codecartographer-pi 0.16.0 → 0.17.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.
Files changed (40) hide show
  1. package/.codecarto/GUIDE.md +15 -2
  2. package/.codecarto/README.md +3 -0
  3. package/.codecarto/broadside/SKILL.md +143 -0
  4. package/.codecarto/broadside/config.yaml +104 -0
  5. package/.codecarto/findings/broadside-scout/README.md +20 -0
  6. package/.codecarto/findings/broadside-scout/SKILL.md +101 -0
  7. package/.codecarto/skills/spec-delta-application/SKILL.md +3 -1
  8. package/.codecarto/templates/backlog-project.md +51 -0
  9. package/.codecarto/templates/broadside-scout-brief.md +97 -0
  10. package/.codecarto/{THREAD_LOG.md → templates/thread-log.md} +2 -5
  11. package/.codecarto/workflow/pipeline-scout-first.yaml +271 -0
  12. package/.codecarto/workflow/scaffold-version.yaml +1 -1
  13. package/README.md +47 -2
  14. package/agent-skill/codecartographer/SKILL.md +3 -1
  15. package/agent-skill/codecartographer/references/broadside.md +115 -0
  16. package/agent-skill/codecartographer/references/library.md +1 -1
  17. package/agent-skill/codecartographer/references/pipeline-selection.md +14 -0
  18. package/dist/core/broadside.d.ts +421 -0
  19. package/dist/core/broadside.js +2349 -0
  20. package/dist/core/completion.js +20 -4
  21. package/dist/core/index.d.ts +1 -0
  22. package/dist/core/index.js +1 -0
  23. package/dist/core/library.d.ts +22 -0
  24. package/dist/core/library.js +101 -1
  25. package/dist/core/orchestrator-config.js +5 -2
  26. package/dist/core/pipeline.js +1 -0
  27. package/dist/core/status.js +9 -1
  28. package/dist/core/utils.js +7 -1
  29. package/dist/core/workspace.d.ts +17 -0
  30. package/dist/core/workspace.js +68 -2
  31. package/dist/extensions/codecarto/agent-runner.js +6 -0
  32. package/dist/extensions/codecarto/broadside-flags.d.ts +21 -0
  33. package/dist/extensions/codecarto/broadside-flags.js +116 -0
  34. package/dist/extensions/codecarto/index.js +232 -4
  35. package/dist/mcp-server/server.d.ts +22 -0
  36. package/dist/mcp-server/server.js +218 -11
  37. package/package.json +10 -1
  38. package/.codecarto/BACKLOG.md +0 -184
  39. package/.codecarto/CHANGELOG-2026-05-02-feedback-pass.md +0 -118
  40. package/.codecarto/closeouts/2026-05-02-framework-feedback-pass.md +0 -111
