codecartographer-pi 0.10.0 → 0.12.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 (71) hide show
  1. package/.codecarto/GUIDE.md +40 -18
  2. package/.codecarto/README.md +3 -0
  3. package/.codecarto/findings/goal-synthesis/README.md +3 -0
  4. package/.codecarto/findings/goal-synthesis-finalize/SKILL.md +30 -0
  5. package/.codecarto/findings/goal-synthesis-propose/SKILL.md +24 -0
  6. package/.codecarto/findings/porting/SKILL.md +7 -0
  7. package/.codecarto/findings/reimplementation-spec/SKILL.md +10 -0
  8. package/.codecarto/findings/spec-merge/README.md +3 -0
  9. package/.codecarto/findings/spec-merge/SKILL.md +23 -0
  10. package/.codecarto/findings/vision-capture/README.md +3 -0
  11. package/.codecarto/findings/vision-capture/SKILL.md +26 -0
  12. package/.codecarto/inputs/vision.md +11 -0
  13. package/.codecarto/templates/architecture-map.md +9 -0
  14. package/.codecarto/templates/behavioral-contracts.md +9 -0
  15. package/.codecarto/templates/defect-report.md +9 -0
  16. package/.codecarto/templates/mechanical-defects.md +9 -0
  17. package/.codecarto/templates/merged-spec.md +58 -0
  18. package/.codecarto/templates/phase-checkpoint.md +41 -0
  19. package/.codecarto/templates/phase-handoff.yaml +22 -0
  20. package/.codecarto/templates/project-plan.md +70 -0
  21. package/.codecarto/templates/proposal.md +43 -0
  22. package/.codecarto/templates/protocols-and-state.md +9 -0
  23. package/.codecarto/templates/reimplementation-spec-opinionated.md +10 -0
  24. package/.codecarto/templates/reimplementation-spec.md +10 -0
  25. package/.codecarto/templates/reverse-engineering-bundle.md +29 -3
  26. package/.codecarto/templates/semantic-defects.md +9 -0
  27. package/.codecarto/templates/vision.md +63 -0
  28. package/.codecarto/workflow/pipeline-architecture-only.yaml +1 -0
  29. package/.codecarto/workflow/pipeline-defect-scan.yaml +2 -0
  30. package/.codecarto/workflow/pipeline-full-with-audit.yaml +8 -3
  31. package/.codecarto/workflow/pipeline-full-with-deep-audit.yaml +9 -5
  32. package/.codecarto/workflow/pipeline-lite.yaml +3 -0
  33. package/.codecarto/workflow/pipeline-synthesis.yaml +105 -0
  34. package/.codecarto/workflow/pipeline.yaml +7 -3
  35. package/.codecarto/workflow/status.yaml +2 -0
  36. package/README.md +89 -7
  37. package/dist/core/completion.d.ts +6 -0
  38. package/dist/core/completion.js +127 -0
  39. package/dist/core/dashboard.js +37 -7
  40. package/dist/core/index.d.ts +2 -0
  41. package/dist/core/index.js +2 -0
  42. package/dist/core/pipeline.js +1 -0
  43. package/dist/core/prompts.d.ts +9 -3
  44. package/dist/core/prompts.js +43 -26
  45. package/dist/core/status.d.ts +7 -1
  46. package/dist/core/status.js +187 -2
  47. package/dist/core/synthesis.d.ts +31 -0
  48. package/dist/core/synthesis.js +140 -0
  49. package/dist/core/types.d.ts +29 -1
  50. package/dist/core/usage.d.ts +11 -0
  51. package/dist/core/usage.js +64 -46
  52. package/dist/core/workspace.d.ts +3 -1
  53. package/dist/core/workspace.js +39 -3
  54. package/dist/core/yaml.js +24 -0
  55. package/dist/extensions/codecarto/agent-rewriter.js +0 -1
  56. package/dist/extensions/codecarto/agent-runner.d.ts +19 -0
  57. package/dist/extensions/codecarto/agent-runner.js +68 -6
  58. package/dist/extensions/codecarto/agent-state.d.ts +3 -0
  59. package/dist/extensions/codecarto/agent-state.js +2 -0
  60. package/dist/extensions/codecarto/agent-summary.d.ts +5 -0
  61. package/dist/extensions/codecarto/agent-summary.js +9 -0
  62. package/dist/extensions/codecarto/agent-widget.js +6 -0
  63. package/dist/extensions/codecarto/auto-runner.d.ts +3 -1
  64. package/dist/extensions/codecarto/auto-runner.js +33 -69
  65. package/dist/extensions/codecarto/dashboard-narrator.js +0 -1
  66. package/dist/extensions/codecarto/index.d.ts +1 -1
  67. package/dist/extensions/codecarto/index.js +153 -12
  68. package/dist/extensions/codecarto/phase-compaction.d.ts +11 -0
  69. package/dist/extensions/codecarto/phase-compaction.js +115 -0
  70. package/dist/mcp-server/server.js +24 -68
  71. package/package.json +4 -3
@@ -6,6 +6,8 @@ This is a structured reverse-engineering workspace embedded inside a repository.
6
6
 
7
7
  All CodeCartographer files live inside this `.codecarto/` folder. The source code is everything outside it.
8
8
 
