@entelligentsia/forgecli 0.10.0 โ 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/README.md +21 -3
- package/dist/CHANGELOG-forge-plugin.md +90 -0
- package/dist/bin/config.js +6 -0
- package/dist/bin/config.js.map +1 -1
- package/dist/extensions/forgecli/add-pipeline.d.ts +19 -0
- package/dist/extensions/forgecli/add-pipeline.js +143 -0
- package/dist/extensions/forgecli/add-pipeline.js.map +1 -0
- package/dist/extensions/forgecli/add-task.d.ts +20 -0
- package/dist/extensions/forgecli/add-task.js +154 -0
- package/dist/extensions/forgecli/add-task.js.map +1 -0
- package/dist/extensions/forgecli/calibrate.d.ts +61 -0
- package/dist/extensions/forgecli/calibrate.js +488 -0
- package/dist/extensions/forgecli/calibrate.js.map +1 -0
- package/dist/extensions/forgecli/fix-bug.d.ts +9 -1
- package/dist/extensions/forgecli/fix-bug.js +155 -45
- package/dist/extensions/forgecli/fix-bug.js.map +1 -1
- package/dist/extensions/forgecli/forge-commands.js +15 -22
- package/dist/extensions/forgecli/forge-commands.js.map +1 -1
- package/dist/extensions/forgecli/forge-subagent.d.ts +16 -1
- package/dist/extensions/forgecli/forge-subagent.js +45 -8
- package/dist/extensions/forgecli/forge-subagent.js.map +1 -1
- package/dist/extensions/forgecli/forge-update-command.d.ts +9 -0
- package/dist/extensions/forgecli/forge-update-command.js +106 -7
- package/dist/extensions/forgecli/forge-update-command.js.map +1 -1
- package/dist/extensions/forgecli/health-check.d.ts +22 -1
- package/dist/extensions/forgecli/health-check.js +177 -4
- package/dist/extensions/forgecli/health-check.js.map +1 -1
- package/dist/extensions/forgecli/hook-dispatcher.d.ts +25 -1
- package/dist/extensions/forgecli/hook-dispatcher.js +104 -9
- package/dist/extensions/forgecli/hook-dispatcher.js.map +1 -1
- package/dist/extensions/forgecli/hooks/check-update.d.ts +81 -0
- package/dist/extensions/forgecli/hooks/check-update.js +308 -0
- package/dist/extensions/forgecli/hooks/check-update.js.map +1 -0
- package/dist/extensions/forgecli/hooks/forge-permissions.d.ts +32 -0
- package/dist/extensions/forgecli/hooks/forge-permissions.js +119 -0
- package/dist/extensions/forgecli/hooks/forge-permissions.js.map +1 -0
- package/dist/extensions/forgecli/hooks/triage-error.d.ts +23 -0
- package/dist/extensions/forgecli/hooks/triage-error.js +62 -0
- package/dist/extensions/forgecli/hooks/triage-error.js.map +1 -0
- package/dist/extensions/forgecli/hooks/write-guard.d.ts +28 -0
- package/dist/extensions/forgecli/hooks/write-guard.js +225 -0
- package/dist/extensions/forgecli/hooks/write-guard.js.map +1 -0
- package/dist/extensions/forgecli/index.js +60 -0
- package/dist/extensions/forgecli/index.js.map +1 -1
- package/dist/extensions/forgecli/init-context.d.ts +1 -1
- package/dist/extensions/forgecli/init-context.js +21 -6
- package/dist/extensions/forgecli/init-context.js.map +1 -1
- package/dist/extensions/forgecli/materialize.d.ts +16 -0
- package/dist/extensions/forgecli/materialize.js +195 -0
- package/dist/extensions/forgecli/materialize.js.map +1 -0
- package/dist/extensions/forgecli/migrate.d.ts +19 -0
- package/dist/extensions/forgecli/migrate.js +258 -0
- package/dist/extensions/forgecli/migrate.js.map +1 -0
- package/dist/extensions/forgecli/migration-engine.d.ts +111 -0
- package/dist/extensions/forgecli/migration-engine.js +533 -0
- package/dist/extensions/forgecli/migration-engine.js.map +1 -0
- package/dist/extensions/forgecli/quiz-agent.d.ts +17 -0
- package/dist/extensions/forgecli/quiz-agent.js +98 -0
- package/dist/extensions/forgecli/quiz-agent.js.map +1 -0
- package/dist/extensions/forgecli/remove-command.d.ts +17 -0
- package/dist/extensions/forgecli/remove-command.js +124 -0
- package/dist/extensions/forgecli/remove-command.js.map +1 -0
- package/dist/extensions/forgecli/report-bug.d.ts +25 -0
- package/dist/extensions/forgecli/report-bug.js +159 -0
- package/dist/extensions/forgecli/report-bug.js.map +1 -0
- package/dist/extensions/forgecli/retrospective.d.ts +19 -0
- package/dist/extensions/forgecli/retrospective.js +156 -0
- package/dist/extensions/forgecli/retrospective.js.map +1 -0
- package/dist/extensions/forgecli/run-sprint.js +36 -3
- package/dist/extensions/forgecli/run-sprint.js.map +1 -1
- package/dist/extensions/forgecli/run-task.d.ts +9 -1
- package/dist/extensions/forgecli/run-task.js +66 -13
- package/dist/extensions/forgecli/run-task.js.map +1 -1
- package/dist/extensions/forgecli/session-registry.d.ts +40 -2
- package/dist/extensions/forgecli/session-registry.js +71 -1
- package/dist/extensions/forgecli/session-registry.js.map +1 -1
- package/dist/extensions/forgecli/status-command.d.ts +19 -0
- package/dist/extensions/forgecli/status-command.js +140 -0
- package/dist/extensions/forgecli/status-command.js.map +1 -0
- package/dist/extensions/forgecli/store-query.d.ts +22 -0
- package/dist/extensions/forgecli/store-query.js +107 -0
- package/dist/extensions/forgecli/store-query.js.map +1 -0
- package/dist/extensions/forgecli/store-repair.d.ts +17 -0
- package/dist/extensions/forgecli/store-repair.js +123 -0
- package/dist/extensions/forgecli/store-repair.js.map +1 -0
- package/dist/extensions/forgecli/test-orchestrate.js +1 -0
- package/dist/extensions/forgecli/test-orchestrate.js.map +1 -1
- package/dist/extensions/forgecli/thread-switcher.js +286 -41
- package/dist/extensions/forgecli/thread-switcher.js.map +1 -1
- package/dist/extensions/forgecli/transition-guard.js +7 -2
- package/dist/extensions/forgecli/transition-guard.js.map +1 -1
- package/dist/extensions/forgecli/update-tools.d.ts +23 -0
- package/dist/extensions/forgecli/update-tools.js +136 -0
- package/dist/extensions/forgecli/update-tools.js.map +1 -0
- package/dist/extensions/forgecli/viewport-events.js +10 -0
- package/dist/extensions/forgecli/viewport-events.js.map +1 -1
- package/dist/extensions/forgecli/viewport-renderer.d.ts +18 -0
- package/dist/extensions/forgecli/viewport-renderer.js +27 -0
- package/dist/extensions/forgecli/viewport-renderer.js.map +1 -1
- package/dist/extensions/forgecli/viewport-theme.js +4 -0
- package/dist/extensions/forgecli/viewport-theme.js.map +1 -1
- package/dist/extensions/forgecli/whats-new-widget.d.ts +13 -8
- package/dist/extensions/forgecli/whats-new-widget.js +111 -42
- package/dist/extensions/forgecli/whats-new-widget.js.map +1 -1
- package/dist/forge-payload/.base-pack/workflows/architect_approve.md +29 -3
- package/dist/forge-payload/.base-pack/workflows/commit_task.md +15 -8
- package/dist/forge-payload/.base-pack/workflows/fix_bug.md +327 -185
- package/dist/forge-payload/.base-pack/workflows/implement_plan.md +18 -10
- package/dist/forge-payload/.base-pack/workflows/plan_task.md +15 -9
- package/dist/forge-payload/.base-pack/workflows/review_code.md +14 -6
- package/dist/forge-payload/.base-pack/workflows/review_plan.md +18 -10
- package/dist/forge-payload/.claude-plugin/plugin.json +1 -1
- package/dist/forge-payload/.schemas/bug.schema.json +3 -2
- package/dist/forge-payload/.schemas/config.schema.json +83 -0
- package/dist/forge-payload/.schemas/migrations.json +2049 -0
- package/dist/forge-payload/commands/regenerate.md +17 -1
- package/dist/forge-payload/meta/personas/README.md +16 -0
- package/dist/forge-payload/meta/personas/meta-architect.md +70 -0
- package/dist/forge-payload/meta/personas/meta-bug-fixer.md +73 -0
- package/dist/forge-payload/meta/personas/meta-collator.md +72 -0
- package/dist/forge-payload/meta/personas/meta-engineer.md +70 -0
- package/dist/forge-payload/meta/personas/meta-orchestrator.md +71 -0
- package/dist/forge-payload/meta/personas/meta-product-manager.md +82 -0
- package/dist/forge-payload/meta/personas/meta-qa-engineer.md +91 -0
- package/dist/forge-payload/meta/personas/meta-supervisor.md +92 -0
- package/dist/forge-payload/meta/skill-recommendations.md +154 -0
- package/dist/forge-payload/meta/skills/meta-architect-skills.md +43 -0
- package/dist/forge-payload/meta/skills/meta-bug-fixer-skills.md +43 -0
- package/dist/forge-payload/meta/skills/meta-collator-skills.md +41 -0
- package/dist/forge-payload/meta/skills/meta-engineer-skills.md +43 -0
- package/dist/forge-payload/meta/skills/meta-generic-skills.md +58 -0
- package/dist/forge-payload/meta/skills/meta-qa-engineer-skills.md +46 -0
- package/dist/forge-payload/meta/skills/meta-supervisor-skills.md +43 -0
- package/dist/forge-payload/meta/store-schema/bug.schema.md +71 -0
- package/dist/forge-payload/meta/store-schema/event.schema.md +76 -0
- package/dist/forge-payload/meta/store-schema/feature.schema.md +65 -0
- package/dist/forge-payload/meta/store-schema/sprint.schema.md +64 -0
- package/dist/forge-payload/meta/store-schema/task.schema.md +78 -0
- package/dist/forge-payload/meta/templates/meta-code-review.md +26 -0
- package/dist/forge-payload/meta/templates/meta-plan-review.md +28 -0
- package/dist/forge-payload/meta/templates/meta-plan.md +28 -0
- package/dist/forge-payload/meta/templates/meta-progress.md +25 -0
- package/dist/forge-payload/meta/templates/meta-retrospective.md +28 -0
- package/dist/forge-payload/meta/templates/meta-sprint-manifest.md +26 -0
- package/dist/forge-payload/meta/templates/meta-sprint-requirements.md +91 -0
- package/dist/forge-payload/meta/templates/meta-task-prompt.md +26 -0
- package/dist/forge-payload/meta/tool-specs/collate.spec.md +88 -0
- package/dist/forge-payload/meta/tool-specs/generation-manifest.spec.md +139 -0
- package/dist/forge-payload/meta/tool-specs/manage-config.spec.md +143 -0
- package/dist/forge-payload/meta/tool-specs/seed-store.spec.md +91 -0
- package/dist/forge-payload/meta/tool-specs/store-cli.spec.md +328 -0
- package/dist/forge-payload/meta/tool-specs/validate-store.spec.md +191 -0
- package/dist/forge-payload/meta/workflows/_fragments/context-injection.md +75 -0
- package/dist/forge-payload/meta/workflows/_fragments/event-emission-schema.md +73 -0
- package/dist/forge-payload/meta/workflows/_fragments/finalize.md +13 -0
- package/dist/forge-payload/meta/workflows/_fragments/friction-emit.md +73 -0
- package/dist/forge-payload/meta/workflows/_fragments/progress-reporting.md +38 -0
- package/dist/forge-payload/meta/workflows/_fragments/store-cli-verbs.md +39 -0
- package/dist/forge-payload/meta/workflows/meta-approve.md +119 -0
- package/dist/forge-payload/meta/workflows/meta-collate.md +89 -0
- package/dist/forge-payload/meta/workflows/meta-commit.md +93 -0
- package/dist/forge-payload/meta/workflows/meta-enhance.md +286 -0
- package/dist/forge-payload/meta/workflows/meta-fix-bug.md +501 -0
- package/dist/forge-payload/meta/workflows/meta-implement.md +132 -0
- package/dist/forge-payload/meta/workflows/meta-migrate.md +455 -0
- package/dist/forge-payload/meta/workflows/meta-orchestrate.md +993 -0
- package/dist/forge-payload/meta/workflows/meta-plan-task.md +133 -0
- package/dist/forge-payload/meta/workflows/meta-quiz-agent.md +135 -0
- package/dist/forge-payload/meta/workflows/meta-retrospective.md +65 -0
- package/dist/forge-payload/meta/workflows/meta-review-implementation.md +119 -0
- package/dist/forge-payload/meta/workflows/meta-review-plan.md +108 -0
- package/dist/forge-payload/meta/workflows/meta-review-sprint-completion.md +65 -0
- package/dist/forge-payload/meta/workflows/meta-sprint-intake.md +76 -0
- package/dist/forge-payload/meta/workflows/meta-sprint-plan.md +147 -0
- package/dist/forge-payload/meta/workflows/meta-update-implementation.md +76 -0
- package/dist/forge-payload/meta/workflows/meta-update-plan.md +76 -0
- package/dist/forge-payload/meta/workflows/meta-validate.md +111 -0
- package/dist/forge-payload/tools/check-structure.cjs +344 -0
- package/dist/forge-payload/tools/collate.cjs +34 -9
- package/dist/forge-payload/tools/list-skills.js +76 -0
- package/dist/forge-payload/tools/parse-gates.cjs +8 -2
- package/dist/forge-payload/tools/store-cli.cjs +56 -11
- package/dist/forge-payload/tools/store.cjs +61 -0
- package/dist/forge-payload/tools/substitute-placeholders.cjs +60 -8
- package/dist/forge-payload/tools/validate-store.cjs +6 -2
- package/dist/forge-payload/tools/verify-integrity.cjs +86 -0
- package/package.json +2 -2
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
---
|
|
2
|
+
requirements:
|
|
3
|
+
reasoning: High
|
|
4
|
+
context: Medium
|
|
5
|
+
speed: Medium
|
|
6
|
+
audience: orchestrator-only
|
|
7
|
+
deps:
|
|
8
|
+
personas: [bug-fixer, supervisor, architect, engineer, collator]
|
|
9
|
+
skills: [bug-fixer, supervisor, architect, engineer, generic]
|
|
10
|
+
templates: [PROGRESS_TEMPLATE]
|
|
11
|
+
sub_workflows: [plan_task, implement_plan, review_plan, review_code, architect_approve, commit_task]
|
|
12
|
+
kb_docs: [architecture/stack.md, architecture/routing.md]
|
|
13
|
+
context_pack: .forge/cache/context-pack.md
|
|
14
|
+
config_fields: [commands.test, paths.engineering]
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# ๐ Meta-Workflow: Fix Bug
|
|
18
|
+
|
|
19
|
+
## Purpose
|
|
20
|
+
|
|
21
|
+
Drive a single bug through its complete lifecycle. The pipeline mirrors
|
|
22
|
+
`meta-orchestrate.md` so personas, phases, gates, and event emission stay
|
|
23
|
+
identical โ the only deviation is **the judgement step after triage**, which
|
|
24
|
+
branches the bug into a short Path A or the full Path B. Everything past the
|
|
25
|
+
branch reuses the run-task phases verbatim.
|
|
26
|
+
|
|
27
|
+
## Pipeline Phases
|
|
28
|
+
|
|
29
|
+
A fix-bug pipeline has these phases (mirrors `meta-orchestrate.md ยง Pipeline
|
|
30
|
+
Phases`):
|
|
31
|
+
|
|
32
|
+
| Phase | Role | Persona | Workflow | Path A | Path B |
|
|
33
|
+
|---|---|---|---|---|---|
|
|
34
|
+
| triage | `triage` | bug-fixer | (inline algorithm) | yes | yes |
|
|
35
|
+
| plan-fix | `plan` | engineer | `plan_task.md` (bug-mode) | no | yes |
|
|
36
|
+
| review-plan | `review-plan` | supervisor | `review_plan.md` | no | yes |
|
|
37
|
+
| implement | `implement` | engineer | `implement_plan.md` (bug-mode) | yes | yes |
|
|
38
|
+
| review-code | `review-code` | supervisor | `review_code.md` | yes | yes |
|
|
39
|
+
| approve | `approve` | architect | `architect_approve.md` (bug-mode) | yes | yes |
|
|
40
|
+
| commit | `commit` | engineer | `commit_task.md` (bug-mode) | yes | yes |
|
|
41
|
+
| finalize | `finalize` | collator | (inline algorithm) | yes | yes |
|
|
42
|
+
|
|
43
|
+
Phases past triage are the same workflows used by the run-task pipeline. The
|
|
44
|
+
generated orchestrator passes `--bug {bugId}` (in place of `--task {taskId}`)
|
|
45
|
+
to every sub-workflow and to `preflight-gate.cjs`. Sub-workflows resolve the
|
|
46
|
+
record kind from the flag and adjust their verdict-source mapping via
|
|
47
|
+
`BUG_PHASE_VERDICT_SOURCE` in `tools/read-verdict.cjs`.
|
|
48
|
+
|
|
49
|
+
## Status State Machine
|
|
50
|
+
|
|
51
|
+
Bug status writes are owned by specific phases โ never by the workflow source
|
|
52
|
+
in finalize, never by an LLM improvising on a task workflow.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
reported -> triaged -> in-progress -> fixed
|
|
56
|
+
(terminal)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Transition | Owner | Trigger |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `reported โ triaged` | triage subagent | after reproduction confirmed |
|
|
62
|
+
| `triaged โ in-progress` | triage subagent | after route decision recorded in `summaries.triage.route` |
|
|
63
|
+
| `in-progress โ fixed` | commit phase | after git commit succeeds (terminal) |
|
|
64
|
+
|
|
65
|
+
The schema's `approved` and `verified` enum members are vestigial โ no phase in
|
|
66
|
+
this workflow writes them, and the verdict gate reads
|
|
67
|
+
`summaries.approve.verdict`, not `bug.status`. A follow-up cleanup should drop
|
|
68
|
+
both members from `bug.schema.json` to remove the runtime trap. Until then,
|
|
69
|
+
this workflow MUST NOT write either value. The Phase Gates below `forbid`
|
|
70
|
+
them defensively.
|
|
71
|
+
|
|
72
|
+
## Triage Judgement (the only run-task deviation)
|
|
73
|
+
|
|
74
|
+
After the triage subagent reproduces the bug and confirms root cause, it MUST
|
|
75
|
+
record a **route** decision in its summary:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"objective": "Triage FORGE-BUG-NNN โ reproduce, locate, decide route.",
|
|
80
|
+
"key_changes": [...],
|
|
81
|
+
"findings": [
|
|
82
|
+
"Root cause: <one line>",
|
|
83
|
+
"Reproduction: <one line>",
|
|
84
|
+
"Route decision: A | B",
|
|
85
|
+
"Rationale: <one line>"
|
|
86
|
+
],
|
|
87
|
+
"verdict": "n/a",
|
|
88
|
+
"written_at": "<iso>",
|
|
89
|
+
"artifact_ref": "TRIAGE.md",
|
|
90
|
+
"route": "A"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The `route` field is required. Allowed values: `"A"` or `"B"`.
|
|
95
|
+
|
|
96
|
+
> **Field-naming caution โ runtime-tested.** The route field is named
|
|
97
|
+
> `route`, never `path`. The bug schema's top-level `path` field is the
|
|
98
|
+
> bug's **artifact directory** (e.g. `engineering/bugs/EMG-BUG-001-...`).
|
|
99
|
+
> Conflating the two caused EMBERGLOW-BUG-001 (v0.44.0 first run) to land
|
|
100
|
+
> its `TRIAGE.md` under `.forge/store/bugs/` instead of `engineering/bugs/`.
|
|
101
|
+
> Triage subagents MUST NOT touch `bug.path` โ that field is set at bug
|
|
102
|
+
> creation and never modified by triage.
|
|
103
|
+
|
|
104
|
+
### Path A โ short-circuit (eligibility)
|
|
105
|
+
|
|
106
|
+
Path A is **eligible only when ALL** of the following hold. Triage subagent
|
|
107
|
+
must enumerate each in its findings:
|
|
108
|
+
|
|
109
|
+
- `bug.severity โ {minor}`
|
|
110
|
+
- Fix is contained in a single file
|
|
111
|
+
- Estimated diff โค ~20 lines (judgement call; one screen)
|
|
112
|
+
- No schema, API, migration, security, or build-system change
|
|
113
|
+
- A regression test is obvious from the reproduction script (single short
|
|
114
|
+
test case, no new fixtures, no test-harness change)
|
|
115
|
+
|
|
116
|
+
If any criterion fails, the triage subagent MUST select Path B.
|
|
117
|
+
|
|
118
|
+
### Path B โ full loop (default)
|
|
119
|
+
|
|
120
|
+
Path B runs the same plan/review/implement/review/approve/commit shape as
|
|
121
|
+
`meta-orchestrate.md`. It is the default. Any uncertainty defaults Path B.
|
|
122
|
+
|
|
123
|
+
### Pipeline selection by path
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
phases_A = [triage, implement, review-code, approve, commit, finalize]
|
|
127
|
+
phases_B = [triage, plan-fix, review-plan, implement, review-code, approve, commit, finalize]
|
|
128
|
+
|
|
129
|
+
if summaries.triage.route == "A": phases = phases_A
|
|
130
|
+
else: phases = phases_B
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The orchestrator MUST read `summaries.triage.route` from the bug record after
|
|
134
|
+
the triage subagent returns and select the phase list before entering the main
|
|
135
|
+
loop. The selection is final for the run โ no mid-pipeline switching.
|
|
136
|
+
|
|
137
|
+
## Pipeline Resolution
|
|
138
|
+
|
|
139
|
+
Fix-bug does **not** read `task.pipeline` from config. The path-branch decision
|
|
140
|
+
above replaces the task pipeline lookup. The orchestrator MAY honour
|
|
141
|
+
`config.pipelines.bug` to override the default Path A / Path B phase lists,
|
|
142
|
+
mirroring `meta-orchestrate.md ยง Pipeline Resolution`; if unset, the lists
|
|
143
|
+
above are used.
|
|
144
|
+
|
|
145
|
+
## Algorithm
|
|
146
|
+
|
|
147
|
+
The fix-bug orchestrator MUST follow this procedure exactly. The structure
|
|
148
|
+
mirrors `meta-orchestrate.md ยง Execution Algorithm` โ same persona-map, same
|
|
149
|
+
banner-map, same cluster detection, same preflight gate, same event emission.
|
|
150
|
+
Differences are confined to the **triage** step and the **path branch**.
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
1. Pre-loop setup (mirrors meta-orchestrate.md):
|
|
154
|
+
- Resolve FORGE_ROOT.
|
|
155
|
+
- Detect execution cluster from ANTHROPIC_DEFAULT_*_MODEL env vars.
|
|
156
|
+
- Clear progress log: store-cli progress-clear bugs
|
|
157
|
+
- Read bug record. If status โ {blocked, escalated, fixed, abandoned}:
|
|
158
|
+
skip the run, emit a single `bug_skipped` event, return.
|
|
159
|
+
|
|
160
|
+
2. Triage:
|
|
161
|
+
- Locate or create the bug record (MANDATORY โ do this before anything else):
|
|
162
|
+
a. Determine the bug ID: if $ARGUMENTS is an existing FORGE-BUG-NNN ID, use it.
|
|
163
|
+
Otherwise derive the next available ID by listing .forge/store/bugs/.
|
|
164
|
+
b. If .forge/store/bugs/{BUG_ID}.json does NOT exist, write a fresh record
|
|
165
|
+
via store-cli with status="reported".
|
|
166
|
+
c. Read the now-guaranteed record.
|
|
167
|
+
- Spawn the triage subagent (persona: bug-fixer). It MUST:
|
|
168
|
+
โข Reproduce the bug (failing test or reproduction script).
|
|
169
|
+
โข Confirm the root cause via codebase research.
|
|
170
|
+
โข Decide Path A vs Path B by the criteria above.
|
|
171
|
+
โข Write TRIAGE.md and TRIAGE-SUMMARY.json (with `path` field).
|
|
172
|
+
โข Call set-bug-summary {bugId} triage TRIAGE-SUMMARY.json
|
|
173
|
+
- On return, orchestrator transitions status:
|
|
174
|
+
store-cli update-status bug {bugId} status triaged
|
|
175
|
+
store-cli update-status bug {bugId} status in-progress
|
|
176
|
+
- Read summaries.triage.route. If neither "A" nor "B": escalate
|
|
177
|
+
(verdict_malformed). Do not guess.
|
|
178
|
+
|
|
179
|
+
3. Path selection:
|
|
180
|
+
- phases = phases_A if route == "A" else phases_B
|
|
181
|
+
- Begin main phase loop.
|
|
182
|
+
|
|
183
|
+
4. Phase loop (identical to meta-orchestrate.md ยง Execution Algorithm):
|
|
184
|
+
for each phase in phases[1:]: # triage already done
|
|
185
|
+
- Resolve model (cluster + ROLE_TIER).
|
|
186
|
+
- Compute eventId, agent_name, banner_name (from PERSONA_MAP /
|
|
187
|
+
BANNER_MAP below).
|
|
188
|
+
- Announce phase: banner + "โ {bugId} [{display_model}]".
|
|
189
|
+
- Start progress Monitor on .forge/store/events/bugs/progress.log.
|
|
190
|
+
- Preflight gate: preflight-gate.cjs --phase {role} --bug {bugId}
|
|
191
|
+
Exit 1 or 2 โ escalate (see meta-orchestrate.md ยง Escalation Procedure)
|
|
192
|
+
with bug_id substituted for task_id. Update bug.status to "escalated"
|
|
193
|
+
only if it is currently "in-progress" (do not downgrade other states).
|
|
194
|
+
- Compose role-block, architecture-block, summary-block, overlay (via
|
|
195
|
+
build-overlay.cjs --bug {bugId}).
|
|
196
|
+
- Spawn subagent via Agent tool. Subagent prompt passes:
|
|
197
|
+
sprint_or_bug_id = "bugs" # virtual sprint dir for emit/sidecar
|
|
198
|
+
record_id = {bugId}
|
|
199
|
+
sidecar_path = .forge/store/events/bugs/_{event_id}_usage.json
|
|
200
|
+
- On return: merge sidecar, emit canonical event (orchestrator-owned),
|
|
201
|
+
stop progress Monitor, print phase-exit signal (โ / โป / โ ), run
|
|
202
|
+
/compact with checkpoint line.
|
|
203
|
+
- If phase is a review and verdict == "revision": re-enter the loop
|
|
204
|
+
on the on_revision predecessor up to max_iterations. Exhaust โ
|
|
205
|
+
escalate (see meta-orchestrate.md ยง Escalation Procedure).
|
|
206
|
+
|
|
207
|
+
5. Phase-specific responsibilities (sub-workflow contracts):
|
|
208
|
+
- plan-fix (Path B): engineer writes BUG_FIX_PLAN.md and BUG-FIX-PLAN-SUMMARY.json
|
|
209
|
+
(verdict: "n/a"). No status write.
|
|
210
|
+
- review-plan (Path B): supervisor writes REVIEW-PLAN-SUMMARY.json
|
|
211
|
+
(verdict: approved | revision). No status write.
|
|
212
|
+
- implement: engineer (or bug-fixer for Path A) applies the fix, runs the
|
|
213
|
+
regression test, writes IMPLEMENTATION-SUMMARY.json (verdict: "n/a").
|
|
214
|
+
No status write โ bug stays at "in-progress".
|
|
215
|
+
- review-code: supervisor reads the actual diff and the regression test,
|
|
216
|
+
writes REVIEW-CODE-SUMMARY.json (verdict: approved | revision).
|
|
217
|
+
- approve: architect writes ARCHITECT_APPROVAL.md and APPROVE-SUMMARY.json
|
|
218
|
+
(verdict: approved | revision). No status write โ the verdict signal is
|
|
219
|
+
the summary, not bug.status (see read-verdict.cjs:44).
|
|
220
|
+
- commit: engineer makes the git commit and runs:
|
|
221
|
+
store-cli update-status bug {bugId} status fixed
|
|
222
|
+
Then writes COMMIT-SUMMARY.json (verdict: "n/a"). This is the ONLY
|
|
223
|
+
phase that writes bug.status post-triage.
|
|
224
|
+
|
|
225
|
+
6. Finalize (collator, housekeeping):
|
|
226
|
+
- Aggregate cost data from .forge/store/events/bugs/*.json filtered by
|
|
227
|
+
this bugId, and append a "## Cost Summary" section to the bug's
|
|
228
|
+
INDEX.md artifact.
|
|
229
|
+
- Run `node "$FORGE_ROOT/tools/collate.cjs" {bugId} --purge-events`.
|
|
230
|
+
Collate purges only this bug's events from the shared bugs/ dir
|
|
231
|
+
(filtered by bugId reference) โ it does NOT purge other bugs' events.
|
|
232
|
+
- Run preflight finalize gate: preflight-gate.cjs --phase finalize --bug {bugId}.
|
|
233
|
+
Exit 1 โ escalate. Do NOT downgrade bug.status (it is already "fixed").
|
|
234
|
+
- Do NOT emit a phase event yourself. The orchestrator owns event
|
|
235
|
+
emission for finalize as it does for every other phase โ composed from
|
|
236
|
+
runtime telemetry plus the collator's summary.
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Persona and Banner Maps
|
|
240
|
+
|
|
241
|
+
Mirrors `meta-orchestrate.md` for shared roles. Bug-only role is `triage`.
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
# --- Role-to-noun mapping (persona and skill file lookups) ---
|
|
245
|
+
ROLE_TO_NOUN = {
|
|
246
|
+
"triage": "bug-fixer",
|
|
247
|
+
"plan": "engineer", # Path B only
|
|
248
|
+
"review-plan": "supervisor", # Path B only
|
|
249
|
+
"implement": "engineer",
|
|
250
|
+
"review-code": "supervisor",
|
|
251
|
+
"approve": "architect",
|
|
252
|
+
"commit": "engineer",
|
|
253
|
+
"finalize": "collator",
|
|
254
|
+
}
|
|
255
|
+
# Default fallback: "bug-fixer"
|
|
256
|
+
|
|
257
|
+
# --- Persona symbol lookup (emoji, name, tagline) ---
|
|
258
|
+
PERSONA_MAP = {
|
|
259
|
+
"triage": ("๐", "Bug Fixer", "I find what has decayed and decide the path."),
|
|
260
|
+
"plan": ("๐ฑ", "Engineer", "I plan what will be built before any code is written."),
|
|
261
|
+
"review-plan": ("๐ฟ", "Supervisor", "I review before things move forward. I read the actual fix, not just the plan."),
|
|
262
|
+
"implement": ("๐ฑ", "Engineer", "I build what was planned. I do not move forward until the code is clean."),
|
|
263
|
+
"review-code": ("๐ฟ", "Supervisor", "I review before things move forward. I read the actual code, not the report."),
|
|
264
|
+
"approve": ("๐ป", "Architect", "I hold the shape of the whole. I give final sign-off before commit."),
|
|
265
|
+
"commit": ("๐ฑ", "Engineer", "I close out completed work with a clean, honest commit."),
|
|
266
|
+
"finalize": ("๐", "Collator", "I gather what exists and arrange it into views."),
|
|
267
|
+
}
|
|
268
|
+
# Default fallback: ("๐", "Bug Fixer", "I find what has decayed and decide the path.")
|
|
269
|
+
|
|
270
|
+
# --- Banner identity map (banner name per phase role) ---
|
|
271
|
+
BANNER_MAP = {
|
|
272
|
+
"triage": "rift",
|
|
273
|
+
"plan": "forge",
|
|
274
|
+
"review-plan": "oracle",
|
|
275
|
+
"implement": "forge",
|
|
276
|
+
"review-code": "oracle",
|
|
277
|
+
"approve": "north",
|
|
278
|
+
"commit": "forge",
|
|
279
|
+
"finalize": "drift",
|
|
280
|
+
}
|
|
281
|
+
# Default fallback: "rift"
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Subagent Prompt Composition
|
|
285
|
+
|
|
286
|
+
Identical pattern to `meta-orchestrate.md ยง Execution Algorithm`. The only
|
|
287
|
+
differences are:
|
|
288
|
+
|
|
289
|
+
- `--bug {bugId}` flag passed to preflight-gate.cjs and sub-workflows.
|
|
290
|
+
- `sprint_or_bug_id = "bugs"` for emit/sidecar/progress (virtual sprint dir).
|
|
291
|
+
- `build-overlay.cjs --bug {bugId}` for the overlay (matches the task pattern
|
|
292
|
+
`build-overlay.cjs --task {taskId}`).
|
|
293
|
+
- Sidecar path uses `.forge/store/events/bugs/_{event_id}_usage.json` โ the
|
|
294
|
+
shared bugs virtual dir. Collate filters by bug reference at purge time.
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
# --- Materialize project overlay (replaces MASTER_INDEX.md read in subagent) ---
|
|
298
|
+
overlay_result = run_bash(
|
|
299
|
+
f'node "$FORGE_ROOT/tools/build-overlay.cjs" --bug {bug_id} --format md'
|
|
300
|
+
)
|
|
301
|
+
bug_overlay_md = overlay_result.stdout if overlay_result.exit_code == 0 else ""
|
|
302
|
+
|
|
303
|
+
spawn_subagent(
|
|
304
|
+
prompt=compose_subagent_prompt(
|
|
305
|
+
agent_name=agent_name, progress_log_path=progress_log_path, banner_name=banner_name,
|
|
306
|
+
sprint_or_bug_id="bugs", phase_role=phase.role,
|
|
307
|
+
architecture_block=bug_architecture_block, summary_block=bug_summary_block,
|
|
308
|
+
role_block=role_block, overlay_md=bug_overlay_md,
|
|
309
|
+
context={"Bug Root": bug_root_path, "Store Root": store_root_path,
|
|
310
|
+
"Events Root": ".forge/store/events/bugs/"},
|
|
311
|
+
workflow=phase.workflow, record_id=bug_id,
|
|
312
|
+
sidecar_path=f".forge/store/events/bugs/_{event_id}_usage.json"
|
|
313
|
+
),
|
|
314
|
+
description=f"{emoji} {persona_name} โ {phase.name} for {bug_id}",
|
|
315
|
+
model=phase_model
|
|
316
|
+
)
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Phase Gates
|
|
320
|
+
|
|
321
|
+
Declarative pre-flight gates. Evaluated by `forge/tools/preflight-gate.cjs`
|
|
322
|
+
before every subagent spawn. Grammar identical to `meta-orchestrate.md ยง
|
|
323
|
+
Phase Gates`. Gates encode both the path-A/path-B split (via `after`
|
|
324
|
+
predecessors that differ per path) and the status-trap defences.
|
|
325
|
+
|
|
326
|
+
```gates phase=triage
|
|
327
|
+
forbid bug.status == blocked
|
|
328
|
+
forbid bug.status == escalated
|
|
329
|
+
forbid bug.status == fixed
|
|
330
|
+
forbid bug.status == abandoned
|
|
331
|
+
forbid bug.status == approved
|
|
332
|
+
forbid bug.status == verified
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
```gates phase=plan
|
|
336
|
+
artifact {engineering}/bugs/{bug}/TRIAGE.md min=200
|
|
337
|
+
after triage = n/a
|
|
338
|
+
forbid bug.status == fixed
|
|
339
|
+
forbid bug.status == approved
|
|
340
|
+
forbid bug.status == verified
|
|
341
|
+
forbid bug.status == blocked
|
|
342
|
+
forbid bug.status == escalated
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
```gates phase=review-plan
|
|
346
|
+
artifact {engineering}/bugs/{bug}/BUG_FIX_PLAN.md min=200
|
|
347
|
+
forbid bug.status == fixed
|
|
348
|
+
forbid bug.status == approved
|
|
349
|
+
forbid bug.status == verified
|
|
350
|
+
forbid bug.status == blocked
|
|
351
|
+
forbid bug.status == escalated
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
```gates phase=implement
|
|
355
|
+
artifact {engineering}/bugs/{bug}/TRIAGE.md min=200
|
|
356
|
+
forbid bug.status == fixed
|
|
357
|
+
forbid bug.status == approved
|
|
358
|
+
forbid bug.status == verified
|
|
359
|
+
forbid bug.status == blocked
|
|
360
|
+
forbid bug.status == escalated
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
```gates phase=review-code
|
|
364
|
+
after implement = n/a
|
|
365
|
+
forbid bug.status == fixed
|
|
366
|
+
forbid bug.status == approved
|
|
367
|
+
forbid bug.status == verified
|
|
368
|
+
forbid bug.status == blocked
|
|
369
|
+
forbid bug.status == escalated
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
```gates phase=approve
|
|
373
|
+
after review-code = approved
|
|
374
|
+
forbid bug.status == fixed
|
|
375
|
+
forbid bug.status == approved
|
|
376
|
+
forbid bug.status == verified
|
|
377
|
+
forbid bug.status == blocked
|
|
378
|
+
forbid bug.status == escalated
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
```gates phase=commit
|
|
382
|
+
after approve = approved
|
|
383
|
+
forbid bug.status == fixed
|
|
384
|
+
forbid bug.status == approved
|
|
385
|
+
forbid bug.status == verified
|
|
386
|
+
forbid bug.status == blocked
|
|
387
|
+
forbid bug.status == escalated
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
```gates phase=finalize
|
|
391
|
+
artifact {engineering}/bugs/{bug}/INDEX.md
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Note: the `forbid bug.status == approved | verified` rows are defensive โ no
|
|
395
|
+
phase in this workflow writes those values, and a follow-up cleanup should
|
|
396
|
+
drop them from `bug.schema.json` entirely. Until then, these gates halt any
|
|
397
|
+
LLM-improvised attempt to land in the run-task trap (see today's regression).
|
|
398
|
+
|
|
399
|
+
## Generation Instructions
|
|
400
|
+
|
|
401
|
+
Mirrors `meta-orchestrate.md ยง Generation Instructions` with these
|
|
402
|
+
adjustments:
|
|
403
|
+
|
|
404
|
+
- The generated `fix_bug.md` must include the **Triage Judgement** section
|
|
405
|
+
verbatim, including the JSON shape, the Path A eligibility criteria, and
|
|
406
|
+
the path-selection algorithm.
|
|
407
|
+
- `ROLE_TO_NOUN` MUST include `triage` and `finalize` in addition to the
|
|
408
|
+
five run-task roles.
|
|
409
|
+
- The generated orchestrator MUST read `summaries.triage.route` and select
|
|
410
|
+
`phases_A` or `phases_B` before entering the main loop.
|
|
411
|
+
- Sub-workflow invocations pass `--bug {bugId}` (mirroring `--task {taskId}`).
|
|
412
|
+
- Event emission uses `sprint_or_bug_id="bugs"` (the reserved virtual sprint
|
|
413
|
+
dir; matches `validate-store.spec.md` and the reservation in
|
|
414
|
+
`store-cli.cjs`).
|
|
415
|
+
- Build-overlay uses `--bug {bugId}` and falls back to the bug record's
|
|
416
|
+
`path` field for KB context if the overlay is empty.
|
|
417
|
+
- Subagent personas, banners, and skills are loaded by noun via
|
|
418
|
+
`{persona_noun}.md` and `{persona_noun}-skills.md` โ never by phase role.
|
|
419
|
+
- Phase banners are orchestrator-owned (see `meta-orchestrate.md`). Subagent
|
|
420
|
+
prompts MUST NOT contain banner commands.
|
|
421
|
+
- Include the cluster-detection block, model-resolution dispatch, progress
|
|
422
|
+
IPC, phase-exit signals, post-phase `/compact` with checkpoint line
|
|
423
|
+
`[checkpoint] bug={bug_id} phase={phase.role} iterations={iteration_counts}`,
|
|
424
|
+
and context-pack injection โ identical to `meta-orchestrate.md`.
|
|
425
|
+
- Token reporting: see `_fragments/finalize.md` โ wire via `file_ref:` in
|
|
426
|
+
each subagent prompt.
|
|
427
|
+
- Sub-workflows (`plan_task.md`, `implement_plan.md`, `review_plan.md`,
|
|
428
|
+
`review_code.md`, `architect_approve.md`, `commit_task.md`) MUST detect
|
|
429
|
+
the `--bug` flag and resolve their entity context against the bug record;
|
|
430
|
+
they share the gate-and-verdict machinery with their `--task` paths via
|
|
431
|
+
`BUG_PHASE_VERDICT_SOURCE` in `read-verdict.cjs`.
|
|
432
|
+
|
|
433
|
+
## Iron Laws
|
|
434
|
+
|
|
435
|
+
<!-- Shared orchestrator laws live in generic-skills.md ยง Orchestrator Iron Laws. -->
|
|
436
|
+
> See `generic-skills.md ยง Orchestrator Iron Laws` for the six universal
|
|
437
|
+
> laws that apply to all orchestrators.
|
|
438
|
+
|
|
439
|
+
**Additional laws specific to fix-bug:**
|
|
440
|
+
|
|
441
|
+
1. **Path is decided once.** The triage subagent records `summaries.triage.route`.
|
|
442
|
+
The orchestrator selects the phase list and does not switch paths mid-run.
|
|
443
|
+
If the architect or supervisor concludes Path A was wrong, the verdict is
|
|
444
|
+
`revision` โ re-enter the loop, escalate on exhaustion. Never silently
|
|
445
|
+
promote a Path A run into Path B.
|
|
446
|
+
|
|
447
|
+
2. **No status writes outside owned phases.** Only `triage` (`reported โ
|
|
448
|
+
triaged โ in-progress`) and `commit` (`in-progress โ fixed`) write
|
|
449
|
+
`bug.status`. No phase writes `approved` or `verified`. No phase writes
|
|
450
|
+
anything in finalize. LLM improvisation that mirrors a task workflow's
|
|
451
|
+
status writes is a violation; the gates catch it, the iron law names it.
|
|
452
|
+
|
|
453
|
+
3. **No silent skipping.** A bug at `fixed`/`abandoned`/`blocked`/`escalated`
|
|
454
|
+
is skipped at pre-loop with one `bug_skipped` event. Skipping inside the
|
|
455
|
+
phase loop (writing "phase skipped" summaries) is forbidden โ that pattern
|
|
456
|
+
produced the inconsistent-skip drift that surfaced today's regression.
|
|
457
|
+
|
|
458
|
+
## Friction Emit
|
|
459
|
+
|
|
460
|
+
When the Bug Fixer, Supervisor, Architect, Engineer, or Collator detects skill
|
|
461
|
+
friction during fix-bug โ a referenced skill is unused, fails on invocation,
|
|
462
|
+
is missing from the registry, has gone stale relative to current architecture,
|
|
463
|
+
or is redundant with another skill โ emit a `friction` event so
|
|
464
|
+
`/forge:enhance --phase 2` can act on the signal.
|
|
465
|
+
|
|
466
|
+
**Trigger conditions** (set `issue` to the matching token):
|
|
467
|
+
|
|
468
|
+
| Token | When to emit |
|
|
469
|
+
|--------------------|----------------------------------------------------------------------------------|
|
|
470
|
+
| `skill_unused` | A skill listed in the persona's skill block was loaded but never consulted. |
|
|
471
|
+
| `skill_failed` | A skill was consulted but its guidance produced an error or required correction. |
|
|
472
|
+
| `skill_missing` | The workflow needed guidance the available skills did not cover. |
|
|
473
|
+
| `skill_stale` | A skill's guidance contradicts current architecture / supersedes its own advice. |
|
|
474
|
+
| `skill_redundant` | Two skills provided overlapping or conflicting guidance for the same decision. |
|
|
475
|
+
|
|
476
|
+
**Recording friction (subagent side):** call `node "$FORGE_ROOT/tools/friction-emit.cjs` `--workflow {workflow} --persona {persona-noun} --issue {token} [--subkind {token}] [--evidence '{...}']`. The tool appends one judgement-only record to `.forge/cache/FRICTION-{workflow}.jsonl`. The orchestrator drains the file at phase-end, stamps runtime attribution (model, provider, usage, wall times, eventId) onto each record, and emits the events via `store-cli emit` as event type `"friction"`. The schema enforces `{workflow, persona, issue}` as required when `type === "friction"`; `subkind` is the frozen enum `skill_unused|skill_failed|skill_missing|skill_stale|skill_redundant` or experimental `^x_[a-z_]+$`. Emit one record per distinct friction signal โ do not coalesce.
|
|
477
|
+
|
|
478
|
+
## Progress Reporting
|
|
479
|
+
|
|
480
|
+
<!-- See _fragments/progress-reporting.md for canonical definition -->
|
|
481
|
+
> See `_fragments/progress-reporting.md` for the full progress log format and `store-cli progress` command reference.
|
|
482
|
+
|
|
483
|
+
Log path: `.forge/store/events/bugs/progress.log`. Agent name format: `{bugId}:{persona_noun}:{phase.role}:{iteration}`. Clear at bug start: `store-cli progress-clear bugs`.
|
|
484
|
+
|
|
485
|
+
## Phase-Exit Signals
|
|
486
|
+
|
|
487
|
+
After each subagent returns: `โ` for completed/approved, `โป` for revision required (with iteration count), `โ ` for escalated. Format mirrors `meta-orchestrate.md ยง Phase-Exit Signals` with `bug_id` in place of `task_id`.
|
|
488
|
+
|
|
489
|
+
## Event Emission
|
|
490
|
+
|
|
491
|
+
<!-- See _fragments/event-emission-schema.md for canonical contract -->
|
|
492
|
+
> See `_fragments/event-emission-schema.md` for the actor split (subagent
|
|
493
|
+
> writes judgement-only SUMMARY; orchestrator composes the canonical event
|
|
494
|
+
> from runtime telemetry + SUMMARY and emits it).
|
|
495
|
+
|
|
496
|
+
The orchestrator is the only actor that calls `store-cli emit` for phase
|
|
497
|
+
events. All bug-phase events use `sprintId="bugs"` (the reserved virtual
|
|
498
|
+
sprint dir). The schema's `event.bugId` field carries the originating bug
|
|
499
|
+
ID for cross-bug filtering at collate time. Subagents write
|
|
500
|
+
`{PHASE}-SUMMARY.json` and return; the orchestrator composes the canonical
|
|
501
|
+
event and emits it.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
requirements:
|
|
3
|
+
reasoning: Medium
|
|
4
|
+
context: Medium
|
|
5
|
+
speed: Medium
|
|
6
|
+
audience: subagent
|
|
7
|
+
phase: implement
|
|
8
|
+
context:
|
|
9
|
+
architecture: false
|
|
10
|
+
prior_summaries: delta
|
|
11
|
+
persona: summary
|
|
12
|
+
master_index: false
|
|
13
|
+
diff_mode: false
|
|
14
|
+
deps:
|
|
15
|
+
personas: [engineer]
|
|
16
|
+
skills: [engineer, generic]
|
|
17
|
+
templates: [PROGRESS_TEMPLATE]
|
|
18
|
+
sub_workflows: [review_code]
|
|
19
|
+
kb_docs: [architecture/stack.md, architecture/routing.md]
|
|
20
|
+
config_fields: [commands.test, paths.engineering]
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# ๐ฑ Meta-Workflow: Implement Plan
|
|
24
|
+
|
|
25
|
+
## Purpose
|
|
26
|
+
|
|
27
|
+
The Engineer implements the approved plan: write code, run tests, verify, and document progress.
|
|
28
|
+
|
|
29
|
+
## Algorithm
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
0. Pre-flight Gate Check:
|
|
34
|
+
- Resolve FORGE_ROOT (`node -e "console.log(require('./.forge/config.json').paths.forgeRoot)"`).
|
|
35
|
+
- **Entity-mode resolution:** read the kickoff arguments. `--task {id}` โ `entity_kind = "task"`, `record_id = {id}`. `--bug {id}` โ `entity_kind = "bug"`, `record_id = {id}`. All store-cli calls below substitute `{entity_kind}` and `{record_id}` for the literal "task"/{taskId} placeholders.
|
|
36
|
+
- Run: `node "$FORGE_ROOT/tools/preflight-gate.cjs" --phase implement --{entity_kind} {record_id}`
|
|
37
|
+
- Exit 1 (gate failed) โ print stderr and HALT. Do not proceed; do not attempt to produce the artifact.
|
|
38
|
+
- Exit 2 (misconfiguration) โ print stderr and HALT.
|
|
39
|
+
- Exit 0 โ continue.
|
|
40
|
+
1. Load Context:
|
|
41
|
+
- Read `.forge/personas/engineer.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
|
|
42
|
+
- store-cli verbs: `read` | `list` | `write` | `emit` | `update-status` | `set-summary` | `describe` | `nlp` | `query` | `delete` โ there is no `get`/`set`/`find`. See `_fragments/store-cli-verbs.md` for full notes; run `--help` before improvising.
|
|
43
|
+
- Read the approved PLAN.md
|
|
44
|
+
- Read business domain docs relevant to the task
|
|
45
|
+
|
|
46
|
+
2. Implementation:
|
|
47
|
+
- Execute plan steps incrementally
|
|
48
|
+
- Perform "compile/check" after each significant change
|
|
49
|
+
- Ensure all new code follows established project patterns
|
|
50
|
+
|
|
51
|
+
3. Verification:
|
|
52
|
+
- Run syntax verification: {SYNTAX_CHECK}
|
|
53
|
+
- Run test suite using the **resolved test command** from `commands.test` in `.forge/config.json` (i.e. `` `${commands.test}` ``, e.g. `.venv/bin/python -m pytest`, `npm test`, `cargo test`). Do NOT invoke bare `python` / `python3` / `pytest` โ the project interpreter is rarely on `$PATH`; using the resolved command avoids `python: command not found` and `No module named pytest`.
|
|
54
|
+
- Template placeholder: {{TEST_COMMAND}} (resolved at materialize time from `commands.test`).
|
|
55
|
+
- Run build if frontend assets modified: {BUILD_COMMAND}
|
|
56
|
+
|
|
57
|
+
4. Documentation:
|
|
58
|
+
- Write PROGRESS.md containing:
|
|
59
|
+
- Summary of changes
|
|
60
|
+
- Test evidence (copy of output)
|
|
61
|
+
- Files changed manifest
|
|
62
|
+
|
|
63
|
+
5. Knowledge Writeback:
|
|
64
|
+
- Update architecture/domain/stack-checklist if discoveries were made
|
|
65
|
+
- Tag updates: `<!-- Discovered during {TASK_ID} โ {date} -->`
|
|
66
|
+
|
|
67
|
+
6. Finalize:
|
|
68
|
+
- Transitions:
|
|
69
|
+
- **Task mode** โ legal predecessors are `planned`, `plan-approved`, or `implementing`; target is `implemented`.
|
|
70
|
+
- `planned` โ `implemented` (workflow-prose path โ direct)
|
|
71
|
+
- `plan-approved` โ `implementing` โ `implemented` (supervisor-review path)
|
|
72
|
+
- Out-of-band escapes (any state): `plan-revision-required`, `code-revision-required`, `blocked`, `escalated`, `abandoned`
|
|
73
|
+
Update status: `node "$FORGE_ROOT/tools/store-cli.cjs" update-status task {taskId} status implemented`
|
|
74
|
+
- **Bug mode** โ NO status write. The bug remains `in-progress` until the commit phase transitions it to `fixed`. Writing `bug.status` here violates `meta-fix-bug.md ยง Iron Laws #2`.
|
|
75
|
+
- **Do NOT emit a phase event yourself.** The orchestrator owns event emission โ it composes the canonical event from runtime telemetry (model, provider, tokens, wall times) plus the SUMMARY you write in the next step. Subagents that call `store-cli emit` for phase events hallucinate runtime facts (see Plan 11 / Slice 2). Write the SUMMARY and return.
|
|
76
|
+
|
|
77
|
+
7. Emit Summary Sidecar:
|
|
78
|
+
- Write `IMPLEMENTATION-SUMMARY.json` to the record's directory with the following shape:
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"objective": "<one sentence โ what this implementation delivered>",
|
|
82
|
+
"key_changes": ["<up to 12 bullets, 200 chars each โ files changed, key decisions>"],
|
|
83
|
+
"verdict": "n/a",
|
|
84
|
+
"written_at": "<current ISO 8601 timestamp>",
|
|
85
|
+
"artifact_ref":"PROGRESS.md"
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
- Call (task mode):
|
|
89
|
+
```
|
|
90
|
+
node "$FORGE_ROOT/tools/store-cli.cjs" set-summary {taskId} implementation \
|
|
91
|
+
engineering/sprints/{sprint}/{task}/IMPLEMENTATION-SUMMARY.json
|
|
92
|
+
```
|
|
93
|
+
Or (bug mode):
|
|
94
|
+
```
|
|
95
|
+
node "$FORGE_ROOT/tools/store-cli.cjs" set-bug-summary {bugId} implementation \
|
|
96
|
+
engineering/bugs/{bugDir}/IMPLEMENTATION-SUMMARY.json
|
|
97
|
+
```
|
|
98
|
+
- If the set-summary call exits non-zero, fix the sidecar JSON and retry. Do not proceed without a valid summary.
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Iron Laws
|
|
102
|
+
|
|
103
|
+
- Follow the Algorithm step by step. Execute the approved PLAN.md exactly; do not invent scope or skip steps without updating the plan first.
|
|
104
|
+
- Read `.forge/personas/engineer.md` first; print the persona identity line to stdout before any other tool use.
|
|
105
|
+
- All store I/O via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
|
|
106
|
+
- Run the full test suite before declaring the task implemented. Silent continuation past test failures is never acceptable.
|
|
107
|
+
|
|
108
|
+
## Store-Write Verification
|
|
109
|
+
|
|
110
|
+
Every `forge_store` write MUST succeed before advancing. If `store-cli` exits
|
|
111
|
+
non-zero or the `PreToolUse` write-boundary hook blocks the call (exit 2):
|
|
112
|
+
|
|
113
|
+
1. Parse the structured error (names the offending field + schema file).
|
|
114
|
+
2. Correct the JSON to satisfy the schema.
|
|
115
|
+
3. Retry. Repeat up to 3 times.
|
|
116
|
+
4. After 3 failures, halt and escalate with original payload, corrected payload, and all error messages.
|
|
117
|
+
|
|
118
|
+
Never set `FORGE_SKIP_WRITE_VALIDATION=1` โ operator-only emergency switch.
|
|
119
|
+
|
|
120
|
+
## Friction Emit
|
|
121
|
+
Emit `type:friction` `{workflow:implement, persona:engineer, issue}` per `_fragments/friction-emit.md`.
|
|
122
|
+
|
|
123
|
+
## Generation Instructions
|
|
124
|
+
|
|
125
|
+
- **Workflow Structure:** Strict "Algorithm" block format.
|
|
126
|
+
- **Markers (required by `/forge:implement` kickoff shim):** Generated workflow MUST include the "Iron Laws" section, the "Store-Write Verification" section, the literal `forge_store` token, and the `engineer.md` persona path. Missing any โ kickoff shim refuses to dispatch.
|
|
127
|
+
- **Context Isolation:** Forbid inline execution of complex logic; use the `Agent` tool for sub-tasks.
|
|
128
|
+
- **Project Specifics:**
|
|
129
|
+
- Replace {SYNTAX_CHECK}, {TEST_COMMAND}, and {BUILD_COMMAND} with actual project commands.
|
|
130
|
+
- Reference project-specific architecture docs by name.
|
|
131
|
+
- **Token Reporting:** See `_fragments/finalize.md` โ wire via `file_ref:`.
|
|
132
|
+
- **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.
|