@@ -0,0 +1,271 @@
1
+ workflow_name: codebase-reverse-engineering-scout-first
2
+ workflow_version: 1
3
+ workflow_goal: The full deep-audit reverse-engineering run, preceded by a Broad-Side scout phase that distills an existing batch reconnaissance run into a routing brief every later phase reads. Identical to pipeline-full-with-deep-audit.yaml apart from that first phase and the brief each phase must account for.
4
+ source_location: ../
5
+ validation_protocol: workflow/VALIDATE.md
6
+ phase_order:
7
+ - broadside-scout
8
+ - architecture
9
+ - defect-scan-mechanical
10
+ - contracts
11
+ - protocols
12
+ - defect-scan-semantic
13
+ - porting
14
+ - reimplementation-spec
15
+ phases:
16
+ - id: broadside-scout
17
+ purpose: Distill a completed Broad-Side batch reconnaissance run into a short routing brief that tells each later phase where to look first. Reads only what a prior Broad-Side run already wrote; it never submits a batch and never spends.
18
+ skill_path: findings/broadside-scout/SKILL.md
19
+ output_template: templates/broadside-scout-brief.md
20
+ depends_on: []
21
+ primary_output: findings/broadside-scout/scout-brief.md
22
+ secondary_outputs: []
23
+ required_reads:
24
+ - GUIDE.md
25
+ - workflow/status.yaml
26
+ completion_criteria:
27
+ - Every forwarded lead names a target phase in this pipeline and a source pointer the target phase can start from.
28
+ - Every lead is marked as an unverified scouting signal; none is stated as a fact or cited as evidence.
29
+ - Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots, so unscouted scope is distinguishable from clean scope.
30
+ - Leads dropped rather than forwarded are recorded with a reason.
31
+ - Convention candidates are routed to the orchestrator's CONVENTIONS.md review, not to a phase.
32
+ - When no completed Broad-Side run exists, the brief says so explicitly, forwards no leads, and does not block the pipeline.
33
+ handoff_requirements:
34
+ - Run validation per workflow/VALIDATE.md. Append validation block to primary output.
35
+ - Write the phase handoff to scratch/handoffs/<phase>.yaml with owner notes, open questions, and carry-forward routings; completion applies it to workflow/status.yaml.
36
+ - Provide closeout_summary and optional closeout_content in the handoff; completion writes the closeout and THREAD_LOG.md entry.
37
+ - id: architecture
38
+ purpose: Build the layer map, dependency direction, public surfaces, and high-level system structure.
39
+ skill_path: findings/architecture/SKILL.md
40
+ output_template: templates/architecture-map.md
41
+ depends_on:
42
+ - broadside-scout
43
+ primary_output: findings/architecture/architecture-map.md
44
+ secondary_outputs:
45
+ - path: findings/public-surfaces/public-surfaces.md
46
+ mode: append
47
+ - path: findings/runtime-lifecycle/runtime-lifecycle.md
48
+ mode: append
49
+ - path: findings/state-and-storage/state-and-storage.md
50
+ mode: append
51
+ - path: findings/build-and-deploy/build-and-deploy.md
52
+ mode: append
53
+ - path: findings/config-model/config-model.md
54
+ mode: append
55
+ required_reads:
56
+ - GUIDE.md
57
+ - workflow/status.yaml
58
+ - findings/broadside-scout/scout-brief.md
59
+ completion_criteria:
60
+ - Every Broad-Side lead the scout brief routed to this phase is confirmed against the source, dismissed with a reason, or carried forward; none is reported as a finding on the brief's authority alone.
61
+ - The system intent is documented.
62
+ - The layer map and dependency direction are documented.
63
+ - Public surfaces are identified.
64
+ - Runtime lifecycle, concurrency model, and porting priorities are summarized.
65
+ - Findings are marked with evidence levels.
66
+ - Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots.
67
+ handoff_requirements:
68
+ - Run validation per workflow/VALIDATE.md. Append validation block to primary output.
69
+ - Write the phase handoff to scratch/handoffs/<phase>.yaml with owner notes, open questions, and carry-forward routings; completion applies it to workflow/status.yaml.
70
+ - Provide closeout_summary and optional closeout_content in the handoff; completion writes the closeout and THREAD_LOG.md entry.
71
+ - id: defect-scan-mechanical
72
+ purpose: Early, context-light defect pass covering logic, error handling, and configuration hazards. Runs before contracts so mechanical bugs are surfaced for the contracts and porting phases to reference.
73
+ skill_path: findings/defect-scan-mechanical/SKILL.md
74
+ output_template: templates/mechanical-defects.md
75
+ depends_on:
76
+ - broadside-scout
77
+ - architecture
78
+ primary_output: findings/defect-scan-mechanical/mechanical-defects.md
79
+ secondary_outputs: []
80
+ required_reads:
81
+ - GUIDE.md
82
+ - workflow/status.yaml
83
+ - findings/broadside-scout/scout-brief.md
84
+ - findings/architecture/architecture-map.md
85
+ completion_criteria:
86
+ - Every Broad-Side lead the scout brief routed to this phase is confirmed against the source, dismissed with a reason, or carried forward; none is reported as a finding on the brief's authority alone.
87
+ - At least two of the three mechanical passes (1, 2, 6) produced findings or documented "no defects found."
88
+ - Each finding has location, severity, evidence level, and recommended action.
89
+ - Findings are organized by pass and sorted by severity.
90
+ - Summary tables are complete and counts match the detailed findings.
91
+ - Items spotted that are actually semantic in nature are routed onward via a carry_forward entry in the phase handoff targeting defect-scan-semantic.
92
+ - Findings are marked with evidence levels.
93
+ - Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots.
94
+ handoff_requirements:
95
+ - Run validation per workflow/VALIDATE.md. Append validation block to primary output.
96
+ - Write the phase handoff to scratch/handoffs/<phase>.yaml with owner notes, open questions, and carry-forward routings; completion applies it to workflow/status.yaml.
97
+ - Provide closeout_summary and optional closeout_content in the handoff; completion writes the closeout and THREAD_LOG.md entry.
98
+ - id: contracts
99
+ purpose: Recover user-visible behavior, defaults, side effects, error behavior, and black-box acceptance checks.
100
+ skill_path: findings/contracts/SKILL.md
101
+ output_template: templates/behavioral-contracts.md
102
+ depends_on:
103
+ - broadside-scout
104
+ - architecture
105
+ primary_output: findings/contracts/behavioral-contracts.md
106
+ secondary_outputs:
107
+ - path: findings/public-surfaces/public-surfaces.md
108
+ mode: append
109
+ - path: findings/runtime-lifecycle/runtime-lifecycle.md
110
+ mode: append
111
+ - path: findings/state-and-storage/state-and-storage.md
112
+ mode: append
113
+ - path: findings/config-model/config-model.md
114
+ mode: append
115
+ required_reads:
116
+ - GUIDE.md
117
+ - workflow/status.yaml
118
+ - findings/broadside-scout/scout-brief.md
119
+ - findings/architecture/architecture-map.md
120
+ - findings/defect-scan-mechanical/mechanical-defects.md
121
+ completion_criteria:
122
+ - Every Broad-Side lead the scout brief routed to this phase is confirmed against the source, dismissed with a reason, or carried forward; none is reported as a finding on the brief's authority alone.
123
+ - User-facing surfaces are split by surface type.
124
+ - Feature contracts record trigger, defaults, outputs, side effects, persisted state, error behavior, and recovery behavior.
125
+ - Security and authorization model is documented (if applicable).
126
+ - Contract ownership is mapped back to a layer or package.
127
+ - A black-box acceptance list is included.
128
+ - Findings are marked with evidence levels.
129
+ - Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots.
130
+ handoff_requirements:
131
+ - Run validation per workflow/VALIDATE.md. Append validation block to primary output.
132
+ - Write the phase handoff to scratch/handoffs/<phase>.yaml with owner notes, open questions, and carry-forward routings; completion applies it to workflow/status.yaml.
133
+ - Provide closeout_summary and optional closeout_content in the handoff; completion writes the closeout and THREAD_LOG.md entry.
134
+ - id: protocols
135
+ purpose: Capture event catalogs, state machines, persistence formats, and compatibility hazards.
136
+ skill_path: findings/protocols/SKILL.md
137
+ output_template: templates/protocols-and-state.md
138
+ depends_on:
139
+ - broadside-scout
140
+ - architecture
141
+ primary_output: findings/protocols/protocols-and-state.md
142
+ secondary_outputs:
143
+ - path: findings/public-surfaces/public-surfaces.md
144
+ mode: append
145
+ - path: findings/runtime-lifecycle/runtime-lifecycle.md
146
+ mode: append
147
+ - path: findings/state-and-storage/state-and-storage.md
148
+ mode: append
149
+ - path: findings/config-model/config-model.md
150
+ mode: append
151
+ required_reads:
152
+ - GUIDE.md
153
+ - workflow/status.yaml
154
+ - findings/broadside-scout/scout-brief.md
155
+ - findings/architecture/architecture-map.md
156
+ - findings/defect-scan-mechanical/mechanical-defects.md
157
+ completion_criteria:
158
+ - Every Broad-Side lead the scout brief routed to this phase is confirmed against the source, dismissed with a reason, or carried forward; none is reported as a finding on the brief's authority alone.
159
+ - An event catalog is documented.
160
+ - A state machine is documented.
161
+ - Persistent schema notes are documented.
162
+ - Compatibility hazards are documented.
163
+ - Findings are marked with evidence levels.
164
+ - Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots.
165
+ handoff_requirements:
166
+ - Run validation per workflow/VALIDATE.md. Append validation block to primary output.
167
+ - Write the phase handoff to scratch/handoffs/<phase>.yaml with owner notes, open questions, and carry-forward routings; completion applies it to workflow/status.yaml.
168
+ - Provide closeout_summary and optional closeout_content in the handoff; completion writes the closeout and THREAD_LOG.md entry.
169
+ - id: defect-scan-semantic
170
+ purpose: Deep, context-rich defect pass covering concurrency, security, and API contract violations. Runs after protocols so contracts/protocols context is available, and before porting so the porting phase can synthesize all defects with full understanding of the system.
171
+ skill_path: findings/defect-scan-semantic/SKILL.md
172
+ output_template: templates/semantic-defects.md
173
+ depends_on:
174
+ - broadside-scout
175
+ - architecture
176
+ - contracts
177
+ - protocols
178
+ - defect-scan-mechanical
179
+ primary_output: findings/defect-scan-semantic/semantic-defects.md
180
+ secondary_outputs: []
181
+ required_reads:
182
+ - GUIDE.md
183
+ - workflow/status.yaml
184
+ - findings/broadside-scout/scout-brief.md
185
+ - findings/architecture/architecture-map.md
186
+ - findings/contracts/behavioral-contracts.md
187
+ - findings/protocols/protocols-and-state.md
188
+ - findings/defect-scan-mechanical/mechanical-defects.md
189
+ completion_criteria:
190
+ - Every Broad-Side lead the scout brief routed to this phase is confirmed against the source, dismissed with a reason, or carried forward; none is reported as a finding on the brief's authority alone.
191
+ - All three semantic passes (3, 4, 5) produced findings or documented "no defects found."
192
+ - Each finding has location, severity, evidence level, and recommended action.
193
+ - Pass 5 findings cite the contract or protocol reference they violate.
194
+ - Findings are organized by pass and sorted by severity; summary tables match the detailed findings.
195
+ - Any carry_forward entries that targeted defect-scan-semantic have been resolved or explicitly re-routed.
196
+ - Findings are marked with evidence levels.
197
+ - Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots.
198
+ handoff_requirements:
199
+ - Run validation per workflow/VALIDATE.md. Append validation block to primary output.
200
+ - Write the phase handoff to scratch/handoffs/<phase>.yaml with owner notes, open questions, and carry-forward routings; completion applies it to workflow/status.yaml.
201
+ - Provide closeout_summary and optional closeout_content in the handoff; completion writes the closeout and THREAD_LOG.md entry.
202
+ - id: porting
203
+ purpose: Synthesize architecture, contracts, protocols, and both defect passes into a reverse-engineering bundle oriented toward porting. Fill the Defect Synthesis section by consolidating mechanical-defects.md and semantic-defects.md into a single porting-oriented view.
204
+ skill_path: findings/porting/SKILL.md
205
+ output_template: templates/reverse-engineering-bundle.md
206
+ depends_on:
207
+ - broadside-scout
208
+ - architecture
209
+ - contracts
210
+ - protocols
211
+ - defect-scan-mechanical
212
+ - defect-scan-semantic
213
+ primary_output: findings/porting/reverse-engineering-bundle.md
214
+ secondary_outputs:
215
+ - path: findings/public-surfaces/public-surfaces.md
216
+ mode: append
217
+ - path: findings/runtime-lifecycle/runtime-lifecycle.md
218
+ mode: append
219
+ - path: findings/state-and-storage/state-and-storage.md
220
+ mode: append
221
+ - path: findings/build-and-deploy/build-and-deploy.md
222
+ mode: append
223
+ - path: findings/config-model/config-model.md
224
+ mode: append
225
+ required_reads:
226
+ - GUIDE.md
227
+ - workflow/status.yaml
228
+ - findings/broadside-scout/scout-brief.md
229
+ - findings/architecture/architecture-map.md
230
+ - findings/contracts/behavioral-contracts.md
231
+ - findings/protocols/protocols-and-state.md
232
+ - findings/defect-scan-mechanical/mechanical-defects.md
233
+ - findings/defect-scan-semantic/semantic-defects.md
234
+ completion_criteria:
235
+ - Every Broad-Side lead the scout brief routed to this phase is confirmed against the source, dismissed with a reason, or carried forward; none is reported as a finding on the brief's authority alone.
236
+ - The system summary, layer map, contract table, protocol notes, and porting findings are synthesized.
237
+ - Portability hazards and open questions are separated from facts.
238
+ - Feature importance is sorted for porting.
239
+ - Defect Synthesis consolidates mechanical-defects.md and semantic-defects.md with porting recommendations (fix before porting / port differently / leave behind).
240
+ - Findings are marked with evidence levels.
241
+ - Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots.
242
+ - The Source Index makes the bundle a self-contained compression boundary and identifies targeted deep-read triggers.
243
+ handoff_requirements:
244
+ - Run validation per workflow/VALIDATE.md. Append validation block to primary output.
245
+ - Write the phase handoff to scratch/handoffs/<phase>.yaml with owner notes, open questions, and carry-forward routings; completion applies it to workflow/status.yaml.
246
+ - Provide closeout_summary and optional closeout_content in the handoff; completion writes the closeout and THREAD_LOG.md entry.
247
+ - id: reimplementation-spec
248
+ purpose: Produce the final language-agnostic reimplementation plan and acceptance spec. The Strategic Alignment Hook in GUIDE.md decides between the default and opinionated template variants.
249
+ skill_path: findings/reimplementation-spec/SKILL.md
250
+ output_template: templates/reimplementation-spec.md
251
+ depends_on:
252
+ - porting
253
+ primary_output: findings/reimplementation-spec/reimplementation-spec.md
254
+ secondary_outputs: []
255
+ required_reads:
256
+ - GUIDE.md
257
+ - workflow/status.yaml
258
+ - findings/porting/reverse-engineering-bundle.md
259
+ completion_criteria:
260
+ - Concept-level modules are defined.
261
+ - Required behaviors are stated.
262
+ - Protocol and persisted state expectations are stated.
263
+ - Acceptance scenarios and known unknowns are included.
264
+ - Defects identified in either scan are explicitly designed-around or noted as "left behind", with the choice cited.
265
+ - Findings are marked with evidence levels.
266
+ - Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots.
267
+ - Lower-level findings are deep-read only when the porting bundle identifies a gap, conflict, missing acceptance detail, or defect rationale.
268
+ handoff_requirements:
269
+ - Run validation per workflow/VALIDATE.md. Append validation block to primary output.
270
+ - Write the phase handoff to scratch/handoffs/<phase>.yaml with owner notes, open questions, and carry-forward routings; completion applies it to workflow/status.yaml.
271
+ - Provide closeout_summary and optional closeout_content in the handoff; completion writes the closeout and THREAD_LOG.md entry.
@@ -3,4 +3,4 @@
3
3
  # workspace's framework-owned files (GUIDE.md, templates/, workflow/ pipelines
