agent_primitives 0.1.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE +21 -0
- data/README.md +284 -0
- data/exe/agent_primitives +8 -0
- data/lib/agent_primitives/cli.rb +424 -0
- data/lib/agent_primitives/evals/capability.rb +222 -0
- data/lib/agent_primitives/evals/finding.rb +41 -0
- data/lib/agent_primitives/evals/proofs.rb +139 -0
- data/lib/agent_primitives/evals/tags.rb +160 -0
- data/lib/agent_primitives/evals.rb +152 -0
- data/lib/agent_primitives/guard/baseline.rb +71 -0
- data/lib/agent_primitives/guard.rb +392 -0
- data/lib/agent_primitives/importer.rb +50 -0
- data/lib/agent_primitives/proof_report.rb +220 -0
- data/lib/agent_primitives/version.rb +5 -0
- data/lib/agent_primitives.rb +26 -0
- data/skills/backfilling-primitives/SKILL.md +253 -0
- data/skills/bootstrapping-primitives/SKILL.md +208 -0
- data/skills/closing-out-primitives/SKILL.md +206 -0
- data/skills/integrating-primitives/SKILL.md +184 -0
- data/skills/maintaining-primitives/SKILL.md +169 -0
- data/skills/maintaining-primitives/references/templates.md +169 -0
- data/skills/planning-with-primitives/SKILL.md +261 -0
- data/skills/primitives-format/SKILL.md +354 -0
- data/skills/reviewing-primitives/SKILL.md +211 -0
- data/skills/running-primitives-checks/SKILL.md +175 -0
- data/skills/tagging-intent/SKILL.md +118 -0
- metadata +74 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: primitives-format
|
|
3
|
+
description: >-
|
|
4
|
+
The format of the primitives tree under docs/primitives/ — layout, reading
|
|
5
|
+
contract, ownership and write points, capability doc frontmatter, intent
|
|
6
|
+
clauses and their lifecycle, evaluations, append-only provenance, size limits.
|
|
7
|
+
Use before reading or editing any file under docs/primitives/, and whenever
|
|
8
|
+
another skill cites a section of the format.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Primitives (docs layout)
|
|
12
|
+
|
|
13
|
+
**Announce:** "I'm using the primitives-format skill."
|
|
14
|
+
|
|
15
|
+
These rules apply to the **default** primitives tree: **`docs/primitives/`**
|
|
16
|
+
beside a Rails app. Write points: `planning-with-primitives`,
|
|
17
|
+
`closing-out-primitives`, `backfilling-primitives`; everything else:
|
|
18
|
+
`maintaining-primitives`.
|
|
19
|
+
One-time setup: **`bootstrapping-primitives`**.
|
|
20
|
+
|
|
21
|
+
The tree holds the four primitives that outlive generated code:
|
|
22
|
+
|
|
23
|
+
| Primitive | Where it lives |
|
|
24
|
+
|-----------|----------------|
|
|
25
|
+
| **Intent** — what the system must do and why | `intent:` clauses in each capability doc's YAML frontmatter |
|
|
26
|
+
| **Compilation** — architecture generated code compiles into | Generic Rails shape: the app's own conventions. App-specific: `compilation.md` |
|
|
27
|
+
| **Evaluations** — executable proof behaviour survived change | `evaluations:` on each clause, naming the RSpec files that prove it |
|
|
28
|
+
| **Provenance** — lineage of decisions and rejected alternatives | `## Provenance` section, append-only |
|
|
29
|
+
|
|
30
|
+
Intent and evaluations live in **frontmatter, not prose**, because a machine
|
|
31
|
+
must read them: **`agent_primitives evals`** checks that every active clause
|
|
32
|
+
on a `built` doc is proven and every proof points at a live clause. Shape and
|
|
33
|
+
provenance stay prose — they are for humans.
|
|
34
|
+
|
|
35
|
+
## Layout
|
|
36
|
+
|
|
37
|
+
Fixed — no other file types.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
docs/primitives/
|
|
41
|
+
SCHEMA.md # Co-owned contract (agent + human)
|
|
42
|
+
index.md # One line per capability + status — the only entry point
|
|
43
|
+
compilation.md # App-wide constraints. Human-owned.
|
|
44
|
+
capabilities/ # One file per capability: intent + evaluations in frontmatter,
|
|
45
|
+
# then ## Shape and ## Provenance
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**No topic pages, synthesis pages, or hubs.** Content that does not answer
|
|
49
|
+
"what must this do / what constrains it / where is it proven / why is it this
|
|
50
|
+
way" has no home here.
|
|
51
|
+
|
|
52
|
+
## Reading contract
|
|
53
|
+
|
|
54
|
+
No agent loads more than **three files**: `index.md` + the **one** target
|
|
55
|
+
capability doc + `compilation.md`. Cross-links between capability docs are for
|
|
56
|
+
humans; no workflow requires following one. Do not read other capability docs
|
|
57
|
+
unless the work explicitly spans a second named capability. Sole exception:
|
|
58
|
+
the maintainer's **`lint`** operation reads the whole tree by design.
|
|
59
|
+
|
|
60
|
+
### Finding the right capability
|
|
61
|
+
|
|
62
|
+
Three routes, cheapest first:
|
|
63
|
+
|
|
64
|
+
1. **From a spec** — the tagged example names it: `intent: "comment_threads#I2"`.
|
|
65
|
+
2. **From code, by grep** — `ls capabilities/ | grep comment`. Filenames carry
|
|
66
|
+
the app's resource names and domain prefixes (§ Style).
|
|
67
|
+
3. **From `index.md`** — the entry point, and the only route when the
|
|
68
|
+
capability owns no single resource.
|
|
69
|
+
|
|
70
|
+
Route 3 is also how you judge *"does this work span a second capability?"* —
|
|
71
|
+
so each `index.md` line must distinguish its capability from its neighbours;
|
|
72
|
+
a vague line is what produces a duplicate doc.
|
|
73
|
+
|
|
74
|
+
## Ownership and write points
|
|
75
|
+
|
|
76
|
+
- **`compilation.md`** — **Human-owned.** Every agent that reads the tree
|
|
77
|
+
reads it (the implementing agent deliberately reads nothing here — constraints
|
|
78
|
+
reach it via excerpts pasted into its dispatch prompt), agents propose
|
|
79
|
+
amendments as review findings, and **never edit it directly** (exception:
|
|
80
|
+
the drafting step of `bootstrapping-primitives`, which ends with human edit).
|
|
81
|
+
- **`intent:` clauses** — Human-co-owned: clauses transcribe the user's answers
|
|
82
|
+
to requirements-gate or brainstorm questions. Written or amended only by the
|
|
83
|
+
planning workflows (the requirements spec seeds,
|
|
84
|
+
`planning-with-primitives` confirms/amends), a `backfilling-primitives` pass
|
|
85
|
+
(after the human confirms a read-back), or the execution revision loop when
|
|
86
|
+
the **user's** revision changes intent (`closing-out-primitives` § When finished work is revised).
|
|
87
|
+
Never silently rewritten by an implementing agent — every amendment traces to an
|
|
88
|
+
explicit user decision, which **`agent_primitives guard`** reports as
|
|
89
|
+
`intent/rewritten` when one does not
|
|
90
|
+
(`running-primitives-checks` § What a change did to the record).
|
|
91
|
+
- **`## Shape`** / **`evaluations:`** / `status:` — Agent-maintained at the
|
|
92
|
+
defined write points: brainstorm (seeds the doc: `status: shaping`, rough
|
|
93
|
+
Shape), planner (Shape; `status: planned` at final approval, or `built` →
|
|
94
|
+
`amending` plus `plan:` when the plan adds or supersedes a clause on a
|
|
95
|
+
`built` doc), `backfilling-primitives` (`status: built`, the index line,
|
|
96
|
+
`evaluations:` from already-existing tagged specs), execution (close-out:
|
|
97
|
+
`evaluations:`, `status: built` from `planned` or `amending`, removing
|
|
98
|
+
`plan:`; revision loop: `evaluations:` sync when a fix moves or adds spec homes), maintainer agent
|
|
99
|
+
(update — including human-directed deprecation — lint, structural
|
|
100
|
+
changes).
|
|
101
|
+
- **`## Provenance`** — **Append-only.** Never edit or delete an entry; a wrong
|
|
102
|
+
entry gets a correcting entry. `agent_primitives guard` reports an edited
|
|
103
|
+
entry as `provenance/rewritten`: provenance is the trace every other notice is
|
|
104
|
+
discharged against, so it is the one part of the tree whose loss costs you the
|
|
105
|
+
ability to audit the next change.
|
|
106
|
+
- **`index.md`** — Stays in sync: update in the same change that adds or
|
|
107
|
+
renames a doc. Each line reads
|
|
108
|
+
**`<name> — <status> — <outcome>. Owns: <models or resources>.`**
|
|
109
|
+
The outcome must **discriminate** — a reader deciding between two
|
|
110
|
+
capabilities can tell them apart without opening either — and `Owns:` is the
|
|
111
|
+
grep bridge when the filename is not a resource name (§ Style).
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
- `comment_threads` — built — readers reply to comments and see them nested. Owns: Comment.
|
|
115
|
+
- `billing_plan_changes` — built — owners switch plan mid-cycle with proration. Owns: Subscription, Invoice.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Capability doc format
|
|
119
|
+
|
|
120
|
+
Frontmatter carrying intent and evaluations, then two fixed H2 sections in this
|
|
121
|
+
order — fixed order is what makes docs traversable without search:
|
|
122
|
+
|
|
123
|
+
```markdown
|
|
124
|
+
---
|
|
125
|
+
status: shaping | planned | built | amending | deprecated
|
|
126
|
+
plan: docs/plans/YYYY-MM-DD-<feature>.md # only while amending
|
|
127
|
+
intent:
|
|
128
|
+
- id: I1
|
|
129
|
+
clause: A reader can reply to any comment.
|
|
130
|
+
evaluations:
|
|
131
|
+
- spec/system/comment_threads_spec.rb
|
|
132
|
+
- id: I4
|
|
133
|
+
clause: Threads never nest deeper than 3 levels.
|
|
134
|
+
superseded_by: [ I5, I6 ]
|
|
135
|
+
superseded_on: 2026-09-18
|
|
136
|
+
---
|
|
137
|
+
# Capability name
|
|
138
|
+
|
|
139
|
+
## Shape
|
|
140
|
+
## Provenance
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
There is **no `## Intent` or `## Evaluations` section** — the clause and the
|
|
144
|
+
specs that prove it are one record in frontmatter, so they cannot fall out of
|
|
145
|
+
step. There is **no `specs:` key** either; `agent_primitives evals` derives
|
|
146
|
+
the reverse index from every clause's `evaluations`.
|
|
147
|
+
|
|
148
|
+
The key is **`superseded_on:`**, not `on:` — YAML resolves a bare `on` to the
|
|
149
|
+
boolean `true`, so an `on:` key silently loses its date.
|
|
150
|
+
|
|
151
|
+
Skeletons: `references/templates.md` in the `maintaining-primitives` skill.
|
|
152
|
+
|
|
153
|
+
### Intent clauses
|
|
154
|
+
|
|
155
|
+
- **`id:`** — stable (`I1`, `I2`, …), assigned once, **never renumbered or
|
|
156
|
+
reused**; provenance entries and old plans reference them.
|
|
157
|
+
- **`clause:`** — **one sentence, in outcome terms.** Write the quantifier you
|
|
158
|
+
mean — *any*, *every*, *never*, *only* — because it is what the evaluations
|
|
159
|
+
must cover (`tagging-intent` § What counts as proving
|
|
160
|
+
a clause).
|
|
161
|
+
|
|
162
|
+
#### What is and is not a clause
|
|
163
|
+
|
|
164
|
+
A clause is acceptable only when **all four** hold:
|
|
165
|
+
|
|
166
|
+
1. **Observable** — names an outcome a user or caller can see, not an internal
|
|
167
|
+
arrangement.
|
|
168
|
+
2. **Falsifiable** — a spec can go red when it stops being true. "Replies appear
|
|
169
|
+
nested under their parent" can fail; "threading feels natural" cannot.
|
|
170
|
+
3. **One behaviour** — one action, one outcome. No umbrella verb (*manage*,
|
|
171
|
+
*handle*, *support*, *administer*), no `and` joining two actions.
|
|
172
|
+
4. **Durable** — still worth stating after the implementation is rewritten in a
|
|
173
|
+
different shape.
|
|
174
|
+
|
|
175
|
+
Run the fourth first: intent is the primitive that **outlives generated code**,
|
|
176
|
+
so anything a rewrite would invalidate was never intent — that one question
|
|
177
|
+
disposes of architecture, technology choices, and task lists.
|
|
178
|
+
|
|
179
|
+
None of the following is a clause:
|
|
180
|
+
|
|
181
|
+
| Not a clause | Why | Where it belongs |
|
|
182
|
+
|---|---|---|
|
|
183
|
+
| "Comments use a `parent_id` self-join" | How the code is arranged; a rewrite invalidates it | `## Shape` |
|
|
184
|
+
| "Use Turbo Streams for replies" | A constraint on implementation, not a promise | `## Shape`, or `compilation.md` if app-wide |
|
|
185
|
+
| "Notifications move into a concern" | Nothing observable changes, so nothing could go red | `## Shape` if it leaves a constraint worth respecting; otherwise **nothing** — a refactor is git's business |
|
|
186
|
+
| "Overdue invoices are shown in red", "the form uses the card layout" | Styling, not behaviour — a restyle invalidates it, and its only proof is a class assertion (the app's testing conventions) | Nothing — the markup is the record; restate as behaviour if one hides inside ("overdue invoices are listed first") |
|
|
187
|
+
| "Threading feels natural", "the page is fast" | Not falsifiable — no spec can fail | Drop it, or restate as a measurable outcome |
|
|
188
|
+
| "Add a comments controller" | A work item, ephemeral by design | The plan's task list |
|
|
189
|
+
| "A member can manage their comments" | Several promises in one sentence; no example proves the whole | Split per action (below) |
|
|
190
|
+
| "Blank titles are rejected" | Rails' promise, not the app's | Nothing |
|
|
191
|
+
| "Renders the reply form" | The suite transcribed into the tree; a clause is a promise, not an example | The spec |
|
|
192
|
+
|
|
193
|
+
**Splitting an umbrella:**
|
|
194
|
+
|
|
195
|
+
| Instead of | Write |
|
|
196
|
+
|------------|-------|
|
|
197
|
+
| A member can manage their comments | A member can post a comment / can edit their own comment / can delete their own comment |
|
|
198
|
+
| Billing handles plan changes correctly | An owner can change plan mid-cycle / A proration line appears on the next invoice |
|
|
199
|
+
|
|
200
|
+
A focused clause is proven by a focused example at the layer that owns it; a
|
|
201
|
+
broad one has no home but a wide system spec, which fights the budget and the
|
|
202
|
+
app's testing conventions and lands on the
|
|
203
|
+
~3-evaluation tripwire below. **A clause you cannot prove without a journey
|
|
204
|
+
spec is usually a clause that has not been split yet.**
|
|
205
|
+
|
|
206
|
+
**The other bound — a clause is not a spec.** Scope words *sharpen* a clause,
|
|
207
|
+
they do not split it: "Only the author can edit an article" is one promise even
|
|
208
|
+
though proving it takes a permit case and a deny case at two layers. If a split
|
|
209
|
+
yields clauses no user would state separately, or that differ only by which
|
|
210
|
+
layer proves them, it has gone too far — the ~10-clauses-per-capability ceiling
|
|
211
|
+
is what says so. Split by what the product promises, never by what one example
|
|
212
|
+
can assert.
|
|
213
|
+
|
|
214
|
+
#### Lifecycle
|
|
215
|
+
|
|
216
|
+
- **Superseding:** add `superseded_by: [ I5 ]` and `superseded_on: YYYY-MM-DD`
|
|
217
|
+
to the old clause, and add the new clause with a **new** id. Never delete the
|
|
218
|
+
old entry — tombstones are how a future agent learns a cap existed, why, and
|
|
219
|
+
why it went. `retired_on:` covers a clause withdrawn with no replacement.
|
|
220
|
+
- **Draft stage:** clauses not yet referenced by any approved plan may simply
|
|
221
|
+
be edited in place; the supersession mechanics bind once a plan referencing
|
|
222
|
+
them is approved.
|
|
223
|
+
|
|
224
|
+
### Shape
|
|
225
|
+
|
|
226
|
+
Deltas only — constraints specific to this capability that are **not**
|
|
227
|
+
derivable from the app's own conventions and **not** stated in `compilation.md`. Link,
|
|
228
|
+
don't repeat.
|
|
229
|
+
|
|
230
|
+
### Evaluations
|
|
231
|
+
|
|
232
|
+
Each **active** clause carries `evaluations:` — the RSpec files that prove it.
|
|
233
|
+
System specs are the browser evaluations. The named spec file must carry a
|
|
234
|
+
matching **`intent:` metadata tag** (below); a path alone is a claim, the tag
|
|
235
|
+
is the proof.
|
|
236
|
+
|
|
237
|
+
**The row has to be earned, not just filled.** `agent_primitives evals`
|
|
238
|
+
checks only that the link is well-formed — clause exists, file exists, tag
|
|
239
|
+
present. Whether the tagged examples would actually go red if the clause
|
|
240
|
+
stopped being true is judgment: a clause with a green row that proves nothing
|
|
241
|
+
is worse than a bare clause, which at least fails honestly. The test and its
|
|
242
|
+
three common failures — asserting the affordance instead of the outcome,
|
|
243
|
+
proving one case where the clause claims a quantifier, proving it at a layer
|
|
244
|
+
that cannot hold it — are in **`tagging-intent`**
|
|
245
|
+
§ What counts as proving a clause.
|
|
246
|
+
|
|
247
|
+
A clause often lists **several files across several layers** — the permission
|
|
248
|
+
in a policy spec, the denial in a request spec, the journey in a system spec.
|
|
249
|
+
That is coverage of one clause, not duplication of one test; the app's testing
|
|
250
|
+
conventions for which spec layer owns a behaviour make it mandatory for
|
|
251
|
+
anything with an authorization side. The brake is **necessity**: an evaluation
|
|
252
|
+
you could delete while leaving the clause fully proven is padding, and comes
|
|
253
|
+
off the row.
|
|
254
|
+
|
|
255
|
+
Coverage is a **`built`-status obligation, and it is total**: every active
|
|
256
|
+
clause on a `built` doc names a spec, or `agent_primitives evals` fails.
|
|
257
|
+
`shaping` and `planned` docs for new work have none by design.
|
|
258
|
+
|
|
259
|
+
There is **no way to annotate a clause into being excused** — an unproven
|
|
260
|
+
clause on a built capability is a gap in the capability, not a nuance of the
|
|
261
|
+
record. Either write the spec, or the clause is not yet `built`: split it out,
|
|
262
|
+
leave the doc `planned`, or state in provenance that the behaviour shipped
|
|
263
|
+
untested and expect a red run until it isn't.
|
|
264
|
+
|
|
265
|
+
**`amending`** is a shipped capability that an approved plan is changing. At
|
|
266
|
+
plan approval it goes `built` → `amending`, and `plan:` names the plan. At
|
|
267
|
+
close-out it goes back to `built` and `plan:` comes off, in one edit. Rows
|
|
268
|
+
the doc already has stay fully enforced. Its new clauses have none until
|
|
269
|
+
close-out, so `evals` reports them, and the tags pointing at them, as
|
|
270
|
+
warnings rather than failures. Tags on a `planned` doc's rowless clauses warn
|
|
271
|
+
the same way. The status is set, never inferred, and `evals` never reads
|
|
272
|
+
provenance. A plan that stops before close-out gets a provenance line saying
|
|
273
|
+
why, then `status: built` without `plan:`.
|
|
274
|
+
|
|
275
|
+
### Tagging the proof
|
|
276
|
+
|
|
277
|
+
The spec example that proves a clause carries its id as `intent:` RSpec
|
|
278
|
+
metadata — on the example, never on the group — as **`tagging-intent`**
|
|
279
|
+
describes, and **`running-primitives-checks`** covers the commands that check
|
|
280
|
+
the tag is there, placed, and pointing at a live clause.
|
|
281
|
+
|
|
282
|
+
### Checked mechanically
|
|
283
|
+
|
|
284
|
+
Three CLI commands keep this record honest — **`agent_primitives evals`**,
|
|
285
|
+
**`agent_primitives guard --base <ref>`**, and **`agent_primitives proofs`** —
|
|
286
|
+
and **`running-primitives-checks`** holds their reference, the guard notice
|
|
287
|
+
taxonomy, and the silent-CLI protocol, while **`tagging-intent`** holds the tags
|
|
288
|
+
they read.
|
|
289
|
+
|
|
290
|
+
### Provenance
|
|
291
|
+
|
|
292
|
+
One line per **event** (shaped, planned, built, amended, revised, refactored,
|
|
293
|
+
backfilled, confirmed, deprecated) — not per edit. Each line: date, what
|
|
294
|
+
happened, link to the plan or PR, and rejected alternatives or knowingly
|
|
295
|
+
accepted debt when there were any. Multi-line entries are a lint finding.
|
|
296
|
+
|
|
297
|
+
**Every line earns its place with a future reader** deciding whether to change
|
|
298
|
+
the code. Decisions, rejected alternatives, and accepted debt pass. Mid-task
|
|
299
|
+
process does not — how the work got done is git's job:
|
|
300
|
+
|
|
301
|
+
| Keep out | Why |
|
|
302
|
+
|----------|-----|
|
|
303
|
+
| Review iteration counts, task counts, fix-pass tallies | Changes no future decision |
|
|
304
|
+
| Who or what agent did the work, which skill or subagent ran | Not a property of the capability |
|
|
305
|
+
| Commands run, suites passed, lint status | `evaluations:` and CI are where proof lives |
|
|
306
|
+
| Progress narration ("started X", "continuing Y", "blocked then unblocked") | Only events land — a thing that happened and stayed true |
|
|
307
|
+
| Restated intent clauses or Shape bullets | Already above in the doc |
|
|
308
|
+
|
|
309
|
+
The same test governs the whole tree: **`intent:` clauses**, **`## Shape`**, and
|
|
310
|
+
**`compilation.md`** hold only what a future reader must know to change the
|
|
311
|
+
code correctly. Process, status chatter, and anything derivable from the code
|
|
312
|
+
or the app's own conventions has no home here.
|
|
313
|
+
|
|
314
|
+
## Size discipline
|
|
315
|
+
|
|
316
|
+
Lint tripwires.
|
|
317
|
+
|
|
318
|
+
| Limit | Finding when exceeded |
|
|
319
|
+
|-------|----------------------|
|
|
320
|
+
| ~10 active intent clauses per capability | Split the capability — same instinct as a fat controller |
|
|
321
|
+
| ~3 evaluations on one clause | Two promises wearing one id (split the clause), or a padded row (drop the evaluations that prove nothing the others don't) |
|
|
322
|
+
| One sentence per clause, one line per provenance entry | Rewrite tighter |
|
|
323
|
+
| ~150 lines per capability doc | Fat provenance, a capability that should split, or Shape restating the app's own conventions |
|
|
324
|
+
| ~50 lines for `compilation.md` | It is describing the app, not constraining it |
|
|
325
|
+
|
|
326
|
+
## Style
|
|
327
|
+
|
|
328
|
+
- **Plain sentences a stranger can skim.** A clause or Shape bullet states its
|
|
329
|
+
constraint once, with no hedging, meta-commentary, or rationale paragraphs —
|
|
330
|
+
rationale is a one-line provenance entry. The size limits above bound length;
|
|
331
|
+
this bounds density: prose that pads within the limits is still a finding.
|
|
332
|
+
- Prefer **relative links** inside the tree.
|
|
333
|
+
- Capability filenames follow the app's resource names (the app's naming conventions)
|
|
334
|
+
so code → doc lookup works by grep — and because the filename is what an
|
|
335
|
+
`intent:` tag names, a rename means retagging its examples. Choose the name
|
|
336
|
+
as if it were permanent.
|
|
337
|
+
- **`capabilities/` is flat, and the prefix is the namespace.** Not every
|
|
338
|
+
capability is a resource: the ~10-clause tripwire splits `comments` into
|
|
339
|
+
`comment_threads` and `comment_moderation`, and cross-cutting capabilities
|
|
340
|
+
(authentication, search, notifications, audit logging) never owned a
|
|
341
|
+
resource. Name those **`<domain>_<behaviour>`** — `billing_plan_changes`,
|
|
342
|
+
`billing_invoices`, `billing_dunning` — so `ls capabilities/ | grep billing`
|
|
343
|
+
is a working namespace query. Subdirectories are **not** the way: `intent:`
|
|
344
|
+
tags name a bare filename with no path, so a nested doc cannot be addressed
|
|
345
|
+
by a tag — `agent_primitives evals` reports one as `doc/nested`.
|
|
346
|
+
- Keep **Rails app code** out of this tree; it holds decisions and pointers,
|
|
347
|
+
not application source.
|
|
348
|
+
|
|
349
|
+
## Relationship to the app's workflows
|
|
350
|
+
|
|
351
|
+
- **`planning-with-primitives`** — seeds or amends the capability doc and its intent clauses while a requirements spec or plan is written, and syncs status and provenance at plan approval.
|
|
352
|
+
- **`closing-out-primitives`** — verifies each task with `proofs` and `guard` while a plan runs, then fills `evaluations:`, flips `status:`, and appends provenance at close-out.
|
|
353
|
+
- **`reviewing-primitives`** — reviews a plan or a change against the tree, and keeps intent tags intact through a spec refactor.
|
|
354
|
+
- **`backfilling-primitives`** — writes the capability doc for an existing feature from its specs and code, after the human confirms each clause in an interview; planning runs it when its gate finds a shipped feature with no doc.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reviewing-primitives
|
|
3
|
+
description: >-
|
|
4
|
+
Review a plan or a change against the primitives tree: traceability to intent
|
|
5
|
+
clauses, a complete Intent impact block, supersession hygiene, evaluation
|
|
6
|
+
adequacy read from proofs output, provenance candidates — and the audit that
|
|
7
|
+
keeps intent tags intact through a spec refactor. Use when reviewing plans or
|
|
8
|
+
code, or refactoring specs, in an app with a docs/primitives/ tree.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Reviewing primitives
|
|
12
|
+
|
|
13
|
+
**Announce:** "I'm using the reviewing-primitives skill."
|
|
14
|
+
|
|
15
|
+
This skill applies only when the app has a `docs/primitives/` tree; the
|
|
16
|
+
workflow skill that sent you here owns everything else about the review or the
|
|
17
|
+
refactor.
|
|
18
|
+
|
|
19
|
+
## Inputs
|
|
20
|
+
|
|
21
|
+
Runs when the app has a **`docs/primitives/`** tree (`primitives-format` § Layout).
|
|
22
|
+
Read the **one** capability doc named by the plan header's **Capability:** line
|
|
23
|
+
(or located via `docs/primitives/index.md`) plus `compilation.md` — never the
|
|
24
|
+
whole tree. No tree → note "No primitives tree" in the report and skip.
|
|
25
|
+
|
|
26
|
+
**The mechanical output arrives with the prompt.** Whoever runs the plan, when
|
|
27
|
+
delegating the review, runs the commands `running-primitives-checks`
|
|
28
|
+
§ Handing the output to a reviewer names for the review's phase and pastes
|
|
29
|
+
their stdout under
|
|
30
|
+
**Mechanical primitives output (authoritative — do not re-run)**
|
|
31
|
+
(`running-primitives-checks` § Handing the output to a reviewer) — cite that
|
|
32
|
+
block. Run them yourself only when you are the top-level agent with a working
|
|
33
|
+
shell:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
agent_primitives evals # clause coverage; exits 1 on findings
|
|
37
|
+
agent_primitives guard --base <the diff's base> # what this change did to the record
|
|
38
|
+
agent_primitives proofs --since <the diff's base> # tagged-example counts per touched clause
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**No block and no working shell → `UNVERIFIED (CLI unavailable)`** per
|
|
42
|
+
`running-primitives-checks` § None of these is quiet; `Status: Approved`
|
|
43
|
+
resting on the mechanical checks is not available on one. Ask the delegating
|
|
44
|
+
agent once for the output first, and report the unverified checks in the
|
|
45
|
+
**primitives:** section.
|
|
46
|
+
|
|
47
|
+
What each command checks — and the guard notice taxonomy with its
|
|
48
|
+
proof-vs-intent handling split — is
|
|
49
|
+
the **`running-primitives-checks`** skill. Cite `evals` file:line
|
|
50
|
+
output rather than re-deriving it by hand, and cite `guard` notices with a
|
|
51
|
+
verdict rather than copying them in as findings. Two turn into findings: an
|
|
52
|
+
**intent** notice with no matching entry in the plan's **Intent impact** block
|
|
53
|
+
(scope creep into intent, whatever the code does), and a **proof** notice on a
|
|
54
|
+
still-active clause (**Eval adequacy** below, with the before-state attached —
|
|
55
|
+
name what stopped being covered). Never clear a notice by editing the tree — a
|
|
56
|
+
reviewer that writes the provenance entry discharging an intent notice has
|
|
57
|
+
laundered the finding it was reading.
|
|
58
|
+
|
|
59
|
+
## Checks
|
|
60
|
+
|
|
61
|
+
Prefix these findings **`primitives:`**. They are checkable properties, not
|
|
62
|
+
suggestions:
|
|
63
|
+
|
|
64
|
+
- **Traceability** — every behaviour in the plan or diff maps to an active
|
|
65
|
+
`intent:` clause. Untraceable behaviour is a finding: either a missing clause
|
|
66
|
+
or scope creep. A plan whose header lacks the **Capability:** line when the
|
|
67
|
+
tree exists is a finding.
|
|
68
|
+
- **Intent impact declared** — plan phase: the header carries a complete, honest
|
|
69
|
+
**Intent impact** block per `planning-with-primitives` § Intent impact block; a
|
|
70
|
+
missing block, an omitted touched clause, an undelivered case, or `no intent
|
|
71
|
+
delta` beside a wording change is a finding.
|
|
72
|
+
- **Clause admissibility** — every new or amended clause passes the four tests
|
|
73
|
+
in `primitives-format` § Intent clauses; run the
|
|
74
|
+
durable test first, since it disposes of all four at once.
|
|
75
|
+
- **Clause granularity** — plan phase: one behaviour per clause, umbrella verbs
|
|
76
|
+
and `and`-joins split, layer-only splits merged
|
|
77
|
+
(`primitives-format` § Intent clauses).
|
|
78
|
+
- **No overlap** — a new capability doc whose intent overlaps an existing one
|
|
79
|
+
is a plan defect (should be an amendment). Read `index.md` end to end before
|
|
80
|
+
accepting a new doc — the only place overlap is visible without opening the
|
|
81
|
+
whole tree. If two lines are too vague to tell apart, report **that** as the
|
|
82
|
+
finding: an indiscriminate index line is how duplicate capabilities get
|
|
83
|
+
created (`primitives-format`
|
|
84
|
+
§ Finding the right capability).
|
|
85
|
+
- **Compilation and Shape** — nothing contradicts `compilation.md` or the
|
|
86
|
+
doc's recorded Shape; a change that needs a constraint amended says so
|
|
87
|
+
explicitly rather than working around it. These are `philosophy:`-grade.
|
|
88
|
+
- **Supersession hygiene** — intent changes follow
|
|
89
|
+
`primitives-format` § Lifecycle: the plan schedules row
|
|
90
|
+
retirement and dead-spec deletion, post-close-out both have happened (pending
|
|
91
|
+
during per-task loops is not a finding).
|
|
92
|
+
- **Eval coverage** — plan phase: every touched clause gets a spec home in the
|
|
93
|
+
plan's tasks. Rows for **new** work are written at close-out — a plan
|
|
94
|
+
pre-filling them from intention is a finding; rows transcribed from
|
|
95
|
+
**already-existing specs** (a `backfilling-primitives` pass, earlier
|
|
96
|
+
close-outs) are legitimately present at plan time
|
|
97
|
+
(`primitives-format` § Evaluations). Implementation phase, **per-task reviews**: rows are
|
|
98
|
+
not yet written — close-out fills them after all tasks approve — so check
|
|
99
|
+
that the task delivered the spec homes its cited clauses need, not the
|
|
100
|
+
rows. **Post-close-out reviews only:** every touched clause has a row
|
|
101
|
+
pointing at real reported specs; `status: built` with a missing row is a
|
|
102
|
+
finding, and no annotation excuses one. A doc still `amending`, or an index
|
|
103
|
+
line still saying `planned` or `amending`, on a branch that completes its
|
|
104
|
+
plan is a finding: close-out flips both to `built`
|
|
105
|
+
(`closing-out-primitives` § Close-out pass). Check the tags landed on the
|
|
106
|
+
**examples** that prove each clause — a tag on a `describe` or `context` is a
|
|
107
|
+
finding, because it keeps resolving after the example it stood for is
|
|
108
|
+
deleted.
|
|
109
|
+
- **Eval adequacy** — the check `agent_primitives evals` cannot make: **would
|
|
110
|
+
breaking the clause turn a tagged example red?** Start from the
|
|
111
|
+
**`proofs`** output for each touched clause: `proofs --since <base>` counts the
|
|
112
|
+
tagged examples per clause the change touched, and
|
|
113
|
+
`proofs '<capability>#I<n>'` lists them for one. Read the counts and listings
|
|
114
|
+
against the plan's **Intent
|
|
115
|
+
impact** entry, which names the cases the clause needs. A case the entry named that is missing from the tagged listing is a finding —
|
|
116
|
+
`evals` is green on it, because one tag makes the whole file a carrier, so a
|
|
117
|
+
clause meant to be proven by four denials passes with three tagged. Then read
|
|
118
|
+
each touched clause's wording against its evaluations. A quantifier (*only*, *never*, *any*, *every*) proven by one
|
|
119
|
+
happy path is a finding; so is an example asserting the affordance (form
|
|
120
|
+
renders, `200` returned) where the clause names an outcome; so is a denial
|
|
121
|
+
bolted onto a canonical journey instead of living in the policy or request
|
|
122
|
+
spec that owns it (`tagging-intent`
|
|
123
|
+
§ What counts as proving a clause). Report the missing case, not "add more
|
|
124
|
+
tests" — name the clause, the half that is unproven, and the layer it belongs
|
|
125
|
+
at.
|
|
126
|
+
|
|
127
|
+
Then run it the other way: **is every listed evaluation necessary?** An
|
|
128
|
+
evaluation you could delete with the clause still fully proven is padding.
|
|
129
|
+
More than ~3 on one clause is a tripwire — usually two promises sharing an id
|
|
130
|
+
(`primitives-format` § Size discipline).
|
|
131
|
+
- **Provenance conflicts** — the work does not re-litigate a recorded rejection
|
|
132
|
+
or undo a recorded deliberate decision without saying so
|
|
133
|
+
(`primitives-format` § Provenance).
|
|
134
|
+
|
|
135
|
+
**Provenance candidates (non-blocking):** list decisions, constraints, and
|
|
136
|
+
accepted debt that pass the earns-its-place test of
|
|
137
|
+
`primitives-format` § Provenance in the report's
|
|
138
|
+
**primitives:** section, so the close-out pass (`closing-out-primitives`
|
|
139
|
+
§ Close-out pass) can file them as one-line entries.
|
|
140
|
+
|
|
141
|
+
## Report section
|
|
142
|
+
|
|
143
|
+
The review report carries this section:
|
|
144
|
+
|
|
145
|
+
```markdown
|
|
146
|
+
### primitives: (traceability, compilation, evals, provenance)
|
|
147
|
+
_Only when the app has a `docs/primitives/` tree; otherwise state "No primitives tree" and omit the findings._
|
|
148
|
+
|
|
149
|
+
**Mechanical checks:** [`evals` / `guard` / `proofs` summary lines quoted from the pasted **Mechanical primitives output** block — or `UNVERIFIED (CLI unavailable)`, the checks that did not run, and the findings that would have rested on them.]
|
|
150
|
+
|
|
151
|
+
- [confidence: X.X] `[file or area]`: [Direct statement — untraceable behaviour, compilation/Shape contradiction, missing evaluation, supersession hygiene, provenance conflict.] — `primitives-format` § Capability doc format
|
|
152
|
+
**Verified:** [Capability doc + code you read to confirm, and the `agent_primitives evals` result — or that it was unavailable.]
|
|
153
|
+
|
|
154
|
+
**Provenance candidates (non-blocking):** decisions, constraints, or accepted debt worth a one-line provenance entry at close-out. Only durable value — not every implementation detail.
|
|
155
|
+
- ...
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Auditing tagged examples in a spec refactor
|
|
159
|
+
|
|
160
|
+
### Intent audit — does this `it` block carry an `intent:` tag?
|
|
161
|
+
|
|
162
|
+
**Only when the app has a `docs/primitives/` tree.** A tagged example is a
|
|
163
|
+
capability doc's evaluation, so a verdict on it is a verdict on the record too:
|
|
164
|
+
|
|
165
|
+
- **MOVE** — the tag travels with the example, and the clause's `evaluations:`
|
|
166
|
+
gains the new path and loses the old one.
|
|
167
|
+
- **MERGE** — the surviving example carries the union of the tags. Check the
|
|
168
|
+
merge did not swallow the half that proved a quantifier: two examples proving
|
|
169
|
+
*"only the author can edit"* — one permitting, one denying — cannot become one
|
|
170
|
+
example without the clause losing a side
|
|
171
|
+
(`tagging-intent` § What counts as proving a clause).
|
|
172
|
+
- **DELETE** — a tagged example is only deletable if its clause is still proven
|
|
173
|
+
elsewhere afterwards. If it is the last proof, the deletion is out of scope for
|
|
174
|
+
a refactor: it removes coverage, not duplication. Flag it and leave it.
|
|
175
|
+
- **REWRITE** — re-read the clause against the rewritten example. A rewrite that
|
|
176
|
+
drops to a lower layer for speed can quietly turn an outcome assertion into an
|
|
177
|
+
affordance assertion.
|
|
178
|
+
|
|
179
|
+
Take **`agent_primitives proofs '<capability>#I<n>'`** before and after each
|
|
180
|
+
touched clause: it lists each evaluation file's tagged examples with a count,
|
|
181
|
+
so a tag dropped in a merge or a split shows as a number that went down. `evals` cannot see it — one surviving tag makes the whole file a
|
|
182
|
+
carrier — and `guard`'s `proof/removed` only fires when a tagged example is gone,
|
|
183
|
+
not when a surviving one lost its tag.
|
|
184
|
+
|
|
185
|
+
Never resolve a tag by deleting it from the example — that silently unproves a
|
|
186
|
+
clause while keeping the suite green, and `agent_primitives evals` will then
|
|
187
|
+
fail on the doc rather than on the spec that caused it. Finish the session with
|
|
188
|
+
`agent_primitives evals` green.
|
|
189
|
+
|
|
190
|
+
Then run **`agent_primitives guard --base <the commit this session started
|
|
191
|
+
from>`**. A spec refactor is the single largest legitimate source of its notices,
|
|
192
|
+
which is exactly why it is worth reading here: `guard` lists every tagged example
|
|
193
|
+
that lost assertions (`proof/weakened`), disappeared (`proof/removed`), or moved
|
|
194
|
+
to another layer (`evaluation/relayered`) — the audit-plan verdicts, read back off
|
|
195
|
+
what actually happened rather than off what the plan intended. Reconcile each
|
|
196
|
+
notice against its MERGE / DELETE / REWRITE verdict. One with no verdict behind it
|
|
197
|
+
is coverage this session dropped by accident; restore it. Notices about **intent**
|
|
198
|
+
(`intent/rewritten`, `intent/vanished`) mean the session edited promises, which a
|
|
199
|
+
spec refactor never does — stop and surface those.
|
|
200
|
+
|
|
201
|
+
### Anti-pattern
|
|
202
|
+
|
|
203
|
+
| Anti-pattern | Instead |
|
|
204
|
+
|--------------|---------|
|
|
205
|
+
| Deleting an `intent:` tag, or the last example proving a clause | Unproves a capability while the suite stays green; flag it and leave the example |
|
|
206
|
+
|
|
207
|
+
### Before declaring the refactor done
|
|
208
|
+
|
|
209
|
+
- [ ] Every `intent:` tag moved with its example, still sits on an `it` block, and its clause's `evaluations:` paths were updated; no tag was deleted to resolve a verdict
|
|
210
|
+
- [ ] `agent_primitives evals` is green (only when the app has a `docs/primitives/` tree)
|
|
211
|
+
- [ ] Every `agent_primitives guard` notice reconciles to an audit-plan verdict; no intent notices
|