9
+ **Synthesis exception.** When `workflow/status.yaml` selects `workflow/pipeline-synthesis.yaml`, this workspace is planning a new product rather than reverse-engineering the surrounding repository. Use `inputs/vision.md` and the read-only library paths supplied by the executable host. Do not treat the parent directory as source evidence for synthesis.
10
+
9
11
  Work in explicit phases. Do not try to do everything at once.
10
12
 
11
13
  ## Roles
@@ -55,8 +57,9 @@ Read these files in order before doing any analysis:
55
57
  1. This `GUIDE.md` (you are here — `.codecarto/GUIDE.md`).
56
58
  2. `workflow/status.yaml` to see which phases are done and what is next.
57
59
  3. The current phase's existing output file, if one exists (to avoid repeating work).
58
- 4. The current phase's `SKILL.md` for detailed instructions on what to analyze and produce.
59
- 5. The output template from `templates/` for the current phase (if starting a new output).
60
+ 4. `scratch/checkpoints/<phase>.md`, if present, to resume durable in-phase progress after compaction or interruption.
61
+ 5. The current phase's `SKILL.md` for detailed instructions on what to analyze and produce.
62
+ 6. The output template from `templates/` for the current phase (if starting a new output).
60
63
 
61
64
  All paths in this guide are relative to `.codecarto/` unless stated otherwise.
62
65
 
@@ -75,19 +78,21 @@ Some files in this workspace are **read-only instructions** and must not be modi
75
78
  | Templates (read-only) | `templates/*.md` | Read only. Never modify. |
76
79
  | Pipeline definitions (read-only) | `workflow/pipeline*.yaml`, `workflow/VALIDATE.md` | Read only. Never modify. |
77
80
  | Source code (read-only) | `../` (everything outside `.codecarto/`) | Read only. Analyze but never modify. |
78
- | Workflow state (read-write) | `workflow/status.yaml` | Update to track progress. |
81
+ | Synthesis input (user-maintained) | `inputs/vision.md` | The user fills this before the synthesis pipeline starts. Implementing phases read it but do not rewrite the raw brief. |
82
+ | Workflow state (framework-owned) | `workflow/status.yaml` | Read to understand progress. Implementing sessions never edit it directly; completion applies a validated phase handoff under a lock. |
79
83
  | Findings (read-write) | `findings/<phase>/<primary-output>.md`, secondary output files | Create and update during phases. |
80
- | Closeouts (read-write, append-only) | `closeouts/<date>-<phase-or-module>.md`, `THREAD_LOG.md` | Each session writes a new closeout file; `THREAD_LOG.md` is an INDEX pointing to closeouts. |
84
+ | Phase handoff (read-write) | `scratch/handoffs/<phase>.yaml` | Implementing sessions propose state changes and closeout content here. The framework validates and applies them. |
85
+ | Closeouts (framework-owned) | `closeouts/<date>-<phase-or-module>.md`, `THREAD_LOG.md` | Completion writes or updates one canonical closeout and one idempotent index entry. |
81
86
  | Conventions (orchestrator-maintained) | `CONVENTIONS.md` | Cross-cutting patterns promoted to project-wide invariants. Implementing sessions propose; the orchestrator writes. |
82
87
  | Decisions (orchestrator-maintained, append-only) | `DECISIONS.md` | Numbered log of decisions that diverge from spec, prompt, or obvious-default. Appended at session close. |
83
88
  | Backlog (read-write) | `BACKLOG.md` | Deferred items with rationale. |
84
- | Scratch (read-write) | `scratch/*` | Disposable working notes. |
89
+ | Scratch (read-write) | `scratch/*` | Working notes; `scratch/checkpoints/<phase>.md` is the durable in-phase continuation checkpoint until the phase validates. |
85
90
 
86
91
  If you are uncertain whether a file should be modified, treat it as read-only.
87
92
 
88
93
  ## Pipeline Selection
89
94
 
90
- Six pipeline variants are available. Check the `pipeline` field in `workflow/status.yaml` to see which is active.
95
+ Seven pipeline variants are available. Check the `pipeline` field in `workflow/status.yaml` to see which is active.
91
96
 
92
97
  - If the field is **empty**, ask the user which scope to use.
93
98
  - If the field points to a **file that does not exist**, stop and ask the user to correct it. Do not guess or fall back to the default pipeline.
