@entelligentsia/forgecli 0.10.1 → 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 +78 -0
- package/README.md +21 -3
- package/dist/CHANGELOG-forge-plugin.md +22 -0
- 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 +70 -8
- 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.js +34 -7
- 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 +34 -0
- 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 +64 -10
- package/dist/extensions/forgecli/run-task.js.map +1 -1
- package/dist/extensions/forgecli/session-registry.d.ts +27 -2
- package/dist/extensions/forgecli/session-registry.js +52 -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/thread-switcher.js +213 -28
- package/dist/extensions/forgecli/thread-switcher.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-theme.js +4 -0
- package/dist/extensions/forgecli/viewport-theme.js.map +1 -1
- package/dist/forge-payload/.claude-plugin/plugin.json +1 -1
- 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/list-skills.js +76 -0
- package/dist/forge-payload/tools/store-cli.cjs +27 -1
- package/dist/forge-payload/tools/substitute-placeholders.cjs +60 -8
- package/dist/forge-payload/tools/verify-integrity.cjs +86 -0
- package/package.json +2 -2
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
requirements:
|
|
3
|
+
reasoning: High
|
|
4
|
+
context: Medium
|
|
5
|
+
speed: Low
|
|
6
|
+
deps:
|
|
7
|
+
personas: [product-manager]
|
|
8
|
+
skills: [architect, generic]
|
|
9
|
+
templates: [SPRINT_REQUIREMENTS_TEMPLATE, SPRINT_MANIFEST_TEMPLATE]
|
|
10
|
+
sub_workflows: []
|
|
11
|
+
kb_docs: [MASTER_INDEX.md, architecture/stack.md]
|
|
12
|
+
config_fields: [project.prefix, paths.engineering]
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# 🌸 Meta-Workflow: Sprint Intake
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
Capture sprint requirements via a structured interview and document them for planning.
|
|
20
|
+
|
|
21
|
+
## Algorithm
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
0. Project Orientation:
|
|
25
|
+
- Your current working directory is the project root.
|
|
26
|
+
- Forge config lives at `.forge/config.json` (relative to cwd); the `forge_config` MCP tool returns canonical values.
|
|
27
|
+
- Engineering knowledge lives under `engineering/` (relative to cwd) — `MASTER_INDEX.md`, `architecture/`, `business-domain/`, `sprints/`, `features/`.
|
|
28
|
+
- Paths in subsequent steps resolve against this cwd.
|
|
29
|
+
|
|
30
|
+
1. Pre-flight Gate Check:
|
|
31
|
+
- Probe token reporting: if the host runtime exposes a `/cost` slash command
|
|
32
|
+
(Claude Code), invoke it; on any other runtime treat as unavailable and
|
|
33
|
+
proceed. Do NOT search for or invent a `cost-cli.cjs` — there is no such tool.
|
|
34
|
+
- If the probe succeeds → note for later (will use reported data)
|
|
35
|
+
- If the probe fails or is unavailable → note for later (will use estimates)
|
|
36
|
+
|
|
37
|
+
2. Load Context:
|
|
38
|
+
- Read `engineering/MASTER_INDEX.md` (relative to cwd)
|
|
39
|
+
- Read any pending feature requests or bug reports under `engineering/`
|
|
40
|
+
|
|
41
|
+
3. Requirements Interview:
|
|
42
|
+
- Conduct a structured interview with the user
|
|
43
|
+
- Capture: Objectives, Constraints, Deliverables, and Success Criteria
|
|
44
|
+
- Clarify ambiguous requirements through iterative questioning
|
|
45
|
+
|
|
46
|
+
4. Document Requirements:
|
|
47
|
+
- Generate `engineering/sprints/<SPRINT_ID>/SPRINT_REQUIREMENTS.md`
|
|
48
|
+
- Map requirements to existing Features if applicable
|
|
49
|
+
- Ensure all deliverables are measurable and testable
|
|
50
|
+
|
|
51
|
+
5. Finalize:
|
|
52
|
+
- Update sprint status via `node "$FORGE_ROOT/tools/store-cli.cjs" update-status sprint {sprintId} status planning`
|
|
53
|
+
- **Do NOT emit a phase event yourself.** The orchestrator (or kickoff handler) 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.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Generation Instructions
|
|
57
|
+
|
|
58
|
+
- **Persona Self-Load:** The generated workflow MUST begin by reading `.forge/personas/product-manager.md` as its first step (before any other tool use). This replaces the former inline `## Persona` section. The persona identity line (emoji, name, tagline) should be printed to stdout after reading the file.
|
|
59
|
+
- **Workflow Structure:** The generated `sprint_intake.md` must follow the strict "Algorithm" block format.
|
|
60
|
+
- **Context Isolation:** Forbid inline execution of requirement analysis; use the `Agent` tool for sub-tasks.
|
|
61
|
+
- **Project Specifics:**
|
|
62
|
+
- Reference project-specific requirement templates.
|
|
63
|
+
- **Token Reporting:** The generated workflow MUST mandate the following before returning:
|
|
64
|
+
1. Probe session token usage: invoke `/cost` if the host runtime supports it
|
|
65
|
+
(Claude Code only); on any other runtime treat as unavailable. Do NOT
|
|
66
|
+
shell out to a `cost-cli.cjs` — there is no such tool.
|
|
67
|
+
2. If the probe succeeds:
|
|
68
|
+
- Parse: `inputTokens`, `outputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `estimatedCostUSD`.
|
|
69
|
+
- Add `"source": "reported"` to sidecar JSON.
|
|
70
|
+
3. If the probe fails or is unavailable:
|
|
71
|
+
- Set token fields to `null`: `"inputTokens": null, "outputTokens": null, "estimatedCostUSD": null`.
|
|
72
|
+
- Add `"source": "missing"` to sidecar JSON.
|
|
73
|
+
- Log: "Token data unavailable (cost probe failed). Backfill later via estimate-usage.cjs."
|
|
74
|
+
4. Write the usage sidecar via `node "$FORGE_ROOT/tools/store-cli.cjs" emit {sprintId} '{sidecar-json}' --sidecar`.
|
|
75
|
+
5. **NEVER skip sidecar write.** Always emit (reported or placeholder with nulls).
|
|
76
|
+
- **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
requirements:
|
|
3
|
+
reasoning: High
|
|
4
|
+
context: Medium
|
|
5
|
+
speed: Low
|
|
6
|
+
deps:
|
|
7
|
+
personas: [architect]
|
|
8
|
+
skills: [architect, generic]
|
|
9
|
+
templates: [SPRINT_MANIFEST_TEMPLATE, TASK_PROMPT_TEMPLATE]
|
|
10
|
+
sub_workflows: []
|
|
11
|
+
kb_docs: [MASTER_INDEX.md, architecture/stack.md]
|
|
12
|
+
config_fields: [project.prefix, paths.engineering]
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# 🗻 Meta-Workflow: Sprint Plan
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
Break sprint requirements into a set of estimated tasks with a dependency graph.
|
|
20
|
+
|
|
21
|
+
## Algorithm
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
0. Pre-flight Gate Check:
|
|
25
|
+
- Probe token reporting: if the host runtime exposes a `/cost` slash command
|
|
26
|
+
(Claude Code), invoke it; on any other runtime treat as unavailable. Do
|
|
27
|
+
NOT search for or invent a `cost-cli.cjs` — there is no such tool.
|
|
28
|
+
- If the probe succeeds → note for later (will use reported data)
|
|
29
|
+
- If the probe fails or is unavailable → note for later (will use estimates)
|
|
30
|
+
|
|
31
|
+
1. Load Context:
|
|
32
|
+
- Query the store to orient on current project state before reading docs:
|
|
33
|
+
```sh
|
|
34
|
+
node "$FORGE_ROOT/tools/store-cli.cjs" nlp "latest sprint"
|
|
35
|
+
node "$FORGE_ROOT/tools/store-cli.cjs" nlp "open bugs"
|
|
36
|
+
```
|
|
37
|
+
Use results (titles, statuses, excerpts, file refs) to skip manual MASTER_INDEX.md navigation where sufficient.
|
|
38
|
+
- Read SPRINT_REQUIREMENTS.md
|
|
39
|
+
- Read architecture and domain docs
|
|
40
|
+
- Read the stack checklist
|
|
41
|
+
|
|
42
|
+
2. Task Decomposition:
|
|
43
|
+
- Break requirements into atomic tasks
|
|
44
|
+
- Assign each task to a Feature (if applicable)
|
|
45
|
+
- Define clear acceptance criteria for each task
|
|
46
|
+
- Use the `ID-description` format (e.g., `FORGE-S05-agent-runtime-portability`) for sprint and task folders.
|
|
47
|
+
|
|
48
|
+
3. Estimation and Sequencing:
|
|
49
|
+
- Estimate each task (S, M, L) based on complexity
|
|
50
|
+
- Define the dependency graph (which tasks must precede others)
|
|
51
|
+
- Identify the critical path
|
|
52
|
+
|
|
53
|
+
4. Documentation:
|
|
54
|
+
- Write SPRINT_PLAN.md to `engineering/sprints/{sprintId}/SPRINT_PLAN.md`
|
|
55
|
+
- Create each task via `node "$FORGE_ROOT/tools/store-cli.cjs" write task '{task-json}'`.
|
|
56
|
+
If the command exits non-zero or the PreToolUse hook blocks the write:
|
|
57
|
+
parse the error, correct the JSON, and retry (see Store-Write Verification).
|
|
58
|
+
Do not proceed to the next task until this write succeeds.
|
|
59
|
+
- Update the sprint record with all new task IDs via `node "$FORGE_ROOT/tools/store-cli.cjs" write sprint '{updated-sprint-json}'` (the sprint JSON must include the complete `taskIds` array with all newly created task IDs).
|
|
60
|
+
If the command exits non-zero or the PreToolUse hook blocks the write:
|
|
61
|
+
parse the error, correct the JSON, and retry (see Store-Write Verification).
|
|
62
|
+
Do not proceed until this write succeeds.
|
|
63
|
+
- For each task, create its task folder and write TASK_PROMPT.md:
|
|
64
|
+
* Folder: `engineering/sprints/{sprintId}/{taskId}/`
|
|
65
|
+
* File: `TASK_PROMPT.md` — populate from `.forge/templates/TASK_PROMPT_TEMPLATE.md`
|
|
66
|
+
filling in title, objective, acceptance criteria, entities, DSL/CLI changes, and operational impact
|
|
67
|
+
- Update sprint status via `node "$FORGE_ROOT/tools/store-cli.cjs" update-status sprint {sprintId} status active`.
|
|
68
|
+
If the command exits non-zero, parse the error and retry
|
|
69
|
+
(see Store-Write Verification). Do not proceed until this write succeeds.
|
|
70
|
+
|
|
71
|
+
5. Finalize:
|
|
72
|
+
- **Do NOT emit a phase event yourself.** The orchestrator (or kickoff handler) 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.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Anti-Pattern Guard
|
|
76
|
+
|
|
77
|
+
The generated workflow MUST include the following section verbatim, placed immediately
|
|
78
|
+
after the Purpose heading and before the Algorithm block:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
## Iron Laws
|
|
82
|
+
|
|
83
|
+
- YOU MUST NOT write any code, pseudocode, or implementation sketch.
|
|
84
|
+
- YOU MUST NOT produce a plan of your own before reading this workflow.
|
|
85
|
+
- YOU MUST follow the Algorithm below step by step. Reading it is not optional.
|
|
86
|
+
- If you have already read SPRINT_REQUIREMENTS.md and feel ready to decompose tasks:
|
|
87
|
+
stop. Return to step 1 of the Algorithm and proceed from there.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Store-Write Verification
|
|
91
|
+
|
|
92
|
+
Every write to the Forge store MUST succeed before the agent proceeds to the next
|
|
93
|
+
step. Store writes include `store-cli` commands (`write`, `update-status`, `emit`)
|
|
94
|
+
and direct `Write`/`Edit` tool calls against Forge-owned paths under
|
|
95
|
+
`.forge/store/`.
|
|
96
|
+
|
|
97
|
+
If a write is rejected — either by `store-cli` exiting non-zero or by the
|
|
98
|
+
`PreToolUse` write-boundary hook blocking the call with exit code 2 — the agent
|
|
99
|
+
MUST:
|
|
100
|
+
|
|
101
|
+
1. **Parse the error.** Both `store-cli` and the write-boundary hook emit
|
|
102
|
+
structured messages naming the offending field and referencing the relevant
|
|
103
|
+
schema file (e.g. `forge/schemas/task.schema.json`). Read the error carefully
|
|
104
|
+
to identify which field is wrong and what the schema expects.
|
|
105
|
+
2. **Correct the data.** Fix the JSON payload to satisfy the schema: add missing
|
|
106
|
+
required fields, fix type mismatches, remove undeclared properties, correct
|
|
107
|
+
enum values, etc. If the hook message mentions a schema file, read that file
|
|
108
|
+
to understand the full shape.
|
|
109
|
+
3. **Retry the write.** Re-attempt the same store write with the corrected payload.
|
|
110
|
+
4. **Repeat until success.** Do NOT advance past the current step, emit events,
|
|
111
|
+
or produce further artifacts until the write is confirmed successful.
|
|
112
|
+
|
|
113
|
+
**Maximum retries: 3.** If the write still fails after 3 correction attempts,
|
|
114
|
+
halt and escalate to the human. Include the original payload, the corrected
|
|
115
|
+
payload, and all error messages in the escalation.
|
|
116
|
+
|
|
117
|
+
**Do NOT** set `FORGE_SKIP_WRITE_VALIDATION=1` to bypass a schema error. That
|
|
118
|
+
environment variable is reserved for emergency operator repair only.
|
|
119
|
+
|
|
120
|
+
## Generation Instructions
|
|
121
|
+
|
|
122
|
+
- **Persona Self-Load:** The generated workflow MUST begin by reading `.forge/personas/architect.md` as its first step (before any other tool use). This replaces the former inline `## Persona` section. The persona identity line (emoji, name, tagline) should be printed to stdout after reading the file.
|
|
123
|
+
- **Workflow Structure:** The generated `sprint_plan.md` must follow the strict "Algorithm" block format.
|
|
124
|
+
- **Context Isolation:** Forbid inline execution of task decomposition or estimation; use the `Agent` tool for sub-tasks.
|
|
125
|
+
- **Project Specifics:**
|
|
126
|
+
- Use project-specific estimation guidelines.
|
|
127
|
+
- Reference project's task manifest schema.
|
|
128
|
+
- **Token Reporting:** The generated workflow MUST mandate the following before returning:
|
|
129
|
+
1. Probe session token usage: invoke `/cost` if the host runtime supports it
|
|
130
|
+
(Claude Code only); on any other runtime treat as unavailable. Do NOT
|
|
131
|
+
shell out to a `cost-cli.cjs` — there is no such tool.
|
|
132
|
+
2. If the probe succeeds:
|
|
133
|
+
- Parse: `inputTokens`, `outputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `estimatedCostUSD`.
|
|
134
|
+
- Add `"source": "reported"` to sidecar JSON.
|
|
135
|
+
3. If the probe fails or is unavailable:
|
|
136
|
+
- Set token fields to `null`: `"inputTokens": null, "outputTokens": null, "estimatedCostUSD": null`.
|
|
137
|
+
- Add `"source": "missing"` to sidecar JSON.
|
|
138
|
+
- Log: "Token data unavailable (cost probe failed). Backfill later via estimate-usage.cjs."
|
|
139
|
+
4. Write the usage sidecar via `node "$FORGE_ROOT/tools/store-cli.cjs" emit {sprintId} '{sidecar-json}' --sidecar`.
|
|
140
|
+
5. **NEVER skip sidecar write.** Always emit (reported or placeholder with nulls).
|
|
141
|
+
- **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.
|
|
142
|
+
- **Store-Write Verification:** The generated workflow MUST include the "Store-Write
|
|
143
|
+
Verification" section verbatim. Every `store-cli write`, `store-cli update-status`,
|
|
144
|
+
and `store-cli emit` command in the Algorithm must be annotated with the
|
|
145
|
+
parse-correct-retry instruction: "If the command exits non-zero or the
|
|
146
|
+
PreToolUse hook blocks the write: parse the error, correct the JSON, and retry
|
|
147
|
+
(see Store-Write Verification). Do not proceed until this write succeeds."
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
requirements:
|
|
3
|
+
reasoning: Medium
|
|
4
|
+
context: Medium
|
|
5
|
+
speed: Medium
|
|
6
|
+
audience: subagent
|
|
7
|
+
phase: update-impl
|
|
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]
|
|
20
|
+
config_fields: [commands.test, paths.engineering]
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# 🌱 Meta-Workflow: Update Implementation
|
|
24
|
+
|
|
25
|
+
## Purpose
|
|
26
|
+
|
|
27
|
+
Update the implementation of a task based on a "Revision Required" verdict from a review phase.
|
|
28
|
+
|
|
29
|
+
## Iron Laws
|
|
30
|
+
|
|
31
|
+
- Address every "Revision Required" item from the review artifact at the correct code location; do not paper over them with comments. If a finding is wrong, escalate rather than ignore.
|
|
32
|
+
- Read `.forge/personas/engineer.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
|
|
33
|
+
- All store I/O via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
|
|
34
|
+
|
|
35
|
+
## Store-Write Verification
|
|
36
|
+
|
|
37
|
+
Every `forge_store` write MUST succeed before advancing. If `store-cli` exits
|
|
38
|
+
non-zero or the `PreToolUse` write-boundary hook blocks the call (exit 2):
|
|
39
|
+
|
|
40
|
+
1. Parse the structured error (names the offending field + schema file).
|
|
41
|
+
2. Correct the JSON to satisfy the schema.
|
|
42
|
+
3. Retry. Repeat up to 3 times.
|
|
43
|
+
4. After 3 failures, halt and escalate with original payload, corrected payload, and all error messages.
|
|
44
|
+
|
|
45
|
+
Never set `FORGE_SKIP_WRITE_VALIDATION=1` — operator-only emergency switch.
|
|
46
|
+
|
|
47
|
+
## Algorithm
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
1. Load Context:
|
|
51
|
+
- Read current implementation (code)
|
|
52
|
+
- Read the review artifact (CODE_REVIEW.md or VALIDATION_REPORT.md)
|
|
53
|
+
- Read the approved PLAN.md
|
|
54
|
+
|
|
55
|
+
2. Analysis:
|
|
56
|
+
- Map the "Revision Required" items to specific code locations
|
|
57
|
+
- Determine if the required changes necessitate a plan update
|
|
58
|
+
|
|
59
|
+
3. Implementation:
|
|
60
|
+
- Apply the necessary fixes/changes
|
|
61
|
+
- Verify the changes using the **resolved test command** from `commands.test` in `.forge/config.json` (i.e. `` `${commands.test}` ``, e.g. `.venv/bin/python -m pytest`). Template placeholder: {{TEST_COMMAND}}. Do NOT invoke bare `python` / `python3` — the project interpreter is rarely on `$PATH`.
|
|
62
|
+
- Update PROGRESS.md with a summary of the revisions
|
|
63
|
+
|
|
64
|
+
4. Finalize:
|
|
65
|
+
- Update task status via `node "$FORGE_ROOT/tools/store-cli.cjs" update-status task {taskId} status implemented`
|
|
66
|
+
- **Do NOT emit a phase event yourself.** The orchestrator (or kickoff handler) 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.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Generation Instructions
|
|
70
|
+
|
|
71
|
+
- **Workflow Structure:** The generated `update_implementation.md` must follow the strict "Algorithm" block format.
|
|
72
|
+
- **Context Isolation:** Forbid inline execution of fix logic; use the `Agent` tool for sub-tasks.
|
|
73
|
+
- **Project Specifics:**
|
|
74
|
+
- Reference project-specific verification commands.
|
|
75
|
+
- **Token Reporting:** See `_fragments/finalize.md` — wire via `file_ref:`.
|
|
76
|
+
- **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
requirements:
|
|
3
|
+
reasoning: Medium
|
|
4
|
+
context: Medium
|
|
5
|
+
speed: Medium
|
|
6
|
+
audience: subagent
|
|
7
|
+
phase: update-plan
|
|
8
|
+
context:
|
|
9
|
+
architecture: false
|
|
10
|
+
prior_summaries: delta
|
|
11
|
+
persona: summary
|
|
12
|
+
master_index: false
|
|
13
|
+
diff_mode: false
|
|
14
|
+
deps:
|
|
15
|
+
personas: [architect]
|
|
16
|
+
skills: [architect, generic]
|
|
17
|
+
templates: [PLAN_TEMPLATE]
|
|
18
|
+
sub_workflows: [review_plan]
|
|
19
|
+
kb_docs: [architecture/stack.md]
|
|
20
|
+
config_fields: [paths.engineering]
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# 🌱 Meta-Workflow: Update Plan
|
|
24
|
+
|
|
25
|
+
## Purpose
|
|
26
|
+
|
|
27
|
+
Update the implementation plan of a task based on a "Revision Required" verdict from the plan review phase.
|
|
28
|
+
|
|
29
|
+
## Iron Laws
|
|
30
|
+
|
|
31
|
+
- Address every numbered finding in the review artifact. Do not silently drop items; if a finding is wrong, note the reason in the revised plan rather than ignoring it.
|
|
32
|
+
- Read `.forge/personas/architect.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
|
|
33
|
+
- All store I/O via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
|
|
34
|
+
|
|
35
|
+
## Store-Write Verification
|
|
36
|
+
|
|
37
|
+
Every `forge_store` write MUST succeed before advancing. If `store-cli` exits
|
|
38
|
+
non-zero or the `PreToolUse` write-boundary hook blocks the call (exit 2):
|
|
39
|
+
|
|
40
|
+
1. Parse the structured error (names the offending field + schema file).
|
|
41
|
+
2. Correct the JSON to satisfy the schema.
|
|
42
|
+
3. Retry. Repeat up to 3 times.
|
|
43
|
+
4. After 3 failures, halt and escalate with original payload, corrected payload, and all error messages.
|
|
44
|
+
|
|
45
|
+
Never set `FORGE_SKIP_WRITE_VALIDATION=1` — operator-only emergency switch.
|
|
46
|
+
|
|
47
|
+
## Algorithm
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
1. Load Context:
|
|
51
|
+
- Read the original task prompt
|
|
52
|
+
- Read the current PLAN.md
|
|
53
|
+
- Read the review artifact (PLAN_REVIEW.md)
|
|
54
|
+
|
|
55
|
+
2. Analysis:
|
|
56
|
+
- Review the numbered, actionable items in the review artifact
|
|
57
|
+
- Determine where the plan was insufficient or incorrect
|
|
58
|
+
|
|
59
|
+
3. Revision:
|
|
60
|
+
- Update PLAN.md to address all review findings
|
|
61
|
+
- Ensure the revised plan remains aligned with the task prompt
|
|
62
|
+
- Update the "Operational Impact" or "Testing Strategy" if the revision changed them
|
|
63
|
+
|
|
64
|
+
4. Finalize:
|
|
65
|
+
- Update task status via `node "$FORGE_ROOT/tools/store-cli.cjs" update-status task {taskId} status planned`
|
|
66
|
+
- **Do NOT emit a phase event yourself.** The orchestrator (or kickoff handler) 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.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Generation Instructions
|
|
70
|
+
|
|
71
|
+
- **Workflow Structure:** The generated `update_plan.md` must follow the strict "Algorithm" block format.
|
|
72
|
+
- **Context Isolation:** Forbid inline execution of plan revision; use the `Agent` tool for sub-tasks.
|
|
73
|
+
- **Project Specifics:**
|
|
74
|
+
- Reference the project's plan template.
|
|
75
|
+
- **Token Reporting:** See `_fragments/finalize.md` — wire via `file_ref:`.
|
|
76
|
+
- **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
requirements:
|
|
3
|
+
reasoning: High
|
|
4
|
+
context: Medium
|
|
5
|
+
speed: Low
|
|
6
|
+
audience: subagent
|
|
7
|
+
phase: validate
|
|
8
|
+
context:
|
|
9
|
+
architecture: false
|
|
10
|
+
prior_summaries: none
|
|
11
|
+
persona: summary
|
|
12
|
+
master_index: false
|
|
13
|
+
diff_mode: true
|
|
14
|
+
deps:
|
|
15
|
+
personas: [qa-engineer]
|
|
16
|
+
skills: [qa-engineer, generic]
|
|
17
|
+
templates: []
|
|
18
|
+
sub_workflows: []
|
|
19
|
+
kb_docs: [architecture/stack.md]
|
|
20
|
+
config_fields: [commands.test, paths.engineering]
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# 🍵 Meta-Workflow: Validate Task
|
|
24
|
+
|
|
25
|
+
## Purpose
|
|
26
|
+
|
|
27
|
+
The Supervisor performs a final validation of the implementation against the acceptance criteria and the technical spec.
|
|
28
|
+
|
|
29
|
+
## Iron Laws
|
|
30
|
+
|
|
31
|
+
- Validate against the acceptance criteria as written; do not soften, expand, or reinterpret them. The validator's job is to catch what the implementer optimistically considered "done".
|
|
32
|
+
- Read `.forge/personas/qa-engineer.md` first; print the persona identity line (emoji, name, tagline) to stdout before any other tool use.
|
|
33
|
+
- All store I/O via `forge_store` (or `node "$FORGE_ROOT/tools/store-cli.cjs"`). Never edit `.forge/store/*.json` directly.
|
|
34
|
+
|
|
35
|
+
## Store-Write Verification
|
|
36
|
+
|
|
37
|
+
Every `forge_store` write MUST succeed before advancing. If `store-cli` exits
|
|
38
|
+
non-zero or the `PreToolUse` write-boundary hook blocks the call (exit 2):
|
|
39
|
+
|
|
40
|
+
1. Parse the structured error (names the offending field + schema file).
|
|
41
|
+
2. Correct the JSON to satisfy the schema.
|
|
42
|
+
3. Retry. Repeat up to 3 times.
|
|
43
|
+
4. After 3 failures, halt and escalate with original payload, corrected payload, and all error messages.
|
|
44
|
+
|
|
45
|
+
Never set `FORGE_SKIP_WRITE_VALIDATION=1` — operator-only emergency switch.
|
|
46
|
+
|
|
47
|
+
## Algorithm
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
0. Pre-flight Gate Check:
|
|
52
|
+
- Resolve FORGE_ROOT (`node -e "console.log(require('./.forge/config.json').paths.forgeRoot)"`).
|
|
53
|
+
- Run: `node "$FORGE_ROOT/tools/preflight-gate.cjs" --phase validate --task {taskId}`
|
|
54
|
+
- Exit 1 (gate failed) → print stderr and HALT. Do not proceed; do not attempt to produce the artifact.
|
|
55
|
+
- Exit 2 (misconfiguration) → print stderr and HALT.
|
|
56
|
+
- Exit 0 → continue.
|
|
57
|
+
|
|
58
|
+
1. Load Context:
|
|
59
|
+
- Read task prompt
|
|
60
|
+
- Read approved PLAN.md
|
|
61
|
+
- Read the implementation
|
|
62
|
+
- Read PROGRESS.md
|
|
63
|
+
|
|
64
|
+
2. Validation:
|
|
65
|
+
- Execute the "Acceptance Criteria" checklist from the plan
|
|
66
|
+
- Verify that all technical constraints (e.g., performance, security) are met
|
|
67
|
+
- Check for any regressions in related functionality
|
|
68
|
+
- When re-running the test suite, use the **resolved test command** from `commands.test` in `.forge/config.json` (i.e. `` `${commands.test}` ``, e.g. `.venv/bin/python -m pytest`). Template placeholder: {{TEST_COMMAND}}. Do NOT invoke bare `python` / `python3` — the project interpreter is rarely on `$PATH`.
|
|
69
|
+
|
|
70
|
+
3. Verdict:
|
|
71
|
+
- Write VALIDATION_REPORT.md using the format:
|
|
72
|
+
**Verdict:** [Approved | Revision Required]
|
|
73
|
+
- If Revision Required: list the failed criteria and required fixes
|
|
74
|
+
- If Approved: confirm the task is validated
|
|
75
|
+
|
|
76
|
+
4. Finalize:
|
|
77
|
+
- Update task status via `node "$FORGE_ROOT/tools/store-cli.cjs" update-status task {taskId} status review-approved` (if Approved) or `node "$FORGE_ROOT/tools/store-cli.cjs" update-status task {taskId} status code-revision-required` (if Revision Required)
|
|
78
|
+
- **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.
|
|
79
|
+
|
|
80
|
+
5. Emit Summary Sidecar:
|
|
81
|
+
- Write `VALIDATION-SUMMARY.json` to the task directory with the following shape:
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"objective": "<one sentence — what acceptance criteria were validated>",
|
|
85
|
+
"findings": ["<up to 12 bullets, 200 chars each — pass/fail per criterion>"],
|
|
86
|
+
"verdict": "<approved | revision>",
|
|
87
|
+
"written_at": "<current ISO 8601 timestamp>",
|
|
88
|
+
"artifact_ref":"VALIDATION_REPORT.md"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
- Call:
|
|
92
|
+
```
|
|
93
|
+
node "$FORGE_ROOT/tools/store-cli.cjs" set-summary {task_id} validation \
|
|
94
|
+
engineering/sprints/{sprint}/{task}/VALIDATION-SUMMARY.json
|
|
95
|
+
```
|
|
96
|
+
- If set-summary exits non-zero, fix the sidecar JSON and retry. Do not proceed without a valid summary.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Friction Emit
|
|
100
|
+
Emit `type:friction` `{workflow:validate, persona:qa-engineer, issue}` per `_fragments/friction-emit.md`.
|
|
101
|
+
|
|
102
|
+
## Generation Instructions
|
|
103
|
+
|
|
104
|
+
- **Workflow Structure:** The generated `validate_task.md` must follow the strict "Algorithm" block format.
|
|
105
|
+
- **Verdict Detection:** The generated workflow MUST enforce the strict `**Verdict:** [Approved | Revision Required]` format.
|
|
106
|
+
- **Context Isolation:** Forbid inline execution of validation tests; use the `Agent` tool for sub-tasks.
|
|
107
|
+
- **Project Specifics:**
|
|
108
|
+
- Reference project-specific validation tools or smoke tests.
|
|
109
|
+
- **Token Reporting:** See `_fragments/finalize.md` — wire via `file_ref:`.
|
|
110
|
+
- **Diff-mode:** Generated workflow MUST include the diff-first read mode instruction (see plan PLAN.md A6).
|
|
111
|
+
- **Event Emission:** Ensure the "complete" event includes the `eventId` passed by the orchestrator.
|