codecartographer-pi 0.6.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codecarto/GUIDE.md +2 -0
- package/README.md +275 -219
- package/assets/logo.svg +42 -0
- package/dist/core/dashboard.d.ts +42 -0
- package/dist/core/dashboard.js +637 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/core/library.d.ts +157 -0
- package/dist/core/library.js +675 -0
- package/dist/core/orchestrator-config.d.ts +38 -0
- package/dist/core/orchestrator-config.js +86 -19
- package/dist/core/pipeline.js +15 -3
- package/dist/core/prompts.d.ts +12 -1
- package/dist/core/prompts.js +15 -6
- package/dist/core/usage.js +15 -1
- package/dist/core/utils.d.ts +21 -0
- package/dist/core/utils.js +44 -1
- package/dist/core/workspace.d.ts +1 -0
- package/dist/core/workspace.js +13 -1
- package/dist/extensions/codecarto/auto-runner.d.ts +96 -0
- package/dist/extensions/codecarto/auto-runner.js +403 -0
- package/dist/extensions/codecarto/dashboard-flags.d.ts +6 -0
- package/dist/extensions/codecarto/dashboard-flags.js +17 -0
- package/dist/extensions/codecarto/dashboard-narrator.d.ts +8 -0
- package/dist/extensions/codecarto/dashboard-narrator.js +182 -0
- package/dist/extensions/codecarto/dashboard-writer.d.ts +1 -0
- package/dist/extensions/codecarto/dashboard-writer.js +148 -0
- package/dist/extensions/codecarto/index.js +98 -208
- package/dist/extensions/codecarto/next-flags.d.ts +4 -0
- package/dist/extensions/codecarto/next-flags.js +19 -6
- package/dist/mcp-server/server.d.ts +21 -0
- package/dist/mcp-server/server.js +305 -3
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,127 +1,77 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/logo.svg" alt="CodeCartographer logo" width="96" height="96">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# CodeCartographer
|
|
2
6
|
|
|
3
7
|
[](https://github.com/HuginnIndustries/CodeCartographer/actions/workflows/ci.yml)
|
|
4
8
|
[](LICENSE)
|
|
5
9
|
[](https://www.npmjs.com/package/codecartographer-pi)
|
|
10
|
+
[](package.json)
|
|
6
11
|
|
|
7
|
-
A structured reverse-engineering
|
|
8
|
-
|
|
9
|
-
## What It Does
|
|
12
|
+
> **A structured pipeline for reverse-engineering unfamiliar codebases with an LLM.** Drop it into any repo, point an LLM at the guide, and walk away with a layered analysis: architecture map, behavioral contracts, protocol documentation, defect report, porting bundle, and a language-agnostic reimplementation spec. Every finding is evidence-tagged. Every phase output is validated before the next one starts.
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
```text
|
|
15
|
+
● CodeCartographer
|
|
16
|
+
├─ ✓ architecture phase ⟳ 25 · 76 tool uses · 1.0M tokens · 4m28s
|
|
17
|
+
├─ ✓ defect-scan-mech. ⟳ 39 · 91 tool uses · 2.4M tokens · 7m05s
|
|
18
|
+
└─ ⠹ contracts phase ⟳ 11 · 37 tool uses · 335.1k tokens · 40.1s
|
|
19
|
+
⎿ extracting behavioral contracts from server/index.ts…
|
|
20
|
+
```
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
---
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
## At a glance
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
| What you get | Where it lives |
|
|
27
|
+
|---|---|
|
|
28
|
+
| **Layered analysis pipeline** — architecture → defect scan → behavioral contracts → protocols → porting → reimplementation spec | `.codecarto/` template |
|
|
29
|
+
| **Validation gates between phases** — no advancing past a `FAIL` output | `core/` state machine |
|
|
30
|
+
| **Three surfaces, one framework** — Pi extension (recommended), MCP server (for other coding agents), or drop-in template (one-off / evaluation) | All three share `core/` |
|
|
31
|
+
| **Live progress widget** while phase sub-agents work | Pi extension |
|
|
32
|
+
| **HTML dashboard** — single-file aggregate of progress, links, usage, narrative | `.codecarto/dashboard.html` |
|
|
33
|
+
| **Per-phase token tracking** | `/codecarto-usage` |
|
|
34
|
+
| **Opt-in LLM steering** of the next phase's seed prompt | `/codecarto-next --llm-steer` |
|
|
22
35
|
|
|
23
|
-
**
|
|
36
|
+
> **Forward-flow synthesis is underway.** v0.9.0 adds the experimental library foundation and MCP publish/list/reindex tools for accumulating `reimplementation-spec.md` artifacts in a git-trackable library. The Pi publish UX and synthesis pipeline that turns selected library entries plus a vision into `project-plan.md` are still in progress. See [`docs/synthesis-roadmap.md`](docs/synthesis-roadmap.md) for the implementation tracker.
|
|
24
37
|
|
|
25
|
-
|
|
26
|
-
# Edit .codecarto/workflow/status.yaml and set the pipeline field:
|
|
27
|
-
pipeline: workflow/pipeline-full-with-deep-audit.yaml # 7-phase with split defect scan (default; depth-first)
|
|
28
|
-
pipeline: workflow/pipeline-full-with-audit.yaml # 6-phase with single early defect scan
|
|
29
|
-
pipeline: workflow/pipeline.yaml # 5-phase without defect scan — remove defect-scan phases
|
|
30
|
-
pipeline: workflow/pipeline-defect-scan.yaml # 2-phase defect audit — remove contracts through reimplementation-spec
|
|
31
|
-
pipeline: workflow/pipeline-lite.yaml # 3-phase understanding — remove defect-scan phases, porting, and reimplementation-spec
|
|
32
|
-
pipeline: workflow/pipeline-architecture-only.yaml # 1-phase quick overview — keep only architecture
|
|
33
|
-
```
|
|
38
|
+
---
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
## Install
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
Read .codecarto/GUIDE.md and begin the analysis.
|
|
39
|
-
```
|
|
42
|
+
Three surfaces, in recommended order. All three share the same `core/` and produce byte-identical phase prompts — but the user experience differs by surface, and new features (live widget, dashboard, auto-runner, the upcoming library + synthesis workflows) land on Pi first, MCP second, drop-in last.
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
1. **Pi extension** — recommended for interactive use. First-class UX.
|
|
45
|
+
2. **MCP server** — for Claude Code, Codex, opencode, Cursor, Claude Desktop, and any other MCP-capable agent.
|
|
46
|
+
3. **Drop-in template** — pure `.codecarto/` markdown + YAML for one-off evaluation or any LLM that can read and write files. Library and synthesis workflows are **not** available in pure drop-in mode; the analysis side works fully.
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
### Pi extension (recommended)
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Install from npm, a local checkout, or a git URL:
|
|
50
|
+
[Pi](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent) is a TUI coding agent. The CodeCartographer extension adds slash commands, a live agents widget, and the dashboard.
|
|
48
51
|
|
|
49
52
|
```bash
|
|
50
|
-
pi install npm:codecartographer-pi
|
|
51
|
-
#
|
|
52
|
-
pi install /
|
|
53
|
-
# or, from a git URL:
|
|
54
|
-
pi install git:github.com/your-user/CodeCartographer
|
|
53
|
+
pi install npm:codecartographer-pi # from the npm registry
|
|
54
|
+
pi install /absolute/path/to/CodeCartographer # from a local checkout
|
|
55
|
+
pi install git:github.com/HuginnIndustries/CodeCartographer # from a git URL
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
> **Don't run `npm install codecartographer-pi` for the Pi use case
|
|
58
|
+
> **Don't** run `npm install codecartographer-pi` for the Pi use case. Plain `npm install` puts the package on disk but doesn't register it with Pi. Use `pi install npm:...` so Pi writes the package into its own `~/.pi/agent/settings.json`.
|
|
58
59
|
|
|
59
|
-
For extension development,
|
|
60
|
+
For extension development, point Pi directly at the entrypoint:
|
|
60
61
|
|
|
61
62
|
```bash
|
|
62
63
|
pi -e /absolute/path/to/CodeCartographer/extensions/codecarto/index.ts
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Then in the target repository:
|
|
68
|
-
|
|
69
|
-
```text
|
|
70
|
-
/codecarto-init [full-with-deep-audit|full-with-audit|full|defect-scan|lite|architecture-only]
|
|
71
|
-
/codecarto-status
|
|
72
|
-
/codecarto-next
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
If you install the whole repository as a Pi package, Pi may still run package installation steps for the package itself, but the CodeCartographer extension does not depend on any third-party runtime modules.
|
|
76
|
-
|
|
77
|
-
What the Pi extension adds:
|
|
78
|
-
|
|
79
|
-
- `/codecarto-init` to copy `.codecarto/` into the current repository
|
|
80
|
-
- `/codecarto-next [--llm-steer | --no-llm-steer]` to spawn the next eligible phase as a sub-agent (the optional flag opts into the LLM-rewriter for the seed prompt; see *Phase orchestration* below)
|
|
81
|
-
- `/codecarto-status` to show current phase progress
|
|
82
|
-
- `/codecarto-validate` and `/codecarto-complete` for validation-gated status updates
|
|
83
|
-
- `/codecarto-phase <id>` to force a specific phase even out of pipeline order
|
|
84
|
-
- `/codecarto-skill <name>` to run a post-pipeline skill once all phases are complete
|
|
85
|
-
- `/codecarto-usage` to show cumulative + per-phase token usage from local phase runs (0.6.0+)
|
|
86
|
-
- a footer/widget showing the active CodeCartographer phase, plus a live **Agents** widget above the editor while a phase sub-agent is running
|
|
87
|
-
- tool interception that blocks `edit` and `write` outside `.codecarto/`
|
|
88
|
-
- direct phase prompts that tell Pi exactly which `.codecarto/findings/<phase>/SKILL.md` file to read, without registering those internal files as global Pi skills
|
|
89
|
-
|
|
90
|
-
### Phase orchestration (0.2.0 – 0.6.0)
|
|
91
|
-
|
|
92
|
-
`/codecarto-next` runs each phase as an isolated `AgentSession` while your TUI stays on the orchestrator session. The phase's tool calls, file reads, and reasoning live in the child's own context window — they never accumulate in the orchestrator. A persistent **Agents** widget appears above the editor while a phase is running, showing live tool count, token usage, elapsed time, and the current activity. The widget auto-clears once the phase finishes (and lingers a few seconds after for visibility).
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
● CodeCartographer
|
|
96
|
-
└─ ⠹ architecture phase ⟳ 3 · 5 tool uses · 12.3k tokens · 1m32s
|
|
97
|
-
⎿ reading…
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Capabilities layered on top of the parallel-widget runner:
|
|
101
|
-
|
|
102
|
-
- **0.3.0 — file-backed sessions.** Phase sub-agents persist their transcripts to the same `~/.pi/agent/sessions/<encoded-cwd>/` directory the orchestrator uses, so Pi's `/resume`, `/tree`, and `/export` browse them as first-class sessions. The picker shows them with an explicit `CodeCartographer phase: <id>` name and lineage back to the orchestrator's own session.
|
|
103
|
-
- **0.4.0 — phase-completion summary.** When a phase finishes (completed, aborted, or errored), a Markdown closeout block is appended to the orchestrator's transcript via `pi.sendMessage(...)`. You see it in the TUI scrollback; the orchestrator's LLM picks it up as context on your next message. No auto-trigger — control of the next step stays with you.
|
|
104
|
-
- **0.5.0 — opt-in LLM-steered seed prompt.** Set `orchestrator.llm_steer_next_phase: true` in `.codecarto/workflow/config.yaml`, or pass `--llm-steer` per invocation, and the orchestrator's model will run a one-shot rewriter that reads the previous phase's closeout and customizes the next phase's seed prompt to highlight relevant prior findings. Off by default — extra orchestrator-side tokens, opt-in.
|
|
105
|
-
- **0.6.0 — local usage log.** Each phase run is appended to `.codecarto/workflow/.usage.local.yaml` (gitignored). `/codecarto-usage` reports cumulative + per-phase totals. Best-effort logging — write failures don't surface as phase errors.
|
|
106
|
-
|
|
107
|
-
Versions 0.1.3 – 0.1.4 used a different design — a session-switching pattern via `ctx.newSession()` that flipped the TUI to the child. That delivered context isolation but the switch was visually invisible during normal flow, so 0.2.0 replaced it with the parallel-widget approach. 0.1.x workspaces don't need migration; existing `.codecarto/` directories work with 0.6.0 unchanged.
|
|
108
|
-
|
|
109
|
-
The MCP-server path is unaffected — it has no session concept; the host (Claude Desktop / Claude Code / etc.) is always the orchestrator. `/codecarto-usage` is Pi-only; the MCP path doesn't run sub-agents itself, so there's no per-phase usage to track on that side.
|
|
66
|
+
### MCP server (for other coding agents)
|
|
110
67
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
The same framework is also packaged as a [Model Context Protocol](https://modelcontextprotocol.io) server, so any MCP-compatible host (Claude Code, Claude Desktop, etc.) can drive a CodeCartographer workflow without the Pi runtime. The server imports the same `core/` primitives the Pi extension uses, so phase prompts and validation are byte-identical across both surfaces.
|
|
114
|
-
|
|
115
|
-
Implements MCP spec revision [`2025-11-25`](https://modelcontextprotocol.io/specification/2025-11-25) via `@modelcontextprotocol/sdk` ≥ 1.29.0. The negotiated `protocolVersion` reflects whatever the connecting client requests; the server accepts every revision the SDK supports (currently `2025-11-25`, `2025-06-18`, `2025-03-26`, `2024-11-05`, `2024-10-07`).
|
|
116
|
-
|
|
117
|
-
Install and wire it up:
|
|
68
|
+
Use this when your coding agent isn't Pi — Claude Code, Codex, opencode, Cursor, Claude Desktop, or anything else that speaks MCP. The host drives the conversation and runs the LLM; CodeCartographer provides phase prompts, validation, and experimental library publish/list/reindex operations.
|
|
118
69
|
|
|
119
70
|
```bash
|
|
120
71
|
npm install --global codecartographer-pi
|
|
121
|
-
# or, in a project: npm install codecartographer-pi
|
|
122
72
|
```
|
|
123
73
|
|
|
124
|
-
Add
|
|
74
|
+
Add to your host config (`~/.config/claude-code/config.json`, `claude_desktop_config.json`, etc.):
|
|
125
75
|
|
|
126
76
|
```json
|
|
127
77
|
{
|
|
@@ -133,67 +83,194 @@ Add it to your MCP host config (Claude Code: `~/.config/claude-code/config.json`
|
|
|
133
83
|
}
|
|
134
84
|
```
|
|
135
85
|
|
|
136
|
-
|
|
86
|
+
### Drop-in template (one-off / evaluation)
|
|
137
87
|
|
|
138
|
-
|
|
139
|
-
|---|---|---|
|
|
140
|
-
| `codecarto_init` | Copy `.codecarto/` into the target repo and select a pipeline | `/codecarto-init` |
|
|
141
|
-
| `codecarto_status` | Current phase, active pipeline, progress, open questions | `/codecarto-status` |
|
|
142
|
-
| `codecarto_next` | Return the next eligible phase prompt as text | `/codecarto-next` |
|
|
143
|
-
| `codecarto_phase` | Return a specific phase's prompt (forced, even out of order) | `/codecarto-phase` |
|
|
144
|
-
| `codecarto_validate` | Validate a phase output, returning structured criteria rows | `/codecarto-validate` |
|
|
145
|
-
| `codecarto_complete` | Atomically mark a phase complete after validation passes | `/codecarto-complete` |
|
|
146
|
-
| `codecarto_skill` | Return a post-pipeline skill prompt | `/codecarto-skill` |
|
|
88
|
+
Use this to try CodeCartographer in any repo without installing anything, or in environments where neither Pi nor an MCP-capable agent is available. Works with any LLM that can read and write files.
|
|
147
89
|
|
|
148
|
-
|
|
90
|
+
```bash
|
|
91
|
+
cp -r /path/to/CodeCartographer/.codecarto /path/to/your-repo/
|
|
92
|
+
```
|
|
149
93
|
|
|
150
|
-
|
|
94
|
+
Then in the LLM session: `Read .codecarto/GUIDE.md and begin the analysis.`
|
|
95
|
+
|
|
96
|
+
> **Limitation.** Drop-in mode runs the analysis pipeline fully, but library + synthesis workflows require executable code. Publishing and reading library entries are currently available through the MCP server; Pi publish UX and project-plan synthesis are still in progress. See [`docs/synthesis-roadmap.md`](docs/synthesis-roadmap.md) for the planned scope.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## How it works
|
|
101
|
+
|
|
102
|
+
The "code" is structured Markdown + YAML inside `.codecarto/`:
|
|
103
|
+
|
|
104
|
+
- **`GUIDE.md`** — LLM entry point. Every session reads this first.
|
|
105
|
+
- **`workflow/pipeline.yaml`** — phase definitions, dependencies, output paths.
|
|
106
|
+
- **`workflow/status.yaml`** — mutable per-project state. Single source of truth for progress.
|
|
107
|
+
- **`workflow/VALIDATE.md`** — validation protocol run after every phase.
|
|
108
|
+
- **`findings/<phase>/SKILL.md`** — detailed analysis instructions per phase.
|
|
109
|
+
- **`templates/`** — output templates that enforce consistent structure.
|
|
110
|
+
|
|
111
|
+
Phases form a DAG: `contracts` and `protocols` can run in parallel after `architecture`; `porting` waits for both; `reimplementation-spec` is last. The host (Pi, MCP, or your shell) reads the active pipeline, finds the next phase whose dependencies are all `complete`, hands the LLM that phase's instructions, validates the output, and advances `status.yaml`.
|
|
112
|
+
|
|
113
|
+
For multi-session work, every new session reads `.codecarto/GUIDE.md` (or the lighter `NEW_THREAD_BLURB.md`), checks `workflow/status.yaml`, and picks up where the last session left off. You don't explain what happened in previous sessions.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Phases produce these artifacts
|
|
151
118
|
|
|
152
119
|
| Artifact | Description |
|
|
153
120
|
|---|---|
|
|
154
|
-
| Architecture map | Layers, dependency direction, public surfaces, runtime lifecycle, concurrency model |
|
|
155
|
-
| Defect report | Multi-pass scan for logic errors, security issues, concurrency bugs, API violations |
|
|
156
|
-
| Defect fix tracker | Remediation log mapping each fix, deferral, or acceptance back to the defect report |
|
|
157
|
-
| Behavioral contracts | Feature-by-feature behavior with defaults, error handling, and acceptance tests |
|
|
158
|
-
| Protocols and state | Event flows, state machines, persistence formats, compatibility hazards |
|
|
159
|
-
| Porting bundle | Everything synthesized into a porting-oriented view with priority rankings |
|
|
160
|
-
| Reimplementation spec | Language-agnostic build plan with modules, acceptance scenarios, and known unknowns |
|
|
121
|
+
| **Architecture map** | Layers, dependency direction, public surfaces, runtime lifecycle, concurrency model |
|
|
122
|
+
| **Defect report** | Multi-pass scan for logic errors, security issues, concurrency bugs, API violations |
|
|
123
|
+
| **Defect fix tracker** | Remediation log mapping each fix, deferral, or acceptance back to the defect report |
|
|
124
|
+
| **Behavioral contracts** | Feature-by-feature behavior with defaults, error handling, and acceptance tests |
|
|
125
|
+
| **Protocols and state** | Event flows, state machines, persistence formats, compatibility hazards |
|
|
126
|
+
| **Porting bundle** | Everything synthesized into a porting-oriented view with priority rankings |
|
|
127
|
+
| **Reimplementation spec** | Language-agnostic build plan with modules, acceptance scenarios, and known unknowns |
|
|
128
|
+
|
|
129
|
+
Every finding is tagged with an evidence level: `observed fact`, `strong inference`, `portability hazard`, or `open question`. Every phase output is validated against explicit completion criteria before the pipeline advances.
|
|
161
130
|
|
|
162
|
-
|
|
131
|
+
---
|
|
163
132
|
|
|
164
|
-
## Pipeline
|
|
133
|
+
## Pipeline variants
|
|
165
134
|
|
|
166
|
-
|
|
135
|
+
The default is a 7-phase run that splits the defect scan into a mechanical early pass and a semantic late pass — the reimplementation phase then designs around defects with full contracts and protocols context. Scale back if you want less:
|
|
167
136
|
|
|
168
137
|
| Variant | Phases | Use when |
|
|
169
138
|
|---|---|---|
|
|
170
139
|
| **Full with deep audit** (default) | 7 | Complete analysis with split defect scan; reimplementation grounded in contracts/protocols-aware defect findings |
|
|
171
|
-
| **Full with audit** | 6 | Single early defect scan; cheaper than the deep variant when
|
|
140
|
+
| **Full with audit** | 6 | Single early defect scan; cheaper than the deep variant when defects are mostly mechanical |
|
|
172
141
|
| **Full** | 5 | Porting or reimplementation without any defect scan |
|
|
173
142
|
| **Defect scan** | 2 | Maintenance audit to surface latent problems |
|
|
174
143
|
| **Lite** | 3 | You need to understand behavior without porting plans |
|
|
175
144
|
| **Architecture only** | 1 | Quick structural overview |
|
|
176
145
|
|
|
177
|
-
|
|
146
|
+
Set the active pipeline by editing `workflow/status.yaml`'s `pipeline:` field, or pass it as the argument to `/codecarto-init`.
|
|
178
147
|
|
|
179
|
-
|
|
148
|
+
**On disk:**
|
|
180
149
|
|
|
181
|
-
|
|
|
150
|
+
| Variant | Pipeline file |
|
|
182
151
|
|---|---|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
|
|
|
186
|
-
|
|
|
187
|
-
|
|
|
188
|
-
|
|
|
152
|
+
| Full with deep audit (**default**) | `workflow/pipeline-full-with-deep-audit.yaml` |
|
|
153
|
+
| Full with audit | `workflow/pipeline-full-with-audit.yaml` |
|
|
154
|
+
| Full | `workflow/pipeline.yaml` |
|
|
155
|
+
| Defect scan | `workflow/pipeline-defect-scan.yaml` |
|
|
156
|
+
| Lite | `workflow/pipeline-lite.yaml` |
|
|
157
|
+
| Architecture only | `workflow/pipeline-architecture-only.yaml` |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## The dashboard
|
|
162
|
+
|
|
163
|
+
Every state change re-renders `.codecarto/dashboard.html` — a self-contained single-file artifact you open in any browser. Aggregates everything a human wants to see at a glance:
|
|
164
|
+
|
|
165
|
+
- Pipeline progress strip with per-phase status badges
|
|
166
|
+
- Per-phase cards with output links, open questions, carry-forward routing, owner notes, last-run usage
|
|
167
|
+
- Aggregate token usage panel + per-phase breakdown
|
|
168
|
+
- Activity timeline with session-file links
|
|
169
|
+
- Open questions roll-up grouped by source phase
|
|
170
|
+
- Closeouts list (reverse-chronological) with relative-path links
|
|
171
|
+
|
|
172
|
+
No JavaScript. No external assets. Light/dark via `prefers-color-scheme`. Works opened directly from `file://`.
|
|
173
|
+
|
|
174
|
+
**Opt-in narrative summary.** `/codecarto-dashboard --narrate` runs the orchestrator's model as a one-shot session that writes a 200–400 word executive summary citing specific findings from recent closeouts. Cached to `.codecarto/.dashboard-narration.local.md` and preserved across deterministic re-renders with a "(N runs since)" staleness note.
|
|
175
|
+
|
|
176
|
+
---
|
|
189
177
|
|
|
190
|
-
##
|
|
178
|
+
## Pi extension features
|
|
191
179
|
|
|
192
|
-
|
|
180
|
+
Beyond the slash commands, the Pi extension layers on:
|
|
193
181
|
|
|
194
|
-
|
|
182
|
+
**Phase sub-agents.** `/codecarto-next` spawns each phase as an isolated `AgentSession`. Tool calls, file reads, and reasoning live in the child's own context window — they never accumulate in the orchestrator. Your TUI stays on the orchestrator session and remains responsive while phases work in background.
|
|
195
183
|
|
|
196
|
-
|
|
184
|
+
**Live agents widget** above the editor showing tool count, token usage, elapsed time, and current activity.
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
● CodeCartographer
|
|
188
|
+
└─ ⠹ architecture phase ⟳ 3 · 5 tool uses · 12.3k tokens · 1m32s
|
|
189
|
+
⎿ reading…
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**File-backed phase sessions.** Phase transcripts persist to the same Pi session directory the orchestrator uses, so `/resume`, `/tree`, and `/export` browse them as first-class sessions. Each appears as `CodeCartographer phase: <id>` with lineage back to the orchestrator's session.
|
|
193
|
+
|
|
194
|
+
**Phase-completion summary in the orchestrator transcript.** When a phase finishes, a Markdown closeout block is appended to the orchestrator's session via `pi.sendMessage(...)`. Visible in the TUI scrollback; available to the orchestrator's LLM as context on your next message. No auto-trigger — you stay in control.
|
|
195
|
+
|
|
196
|
+
**Opt-in LLM-steered seed prompts.** Set `orchestrator.llm_steer_next_phase: true` in `.codecarto/workflow/config.yaml` (or pass `--llm-steer` per invocation), and the orchestrator's LLM rewrites the next phase's seed prompt to highlight relevant prior findings. Off by default — extra orchestrator-side tokens, opt-in. The rewritten prompt is injected into the orchestrator transcript so you can audit what the rewriter chose to emphasize.
|
|
197
|
+
|
|
198
|
+
**Per-phase usage tracking.** Each phase run is appended to `.codecarto/workflow/.usage.local.yaml`. `/codecarto-usage` reports cumulative + per-phase totals.
|
|
199
|
+
|
|
200
|
+
**Tool interception.** `bash` is blocked outright; `edit` and `write` are confined to `.codecarto/`. Same rules apply to phase sub-agents.
|
|
201
|
+
|
|
202
|
+
### Slash commands
|
|
203
|
+
|
|
204
|
+
| Command | Purpose |
|
|
205
|
+
|---|---|
|
|
206
|
+
| `/codecarto-init [variant]` | Copy `.codecarto/` into the current repository, select pipeline variant |
|
|
207
|
+
| `/codecarto-status` | Current phase, progress, open questions |
|
|
208
|
+
| `/codecarto-next [--auto [--strict]] [--llm-steer \| --no-llm-steer]` | Spawn the next eligible phase as a sub-agent. `--auto` walks the full pipeline end-to-end (auto-validate + auto-complete + advance); `--strict` flips the `PASS WITH GAPS` rule from "advance" to "pause". |
|
|
209
|
+
| `/codecarto-phase <id>` | Force a specific phase, even out of pipeline order |
|
|
210
|
+
| `/codecarto-validate [phase]` | Validate a phase output against completion criteria |
|
|
211
|
+
| `/codecarto-complete [phase]` | Atomically mark a phase complete (validation must pass) |
|
|
212
|
+
| `/codecarto-skill <name>` | Run a post-pipeline skill once all phases are complete |
|
|
213
|
+
| `/codecarto-usage` | Cumulative + per-phase token usage |
|
|
214
|
+
| `/codecarto-dashboard [--narrate]` | Regenerate `.codecarto/dashboard.html`; `--narrate` for the LLM executive summary |
|
|
215
|
+
|
|
216
|
+
### End-to-end auto mode (0.8.0+)
|
|
217
|
+
|
|
218
|
+
`/codecarto-next --auto` walks the entire pipeline without intervention. The loop spawns each next-eligible phase, auto-validates the output, auto-marks it complete, and advances until the pipeline finishes — or until something stops it (`FAIL` / `MISSING` validation, sub-agent error, or `ctx.signal` abort). The orchestrator's TUI stays responsive throughout; per-phase summaries land in the transcript as usual, and a final `codecarto-auto-summary` block reports the outcome with cumulative tokens, wall time, and a recovery hint if the run stopped early.
|
|
219
|
+
|
|
220
|
+
- **Resumability** is implicit: re-running `--auto` reads `status.yaml` and picks up from `getNextEligiblePhase`.
|
|
221
|
+
- **`--strict`** (requires `--auto`) treats `PASS WITH GAPS` as a stop — useful when you want to triage gaps before advancing.
|
|
222
|
+
- **`--auto --llm-steer`** runs the rewriter on every phase transition; the per-phase steering blocks land in the orchestrator transcript so the run is auditable.
|
|
223
|
+
|
|
224
|
+
### Version history (Pi orchestration)
|
|
225
|
+
|
|
226
|
+
The current parallel-sub-agent design landed in 0.2.0 and has been incrementally enriched: file-backed sessions (0.3.0), summary injection (0.4.0), opt-in LLM steering (0.5.0), usage tracking (0.6.0), HTML dashboard (0.7.0), end-to-end auto mode (0.8.0), and experimental library foundations plus MCP library tools (0.9.0). 0.1.x workspaces don't need migration — existing `.codecarto/` directories work unchanged. See `CHANGELOG.md` for details.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## MCP server
|
|
231
|
+
|
|
232
|
+
The same framework is packaged as a [Model Context Protocol](https://modelcontextprotocol.io) server. The MCP path returns prompt text for the host to dispatch and never runs sub-agents itself, so the Pi-only orchestration features (sub-agents, live widget, dashboard, usage tracking) don't apply — but phase prompts and validation are byte-identical with the Pi path because both import the same `core/`. v0.9.0 also exposes experimental library tools so MCP-capable hosts can publish, list, and reindex reusable `reimplementation-spec.md` artifacts.
|
|
233
|
+
|
|
234
|
+
Implements MCP spec revision [`2025-11-25`](https://modelcontextprotocol.io/specification/2025-11-25) via `@modelcontextprotocol/sdk` ≥ 1.29.0. The negotiated `protocolVersion` reflects whatever the connecting client requests; the server accepts every revision the SDK supports (currently `2025-11-25`, `2025-06-18`, `2025-03-26`, `2024-11-05`, `2024-10-07`).
|
|
235
|
+
|
|
236
|
+
| Tool | Pi equivalent |
|
|
237
|
+
|---|---|
|
|
238
|
+
| `codecarto_init` | `/codecarto-init` |
|
|
239
|
+
| `codecarto_status` | `/codecarto-status` |
|
|
240
|
+
| `codecarto_next` | `/codecarto-next` |
|
|
241
|
+
| `codecarto_phase` | `/codecarto-phase` |
|
|
242
|
+
| `codecarto_validate` | `/codecarto-validate` |
|
|
243
|
+
| `codecarto_complete` | `/codecarto-complete` |
|
|
244
|
+
| `codecarto_skill` | `/codecarto-skill` |
|
|
245
|
+
| `codecarto_publish` | MCP-only library publish |
|
|
246
|
+
| `codecarto_library_list` | MCP-only library listing |
|
|
247
|
+
| `codecarto_library_reindex` | MCP-only library reindex |
|
|
248
|
+
|
|
249
|
+
Each workflow tool accepts an absolute `cwd` for the target repository. `codecarto_init` requires `force: true` to overwrite an existing `.codecarto/` (instead of Pi's interactive confirmation). The library tools accept an explicit absolute `library_path` or resolve `library.path` from `.codecarto/workflow/config.yaml` / `~/.codecarto/config.yaml`. The library schema is experimental and may break before v2.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Compatible environments
|
|
254
|
+
|
|
255
|
+
| Environment | Recommended surface |
|
|
256
|
+
|---|---|
|
|
257
|
+
| **Pi** | Native Pi extension — slash commands + widget + dashboard. |
|
|
258
|
+
| **Claude Code / Codex / opencode** | MCP server. All three speak MCP cleanly. |
|
|
259
|
+
| **Cursor / Windsurf / IDE copilots** | MCP server where supported; otherwise drop-in template (`.codecarto/GUIDE.md`). |
|
|
260
|
+
| **Claude Desktop** | MCP server. |
|
|
261
|
+
| **Aider** | Drop-in template — point at `.codecarto/GUIDE.md`. |
|
|
262
|
+
| **Claude.ai / ChatGPT (web chat)** | Drop-in, paste file contents manually. Tedious for multi-phase runs. |
|
|
263
|
+
| **API-based agents** | Load files programmatically, pass to the model, write outputs back. Drop-in semantics. |
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Token usage and cost
|
|
268
|
+
|
|
269
|
+
CodeCartographer is token-intensive — it reads source code multiple times across phases and produces thousands of words of structured output. Plan accordingly.
|
|
270
|
+
|
|
271
|
+
### Template overhead (fixed cost)
|
|
272
|
+
|
|
273
|
+
Every session reads the guide, pipeline definition, status, and validation protocol. Each phase additionally reads its own `SKILL.md` and output template. Fixed regardless of codebase size:
|
|
197
274
|
|
|
198
275
|
| Component | Tokens (input) |
|
|
199
276
|
|---|---|
|
|
@@ -204,17 +281,16 @@ Every session reads the guide, pipeline definition, status file, and validation
|
|
|
204
281
|
| Protocols phase instructions | ~1,200 |
|
|
205
282
|
| Porting phase instructions | ~1,200 |
|
|
206
283
|
| Reimplementation spec phase instructions | ~1,100 |
|
|
207
|
-
| **Total template overhead
|
|
284
|
+
| **Total template overhead, 6-phase run** | **~27,000** |
|
|
285
|
+
| **Total template overhead, 7-phase deep-audit** | **~32,000** (split defect scan adds one more SKILL load) |
|
|
208
286
|
|
|
209
|
-
### Source
|
|
287
|
+
### Source code reading (variable cost)
|
|
210
288
|
|
|
211
|
-
|
|
289
|
+
The dominant cost. Each phase reads some or all of your source code; the architecture phase reads the most. Rough guide: **expect 1–3× your codebase size in tokens per phase**. A 50k-token codebase might consume 100–200k input tokens across a full pipeline run.
|
|
212
290
|
|
|
213
|
-
|
|
291
|
+
### Output generation
|
|
214
292
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
Each phase produces a structured findings document. From a real 6-phase run (CodeCartographer analyzing itself — a small ~14k-word template):
|
|
293
|
+
From a real 6-phase run (CodeCartographer analyzing itself — a small ~14k-word template):
|
|
218
294
|
|
|
219
295
|
| Phase | Output size |
|
|
220
296
|
|---|---|
|
|
@@ -228,36 +304,40 @@ Each phase produces a structured findings document. From a real 6-phase run (Cod
|
|
|
228
304
|
|
|
229
305
|
Larger codebases produce proportionally larger outputs.
|
|
230
306
|
|
|
231
|
-
### Cost
|
|
307
|
+
### Cost estimates
|
|
232
308
|
|
|
233
309
|
For a medium-sized codebase (~100k tokens of source):
|
|
234
310
|
|
|
235
|
-
| Pipeline | Estimated
|
|
311
|
+
| Pipeline | Estimated input | Estimated output | Total |
|
|
236
312
|
|---|---|---|---|
|
|
237
313
|
| Architecture only | ~130k | ~5k | ~135k tokens |
|
|
238
314
|
| Defect scan (2-phase) | ~260k | ~10k | ~270k tokens |
|
|
239
315
|
| Lite (3-phase) | ~370k | ~15k | ~385k tokens |
|
|
240
316
|
| Full (5-phase) | ~570k | ~22k | ~592k tokens |
|
|
241
317
|
| Full with audit (6-phase) | ~700k | ~27k | ~727k tokens |
|
|
318
|
+
| Full with deep audit (7-phase, default) | ~830k | ~32k | ~862k tokens |
|
|
319
|
+
|
|
320
|
+
At current API pricing (~$3/M input, ~$15/M output for Claude Sonnet), a full 5-phase run on a 100k-token codebase costs roughly **$2–4**. Larger codebases scale linearly.
|
|
242
321
|
|
|
243
|
-
|
|
322
|
+
### Tips to reduce token usage
|
|
244
323
|
|
|
245
|
-
|
|
324
|
+
- **Start with `architecture-only`** to see if the output quality is useful before committing to a full run.
|
|
325
|
+
- **One LLM session per phase** — each phase gets a fresh context window so you're not paying to carry stale context.
|
|
326
|
+
- **For very large codebases** (500k+ tokens of source), the LLM can't read everything anyway. It uses the architecture map to prioritize and produces partial results. `open_questions` in `status.yaml` shows what was skipped.
|
|
327
|
+
- **The `lite` pipeline (3 phases) gives 80% of the value** for understanding a codebase without porting-specific phases.
|
|
328
|
+
- **Skip `--llm-steer`** unless you're hitting cross-phase coherence issues — the rewriter costs orchestrator-side tokens per phase.
|
|
246
329
|
|
|
247
|
-
|
|
248
|
-
- **Use one session per phase** — each phase gets a fresh context window, so you're not paying to carry stale context.
|
|
249
|
-
- **For very large codebases** (500k+ tokens of source), the LLM can't read everything anyway. It will use the architecture map to prioritize and produce partial results. Check `open_questions` in status.yaml to see what it skipped.
|
|
250
|
-
- **The lite pipeline (3 phases) gives 80% of the value** for understanding a codebase without the porting-specific phases.
|
|
330
|
+
---
|
|
251
331
|
|
|
252
|
-
## Model
|
|
332
|
+
## Model compatibility
|
|
253
333
|
|
|
254
|
-
|
|
334
|
+
LLM-agnostic by design, but model choice affects both what you can analyze and how good the results are. Two independent constraints: **context window size** and **model capability**.
|
|
255
335
|
|
|
256
|
-
### Context
|
|
336
|
+
### Context window
|
|
257
337
|
|
|
258
|
-
Each phase runs in its own session, so the context window limits how much source code can be read per phase — not across the whole pipeline. After
|
|
338
|
+
Each phase runs in its own session, so the context window limits how much source code can be read per phase — not across the whole pipeline. After template overhead, prior-phase findings, and output generation:
|
|
259
339
|
|
|
260
|
-
| Phase | Available for
|
|
340
|
+
| Phase | Available for source (128k model) | Available (200k model) |
|
|
261
341
|
|---|---|---|
|
|
262
342
|
| Architecture | ~121k | ~193k |
|
|
263
343
|
| Defect scan | ~115k | ~187k |
|
|
@@ -266,79 +346,40 @@ Each phase runs in its own session, so the context window limits how much source
|
|
|
266
346
|
| Porting | ~104k | ~176k |
|
|
267
347
|
| Reimplementation spec | ~103k | ~175k |
|
|
268
348
|
|
|
269
|
-
|
|
349
|
+
Practical limits by codebase size:
|
|
270
350
|
|
|
271
|
-
| Codebase
|
|
351
|
+
| Codebase | 128k context | 200k context |
|
|
272
352
|
|---|---|---|
|
|
273
353
|
| <30k tokens | All phases comfortable | All phases comfortable |
|
|
274
|
-
| 30–60k tokens | Feasible, some PARTIAL results | Comfortable |
|
|
275
|
-
| 60–100k tokens | Marginal — heavy PARTIAL use | Feasible with prioritization |
|
|
276
|
-
| >100k tokens | Not viable | Feasible, later phases may PARTIAL |
|
|
354
|
+
| 30–60k tokens | Feasible, some `PARTIAL` results | Comfortable |
|
|
355
|
+
| 60–100k tokens | Marginal — heavy `PARTIAL` use | Feasible with prioritization |
|
|
356
|
+
| >100k tokens | Not viable | Feasible, later phases may `PARTIAL` |
|
|
277
357
|
|
|
278
|
-
The pipeline handles context exhaustion gracefully: phases
|
|
358
|
+
The pipeline handles context exhaustion gracefully: phases write `PARTIAL` validation and log remaining work in `open_questions`.
|
|
279
359
|
|
|
280
|
-
### Model
|
|
360
|
+
### Model capability
|
|
281
361
|
|
|
282
|
-
|
|
362
|
+
The harder constraint. Tasks that degrade fastest on weaker models:
|
|
283
363
|
|
|
284
|
-
1. **Evidence classification** (high risk) — distinguishing `observed fact` from `strong inference` from `open question` requires calibrated self-awareness about certainty. Weaker models
|
|
285
|
-
2. **Defect scan** (high risk) — the
|
|
286
|
-
3. **Architecture synthesis** (medium-high risk) — abstracting a coherent layer map from many files is high-order reasoning.
|
|
364
|
+
1. **Evidence classification** (high risk) — distinguishing `observed fact` from `strong inference` from `open question` requires calibrated self-awareness about certainty. Weaker models over-classify inferences as facts and skip `open question` tagging.
|
|
365
|
+
2. **Defect scan** (high risk) — the multi-pass scan demands domain-specific reasoning (concurrency, security, API contracts). Weaker models produce more false positives, miss subtle bugs, and over-report style issues as defects.
|
|
366
|
+
3. **Architecture synthesis** (medium-high risk) — abstracting a coherent layer map from many files is high-order reasoning.
|
|
287
367
|
4. **Structured output adherence** (medium risk) — filling templates correctly with all required sections and consistent formatting.
|
|
288
|
-
5. **Cross-phase coherence** (medium risk) — later phases build on earlier findings. Weak architecture
|
|
368
|
+
5. **Cross-phase coherence** (medium risk) — later phases build on earlier findings. Weak architecture compounds errors downstream.
|
|
289
369
|
|
|
290
|
-
### Recommended
|
|
370
|
+
### Recommended model tiers
|
|
291
371
|
|
|
292
|
-
|
|
|
372
|
+
| Tier | Examples | Recommended pipeline | Notes |
|
|
293
373
|
|---|---|---|---|
|
|
294
|
-
| Frontier | Claude Opus 4.6, Claude Sonnet 4.6 | Full-with-deep-audit (default)
|
|
295
|
-
| Strong mid-tier | Claude Haiku 4.5, GPT-4o | Lite (3-phase) | Architecture and contracts are solid. Skip defect scan — false
|
|
296
|
-
| Smaller / faster | GPT-4o-mini, Gemini Flash, small open-weight models | Architecture only | Fair structural overview. Multi-phase
|
|
297
|
-
|
|
298
|
-
### What to Expect Below Sonnet 4.6
|
|
299
|
-
|
|
300
|
-
- **Architecture phase**: Usually passable. The layer map and public surfaces will be present but may lack nuance in dependency direction and porting priorities.
|
|
301
|
-
- **Contracts and protocols**: Quality depends heavily on how well architecture was captured. Expect missing edge cases and less precise error-behavior documentation.
|
|
302
|
-
- **Defect scan**: Not recommended. The six specialized passes require strong domain reasoning. Weaker models produce noisy reports that cost more time to triage than they save.
|
|
303
|
-
- **Porting and reimplementation**: These synthesis phases amplify upstream quality. If earlier phases are weak, these will be too.
|
|
304
|
-
|
|
305
|
-
If you're testing a new model, start with `pipeline-architecture-only.yaml` on a codebase you already understand, and compare the output against your own knowledge. That gives you a fast signal on whether to trust the model with deeper phases.
|
|
306
|
-
|
|
307
|
-
## How It Works
|
|
308
|
-
|
|
309
|
-
CodeCartographer is a pure template — no CLI, no runtime, no dependencies. The "code" is structured Markdown and YAML files that tell an LLM what to analyze, in what order, and how to format the results.
|
|
310
|
-
|
|
311
|
-
The workflow is driven by flat files inside `.codecarto/`:
|
|
312
|
-
|
|
313
|
-
- **`GUIDE.md`** — the LLM entry point. Every session starts here.
|
|
314
|
-
- **`workflow/pipeline.yaml`** — phase definitions, dependencies, and output paths.
|
|
315
|
-
- **`workflow/status.yaml`** — mutable per-project state. Single source of truth for progress.
|
|
316
|
-
- **`workflow/VALIDATE.md`** — validation protocol run after every phase.
|
|
317
|
-
- **`findings/<phase>/SKILL.md`** — detailed analysis instructions per phase.
|
|
318
|
-
- **`templates/`** — output templates that enforce consistent structure.
|
|
319
|
-
|
|
320
|
-
Phases form a DAG: `contracts` and `protocols` can run in parallel after `architecture`; `porting` waits for both; `reimplementation-spec` is last.
|
|
321
|
-
|
|
322
|
-
### Multi-Session Workflows
|
|
323
|
-
|
|
324
|
-
Large codebases typically need one LLM session per phase. Start a new session and point it at `.codecarto/GUIDE.md` — it reads `status.yaml`, sees what's done, and picks up the next phase automatically. You don't need to explain what happened in previous sessions.
|
|
325
|
-
|
|
326
|
-
For follow-up sessions, you can also use `NEW_THREAD_BLURB.md` as a lighter entry point — it's a compact checklist that saves tokens by skipping the full guide.
|
|
374
|
+
| **Frontier** | Claude Opus 4.6, Claude Sonnet 4.6 | Full-with-deep-audit (default) | Full quality on codebases up to ~100k tokens; the deep audit's semantic pass benefits most from frontier reasoning. |
|
|
375
|
+
| **Strong mid-tier** | Claude Haiku 4.5, GPT-4o | Lite (3-phase) | Architecture and contracts are solid. Skip defect scan — false-positive rate too high. |
|
|
376
|
+
| **Smaller / faster** | GPT-4o-mini, Gemini Flash, small open-weight models | Architecture only | Fair structural overview. Multi-phase runs produce significant quality loss. |
|
|
327
377
|
|
|
328
|
-
|
|
378
|
+
If you're testing a new model, start with `pipeline-architecture-only.yaml` on a codebase you already understand and compare the output against your own knowledge. Fast signal on whether to trust the model with deeper phases.
|
|
329
379
|
|
|
330
|
-
|
|
380
|
+
---
|
|
331
381
|
|
|
332
|
-
##
|
|
333
|
-
|
|
334
|
-
- **LLM-agnostic**: works with any model that can read/write files.
|
|
335
|
-
- **Phase-gated**: one phase per session, validated before advancing.
|
|
336
|
-
- **Single source of truth**: `status.yaml` tracks progress; no duplicated state.
|
|
337
|
-
- **Evidence-classified**: every finding is tagged as observed fact, strong inference, portability hazard, or open question.
|
|
338
|
-
- **Template-driven**: consistent output structure across projects and sessions.
|
|
339
|
-
- **Drop-in**: lives inside your repo as `.codecarto/`. No symlinking or copying source code.
|
|
340
|
-
|
|
341
|
-
## Repository Structure
|
|
382
|
+
## Repository structure
|
|
342
383
|
|
|
343
384
|
```
|
|
344
385
|
.codecarto/ # The drop-in template (Markdown + YAML).
|
|
@@ -346,30 +387,30 @@ The defect-scan phase runs six sequential analysis passes: logic and correctness
|
|
|
346
387
|
findings/
|
|
347
388
|
architecture/ # System structure, layers, dependency direction.
|
|
348
389
|
defect-scan/ # Multi-pass defect report with severity and actions.
|
|
349
|
-
passes/ # Per-category analysis instructions (6 pass files).
|
|
350
390
|
contracts/ # User-visible behavior, defaults, acceptance checks.
|
|
351
391
|
protocols/ # Event streams, state machines, persistence formats.
|
|
352
392
|
porting/ # Reverse-engineering synthesis bundle.
|
|
353
|
-
reimplementation-spec/ #
|
|
393
|
+
reimplementation-spec/ # Language-agnostic build spec.
|
|
354
394
|
scratch/ # Disposable analysis notes.
|
|
355
395
|
templates/ # Output structure templates.
|
|
356
|
-
workflow/ # Pipeline definitions, status, validation.
|
|
396
|
+
workflow/ # Pipeline definitions, status, validation, config.
|
|
397
|
+
closeouts/ # Per-session closeout files.
|
|
357
398
|
THREAD_LOG.md # Cross-session summary log.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
399
|
+
dashboard.html # Generated; gitignored.
|
|
400
|
+
core/ # Pipeline state machine, validators, prompt assembly,
|
|
401
|
+
# dashboard renderer, usage log, orchestrator config.
|
|
402
|
+
extensions/codecarto/ # Pi extension surface (slash commands, widget,
|
|
403
|
+
# tool gating, dashboard writer + narrator).
|
|
404
|
+
mcp-server/ # MCP server surface (workflow tools + experimental library tools).
|
|
361
405
|
tests/ # Invariant tests catching cross-wrapper drift.
|
|
362
406
|
docs/ # Roadmap, design notes.
|
|
363
|
-
CONTRIBUTING.md # How to contribute to CodeCartographer itself.
|
|
364
|
-
SECURITY.md # Security policy and reporting.
|
|
365
|
-
CHANGELOG.md # Version history.
|
|
366
407
|
```
|
|
367
408
|
|
|
368
|
-
|
|
409
|
+
The `.codecarto/.gitignore` excludes generated findings, scratch files, the dashboard, and the local usage / narration caches. Template files (workflow definitions, skills, output templates) are safe to commit so teammates can run their own analyses.
|
|
369
410
|
|
|
370
|
-
|
|
411
|
+
---
|
|
371
412
|
|
|
372
|
-
## For
|
|
413
|
+
## For automated agents
|
|
373
414
|
|
|
374
415
|
1. Load the active pipeline YAML and `workflow/status.yaml`.
|
|
375
416
|
2. Select the first phase whose status is not `complete` and whose dependencies are all `complete`.
|
|
@@ -377,9 +418,24 @@ The `.codecarto/.gitignore` excludes generated findings and scratch files by def
|
|
|
377
418
|
4. Write outputs to the declared paths. Run validation. Update status.
|
|
378
419
|
5. Repeat until all phases are complete. Set `current_phase` to `complete` when done.
|
|
379
420
|
|
|
421
|
+
The MCP server does steps 1–3 directly; the Pi extension wraps them as slash commands plus the parallel-sub-agent runner described above.
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## Design principles
|
|
426
|
+
|
|
427
|
+
- **LLM-agnostic** — works with any model that can read and write files.
|
|
428
|
+
- **Phase-gated** — one phase per session, validated before advancing.
|
|
429
|
+
- **Single source of truth** — `status.yaml` tracks progress; no duplicated state.
|
|
430
|
+
- **Evidence-classified** — every finding tagged as observed fact, strong inference, portability hazard, or open question.
|
|
431
|
+
- **Template-driven** — consistent output structure across projects and sessions.
|
|
432
|
+
- **Drop-in** — lives inside your repo as `.codecarto/`. No symlinks, no copying source code, no runtime daemon.
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
380
436
|
## Contributing
|
|
381
437
|
|
|
382
|
-
Bug reports, feature requests, and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, branch model, and the maintainer release process. All participants are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md). For security issues,
|
|
438
|
+
Bug reports, feature requests, and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, branch model, and the maintainer release process. All participants are expected to follow the [Code of Conduct](CODE_OF_CONDUCT.md). For security issues, follow [SECURITY.md](SECURITY.md) instead of filing a public issue.
|
|
383
439
|
|
|
384
440
|
## License
|
|
385
441
|
|