@@ -100,6 +105,7 @@ Six pipeline variants are available. Check the `pipeline` field in `workflow/sta
100
105
  | Defect scan | `workflow/pipeline-defect-scan.yaml` | architecture → defect-scan | Maintenance audit to surface latent problems |
101
106
  | Lite | `workflow/pipeline-lite.yaml` | architecture → contracts → protocols | Understanding behavior without porting plans |
102
107
  | Architecture only | `workflow/pipeline-architecture-only.yaml` | architecture | Quick structural overview |
108
+ | Synthesis | `workflow/pipeline-synthesis.yaml` | vision-capture → goal-synthesis-propose → spec-merge → goal-synthesis-finalize | Convert a user vision and explicitly confirmed library specs into a provenance-backed project plan; requires Pi or MCP |
103
109
 
104
110
  ## Evaluation Objective
105
111
 
@@ -118,6 +124,9 @@ Produce a reusable evaluation bundle for the repository. The bundle has two purp
118
124
  | Protocols and state | `findings/protocols/protocols-and-state.md` |
119
125
  | Reverse-engineering bundle | `findings/porting/reverse-engineering-bundle.md` |
120
126
  | Reimplementation spec | `findings/reimplementation-spec/reimplementation-spec.md` |
127
+ | Synthesis proposal | `findings/goal-synthesis/proposal.md` |
128
+ | Merged specification | `findings/spec-merge/merged-spec.md` |
129
+ | Evidence-backed project plan | `findings/goal-synthesis/project-plan.md` |
121
130
 
122
131
  Not all deliverables apply to every pipeline variant. Check your active pipeline YAML for which phases and outputs are included.
123
132
 
@@ -158,7 +167,13 @@ Before beginning a phase, estimate how much source material you need to read. Fo
158
167
  - Read structural files first (manifests, entrypoints, READMEs) from the repository root (`../`).
159
168
  - Use the architecture map to prioritize which packages to read in detail.
160
169
  - Defer deep reads until the current phase actually needs them.
161
- - If you are running low on context, finish the current section, write a PARTIAL validation, and document what remains in `open_questions` (truly unknown) or `carry_forward` (deferred to a specific later phase) in status.yaml. See "Open Questions vs Carry-Forward" below.
170
+ - For long phases, update `scratch/checkpoints/<phase>.md` after each major subsystem or output section. Pi writes a phase-aware checkpoint automatically after phase compaction; other hosts should use `templates/phase-checkpoint.md` manually.
171
+ - Every primary output must include `Coverage and limits`: inspected scope, skipped scope, evidence basis, known blind spots, and a `COMPLETE` or `PARTIAL` disposition.
172
+ - If you are running low on context, finish the current section, write a PARTIAL validation, and document what remains in `open_questions` (truly unknown) or `carry_forward` (deferred to a specific later phase) in the phase handoff. See "Open Questions vs Carry-Forward" below.
173
+
174
+ ### Synthesis compression boundary
175
+
176
+ The porting bundle is the intentional compression boundary before `reimplementation-spec`. Its Source Index must preserve load-bearing claims, defect dispositions, coverage gaps, and exact pointers for targeted deep reads. The final synthesis phase reads the bundle by default; it opens architecture, contracts, protocols, or defect reports only when the bundle names a gap or conflict, an acceptance scenario needs omitted detail, a claim needs stronger evidence, or a defect disposition needs its rationale. If the bundle cannot support that selective workflow, mark validation `PARTIAL` instead of loading every upstream report by habit.
162
177
 
163
178
  ### Subagent Delegation for Large Codebases
164
179
 
@@ -170,8 +185,9 @@ For codebases over roughly 50 source files or 100K LOC, do not burn primary cont
170
185
 
171
186
  - **`open_questions`** — items that are *still genuinely unknown*. Need more evidence (a runtime test, a maintainer decision, a spec ruling). Not resolvable by any later phase in the current pipeline.
172
187
  - **`carry_forward`** — items that are deferred to a specific later phase because the current phase can't responsibly close them but the pipeline naturally will. Each entry has a target phase.
188
+ - **`post_pipeline`** — optional work after the active pipeline: spikes, amendments, deltas, maintainer rulings, or opinionated reruns. These items do not make pipeline completion partial and must not be disguised as carry-forward targets.
173
189
 
174
- Both lists carry structured entries. Recommended shape:
190
+ All three collections carry structured entries. Recommended phase-state shape:
175
191
 
176
192
  ```yaml
177
193
  open_questions:
@@ -185,9 +201,13 @@ carry_forward:
185
201
  target_phase: defect-scan
186
202
  description: The `loadConfig()` callsite returns `{}` on both ENOENT and parse-error — can't tell absent from corrupt.
187
203
  deferred_reason: framing this as a defect requires the defect-scan rubric; flagged here so defect-scan picks it up.
