mandrel 2.7.0 → 2.9.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/README.md +104 -330
- package/.agents/agents/auditor.md +135 -0
- package/.agents/agents/plan-critic.md +80 -0
- package/.agents/audit-checklists/dependencies.md +7 -0
- package/.agents/audit-checklists/documentation.md +1 -0
- package/.agents/docs/SDLC.md +69 -162
- package/.agents/docs/configuration.md +159 -499
- package/.agents/docs/quality-gates.md +59 -180
- package/.agents/instructions.md +170 -295
- package/.agents/rules/changelog-style.md +8 -66
- package/.agents/rules/ci-remediation.md +65 -124
- package/.agents/rules/gherkin-standards.md +10 -31
- package/.agents/rules/git-conventions-reference.md +28 -61
- package/.agents/rules/git-conventions.md +1 -1
- package/.agents/rules/orchestration-error-handling.md +5 -15
- package/.agents/rules/security-baseline.md +7 -13
- package/.agents/rules/shell-conventions.md +4 -13
- package/.agents/rules/test-seams.md +2 -2
- package/.agents/rules/testing-standards.md +7 -17
- package/.agents/schemas/agentrc.schema.json +21 -0
- package/.agents/scripts/audit-to-stories.js +51 -0
- package/.agents/scripts/lib/audit-to-stories/dedupe-against-github.js +120 -55
- package/.agents/scripts/lib/config-settings-schema.js +32 -0
- package/.agents/scripts/lib/findings/semantic-issue-search.js +43 -5
- package/.agents/scripts/lib/observability/terse-result.js +114 -0
- package/.agents/scripts/lib/orchestration/complexity-gate.js +207 -0
- package/.agents/scripts/lib/orchestration/plan-context.js +3 -0
- package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +221 -8
- package/.agents/scripts/lib/orchestration/single-story-close/runner.js +55 -14
- package/.agents/scripts/lib/orchestration/story-close/emit-blocked.js +9 -3
- package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +4 -1
- package/.agents/scripts/lib/orchestration/task-body-validator.js +13 -40
- package/.agents/scripts/lib/story-body/body-format-lints.js +215 -0
- package/.agents/scripts/lib/story-body/story-body.js +18 -2
- package/.agents/scripts/lib/templates/decomposer-prompts.js +16 -0
- package/.agents/scripts/providers/github/issues.js +54 -7
- package/.agents/scripts/providers/github/search-budget.js +124 -0
- package/.agents/scripts/providers/github/search-query.js +71 -0
- package/.agents/scripts/single-story-confirm-merge.js +14 -5
- package/.agents/scripts/single-story-init.js +19 -3
- package/.agents/scripts/sync-branch-from-base.js +9 -3
- package/.agents/skills/core/api-and-interface-design/SKILL.md +23 -297
- package/.agents/skills/core/api-and-interface-design/reference.md +76 -0
- package/.agents/skills/core/browser-testing-with-devtools/SKILL.md +20 -327
- package/.agents/skills/core/browser-testing-with-devtools/reference.md +74 -0
- package/.agents/skills/core/code-review-and-quality/reference.md +16 -398
- package/.agents/skills/core/debugging-and-error-recovery/reference.md +14 -281
- package/.agents/skills/core/documentation-and-adrs/reference.md +42 -338
- package/.agents/skills/core/git-workflow-and-versioning/SKILL.md +28 -326
- package/.agents/skills/core/idea-refinement/SKILL.md +67 -193
- package/.agents/skills/core/security-and-hardening/SKILL.md +15 -31
- package/.agents/skills/core/security-and-hardening/reference.md +15 -273
- package/.agents/skills/skills.index.json +5 -5
- package/.agents/skills/stack/qa/gherkin-authoring/SKILL.md +16 -222
- package/.agents/skills/stack/qa/gherkin-authoring/reference.md +157 -0
- package/.agents/skills/stack/qa/playwright/SKILL.md +0 -29
- package/.agents/skills/stack/qa/qa-explore-driving/SKILL.md +19 -23
- package/.agents/skills/stack/qa/qa-harness/SKILL.md +35 -53
- package/.agents/skills/stack/qa/vitest/SKILL.md +0 -29
- package/.agents/workflows/audit-accessibility.md +34 -108
- package/.agents/workflows/audit-architecture.md +35 -123
- package/.agents/workflows/audit-clean-code.md +19 -78
- package/.agents/workflows/audit-data-model.md +32 -100
- package/.agents/workflows/audit-dependencies.md +47 -111
- package/.agents/workflows/audit-devops.md +16 -83
- package/.agents/workflows/audit-documentation.md +46 -93
- package/.agents/workflows/audit-navigability.md +26 -80
- package/.agents/workflows/audit-performance.md +40 -106
- package/.agents/workflows/audit-privacy.md +17 -80
- package/.agents/workflows/audit-quality.md +35 -99
- package/.agents/workflows/audit-security.md +20 -78
- package/.agents/workflows/audit-seo.md +20 -98
- package/.agents/workflows/audit-sre.md +20 -88
- package/.agents/workflows/audit-to-stories.md +1 -8
- package/.agents/workflows/audit-ux-ui.md +17 -80
- package/.agents/workflows/deliver.md +54 -9
- package/.agents/workflows/git-cleanup.md +50 -275
- package/.agents/workflows/helpers/audit-lens-core.md +230 -0
- package/.agents/workflows/helpers/code-review.md +11 -23
- package/.agents/workflows/helpers/deliver-story-reference.md +114 -17
- package/.agents/workflows/helpers/deliver-story.md +36 -186
- package/.agents/workflows/helpers/qa-core.md +174 -0
- package/.agents/workflows/helpers/qa-run-scenario-reference.md +35 -0
- package/.agents/workflows/helpers/qa-run-scenario.md +11 -25
- package/.agents/workflows/helpers/worktree-lifecycle.md +6 -67
- package/.agents/workflows/mandrel-update.md +7 -13
- package/.agents/workflows/plan.md +44 -17
- package/.agents/workflows/qa-assist.md +140 -269
- package/.agents/workflows/qa-explore.md +125 -316
- package/.agents/workflows/qa-run.md +180 -380
- package/docs/CHANGELOG.md +30 -0
- package/package.json +1 -1
- package/.agents/workflows/helpers/audit-dual-path.md +0 -59
- package/.agents/workflows/helpers/audit-self-check.md +0 -70
- package/.agents/workflows/helpers/audit-severity-scale.md +0 -19
package/.agents/instructions.md
CHANGED
|
@@ -1,73 +1,53 @@
|
|
|
1
1
|
# Agent Execution Protocol
|
|
2
2
|
|
|
3
|
-
You
|
|
4
|
-
constraints, and operational context
|
|
5
|
-
|
|
3
|
+
You operate under the Agent Execution Protocol — this central instruction set
|
|
4
|
+
governs your behavior, constraints, and operational context, and you MUST
|
|
5
|
+
strictly adhere to it.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## 1. System Guardrails & Initialization
|
|
10
10
|
|
|
11
|
-
### A. Role Framing
|
|
11
|
+
### A. Role Framing
|
|
12
12
|
|
|
13
|
-
v2 has **no** `.agents/personas/` packs and **no** `persona::*` GitHub labels.
|
|
14
13
|
Behavioral constraints come from this file, always-on / on-demand rules, and
|
|
15
|
-
skills
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
modeling) rather than looking for a persona file.
|
|
14
|
+
skills — there are no persona packs and no `persona::*` labels. Role-scoped
|
|
15
|
+
spawn contexts (when used) live under `.agents/agents/` via
|
|
16
|
+
`delivery.routing.roleScopedAgents`; QA auth identities (`qa.personas`) are a
|
|
17
|
+
separate fixture concept. If a user says "act as [role]", apply the matching
|
|
18
|
+
skill / workflow guidance (QA skills for verification, the security skill for
|
|
19
|
+
threat modeling) rather than looking for a persona file.
|
|
22
20
|
|
|
23
21
|
### B. Skill Activation
|
|
24
22
|
|
|
25
|
-
The skill library
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
into an on-demand `reference.md` sibling holding the long-form material
|
|
44
|
-
(patterns, worked examples, checklists). This is the same split the always-on
|
|
45
|
-
rules use (§ 1.F): read the capsule on activation, and open a `reference.md`
|
|
46
|
-
section only when the task actually engages it. Review the skill's `examples/`
|
|
47
|
-
directory or `examples.md` sibling **when present and relevant** to the task —
|
|
48
|
-
most skills do not ship one, so do not probe blindly. When uncertain which skill applies,
|
|
49
|
-
match the task against the one-line `description` in each skill's frontmatter
|
|
50
|
-
(catalogued in `.agents/skills/skills.index.json`). Skills compose: a complete
|
|
51
|
-
feature typically flows `idea-refinement` → the `/plan` workflow →
|
|
52
|
-
implementation test-first (`rules/testing-standards.md`) →
|
|
53
|
-
`code-review-and-quality` — not every task needs every skill. The always-on
|
|
54
|
-
operating posture (surface assumptions, manage confusion, push back on flawed
|
|
55
|
-
approaches, verify don't assume) is governed by § 3–4 and § 1.I of this file.
|
|
23
|
+
The skill library is **two-tier**: **`core/`** — universal, process-driven
|
|
24
|
+
skills (`core/debugging-and-error-recovery`, `core/code-review-and-quality`,
|
|
25
|
+
`core/security-and-hardening`); check for one first (the **test-first**
|
|
26
|
+
discipline lives in [`rules/testing-standards.md`](rules/testing-standards.md),
|
|
27
|
+
not a skill). **`stack/`** — tech-stack-specific skills (`stack/qa/playwright`,
|
|
28
|
+
`stack/qa/vitest`); apply when the project uses that technology, else use the
|
|
29
|
+
§ 1.C live-docs lookup.
|
|
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.
|
|
56
41
|
|
|
57
42
|
### C. Proactive Documentation
|
|
58
43
|
|
|
59
|
-
You MUST use the host's best
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
documentation **before** writing code. Do not ask for permission.
|
|
67
|
-
- **Fallback Order:** If no live-docs mechanism is available, fall back to (1)
|
|
68
|
-
in-repo docs and the package's bundled `README.md`/`CHANGELOG.md`, then
|
|
69
|
-
(2) the host's web fetch/search tool. Note in your work log which channel
|
|
70
|
-
you used so reviewers can spot stale references.
|
|
44
|
+
You MUST use the host's best live-documentation mechanism (a docs MCP server
|
|
45
|
+
such as Context7, an IDE-native lookup, or equivalent) proactively to prevent
|
|
46
|
+
hallucination: for any code involving third-party libraries, fetch the latest
|
|
47
|
+
official docs **before** writing code — do not ask permission. If none exists,
|
|
48
|
+
fall back to (1) in-repo docs and the package's bundled `README.md` /
|
|
49
|
+
`CHANGELOG.md`, then (2) the host's web fetch/search; note which channel you
|
|
50
|
+
used so reviewers can spot stale references.
|
|
71
51
|
|
|
72
52
|
### D. Error Handling & Degradation
|
|
73
53
|
|
|
@@ -87,136 +67,97 @@ directly — there is no separate state-mutation MCP server to degrade from.
|
|
|
87
67
|
|
|
88
68
|
### E. Local Overrides
|
|
89
69
|
|
|
90
|
-
If a `.agents/instructions.local.md`
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
`.agents/local
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
`npm install`, `mandrel sync`, and `mandrel update` with no manual
|
|
102
|
-
re-sync. Core payload commands of the same basename always win (the
|
|
103
|
-
local copy is ignored with a `shadowed` warning).
|
|
70
|
+
If a `.agents/instructions.local.md` or `.agentrc.local.json` is present, you
|
|
71
|
+
MUST load it — the config resolver deep-merges `.agentrc.local.json` over
|
|
72
|
+
`.agentrc.json` (local wins; absent is a no-op). Do not modify these files
|
|
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).
|
|
104
81
|
|
|
105
82
|
### F. Modular Global Rules
|
|
106
83
|
|
|
107
|
-
|
|
108
|
-
**on-demand set**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
- [`rules/ci-remediation.md`](rules/ci-remediation.md) — before remediating
|
|
136
|
-
a red (or repeatedly slow) CI check during delivery (the root-cause-only
|
|
137
|
-
triage decision tree, the never-rerun / never-quarantine prohibitions,
|
|
138
|
-
and the escalation criteria).
|
|
139
|
-
- [`rules/api-conventions.md`](rules/api-conventions.md),
|
|
140
|
-
[`rules/gherkin-standards.md`](rules/gherkin-standards.md),
|
|
141
|
-
[`rules/changelog-style.md`](rules/changelog-style.md),
|
|
142
|
-
[`rules/test-seams.md`](rules/test-seams.md) — when the task is in that
|
|
143
|
-
domain (API surface, Gherkin scenarios, changelog prose, test seams).
|
|
144
|
-
|
|
145
|
-
When in doubt, read the rule — the read is cheap relative to shipping a
|
|
146
|
-
MUST-violating change. Precedence between a rule and any other governance
|
|
147
|
-
document is unchanged (§ 1.K): loading a rule on demand does not lower its
|
|
148
|
-
authority.
|
|
84
|
+
`.agents/rules/` splits into an **always-on core** (loaded with this file) and
|
|
85
|
+
an **on-demand set** (read only when the task engages it, so a generic task —
|
|
86
|
+
and every subagent it spawns — does not re-pay their bytes), the same
|
|
87
|
+
read-when-relevant pattern skills use (§ 1.B).
|
|
88
|
+
|
|
89
|
+
- **Always-on core**: [`security-baseline.md`](rules/security-baseline.md)
|
|
90
|
+
(inviolable security MUSTs) and
|
|
91
|
+
[`git-conventions.md`](rules/git-conventions.md) (branch shapes,
|
|
92
|
+
commit-subject format, `refs #`, push/hygiene MUSTs).
|
|
93
|
+
- **On-demand** — read **before** the matching work; each opens with a one-line
|
|
94
|
+
"this rule applies when…" scope header:
|
|
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).
|
|
149
112
|
|
|
150
113
|
### G. Structured Configuration
|
|
151
114
|
|
|
152
|
-
Refer to `.agentrc.json`
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
otherwise the **Tech Stack** section of `docs/architecture.md` (a numbered or
|
|
158
|
-
decorated heading such as `## 1. Tech Stack` is fine). Project-specific
|
|
159
|
-
technology context is intentionally kept out of `.agentrc.json`.
|
|
115
|
+
Refer to `.agentrc.json` for operational limits (auto-run permissions, etc.).
|
|
116
|
+
Project technology choices (database, ORM, API framework, auth, validation,
|
|
117
|
+
paths) are intentionally kept out of it — read the Tech Stack inventory:
|
|
118
|
+
`docs/tech-stack.md` when present, otherwise the **Tech Stack** section of
|
|
119
|
+
`docs/architecture.md`.
|
|
160
120
|
|
|
161
121
|
### H. Observability & Friction Telemetry
|
|
162
122
|
|
|
163
123
|
You MUST log telemetry about operational difficulty or automation
|
|
164
|
-
opportunities
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
capture time; the retro phase surfaces the aggregate as routed proposals.
|
|
124
|
+
opportunities. Friction is a **local NDJSON signal**: `diagnose-friction.js`
|
|
125
|
+
appends a `kind: friction` record to the per-run/per-Story `signals.ndjson`
|
|
126
|
+
stream (not posted to the ticket; the retro phase surfaces the aggregate).
|
|
168
127
|
|
|
169
128
|
- **Command**:
|
|
170
129
|
`node .agents/scripts/diagnose-friction.js --story [STORY_ID] --cmd [FAILED_COMMAND]`
|
|
171
130
|
- **When to fire**: after repeated tool-validation errors, an unrecoverable
|
|
172
|
-
command failure, ambiguity needing self-correction, or repetitive
|
|
173
|
-
|
|
131
|
+
command failure, ambiguity needing self-correction, or repetitive boilerplate
|
|
132
|
+
a workflow/skill could simplify.
|
|
174
133
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
[`docs/execution-reference.md`
|
|
178
|
-
|
|
179
|
-
#### Log Level Control
|
|
180
|
-
|
|
181
|
-
The orchestrator logger honors `AGENT_LOG_LEVEL` (`silent` / `info` /
|
|
182
|
-
`verbose`). The per-level emission table is reference detail — see
|
|
183
|
-
[`docs/execution-reference.md` § Log-level control](docs/execution-reference.md#log-level-control).
|
|
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).
|
|
184
137
|
|
|
185
138
|
### I. Anti-Thrashing Protocol
|
|
186
139
|
|
|
187
140
|
You MUST proactively identify when you are "thrashing" or stuck in an
|
|
188
141
|
infinite loop, and you MUST stop, summarize the blockers, and present a
|
|
189
142
|
**Re-Plan** (or yield to the user) before consuming more tokens on a failing
|
|
190
|
-
strategy.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
- **
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
When you stop, write a one-paragraph summary of what you tried, what
|
|
206
|
-
recurred, and what assumption you would test next, then either Re-Plan or
|
|
207
|
-
hand back to the operator. Do not paper over the loop with another
|
|
208
|
-
just-in-case retry.
|
|
209
|
-
|
|
210
|
-
While executing as a Story delivery sub-agent (via `helpers/deliver-story`),
|
|
211
|
-
if you genuinely cannot proceed you MUST transition to `agent::blocked` and
|
|
212
|
-
exit non-zero — **never fall silent**. A stalled child that reports nothing
|
|
213
|
-
is indistinguishable from a dead one, and the parent `/deliver` run can only
|
|
214
|
-
escalate what you surface.
|
|
143
|
+
strategy. The cues are qualitative — there are no numeric thresholds; the call
|
|
144
|
+
is yours to make.
|
|
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.
|
|
215
157
|
|
|
216
158
|
### J. HITL Blocker Escalation (Safe Execution)
|
|
217
159
|
|
|
218
|
-
Before
|
|
219
|
-
for high-risk operations.
|
|
160
|
+
Before any task, you MUST check the ticket labels for high-risk operations.
|
|
220
161
|
|
|
221
162
|
- **`risk::high` is metadata**: treat it as planning/audit signal only. It
|
|
222
163
|
does **not** create an automatic runtime pause.
|
|
@@ -258,16 +199,11 @@ Two carve-outs refine the ordering:
|
|
|
258
199
|
|
|
259
200
|
## 2. FinOps & Token Budgeting (Economic Guardrails)
|
|
260
201
|
|
|
261
|
-
Mandrel does **not** enforce live LLM spend
|
|
262
|
-
|
|
263
|
-
ceilings — the `/plan` context envelope and plan-time Story sizing —
|
|
264
|
-
**fail closed** with a message naming what to trim
|
|
265
|
-
|
|
266
|
-
hard stops. The constants, the ≈4-char/token estimate, and the trim options are
|
|
267
|
-
reference detail — see
|
|
268
|
-
[`docs/execution-reference.md` § FinOps & token budgeting](docs/execution-reference.md#finops--token-budgeting-economic-guardrails).
|
|
269
|
-
Consult it when `/plan` refused an over-ceiling envelope or an over-budget
|
|
270
|
-
Story count.
|
|
202
|
+
Mandrel does **not** enforce live LLM spend and has no operator-tunable context
|
|
203
|
+
budget; your host runtime owns session quota. It does bound fixed framework
|
|
204
|
+
ceilings — the `/plan` context envelope and plan-time Story sizing — which
|
|
205
|
+
**fail closed** with a message naming what to trim. Constants and trim options:
|
|
206
|
+
[`docs/execution-reference.md`](docs/execution-reference.md#finops--token-budgeting-economic-guardrails).
|
|
271
207
|
|
|
272
208
|
---
|
|
273
209
|
|
|
@@ -275,37 +211,16 @@ Story count.
|
|
|
275
211
|
|
|
276
212
|
1. **Context First:** Before proposing any solution, understand the
|
|
277
213
|
repository's tech stack, historical context, and structure.
|
|
278
|
-
- **Digest-first Reading (Story #4433)**
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
discipline above is identical for all of them:
|
|
289
|
-
- `/plan` and interactive tasks — a file at `temp/run-<id>/docs-digest.md`
|
|
290
|
-
(`plan-context.js`, via the shared generator in
|
|
291
|
-
`.agents/scripts/lib/orchestration/docs-digest.js`).
|
|
292
|
-
- `/deliver` Story sub-agents (`helpers/deliver-story`) — the
|
|
293
|
-
`docsDigestPath` the caller threads.
|
|
294
|
-
- Standalone-Story planning (`story-plan.js --emit-context`) — inline as
|
|
295
|
-
`corpusContext.docsDigest` (no per-run directory to anchor a
|
|
296
|
-
file), alongside `corpusContext.relevantSections`.
|
|
297
|
-
|
|
298
|
-
When no digest exists for the task at hand — an ad hoc task outside
|
|
299
|
-
`/deliver`, `project.docsContextFiles` unset, or a null `docsDigestPath` —
|
|
300
|
-
there is **no mandatory docs read**: read a full doc only when the task's
|
|
301
|
-
own context points you at one.
|
|
302
|
-
|
|
303
|
-
The decisions log (`decisions.md`) may be either a single-file
|
|
304
|
-
dated-entry log or an **index** into a `decisions/` ADR directory — both
|
|
305
|
-
are first-class layouts (see
|
|
306
|
-
[`skills/core/documentation-and-adrs`](skills/core/documentation-and-adrs/SKILL.md)).
|
|
307
|
-
Treat an index like any other digested doc: link-follow the per-ADR
|
|
308
|
-
bodies on demand rather than auto-loading them.
|
|
214
|
+
- **Digest-first Reading (Story #4433).** **Never ingest the whole
|
|
215
|
+
`project.docsContextFiles` set up front.** Read the **docs digest** — a
|
|
216
|
+
compact outline (path, byte size, heading outline with line numbers, and
|
|
217
|
+
the first paragraph under each `##`) — decide which docs bear on the task,
|
|
218
|
+
then **pull the full file on demand**, jumping to the section at the line
|
|
219
|
+
number the digest names. This is a hard cutover: no read-every-file branch
|
|
220
|
+
survives. When no digest exists for the task — an ad hoc task,
|
|
221
|
+
`project.docsContextFiles` unset, or a null `docsDigestPath` — there is
|
|
222
|
+
**no mandatory docs read**: read a full doc only when the task's own
|
|
223
|
+
context points you at one.
|
|
309
224
|
- **Conditional Reads**: When the task touches UI copy, layout, or
|
|
310
225
|
routing and the corresponding file is present in the project, also
|
|
311
226
|
read `docs/style-guide.md` and `docs/web-routes.md`. Skip both when
|
|
@@ -318,17 +233,12 @@ Story count.
|
|
|
318
233
|
(semantic code search or focused text search) to isolate specific
|
|
319
234
|
schemas or decisions before reading broad files.
|
|
320
235
|
2. **Plan First:** For non-trivial tasks (3+ steps or architectural
|
|
321
|
-
decisions),
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
chat.
|
|
328
|
-
4. **Idempotency:** Ensure scripts and commands can be run multiple times
|
|
329
|
-
without breaking the environment.
|
|
330
|
-
5. **Security First:** Never hardcode secrets. Use environment variables
|
|
331
|
-
and validate with secret scanning tools.
|
|
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.
|
|
332
242
|
|
|
333
243
|
---
|
|
334
244
|
|
|
@@ -336,36 +246,25 @@ Story count.
|
|
|
336
246
|
|
|
337
247
|
- **Re-Plan on Failure:** If a strategy fails, **STOP** and re-plan
|
|
338
248
|
immediately. Do not repeat a broken approach.
|
|
339
|
-
- **Subagent Strategy:**
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
**implementation and design** work on the default capability; name no
|
|
350
|
-
specific model — let the host and operator own the concrete mapping.
|
|
351
|
-
**Depth compounds the cost.** Sub-agents now carry the `Agent` tool and
|
|
352
|
-
can nest further (verified depth 2, announced max depth 5; see
|
|
353
|
-
[#2870](https://github.com/dsj1984/mandrel/issues/2870)), so this
|
|
354
|
-
spend-per-spawn caution is not one-level — **every** nesting level
|
|
355
|
-
re-pays the full always-loaded context. Weigh the whole subtree's cost,
|
|
356
|
-
not just the immediate spawn, before opening a deeper orchestration
|
|
357
|
-
level, and stay within the supported depth envelope.
|
|
249
|
+
- **Subagent Strategy:** Each spawn re-pays the full always-loaded context, so
|
|
250
|
+
treat it as a cost decision. Prefer an **inline search** (grep, a targeted
|
|
251
|
+
read) for small or localized lookups; reach for a subagent **only when the
|
|
252
|
+
work justifies replicating context** — a broad multi-file investigation, a
|
|
253
|
+
parallel exploration front, or an isolated task that would crowd the main
|
|
254
|
+
window. One objective per subagent; prefer a cheaper/faster host capability
|
|
255
|
+
for mechanical or read-only spawns and keep implementation/design on the
|
|
256
|
+
default. **Depth compounds the cost** — sub-agents carry the `Agent` tool and
|
|
257
|
+
nest further, and **every** level re-pays the context, so weigh the whole
|
|
258
|
+
subtree's cost and stay within the supported depth envelope.
|
|
358
259
|
- **Anti-Laziness:** NEVER use placeholder comments like
|
|
359
260
|
`// ... existing code ...`, `/* rest of file */`, or
|
|
360
261
|
`// implementation here`. You MUST output the ENTIRE file or the ENTIRE
|
|
361
262
|
complete function so it can be safely written to disk.
|
|
362
263
|
- **No Dead Code:** Remove unused imports, commented-out code, and dead
|
|
363
264
|
branches before finalizing a file.
|
|
364
|
-
- **Lint Compliance:** Adhere strictly to project linters and formatters
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
`stack/` skills and `.agents/rules/` files — apply them when the relevant
|
|
368
|
-
skill is activated.
|
|
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.
|
|
369
268
|
- **Verification:** Include explicit verification steps in every plan.
|
|
370
269
|
|
|
371
270
|
---
|
|
@@ -377,18 +276,11 @@ strict conventions for all Story-related Git operations. See
|
|
|
377
276
|
[`.agents/rules/git-conventions.md`](rules/git-conventions.md) for the full
|
|
378
277
|
canonical reference.
|
|
379
278
|
|
|
380
|
-
### A. Branch Naming
|
|
381
|
-
|
|
382
|
-
v2 delivery uses one branch shape. The runtime creates and maintains it
|
|
383
|
-
via `single-story-init.js`; agents commit on that branch only.
|
|
384
|
-
|
|
385
|
-
| Purpose | Format | Owner | Notes |
|
|
386
|
-
| --------------- | ----------------- | ----------------------- | --------------------------------------------------------------------- |
|
|
387
|
-
| Story execution | `story-<storyId>` | `single-story-init.js` | Per-Story worktree at `.worktrees/story-<storyId>/`. PR target is `main` (squash + required checks). There is no `epic/<id>` integration branch and no `--no-ff` wave merge. |
|
|
279
|
+
### A. Branch Naming
|
|
388
280
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
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).
|
|
392
284
|
|
|
393
285
|
### B. Status Tracking & Commit Standards
|
|
394
286
|
|
|
@@ -402,66 +294,49 @@ prompted.
|
|
|
402
294
|
|
|
403
295
|
### C. History Hygiene
|
|
404
296
|
|
|
405
|
-
Every Story reaches `main` via its own PR
|
|
406
|
-
|
|
407
|
-
|
|
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).
|
|
408
300
|
|
|
409
301
|
### D. Ticket hierarchy (Story-only)
|
|
410
302
|
|
|
411
|
-
v2 collapses the ticket model to **Story
|
|
412
|
-
|
|
413
|
-
`
|
|
414
|
-
|
|
415
|
-
`
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
- Branch model matches Section 5.A (`story-<id>` → PR → `main`).
|
|
427
|
-
- There is no `type::epic` / `type::task` label and no Epic issue form. An
|
|
428
|
-
Epic is at most an optional untyped human umbrella issue outside
|
|
429
|
-
orchestration; `/deliver` refuses tickets that still carry an
|
|
430
|
-
`Epic: #N` footer.
|
|
303
|
+
v2 collapses the ticket model to **Story**: acceptance criteria and verify
|
|
304
|
+
steps live inline (`acceptance[]` / `verify[]`) and the folded Tech Spec in
|
|
305
|
+
`## Spec` (over-budget Specs fail closed — split or tighten; never write under
|
|
306
|
+
`docs/`). Optional `depends_on` edges order rare multi-Story runs, resolved by
|
|
307
|
+
`/deliver` from live state across plan runs and over time.
|
|
308
|
+
|
|
309
|
+
- `/plan` emits one or more `type::story` issues (default N=1); there is no
|
|
310
|
+
batch label — `/deliver` takes ids and discovers the graph.
|
|
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.
|
|
431
318
|
|
|
432
319
|
---
|
|
433
320
|
|
|
434
321
|
## 6. Workspace & File Hygiene (Temporary Files)
|
|
435
322
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
intermediate outputs MUST be stored in the `/temp/` directory located at
|
|
440
|
-
the workspace root.
|
|
441
|
-
- **Git Exclusion**: The `/temp/` directory is excluded from Git by default.
|
|
442
|
-
Do NOT commit any files stored within it.
|
|
323
|
+
All temporary files, scratch scripts, and intermediate outputs MUST live in the
|
|
324
|
+
workspace-root `/temp/` directory, which is gitignored — do NOT commit anything
|
|
325
|
+
under it.
|
|
443
326
|
|
|
444
327
|
---
|
|
445
328
|
|
|
446
329
|
## 7. Complexity-Aware Execution
|
|
447
330
|
|
|
448
|
-
`/plan` sizes each Story as a **capability slice a frontier model delivers
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
constant — not operator-tunable). Do not re-slice a capability-sized
|
|
454
|
-
Story into per-module fragments just because it touches many files.
|
|
331
|
+
`/plan` sizes each Story as a **capability slice a frontier model delivers and
|
|
332
|
+
self-verifies in one pass** — a broad footprint is normal when the change is
|
|
333
|
+
cohesive (the backstop is `DEFAULT_MODEL_CAPACITY` in `ticket-validator-sizing.js`,
|
|
334
|
+
a framework constant). Do not re-slice a capability-sized Story into per-module
|
|
335
|
+
fragments just because it touches many files.
|
|
455
336
|
|
|
456
337
|
### A. When You See `⚠️ COMPLEXITY WARNING`
|
|
457
338
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
coherent change with one reason to exist per sub-step, not one file per
|
|
463
|
-
sub-step.
|
|
464
|
-
2. **Commit incrementally.** Stage, commit, and push after each logical
|
|
465
|
-
sub-step completes successfully.
|
|
466
|
-
3. **Fail fast.** If any sub-step fails validation, STOP and report the
|
|
467
|
-
failure.
|
|
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.
|