Recursive file discovery in the scope phase
Goal
Deliver the file-discovery piece of the file x rule-batch matrix walk for /impl-hygiene-review.
Implementation Sketch
Per the matrix-walk topology: the runtime (scripts/impl_hygiene_review_runtime/) owns the loop; the LLM gets ONE (anchor_file, rule_batch) cell per dispatch. The anchor file is the finding subject; the cell agent reads cross-file context freely (encouraged). Rule content renders from the JSON SSOT generator; per-cell findings flow through the shared finding_emit._classify_finding drop-unless-verified gate into both emission sinks (plan/bug §NN.R.H + raw-context report).
Spec References
.claude/rules/workflow-ownership.md §1— the script owns the loop; one bounded cell per LLM dispatch..claude/rules/script-first.md §1— orchestration lives inscripts/<skill>_runtime/.scripts/impl_hygiene_rules_runtime/— the JSON SSOT generator +category_tokens()(rule content for each batch).- Predecessor:
plans/completed/impl-hygiene-rules-as-data(JSON SSOT + 5-batch decomposition + raw-context report sink).
Work Items
- Add recursive file discovery to the scope phase (dir/crate -> all nested .rs/.py files, not a flat glob)
- Cure the non-recursive gap: a crate scope resolves every file under src/** including nested modules
- Unit-test discovery on a fixture tree with nested module dirs
Items
- Wire recursive discovery into the production scope-phase entry point so a real crate/dir /impl-hygiene-review run enumerates every nested file as a matrix anchor (the file dimension feeding the N_files x N_batches walk)
Fresh intel (regenerated)
{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “impl-hygiene-review-matrix-walk/s-82a1c92a” }, “generated_at”: “2026-06-21T14:33:57.254357+00:00”, “graph_state”: { “head_sha”: “b0bd51a8”, “last_code_import_at”: “2026-06-21T14:23:54.409Z”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:impl-hygiene-review-matrix-walk/s-82a1c92a] agent-authored dossier”, “degraded”: false, “dossier”: { “objective_symbols”: [], “tiers”: {}, “agent_authored”: true, “difficulty”: { “class”: “routine”, “research_online”: false, “research_mode”: “auto”, “signals”: [], “plan_dir”: “/home/eric/projects/ori_lang/plans/impl-hygiene-review-matrix-walk” } } }
(full dossier: file-discovery—s-82a1c92a.intel.json)