204
+ post_pipeline:
205
+ - id: post-runtime-1
206
+ kind: spike
207
+ description: Capture restart behavior against a packaged build after the pipeline is complete.
188
208
  ```
189
209
 
190
- `kind` is one of: `needs-runtime-test`, `needs-maintainer-decision`, `needs-spec-ruling`, `defer-to-phase`, `needs-fixture-capture`. The downstream phase scans `carry_forward` entries whose `target_phase` matches its own ID and either resolves them (deleting the entry) or re-defers (updating `target_phase`).
210
+ `kind` is one of: `needs-runtime-test`, `needs-maintainer-decision`, `needs-spec-ruling`, `defer-to-phase`, `needs-fixture-capture`, or a post-pipeline work kind such as `spike` or `amendment`. Every new `carry_forward.target_phase` must be an ID in the active pipeline. Every `post_pipeline` entry requires a stable ID. Open questions should carry a stable `id` (e.g. `q-loadconfig-ambiguity`); if omitted, the framework auto-assigns one. When a later phase resolves an open question, list its id in `open_question_closures` to remove it from all phases. The downstream phase records resolved carry-forward IDs in `carry_forward_closures`; completion removes those entries atomically.
191
211
 
192
212
  ## Phase Selection Logic
193
213
 
@@ -198,9 +218,9 @@ carry_forward:
198
218
  5. Load that phase's `skill_path` and all files listed in `required_reads`.
199
219
  6. Run the phase. Write output to `primary_output`.
200
220
  7. Run validation per `workflow/VALIDATE.md`. Append the validation block to the output.
201
- 8. Enforce completion rules: the primary output file must exist with a PASS or PASS WITH GAPS validation block, status.yaml must reflect completion, and THREAD_LOG.md must have a handoff entry.
221
+ 8. Write `scratch/handoffs/<phase>.yaml`, then run completion. The framework verifies the primary output and validation, applies the handoff to `status.yaml`, and maintains the closeout and `THREAD_LOG.md` entry.
202
222
 
203
- **Parallel phase warning:** Some phases share the same `depends_on` and can run concurrently (e.g., `contracts` and `protocols` both depend only on `architecture`). If two sessions update `status.yaml` at the same time, the second write will overwrite the first. When running parallel phases, update `status.yaml` carefully — read the file immediately before writing, and preserve the status of any phase completed by a sibling session.
223
+ **Parallel phases:** Some phases share the same `depends_on` and can run concurrently. Each session writes only its phase handoff; completion serializes canonical state changes with a filesystem lock so sibling phase state is preserved.
204
224
 
205
225
  ## Session Update Protocol
206
226
 
@@ -217,9 +237,9 @@ When a session starts:
217
237
  When a session finishes durable work:
218
238
 
219
239
  1. Run the validation step described in `workflow/VALIDATE.md`. Append a validation block to the output.
220
- 2. Update `workflow/status.yaml` (the single source of truth for progress): mark the phase status as `complete`, advance `current_phase` to the next pending phase, and update both `open_questions` and `carry_forward`. When all phases in the pipeline are complete, set `current_phase` to `complete`.
221
- 3. Record 2-3 key observations in `owner_notes` for the completed phase (e.g., row counts, notable decisions, scope of analysis).
222
- 4. Write a per-session closeout file at `closeouts/<YYYY-MM-DD>-<phase-or-module>.md` using `templates/closeout-template.md`. Append a one-line index entry to `THREAD_LOG.md` pointing at it.
240
+ 2. Write `scratch/handoffs/<phase>.yaml` with `schema_version: 1`, the exact `phase_id`, arrays for `owner_notes`, `open_questions`, `carry_forward`, `carry_forward_closures`, `open_question_closures`, `post_pipeline`, and `decisions`, plus `closeout_summary` and optional multiline `closeout_content`. Omitted arrays default to empty; malformed collection shapes fail completion.
241
+ 3. Record 2-3 key observations in the handoff's `owner_notes` (e.g., row counts, notable decisions, scope of analysis). Do not provide a canonical timestamp; the host clock owns timestamps.
242
+ 4. Run `/codecarto-complete` (or `codecarto_complete`). The framework atomically updates `workflow/status.yaml`, writes or updates one canonical closeout, and appends one idempotent `THREAD_LOG.md` entry. Do not edit those files directly.
223
243
  5. Store the durable output in the declared `findings/` path.
224
244
  6. If the session made cross-cutting decisions or discovered project-wide invariants, propose additions to `CONVENTIONS.md` (in the closeout's "Proposed Conventions" section) and `DECISIONS.md` (numbered entries in the closeout's "Decisions Beyond Prompt" section). The orchestrator promotes these to the canonical files.
225
245
 
@@ -236,9 +256,9 @@ This conversation produces inputs the synthesis phase actually needs (locked tar
236
256
 
237
257
  ## Guardrails
238
258
 
239
- These rules cannot be enforced by the template — they rely on the LLM following instructions. A future code-backed implementation should enforce them programmatically.
259
+ These rules combine framework enforcement with explicit agent discipline:
240
260
 
241
- 1. **Validation gate:** Never set a phase's status to `complete` in `status.yaml` if the validation block contains any FAIL result. Fix the output first, re-run validation, and only then mark complete. If the validation is PASS WITH GAPS, document the gaps in `open_questions` before marking complete.
261
+ 1. **Validation gate:** Completion refuses FAIL or MISSING validation. Fix the output first and re-run validation. If validation is PASS WITH GAPS, document the gaps in the handoff's `open_questions`.
242
262
  2. **Status recovery:** If `workflow/status.yaml` becomes malformed (bad YAML syntax, missing fields), do not guess at the intended state. Stop and ask the user to review the file. Compare against the phase outputs in `findings/` to reconstruct which phases are actually complete.
243
263
  3. **Output path verification:** After writing a phase's primary output, verify the file path matches the `primary_output` field in the active pipeline YAML. Do not write findings to a path that belongs to a different phase.
244
264
 
@@ -248,7 +268,7 @@ These rules cannot be enforced by the template — they rely on the LLM followin
248
268
  - Rough working notes go under `scratch/`.
249
269
  - The primary outputs are listed in the deliverables table above.
250
270
  - Secondary outputs are created only when needed, using `mode: append`.
251
- - Per-session closeouts go under `closeouts/<YYYY-MM-DD>-<phase-or-module>.md`. `THREAD_LOG.md` is an INDEX of one-line pointers to those closeouts, not the primary store.
271
+ - Completion owns `closeouts/<YYYY-MM-DD>-<phase-or-module>.md` and `THREAD_LOG.md`; implementing sessions supply closeout content through their phase handoff.
252
272
  - Cross-cutting patterns go in `CONVENTIONS.md`; numbered cross-cutting decisions go in `DECISIONS.md`. Both are orchestrator-maintained — implementing sessions propose in their closeout, the orchestrator promotes.
253
273
  - Do not store durable findings only in `THREAD_LOG.md`. The log is an index, not the primary artifact store.
254
274
 
@@ -275,7 +295,8 @@ your-repo/
275
295
  state-and-storage/ # (Optional) Extracted durable state notes.
276
296
  build-and-deploy/ # (Optional) Build pipeline and packaging notes.
277
297
  config-model/ # (Optional) Configuration inheritance and env behavior.
278
- scratch/ # Disposable analysis notes.
298
+ scratch/ # Disposable analysis notes plus framework handoffs/checkpoints.
299
+ handoffs/<phase>.yaml # Structured state/closeout proposal consumed by completion.
279
300
  templates/ # Output templates and log entry templates.
280
301
  skills/
281
302
  spec-delta-application/ # Post-pipeline skill: apply triaged spec deltas with citation discipline.
@@ -287,6 +308,7 @@ your-repo/
287
308
  pipeline-defect-scan.yaml # 2-phase (architecture + defect scan).
288
309
  pipeline-lite.yaml # 3-phase (no porting or reimpl).
289
310
  pipeline-architecture-only.yaml # 1-phase (architecture only).
311
+ pipeline-synthesis.yaml # 4-phase forward synthesis (Pi/MCP only).
290
312
  status.yaml # Per-project progress. Single source of truth.
291
313
  VALIDATE.md # Validation protocol. Run after every phase.
292
314
  closeouts/ # Per-session closeout files (replaces monolithic THREAD_LOG body).
@@ -36,4 +36,7 @@ pipeline: workflow/pipeline.yaml # 5-phase without defect
36
36
  pipeline: workflow/pipeline-defect-scan.yaml # 2-phase defect audit — remove contracts through reimplementation-spec
37
37
  pipeline: workflow/pipeline-lite.yaml # 3-phase understanding — remove defect-scan phases, porting, and reimplementation-spec
38
38
  pipeline: workflow/pipeline-architecture-only.yaml # 1-phase quick overview — keep only architecture
39
+ pipeline: workflow/pipeline-synthesis.yaml # 4-phase forward synthesis — vision + confirmed library specs → project plan (Pi/MCP only)
39
40
  ```
41
+
42
+ The synthesis pipeline is different from the analysis variants: it requires Pi or MCP, a configured non-empty CodeCartographer library, and a completed `inputs/vision.md`. It pauses after proposing candidate specs and will not merge or finalize until the user changes at least one proposal checkbox from `[ ]` to `[x]`.
@@ -0,0 +1,3 @@
1
+ # Goal Synthesis
2
+
3
+ The synthesis pipeline writes the human-confirmation proposal and final evidence-backed project plan here.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: finalize-evidence-backed-project-plan
3
+ description: Transform a confirmed product vision and merged reusable specifications into an executable project plan whose important decisions remain traceable.
4
+ ---
5
+
6
+ # Finalize Evidence-Backed Project Plan
7
+
8
+ Produce `findings/goal-synthesis/project-plan.md` using `templates/project-plan.md`.
9
+
10
+ Use `findings/spec-merge/merged-spec.md` as the default compression boundary. Deep-read a confirmed library specification only when the merged intermediate names a gap, unresolved conflict, or missing acceptance detail. Record any targeted deep reads in Coverage and limits.
11
+
12
+ Create a coherent build plan:
13
+
14
+ - define the first executable vertical slice,
15
+ - identify target components and stable public boundaries,
16
+ - break delivery into dependency-ordered work packages,
17
+ - give every work package an observable acceptance gate,
18
+ - preserve open conflicts and unknowns with owners or dispositions,
19
+ - state deliberate non-goals.
20
+
21
+ The provenance ledger is mandatory. Map every load-bearing architecture, scope, behavior, and sequencing decision to one of:
22
+
23
+ - an exact confirmed library reference and version,
24
+ - an exact product-vision section,
25
+ - an explicit synthesis decision, marked `strong inference`,
26
+ - an unresolved choice, marked `open question`.
27
+
28
+ Do not hide conflicts by averaging incompatible source behaviors. Prefer a clear disposition with rationale. A complete-looking plan with missing provenance must fail validation.
29
+
30
+ End with Coverage and limits and the validation table from the template.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: propose-synthesis-inputs
3
+ description: Rank reusable CodeCartographer library specifications against a captured product vision and create an explicit human confirmation gate.
4
+ ---
5
+
6
+ # Propose Synthesis Inputs
7
+
8
+ Produce `findings/goal-synthesis/proposal.md` using `templates/proposal.md`.
9
+
10
+ Read `findings/vision-capture/vision.md` first. Use the library index and entry paths supplied in the phase prompt. Start with metadata for all entries; deep-read a specification only when its headline, tags, or capabilities indicate a credible fit that metadata cannot resolve.
11
+
12
+ For each serious candidate:
13
+
14
+ - map its reusable capabilities to concrete vision needs,
15
+ - state the benefit of including it,
16
+ - identify likely conceptual conflicts, irrelevant surface details, and integration costs,
17
+ - identify vision needs no candidate covers,
18
+ - rank it relative to the other candidates.
19
+
20
+ Write every candidate row with an unchecked `[ ]` box. Never confirm on the user's behalf, including in auto mode. The user confirms by editing one or more boxes to `[x]` after reviewing the proposal.
21
+
22
+ On a re-run, preserve existing `[x]` selections unless the user explicitly changed them. Re-evaluate the proposal and mark validation PASS only when the shortlist is coherent; confirmation itself is enforced structurally by the next phase, not by optimistic prose.
23
+
24
+ Treat library entries as read-only. Do not merge them yet. End with Coverage and limits and the validation table from the template.
@@ -7,6 +7,12 @@ description: Synthesize architecture, contracts, and protocol findings into a re
7
7
 
