@gtrabanco/pi-agentic-workflow 0.13.2 → 0.14.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 (95) hide show
  1. package/README.md +3 -9
  2. package/dist/routing/catalogue.d.ts +1 -1
  3. package/dist/routing/catalogue.js +1 -1
  4. package/dist/runtime.d.ts +45 -0
  5. package/dist/runtime.js +62 -0
  6. package/package.json +10 -8
  7. package/skills/audit-docs/SKILL.md +6 -5
  8. package/skills/audit-pr/SKILL.md +1 -1
  9. package/skills/audit-pr/references/PORTABILITY.md +1 -1
  10. package/skills/execute-phase/SKILL.md +207 -116
  11. package/skills/execute-phase/references/DESCOPE.md +22 -18
  12. package/skills/execute-phase/references/EXECUTION_CONTRACT.md +69 -77
  13. package/skills/execute-phase/references/FOLDING.md +34 -47
  14. package/skills/execute-phase/references/PREFLIGHT.md +103 -114
  15. package/skills/execute-phase/references/PRE_EXECUTION_GATE.md +53 -60
  16. package/skills/init-workspace/SKILL.md +52 -16
  17. package/skills/init-workspace/references/BOOTSTRAP_DISCOVERY.md +6 -6
  18. package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +17 -10
  19. package/skills/init-workspace/references/PORTABILITY.md +1 -1
  20. package/skills/init-workspace/references/UPGRADE.md +50 -15
  21. package/skills/log-session/SKILL.md +4 -3
  22. package/skills/orchestration-envelope/references/TURN_CONTRACT.md +1 -1
  23. package/skills/pre-execution-review/references/LEDGERS.md +39 -39
  24. package/skills/pre-execution-review/references/POLICY.md +1 -0
  25. package/skills/product-audit/SKILL.md +4 -4
  26. package/skills/product-audit/references/AUDIT_PROCESS.md +3 -3
  27. package/skills/review-change/SKILL.md +1 -1
  28. package/skills/review-change/references/PORTABILITY.md +1 -1
  29. package/skills/unit-lane/SKILL.md +154 -0
  30. package/skills/unit-lane/references/DESIGN.md +35 -0
  31. package/skills/unit-lane/references/DOCS.md +36 -0
  32. package/skills/unit-lane/references/EVIDENCE.md +34 -0
  33. package/skills/unit-lane/references/IMPLEMENT.md +45 -0
  34. package/skills/unit-lane/references/PLAN.md +38 -0
  35. package/skills/unit-lane/references/RELEASE.md +45 -0
  36. package/skills/unit-lane/references/RESEARCH.md +37 -0
  37. package/skills/unit-lane/references/REVIEW.md +45 -0
  38. package/skills/unit-lane/references/STEPS.md +23 -0
  39. package/skills/unit-lane/references/TESTS.md +32 -0
  40. package/skills/workflow-status/references/ENVELOPE_FIELDS.md +5 -6
  41. package/skills/workflow-status/references/SENSOR_CORE.md +16 -20
  42. package/skills/workflow-status/references/SENSOR_SIGNALS.md +5 -7
  43. package/skills/design-feature/SKILL.md +0 -231
  44. package/skills/design-feature/references/INTERVIEW.md +0 -74
  45. package/skills/design-feature/references/PORTABILITY.md +0 -15
  46. package/skills/design-feature/references/REPAIR.md +0 -88
  47. package/skills/design-feature/references/UPSERT_EXAMPLE.md +0 -8
  48. package/skills/design-feature/references/WRITE_AND_UPSERT.md +0 -115
  49. package/skills/evidence-grounding/SKILL.md +0 -174
  50. package/skills/evidence-grounding/references/DELEGATION.md +0 -131
  51. package/skills/evidence-grounding/references/READINESS.md +0 -130
  52. package/skills/evidence-grounding/references/ROWS.md +0 -93
  53. package/skills/execute-phase/references/BATCH_AND_PORTABILITY.md +0 -57
  54. package/skills/execute-phase/references/CLOSEOUT.md +0 -77
  55. package/skills/execute-phase/references/HANDOFF.md +0 -21
  56. package/skills/execute-phase/references/OPPORTUNISTIC_FINDING.md +0 -45
  57. package/skills/execute-phase/references/UNIT_LOOP.md +0 -88
  58. package/skills/execute-phase/references/WORKFLOWS_FEATURE.md +0 -37
  59. package/skills/execute-phase/references/WORKFLOWS_FIX.md +0 -43
  60. package/skills/execute-phase/references/WORKFLOWS_LEGACY.md +0 -26
  61. package/skills/execute-phase/references/WORKFLOWS_SMALL_PHASED.md +0 -38
  62. package/skills/generate-docs/SKILL.md +0 -145
  63. package/skills/generate-docs/references/ADAPTERS.md +0 -15
  64. package/skills/generate-docs/references/ADAPTER_DISCOVERY.md +0 -33
  65. package/skills/generate-docs/references/GENERATION_PROCESS.md +0 -90
  66. package/skills/implementation-discovery/SKILL.md +0 -209
  67. package/skills/plan-feature/SKILL.md +0 -208
  68. package/skills/plan-feature/references/ROUTING.md +0 -155
  69. package/skills/plan-feature-from-issue/SKILL.md +0 -162
  70. package/skills/plan-feature-scaffold/SKILL.md +0 -112
  71. package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +0 -122
  72. package/skills/plan-fix/SKILL.md +0 -161
  73. package/skills/plan-fix/references/PLANNING_PROCESS.md +0 -148
  74. package/skills/plan-fix/references/SPEC_CONTRACT.md +0 -22
  75. package/skills/planning-preflight/SKILL.md +0 -130
  76. package/skills/replan-findings/SKILL.md +0 -131
  77. package/skills/replan-findings/references/PHASE_APPEND.md +0 -89
  78. package/skills/review-plan/SKILL.md +0 -154
  79. package/skills/review-plan/references/CHECKS.md +0 -111
  80. package/skills/review-plan/references/ENG-CHECKS.md +0 -30
  81. package/skills/review-plan/references/OUTPUT.md +0 -166
  82. package/skills/review-spec/SKILL.md +0 -145
  83. package/skills/review-spec/references/CHECKS.md +0 -108
  84. package/skills/review-spec/references/OUTPUT.md +0 -160
  85. package/skills/ship-roadmap/SKILL.md +0 -120
  86. package/skills/ship-roadmap/references/ADVANCE.md +0 -117
  87. package/skills/ship-roadmap/references/AUDIT_AND_MERGE.md +0 -64
  88. package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +0 -27
  89. package/skills/ship-roadmap/references/FOUNDING.md +0 -101
  90. package/skills/ship-roadmap/references/GUARDRAILS.md +0 -56
  91. package/skills/ship-roadmap/references/MODEL_ROUTING.md +0 -16
  92. package/skills/ship-roadmap/references/PORTABILITY.md +0 -34
  93. package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +0 -94
  94. package/skills/ship-roadmap/references/STOP_CONDITIONS.md +0 -9
  95. package/skills/ship-roadmap/references/TERMINAL_REPORT.md +0 -34
