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.
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: running-primitives-checks
3
+ description: >-
4
+ Run and read the agent_primitives CLI — evals (is every clause proven), guard
5
+ (what a change did to intent and its proofs), proofs (which examples prove a
6
+ clause) — with the guard notice taxonomy, who resolves which notice, and what
7
+ to do when a command returns nothing. Use when running or citing these
8
+ commands, in CI or before handing work to a reviewer.
9
+ ---
10
+
11
+ # Primitives CLI (evals, guard, proofs)
12
+
13
+ **Announce:** "I'm using the running-primitives-checks skill."
14
+
15
+ Three commands read the primitives tree (structure and ownership:
16
+ **`primitives-format`**). Each answers a question the
17
+ others cannot, and none replaces judgment about whether a proof would actually
18
+ go red (`tagging-intent` § What counts as proving a
19
+ clause).
20
+
21
+ ## Checked mechanically
22
+
23
+ ```bash
24
+ agent_primitives evals # from the app root; exits 1 on findings
25
+ ```
26
+
27
+ It checks clause ↔ evaluation: unproven built clauses, evaluations naming a
28
+ file that does not exist or does not carry the tag, tags naming a clause that
29
+ is absent or superseded, tags in a file the clause's `evaluations:` does not
30
+ list, tags sitting on a group rather than an example, duplicate ids, dangling
31
+ supersessions, capability docs nested in a subdirectory, docs still in the
32
+ retired prose format, and malformed frontmatter or tags. It also checks
33
+ `plan:`: an `amending` doc must name its plan (`status/plan-unnamed`), and no
34
+ other doc may carry one (`status/plan-stale`). Three warnings never fail a run:
35
+ `clause/in-flight`, for an `amending` doc's clauses with no row yet;
36
+ `tag/in-flight`, for a tag on a rowless clause of a `planned` or `amending`
37
+ doc; and `status/plan-missing`, for a `plan:` naming a file that is gone.
38
+ Provenance is never read. Everything else — sizes, index sync, provenance
39
+ style — is judgment, and stays with the `lint` operation in
40
+ `maintaining-primitives`.
41
+
42
+ ## What a change did to the record
43
+
44
+ ```bash
45
+ agent_primitives guard --base main # notices only; exit 0 whenever it ran
46
+ ```
47
+
48
+ `evals` is stateless — it asks whether the tree is well-formed **now**, and a
49
+ whole class of drift passes it green. Reword a clause under the same id, hollow
50
+ out the example proving it, move a browser promise onto a model spec: every link
51
+ stays well-formed while the record stops describing the app. Seeing that needs a
52
+ **before**, so `guard` parses the tree twice — at `--base` and in the working
53
+ tree — and reports what got **smaller or different**. Growth is silent: new
54
+ clauses, new tagged examples, added evaluations and appended provenance produce
55
+ nothing.
56
+
57
+ | Notice | What moved |
58
+ |--------|------------|
59
+ | `intent/rewritten` | a clause promises something else under the same id, with no provenance entry |
60
+ | `intent/vanished` | a clause id is gone with no tombstone |
61
+ | `intent/deactivated` | a clause was superseded or retired — the sanctioned path, still worth seeing |
62
+ | `evaluation/dropped` · `evaluation/relayered` | an active clause is proven by less, or at a layer that may not hold it |
63
+ | `evaluation/moved` | the same layer, a different file — confirm it proves what the old one did |
64
+ | `status/closed-out` | an amendment closed out (`amending` → `built`) — confirm its rows were filed |
65
+ | `proof/removed` · `proof/weakened` · `proof/changed` | a tagged example went, lost assertions, or changed |
66
+ | `doc/removed` · `status/downgraded` · `provenance/rewritten` | the record itself got smaller |
67
+ | `doc/unreadable` | the doc stopped parsing, so nothing about it can be compared |
68
+
69
+ **Everything it prints is a notice and nothing fails.** Each of these has an
70
+ innocent cause as well as a suspicious one — a spec refactor legitimately
71
+ produces most of the proof notices — and a check that stops honest work is a
72
+ check that gets routed around.
73
+
74
+ The split in handling is what makes it useful. **Proof** notices belong to the
75
+ agent that caused them: restore the assertion, the example, or the row, then
76
+ re-run. **Intent** notices belong to the user. Only `intent/rewritten` is ever
77
+ discharged, by a new provenance entry naming the clause id — and an agent
78
+ writing that entry to quiet its own notice has laundered exactly the change
79
+ this exists to surface. Every other intent notice is never discharged: it
80
+ prints on every run until the change is reverted or the user rules on it. Surface
81
+ it instead; only a user decision amends intent
82
+ (`primitives-format` § Ownership and write points).
83
+
84
+ ## Which examples prove a clause
85
+
86
+ ```bash
87
+ agent_primitives proofs 'comment_threads#I2' # a lookup; exit 0 always — quote the `#`
88
+ ```
89
+
90
+ `evals` counts **files**. A clause naming `spec/policies/comment_policy_spec.rb`
91
+ is satisfied by **one** tag in that file — so a clause meant to be proven by four
92
+ denials is green with three tagged, and `guard` is silent too, because an untagged
93
+ new example is growth. That is the gap `proofs` fills: the tagged examples behind
94
+ each clause, per evaluation file, as a listing to hold against the plan's proof
95
+ set.
96
+
97
+ ```
98
+ I3 Only a published stage accepts entries.
99
+ spec/policies/long_list_policy_spec.rb — 3 tagged examples
100
+ :3 allows entry to a published stage 1 assertion
101
+ :11 denies entry to an archived stage 2 assertions
102
+ :16 denies entry to a locked stage 1 assertion
103
+ ```
104
+
105
+ A planned example missing from the listing is found in the spec file and tagged —
106
+ or written. Untagged examples are deliberately **not** printed: they drowned the
107
+ report in any real spec file, and a reader holding the plan already knows which
108
+ example is missing; `--format json` carries them when a step needs the full
109
+ picture. A tag on a `describe` is named as proving nothing rather than listed
110
+ among the proofs — there is no example under it — and the footer counts every
111
+ tag `evals` will reject.
112
+
113
+ **Nothing here is an offence and the exit code is always 0.** Most examples in a
114
+ spec file carry no tag by design — only evaluation examples are tagged — so a
115
+ tagged count is a number to hold against the plan's **Intent impact** entry, which
116
+ names the cases the clause needs. Made a gate it would fire on nearly every file.
117
+ `--since <the ref the task started from>` (`HEAD` while the task is
118
+ uncommitted) prints one counted line per clause whose spec files a change
119
+ touched, untracked files included, which is the shape a task's verify step runs —
120
+ a count that comes up short is drilled into by naming the clause.
121
+
122
+ ## None of these is quiet
123
+
124
+ Every one of them prints. `evals` closes with `6 capabilities, 37 clauses — no
125
+ offences`; `guard` with `compared against <ref>: no change to
126
+ intent or the specs that prove it`; `proofs` with a line per clause, or `no
127
+ intent clauses found`. A real failure prints a Bundler or Ruby stack on stderr.
128
+
129
+ So **an empty result is not a clean run — it is a missing result.** A call that
130
+ came back with no stdout, no stderr and no exit code observed nothing about the
131
+ tree, and "the CLI returned no output" describes the tool bridge, not the CLI.
132
+ The common shape is a subagent: a worker whose shell is withheld (a `readonly`
133
+ agent type) or whose result never arrived.
134
+
135
+ Retry once, then report **`UNVERIFIED (CLI unavailable)`** against the checks
136
+ that did not run, and name what rested on them. Reading the frontmatter and the
137
+ `intent:` tags by hand is a different check and does not discharge this one — a
138
+ hand audit that happens to agree is luck, and recorded as a pass it hides that
139
+ nothing ran.
140
+
141
+ ## Handing the output to a reviewer
142
+
143
+ The arrangement that holds: whoever **can** run them does, once, and hands the
144
+ output over. Whoever runs the plan, dispatching a review, runs the commands and
145
+ pastes their stdout into the review prompt; the reviewer cites that block
146
+ instead of shelling out.
147
+
148
+ Run them yourself first (running these commands to describe scope is
149
+ orchestration, not implementation) and paste their **full stdout** into the
150
+ prompt under the heading **Mechanical primitives output (authoritative — do not
151
+ re-run)**. The reviewer may be read-only and have no shell at all — an empty
152
+ result would read to it as a silent CLI (§ None of these is quiet); running them
153
+ here removes that failure from the loop. Paste verbatim **including the summary
154
+ lines** — a truncated block reads as a clean run. If a command fails in your own
155
+ shell, fix that before dispatching rather than sending the reviewer a gap. No
156
+ tree → say `no primitives tree`.
157
+
158
+ A plan-phase review sends two commands:
159
+
160
+ ```bash
161
+ agent_primitives evals
162
+ agent_primitives guard --base <ref>
163
+ ```
164
+
165
+ An implementation-phase review sends **three** commands, not the plan phase's
166
+ two:
167
+
168
+ ```bash
169
+ agent_primitives evals
170
+ agent_primitives guard --base <the ref this task started from>
171
+ agent_primitives proofs --since <the ref this task started from>
172
+ ```
173
+
174
+ A whole-run review — the final sign-off over every task's combined scope — puts
175
+ `--base` / `--since` at the **branch point** so the block covers the whole run.
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: tagging-intent
3
+ description: >-
4
+ Tag the RSpec example that proves an intent clause with intent: metadata, and
5
+ judge whether an evaluation actually proves its clause. Use when writing,
6
+ moving, merging, or deleting a spec in an app with a docs/primitives/ tree, or
7
+ when deciding which examples a clause needs.
8
+ ---
9
+
10
+ # Intent Tags
11
+
12
+ **Announce:** "I'm using the tagging-intent skill."
13
+
14
+ ## Tagging the Intent a Spec Proves
15
+
16
+ When the app has a **`docs/primitives/`** tree, the example that proves an intent
17
+ clause carries the clause id as RSpec metadata:
18
+
19
+ ```ruby
20
+ it "shows replies nested under their parent", intent: "comment_threads#I2" do
21
+ ```
22
+
23
+ The capability is the doc's filename without `.md`
24
+ (`primitives-format`). One example can carry several
25
+ clauses as a list — `intent: %w[comment_threads#I2 comment_threads#I3]` — and a
26
+ clause proven by four examples is tagged on all four.
27
+
28
+ - **On the example, never on the group.** A tag on a `describe`, `context`, or
29
+ `shared_examples` is an offence — an intent-tag lint cop, where the app has
30
+ one, at lint time, `tag/misplaced` from `agent_primitives evals`. A group tag
31
+ can lie: delete
32
+ the example it stood for and its siblings keep the group green, so the clause
33
+ still claims a proof that no longer exists.
34
+ - **Only evaluation examples are tagged.** Most specs prove behaviour without
35
+ proving a *clause*; those stay untagged. Tagging everything makes the map
36
+ useless.
37
+ - The capability doc's `evaluations:` must list the spec file, and the file must
38
+ carry the tag. **`agent_primitives evals`** checks both directions and fails when either
39
+ side drifts.
40
+ - **Tagging all four is a rule, not a check.** `evals` counts files: one tag makes
41
+ the whole file a carrier, so a clause meant to be proven by four denials goes
42
+ green with three tagged, and `guard` says nothing either — an untagged new
43
+ example is growth. **`agent_primitives proofs '<capability>#I<n>'`** is what
44
+ shows the fourth: it lists the tagged examples behind the clause, per
45
+ evaluation file. Read the listing against the plan's **Intent impact** entry,
46
+ which names the cases — a case the entry names that is missing from the listing
47
+ is found in the spec file and tagged, or written. Nothing it prints is an
48
+ offence — most examples in a spec file are untagged by design.
49
+ - **`agent_primitives proofs --since <the ref the task started from>`**
50
+ (`HEAD` while the task is uncommitted) prints one counted line per
51
+ clause a change touched, which is what a task's verify step runs before
52
+ reporting — a count that comes up short is drilled into by naming the clause.
53
+ - The tag is also a selector — `bundle exec rspec --tag 'intent:comment_threads#I2'`
54
+ runs exactly the proof.
55
+
56
+ Metadata rather than a comment for that reason: renaming an example cannot break
57
+ the link, and deleting it breaks the link loudly.
58
+
59
+ ## What counts as proving a clause
60
+
61
+ `agent_primitives evals` only checks a tag is well-formed — clause exists,
62
+ example carries the tag. Whether the example **proves** the clause is judgment.
63
+ The test:
64
+
65
+ > **An evaluation proves a clause when breaking the clause turns it red.**
66
+
67
+ If the behaviour could regress while the tagged example still passes, the tag
68
+ is decoration and the clause is unproven behind a green run.
69
+
70
+ Three ways a tag fails that test:
71
+
72
+ 1. **It asserts the affordance, not the outcome.** The form renders, the button
73
+ is on the page, the request came back `200` — strip the behaviour out and the
74
+ example still passes. Assert the outcome the clause names.
75
+ 2. **It proves one case, not the quantifier.** Clause sentences carry scope —
76
+ *any*, *every*, *never*, *only*, *at most*. A happy path proves the
77
+ existential case only. "Never nests deeper than three" is unproven until
78
+ something tries for four.
79
+ 3. **It proves the clause at a layer that cannot hold it.** Denials, role
80
+ matrices, and boundaries have owners in the app's testing conventions for
81
+ which spec layer owns a behaviour. Bolting "and the other user cannot" onto a
82
+ canonical journey gives the journey a second story *and* still leaves the
83
+ matrix uncovered.
84
+
85
+ So a clause often needs **more than one evaluation, across more than one
86
+ layer** — that is normal, not duplication:
87
+
88
+ ```ruby
89
+ # Clause: articles#I3 — Only the author can edit an article.
90
+
91
+ # bad — tagged, green, and half the clause is untested. Nothing here would
92
+ # go red if every reader could suddenly edit.
93
+ # spec/system/articles_spec.rb
94
+ it "lets the author edit their article", intent: "articles#I3" do
95
+
96
+ # good — the permission and the denial, each at the layer that owns it
97
+ # spec/policies/article_policy_spec.rb
98
+ it "denies edit to a reader who is not the author", intent: "articles#I3" do
99
+ # spec/requests/articles_spec.rb
100
+ it "redirects a non-author away from edit", intent: "articles#I3" do
101
+ ```
102
+
103
+ `evaluations:` on that clause then lists both files. A clause whose evaluations
104
+ all sit in one happy-path example, when its wording claims a universal or a
105
+ denial, is a finding at review — not a passing row.
106
+
107
+ **Sufficient as a set, necessary individually.** The red test asks whether the
108
+ evaluations are *enough*; the inverse question is **could you delete this
109
+ evaluation and still have the clause fully proven?** If yes, it is padding, and
110
+ the tag comes off.
111
+
112
+ Past about three evaluations, suspect the clause rather than the coverage — a
113
+ sentence needing four separate proofs is usually two promises wearing one id
114
+ (`primitives-format` § Size discipline).
115
+
116
+ A clause that **no** spec could falsify is not a clause at all: it is a Shape
117
+ bullet, or an aspiration. Send it back rather than tagging something adjacent to
118
+ it (`primitives-format` § Intent clauses).
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: agent_primitives
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Bellairs
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: Checks that every intent clause in an app's docs/primitives/ tree is
13
+ proven by a tagged RSpec example, reports what a change did to that record, and
14
+ imports the skills that teach a coding agent to keep it.
15
+ email:
16
+ - chris@pitchd.ai
17
+ executables:
18
+ - agent_primitives
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - CHANGELOG.md
23
+ - LICENSE
24
+ - README.md
25
+ - exe/agent_primitives
26
+ - lib/agent_primitives.rb
27
+ - lib/agent_primitives/cli.rb
28
+ - lib/agent_primitives/evals.rb
29
+ - lib/agent_primitives/evals/capability.rb
30
+ - lib/agent_primitives/evals/finding.rb
31
+ - lib/agent_primitives/evals/proofs.rb
32
+ - lib/agent_primitives/evals/tags.rb
33
+ - lib/agent_primitives/guard.rb
34
+ - lib/agent_primitives/guard/baseline.rb
35
+ - lib/agent_primitives/importer.rb
36
+ - lib/agent_primitives/proof_report.rb
37
+ - lib/agent_primitives/version.rb
38
+ - skills/backfilling-primitives/SKILL.md
39
+ - skills/bootstrapping-primitives/SKILL.md
40
+ - skills/closing-out-primitives/SKILL.md
41
+ - skills/integrating-primitives/SKILL.md
42
+ - skills/maintaining-primitives/SKILL.md
43
+ - skills/maintaining-primitives/references/templates.md
44
+ - skills/planning-with-primitives/SKILL.md
45
+ - skills/primitives-format/SKILL.md
46
+ - skills/reviewing-primitives/SKILL.md
47
+ - skills/running-primitives-checks/SKILL.md
48
+ - skills/tagging-intent/SKILL.md
49
+ homepage: https://github.com/pitch-sourcery/agent_primitives
50
+ licenses:
51
+ - MIT
52
+ metadata:
53
+ homepage_uri: https://github.com/pitch-sourcery/agent_primitives
54
+ source_code_uri: https://github.com/pitch-sourcery/agent_primitives
55
+ changelog_uri: https://github.com/pitch-sourcery/agent_primitives/blob/main/CHANGELOG.md
56
+ rubygems_mfa_required: 'true'
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '3.3'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements: []
71
+ rubygems_version: 4.0.20
72
+ specification_version: 4
73
+ summary: Durable intent for coding agents — capability docs proven by tagged specs.
74
+ test_files: []