Skip to content

feat(setup): skip LLM scan on effectively-empty projects#139

Closed
George-iam wants to merge 1 commit into
mainfrom
feat/skip-llm-scan-empty-project-20260517
Closed

feat(setup): skip LLM scan on effectively-empty projects#139
George-iam wants to merge 1 commit into
mainfrom
feat/skip-llm-scan-empty-project-20260517

Conversation

@George-iam
Copy link
Copy Markdown
Contributor

Summary

Bug: running axme-code setup in a freshly-created empty folder sits for 1-3 minutes with no progress output, then completes with empty oracle/decisions output anyway. Reported 2026-05-17.

Root cause: the four LLM scanners (oracle / decision / safety / deploy) launch in parallel regardless of project content. Each round-trips to Claude generating boilerplate text + empty section markers, even when there's literally nothing in the project tree to analyse. The user has zero progress output between "starting scanners" and "scanners complete".

Fix

A pre-scan check isEffectivelyEmpty(projectPath) that walks the project tree (capped depth 4, early exit at threshold, skips .git/node_modules/build outputs/etc) and counts non-trivial files. If fewer than 3 non-trivial files exist outside boilerplate (README*/LICENSE*/.gitignore/CLAUDE.md/.editorconfig etc), we skip the LLM scanner block entirely and fall through to the existing deterministic init paths (bundlesToDecisions presets + initOracleDeterministic), which run instantly.

User sees a clear message instead of silent waiting:

[project] Project appears empty (< 3 non-trivial files outside
.git/node_modules/etc) — skipping LLM scanners, writing presets +
deterministic oracle only. Re-run with --force after adding code to
get an LLM scan.

Trade-offs

  • Heuristic, not a sandbox. False positive (real project misidentified as empty) results in presets-only setup — user can re-run with --force after adding code.
  • False negative (truly empty project misidentified as non-empty) means we run the LLM scan unnecessarily — annoying but not broken.
  • Threshold of 3 is conservative: a tiny real library is usually 5+ files; a fresh git init with README+.gitignore is 0-1 non-trivial files.

Result-shape stability

The deterministic-oracle fallback at src/tools/init.ts:268-273 already exists for the "no claude CLI installed" path, so the InitResult shape is unchanged when we skip:

  • oracle: { files: 4, llm: false }
  • scannersRun: 0, scannersFailed: 0
  • Telemetry consumers see this exactly like the no-claude path.

Test plan

  • Merge to main
  • mkdir /tmp/empty && cd /tmp/empty && axme-code setup — completes in seconds, prints the "Project appears empty" message, .axme-code/ populated with presets
  • cd path/to/axme-code && axme-code setup --force — still runs full LLM scan (existing behaviour)
  • Existing core test suite (npm test) passes

🤖 Generated with Claude Code

Reported 2026-05-17 by @geobelsky: running `axme-code setup` in a
freshly-created empty folder sits for 1-3 minutes with no progress
output, then completes with empty oracle/decisions output anyway. The
four LLM scanners (oracle / decision / safety / deploy) round-trip to
Claude in parallel, each generating boilerplate text + empty section
markers, even when there's nothing in the project to analyse.

Fix: a pre-scan check that walks the project tree (capped depth, early
exit, skips .git/node_modules/build outputs/etc) and counts non-trivial
files. If fewer than 3 non-trivial files exist outside boilerplate
(README/LICENSE/.gitignore/CLAUDE.md), we skip the LLM scanner block
entirely and fall through to the existing deterministic init paths
(presets + initOracleDeterministic), which run instantly.

User sees a clear message instead of silent waiting:

  [project] Project appears empty (< 3 non-trivial files outside
  .git/node_modules/etc) — skipping LLM scanners, writing presets +
  deterministic oracle only. Re-run with --force after adding code to
  get an LLM scan.

Trade-offs:
- Heuristic, not a sandbox. False positive (real project misidentified
  as empty) results in presets-only setup — the user can re-run after
  adding code or with --force.
- False negative (truly empty project misidentified as non-empty) means
  we run the LLM scan unnecessarily — annoying but not broken.
- Threshold of 3 is conservative: even a tiny library is usually 5+
  files; a fresh `git init` + README is 0-1 non-trivial files.

The deterministic-oracle fallback (lines 268-273) already exists for
the "no claude CLI installed" path, so the result shape is unchanged —
oracle.files = 4, oracle.llm = false, scanners.run = 0,
scanners.failed = 0. Telemetry consumers see this as a fast no-LLM
setup, same as the no-claude-installed path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@George-iam
Copy link
Copy Markdown
Contributor Author

Reverting on user feedback — the oracle scanner reads more than just local project files: it pulls in ~/.claude/projects/<encoded-path>/memory/ (cross-session auto-memory) plus CLAUDE.md / AGENTS.md / .cursorrules cascade. Skipping the LLM block on empty-looking project folders would silently lose all that accumulated context. Better to keep the slow path than ship a regression. Closing without merge; branch feat/skip-llm-scan-empty-project-20260517 left in place in case we revisit with a more selective skip later.

@George-iam George-iam closed this May 17, 2026
@George-iam George-iam deleted the feat/skip-llm-scan-empty-project-20260517 branch May 17, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant