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,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "agent_primitives/version"
|
|
4
|
+
|
|
5
|
+
# Tooling and skills for a docs/primitives/ tree: capability docs whose intent
|
|
6
|
+
# clauses are proven by tagged RSpec examples.
|
|
7
|
+
module AgentPrimitives
|
|
8
|
+
SKILLS_DIR = "skills"
|
|
9
|
+
|
|
10
|
+
# Skills that develop this repo rather than a consuming app. Dropped from
|
|
11
|
+
# `import` and from the gem; the gemspec repeats the list literally.
|
|
12
|
+
DEV_ONLY = %w[maintaining-agent-primitives].freeze
|
|
13
|
+
|
|
14
|
+
class Error < StandardError; end
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
def root = File.expand_path("..", __dir__)
|
|
18
|
+
|
|
19
|
+
def skills = File.join(root, SKILLS_DIR)
|
|
20
|
+
|
|
21
|
+
# True for a skills-relative path that exists only to develop this repo.
|
|
22
|
+
def dev_only?(relative)
|
|
23
|
+
DEV_ONLY.any? { |name| relative == name || relative.start_with?("#{name}/") }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: backfilling-primitives
|
|
3
|
+
description: >-
|
|
4
|
+
Backfill a capability doc for a feature that already exists: read its specs
|
|
5
|
+
and code for candidate intent clauses, then interview the human clause by
|
|
6
|
+
clause — intended or accidental, why, where the edge is — and ask about
|
|
7
|
+
unspecced behaviour, depended-on quirks, boundaries, and external promises
|
|
8
|
+
before writing anything. Use when the user asks to backfill or capture an
|
|
9
|
+
existing feature, or when planning finds an existing feature with no
|
|
10
|
+
capability doc.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Backfilling primitives (one capability, confirmed by the human)
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
Produce **one capability doc** for a feature that already exists,
|
|
17
|
+
reconstructed from evidence and **confirmed by the human before anything is
|
|
18
|
+
written**. Read no more than the reading contract allows: `index.md`, the one
|
|
19
|
+
target capability doc (if any), and `compilation.md`
|
|
20
|
+
(`primitives-format` § Reading contract). Run it in the conversation with the
|
|
21
|
+
human — never hand it to a subagent, which cannot hold the interview.
|
|
22
|
+
</objective>
|
|
23
|
+
|
|
24
|
+
**Announce:** "I'm using the backfilling-primitives skill."
|
|
25
|
+
|
|
26
|
+
Structure rules: the **`primitives-format`** skill. Skeletons:
|
|
27
|
+
**`references/templates.md`** in the **`maintaining-primitives`** skill.
|
|
28
|
+
Tagging: the **`tagging-intent`** skill.
|
|
29
|
+
|
|
30
|
+
## When to use
|
|
31
|
+
|
|
32
|
+
Existing features get docs **lazily** (the first time planned work touches
|
|
33
|
+
them, planning runs this skill) or **on demand**. Never as a bulk
|
|
34
|
+
documentation project — batch requests run one capability at a time with
|
|
35
|
+
human confirmation between, ordered by where change is coming.
|
|
36
|
+
|
|
37
|
+
Entry points:
|
|
38
|
+
|
|
39
|
+
- **On demand** — the human names a feature.
|
|
40
|
+
- **From planning** — `planning-with-primitives` § Primitives gate found no
|
|
41
|
+
doc for a shipped feature. Planning pauses here, and resumes once § 6 is
|
|
42
|
+
done, treating the new doc as the capability its plan amends. Its final
|
|
43
|
+
approval then moves the doc to `amending`
|
|
44
|
+
(`planning-with-primitives` § At final approval).
|
|
45
|
+
- **An unconfirmed earlier backfill** — a doc whose provenance carries
|
|
46
|
+
`intent reconstructed, unconfirmed` (see § 1).
|
|
47
|
+
|
|
48
|
+
## Process
|
|
49
|
+
|
|
50
|
+
### 1. Scope
|
|
51
|
+
|
|
52
|
+
A feature name or path list from the human. Check `index.md`: if it lists a
|
|
53
|
+
doc for the outcome and that doc's provenance has no
|
|
54
|
+
`intent reconstructed, unconfirmed` line, this is a `maintaining-primitives`
|
|
55
|
+
`update`, not a backfill.
|
|
56
|
+
|
|
57
|
+
If it has one, run § 4 on it: the doc's active clauses are the candidate list
|
|
58
|
+
(§ 2 and § 3 only add behaviour the clauses miss). § 5 then does not open
|
|
59
|
+
provenance, set status, or add the index line — it appends
|
|
60
|
+
`- YYYY-MM-DD — backfill intent confirmed by human.` A legacy clause the human
|
|
61
|
+
rewords is superseded, and one they call accidental is retired with
|
|
62
|
+
`retired_on: YYYY-MM-DD` (`primitives-format` § Lifecycle — ids never reused);
|
|
63
|
+
its `intent:` tags are moved or removed. `agent_primitives guard` then
|
|
64
|
+
reports `intent/deactivated` for each one. That notice is expected, because
|
|
65
|
+
the human's read-back confirmed it, so report it (§ 6). An `intent/rewritten`
|
|
66
|
+
notice means a clause was edited in place instead of superseded: restore it
|
|
67
|
+
and supersede it.
|
|
68
|
+
|
|
69
|
+
### 2. Specs first
|
|
70
|
+
|
|
71
|
+
Read the feature's spec files. In a suite following the app's testing
|
|
72
|
+
conventions for which spec layer owns a behaviour, behaviour-first system and
|
|
73
|
+
request spec descriptions *are* draft intent clauses, and each maps to its
|
|
74
|
+
`evaluations:` for free.
|
|
75
|
+
|
|
76
|
+
**Do not aggregate to fit the clause ceiling** — one behaviour per clause
|
|
77
|
+
(`primitives-format` § Intent clauses). If the honest clause list runs past
|
|
78
|
+
ten, the finding is that the **capability** should split, not that the
|
|
79
|
+
sentences should widen.
|
|
80
|
+
|
|
81
|
+
**Do not promote an adjacent spec into a proof** — the example you tag has
|
|
82
|
+
to go red if the clause stops being true
|
|
83
|
+
(`tagging-intent` § What counts as proving a clause).
|
|
84
|
+
Backfilled clauses arrive *wider* than any single existing example; where a
|
|
85
|
+
clause claims *only*, *never*, or *any* and one case is covered, either
|
|
86
|
+
narrow the clause to what the suite proves, or keep it wide and report the
|
|
87
|
+
uncovered half as a gap under § 5. Both are honest; tagging past it is
|
|
88
|
+
not.
|
|
89
|
+
|
|
90
|
+
Output: a **candidate** clause list, each with its spec description and path
|
|
91
|
+
as evidence.
|
|
92
|
+
|
|
93
|
+
### 3. Code second
|
|
94
|
+
|
|
95
|
+
Models, routes, policies for the Shape bullets (deltas only — nothing
|
|
96
|
+
derivable from the app's own conventions or stated in `compilation.md`).
|
|
97
|
+
Observable behaviour the code shows and no spec describes joins the candidate
|
|
98
|
+
list, with its file and line.
|
|
99
|
+
|
|
100
|
+
Do not write the capability doc from this list.
|
|
101
|
+
|
|
102
|
+
### 4. Interview (human) — every clause earns its place
|
|
103
|
+
|
|
104
|
+
The specs and code show what the feature *does*; only the human knows which of
|
|
105
|
+
it is *intended*, why, and where it stops. A backfill confirmed in minutes
|
|
106
|
+
records the code's behaviour as if someone had chosen it. This step is most of
|
|
107
|
+
the work.
|
|
108
|
+
|
|
109
|
+
**How to ask**
|
|
110
|
+
|
|
111
|
+
- Use the agent's structured question tool when available; otherwise ask in
|
|
112
|
+
chat. A few questions per round, one topic per round.
|
|
113
|
+
- Make every question about a candidate stand alone: state the behaviour, cite
|
|
114
|
+
the evidence (the spec description and path, or the file and line), and offer
|
|
115
|
+
concrete answers, one of which is always "accidental — it just happens to do
|
|
116
|
+
this". Category questions have no evidence to cite; ask them plainly, with
|
|
117
|
+
examples.
|
|
118
|
+
- Never ask one catch-all ("anything else?") in place of the categories below.
|
|
119
|
+
People answer the question they are asked.
|
|
120
|
+
|
|
121
|
+
**The ladder — for every candidate; rungs 2–4 only for those that survive rung 1**
|
|
122
|
+
|
|
123
|
+
1. **Intended or accidental?** "Must future work keep this, or is it just what
|
|
124
|
+
the code happens to do?" If the answer is accidental, ask whether anyone
|
|
125
|
+
would notice it changing: behaviour users or integrations depend on is a
|
|
126
|
+
clause whatever its origin. Accidental and undepended-on is dropped here.
|
|
127
|
+
2. **Why?** "Who notices, or what breaks, if a change stops doing this?" An
|
|
128
|
+
answer with no reason gets asked again in different words. A clause whose
|
|
129
|
+
reason nobody can give is not written — it becomes an open question.
|
|
130
|
+
3. **Where is the edge?** "Who is this for, and who is excluded? What happens
|
|
131
|
+
when the list is empty, the limit is hit, the user lacks permission, the
|
|
132
|
+
call fails?" An answer that narrows the behaviour becomes the clause's
|
|
133
|
+
wording — *only*, *never*, *any* — and the denial and boundary cases its
|
|
134
|
+
proof needs. An answer that is a behaviour of its own (an empty state, a
|
|
135
|
+
failure path) is a new candidate: one behaviour per clause.
|
|
136
|
+
4. **The review test.** Restate the answer as the one-sentence clause you will
|
|
137
|
+
write and ask: "Would you block a pull request that broke this?" A "no"
|
|
138
|
+
means it is not a promise; leave it out.
|
|
139
|
+
|
|
140
|
+
**What specs and code cannot reveal — ask each category explicitly**
|
|
141
|
+
|
|
142
|
+
- **Unspecced behaviour** — what users rely on that no spec covers, and the
|
|
143
|
+
edge cases nobody wrote down: empty states, limits, permissions, failure
|
|
144
|
+
paths. Each one confirmed is a clause, proven or not.
|
|
145
|
+
- **Accidental behaviour** — known bugs or quirks that users or integrations
|
|
146
|
+
now depend on, and behaviour already slated to change or be deprecated. A
|
|
147
|
+
quirk depended on is a clause; one slated to change is reported, not
|
|
148
|
+
promised.
|
|
149
|
+
- **Boundaries and ownership** — what is out of this capability, which
|
|
150
|
+
neighbouring capability owns it (check `index.md`), and who owns or approves
|
|
151
|
+
changes here.
|
|
152
|
+
- **External promises** — contracts, compliance, SLAs, accessibility, anything
|
|
153
|
+
sold to a customer that this behaviour must keep. Hold each against
|
|
154
|
+
`compilation.md`: a promise that binds the whole app belongs there, as a
|
|
155
|
+
proposed amendment for the human; one that binds this capability is a clause.
|
|
156
|
+
|
|
157
|
+
**When answers and the code disagree**, show the evidence and ask which is
|
|
158
|
+
right. Do not pick one silently. If the code is wrong, the clause states the
|
|
159
|
+
intent and the disagreement is reported as a bug.
|
|
160
|
+
|
|
161
|
+
**When the human does not know**, record it as an open question with who
|
|
162
|
+
might know. An unanswered question never becomes a clause, and never becomes
|
|
163
|
+
its absence.
|
|
164
|
+
|
|
165
|
+
**Done when** every candidate is classified, every category has been asked,
|
|
166
|
+
and the human has confirmed a read-back: the full clause list, each with its
|
|
167
|
+
reason, its edge, and its proof — the existing spec that will carry its tag,
|
|
168
|
+
or a gap — in one message. Write the doc only after that confirmation.
|
|
169
|
+
|
|
170
|
+
### 5. Write the doc
|
|
171
|
+
|
|
172
|
+
Only once § 4 is done. For an unconfirmed earlier backfill, apply the
|
|
173
|
+
clause changes the human confirmed and append the confirmation entry instead
|
|
174
|
+
(§ 1); items 3 and 6 below do not apply.
|
|
175
|
+
|
|
176
|
+
1. **`evaluations:` come from specs that already exist** — tag their examples
|
|
177
|
+
now. Add the `intent:` tag to the examples as you write each clause — a
|
|
178
|
+
clause naming a spec that does not carry the tag is a finding, not a
|
|
179
|
+
capture.
|
|
180
|
+
2. **Gaps are findings, and they stay red** — observable behaviour with no
|
|
181
|
+
spec home still gets its clause, with no `evaluations:`; no annotation
|
|
182
|
+
excuses it (`primitives-format` § Evaluations). Say
|
|
183
|
+
so when you report — list the uncovered clauses as blocking spec
|
|
184
|
+
follow-up, and do not soften the clause or drop it to keep the run green.
|
|
185
|
+
3. **Provenance opens with one line:**
|
|
186
|
+
`- YYYY-MM-DD — backfilled from existing behaviour; intent confirmed by human; prior history in git.`
|
|
187
|
+
The read-back in § 4 is the confirmation, so no unconfirmed state ships.
|
|
188
|
+
Do not mine git log for decision archaeology — noisy, low-yield.
|
|
189
|
+
4. **Edges and reasons** — each clause's edge is in its wording. A reason
|
|
190
|
+
future work must respect beyond the clause goes in `## Shape`.
|
|
191
|
+
5. **Boundaries** — the answers sharpen the `index.md` line's discriminating
|
|
192
|
+
outcome, and its `Owns:` where a resource is involved
|
|
193
|
+
(`primitives-format` § Finding the right capability). What is out of
|
|
194
|
+
scope, with a link to the neighbouring capability that owns it, and who
|
|
195
|
+
approves changes go in `## Shape`.
|
|
196
|
+
6. Add the `index.md` line, `status: built` — the feature exists in
|
|
197
|
+
production, and a clause with no spec is a red run rather than a reason to
|
|
198
|
+
understate the status (`primitives-format` § Evaluations).
|
|
199
|
+
7. **Close** with `agent_primitives evals` and the diff read-back
|
|
200
|
+
(`maintaining-primitives` § Close every writing pass by reading your own
|
|
201
|
+
diff back).
|
|
202
|
+
|
|
203
|
+
### 6. Hand to the human
|
|
204
|
+
|
|
205
|
+
Report, as lists:
|
|
206
|
+
|
|
207
|
+
> Capability doc written at `docs/primitives/capabilities/<name>.md`.
|
|
208
|
+
>
|
|
209
|
+
> **Clauses with no proof** — blocking spec follow-up:
|
|
210
|
+
> - [clause id, and the case its spec needs]
|
|
211
|
+
>
|
|
212
|
+
> **Open questions nobody could answer** — not written as clauses:
|
|
213
|
+
> - [question, and who might know]
|
|
214
|
+
>
|
|
215
|
+
> **Accidental or slated to change** — not promised, so a future plan may
|
|
216
|
+
> change it:
|
|
217
|
+
> - [behaviour, and what the human said]
|
|
218
|
+
>
|
|
219
|
+
> **Code and intent disagree** — bugs: the clause states the intent, its
|
|
220
|
+
> proof stays red:
|
|
221
|
+
> - [clause id, the evidence, and what the code does instead]
|
|
222
|
+
>
|
|
223
|
+
> **Proposed `compilation.md` amendments** — app-wide promises; that file is
|
|
224
|
+
> yours:
|
|
225
|
+
> - [promise, and its reason]
|
|
226
|
+
>
|
|
227
|
+
> **Expected `intent/deactivated` notices** — confirming an earlier backfill
|
|
228
|
+
> only; each clause you superseded or retired at the read-back:
|
|
229
|
+
> - [clause id, superseded by or retired, and the human's reason]
|
|
230
|
+
|
|
231
|
+
When entered from planning, end by returning to `planning-with-primitives`
|
|
232
|
+
§ Primitives gate.
|
|
233
|
+
|
|
234
|
+
## Common mistakes
|
|
235
|
+
|
|
236
|
+
| Mistake | Instead |
|
|
237
|
+
|---|---|
|
|
238
|
+
| Confirming in minutes instead of interviewing | § 4 is most of the work; climb the ladder for every candidate. |
|
|
239
|
+
| Tagging before the clause is confirmed | Tag in § 5, after the read-back — a tag is a promise's proof. |
|
|
240
|
+
| Writing an accidental behaviour as a promise | Accidental and undepended-on is dropped at rung 1; slated to change is reported in § 6. |
|
|
241
|
+
| One catch-all question instead of the categories | Ask each category in § 4 explicitly. |
|
|
242
|
+
| Joining an edge case onto its clause with "and" | An edge that is a behaviour of its own is its own clause. |
|
|
243
|
+
| Writing the doc before the read-back is confirmed | § 5 starts only after the human confirms the full clause list. |
|
|
244
|
+
| Handing the pass to a subagent | A subagent cannot talk to the human; run it in the conversation. |
|
|
245
|
+
|
|
246
|
+
## Related
|
|
247
|
+
|
|
248
|
+
- **`primitives-format`** — structure, ownership, lifecycle, reading contract.
|
|
249
|
+
- **`tagging-intent`** — the `intent:` tag and what counts as proving a clause.
|
|
250
|
+
- **`running-primitives-checks`** — `evals` / `guard` / `proofs` reference.
|
|
251
|
+
- **`maintaining-primitives`** — `update`, `trace`, `lint`; the diff read-back.
|
|
252
|
+
- **`planning-with-primitives`** — its primitives gate sends shipped features with no doc here.
|
|
253
|
+
- **`bootstrapping-primitives`** — one-time tree scaffold; offers a first backfill.
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bootstrapping-primitives
|
|
3
|
+
description: >-
|
|
4
|
+
One-time adoption of the primitives tree in an app: scaffold docs/primitives/
|
|
5
|
+
(SCHEMA.md, index.md, capabilities/) and draft the human-owned compilation.md
|
|
6
|
+
from a deep codebase survey and a probing interview that keeps asking until
|
|
7
|
+
each constraint has a reason and an edge. Use when a repo has no
|
|
8
|
+
docs/primitives/ tree, or the user says set up primitives, adopt primitives,
|
|
9
|
+
or generate compilation. Backfill: backfilling-primitives; maintenance:
|
|
10
|
+
maintaining-primitives.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Bootstrapping primitives (one-time adoption)
|
|
14
|
+
|
|
15
|
+
<objective>
|
|
16
|
+
Stand up **`docs/primitives/`** in one sitting, most of it spent on the
|
|
17
|
+
interview: scaffold the tree, then draft **`compilation.md`** — the app-specific compilation primitive — from a
|
|
18
|
+
read-only survey plus a human interview. The deliverable is a **strawman the
|
|
19
|
+
human edits**, not a finished document: `compilation.md` is human-owned from
|
|
20
|
+
its first commit. Everything else (capability docs) accrues per-feature
|
|
21
|
+
afterwards — this skill deliberately does **not** backfill the app.
|
|
22
|
+
</objective>
|
|
23
|
+
|
|
24
|
+
**Announce:** "I'm using the bootstrapping-primitives skill."
|
|
25
|
+
|
|
26
|
+
Structure rules: the **`primitives-format`** skill. Skeletons:
|
|
27
|
+
**`references/templates.md`** in the **`maintaining-primitives`** skill.
|
|
28
|
+
|
|
29
|
+
## Preconditions
|
|
30
|
+
|
|
31
|
+
- **`docs/primitives/` must not already exist.** If it does, this is
|
|
32
|
+
maintenance — route to **`maintaining-primitives`** instead.
|
|
33
|
+
- An app with an RSpec suite in the workspace (the checks read `spec/`).
|
|
34
|
+
|
|
35
|
+
## Process
|
|
36
|
+
|
|
37
|
+
### 1. Scaffold the tree
|
|
38
|
+
|
|
39
|
+
Create from the starters in `references/templates.md` of `maintaining-primitives`:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
docs/primitives/
|
|
43
|
+
SCHEMA.md # contract starter
|
|
44
|
+
index.md # empty catalog — one line per capability, see templates.md
|
|
45
|
+
capabilities/ # empty (add .keep if the repo tracks empty dirs)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`compilation.md` comes from steps 2–4, not the skeleton alone.
|
|
49
|
+
|
|
50
|
+
The first capability docs arrive later, from planning or a
|
|
51
|
+
`backfilling-primitives` pass (format: the `primitives-format` skill).
|
|
52
|
+
|
|
53
|
+
Mention `agent_primitives evals` to the user once, here: it ships with this gem and belongs
|
|
54
|
+
in CI beside RuboCop, so the tree cannot quietly rot. Say what it does and does
|
|
55
|
+
not settle (`running-primitives-checks` § Checked
|
|
56
|
+
mechanically) — the judgment it cannot make, whether a tagged spec would
|
|
57
|
+
actually go red, is a review responsibility from day one
|
|
58
|
+
(`tagging-intent` § What counts as proving a clause).
|
|
59
|
+
|
|
60
|
+
### 2. Survey (read-only, evidence for every candidate)
|
|
61
|
+
|
|
62
|
+
Read for **binding choices**, area by area. Record each candidate with the
|
|
63
|
+
file and line that shows it — a candidate without evidence is a guess, and the
|
|
64
|
+
interview needs something concrete to put in front of the human.
|
|
65
|
+
|
|
66
|
+
| Area | Read | Looking for |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| Dependencies | `Gemfile`, lockfile, `package.json` | What was chosen — and what is conspicuously absent (no Redis, no JS bundler, no service layer gem) |
|
|
69
|
+
| Runtime | `config/` adapters (queue, cache, storage, database), environment files | Datastores, background processing, external services |
|
|
70
|
+
| Delivery | Deploy config, CI workflows, `Dockerfile` | Where it runs, what gates a merge, what is checked that a newcomer would not expect |
|
|
71
|
+
| Boundaries | Engines, namespaces, top-level directories, authentication and authorization code | Seams that look deliberate; areas that look fenced off |
|
|
72
|
+
| Declared policy | `README`, `CLAUDE.md`, `AGENTS.md`, `docs/`, ADRs, linter config and its disabled rules | Rules someone already wrote down, and rules someone switched off |
|
|
73
|
+
| History | `git log` for removed dependencies, reverted changes, large migrations | Decisions already reversed once — the most valuable thing to ask "why" about |
|
|
74
|
+
| Deviations | Anything that departs from the framework's defaults | A deviation is either a constraint or an accident; only the human knows which |
|
|
75
|
+
| Specs | `spec/` layout, support files, factories | Which layers exist, since evaluations will name them |
|
|
76
|
+
|
|
77
|
+
Output: a **candidate list**, each with its evidence and one line on why it
|
|
78
|
+
might be binding. Detected is not binding — that is the interview's job. Do
|
|
79
|
+
not draft `compilation.md` from this list.
|
|
80
|
+
|
|
81
|
+
### 3. Interview (human) — keep asking until the answer has a reason
|
|
82
|
+
|
|
83
|
+
The survey finds *what*; only the human knows which choices are constraints,
|
|
84
|
+
why, and where they stop. This step is most of the work. A short interview
|
|
85
|
+
produces a document of guesses.
|
|
86
|
+
|
|
87
|
+
**How to ask**
|
|
88
|
+
|
|
89
|
+
- Use the agent's structured question tool when available; otherwise ask in
|
|
90
|
+
chat. A few questions per round, one topic per round.
|
|
91
|
+
- Make every question about a candidate stand alone: name the choice, cite the evidence
|
|
92
|
+
(`config/queue.yml` uses Solid Queue; no Redis anywhere in the lockfile), and
|
|
93
|
+
offer concrete answers, one of which is always "just how it is today".
|
|
94
|
+
Category questions have no evidence to cite; ask them plainly, with examples.
|
|
95
|
+
- Never ask one catch-all ("any other constraints?") in place of the
|
|
96
|
+
categories below. People answer the question they are asked.
|
|
97
|
+
|
|
98
|
+
**The ladder — for every candidate; rungs 2–4 only for those that survive rung 1**
|
|
99
|
+
|
|
100
|
+
1. **Binding or incidental?** "Must future work respect this, or is it just
|
|
101
|
+
how it happens to be?" Incidental candidates are dropped here.
|
|
102
|
+
2. **Why?** "What breaks, or who objects, if a change ignores it?" An answer
|
|
103
|
+
with no reason gets asked again in different words. A constraint whose
|
|
104
|
+
reason nobody can give is not written down — say so, add it to the open
|
|
105
|
+
questions, and move on.
|
|
106
|
+
3. **Where is the edge?** "What would be an acceptable exception, and who
|
|
107
|
+
would approve it?" This is what turns a preference into a rule an agent
|
|
108
|
+
can apply.
|
|
109
|
+
4. **The review test.** Restate the answer as the line you would write and
|
|
110
|
+
ask: "Would you block a pull request that broke this?" A "no" means it is
|
|
111
|
+
a preference; leave it out.
|
|
112
|
+
|
|
113
|
+
**What code cannot reveal — ask each category explicitly**
|
|
114
|
+
|
|
115
|
+
- **External commitments** — contracts, compliance, security review,
|
|
116
|
+
accessibility, uptime promises, anything sold to a customer.
|
|
117
|
+
- **Operational red lines** — datastores, vendors, cost ceilings, who is
|
|
118
|
+
paged and what they refuse to run.
|
|
119
|
+
- **Ownership** — areas another team owns, code that must not be touched,
|
|
120
|
+
work already promised elsewhere.
|
|
121
|
+
- **Reversed decisions** — what was tried and backed out, and why. Start from
|
|
122
|
+
the history the survey found.
|
|
123
|
+
- **Temporary state** — choices that are true today and already scheduled to
|
|
124
|
+
change, so nothing is built on them.
|
|
125
|
+
- **Deliberate deviations** — every departure from framework defaults the
|
|
126
|
+
survey listed: chosen, or inherited?
|
|
127
|
+
|
|
128
|
+
**When answers and code disagree**, show the evidence and ask which is right.
|
|
129
|
+
Do not pick one silently.
|
|
130
|
+
|
|
131
|
+
**When the human does not know**, record it as an open question for the
|
|
132
|
+
handoff. An unanswered question never becomes a constraint, and never becomes
|
|
133
|
+
its absence.
|
|
134
|
+
|
|
135
|
+
**Done when** every candidate is classified, every category has been asked,
|
|
136
|
+
and the human has confirmed a read-back: the full list of constraints, each
|
|
137
|
+
with its reason and its edge, in one message. Draft only after that
|
|
138
|
+
confirmation.
|
|
139
|
+
|
|
140
|
+
### 4. Draft `compilation.md`
|
|
141
|
+
|
|
142
|
+
Apply the filter to every line: **not derivable from the code or the app's own
|
|
143
|
+
conventions, and it would change what an agent proposes.** "We use Solid Queue"
|
|
144
|
+
is derivable — cut. "No Redis — ops will not run a second datastore; anything
|
|
145
|
+
proposing it needs an amendment here first" is a constraint with teeth — keep.
|
|
146
|
+
Each kept line carries its reason and its edge in a clause; a line that needed
|
|
147
|
+
the interview to explain it will need the reason again in six months. Target
|
|
148
|
+
**under 50 lines**; if it runs longer, it is describing the app rather than
|
|
149
|
+
constraining it.
|
|
150
|
+
|
|
151
|
+
Use the skeleton's three headings (Runtime & operations / Boundaries &
|
|
152
|
+
ownership / Constraints with teeth); drop or add headings as the app demands —
|
|
153
|
+
the filter matters, the headings don't.
|
|
154
|
+
|
|
155
|
+
### 5. Hand to the human
|
|
156
|
+
|
|
157
|
+
> `compilation.md` drafted at `docs/primitives/compilation.md`. It's yours —
|
|
158
|
+
> please edit: cut anything you wouldn't enforce in review, add what I
|
|
159
|
+
> couldn't see. From here agents read it before every plan and propose
|
|
160
|
+
> amendments via review findings; they won't edit it.
|
|
161
|
+
>
|
|
162
|
+
> **Open questions nobody could answer** — not written down as constraints:
|
|
163
|
+
> - [question, and who might know]
|
|
164
|
+
>
|
|
165
|
+
> **Lines I'm least sure of** — check these first:
|
|
166
|
+
> - [line, and why it is uncertain]
|
|
167
|
+
|
|
168
|
+
Wait for the human's pass before treating bootstrap as done. Then offer —
|
|
169
|
+
**do not run unprompted** — a first backfill:
|
|
170
|
+
|
|
171
|
+
> Want to backfill capability docs for any features change is coming to soon?
|
|
172
|
+
> That's the `backfilling-primitives` skill, one capability at a time.
|
|
173
|
+
|
|
174
|
+
## What this skill does NOT do
|
|
175
|
+
|
|
176
|
+
- **No bulk backfill.** Capability docs accrue lazily (the first time planned
|
|
177
|
+
work touches them, planning runs `backfilling-primitives`) or on demand
|
|
178
|
+
through the same skill; a bulk documentation project produces half-accurate
|
|
179
|
+
docs and dies.
|
|
180
|
+
- **No app code, no plans.**
|
|
181
|
+
- **No re-runs.** Once the tree exists, `compilation.md` changes only through
|
|
182
|
+
human edits prompted by review findings; the tree changes through the
|
|
183
|
+
standard workflow write points.
|
|
184
|
+
|
|
185
|
+
## Common mistakes
|
|
186
|
+
|
|
187
|
+
- **Describing instead of constraining** — `compilation.md` lines that restate
|
|
188
|
+
the Gemfile. Apply the filter; when in doubt, cut.
|
|
189
|
+
- **Skipping the interview** — a survey-only draft encodes the agent's guesses
|
|
190
|
+
about which choices are load-bearing; the interview makes the document
|
|
191
|
+
human-specified.
|
|
192
|
+
- **Backfilling everything while you're at it** — resist; see above.
|
|
193
|
+
- **Accepting the first answer** — a line written without its "why" cannot be
|
|
194
|
+
applied at its edge. Climb the ladder in step 3; a constraint nobody can give
|
|
195
|
+
a reason for is an open question, not a line.
|
|
196
|
+
- **One catch-all question instead of the categories** — "any other
|
|
197
|
+
constraints?" gets "no". Ask each category in step 3 explicitly.
|
|
198
|
+
- **Drafting before the read-back is confirmed** — step 4 starts only after
|
|
199
|
+
the human has confirmed the full list from step 3; a draft from answers not
|
|
200
|
+
yet confirmed is the agent's guesses again.
|
|
201
|
+
|
|
202
|
+
## Related
|
|
203
|
+
|
|
204
|
+
- **`maintaining-primitives`** — recurring operations (capture, trace, update, lint).
|
|
205
|
+
- **`backfilling-primitives`** — backfills a capability doc for an existing feature.
|
|
206
|
+
- **`primitives-format`** — structure, ownership, size limits.
|
|
207
|
+
- **`planning-with-primitives`** — first consumer: reads `compilation.md` and
|
|
208
|
+
the target capability doc at its primitives gate.
|