mandrel 2.9.0 → 2.10.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.
- package/.agents/agents/.markdownlint.json +4 -0
- package/.agents/agents/acceptance-critic.md +30 -5
- package/.agents/agents/auditor.md +36 -19
- package/.agents/agents/plan-critic.md +31 -5
- package/.agents/agents/story-worker.md +91 -100
- package/.agents/docs/configuration.md +16 -4
- package/.agents/docs/execution-reference.md +13 -0
- package/.agents/docs/workflows.md +1 -1
- package/.agents/instructions.md +131 -265
- package/.agents/rules/git-conventions.md +47 -83
- package/.agents/rules/orchestration-error-handling.md +28 -0
- package/.agents/schemas/agentrc.schema.json +24 -2
- package/.agents/schemas/validation-evidence.schema.json +3 -1
- package/.agents/scripts/acceptance-eval.js +1 -1
- package/.agents/scripts/apply-quality-bootstrap.js +1 -1
- package/.agents/scripts/check-test-temp-hygiene.js +438 -0
- package/.agents/scripts/deliver-recover.js +23 -6
- package/.agents/scripts/lib/audit-suite/index.js +5 -0
- package/.agents/scripts/lib/audit-suite/lens-diff-floor.js +179 -0
- package/.agents/scripts/lib/audit-suite/selector.js +1 -1
- package/.agents/scripts/lib/config/temp-paths.js +121 -1
- package/.agents/scripts/lib/config-settings-schema-delivery.js +30 -0
- package/.agents/scripts/lib/config-settings-schema.js +1 -1
- package/.agents/scripts/lib/observability/metrics-ledger.js +217 -0
- package/.agents/scripts/lib/observability/runtime-friction.js +7 -0
- package/.agents/scripts/lib/orchestration/complexity-gate.js +113 -2
- package/.agents/scripts/lib/orchestration/deliver-recover.js +137 -10
- package/.agents/scripts/lib/orchestration/merge-block-class.js +36 -15
- package/.agents/scripts/lib/orchestration/merge-poll.js +213 -0
- package/.agents/scripts/lib/orchestration/plan-context.js +57 -0
- package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +182 -9
- package/.agents/scripts/lib/orchestration/plan-critics-evaluate.js +29 -2
- package/.agents/scripts/lib/orchestration/plan-metrics.js +31 -82
- package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +102 -2
- package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +215 -14
- package/.agents/scripts/lib/orchestration/resolve-stories.js +7 -0
- package/.agents/scripts/lib/orchestration/review-providers/native.js +34 -16
- package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +8 -3
- package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +230 -79
- package/.agents/scripts/lib/orchestration/story-close/phases/local-lens-review.js +89 -1
- package/.agents/scripts/lib/orchestration/story-close/phases/review-core.js +73 -0
- package/.agents/scripts/lib/templates/decomposer-prompts.js +13 -6
- package/.agents/scripts/lib/test-env.js +65 -0
- package/.agents/scripts/plan-context.js +66 -9
- package/.agents/scripts/plan-critics.js +115 -3
- package/.agents/scripts/plan-persist.js +11 -1
- package/.agents/scripts/plan-run-epilogue.js +1 -1
- package/.agents/scripts/single-story-confirm-merge.js +65 -5
- package/.agents/scripts/stories-wave-tick.js +1 -1
- package/.agents/workflows/deliver.md +86 -230
- package/.agents/workflows/helpers/deliver-reference.md +167 -0
- package/.agents/workflows/helpers/deliver-story-reference.md +203 -0
- package/.agents/workflows/helpers/deliver-story.md +114 -432
- package/.agents/workflows/helpers/plan-reference.md +211 -0
- package/.agents/workflows/plan.md +107 -304
- package/docs/CHANGELOG.md +27 -0
- package/package.json +1 -1
package/.agents/instructions.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# Agent Execution Protocol
|
|
2
2
|
|
|
3
|
-
You operate under the Agent Execution Protocol — this
|
|
4
|
-
governs your behavior
|
|
5
|
-
|
|
3
|
+
You operate under the Agent Execution Protocol — this instruction set
|
|
4
|
+
governs your behavior and constraints; you MUST strictly adhere to it.
|
|
5
|
+
It is a lean always-on spine: procedural detail lives in the on-demand
|
|
6
|
+
tier (§ 1.F rules,
|
|
7
|
+
[`docs/execution-reference.md`](docs/execution-reference.md), skills)
|
|
8
|
+
and is read when the task engages it.
|
|
6
9
|
|
|
7
10
|
---
|
|
8
11
|
|
|
@@ -10,333 +13,196 @@ strictly adhere to it.
|
|
|
10
13
|
|
|
11
14
|
### A. Role Framing
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
skill / workflow guidance (QA skills for verification, the security skill for
|
|
19
|
-
threat modeling) rather than looking for a persona file.
|
|
16
|
+
No persona packs, no `persona::*` labels — constraints come from this
|
|
17
|
+
file, the rules, and skills. Role-scoped spawn contexts live under
|
|
18
|
+
`.agents/agents/` (`delivery.routing.roleScopedAgents`); `qa.personas`
|
|
19
|
+
are a separate fixture concept. "Act as [role]" = apply the matching
|
|
20
|
+
skill / workflow guidance.
|
|
20
21
|
|
|
21
22
|
### B. Skill Activation
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
skills
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
When a task engages a domain or technology, you MUST read the corresponding
|
|
32
|
-
`.agents/skills/[tier]/[category]/[skill-name]/SKILL.md` and apply its
|
|
33
|
-
constraints — the **Policy Capsule** (the whole cost of activation) on
|
|
34
|
-
engagement, a `reference.md` section or `examples/` only when the task needs it
|
|
35
|
-
(§ 1.F's read-when-relevant split). When unsure which applies, match the task
|
|
36
|
-
against the one-line `description` in each skill's frontmatter (catalogued in
|
|
37
|
-
`.agents/skills/skills.index.json`). Skills compose (`idea-refinement` →
|
|
38
|
-
`/plan` → test-first implementation → `code-review-and-quality`); not every
|
|
39
|
-
task needs every skill. The always-on operating posture is governed by § 3–4
|
|
40
|
-
and § 1.I.
|
|
24
|
+
When a task engages a domain or technology, you MUST read the matching
|
|
25
|
+
`.agents/skills/[tier]/[category]/[skill-name]/SKILL.md` — tiers
|
|
26
|
+
**`core/`** (universal process; test-first discipline lives in
|
|
27
|
+
[`rules/testing-standards.md`](rules/testing-standards.md)) and
|
|
28
|
+
**`stack/`** (tech-specific) — and apply its constraints: the **Policy
|
|
29
|
+
Capsule** on engagement; `reference.md` / `examples/` only when needed.
|
|
30
|
+
Unsure? Match against the `description`s in
|
|
31
|
+
`.agents/skills/skills.index.json`.
|
|
41
32
|
|
|
42
33
|
### C. Proactive Documentation
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
`CHANGELOG.md`, then (2) the host's web fetch/search; note which channel you
|
|
50
|
-
used so reviewers can spot stale references.
|
|
35
|
+
For any code involving third-party libraries, fetch the latest official
|
|
36
|
+
docs **before** writing code via the host's best live-documentation
|
|
37
|
+
mechanism (docs MCP server, IDE lookup) — do not ask permission.
|
|
38
|
+
Fallbacks: (1) in-repo docs and the package's bundled README/CHANGELOG,
|
|
39
|
+
(2) web fetch/search. Note the channel you used.
|
|
51
40
|
|
|
52
41
|
### D. Error Handling & Degradation
|
|
53
42
|
|
|
54
|
-
If
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
> - **Missing:** `[file or tool]`
|
|
60
|
-
> - **Impact:** [Description]
|
|
61
|
-
> - **Fallback:** [Description]
|
|
62
|
-
|
|
63
|
-
State mutations (label transitions, cascade completion, structured comments)
|
|
64
|
-
are performed via the in-repo CLI scripts under `.agents/scripts/`
|
|
65
|
-
(`update-ticket-state.js`, `post-structured-comment.js`, …). Use those
|
|
66
|
-
directly — there is no separate state-mutation MCP server to degrade from.
|
|
43
|
+
If a protocol file cannot be loaded, alert the user before proceeding
|
|
44
|
+
with a `⚠️ **Agent Protocol Warning**` block naming **Missing**,
|
|
45
|
+
**Impact**, and **Fallback**. State mutations go through the in-repo CLI
|
|
46
|
+
scripts under `.agents/scripts/` — there is no state-mutation MCP server
|
|
47
|
+
to degrade from.
|
|
67
48
|
|
|
68
49
|
### E. Local Overrides
|
|
69
50
|
|
|
70
|
-
If
|
|
71
|
-
MUST load it — the
|
|
72
|
-
`.agentrc.json` (local wins; absent is a no-op). Do not modify these
|
|
73
|
-
unless requested.
|
|
74
|
-
|
|
75
|
-
**Durable slash commands.** Any `.md` at `.agents/local/workflows/<name>.md` is
|
|
76
|
-
projected into `.claude/commands/<name>.md` by `sync-claude-commands.js` as
|
|
77
|
-
`/<name>`. The `.agents/local/` subtree is exempt from `mandrel sync`'s prune
|
|
78
|
-
pass, so these commands survive `npm install` / `mandrel sync` / `mandrel
|
|
79
|
-
update`; a core payload command of the same basename wins (local ignored with a
|
|
80
|
-
`shadowed` warning).
|
|
51
|
+
If `.agents/instructions.local.md` or `.agentrc.local.json` is present,
|
|
52
|
+
you MUST load it — the resolver deep-merges `.agentrc.local.json` over
|
|
53
|
+
`.agentrc.json` (local wins; absent is a no-op). Do not modify these
|
|
54
|
+
files unless requested. Durable local slash commands:
|
|
55
|
+
[`docs/execution-reference.md`](docs/execution-reference.md#durable-local-slash-commands).
|
|
81
56
|
|
|
82
57
|
### F. Modular Global Rules
|
|
83
58
|
|
|
84
|
-
`.agents/rules/` splits into an **always-on core**
|
|
85
|
-
|
|
86
|
-
and
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
|
|
95
|
-
[`git-conventions-reference.md`](rules/git-conventions-reference.md)
|
|
96
|
-
(git-history mechanics),
|
|
97
|
-
[`shell-conventions.md`](rules/shell-conventions.md) (shell chains,
|
|
98
|
-
cross-platform strings),
|
|
99
|
-
[`testing-standards.md`](rules/testing-standards.md) (authoring or
|
|
100
|
-
restructuring tests),
|
|
101
|
-
[`orchestration-error-handling.md`](rules/orchestration-error-handling.md)
|
|
102
|
-
(scripts under `.agents/scripts/**`),
|
|
103
|
-
[`ci-remediation.md`](rules/ci-remediation.md) (a red or slow CI check), and
|
|
104
|
-
[`api-conventions.md`](rules/api-conventions.md) /
|
|
105
|
-
[`gherkin-standards.md`](rules/gherkin-standards.md) /
|
|
106
|
-
[`changelog-style.md`](rules/changelog-style.md) /
|
|
107
|
-
[`test-seams.md`](rules/test-seams.md) (API, Gherkin, changelog, test-seam
|
|
108
|
-
work).
|
|
109
|
-
|
|
110
|
-
Read the rule when unsure — cheaper than shipping a MUST violation; loading it
|
|
111
|
-
on demand does not lower its authority (§ 1.K).
|
|
59
|
+
`.agents/rules/` splits into an **always-on core** —
|
|
60
|
+
[`security-baseline.md`](rules/security-baseline.md) (inviolable security
|
|
61
|
+
MUSTs) and [`git-conventions.md`](rules/git-conventions.md) (branch
|
|
62
|
+
shapes, commit subjects, push/hygiene MUSTs) — and an **on-demand set**,
|
|
63
|
+
read **before** the matching work (each opens with a one-line "applies
|
|
64
|
+
when…" scope header): `git-conventions-reference.md`,
|
|
65
|
+
`shell-conventions.md`, `testing-standards.md`,
|
|
66
|
+
`orchestration-error-handling.md` (scripts under `.agents/scripts/**`),
|
|
67
|
+
`ci-remediation.md`, `api-conventions.md`, `gherkin-standards.md`,
|
|
68
|
+
`changelog-style.md`, `test-seams.md`. Read when unsure (on-demand
|
|
69
|
+
loading does not lower a rule's authority — § 1.K).
|
|
112
70
|
|
|
113
71
|
### G. Structured Configuration
|
|
114
72
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
`docs/tech-stack.md` when present, otherwise the **Tech Stack** section of
|
|
119
|
-
`docs/architecture.md`.
|
|
73
|
+
`.agentrc.json` holds operational limits. Project technology choices
|
|
74
|
+
are deliberately kept out of it — read `docs/tech-stack.md` when
|
|
75
|
+
present, else the **Tech Stack** section of `docs/architecture.md`.
|
|
120
76
|
|
|
121
77
|
### H. Observability & Friction Telemetry
|
|
122
78
|
|
|
123
|
-
You MUST log
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
-
|
|
129
|
-
`node .agents/scripts/diagnose-friction.js --story [STORY_ID] --cmd [FAILED_COMMAND]`
|
|
130
|
-
- **When to fire**: after repeated tool-validation errors, an unrecoverable
|
|
131
|
-
command failure, ambiguity needing self-correction, or repetitive boilerplate
|
|
132
|
-
a workflow/skill could simplify.
|
|
133
|
-
|
|
134
|
-
Schema, stream path, the never-silently-dropped guarantee, and the
|
|
135
|
-
`AGENT_LOG_LEVEL` (`silent`/`info`/`verbose`) emission table are reference
|
|
136
|
-
detail — see [`docs/execution-reference.md`](docs/execution-reference.md#friction-telemetry).
|
|
79
|
+
You MUST log operational friction (repeated tool errors, unrecoverable
|
|
80
|
+
command failures, self-corrected ambiguity, automatable boilerplate):
|
|
81
|
+
`node .agents/scripts/diagnose-friction.js --story [STORY_ID] --cmd [FAILED_COMMAND]`
|
|
82
|
+
— a **local NDJSON signal** (not posted to the ticket). Schema and the
|
|
83
|
+
`AGENT_LOG_LEVEL` table:
|
|
84
|
+
[`docs/execution-reference.md`](docs/execution-reference.md#friction-telemetry).
|
|
137
85
|
|
|
138
86
|
### I. Anti-Thrashing Protocol
|
|
139
87
|
|
|
140
|
-
You MUST
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
- **Failure cluster** — several tool calls in a row returning same-shape
|
|
147
|
-
errors with the same remediation. Stop.
|
|
148
|
-
- **Research drift** — several reads deep with nothing written and the reads no
|
|
149
|
-
longer narrowing the problem. Stop and plan with what you have.
|
|
150
|
-
- **Same fix, same failure** — the same kind of fix applied more than once for
|
|
151
|
-
one error class with no change in the failure mode. Stop; the diagnosis is
|
|
152
|
-
wrong.
|
|
153
|
-
|
|
154
|
-
When you stop, summarize in one paragraph what you tried, what recurred, and
|
|
155
|
-
what you would test next, then Re-Plan or hand back — do not paper over the
|
|
156
|
-
loop with another just-in-case retry.
|
|
88
|
+
You MUST recognize thrashing and stop **before** spending more tokens
|
|
89
|
+
on a failing strategy — cues: a **failure cluster** (same-shape tool
|
|
90
|
+
errors in a row), **research drift** (reads no longer narrowing the
|
|
91
|
+
problem), **same fix, same failure** (the diagnosis is wrong). On stop:
|
|
92
|
+
summarize what you tried and what recurred, then **Re-Plan** or yield —
|
|
93
|
+
never another just-in-case retry.
|
|
157
94
|
|
|
158
95
|
### J. HITL Blocker Escalation (Safe Execution)
|
|
159
96
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
`agent::blocked`, summarize the blocker, and wait for operator resume.
|
|
168
|
-
- **Resume contract**: continue only after the operator explicitly unblocks
|
|
169
|
-
(`agent::executing` or equivalent workflow instruction).
|
|
170
|
-
- **High-risk heuristic**: use `planning.riskHeuristics` from
|
|
171
|
-
`.agentrc.json` to decide when to escalate via `agent::blocked`. Typical
|
|
172
|
-
triggers include destructive/irreversible data mutations, shared
|
|
173
|
-
auth/security changes, CI/CD gate changes, monorepo-wide rewrites, and
|
|
174
|
-
destructive schema migrations.
|
|
97
|
+
Check ticket labels before any task. `risk::high` is planning/audit
|
|
98
|
+
metadata only — no automatic runtime pause. The single runtime pause
|
|
99
|
+
point is **`agent::blocked`**: on an unresolvable blocker or an unsafe
|
|
100
|
+
destructive action without explicit authorization, transition to
|
|
101
|
+
`agent::blocked`, summarize the blocker, and wait for operator resume
|
|
102
|
+
(`agent::executing` or equivalent); escalate per
|
|
103
|
+
`planning.riskHeuristics` in `.agentrc.json`.
|
|
175
104
|
|
|
176
105
|
### K. Precedence & Conflict Resolution
|
|
177
106
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
3. **Global rules** — `.agents/rules/*.md` (§ 1.F).
|
|
185
|
-
4. **Skills** — `.agents/skills/**/SKILL.md` (§ 1.B).
|
|
186
|
-
|
|
187
|
-
Two carve-outs refine the ordering:
|
|
188
|
-
|
|
189
|
-
- **More specific wins within a tier.** When two documents in the **same**
|
|
190
|
-
tier overlap, the narrower, more-specific statement governs the broader one
|
|
191
|
-
(e.g. a stack-specific skill refines a general core skill; a per-rule
|
|
192
|
-
statement refines a cross-rule one).
|
|
193
|
-
- **`rules/security-baseline.md` is inviolable.** No skill or local override
|
|
194
|
-
may relax a security MUST. A security constraint that conflicts with any
|
|
195
|
-
lower-tier guidance — or with a local override — always wins, regardless of
|
|
196
|
-
its tier position above.
|
|
107
|
+
Conflicts resolve by this total ordering (higher wins): **1.** local
|
|
108
|
+
overrides (§ 1.E) → **2.** this file → **3.** global rules (§ 1.F) →
|
|
109
|
+
**4.** skills (§ 1.B). Carve-outs: within a tier, the narrower statement
|
|
110
|
+
governs; and **`rules/security-baseline.md` is inviolable** — no skill or
|
|
111
|
+
local override may relax a security MUST, and a security constraint
|
|
112
|
+
always wins regardless of tier.
|
|
197
113
|
|
|
198
114
|
---
|
|
199
115
|
|
|
200
116
|
## 2. FinOps & Token Budgeting (Economic Guardrails)
|
|
201
117
|
|
|
202
|
-
Mandrel does
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
**fail closed** with a message naming what to trim. Constants and trim options:
|
|
118
|
+
Mandrel does not enforce live LLM spend; your host owns session quota.
|
|
119
|
+
Fixed framework ceilings (the `/plan` context envelope, plan-time Story
|
|
120
|
+
sizing) **fail closed** naming what to trim:
|
|
206
121
|
[`docs/execution-reference.md`](docs/execution-reference.md#finops--token-budgeting-economic-guardrails).
|
|
207
122
|
|
|
208
123
|
---
|
|
209
124
|
|
|
210
125
|
## 3. Core Philosophy
|
|
211
126
|
|
|
212
|
-
1. **Context First
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
mandatory set.
|
|
229
|
-
- **Story Context**: Additionally, read the current Story's body — the
|
|
230
|
-
inline `## Spec` plus its `acceptance[]` / `verify[]` entries — and
|
|
231
|
-
the task-specific instructions.
|
|
232
|
-
- **Optimization**: For large projects, prioritize targeted retrieval
|
|
233
|
-
(semantic code search or focused text search) to isolate specific
|
|
234
|
-
schemas or decisions before reading broad files.
|
|
235
|
-
2. **Plan First:** For non-trivial tasks (3+ steps or architectural
|
|
236
|
-
decisions), update the Story's `## Spec` via `/plan` before touching code.
|
|
237
|
-
3. **Artifacts over Chat:** Write log files for test/build/debug output rather
|
|
238
|
-
than pasting large blocks in chat.
|
|
239
|
-
4. **Idempotency:** Scripts and commands must be safe to run repeatedly.
|
|
240
|
-
5. **Security First:** Never hardcode secrets; use environment variables and
|
|
241
|
-
secret scanning.
|
|
127
|
+
1. **Context First.** **Digest-first reading (Story #4433):** never
|
|
128
|
+
ingest the whole `project.docsContextFiles` set up front — read the
|
|
129
|
+
docs digest and pull files on demand at the section it names. No
|
|
130
|
+
digest (ad hoc task, `docsContextFiles` unset, null `docsDigestPath`)
|
|
131
|
+
→ **no mandatory docs read**. A task touching UI copy, layout, or
|
|
132
|
+
routing also reads `docs/style-guide.md` / `docs/web-routes.md` when
|
|
133
|
+
present. Always read the current Story's body (`## Spec` +
|
|
134
|
+
`acceptance[]` / `verify[]`); prefer targeted retrieval over broad
|
|
135
|
+
reads.
|
|
136
|
+
2. **Plan First.** For non-trivial tasks (3+ steps or architectural
|
|
137
|
+
decisions), update the Story's `## Spec` via `/plan` before code.
|
|
138
|
+
3. **Artifacts over Chat.** Write test/build/debug output to log
|
|
139
|
+
files, not into chat.
|
|
140
|
+
4. **Idempotency.** Scripts must be safe to run repeatedly.
|
|
141
|
+
5. **Security First.** Never hardcode secrets; use environment variables
|
|
142
|
+
and secret scanning.
|
|
242
143
|
|
|
243
144
|
---
|
|
244
145
|
|
|
245
146
|
## 4. Execution & Quality Discipline
|
|
246
147
|
|
|
247
|
-
- **Re-Plan on Failure
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
- **Anti-Laziness:** NEVER use placeholder comments like
|
|
260
|
-
`// ... existing code ...`, `/* rest of file */`, or
|
|
261
|
-
`// implementation here`. You MUST output the ENTIRE file or the ENTIRE
|
|
262
|
-
complete function so it can be safely written to disk.
|
|
263
|
-
- **No Dead Code:** Remove unused imports, commented-out code, and dead
|
|
264
|
-
branches before finalizing a file.
|
|
265
|
-
- **Lint Compliance:** Adhere strictly to project linters and formatters;
|
|
266
|
-
language/stack-specific quality rules live in their `stack/` skills and
|
|
267
|
-
`.agents/rules/` files — apply them when the skill is activated.
|
|
268
|
-
- **Verification:** Include explicit verification steps in every plan.
|
|
148
|
+
- **Re-Plan on Failure.** If a strategy fails, STOP and re-plan.
|
|
149
|
+
- **Subagent Strategy.** Each spawn re-pays the full always-loaded
|
|
150
|
+
context — a cost decision. Prefer inline search for small lookups;
|
|
151
|
+
spawn only when the work justifies replicating context. One objective
|
|
152
|
+
per subagent; depth compounds the cost (every nested level re-pays).
|
|
153
|
+
- **Anti-Laziness / No Dead Code.** NEVER use placeholder comments like
|
|
154
|
+
`// ... existing code ...` — output the ENTIRE file or complete
|
|
155
|
+
function; remove unused imports, commented-out code, and dead branches
|
|
156
|
+
before finalizing.
|
|
157
|
+
- **Lint Compliance.** Adhere strictly to project linters and
|
|
158
|
+
formatters.
|
|
159
|
+
- **Verification.** Include explicit verification steps in every plan.
|
|
269
160
|
|
|
270
161
|
---
|
|
271
162
|
|
|
272
163
|
## 5. Git & Story Protocol (Strict Standards)
|
|
273
164
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
### A. Branch Naming
|
|
280
|
-
|
|
281
|
-
The canonical branch shape (`story-<storyId>` seeded and maintained by
|
|
282
|
-
`single-story-init.js`, PR to `main`) and the commit-subject contract are
|
|
283
|
-
owned by [`rules/git-conventions.md`](rules/git-conventions.md).
|
|
165
|
+
[`rules/git-conventions.md`](rules/git-conventions.md) is the canonical
|
|
166
|
+
reference: `story-<storyId>` branches seeded by `single-story-init.js`,
|
|
167
|
+
every Story reaching `main` via its own PR
|
|
168
|
+
(`helpers/deliver-story` / `single-story-close.js`).
|
|
284
169
|
|
|
285
170
|
### B. Status Tracking & Commit Standards
|
|
286
171
|
|
|
287
|
-
|
|
288
|
-
|
|
172
|
+
State mutations are GitHub labels (`agent::ready`, `agent::executing`,
|
|
173
|
+
`agent::done`) via
|
|
174
|
+
`node .agents/scripts/update-ticket-state.js --ticket [ID] --state [STATUS]`.
|
|
175
|
+
Do NOT manually update issue descriptions or status fields unless
|
|
289
176
|
prompted.
|
|
290
177
|
|
|
291
|
-
- **Sync Tool**:
|
|
292
|
-
`node .agents/scripts/update-ticket-state.js --ticket [ID] --state [STATUS]`
|
|
293
|
-
- **Status Labels**: `agent::ready`, `agent::executing`, `agent::done`.
|
|
294
|
-
|
|
295
|
-
### C. History Hygiene
|
|
296
|
-
|
|
297
|
-
Every Story reaches `main` via its own PR, opened by `helpers/deliver-story` /
|
|
298
|
-
`single-story-close.js`; the history model is owned by
|
|
299
|
-
[`rules/git-conventions.md`](rules/git-conventions.md).
|
|
300
|
-
|
|
301
178
|
### D. Ticket hierarchy (Story-only)
|
|
302
179
|
|
|
303
|
-
v2
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
`
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
- Each Story is executed by `helpers/deliver-story` (from
|
|
312
|
-
[`/deliver`](workflows/deliver.md)); the agent authors commit subjects
|
|
313
|
-
directly per [`rules/git-conventions.md`](rules/git-conventions.md),
|
|
314
|
-
referencing the Story via `(refs #<storyId>)`.
|
|
315
|
-
- There is no `type::epic` / `type::task` label or Epic issue form; an Epic is
|
|
316
|
-
at most an optional untyped human umbrella issue outside orchestration, and
|
|
317
|
-
`/deliver` refuses tickets carrying an `Epic: #N` footer.
|
|
180
|
+
The v2 ticket model is Story-only: `acceptance[]` / `verify[]` live
|
|
181
|
+
inline plus the folded Tech Spec in `## Spec` (over-budget Specs fail
|
|
182
|
+
closed — split or tighten; never write Specs under `docs/`). Optional
|
|
183
|
+
`depends_on` edges order rare multi-Story runs, resolved by `/deliver`
|
|
184
|
+
from live state; the `plan-run::<id>` label is filter metadata only.
|
|
185
|
+
Commit subjects reference the Story via `(refs #<storyId>)`. There is no
|
|
186
|
+
`type::epic` / `type::task` label; `/deliver` refuses tickets carrying an
|
|
187
|
+
`Epic: #N` footer.
|
|
318
188
|
|
|
319
189
|
---
|
|
320
190
|
|
|
321
191
|
## 6. Workspace & File Hygiene (Temporary Files)
|
|
322
192
|
|
|
323
|
-
All temporary files, scratch scripts, and intermediate outputs MUST
|
|
324
|
-
workspace-root `/temp/` directory
|
|
325
|
-
under it.
|
|
193
|
+
All temporary files, scratch scripts, and intermediate outputs MUST
|
|
194
|
+
live in the gitignored workspace-root `/temp/` directory — do NOT commit
|
|
195
|
+
anything under it.
|
|
326
196
|
|
|
327
197
|
---
|
|
328
198
|
|
|
329
199
|
## 7. Complexity-Aware Execution
|
|
330
200
|
|
|
331
|
-
`/plan` sizes each Story as a **capability slice a frontier model
|
|
332
|
-
self-verifies in one pass** — a broad footprint is normal
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
fragments
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
On a complexity warning or out-of-scope task: **plan first** (a numbered list of
|
|
340
|
-
cohesive sub-steps — one coherent change each, not one file each — in a
|
|
341
|
-
`<!-- DECOMPOSITION -->` block), **commit incrementally** after each sub-step,
|
|
342
|
-
and **fail fast** — STOP and report if any sub-step fails validation.
|
|
201
|
+
`/plan` sizes each Story as a **capability slice a frontier model
|
|
202
|
+
delivers and self-verifies in one pass** — a broad footprint is normal
|
|
203
|
+
when the change is cohesive (backstop: `DEFAULT_MODEL_CAPACITY` in
|
|
204
|
+
`ticket-validator-sizing.js`); do not re-slice it into per-module
|
|
205
|
+
fragments. On a `⚠️ COMPLEXITY WARNING` or out-of-scope task: **plan
|
|
206
|
+
first** (numbered cohesive sub-steps in a `<!-- DECOMPOSITION -->`
|
|
207
|
+
block), **commit incrementally** per sub-step, and **fail fast** — STOP
|
|
208
|
+
and report if any sub-step fails validation.
|