4
4
  # and VALIDATE.md) predate the running release. Written at release time and
5
5
  # copied verbatim by init — never edit by hand.
6
- scaffold_version: 0.16.0
6
+ scaffold_version: 0.17.0
package/README.md CHANGED
@@ -239,6 +239,7 @@ The default is a 7-phase run that splits the defect scan into a mechanical early
239
239
  | Variant | Phases | Use when |
240
240
  |---|---|---|
241
241
  | **Full with deep audit** (default) | 7 | Complete analysis with split defect scan; reimplementation grounded in contracts/protocols-aware defect findings |
242
+ | **Scout first** | 8 | The deep-audit run preceded by a `broadside-scout` phase that distills an existing [Broad-Side](#broad-side-batch-reconnaissance) run into a routing brief every later phase reads |
242
243
  | **Full with audit** | 6 | Single early defect scan; cheaper than the deep variant when defects are mostly mechanical |
243
244
  | **Full** | 5 | Porting or reimplementation without any defect scan |
244
245
  | **Defect scan** | 2 | Maintenance audit to surface latent problems |
@@ -253,6 +254,7 @@ Switch the active pipeline with `/codecarto-switch-pipeline <variant>` (Pi) or `
253
254
  | Variant | Pipeline file |
254
255
  |---|---|
255
256
  | Full with deep audit (**default**) | `workflow/pipeline-full-with-deep-audit.yaml` |
257
+ | Scout first | `workflow/pipeline-scout-first.yaml` |
256
258
  | Full with audit | `workflow/pipeline-full-with-audit.yaml` |
257
259
  | Full | `workflow/pipeline.yaml` |
258
260
  | Defect scan | `workflow/pipeline-defect-scan.yaml` |
@@ -318,7 +320,8 @@ Beyond the slash commands, the Pi extension layers on:
318
320
  | `/codecarto-phase <id>` | Force a specific phase, even out of pipeline order |
319
321
  | `/codecarto-validate [phase]` | Validate a phase output against completion criteria |
320
322
  | `/codecarto-complete [phase]` | Validate and atomically apply the phase handoff, canonical status, closeout, and log entry |
321
- | `/codecarto-skill <name>` | Run a post-pipeline skill once all phases are complete |
323
+ | `/codecarto-skill <name>` | Run a post-pipeline skill once all phases are complete (or `broadside` any time, for the scout reading guide) |
324
+ | `/codecarto-broadside [action] [lenses…]` | Batch reconnaissance (Broad-Side). Actions: `submit`, `collect`, `status`, `models`. Prices the run and asks before spending; works with or without a workspace |
322
325
  | `/codecarto-publish` | Publish the reimplementation spec to the configured library after reviewing an explicit confirmation preview |
323
326
  | `/codecarto-library-init <path> [--namespace <name>]` | Create a library directory with marker and write the config — fixes the first-publish dead end |
324
327
  | `/codecarto-config` | Show the effective merged configuration (global + workspace) and library marker status |
@@ -348,20 +351,61 @@ Implements MCP spec revision [`2025-11-25`](https://modelcontextprotocol.io/spec
348
351
  | Tool | Pi equivalent |
349
352
  |---|---|
350
353
  | `codecarto_init` | `/codecarto-init` |
354
+ | `codecarto_open` | `/codecarto-open` |
355
+ | `codecarto_vision` | `/codecarto-vision` |
351
356
  | `codecarto_status` | `/codecarto-status` |
357
+ | `codecarto_switch_pipeline` | `/codecarto-switch-pipeline` |
352
358
  | `codecarto_next` | `/codecarto-next` |
353
359
  | `codecarto_phase` | `/codecarto-phase` |
354
360
  | `codecarto_validate` | `/codecarto-validate` |
355
361
  | `codecarto_complete` | `/codecarto-complete` |
356
362
  | `codecarto_skill` | `/codecarto-skill` |
357
- | `codecarto_publish` | MCP-only library publish |
363
+ | `codecarto_list_skills` | MCP-only ([#161](https://github.com/HuginnIndustries/CodeCartographer/issues/161)); Pi lists skills when `/codecarto-skill` runs with no argument |
364
+ | `codecarto_publish` | `/codecarto-publish` |
365
+ | `codecarto_library_init` | `/codecarto-library-init` |
358
366
  | `codecarto_library_list` | MCP-only library listing |
359
367
  | `codecarto_library_reindex` | MCP-only library reindex |
368
+ | `codecarto_config` | `/codecarto-config` |
369
+ | `codecarto_usage` | `/codecarto-usage` |
370
+ | `codecarto_dashboard` | `/codecarto-dashboard` |
371
+ | `codecarto_guide` | MCP-only ([#160](https://github.com/HuginnIndustries/CodeCartographer/issues/160)) |
372
+ | `codecarto_amend` | MCP-only ([#157](https://github.com/HuginnIndustries/CodeCartographer/issues/157)) |
373
+ | `codecarto_refresh_scaffold` | MCP-only ([#159](https://github.com/HuginnIndustries/CodeCartographer/issues/159)) |
374
+ | `codecarto_broadside` | `/codecarto-broadside` |
360
375
 
361
376
  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.
362
377
 
363
378
  ---
364
379
 
380
+ ## Broad-Side (batch reconnaissance)
381
+
382
+ Broad-Side is the cheap sweep you run *before* the expensive interactive run. It fires six analysis lenses — architecture, API surface, security, mechanical defect scan, convention extraction, porting — at a repository as single-turn prompts over the [OpenRouter Batch API](https://openrouter.ai/docs), then cross-references them into one executive report (`synthesis.md`) and a prioritized P0–P3 work order (`triage.md`).
383
+
384
+ **Broad-Side findings are unverified scouting leads, not evidence.** Each lens is one shot: no cross-file traversal, no runtime verification, no builds, no tests. Every finding is a `file:line` pointer that the interactive pipeline — or you — must confirm before it is a fact. That division of labor is the point: a sub-dollar unattended sweep that tells the expensive run where to look. Nothing downstream may cite a Broad-Side report as a source.
385
+
386
+ It runs on any git repository — no initialized workspace required — and needs an OpenRouter API key (`api_key` parameter, `OPENROUTER_API_KEY` environment variable, or `api_key` in `.codecarto/broadside/config.yaml`).
387
+
388
+ ```
389
+ codecarto_broadside {cwd, action: "models"} # compare batch models and pricing
390
+ codecarto_broadside {cwd, action: "submit", lenses: [...]} # fire the batches, priced first
391
+ codecarto_broadside {cwd, action: "status"} # what is in flight
392
+ codecarto_broadside {cwd, action: "collect"} # poll, save, synthesize, triage
393
+ ```
394
+
395
+ Submit and collect are separate because batch jobs routinely take tens of minutes; collect is resumable and picks up whatever is still in flight. Submit prices the run from the collected file sizes against the model's live per-token pricing (cached 24h) and refuses when the estimate exceeds `max_cost` unless `force: true` is passed — a pre-flight estimate, not a runtime stop. Actual spend lands in each run's `run-meta.json`.
396
+
397
+ Repository defaults live in `.codecarto/broadside/config.yaml` (`model`, `api_key`, `default_lenses`, `max_cost`, `pricing` overrides, `lens_models`, `incremental`, `retry_truncated`, `include_synthesis`, `include_triage`, `wait_seconds`); an explicit tool parameter always wins. `lens_models` routes individual lenses to their own batch model — a stronger model changes security and defect findings far more than it changes an architecture map — and each override is priced, capability-checked, and clamped exactly like the default, with the estimate broken out per lens so a mixed-model run cannot be approved without seeing which lens costs what. CodeCartographer ships no stronger default: which model earns its price depends on your repository and budget, so compare candidates with the `models` action and choose. `codecarto_skill {cwd, name: "broadside"}` returns the reading guide for a completed run, and unlike post-pipeline skills it is not gated on a finished pipeline.
398
+
399
+ On the Pi extension the same run is `/codecarto-broadside [submit|collect|status|models] [lenses…]`, with tab-completion for actions and lens names and live per-lens progress while batches poll. The two surfaces differ in one deliberate place: MCP cannot ask a human, so it refuses a run over `max_cost` until you pass `force`; Pi shows the per-lens breakdown and asks, and your approval *is* the force flag. Neither surface takes an API key as a command argument — a key typed into a slash command lands in the session transcript.
400
+
401
+ Broad-Side needs runtime code, so firing a run is an executable-surface feature: Pi and MCP have it, the pure drop-in template does not (it carries only the reading guide).
402
+
403
+ **Feeding a run into the pipeline** is the `scout-first` variant. Its first phase, `broadside-scout`, distills a completed run into `findings/broadside-scout/scout-brief.md` — a short list of leads, each routed to a specific later phase with the source pointer that phase should start from. Six later phases read the brief, and each must account for the leads addressed to it at validation: confirmed against the source, dismissed with a reason, or carried forward. None may be reported as a finding on the brief's authority. The scout phase itself never submits a batch and never spends; with no run on disk it writes an explicitly empty brief and the pipeline proceeds unchanged.
404
+
405
+ The indirection is deliberate. Run directories are timestamped and gitignored, so no pipeline YAML could name one as a `required_reads` path; the brief is the stable, reviewable artifact that a phase contract can point at — and distilling into it is where the "which of these is worth anyone's attention" judgment happens.
406
+
407
+ ---
408
+
365
409
  ## Compatible environments
366
410
 
367
411
  | Environment | Recommended surface |
@@ -506,6 +550,7 @@ If you're testing a new model, start with `pipeline-architecture-only.yaml` on a
506
550
  scratch/ # Disposable notes plus checkpoints and structured phase handoffs.
507
551
  templates/ # Output structure templates.
508
552
  workflow/ # Pipeline definitions, status, validation, config.
553
+ broadside/ # Broad-Side batch reconnaissance: config, state, run results.
509
554
  closeouts/ # Per-session closeout files.
510
555
  THREAD_LOG.md # Cross-session summary log.
511
556
  dashboard.html # Generated; gitignored.
@@ -38,6 +38,7 @@ codecarto_status → codecarto_init (first time only)
38
38
  status reports "complete"
39
39
  ```
40
40
 
41
+ 0. **`codecarto_broadside`** — optional, and only worth it on a repository too large to read directly. A cheap batch reconnaissance sweep that produces unverified leads telling the pipeline where to look, before you commit to a pipeline choice. Costs real money and is priced before it fires — `references/broadside.md`.
41
42
  1. **`codecarto_status`** — always start here. It reports the active pipeline, progress, next action, and any scaffold-staleness warning. Every tool takes an absolute `cwd` pointing at the target repository.
42
43
  2. **`codecarto_init`** — only when no `.codecarto/` exists. Choose the pipeline deliberately (see `references/pipeline-selection.md`). Never pass `force: true` without the user's explicit approval; it moves an existing workspace, findings and all, to a backup directory.
43
44
  3. **`codecarto_next`** — returns the prompt for the next eligible phase. It returns *text*; it does not execute anything. Use `codecarto_phase` only to force a specific phase out of order, and only when the user asked for that.
@@ -46,7 +47,7 @@ codecarto_status → codecarto_init (first time only)
46
47
  6. **`codecarto_validate`** — parses the validation block you appended to the primary output. Returns `PASS`, `PASS WITH GAPS`, `FAIL`, or `MISSING`.
47
48
  7. **`codecarto_complete`** — marks the phase done, applies your handoff to canonical state, and writes the closeout and `THREAD_LOG.md` entry. It refuses anything worse than `PASS WITH GAPS`.
48
49
 
49
- When `codecarto_status` reports all phases complete, post-pipeline skills become available via `codecarto_list_skills` and `codecarto_skill`.
50
+ When `codecarto_status` reports all phases complete, post-pipeline skills become available via `codecarto_list_skills` and `codecarto_skill`. One name that tool answers to is exempt from that gate: `codecarto_skill {name: "broadside"}` returns the reading guide for a batch reconnaissance run, which is meant to be read *before* the pipeline and during it.
50
51
 
51
52
  ## The handoff contract
52
53
 
@@ -133,6 +134,7 @@ If the goal is to rebuild or refactor rather than to understand, two phases carr
133
134
 
134
135
  Running the pipeline:
135
136
 
137
+ - `references/broadside.md` — batch reconnaissance: when to scout, cost guardrails, and why its findings are leads rather than evidence
136
138
  - `references/orchestration.md` — the orchestrator's duties, inline vs delegated execution, and the session-by-session fallback's real costs
137
139
  - `references/pipeline-selection.md` — choosing a variant, and switching without losing work
138
140
  - `references/executors.md` — the executor contract, adapters, and model selection
@@ -0,0 +1,115 @@
1
+ # Broad-Side: scouting a repository before you spend on it
2
+
3
+ Broad-Side is CodeCartographer's batch reconnaissance pass. It fires six
4
+ analysis lenses — architecture, API surface, security, mechanical defect scan,
5
+ convention extraction, and porting — at a repository as single-turn prompts
6
+ over the OpenRouter Batch API, then cross-references them into one executive
7
+ report and a prioritized work order.
8
+
9
+ It is not a phase, and it does not replace one. It is the cheap sweep that
10
+ tells the expensive interactive run where to look.
11
+
12
+ ## Leads, never evidence
13
+
14
+ Every Broad-Side finding is an **unverified scouting signal**. Each lens is one
15
+ shot: no cross-file traversal, no runtime verification, no builds, no tests, no
16
+ follow-up questions. The batch model is chosen for price, not strength.
17
+
18
+ This is the rule the whole feature rests on: a finding is a `file:line` lead
19
+ that a phase — or you — must confirm against the source before it is a fact.
20
+ Cite the source you confirmed it from, never the Broad-Side report. A "high"
21
+ you can neither confirm nor dismiss becomes an open question in your handoff,
22
+ not a finding in your report.
23
+
24
+ ## When to fire it
25
+
26
+ - **Before `codecarto_init`,** on a repository nobody on the team knows. The
27
+ synthesis report is a map of where the risk sits, which makes the pipeline
28
+ choice an informed one instead of a guess.
29
+ - **Before an expensive phase,** when the repository is large enough that the
30
+ architecture or defect phases would otherwise read blind.
31
+ - **Not at all,** when the repository is small enough to read directly. A sweep
32
+ that costs more than the reading it saves is waste.
33
+
34
+ It works on any git repository — no workspace required — and `codecarto_init`
35
+ tolerates a `.codecarto/` that holds nothing but scout state.
36
+
37
+ ## Driving it
38
+
39
+ ```
40
+ codecarto_broadside {cwd, action: "models"} # compare batch models first
41
+ codecarto_broadside {cwd, action: "submit", lenses: [...]} # fire the batches
42
+ codecarto_broadside {cwd, action: "status"} # what is in flight
43
+ codecarto_broadside {cwd, action: "collect"} # poll, save, synthesize, triage
44
+ ```
45
+
46
+ (The Pi extension exposes the same four actions as `/codecarto-broadside <action> [lenses…]`.)
47
+
48
+ Submit and collect are separate on purpose: batch jobs routinely take tens of
49
+ minutes, and nothing is lost by returning between them. Pass `wait_seconds` to
50
+ poll inline when you would rather block. Collect is resumable — call it again
51
+ and it picks up the batches the recorded state still lists as in flight.
52
+
53
+ Requires an OpenRouter API key via the `api_key` parameter, the
54
+ `OPENROUTER_API_KEY` environment variable, or `api_key` in
55
+ `.codecarto/broadside/config.yaml`.
56
+
57
+ ## Cost is a first-class parameter
58
+
59
+ Submit prices the run before it fires: it estimates from the collected file
60
+ sizes against the model's live per-token pricing (cached 24h) and refuses when
61
+ the estimate exceeds `max_cost`, printing the per-lens breakdown. `force: true`
62
+ overrides. This is a pre-flight estimate, not a runtime stop — actual spend
63
+ lands in the run's `run-meta.json`.
64
+
65
+ **Never pass `force: true` on the user's behalf without telling them what the
66
+ estimate was.** The guardrail exists because the expensive end of the batch
67
+ model catalog runs past $80 per million output tokens. On MCP the refusal is
68
+ the only protection there is — the server cannot ask, which is exactly why
69
+ `force` must be the user's decision rather than your retry. (Pi has a human to
70
+ ask, so it shows the breakdown and prompts instead of refusing.)
71
+
72
+ Two more economies worth knowing:
73
+
74
+ - `incremental: true` diffs against the previous run's git HEAD and scans only
75
+ the modules whose files changed, falling back to a full scan on a dirty tree.
76
+ - Every knob above has a repository default in `.codecarto/broadside/config.yaml`
77
+ (`model`, `default_lenses`, `max_cost`, `lens_models`, `incremental`,
78
+ `retry_truncated`, `include_synthesis`, `include_triage`, `wait_seconds`). An
79
+ explicit parameter on the call always wins.
80
+ - `lens_models` runs individual lenses on their own model. Spending more on the
81
+ security and defect lenses while the cheap default carries architecture and
82
+ conventions is usually a better trade than raising the model for everything.
83
+ Overrides are priced and capability-checked individually, and the estimate
84
+ breaks cost out per lens.
85
+
86
+ ## Reading a run
87
+
88
+ Results land in `.codecarto/broadside/<run>/`. Read them in this order:
89
+
90
+ 1. `synthesis.md` — executive summary, severity counts, top cross-lens
91
+ findings, per-module risk.
92
+ 2. `triage.md` — the same findings scored by impact × difficulty into a P0–P3
93
+ work order with effort estimates. A starting point for re-verification, not
94
+ a commitment.
95
+ 3. The per-lens `*.json` / `*.md` behind whatever matters to the phase you are
96
+ about to run: `architecture-*` seeds the architecture phase, `api-*` the
97
+ contracts and protocols phases, `security-*` and `defect-*` the defect
98
+ scans, `conventions-*` the convention candidates, `porting-*` the porting
99
+ phase.
100
+ 4. `run-meta.json` — scope: which lenses ran, at what cost, with what coverage
101
+ caps.
102
+
103
+ `codecarto_skill {cwd, name: "broadside"}` returns the full reading guide.
104
+ Unlike post-pipeline skills, that one is not gated on a completed pipeline,
105
+ because a scout run is meant to be read before the pipeline and during it.
106
+
107
+ ## Coverage is spoken, not implied
108
+
109
+ - A lens output whose JSON does not parse is saved verbatim and marked
110
+ `truncated`. The collect summary counts it, `run-meta.json` records it, and
111
+ the synthesis prompt is told that module is unrepresented — not clean. By
112
+ default a truncated slice is resubmitted once with a doubled output cap.
113
+ - A skipped lens, a capped slice, and unscanned scope are all reported. Scope
114
+ outside the sweep is **unscouted, not clean**, and saying otherwise in a phase
115
+ report is the one way Broad-Side can actively mislead a run.
@@ -25,7 +25,7 @@ The moment `reimplementation-spec` completes and validates is the publish moment
25
25
  codecarto_publish cwd:<workspace repo> source_repo:<repo URL or path> headline:"<one line>" spec_path:<abs path to reimplementation-spec.md>
