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
Test impact analysis and code intelligence for LLM agents. Maps tests to code, code to git history, and answers: "what to run, what's risky, who touched it."
5
+
Test impact analysis and code intelligence **for LLM agents**. The design target is **solo-maintained repos** where **multiple agent sessions or processes** (MCP clients, terminals, CI) may run `analyze` / read tools concurrently — hence **ProcessLock**, **WAL SQLite**, and **normalized paths** as core mechanics, not optional extras.
6
+
7
+
Questions Chisel answers for agents: **what tests matter for a change**, **where risk concentrates**, **what’s untested or stale**, and **git/blame context** when debugging — not headcount or org workflows.
6
8
7
9
## Core Data Model
8
10
@@ -54,10 +56,10 @@ ChiselEngine (engine.py) — main orchestrator
54
56
│ ├── Ownership aggregation from blame blocks
55
57
│ └── Co-change coupling detection
56
58
├── ImpactAnalyzer (impact.py)
57
-
│ ├── Impacted tests (direct + transitive via coupling)
Copy file name to clipboardExpand all lines: CLAUDE.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,14 @@
2
2
3
3
Test impact analysis and code intelligence for LLM agents. Zero external dependencies.
4
4
5
+
## Audience (how to read this project)
6
+
7
+
-**Primary user**: autonomous and semi-autonomous **coding agents** (MCP, CLI invoked by agents), not a stand-alone dashboard for engineering managers.
8
+
-**Typical human**: **solo developer** orchestrating multiple agent sessions, parallel tasks, or long-running analyses — *not* “hand off to another engineer” workflows. Tools like `ownership` / `who_reviews` expose **git-derived context** (blame, commit activity) for debugging and risk heuristics; they are not org-chart features.
9
+
-**Multi-agent safety** (see `project.py`, `ProcessLock`, `RWLock`) exists so **several processes** (agents, terminals, CI) can share one `.chisel/` database without corrupting reads/writes — treat this as a **first-class product requirement**, not an edge case.
10
+
11
+
When editing behavior or docs, prefer: **structured tool results**, **explicit statuses** (`no_data`, `no_changes`, `git_error`), **import-graph + test edges** over relying on git co-change alone, and **clear hints** when MCP would otherwise time out or mis-resolve `project_dir`.
12
+
5
13
## Architecture
6
14
7
15
```
@@ -34,9 +42,9 @@ chisel/
34
42
-**Blame caching**: Cached by file content hash, invalidated on change.
35
43
-**Incremental updates**: File content hashes tracked in `file_hashes` table.
36
44
-**Persistent connection**: Storage uses a single SQLite connection (`check_same_thread=False`) with RWLock for thread safety.
37
-
-**Multi-agent safety**: `project.py` provides: (1) `detect_project_root()` canonicalizes via git common dir so worktrees share identity, (2) `normalize_path()` ensures consistent relative paths, (3) `resolve_storage_dir()` defaults to project-local `.chisel/` (priority: explicit > env > project-local > ~/.chisel/), (4) `ProcessLock` for cross-process coordination — shared locks for reads, exclusive for writes. Cross-platform: `fcntl.flock` on Unix, `LockFileEx` on Windows.
45
+
-**Multi-agent / multi-process safety** (solo dev + parallel agents): `project.py` provides: (1) `detect_project_root()` canonicalizes via git common dir so worktrees share identity, (2) `normalize_path()` ensures consistent relative paths, (3) `resolve_storage_dir()` defaults to project-local `.chisel/` (priority: explicit > env > project-local > ~/.chisel/), (4) `ProcessLock` for cross-process coordination — shared locks for reads, exclusive for writes — so concurrent agent runs and CLI `analyze`/`update` do not interleave destructive storage operations. Cross-platform: `fcntl.flock` on Unix, `LockFileEx` on Windows.
38
46
-**SQLite concurrency**: 30s `busy_timeout` + exponential-backoff retry on `_execute` for cross-process SQLITE_BUSY.
39
-
-**Ownership vs Reviewers**: `ownership` = blame-based (who wrote the code, `role: "original_author"`). `who_reviews` = commit-activity-based (who maintains it, `role: "suggested_reviewer"`).
47
+
-**Ownership vs Reviewers**: `ownership` = blame-based (`role: "original_author"`). `who_reviews` = commit-activity-based (`role: "suggested_reviewer"`). Both are **git-derived signals** for agents (lineage, hot spots); they are not substitutes for team assignment in a solo workflow.
40
48
-**Shared constants**: `_SKIP_DIRS` and `_EXTENSION_MAP` live in `ast_utils.py`. `_CODE_EXTENSIONS` in `engine.py` is derived from `_EXTENSION_MAP`. `_SKIP_DIRS` includes `coverage`, `.next`, `.nuxt` to exclude build/test output artifacts.
41
49
-**Shared dispatch**: `dispatch_tool()` in `mcp_server.py` is used by both HTTP and stdio servers. Tool schemas and dispatch tables live in `schemas.py`.
42
50
-**Edge weighting**: Test edges carry a weight (0.4-1.0) based on file proximity. `_compute_proximity_weight()` in `test_mapper.py`.
Copy file name to clipboardExpand all lines: COMPLETE_PROJECT_DOCUMENTATION.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Chisel -- Complete Project Documentation
2
2
3
-
Test impact analysis and code intelligence for LLM agents. Zero external dependencies.
3
+
Test impact analysis and code intelligence for **LLM agents** in **solo-maintainer** workflows, with **multi-process / multi-agent** safety (shared `.chisel/` storage, locks). Zero external dependencies.
4
4
5
5
**Version:** 0.6.2
6
6
**PyPI:**`chisel-test-impact`
@@ -35,7 +35,7 @@ Test impact analysis and code intelligence for LLM agents. Zero external depende
|`chisel/test_mapper.py`| Test file discovery, framework detection (pytest/Jest/Go/Rust/Playwright), dependency extraction, test edge building |`ast`, `os`, `re`, `pathlib`, `chisel.ast_utils`, `chisel.project`|[glossary: test edge](wiki-local/glossary.md)|
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+19-14Lines changed: 19 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Contributing to Chisel
2
2
3
+
Chisel is built for **LLM agents** and **solo developers** running **multiple agent sessions** on one repo. Contributions should preserve: **stdlib-only runtime**, **structured MCP responses** (status dicts, `next_steps` where applicable), **multi-process safety** (locks around storage), and **import-graph + test edges** as primary signals when git co-change is thin.
4
+
3
5
## Prerequisites
4
6
5
7
- Python 3.11 or later
@@ -18,7 +20,7 @@ This installs Chisel in editable mode along with dev dependencies (pytest, pytes
18
20
## Running Tests
19
21
20
22
```bash
21
-
pytest tests/ -v --tb=short # full suite (567 tests)
23
+
pytest tests/ -v --tb=short # full suite
22
24
pytest tests/test_engine.py # single module
23
25
pytest -k "test_risk"# by name pattern
24
26
```
@@ -37,25 +39,26 @@ Configuration lives in `pyproject.toml` under `[tool.ruff]`.
37
39
38
40
## Architecture Overview
39
41
40
-
See `CLAUDE.md` for the full module map and dependency graph, and `ARCHITECTURE.md` for detailed design documentation.
42
+
See `CLAUDE.md` for the full module map and dependency graph, `ARCHITECTURE.md` for the data model, and `wiki-local/spec-project.md` for MCP tool contracts.
41
43
42
44
The core modules are:
43
45
44
46
| Module | Role |
45
47
|---|---|
46
-
|`engine.py`| Orchestrator; owns all subsystems |
48
+
|`engine.py`| Orchestrator; owns all subsystems; `tool_*()` for MCP|
|`mcp_server.py`| HTTP MCP server (`dispatch_tool`, `next_steps`) |
57
60
|`mcp_stdio.py`| stdio MCP server |
58
-
|`rwlock.py`|Read-write lock for concurrent access|
61
+
|`rwlock.py`|In-process read/write lock (pairs with ProcessLock)|
59
62
60
63
## Guidelines
61
64
@@ -82,12 +85,14 @@ Do not add runtime dependencies.
82
85
83
86
### Adding a New MCP Tool
84
87
85
-
To add a new tool, wire it through four layers:
88
+
To add a new tool, wire it through these layers:
89
+
90
+
1.**Engine method**: Add `tool_<name>(self, ...)` in `engine.py`. Wrap with `self._process_lock.shared()` + `self.lock.read_lock()` for reads, or `exclusive()` + `write_lock()` for writes. Prefer **explicit statuses** (`no_data`, `git_error`, etc.) over ambiguous empty lists for agents.
91
+
2.**Schema + dispatch**: Add the tool schema to `_TOOL_SCHEMAS` and the dispatch entry to `_TOOL_DISPATCH` in `schemas.py`. Use **prescriptive** descriptions (“Use when…”). Both HTTP and stdio servers import these automatically; HTTP responses include **`next_steps`** — add a handler in `next_steps.py` if the new tool should suggest follow-ups.
92
+
3.**CLI handler**: Add a subcommand in `cli.py` when the tool should be human-invokable from the terminal (optional for agent-only tools).
93
+
4.**Tests**: Add tests in `tests/` — at minimum an engine integration test; add CLI tests if you added a subcommand.
86
94
87
-
1.**Engine method**: Add `tool_<name>(self, ...)` in `engine.py`. Wrap with `self._process_lock.shared()` + `self.lock.read_lock()` for reads, or `exclusive()` + `write_lock()` for writes.
88
-
2.**Schema + dispatch**: Add the tool schema to `_TOOL_SCHEMAS` and the dispatch entry to `_TOOL_DISPATCH` in `schemas.py`. Both HTTP and stdio servers import these automatically.
89
-
3.**CLI handler**: Add a subcommand in `cli.py` that calls the engine method and formats output.
90
-
4.**Tests**: Add tests in `tests/` — at minimum an engine integration test and a CLI mock test.
95
+
Keep **multi-agent safety** in mind: long-running writes (`analyze`, `update`) must stay under the process exclusive lock; readers should not block writers longer than necessary.
Re-oriented README, CLAUDE.md, ARCHITECTURE.md, and COMPLETE_PROJECT_DOCUMENTATION.md toward **LLM agents** and **solo developers** running **multiple agent sessions** — emphasizing MCP-first usage, multi-process safety (locks, shared storage), and reframing git-derived “ownership” / “reviewer” tools as audit/heuristic signals rather than team workflows. Updated ecosystem and coupling copy to center import-graph and structured tool results.
11
+
12
+
### Follow-up
13
+
Aligned **`wiki-local/spec-project.md`** (tool specs, 22 tools, import-graph impact, `triage`, locks, `next_steps`, `git_error`) and **`CONTRIBUTING.md`** (agent/solo preamble, architecture table, MCP/tool wiring guidance) to the same positioning.
Copy file name to clipboardExpand all lines: README.md
+23-14Lines changed: 23 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,24 @@
1
1
# Chisel
2
2
3
-
Test impact analysis and code intelligence for LLM agents.
3
+
Test impact analysis and code intelligence **built for LLM agents** — especially when **several agents or sessions** touch the same repo (solo developer, multi-agent workflow).
4
4
5
-
Chisel maps tests to code, code to git history, and answers: **"what to run, what's risky, who touched it."**
5
+
Chisel maps tests to code, code to git history, and answers: **what to run, what’s risky, and where attention should go** — including blame-based lineage when you need audit context (not “team roster” features).
6
6
7
7

8
8
9
+
## Who this is for
10
+
11
+
-**Solo developers** using Cursor, Claude Code, or other MCP clients — not a substitute for human code review queues.
12
+
-**Multi-agent usage**: parallel agent runs, background tasks, or sequential sessions that share one project. Chisel keeps **one consistent graph** (project-local `.chisel/` storage, cross-process locks) so agents don’t corrupt analysis mid-write.
13
+
-**Primary interface**: MCP tools and structured responses (`next_steps`, diagnostic statuses), not dashboards for managers.
14
+
9
15
## The Problem
10
16
11
17
An LLM agent changes `engine.py:store_document()`. It then either:
12
18
- Runs **all** 287 tests (slow, wasteful), or
13
19
- Guesses with `-k "test_store"` (misses regressions)
14
20
15
-
When multiple agents (or agents + humans) work on the same codebase, changes in one area silently break another. Chisel gives agents the intelligence to understand the blast radius of their changes before they commit.
21
+
When **multiple agent runs**(or agents plus you) work on the same codebase, changes in one area can break another. Chisel gives each agent **test impact, import-aware suggestions, and risk signals** so they narrow what to run and where regressions may hide — before you merge or ship.
16
22
17
23
## Install
18
24
@@ -51,7 +57,7 @@ Or run the HTTP server for any MCP-compatible client:
51
57
chisel serve --port 8377
52
58
```
53
59
54
-
Once connected, Claude Code can use all 15 tools directly — `analyze`, `diff_impact`, `suggest_tests`, `risk_map`, and more. Run `analyze` first to build the project graph, then `diff_impact`before each commit to know exactly which tests to run.
60
+
Once connected, agents can call the full tool surface — `analyze`, `diff_impact`, `suggest_tests`, `risk_map`, `triage`, and more. Run `analyze` first to build the project graph, then `diff_impact`after edits to narrow which tests to run. For long analyses on large repos, prefer `chisel analyze` / `chisel update` in a terminal so MCP clients don’t time out.
55
61
56
62
## Use with Cursor / Other MCP Clients
57
63
@@ -109,25 +115,28 @@ chisel test-gaps
109
115
chisel stats
110
116
```
111
117
112
-
## 15 Tools
118
+
## MCP tools (core)
119
+
120
+
Core query and write tools below; the MCP server also exposes **advisory file-lock** helpers for multi-process coordination. See `schemas.py` / `chisel serve` for the full list.
|`churn`| How often does this file/function change? |
122
-
|`ownership`|Who wrote this code? (blame-based) |
123
-
|`who_reviews`|Who maintains this code? (commit-activity-based) |
124
-
|`coupling`|What files always change together?|
130
+
|`ownership`|Blame-based authors (useful for audit / “who wrote this line”) |
131
+
|`who_reviews`|Recent commit activity on the file (heuristic “hot spots”, not org chart) |
132
+
|`coupling`|Co-change partners + **import-graph** neighbors and numeric scores|
125
133
|`risk_map`| Risk scores for all files (churn + coupling + coverage gaps) |
126
134
|`stale_tests`| Tests pointing at code that no longer exists |
127
135
|`test_gaps`| Code units with zero test coverage, sorted by risk |
128
136
|`history`| Commit history for a specific file |
129
137
|`record_result`| Record test pass/fail for future prioritization |
130
138
|`stats`| Database summary counts |
139
+
|`triage`| Composite: top risk + gaps + stale tests in one call |
131
140
132
141
## Features
133
142
@@ -142,19 +151,19 @@ chisel stats
142
151
143
152
## Ecosystem
144
153
145
-
Chisel works standalone or alongside [Stele](https://github.com/IronAdamant/Stele) for multi-agent code coordination. Chisel handles test intelligence; Stele handles document-level context and conflict prevention.
154
+
Chisel is designed to sit **in the agent loop** (MCP): impact → tests → record results → refresh analysis. It works standalone or alongside tools like [Stele](https://github.com/IronAdamant/Stele) for semantic code context — Chisel stays focused on **test graph, git signals, and static imports** for blast-radius reasoning.
146
155
147
156
## Design Notes
148
157
149
158
### Coupling: co-change vs. import-graph
150
159
151
-
Chisel's `coupling` tool has two coupling sources:
160
+
Chisel's `coupling` tool exposes two coupling sources:
152
161
153
-
1.**Co-change coupling** (`co_change_partners`) — files that frequently appear in the same git commits. This signal requires **multiple agents or multiple human collaborators** making separate commits. In solo-agent workflows, there is no co-change signal and this returns 0.0.
162
+
1.**Co-change coupling** (`co_change_partners`) — files that often appear in the same git commits. Stronger when **history has many small commits** (including a solo dev committing often, or multiple agents landing separate commits). Sparse history → thin co-change signal.
154
163
155
-
2.**Import-graph coupling** (`import_partners`) — static `import`/`require` edges between source files. This works in any project and provides structural coupling data even when co-change is absent.
164
+
2.**Import-graph coupling** (`import_partners`, plus numeric `import_coupling` / `effective_coupling`) — static `import`/`require` edges. **Always available** after analysis and is the main structural signal for single-author repos.
156
165
157
-
When co-change is 0.0, import coupling still provides meaningful structural data. The `risk_map` tool uses the maximum of the two coupling sources.
166
+
`risk_map` and impact tools combine both; import graph also powers **transitive test suggestions** (e.g. facade tests covering inner modules).
0 commit comments