You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Structured next_steps: hints are now {"tool", "args", "reason"} dicts
instead of prose strings, so LLM agents can directly invoke suggestions.
Non-tool guidance uses {"action", "reason"}.
Diagnostic diff_impact: returns {status: "no_changes", ref, branch, message}
instead of bare [] when no diff found — LLMs can now reason about why.
Stats coupling_threshold: exposes the adaptive threshold so LLMs can
explain coupling=0.0 (threshold too high for project's change patterns).
Schema descriptions rewritten with prescriptive "Use when..." language
and cross-references between related tools.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,9 @@ chisel/
46
46
-**Numstat validation**: `_parse_log_output` in `git_analyzer.py` validates tab-separated fields are digits or `-` before treating them as numstat. Diff lines with tabs were being misidentified as numstat entries in `git log -L` output.
47
47
-**Encoding safety**: All `subprocess.run()` calls use `encoding="utf-8", errors="replace"`. Git history may contain non-UTF-8 bytes (Latin-1 commit messages, binary diff fragments); these are replaced with `�` instead of crashing. File reads in `engine.py` and `test_mapper.py` already used `errors="replace"`.
48
48
-**Empty-state detection**: All 12 query tools return `{"status": "no_data", "message": "...", "hint": "chisel analyze"}` when the DB has no analysis data, instead of `[]`. `_check_analysis_data()` in `engine.py` calls `storage.has_analysis_data()` (`SELECT 1 FROM code_units LIMIT 1`). Write tools (`analyze`, `update`, `record_result`) and `stats` are unaffected. `stats` adds a `hint` key when all counts are zero. CLI detects this via `_is_no_data()` in `cli.py`.
49
-
-**Next-step suggestions**: `next_steps.py` provides `compute_next_steps(tool_name, result)` which returns contextual follow-up suggestions per tool. Integrated at the dispatch level in `mcp_server.py` — HTTP responses include `"next_steps": [...]` as a sibling to `"result"`, stdio wraps both in a `{"result": ..., "next_steps": [...]}` envelope. CLI is unaffected. Only tools with registered hint functions get suggestions; others return empty.
49
+
-**Next-step suggestions**: `next_steps.py` provides `compute_next_steps(tool_name, result)` which returns structured suggestions per tool. Each hint is a dict: `{"tool": "...", "args": {...}, "reason": "..."}` for tool invocations, or `{"action": "...", "reason": "..."}` for non-tool guidance. LLM agents can directly invoke suggested tools without parsing prose. Integrated at the dispatch level in `mcp_server.py` — HTTP responses include `"next_steps": [...]` as a sibling to `"result"`, stdio wraps both in a `{"result": ..., "next_steps": [...]}` envelope. CLI is unaffected. Only tools with registered hint functions get suggestions; others return empty.
50
+
-**Diagnostic empty responses**: `diff_impact` returns `{"status": "no_changes", "ref": ..., "branch": ..., "message": ...}` instead of bare `[]` when no diff is found. CLI `_is_no_data()` handles both `"no_data"` and `"no_changes"` status values. `_hints_diff_impact` in `next_steps.py` handles the diagnostic dict case, suggesting `diff_impact` with `HEAD~1` or `update`.
51
+
-**LLM-prescriptive schema descriptions**: Tool descriptions in `schemas.py` use prescriptive language ("Use when...", "Use after...") to help LLM agents decide which tool to call. Cross-references between related tools (ownership↔who_reviews, analyze↔update, impact↔diff_impact). Coupling description references `stats` for threshold visibility.
50
52
-**Inline coupling partners**: `risk_map` includes `"coupling_partners"` (top 3 by co-commit count) in each file entry alongside the breakdown. Data is already fetched in the batch query — no extra DB calls.
51
53
-**Triage tool**: Composite `triage` runs `risk_map` (top-N) + `test_gaps` (filtered to top-N files) + `stale_tests` in a single read lock. Returns a dict, not a list, so `limit` is not injected.
52
54
@@ -81,11 +83,11 @@ next_steps.py → (no internal deps)
81
83
82
84
Each wired through: engine.tool_*() → CLI subcommand, HTTP POST /call, stdio MCP.
83
85
84
-
-**`diff_impact`**: Auto-detects changed files/functions from `git diff` and returns impacted tests. Branch-aware: on feature branches diffs against main; on main diffs against HEAD.
86
+
-**`diff_impact`**: Auto-detects changed files/functions from `git diff` and returns impacted tests. Branch-aware: on feature branches diffs against main; on main diffs against HEAD. Returns diagnostic dict (`status: "no_changes"`) with `ref`, `branch`, `message` when no diff is found, instead of bare `[]`.
85
87
-**`update`**: Incremental re-analysis — only re-processes changed files and new commits.
86
88
-**`test_gaps`**: Finds code units with zero test coverage, prioritized by churn risk. Excludes test files by default.
87
89
-**`record_result`**: Records test pass/fail outcomes. Feeds into `suggest_tests` (failure rate boost) and `risk_map` (test instability component).
88
-
-**`stats`**: Returns summary counts for all database tables (code units, tests, edges, commits, etc.).
90
+
-**`stats`**: Returns summary counts for all database tables plus `coupling_threshold` (when commits > 0) so LLM agents can diagnose coupling=0.0 results.
89
91
-**`triage`**: Combined risk_map + test_gaps + stale_tests for top-N riskiest files. Single command for pre-audit/refactor prioritization. Returns `{top_risk_files, test_gaps, stale_tests, summary}`.
90
92
-**`limit` parameter**: All list-returning tools accept `limit` to cap result size.
0 commit comments