26
26
  ```
27
27
 
28
- Set `publish_confirm` in config if you want an explicit confirmation gate before writes.
28
+ Set `publish_confirm` in config if you want an explicit confirmation gate before writes. **Pi-only today:** the Pi extension asks for interactive confirmation before `/codecarto-publish` writes; the MCP `codecarto_publish` tool does not act on the key (an MCP host has no one to ask — [#162](https://github.com/HuginnIndustries/CodeCartographer/issues/162) tracks whether it should refuse-unless-forced instead), so on MCP treat it as advisory.
29
29
 
30
30
  ## What this is not
31
31
 
@@ -10,6 +10,7 @@ Pass an alias to `codecarto_init` as `pipeline`. The default is `full-with-deep-
10
10
  | `full` | architecture → contracts → protocols → porting → reimplementation-spec | porting or rewriting, no defect audit |
11
11
  | `full-with-audit` | adds a single defect-scan after architecture | porting, with defects surfaced once |
12
12
  | `full-with-deep-audit` *(default)* | splits the scan: mechanical after architecture, semantic after protocols | porting or rewriting where correctness matters |
13
+ | `scout-first` | `full-with-deep-audit` behind a `broadside-scout` brief | a repository large enough that a Broad-Side sweep already ran and should steer the phases |
13
14
  | `synthesis` | vision-capture → goal-synthesis-propose → spec-merge → goal-synthesis-finalize | forward synthesis of a *new* product, not reverse-engineering |