@@ -1,21 +0,0 @@
1
- ## Phase handoff record (`progress.md` — fixed schema)
2
-
3
- Every phase ends by APPENDING one entry to the unit's `progress.md`. Feature
4
- mode: the file `plan-feature-scaffold` created. Phased XS/S single-pass and
5
- `--fix` units: create `progress.md` beside the SPEC on P1 (the SPEC's
6
- checkboxes stay the task ledger; this file is the **handoff channel**).
7
- Fixed schema — all five lines present, `none` is valid, free prose is not:
8
-
9
- ```
10
- ## P<k> — <YYYY-MM-DD>
11
- - Done: <the phase's delivered tasks, one line>
12
- - Remains: <in-unit work still open, or none>
13
- - Gotchas: <surprises, workarounds, or decisions the NEXT phase must know, or none>
14
- - Files: <paths touched>
15
- - Next: P<k+1> — <its title> | unit finished
16
- ```
17
-
18
- The entry rides the phase commit (no sha in the entry — the carrying commit is
19
- the phase sha; `git log` resolves it). The next phase starts in a fresh
20
- conversation and reads only `SPEC.md`, its phase's `TASKS.md` section (or SPEC
21
- `## Phases`), and `progress.md`. Never rely on prior-session memory.
@@ -1,45 +0,0 @@
1
- ## Opportunistic finding policy
2
-
3
- Use this only for genuinely out-of-scope work discovered while implementing the
4
- current unit. Missing acceptance, correctness, security, accessibility, required
5
- UX/error behavior, or a phase task remains current-unit work — fix/replan/decide
6
- inside the unit; it is never a proposal or issue.
7
-
8
- ### Closed decision ladder
9
-
10
- Evaluate rows in order; every box in a selected row must pass. Estimates include
11
- tests and docs.
12
-
13
- | Decision | Pass only if every box is true | Action |
14
- |---|---|---|
15
- | **Autofix** | ≤15 lines; ≤2 files; files already touched; low risk; no public API/schema/migration/dependency/permission/architecture/user-visible change; objective unchanged | Fix in the current phase commit and run its gate. |
16
- | **Opportunistic Fix** | ≤40 lines; ≤3 files; files touched or directly covered by the phase test; supports touched behavior/consistency; low risk; no public API/schema/migration/dependency/permission/architecture/acceptance change; objective unchanged | Fix in the phase commit, add focused behavior coverage, run the gate. |
17
- | **Proposal** | Either fix row fails, evidence is uncertain, work is independent, or product/risk judgment is needed | Do not edit or create an issue. Record a compact proposal with evidence and trigger for explicit user batch triage. |
18
-
19
- `≤` is inclusive. Check Opportunistic Fix even after a non-size Autofix failure.
20
- More than 40 lines/3 files is a Proposal unless it is current-unit work, in
21
- which case it is `replan-in-unit` and stays on the same branch/PR.
22
-
23
- ### Record before acting
24
-
25
- Append one row to `decisions.md` before editing/recording:
26
-
27
- ```markdown
28
- | Date | Finding | Evidence | Estimate | Risk | Local files | Decision | Why | Trigger | Record |
29
- |---|---|---|---|---|---|---|---|---|---|
30
- | <date> | <finding> | <file:line/command> | <lines/files> | <low/med/high> | <yes/no + paths> | <Autofix/Opportunistic Fix/Proposal> | <boxes> | <when to reconsider> | <commit sha|proposal> |
31
- ```
32
-
33
- For a Proposal, `Record` stays `proposal`; no forge operation runs. Batch the
34
- proposal in the unit's final report. Only an explicit user invocation of
35
- `triage-issue`/the project's backlog intake may create tracked work, where it
36
- must dedupe against existing issues first.
37
-
38
- ### Guardrails
39
-
40
- - No automatic `gh issue create` or equivalent from execution, review, fold,
41
- audit, or their loops.
42
- - Never use Proposal to move unfinished SPEC/task scope out of the unit.
43
- - An uncertain classification becomes Proposal and may stop for user judgment;
44
- it never authorizes adjacent edits.
45
- - `known-issues.md` records blockers, not a substitute backlog.
@@ -1,88 +0,0 @@
1
- ## Whole-unit execution loop
2
-
3
- This route runs only when the user omitted `P<n>`. One user invocation advances
4
- every remaining planned phase; phase boundaries still own scope, gates,
5
- documentation, and commits.
6
-
7
- ### Dispatch
8
-
9
- - `execute-phase <NN>` → all remaining feature phases.
10
- - `execute-phase --fix <n>` → all remaining fix phases.
11
- - An explicit `P<n>` never loads this route and executes exactly one phase.
12
- - Default `--max-attempts 3` limits repair attempts for the same unchanged gate
13
- failure inside one phase. A positive user value overrides it.
14
-
15
- ### Queue
16
-
17
- Read the unit ledger once and select unfinished phases in ascending order. A
18
- phase is unfinished when any task is unticked or its evidence/commit is absent.
19
- Reconcile ticks against repository evidence before selection; contradictory
20
- state with no unique next phase returns `AMBIGUOUS` and stops.
21
-
22
- Materialize the queue before work as explicit phase IDs (`P2, P3, P4`), never
23
- an empty array, ellipsis, or template placeholder. Every terminal report names
24
- the phases actually attempted/completed.
25
-
26
- The final `Hardening & PR`/close-out phase remains last. Never run it while an
27
- earlier phase is unfinished.
28
-
29
- ### Loop — one transaction per phase
30
-
31
- For each queued phase:
32
-
33
- 1. Recompute the frozen `ACCEPTANCE.md` blob and compare it with the acceptance
34
- receipt. Mismatch/missing → `ACCEPTANCE GATE BLOCKED`; no edits.
35
- 2. Run phase-lint, architectural-invariant, dependency/own-status fast paths,
36
- and the selected mode workflow for this phase. A fail-closed gate ends the
37
- whole invocation with its existing fixed block.
38
- 3. Prefer a fresh worker context when the host supports subagents/headless
39
- workers; give it only `ACCEPTANCE.md`, `SPEC.md`, this phase's tasks, the last
40
- `progress.md` receipt, and the selected workflow contracts. The conductor
41
- keeps receipts, never raw source context. Without that primitive, execute
42
- inline and apply the same input cap.
43
- 4. Implement the phase, run its exact validators and normal project gate, update
44
- unit docs, and commit. Never commit red and never weaken a validator.
45
- 5. On a red gate, feed back only the failing command, exit status, failing test
46
- names, and smallest relevant output. Repair the same phase and retry. Same
47
- failure with no diff twice, or `--max-attempts` exhausted, stops:
48
-
49
- ```text
50
- UNIT LOOP — <unit> BLOCKED at <P<n>>
51
- Reason: <NO-PROGRESS|ATTEMPT-BUDGET> · Attempts: <n>
52
- Last validator: <command> → <exit/status + compact failure>
53
- Preserved: no red commit; acceptance blob <sha> unchanged
54
-
55
- → Next: inspect the named blocker, then re-run /execute-phase <unit>
56
- · architecture/product decision required → resolve it before resuming
57
- · continue atomically → /execute-phase <unit> <P<n>>
58
- ```
59
-
60
- 6. Before the commit append a compact cycle receipt to `progress.md`:
61
-
62
- ```text
63
- ## Unit-loop receipt — <P<n>>
64
- - Commit: pending · Gate: <command> (exit 0) · Acceptance blob: <sha>
65
- - Next: <P<n+1>|close-out|none> · Attempts: <n>
66
- ```
67
-
68
- Commit it with the phase, then replace `pending` with the resulting SHA in
69
- the next phase's reconciliation note (never amend an already-published
70
- commit only to self-reference it). Reduce working state to the receipt.
71
- 7. Do **not** stop for intermediate review checkpoint triggers. Record any
72
- trigger in the receipt for final risk selection; the mandatory independent
73
- end review covers the frozen final candidate once.
74
-
75
- ### Terminal
76
-
77
- When the last implementation phase is green, run the existing close-out phase:
78
- mark done, push, open/link the PR, and leave the branch remote-current. Then:
79
-
80
- ```text
81
- UNIT LOOP — <unit> COMPLETE
82
- Phases: <n> · Commits: <sha list> · Acceptance: <blob> · Gate: PASS
83
- PR: <url>
84
-
85
- → Next: /review-change on the changed HEAD — the mandatory end review (fold-findings only after a REVIEW-FAIL)
86
- · findings → /fold-findings (only on a REVIEW-FAIL), then re-run /review-change — triage or replan unresolved findings
87
- · merge gate after REVIEW-PASS → /audit-pr
88
- ```
@@ -1,37 +0,0 @@
1
- ## Feature mode workflow
2
-
3
- **Atomic feature phase** — `docs/features/<NN>-<slug>/`. An explicit `P<n>`
4
- runs this once; whole-unit mode calls it once per remaining phase.
5
-
6
- 1. Verify branch (create if on `main`). **P1 only:** if the planning artifacts
7
- (`docs/features/<NN>-<slug>/`) are still uncommitted, commit them first on the
8
- feature branch — `git add docs/features/<NN>-<slug> && git commit -m "docs(<NN>-<slug>): planning artifacts"` —
9
- so planning history stays separate from implementation.
10
- 2. Read `progress.md` first (the phase handoff record — fixed schema above;
11
- the last entry's `Remains:`/`Gotchas:` lines are the previous phase's
12
- message to you), then `SPEC.md` + the requested phase's `TASKS.md`
13
- section. That is the whole handoff — never rely on session memory from a
14
- previous phase, and honor the *Context budget* for everything beyond
15
- these files.
16
- 3. Implement only that phase (see *Implementation guidance*).
17
- 4. Run the gate (type-check, tests, build). **If red:** fix within the phase's
18
- scope and re-run — never commit red. If the failure can't be fixed within
19
- this phase's scope, record it in `known-issues.md`, leave the work
20
- uncommitted, and stop with a clear report.
21
- 5. Update the per-phase docs.
22
- 6. Stage and commit: `git add <changed files>` then `git commit -m "<type>(<scope>): <summary>"` — one commit per phase, conventional format. Run this; don't just describe what should be committed.
23
- 7. **Explicit-phase mode only:** check the review checkpoint triggers and make
24
- the existing non-blocking recommendation when one fires. Whole-unit mode
25
- records the trigger in its phase receipt and continues; it never interrupts
26
- for an intermediate review. The end review stays mandatory.
27
-
28
- **Resuming an interrupted phase (stated contract — any agent must honor it).**
29
- If, on entry, the unit branch already carries dirty files or commits belonging
30
- to the requested phase (a prior run died mid-turn — e.g. the driver process
31
- restarted), do **not** restart the phase from scratch: reconcile against
32
- `TASKS.md` first — verify each ticked task's evidence actually exists (code
33
- path / test present), untick any tick without evidence, then continue from the
34
- first unticked task. Idempotent re-entry is the contract `workflow-status`'s
35
- crash-recovery verdict `RESUMABLE` relies on. If the ledger contradicts the
36
- commits in a way that has no unique next task, stop and report instead of
37
- guessing (that is its `AMBIGUOUS` verdict — a human decides).
@@ -1,43 +0,0 @@
1
- ## Fix mode workflow
2
-
3
- **`--fix`** — `docs/fix/<n>-<topic>/`, template `docs/fix/_TEMPLATE/SPEC.md`,
4
- index `docs/fix/README.md`. A phased fix runs every remaining phase when `P<k>`
5
- is omitted and one phase when it is explicit. The final `Hardening & PR` phase
6
- runs close-out (steps 7–9) after prior phases are green; legacy SPECs run once.
7
-
8
- 1. Verify the issue exists (`gh issue view <n>`); if it doesn't, create it
9
- (`gh issue create --template fix.yml --body-file <path>`, body from the SPEC
10
- written to a Markdown file — per the Markdown rule above).
11
- 2. **If `docs/fix/<n>-<topic>/SPEC.md` already exists (e.g. from `plan-fix`), use it — do not re-draft.** Otherwise copy the template, fill every section, and register the entry in `docs/fix/README.md`.
12
- 3. Verify branch (`fix/<n>-<topic>`).
13
- 4. Implement the fix (no separate planning artifacts; the SPEC and its `## Phases` ledger are enough).
14
- 5. Run the gate.
15
- 6. Stage and commit: `git add <changed files>` then `git commit -m "fix(<scope>): <summary>"`. An explicit implementation phase **STOPs here — no push, no PR**; whole-unit mode continues to the next phase.
16
- 7. **Mark done + open the PR — always (the close-out; in a phased SPEC these
17
- are the final `Hardening & PR` phase's tasks).** Set the
18
- `docs/fix/README.md` entry's status to `done` (built, not yet merged), commit,
19
- `git push`, then open the PR with the body written to a Markdown file (per the
20
- Markdown rule above): `gh pr create --base main --title "fix(<scope>): <summary>" --body-file <path>`
21
- (the body includes `Closes #<n>`). Run the commands. Then, with the returned URL: **print it in the chat**,
22
- set the `docs/fix/README.md` entry to `done · [#<pr>](<pr-url>)`, commit
23
- (`docs: link PR #<n>`), and push again. A fix **never ends branch-only** —
24
- it always leaves an open, chat-linked PR.
25
- 8. **Mandatory review hand-off** → `/review-change`, then `audit-pr` as the merge gate.
26
- Print the next step. **Keep the fix-index entry** until the PR is actually merged
27
- (don't drop issue tracking early; the merge gate also blocks on pending docs).
28
- 9. **After merge only:** remove the `docs/fix/README.md` entry (or archive it to the
29
- project's fix history per its convention) — never before the merge.
30
-
31
- **Resuming an interrupted phase (stated contract — any agent must honor it).**
32
- If, on entry, the fix branch already carries dirty files or commits belonging
33
- to the requested phase (a prior run died mid-turn — e.g. the driver process
34
- restarted), do **not** restart the phase from scratch: reconcile against the
35
- SPEC's `## Phases` checkboxes first — verify each ticked task's evidence
36
- actually exists (code path / test present), untick any tick without evidence,
37
- then continue from the first unticked task. Idempotent re-entry is the contract
38
- `workflow-status`'s crash-recovery verdict `RESUMABLE` relies on. If the ledger
39
- contradicts the commits in a way that has no unique next task, stop and report
40
- instead of guessing (that is its `AMBIGUOUS` verdict — a human decides).
41
-
42
- (The `Depends on:` check for fixes is the same Dependency gate above — it runs
43
- before step 1, transitively, and blocks unless `--force`.)
@@ -1,26 +0,0 @@
1
- ## Legacy mode workflow
2
-
3
- **Legacy single-pass** — a SPEC **without** a `## Phases` section (drafted
4
- before `plan-feature-scaffold` 1.8.0 / `plan-fix` 2.1.0) runs the whole unit
5
- end-to-end in **one pass**. This is the fallback shared by small-feature and
6
- `--fix` modes; a SPEC that carries `## Phases` never runs it.
7
-
8
- 1. Verify branch.
9
- 2. Read `SPEC.md` (+ `DECISIONS.md` if present) and the docs its documentation map points to.
10
- 3. If the SPEC is ambiguous on scope / edge cases / UI, ask first — one question at a time, nothing it already answers.
11
- 4. Implement end-to-end (see *Implementation guidance*).
12
- 5. Run the gate; write `CHECKLIST.md` (below).
13
- 6. Stage and commit: `git add <changed files>` then `git commit -m "<type>(<scope>): <summary>"`.
14
- 7. **Mark done + open the PR — always (the close-out).** Flip the roadmap
15
- row to `done` (it's *built*; merge state lives in the forge, not the status —
16
- see *Marking done*), commit that flip, then `git push` and open the PR
17
- (body written to a file as Markdown, per the Markdown rule above):
18
- `gh pr create --base main --title "<type>(<scope>): <summary>" --body-file <path>`
19
- (put `Closes #<n>` in that body when issue-born). Then, with the URL `gh pr create`
20
- returned: **print it in the chat**, update the roadmap row to
21
- `done · [#<pr>](<pr-url>)`, commit (`docs: link PR #<n>`), and push again —
22
- the link commit rides the same open PR. A single-pass unit **never ends
23
- branch-only** — it always leaves an open, chat-linked PR, regardless of the
24
- review/audit still to come.
25
- 8. **Mandatory review hand-off** → `/review-change` (the required final quality step;
26
- see *Review checkpoint*), then `audit-pr` as the merge gate. Print the next step.
@@ -1,38 +0,0 @@
1
- ## Small/phased mode workflow
2
-
3
- **Phased single-pass units — the default for small (XS/S) feature SPECs.**
4
- Every current XS/S feature SPEC carries `## Phases` (**≥ 2 phases**; final =
5
- `Hardening & PR`). `execute-phase <NN>` runs every remaining phase; explicit
6
- `P<k>` runs one. The SPEC's checkboxes are the execution ledger (there is no
7
- `TASKS.md`): tick each task with evidence.
8
-
9
- **Resuming an interrupted phase (stated contract — any agent must honor it).**
10
- If, on entry, the unit branch already carries dirty files or commits belonging
11
- to the requested phase (a prior run died mid-turn — e.g. the driver process
12
- restarted), do **not** restart the phase from scratch: reconcile against the
13
- SPEC's checkboxes first — verify each ticked task's evidence actually exists
14
- (code path / test present), untick any tick without evidence, then continue
15
- from the first unticked task. Idempotent re-entry is the contract
16
- `workflow-status`'s crash-recovery verdict `RESUMABLE` relies on. If the ledger
17
- contradicts the commits in a way that has no unique next task, stop and report
18
- instead of guessing (that is its `AMBIGUOUS` verdict — a human decides).
19
-
20
- Each phase appends its handoff entry to a `progress.md` beside the SPEC
21
- (created on P1 — see *Phase handoff record*). An implementation phase runs the
22
- per-phase steps below. Explicit-phase mode **STOPs after the phase commit — no
23
- push, no PR** (the turn contract's box 5 "unit not finished" rule); unit-loop
24
- mode continues. The final `Hardening & PR` phase runs close-out after every
25
- prior phase is green; its pre-written tasks ARE the close-out chain.
26
-
27
- Per-phase steps (implementation phases only):
28
-
29
- 1. Verify branch.
30
- 2. Read `SPEC.md` (+ `DECISIONS.md` if present) and the docs its documentation map points to.
31
- 3. If the SPEC is ambiguous on scope / edge cases / UI, ask first — one question at a time, nothing it already answers.
32
- 4. Implement end-to-end (see *Implementation guidance*).
33
- 5. Run the gate; write `CHECKLIST.md` (below).
34
- 6. Stage and commit: `git add <changed files>` then `git commit -m "<type>(<scope>): <summary>"`. **STOP** — no push, no PR until the final phase.
35
-
36
- A SPEC **without** `## Phases` (drafted before those versions) runs the
37
- **legacy single-pass flow** unchanged, end-to-end in one pass — see
38
- [legacy workflow](WORKFLOWS_LEGACY.md).
@@ -1,145 +0,0 @@
1
- ---
2
- name: generate-docs
3
- user-invocable: true
4
- version: 2.0.1
5
- argument-hint: "[NN-slug | fix-n | path/glob] [--review]"
6
- author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
7
- license: MIT
8
- description: >
9
- Generate incremental, diff-driven developer guides through the project's
10
- detected docs adapter. Never regenerate the whole site, scaffold it, or edit
11
- source. Triggers: "generate-docs", "generate the docs", "document this unit".
12
- ---
13
-
14
- # Generate Docs
15
-
16
- Turn the knowledge produced by a unit of work into developer documentation a
17
- contributor can read on the project's docs website — incrementally, as a
18
- by-product of shipping, so a public repo's docs stay current instead of
19
- rotting. A commit says what changed; a guide says how to use it ("how do I
20
- create a domain event and where do I register its handler").
21
-
22
- ## Turn contract — verify before ending the turn
23
-
24
- ```
25
- ✓ The docs adapter was resolved through the Step 0 detection checklist and the
26
- outcome (adapter name, or NOT CONFIGURED) is stated in the report
27
- ✓ Every generated/updated page is WRITTEN to disk (paths listed in the report)
28
- and carries the provenance frontmatter — or zero pages were written and the
29
- report says exactly why
30
- ✓ The verify step was RUN (docs build command or link check) and its result
31
- pasted — never assumed
32
- ✓ Artifact language: explicit user instruction > the project's declared docs
33
- language > English. The CONVERSATION language never decides
34
- ✓ The fixed report block is printed, then the closing `→ Next:` block, as the
35
- ABSOLUTE last output
36
- ```
37
-
38
- About to end the turn with any box unchecked? The turn is NOT done — complete
39
- the missing box first (weak models drop end-of-document duties; this list is
40
- first on purpose).
41
-
42
- ## When to use
43
-
44
- - **After finishing a unit of work** — `execute-phase` recommends this skill at
45
- close-out when the project declares a docs site: document what the unit
46
- changed while the context is fresh.
47
- - **On demand** for a specific area: `generate-docs src/domain/events/`.
48
- - **`--review`** — export the latest `review-change` report as a docs page so
49
- humans can review findings from the website.
50
- - Not for writing SPECs/planning docs (`plan-feature`), session journals
51
- (`log-session`), or reviewing code (`review-change` produces the findings;
52
- this skill only publishes an existing report on request).
53
-
54
- ## Progressive loading — resolve the docs route
55
-
56
- The reference allowlist is exactly the three paths below. Read them in this
57
- order; every selected resource is normative and one hop from this entrypoint.
58
-
59
- 1. Every invocation: read [adapter discovery](references/ADAPTER_DISCOVERY.md)
60
- and resolve the adapter with evidence. `NOT CONFIGURED` stops writing.
61
- 2. Configured adapter only: before choosing any output path or format, read
62
- [adapter slots](references/ADAPTERS.md).
63
- 3. Read [generation process](references/GENERATION_PROCESS.md) and execute the
64
- scope, incrementality, map/review, verify, and report steps.
65
-
66
- Do not load steps 2–3 after `NOT CONFIGURED`. Missing required resource → stop;
67
- never guess an adapter, output path, or fixed contract.
68
-
69
- ## Allowed & forbidden (fixed lists — no interpretation)
70
-
71
- **Allowed:**
72
- - Writing/updating pages under the adapter's guides location
73
- - Updating only the adapter's declared manual sidebar config when the adapter
74
- table requires it
75
- - Running the declared docs build/verify command
76
- - Reading anything (diff, code, docs)
77
-
78
- **Forbidden — never, even if it "would help":**
79
- - Whole-project doc regeneration (the incrementality checklist is the only
80
- page selector)
81
- - Editing source code, tests, or any config other than the adapter's declared
82
- manual sidebar config
83
- - Scaffolding a docs site (installing Astro/Starlight, creating configs)
84
- - Writing outside the adapter's content locations, except that declared manual
85
- sidebar config
86
- - Pages without the provenance frontmatter
87
- - Committing or pushing (the unit's workflow owns the commit)
88
-
89
- ## Return exactly
90
-
91
- ```
92
- GENERATE DOCS — adapter: <starlight|docusaurus|markdown|NOT CONFIGURED> — scope: <scope>
93
-
94
- | Page | Action | Source-unit | Subject paths |
95
- |---|---|---|---|
96
- | <content-path> | created|updated | <NN-slug> | <paths> |
97
-
98
- Map: regenerated (<command>) | n/a — no map command declared | invalid output — <reason>
99
- Review export: <page path> | not requested | no report available
100
- Verify: <command + exit code | links checked: <n>, broken: 0 | n/a — not configured>
101
- Pages: <n> written, <n> skipped by incrementality checklist
102
- Decision: PASS | FAIL | NOT-CONFIGURED
103
- ```
104
-
105
- `FAIL` only when the verify step is red or a written page had to be reverted;
106
- `NOT-CONFIGURED` per Step 0.5; `PASS` otherwise (including 0 pages).
107
-
108
- ## Portability (agents other than Claude Code)
109
-
110
- The workflow is the contract; Claude Code features are conveniences. On an
111
- agent that lacks one, apply the fallback — never skip the step the feature
112
- enables:
113
-
114
- - **No slash-command menu** — where this skill says `/<skill>`, open that
115
- skill's `SKILL.md` and follow it literally in a fresh conversation.
116
- - **No per-skill `model:`/`effort:`** — writing guides is structured
117
- summarization over a diff: a **mid-tier** model suffices; never below the
118
- tier that can read the project's language accurately.
119
- - **No argument passing** — state the scope in the invocation message
120
- ("generate docs for 01-generate-docs"); the Process step 1 order still
121
- applies.
122
-
123
- ## Relationship to other skills
124
-
125
- - **`execute-phase`** recommends this skill at unit close-out when the
126
- documentation map declares a docs site (hand-off via `→ Next:` — never
127
- composed in-turn).
128
- - **`audit-docs`** detects orphan/stale generated pages via the provenance
129
- frontmatter.
130
- - **`init-workspace`** records the `Docs site` declaration this skill's Step 0
131
- reads.
132
- - Not a review: findings/quality belong to `review-change`.
133
-
134
- ## Done when
135
-
136
- - The adapter outcome is stated with evidence; every selected page is written
137
- with provenance frontmatter; the verify step ran and is green (or the
138
- NOT-CONFIGURED report was printed and nothing was written).
139
- - The fixed report block was returned, then:
140
-
141
- ```
142
- → Next: commit these pages with the unit's close-out (they ride the unit's PR)
143
- · unit already closed → commit as docs(<unit>): generated guides on the unit's branch
144
- · adapter NOT CONFIGURED → add the Docs site block to the documentation map, then re-run /generate-docs
145
- ```
@@ -1,15 +0,0 @@
1
- ## Adapters (reference implementations)
2
-
3
- The generic contract is the slots below; anything stack-specific lives only in
4
- this table. Starlight is the first-class reference.
5
-
6
- | Slot | Starlight (reference) | Docusaurus | Plain markdown (fallback) |
7
- |---|---|---|---|
8
- | Content dir | `src/content/docs/` (or the declared one) | `<site>/docs/` (or the declared one) | `docs/site/` |
9
- | Page format | `.mdx`; frontmatter `title`, `description` + provenance keys | `.mdx`; frontmatter `title`, `description` + provenance keys | `.md`; H1 title + provenance keys in an HTML comment frontmatter block |
10
- | Guides | `<content>/guides/<area>/<topic>.mdx` | `<content>/guides/<area>/<topic>.mdx` | `docs/site/guides/<area>/<topic>.md` |
11
- | Knowledge map | `<content>/map/graph.json` + `<content>/map/<module>.mdx` wrappers | `<content>/map/graph.json` + `<content>/map/<module>.mdx` wrappers | `docs/site/map/graph.json` + `docs/site/map/<module>.md` |
12
- | Review reports | `<content>/reviews/<unit>-<date>.mdx` | `<content>/reviews/<unit>-<date>.mdx` | `docs/site/reviews/<unit>-<date>.md` |
13
- | Sidebar | Starlight autogenerated sidebar (directory-based); no manual sidebar edits | If the project declares a manual `sidebars.js`/`sidebars.ts`, update only that declared config; otherwise use the Docusaurus autogenerated sidebar and make no sidebar edit. Stop when the sidebar mode or declared config path cannot be resolved. | n/a — directory listing |
14
- | Verify | declared build command (`npx astro check` / `astro build`) | declared Docusaurus build command (`npx docusaurus build` or project equivalent) | intra-docs link check |
15
- | Assets | none generated | none generated | none generated |
@@ -1,33 +0,0 @@
1
- ## Step 0 — Discover the project (always first)
2
-
3
- Per the agent guide's **Workflow conventions** + **documentation map**, then
4
- resolve the **docs adapter** with this checklist — fixed order, first match
5
- wins, evidence required for the match:
6
-
7
- 1. **Explicit declaration** — the documentation map contains a `Docs site`
8
- block (format, content dir, build command, map command). Evidence: quote
9
- the block. → use the declared adapter.
10
- 2. **Starlight** — an `astro.config.*` exists AND `@astrojs/starlight` is in
11
- the project's dependencies. Evidence: config path + the dependency line.
12
- → Starlight adapter.
13
- 3. **Docusaurus** — a `docusaurus.config.*` exists AND `@docusaurus/core` is a
14
- dependency. Evidence: config path + the dependency line. → Docusaurus
15
- adapter (same slots as Starlight; `.mdx` under the site's `docs/` dir,
16
- sidebar per its convention).
17
- 4. **Plain-markdown fallback** — a `docs/` directory exists. → plain-markdown
18
- adapter (always available).
19
- 5. **None of the above** → **NOT CONFIGURED**: write nothing. Print the report
20
- with `Decision: NOT-CONFIGURED`, and include this snippet for the user to
21
- add to their documentation map:
22
-
23
- ```markdown
24
- ## Docs site
25
- - format: starlight | docusaurus | markdown
26
- - content-dir: <path, e.g. src/content/docs/>
27
- - build: <command, e.g. npx astro check | none>
28
- - map: <command emitting a nodes/edges JSON | none>
29
- ```
30
-
31
- Detection is per invocation — never cached, never guessed. A monorepo with
32
- more than one docs site is a documented limitation: use the first declaration
33
- found and say so in the report (see the feature's `known-issues.md`).
@@ -1,90 +0,0 @@
1
- ## Process
2
-
3
- 1. **Resolve the scope** — exactly one of, in this order:
4
- - an explicit argument (`NN-slug`, `fix-n`, or a path/glob) → that unit's
5
- branch diff vs the default branch, or the given paths;
6
- - no argument → the current branch's diff vs the default branch;
7
- - on the default branch with a clean tree → the last merged unit's diff
8
- (`git log --merges -1` → its diff). State the resolved scope in the
9
- report.
10
-
11
- 2. **Select pages with the incrementality checklist.** A guide page is
12
- (re)written only if at least one holds — otherwise it is not touched:
13
- - ✓ the diff changes files under the page's subject paths (page exists →
14
- update it);
15
- - ✓ the diff introduces a public entry point (exported API, event, command,
16
- route, port) that no existing guide covers (→ create the page).
17
-
18
- **Whole-tree regeneration is Forbidden** — an empty selection is a valid,
19
- reportable outcome (`0 pages`, `Decision: PASS`).
20
-
21
- 3. **Write the pages** into the adapter's guides location (see the adapter
22
- table). Fixed page shape, identical on every agent:
23
- - **Title** — task-oriented ("Create a domain event"), not file-oriented.
24
- - **Frontmatter** — the adapter's required keys **plus the provenance
25
- keys** (mandatory, exactly these names):
26
-
27
- ```yaml
28
- generated-by: agentic-workflow/generate-docs
29
- source-unit: <NN-slug | fix-n>
30
- updated: <ISO date>
31
- ```
32
-
33
- - **Body sections, in order**: *What this is* (1 paragraph) · *How to do
34
- it* (numbered steps citing real paths — `src/...`, clickable) · *Where
35
- the pieces live* (table: role → path) · *Related* (links to sibling
36
- guide pages that share subject paths).
37
- - **File name**: kebab-case derived from the subject module path
38
- (`src/domain/events/` → `guides/domain/events.mdx`) — never a
39
- model-invented name.
40
- - Facts come from the diff and the code — a claim that cannot cite a path
41
- does not go in the page.
42
-
43
- 4. **Knowledge map** (only when the documentation map declares a `map`
44
- command). The map is the navigable call/module graph that lets a reader
45
- trace an error doc-to-doc to its origin. Rules — no interpretation:
46
- - **Run the declared command** (a project script wrapping deterministic
47
- tooling — dependency-cruiser, madge, TypeDoc, tree-sitter, an LSP dump…).
48
- The model **never infers graph nodes or edges** — zero-token structural
49
- truth, or no map at all.
50
- - **Validate the output**: JSON with `nodes[]` (each
51
- `{"id", "path"}` minimum) and `edges[]` (each `{"from", "to"}`), any
52
- extra keys allowed. Invalid → write nothing, report
53
- `Map: invalid output — <first mismatch>` and count it as a FAIL.
54
- - Valid → write it to the adapter's map location as `graph.json`, then
55
- write/refresh one wrapper page per top-level module **the scope
56
- touched** (incrementality applies to wrapper pages, not to the JSON):
57
- the page lists the module's nodes with source paths, direct callers,
58
- direct callees, and links to guide pages sharing subject paths — the
59
- stack-trace walk. Wrapper pages carry the provenance frontmatter.
60
- - No `map` command declared → `Map: n/a — no map command declared` in the
61
- report. Never substitute model inference.
62
-
63
- Per-tool recipes (the mapping each tool needs to emit the shape above):
64
- `dependency-cruiser --output-type json` → modules⇒nodes, dependencies⇒edges;
65
- `madge --json` → adjacency object⇒edges; TypeDoc JSON → reflections⇒nodes,
66
- references⇒edges; tree-sitter/LSP call hierarchy → definitions⇒nodes,
67
- calls⇒edges. The project's script owns the mapping; these recipes are
68
- documentation for writing that script, not something this skill executes ad
69
- hoc.
70
-
71
- 5. **Review export** (only with the explicit `--review` flag — never
72
- automatic; findings may predate their fixes and a public site is a
73
- publishing decision). Take the most recent `review-change` report available
74
- in the invoking context (or the path the user names), convert its
75
- fixed-format blocks verbatim into one page at the adapter's reviews
76
- location (`reviews/<unit>-<ISO-date>.mdx` or `.md`), provenance frontmatter
77
- included, findings tables intact — no summarizing, no re-judging (that is
78
- `review-change`'s output, frozen). No report available → state it in the
79
- report block and write nothing.
80
-
81
- 6. **Verify.** Run the declared docs build command (e.g. `npx astro check`)
82
- when the adapter declares one; otherwise check that every intra-docs link
83
- in the written pages resolves. Paste the command + exit code (or the link
84
- count) in the report. A red build → fix the written pages or revert them;
85
- never leave the docs site broken.
86
-
87
- 7. **Report** (fixed block), then the closing `→ Next:` block as the
88
- ABSOLUTE last output. This skill does **not** commit — the pages ride the
89
- unit's workflow (the executor or the user commits them with the unit's
90
- close-out).