8
8
  This phase synthesizes the outputs of architecture, contracts, and protocols. If defect reports exist, also read and integrate them: `findings/defect-scan/defect-report.md` (full-with-audit pipeline) or both `findings/defect-scan-mechanical/mechanical-defects.md` and `findings/defect-scan-semantic/semantic-defects.md` (full-with-deep-audit pipeline). The pipeline ensures all required phases are complete before this one runs. Read the prior phase artifacts before starting.
9
9
 
10
+ Treat the reverse-engineering bundle as the pipeline's intentional compression boundary. It must be self-sufficient enough for `reimplementation-spec` to start from this one artifact rather than loading every upstream report. Preserve compact source pointers instead of copying upstream prose:
11
+ - Add a Source Index covering architecture, contracts, protocols/state, and defects when present.
12
+ - Carry forward every load-bearing invariant, acceptance obligation, compatibility hazard, and defect disposition.
13
+ - For omitted detail, name the canonical upstream section and the exact condition that should trigger a targeted deep read.
14
+ - Surface conflicts and incomplete coverage explicitly; never hide them behind synthesis.
15
+
10
16
  The source code to analyze is in the parent directory (`../` relative to `.codecarto/`). This is the repository root.
11
17
 
12
18
  Keep four classes of findings separate throughout:
@@ -43,6 +49,7 @@ Use the output template at `templates/reverse-engineering-bundle.md`. Produce:
43
49
  - A protocol and state note set.
44
50
  - Portability hazards consolidated from all prior phases.
45
51
  - Observed facts separated from inferred structure.
52
+ - A compact Source Index and explicit coverage gaps that let downstream synthesis deep-read selectively.
46
53
 
47
54
  Bias toward evidence over cleverness:
48
55
  - Prefer tests over assumptions.
@@ -7,6 +7,14 @@ description: Convert reverse-engineering findings into a language-agnostic reimp
7
7
 
8
8
  Use this skill after the architecture, behavior, and protocol passes are complete enough to trust.
9
9
 
10
+ Start with `findings/porting/reverse-engineering-bundle.md`; it is the default compression boundary for this phase. Do not load every lower-level finding automatically. Follow the bundle's Source Index and deep-read architecture, contracts, protocols, or defect reports only when:
11
+ - the bundle names a gap or conflict,
12
+ - an acceptance scenario needs detail the bundle deliberately omitted,
13
+ - a load-bearing claim lacks enough evidence to state safely, or
14
+ - a defect disposition needs its original rationale.
15
+
16
+ Record those targeted deep reads in the spec's Coverage and limits section. If the bundle is not self-sufficient, mark the affected validation criterion PARTIAL and route the gap through `open_questions` or `carry_forward` rather than silently reconstructing the whole pipeline in context.
17
+
10
18
  Treat the source repo as evidence, not as a template.
11
19
 
12
20
  Define concept-level modules:
@@ -61,6 +69,8 @@ End with a spike list:
61
69
  - risky performance assumptions
62
70
  - platform-sensitive areas that need targeted tests
63
71
 
72
+ For every defect in the bundle, preserve its disposition (`fix before porting`, `port differently`, or `leave behind`) and convert it into an explicit design consequence or acceptance check.
73
+
64
74
  Use the output template at `templates/reimplementation-spec.md`.
65
75
 
66
76
  The source code to analyze is in the parent directory (`../` relative to `.codecarto/`). This is the repository root.
@@ -0,0 +1,3 @@
1
+ # Specification Merge
2
+
3
+ The synthesis pipeline writes its normalized, provenance-rich merge of confirmed library entries here as `merged-spec.md`.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: merge-confirmed-specifications
3
+ description: Normalize only human-confirmed reimplementation specifications into a provenance-rich, conflict-explicit intermediate for project planning.
4
+ ---
5
+
6
+ # Merge Confirmed Specifications
7
+
8
+ Produce `findings/spec-merge/merged-spec.md` using `templates/merged-spec.md`.
9
+
10
+ Read the product vision, proposal, and only the library entries identified as human-confirmed in the phase prompt. The runtime preflight has already verified that at least one proposal checkbox is `[x]`; do not broaden the selection yourself.
11
+
12
+ Merge by concept, not by original repository structure:
13
+
14
+ - normalize capabilities that use different names for the same behavior,
15
+ - preserve load-bearing invariants and externally observable acceptance behavior,
16
+ - distinguish reusable semantics from adapters and source-specific delivery surfaces,
17
+ - record each incompatibility in the conflict ledger,
18
+ - choose `adopt`, `adapt`, `defer`, or `reject` only when the evidence supports it,
19
+ - keep gaps against the vision visible rather than filling them with invented behavior.
20
+
21
+ Every load-bearing row must cite an exact library reference and version, such as `team/router@v2`, or an exact section of the vision. A merged claim without provenance is a validation failure.
22
+
23
+ Treat library entries as read-only. End with Coverage and limits and the validation table from the template.
@@ -0,0 +1,3 @@
1
+ # Vision Capture
2
+
3
+ The synthesis pipeline writes its bounded product vision here as `vision.md`.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: capture-product-vision
3
+ description: Convert a user's intended product into bounded outcomes, constraints, acceptance scenarios, assumptions, and non-goals before selecting reusable specifications.
4
+ ---
5
+
6
+ # Capture Product Vision
7
+
8
+ Produce `findings/vision-capture/vision.md` using `templates/vision.md`.
9
+
10
+ Treat user-stated intent as the primary evidence. Do not inspect or choose library entries in this phase; selection comes later so the available implementation ingredients do not distort the problem definition.
11
+
12
+ Capture:
13
+
14
+ - the specific audience and problem,
15
+ - desired user-visible outcomes,
16
+ - scope boundaries and deliberate non-goals,
17
+ - technical, operational, timeline, privacy, and compatibility constraints,
18
+ - measurable success criteria,
19
+ - black-box acceptance scenarios,
20
+ - assumptions and decisions that still require confirmation.
21
+
22
+ Do not invent missing product choices. If this phase is running without a sufficiently detailed user vision, use the current conversation and any explicitly supplied inputs, mark unsupported details as assumptions, and return `PASS WITH GAPS`. Record truly blocking choices as stable open-question IDs in the phase handoff.
23
+
24
+ Keep architecture preferences separate from required outcomes unless the user made them explicit. The next phases need freedom to compare multiple library specifications against the same neutral vision.
25
+
26
+ End with Coverage and limits and the validation table from the template.
@@ -0,0 +1,11 @@
1
+ # Synthesis vision brief
2
+
3
+ <!--
4
+ Replace this comment with a short description of:
5
+ - who the new product is for,
6
+ - the problem it should solve,
7
+ - the outcome you want,
8
+ - any hard constraints or non-goals.
9
+
10
+ The vision-capture phase will turn your brief into a structured, testable vision.
11
+ -->
@@ -104,6 +104,14 @@
104
104
  logs, caches, databases, generated artifacts.