14
15
 
15
16
  ## Deep audit versus plain audit
@@ -23,6 +24,19 @@ The mechanical pass routes anything it cannot settle locally to the semantic pas
23
24
 
24
25
  Choose `full-with-audit` when one combined pass is enough and you want fewer phases. Choose `full-with-deep-audit` when the output will drive a rewrite, since a semantic pass without protocols context will miss the findings that most change a port.
25
26
 
27
+ ## Scout-first needs a scout run
28
+
29
+ `scout-first` is `full-with-deep-audit` with one phase in front: `broadside-scout`
30
+ distills a completed Broad-Side batch reconnaissance run into a routing brief,
31
+ and the six phases after it read that brief and must account for the leads
32
+ addressed to them — confirmed, dismissed with a reason, or carried forward.
33
+ See `references/broadside.md` for the sweep itself.
34
+
35
+ The scout phase never submits a batch and never spends; it reads only what a
36
+ prior run wrote. Choosing this variant without having run Broad-Side gets you an
37
+ explicitly empty brief and, from there on, exactly `full-with-deep-audit`. So
38
+ fire the sweep first, or choose the plain deep-audit variant.
39
+
26
40
  ## Synthesis is a different workspace
27
41
 
28
42
  The `synthesis` pipeline plans a new product from a vision brief and a library of reusable specs. It does **not** treat the surrounding repository as source evidence. It has preflight gates: a completed `inputs/vision.md`, a valid non-empty library, and — for merge and finalization — at least one human-confirmed selection. `codecarto_vision` runs the guided interview that produces the brief.