Repository navigation
Conversation
Each LLM call with claude_cli starts a separate `claude -p` session. A user scanning 15 skills (five scans in parallel) started 434 sessions in about 6 minutes and used 98% of their 5-hour plan window, at roughly 34k tokens of startup context per session. - claude argv: add `--tools ""` so built-in tool schemas are not sent (`--allowed-tools ""` only denies use), replace the default agent system prompt with a short fixed one, and pass `--no-session-persistence` so calls stop leaving one ~/.claude/projects folder each. - Default LLM fan-out to 2 for CLI providers when SKILLSPECTOR_MAX_LLM_CONCURRENCY is unset (HTTP providers keep 10). - Warn once per process when a CLI provider is available that every LLM call is a separate session on the user's plan, and point to --no-llm. - skill-inspector: keep --no-llm unless the user asks, never pick a provider on the agent's own, and don't run CLI-provider scans in parallel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
|
Thanks for proactively working on this, will review this on monday. |
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
@rng1995 thank you for turning a real user's cost report into a focused fix with clearly stated limits.
This PR is authored by the review bot account, so this review can only COMMENT. A human maintainer must review and approve (or request changes).
Value and readiness
The problem is real: per-call startup context, persisted sessions, and a default 10-way fan-out billed to the user's plan. The argv changes and the lower CLI default are coherent, and an explicit SKILLSPECTOR_MAX_LLM_CONCURRENCY still wins. It is not ready to approve: the cost warning fires after the cost it warns about, and the new claude flags have not been run against a real binary.
Material findings
- Blocker,
src/skillspector/providers/_agent_cli_base.py:82: the warning is emitted fromis_available(), butskillspector scannever calls that before the fan-out. On the scan path the only caller is the report node (nodes/report.py:1819, and_build_metadataat:1264, viais_llm_available()), which runs after every semantic analyzer andmeta_analyzer. A CLI-provider scan therefore prints the warning only after the sessions have run, contrary to the docstring ("before any LLM call fans out") and the PR description. The MCP server probes up front (mcp_server.py:145), so it warns in time there; and since #806 (now merged into this branch)--no-llmscans no longer probe, so they correctly stay silent. Please warn where CLI-provider LLM work actually starts, for example inget_chat_model()when it builds anAgentCLIChatModel(llm_utils.py:616-618) or at the start ofarun_batches_detailedwhen the active provider is a CLI provider, and add a test that the warning is logged before the firstcomplete()call of a scan. - Blocker (verification),
src/skillspector/providers/_agent_cli.py:285-289:--tools "",--system-promptand--no-session-persistencewere checked only against the CLI reference. Replacing Claude Code's system prompt is the change most likely to interact with subscription (OAuth) logins, the mainclaude_cliauth path.claude_clialso has no version gate: an olderclaudethat lacks a flag passesclaude auth status, and then every call fails, so semantic coverage is reported as degraded (honest, but total). As the description asks, a maintainer withclaudeinstalled should run oneSKILLSPECTOR_PROVIDER=claude_cliscan, ideally with a subscription login, and confirm auth, output parsing, and that no~/.claude/projectsfolders appear.
PIC tradeoffs
- Coverage vs. cost: the scan's 600 s workflow budget (
DEFAULT_MAX_WORKFLOW_SECONDS,state.py:46) also bounds the semantic analyzers. At a 2-way fan-out the LLM phase of a CLI scan can take up to ~5x longer, so larger skills will more often end withruntime_limitgaps in semantic coverage. Those gaps are reported honestly, but the default now favors cost over coverage. The warning could also mentionSKILLSPECTOR_MAX_WORKFLOW_SECONDS. - The skill-inspector rule (keep
--no-llmunless the user asks) is a sensible default, but it changes product behavior for agent-driven scans.
Verification and gaps
- Read the full diff at
8fdefc92. Its own change has the same patch-id as at9881bafc(cfd4e64a+fb2b70d2); the new head only mergesmain, including #806. - Traced every
is_available()/is_llm_available()caller on the scan and MCP paths;resolve_max_concurrencythrougharun_batches_detailedand_shared_limiter; andget_active_providerselection (cheap, no probing). - #806 does not touch
_agent_cli*.pyorllm_analyzer_base.py; its report and MCP changes narrow finding 1 to timing. - Not run: tests or a
claudebinary (none is installed here). CI on the head isaction_required; the last completed run (e47a7d4c) was green.
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
skillspector scan only probes is_available() from the report node, after every semantic analyzer has run, so the session-cost warning arrived after the cost. get_chat_model() now warns (once per process) when it builds a CLI-provider chat model, before the analyzers fan out. The MCP server's up-front probe still warns through is_available(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
|
Follow-up on the two review blockers, plus the merge with 1. The cost warning arrived after the cost. Fixed in 0f51020; see the review thread for details. 2. Checking the new
Merge with Tests:
|
|
Live Setup: Claude Code 2.1.293, signed in with a claude.ai subscription login ( Results:
Unrelated noise, not from this PR: CLI providers also log |
Why
A user on r/ClaudeAI (thread) asked Claude Code to scan their 15 skills with SkillSpector. The agent picked
claude_clion its own and ran five scans in parallel. Because every LLM call starts a separateclaude -psession, that came to 434 sessions in about 6 minutes, 22.4M tokens (about 34k of startup context per session, on Opus), and 98% of their 5-hour plan window. It also left 1,144 folders in~/.claude/projects.#298 (for #295) already keeps MCP servers, hooks, and settings out of the child. Three costs were still left: the built-in tool schemas, Claude Code's default agent system prompt, and a persisted transcript for every call.
Changes
--tools "", so the built-in tool definitions are no longer sent.--allowed-tools ""only blocks tool use (CLI reference). Also replace the default system prompt with a short fixed one via--system-prompt; the analyzer instructions still arrive on stdin.--no-session-persistence. Each call runs in a fresh temp cwd, so before this change every call left its own project folder.SKILLSPECTOR_MAX_LLM_CONCURRENCYis unset and the active provider is a CLI provider, the default is now 2 instead of 10. Once per process, when a CLI provider is available, SkillSpector warns that every LLM call is a separate session on the user's plan and points to--no-llm.--no-llmunless the user asks for LLM analysis. Never choose or changeSKILLSPECTOR_PROVIDERwithout asking. Don't run CLI-provider scans in parallel.Not in this PR
Testing
uv run python -m pytest tests/unit/test_agent_cli.py tests/unit/test_providers.py tests/nodes/test_llm_analyzer_base.py: 539 passed, 10 skipped. New tests cover the argv flags, the CLI concurrency default (and that an explicit value still wins), and the warn-once behaviour.ruff checkandruff format --checkare clean.claudebinary. Before merge, a maintainer withclaudeinstalled should run oneSKILLSPECTOR_PROVIDER=claude_cliscan to confirm that auth still works and the output parses. Olderclaudebuilds that lack--toolsor--no-session-persistencewill fail closed with a non-zero exit.🤖 Generated with Claude Code