105
105
  -->
106
106
 
107
+ ## Coverage and limits
108
+
109
+ - Inspected scope:
110
+ - Skipped scope:
111
+ - Evidence basis: source inspection | tests | runtime verification | upstream findings
112
+ - Known blind spots:
113
+ - Coverage disposition: COMPLETE | PARTIAL
114
+
107
115
  ## Open Questions
108
116
 
109
117
  <!-- Items that are still genuinely unknown — need a runtime test, maintainer decision, or spec ruling.
@@ -138,6 +146,7 @@
138
146
  | 3 | Public surfaces are identified. | PASS / PARTIAL / FAIL | |
139
147
  | 4 | Runtime lifecycle, concurrency model, and porting priorities are summarized. | PASS / PARTIAL / FAIL | |
140
148
  | 5 | Findings are marked with evidence levels. | PASS / PARTIAL / FAIL | |
149
+ | 6 | Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots. | PASS / PARTIAL / FAIL | |
141
150
 
142
151
  **Validated by:** [session identifier or date]
143
152
  **Overall:** PASS / PASS WITH GAPS / FAIL
@@ -91,6 +91,14 @@
91
91
  |---|----------|--------------|--------|------------------|
92
92
  | 1 | | | | |
93
93
 
94
+ ## Coverage and limits
95
+
96
+ - Inspected scope:
97
+ - Skipped scope:
98
+ - Evidence basis: source inspection | tests | runtime verification | upstream findings
99
+ - Known blind spots:
100
+ - Coverage disposition: COMPLETE | PARTIAL
101
+
94
102
  ## Open Questions
95
103
 
96
104
  <!-- Items that are still genuinely unknown — need a runtime test, maintainer decision, or spec ruling.
@@ -129,6 +137,7 @@
129
137
  | 4 | Contract ownership is mapped back to a layer or package. | PASS / PARTIAL / FAIL | |
130
138
  | 5 | A black-box acceptance list is included. | PASS / PARTIAL / FAIL | |
131
139
  | 6 | Findings are marked with evidence levels. | PASS / PARTIAL / FAIL | |
140
+ | 7 | Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots. | PASS / PARTIAL / FAIL | |
132
141
 
133
142
  **Validated by:** [session identifier or date]
134
143
  **Overall:** PASS / PASS WITH GAPS / FAIL
@@ -99,6 +99,14 @@
99
99
 
100
100
  ---
101
101
 
102
+ ## Coverage and limits
103
+
104
+ - Inspected scope:
105
+ - Skipped scope:
106
+ - Evidence basis: source inspection | tests | runtime verification | upstream findings
107
+ - Known blind spots:
108
+ - Coverage disposition: COMPLETE | PARTIAL
109
+
102
110
  ## Validation
103
111
 
104
112
  <!-- Fill in this table per workflow/VALIDATE.md. The rows below match the full pipeline.
@@ -111,6 +119,7 @@
111
119
  | 3 | Findings are organized by pass and sorted by severity. | PASS / PARTIAL / FAIL | |
112
120
  | 4 | Summary tables are complete and counts match the detailed findings. | PASS / PARTIAL / FAIL | |
113
121
  | 5 | Findings are marked with evidence levels. | PASS / PARTIAL / FAIL | |
122
+ | 6 | Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots. | PASS / PARTIAL / FAIL | |
114
123
 
115
124
  **Validated by:** [session identifier or date]
116
125
  **Overall:** PASS / PASS WITH GAPS / FAIL
@@ -88,6 +88,14 @@
88
88
 
89
89
  ---
90
90
 
91
+ ## Coverage and limits
92
+
93
+ - Inspected scope:
94
+ - Skipped scope:
95
+ - Evidence basis: source inspection | tests | runtime verification | upstream findings
96
+ - Known blind spots:
97
+ - Coverage disposition: COMPLETE | PARTIAL
98
+
91
99
  ## Validation
92
100
 
93
101
  <!-- Fill in this table per workflow/VALIDATE.md. The rows below match the mechanical-pass scope. -->
@@ -99,6 +107,7 @@
99
107
  | 3 | Findings are organized by pass and sorted by severity. | PASS / PARTIAL / FAIL | |
100
108
  | 4 | Summary tables are complete and counts match the detailed findings. | PASS / PARTIAL / FAIL | |
101
109
  | 5 | Findings are marked with evidence levels. | PASS / PARTIAL / FAIL | |
110
+ | 6 | Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots. | PASS / PARTIAL / FAIL | |
102
111
 
103
112
  **Validated by:** [session identifier or date]
104
113
  **Overall:** PASS / PASS WITH GAPS / FAIL
@@ -0,0 +1,58 @@
1
+ # Confirmed Specification Merge
2
+
3
+ ## Confirmed inputs
4
+
5
+ | Reference | Version | Source path | Role in the merge |
6
+ |---|---|---|---|
7
+ | | | | |
8
+
9
+ ## Normalized capability model
10
+
11
+ | Capability | Required behavior | Invariants | Source references | Vision fit |
12
+ |---|---|---|---|---|
13
+ | | | | | |
14
+
15
+ ## Architecture ingredients
16
+
17
+ | Concept | Responsibility | Inputs and outputs | Constraints | Provenance |
18
+ |---|---|---|---|---|
19
+ | | | | | |
20
+
21
+ ## Conflict ledger
22
+
23
+ | ID | Sources in tension | Conflict | Disposition | Confidence |
24
+ |---|---|---|---|---|
25
+ | | | | adopt / adapt / defer / reject | observed / strong inference / open question |
26
+
27
+ ## Gaps against the vision
28
+
29
+ | Vision need | Missing or weak evidence | Plan consequence |
30
+ |---|---|---|
31
+ | | | |
32
+
33
+ ## Acceptance behavior inventory
34
+
35
+ | # | Behavior | Observable acceptance | Provenance |
36
+ |---|---|---|---|
37
+ | 1 | | | |
38
+
39
+ ## Coverage and limits
40
+
41
+ - Inspected scope:
42
+ - Skipped scope:
43
+ - Evidence basis: confirmed library specifications | vision | proposal
44
+ - Known blind spots:
45
+ - Coverage disposition: COMPLETE | PARTIAL
46
+
47
+ ## Validation
48
+
49
+ | # | Criterion | Result | Evidence |
50
+ |---|---|---|---|
51
+ | 1 | Only human-confirmed library entries are merged. | PASS / PARTIAL / FAIL | |
52
+ | 2 | Capabilities, invariants, constraints, and acceptance behavior are normalized by concept rather than copied by source structure. | PASS / PARTIAL / FAIL | |
53
+ | 3 | Conflicts, gaps, and chosen dispositions are explicit. | PASS / PARTIAL / FAIL | |
54
+ | 4 | Every load-bearing merged claim has a provenance reference. | PASS / PARTIAL / FAIL | |
55
+ | 5 | Coverage and limits name inspected scope, skipped scope, evidence basis, and blind spots. | PASS / PARTIAL / FAIL | |
56
+
57
+ **Validated by:** [session identifier or date]
58
+ **Overall:** PASS / PASS WITH GAPS / FAIL
@@ -0,0 +1,41 @@
1
+ ---
2
+ phase: <phase-id>
3
+ updated_at: <ISO-8601 timestamp>
4
+ source: manual | pi-compaction
5
+ ---
6
+
7
+ # Phase checkpoint
8
+
9
+ ## Goal and output
10
+
11
+ - Phase:
12
+ - Primary output:
13
+ - Current objective:
14
+
15
+ ## Evidence established
16
+
17
+ <!-- Preserve evidence levels and exact source paths. -->
18
+
19
+ ## Files and subsystems inspected
20
+
21
+ - Inspected:
22
+ - Not yet inspected:
23
+
24
+ ## Output progress
25
+
26
+ - Sections complete:
27
+ - Sections remaining:
28
+
29
+ ## Open questions and carry-forward candidates
30
+
31
+ - Open questions:
32
+ - Carry-forward:
33
+
34
+ ## Validation gaps
35
+
36
+ - Criteria satisfied:
37
+ - Criteria at risk:
38
+
39
+ ## Exact next steps
40
+
41
+ 1.
@@ -0,0 +1,22 @@
1
+ # Phase handoff schema v1. Copy to scratch/handoffs/<phase-id>.yaml.
2
+ # The framework owns canonical timestamps, status.yaml, closeouts, and THREAD_LOG.md.
3
+ schema_version: 1
4
+ phase_id: <phase-id>
5
+ owner_notes: []
6
+ open_questions: []
7
+ carry_forward: []
8
+ carry_forward_closures: []
9
+ # Resolved open questions: their IDs are removed from all phases.
10
+ open_question_closures: []
11
+ # Work after the active pipeline: spikes, amendments, deltas, maintainer rulings,
12
+ # or opinionated reruns. Every entry requires a stable id.
13
+ post_pipeline: []
14
+ decisions: []
15
+ closeout_summary: ""
16
+ # Optional full closeout Markdown. YAML literal blocks are supported.
17
+ closeout_content: |-
18
+ # Closeout — <phase-id>
19
+
20
+ ## Summary
21
+
22
+ -