@olegkoval/agent-skills 1.91.0 → 1.93.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.
Files changed (51) hide show
  1. package/.github/prompts/self-critique.prompt.md +90 -232
  2. package/adapters/claude/olko-github-pr/skills/lekker-review/SKILL.md +13 -7
  3. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/model-matrix.mjs +20 -15
  4. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/run-log.mjs +21 -0
  5. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/selftest.mjs +17 -1
  6. package/adapters/claude/olko-reflection/skills/self-critique/SKILL.md +90 -232
  7. package/adapters/claude/olko-reflection/skills/self-critique/references/rules.md +67 -0
  8. package/adapters/claude/olko-reflection/skills/self-critique/references/scoring.md +99 -0
  9. package/adapters/claude/olko-reflection/skills/self-critique/references/setup.md +62 -0
  10. package/adapters/claude/olko-reflection/skills/self-critique/scripts/claim-ledger.mjs +152 -9
  11. package/adapters/claude/olko-reflection/skills/self-critique/scripts/rule-store.mjs +34 -12
  12. package/adapters/claude/olko-reflection/skills/self-critique/scripts/run-store.mjs +133 -0
  13. package/adapters/cursor/olko-reflection/skills/self-critique/SKILL.md +90 -232
  14. package/adapters/cursor/olko-reflection/skills/self-critique/references/rules.md +67 -0
  15. package/adapters/cursor/olko-reflection/skills/self-critique/references/scoring.md +99 -0
  16. package/adapters/cursor/olko-reflection/skills/self-critique/references/setup.md +62 -0
  17. package/adapters/cursor/olko-reflection/skills/self-critique/scripts/claim-ledger.mjs +152 -9
  18. package/adapters/cursor/olko-reflection/skills/self-critique/scripts/rule-store.mjs +34 -12
  19. package/adapters/cursor/olko-reflection/skills/self-critique/scripts/run-store.mjs +133 -0
  20. package/adapters/grok/olko-reflection/skills/self-critique/SKILL.md +90 -232
  21. package/adapters/grok/olko-reflection/skills/self-critique/references/rules.md +67 -0
  22. package/adapters/grok/olko-reflection/skills/self-critique/references/scoring.md +99 -0
  23. package/adapters/grok/olko-reflection/skills/self-critique/references/setup.md +62 -0
  24. package/adapters/grok/olko-reflection/skills/self-critique/scripts/claim-ledger.mjs +152 -9
  25. package/adapters/grok/olko-reflection/skills/self-critique/scripts/rule-store.mjs +34 -12
  26. package/adapters/grok/olko-reflection/skills/self-critique/scripts/run-store.mjs +133 -0
  27. package/package.json +1 -1
  28. package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
  29. package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
  30. package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
  31. package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
  32. package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
  33. package/plugins/olko-github-pr/skills/lekker-review/README.md +18 -11
  34. package/plugins/olko-github-pr/skills/lekker-review/SKILL.md +13 -7
  35. package/plugins/olko-github-pr/skills/lekker-review/scripts/model-matrix.mjs +20 -15
  36. package/plugins/olko-github-pr/skills/lekker-review/scripts/run-log.mjs +21 -0
  37. package/plugins/olko-github-pr/skills/lekker-review/scripts/selftest.mjs +17 -1
  38. package/plugins/olko-github-pr/skills/lekker-review/workflow.js +25 -2
  39. package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
  40. package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
  41. package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
  42. package/plugins/olko-reflection/skills/self-critique/SKILL.md +90 -232
  43. package/plugins/olko-reflection/skills/self-critique/references/rules.md +67 -0
  44. package/plugins/olko-reflection/skills/self-critique/references/scoring.md +99 -0
  45. package/plugins/olko-reflection/skills/self-critique/references/setup.md +62 -0
  46. package/plugins/olko-reflection/skills/self-critique/scripts/claim-ledger.mjs +152 -9
  47. package/plugins/olko-reflection/skills/self-critique/scripts/rule-store.mjs +34 -12
  48. package/plugins/olko-reflection/skills/self-critique/scripts/run-store.mjs +133 -0
  49. package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
  50. package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
  51. package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
@@ -20,16 +20,12 @@ Run an adversarial review of **your own previous answer** and report the result
20
20
 
21
21
  ## Overview
22
22
 
23
- A confident answer is not a verified one. This skill turns your last substantial reply into the
24
- subject of a hostile review: a separate critic agent tries to refute it against live sources, hunts
25
- for the related issue or pattern you missed, and scores it. You then revise and re-score until the
26
- score stops moving, report the outcome honestly, including where you were wrong, and convert what
27
- the critic caught into a rule that survives the session.
28
-
29
- The point is to surface error before the user does, to make "is this actually right?" a measured
30
- quantity instead of a vibe, and to make the same mistake cost less the second time than it did the
31
- first. A critique that ends at a score has bought one corrected answer. A critique that ends at a
32
- durable rule has bought every answer after it.
23
+ A confident answer is not a verified one. A separate critic agent tries to refute your last answer
24
+ against live sources and hunts for the related issue or pattern you missed. The score is computed
25
+ from a labelled claim ledger. You revise under a ratchet, report honestly including where you were
26
+ wrong, and convert what the critic caught into a rule that survives the session. A critique that ends
27
+ at a score has bought one corrected answer; one that ends at a durable rule has bought every answer
28
+ after it.
33
29
 
34
30
  ## When to Use
35
31
 
@@ -41,174 +37,120 @@ durable rule has bought every answer after it.
41
37
  Do not use for trivial one-shot replies or simple chat. The overhead only pays off on load-bearing
42
38
  answers.
43
39
 
44
- **Standalone Cursor installation.** Use the generated Cursor adapter or the full skill package,
45
- including its `scripts/` directory. Copying only `SKILL.md` is insufficient for this workflow,
46
- which calls the bundled scripts.
40
+ Setup notes (state dir, Cursor install, the optional Stop-hook nudge): `references/setup.md`.
41
+ Penalties, anchors, ledger shape and integrity checks: `references/scoring.md`.
47
42
 
48
43
  ## Procedure
49
44
 
50
45
  1. **Snapshot the target.** Capture your last substantial answer verbatim and the original task
51
- text. This is `v1`.
46
+ text. This is `v1`. Create the run folder (outside the repo, one per run) and use it for every
47
+ file below:
48
+
49
+ ```bash
50
+ RUN=$(node <skill>/scripts/run-store.mjs new --cwd "$PWD")
51
+ ```
52
52
 
53
53
  Write your claim list before you re-read the answer's prose, and put a real receipt against each
54
54
  claim: a quoted field, a `file:line` whose body you actually opened, a command and its output.
55
- A claim you cannot receipt at snapshot time is already a finding - mark it `unverifiable` yourself
55
+ A claim you cannot receipt at snapshot time is already a finding: mark it `unverifiable` yourself
56
56
  rather than waiting for the critic to find it. Grep output, a file name, a path, an endpoint
57
- string, or the behaviour of a sibling module are not receipts for what code does; they prove
58
- those things exist, not what they do.
59
-
60
- Save the list to `.self-critique/author-claims.json` as an array of
61
- `{ id, text, load_bearing, receipt }`. Do NOT show it to the critic in round one.
62
-
63
- **Replay pass.** Before spawning the critic, check the answer against every stored rule. Resolve
64
- the memory dir as the auto-memory dir for the current project, else the repo's `.claude/memory`;
65
- if neither exists, skip replay, evidence-check, and prune with a one-line note. Run
66
- `node <skill>/scripts/rule-store.mjs checklist --dir <memory dir>`, then open each listed rule's
67
- memory file and read its body before testing the answer against it. The checklist's names and
68
- descriptions alone are insufficient. Tag each hit `(recurring)` in the report and record it with
57
+ string, or the behaviour of a sibling module are not receipts for what code does.
58
+
59
+ Save the list to `$RUN/author-claims.json` as an array of `{ id, text, load_bearing, receipt }`.
60
+ Do NOT show it to the critic in round one.
61
+
62
+ **Replay pass.** Before spawning the critic, check the answer against this skill's own rules.
63
+ Resolve the memory dir as the auto-memory dir for the current project, else the repo's
64
+ `.claude/memory`; if neither exists, skip replay, evidence-check, and prune with a one-line note.
65
+ Run `node <skill>/scripts/rule-store.mjs checklist --dir <memory dir>`. It lists only rules marked
66
+ `rule_store: self-critique`; open only those files and read each body before testing the answer
67
+ against it (names and descriptions alone are insufficient). Do not read the rest of the memory
68
+ dir. Tag each hit `(recurring)` in the report and record it with
69
69
  `node <skill>/scripts/rule-store.mjs fire <name> --dir <memory dir> --date <today>`.
70
- Fire counters and pruning apply only to rules in this memory directory. Rules routed to
71
- `CLAUDE.md`, `AGENTS.md`, or the shared store are neither counted nor pruned.
72
70
 
73
71
  2. **Spawn the critic (blind).** Launch one independent agent with live-source access (issue tracker,
74
72
  code host, error monitor, the repo). Round one input is the original task text and the answer
75
73
  verbatim, nothing else: the critic extracts the claims itself and never sees your list or sources.
76
- Use the prompt template below. The critic must return one fenced JSON block with `claims` (its own
77
- list, each `{ text, load_bearing, status, checked_by, receipt }`), `missed`, `where_wrong`,
78
- `shapes` and `verdict` (AGREE / AGREE-WITH-CAVEATS / DISAGREE). There is no `score` field: the
79
- score is computed in Step 2b.
74
+ Use the prompt template below. The critic returns one fenced JSON block with `claims`, `missed`,
75
+ `where_wrong`, `shapes` and `verdict`. There is no `score` field. **Save the returned JSON
76
+ verbatim** as `$RUN/critic-r<N>.json` (N is the round); the ledger is checked against it.
80
77
 
81
78
  2b. **Merge into the ledger.** Match the critic's claims to yours by meaning and set `origin` on
82
- each: `both`, `author` (only you found it), `critic` (only the critic found it). Every critic
83
- finding with `checked_by: inferred` must be re-verified by you before it may become `verified`
84
- or `refuted`; if you cannot verify it, it stays `inferred`. Both statuses require
85
- `checked_by: command` or `checked_by: read` and a non-empty receipt; validation rejects inferred evidence or a missing
86
- receipt. Save `.self-critique/ledger-v1.json`, then run
87
- `node <skill>/scripts/claim-ledger.mjs score .self-critique/ledger-v1.json` and
88
- `node <skill>/scripts/claim-ledger.mjs summary .self-critique/ledger-v1.json` (an invalid ledger
89
- exits 2 and prints the errors as JSON).
90
- Claims found by only one side are reported under their own heading, "Asymmetric claims".
91
-
92
- Ledger shape (`version` is always `1`):
93
-
94
- ```json
95
- { "version": 1,
96
- "claims": [{ "id": "c1", "text": "...", "load_bearing": true, "origin": "both",
97
- "status": "verified", "checked_by": "command", "receipt": "quoted output" }],
98
- "missed": [{ "id": "m1", "text": "...", "load_bearing": false, "checked_by": "read" }] }
79
+ each: `both`, `author` (only you found it), `critic` (only the critic found it). Every entry
80
+ carries its link back: `author_id` (the id in `author-claims.json`) for `author` and `both`,
81
+ `critic_ref` (`"r1:claims.3"` or `"r1:missed.1"`) for `critic` and `both` and on every `missed`
82
+ entry. Nothing from either side may be left out: every author claim and every critic item needs
83
+ an entry. Every critic finding with `checked_by: inferred` must be re-verified by you before it
84
+ may become `verified` or `refuted`; if you cannot, it stays `inferred` (and costs the same as
85
+ unverifiable when load-bearing). Save `$RUN/ledger-v1.json`, then run, always with all three
86
+ flags that apply (`--prev` from round two on):
87
+
88
+ ```bash
89
+ node <skill>/scripts/claim-ledger.mjs score $RUN/ledger-v1.json \
90
+ --author $RUN/author-claims.json --critic r1=$RUN/critic-r1.json [--prev $RUN/ledger-v<N-1>.json]
91
+ node <skill>/scripts/claim-ledger.mjs summary $RUN/ledger-v1.json
99
92
  ```
100
93
 
101
- - `origin`: `author` | `critic` | `both`
102
- - `status`: `verified` | `refuted` | `unverifiable` | `inferred`
103
- - `checked_by`: `command` (run, output quoted) | `read` (file or record opened, quoted) |
104
- `inferred` (reasoning only). Required on `missed` items too; an `inferred` missed item is not
105
- penalised. A `verified` or `refuted` claim may not use inferred evidence and requires a
106
- non-empty receipt.
107
-
108
- 3. **Decide and loop.** Accept a score of at least 90 only after all fixable findings are resolved
109
- or explicitly qualified in the answer and report; otherwise continue the critique loop. Stop
110
- when that condition holds, OR no ledger item is left that a revision could fix, OR 3 rounds have run.
111
- Otherwise revise the answer to produce `v2`, write `ledger-v2.json`, and run
112
- `node <skill>/scripts/claim-ledger.mjs ratchet .self-critique/ledger-v1.json .self-critique/ledger-v2.json`
113
- on the previous and new ledger: a lower re-score discards the revision, and you keep the winner. Round
114
- two and later hand the critic your receipts for the still-open claims (it is no longer blind).
115
- **Hard cap: 3 critic rounds.** (A known ceiling: raise it only if a round is still finding real,
116
- fixable defects.)
94
+ A ledger that drops a claim, cites a missing critic item, or loses an id from the previous round
95
+ exits 2 with the errors as JSON: fix the ledger, not the check. Output with
96
+ `"integrity": "unchecked"` was run without those flags and may not be reported as a score.
97
+ Claims found by only one side go under "Asymmetric claims".
98
+
99
+ 3. **Decide and loop.** After each round run
100
+ `node <skill>/scripts/claim-ledger.mjs status $RUN/ledger-v1.json [$RUN/ledger-v2.json ...]`.
101
+ It prints `first_score`, `final_score`, `trajectory`, `open` (`load_bearing` and `other` counts)
102
+ and `done`. **Stop when** `done` is true (no load-bearing claim is refuted, unverifiable or
103
+ inferred, and no load-bearing missed item remains, inferred ones included), OR nothing left open can be fixed by a
104
+ revision (say why in "Declined findings"), OR 3 rounds have run. There is no score threshold:
105
+ the critic-only penalty can never be revised away, so a score target would loop on nothing.
106
+
107
+ Otherwise revise the answer to produce `v2`, write `$RUN/ledger-v2.json` (it keeps every earlier
108
+ claim id), and run
109
+ `node <skill>/scripts/claim-ledger.mjs ratchet $RUN/ledger-v1.json $RUN/ledger-v2.json --author $RUN/author-claims.json --critic r1=$RUN/critic-r1.json --critic r2=$RUN/critic-r2.json`.
110
+ A lower re-score discards the revision and you keep the winner. Round two and later hand the
111
+ critic your receipts for the still-open claims (it is no longer blind). **Hard cap: 3 critic
112
+ rounds.**
117
113
 
118
114
  **Cost.** The critic runs on a mid-tier model (Sonnet class) by default. Escalate one tier only
119
115
  when a mid-tier round found nothing and the answer is load-bearing. When the budget is tight,
120
116
  verify load-bearing claims first.
121
117
 
122
- 4. **Report, always, even after a single round.** In this order:
123
- - **Corrected answer (`v_final`)** - restated in full, not as a diff, so the user can act on it
124
- without reading anything else. After a single round with no revision, restate `v1` unchanged.
125
- - **Claim ledger** - run `node <skill>/scripts/claim-ledger.mjs summary <ledger for v_final>`
126
- and `node <skill>/scripts/claim-ledger.mjs score <ledger for v_final>` using the ledger for
127
- whichever version the ratchet accepted (for example, `.self-critique/ledger-v2.json`). Report
128
- that table and its computed score.
118
+ 4. **Report, always, even after a single round.** Lead with two numbers, then the rest in order:
119
+ - **Headline** - the first-answer score (round 1, what the user would have got without this
120
+ skill) and the open-defect count from `status` (load-bearing and other). The first-answer
121
+ score is the honest quality number; the final score only measures the revision.
122
+ - **Corrected answer (`v_final`)** - restated in full, not as a diff. After a single round with
123
+ no revision, restate `v1` unchanged and label it unrevised. If load-bearing defects are still
124
+ open, give their count and the stop reason beside it; never call that outcome clean.
125
+ - **Score trajectory** - for example `72 -> 88 -> 94 (+22 pts)`, all computed. If only one round
126
+ ran with `done` true, state `no revision needed`; if it stopped with load-bearing defects open, say that instead. Add the trend from
127
+ `node <skill>/scripts/run-store.mjs history --cwd "$PWD"` (first-answer score per run).
128
+ - **Claim ledger** - the `summary` table for the ledger the ratchet kept, and its `score` with
129
+ `integrity: checked`.
129
130
  - **Where you were wrong** - consolidated, each item with the receipt the critic cited.
130
131
  - **Asymmetric claims** - claims only you found, and claims only the critic found.
131
132
  - **Recurring rules fired** - each stored rule the replay pass hit, with its new `fires` count.
132
- - **Iterations to satisfy** - how many critic rounds it took (1 means it was solid first pass).
133
- - **Score trajectory** - for example `72 -> 88 -> 94 (+22 pts)`, all computed scores. If only one
134
- round ran, state `no revision needed`.
133
+ - **Iterations to satisfy** - how many critic rounds it took (1 with `done` true means it was solid first pass).
135
134
  - **Unverifiable** - anything you should not present as fact.
136
135
  - **Declined findings** - ledger items you chose not to fix, with the reason. Silently dropping
137
136
  one looks identical to missing it.
138
- - **Rules written** - where each rule went and what it says (see Step 5).
139
- - **Rules proposed for deletion** - the candidates from the prune pass, or `none`.
140
-
141
- 5. **Convert the outcome into a durable rule.** See below. Skipping this step is what makes the
142
- same critique necessary again next week.
143
-
144
- ## Step 5: turn the critique into something that outlives the session
145
-
146
- A score is a measurement, not an improvement. The improvement is the rule you write down, in a
147
- place a future session actually reads, before you move on.
148
-
149
- **Not every finding earns a rule.** Write one only when the finding passes both gates:
150
-
151
- - **Recurrence** - the same *shape* of mistake could plausibly happen again on a different task.
152
- - **Cost** - it would have reached the user, cost real rework, or damaged their credibility with
153
- someone else.
154
-
155
- A one-off factual slip, a typo, or a finding fully explained by this task's specifics fails both.
156
- Writing a rule for it pollutes the store, and a littered store is worse than a thin one, because
157
- the next session stops reading it.
158
-
159
- **Write the shape, not the incident.** The incident is the evidence; the shape is the rule. Ask
160
- what class of reasoning produced the error, then name that class:
161
-
162
- | Incident | Shape worth keeping |
163
- | --- | --- |
164
- | Called an endpoint a read because the path was a noun and a sibling module imported | A conclusion drawn from evidence that does not cover the claim |
165
- | Priced an open design question as "small" in the same sentence that asked which design was wanted | Never attach a size to an answer you are simultaneously asking for |
166
- | Described a batch from the one member that was checked | Check the risk-deciding field on every member before describing the set |
167
-
168
- **Route it to the narrowest store the host has**, in this order, and only one of them:
169
-
170
- 1. The user's or project's agent memory, when the rule is about how to work with this user or this
171
- project.
172
- 2. The repository's own `CLAUDE.md` / `AGENTS.md`, when the rule is true only inside that codebase.
173
- 3. A shared, cross-session store, when the rule holds across projects. Use `context-repo` to resolve
174
- it, or `shared-knowledge-artifact` when several agents need to read the same ledger.
175
-
176
- Broadening a rule's scope so it qualifies for a wider store is the failure mode to avoid: one
177
- incident on one afternoon is not standing policy. Let the evidence decide where it lands.
178
-
179
- **Each rule carries three things.** Without all three the next session cannot act on it:
137
+ - **Rules written** and **Rules proposed for deletion** (Step 5), or `none`.
180
138
 
181
- - **The rule**, stated as the shape, in the imperative.
182
- - **Why**, with the incident and its receipt, dated. A rule with no cost attached gets argued away.
183
- - **How to apply**, naming the moment the rule fires ("before drafting outbound text", "before
184
- describing a batch"), not just the principle.
139
+ 5. **Convert the outcome into a durable rule.** Skipping this step is what makes the same critique
140
+ necessary again next week. Write a rule only when the finding passes both gates:
185
141
 
186
- Before writing to shared persistence, redact the incident evidence, including when using
187
- `context-repo` or `shared-knowledge-artifact`, while still including the incident and its dated
188
- receipt. This redaction requirement does not apply to local agent memory or repository-rule writes.
142
+ - **Recurrence** - the same *shape* of mistake could plausibly happen again on a different task.
143
+ - **Cost** - it would have reached the user, cost real rework, or damaged their credibility.
189
144
 
190
- **Dedupe before writing.** Read the store first. If a rule of the same shape exists, add one dated
191
- evidence line to it instead of creating a second entry, with at most three evidence lines per rule.
192
- A fourth incident means the rule named the incident, not the shape: rewrite the rule text and keep
193
- the three most recent evidence lines. Link related rules instead of restating them. Only when the
194
- memory directory resolved in Step 1 exists, run
195
- `node <skill>/scripts/rule-store.mjs evidence-check --dir <memory dir>` before writing and report
196
- any rule it flags. Skip this command when neither supported memory directory exists.
197
-
198
- **Memory rule identity and counters.** Mark each rule stored by this workflow with
199
- `rule_store: self-critique` under `metadata:` in its memory file's frontmatter. Mark an existing
200
- rule only after reading it and confirming it belongs to this workflow. Only marked rules are
201
- pruning candidates; unrelated project and user memories are excluded. A memory rule's `fires` and
202
- `last_fired` live under `metadata:` and are written only by `fire`. Rules routed to `CLAUDE.md`,
203
- `AGENTS.md`, or the shared store are neither counted nor pruned.
204
-
205
- **Prune pass.** At the end of this step, only when a valid memory directory is available, run
206
- `node <skill>/scripts/rule-store.mjs prune --dir <memory dir> --idle-days 60`. List the candidates
207
- in the report under "Rules proposed for deletion". Skip this command when neither supported memory
208
- directory exists. Never delete a rule without the user's reply.
209
-
210
- **Then close the loop.** State in your report where the rule was written and what it says, so the
211
- user can veto it. A rule the user has not seen is a rule they cannot correct.
145
+ A one-off factual slip, a typo, or a finding fully explained by this task's specifics fails both;
146
+ a littered store is worse than a thin one. Write the shape (the class of reasoning that produced
147
+ the error), not the incident. Route it to the narrowest store, in this order, and only one:
148
+ (1) the user's or project's agent memory, (2) the repo's `CLAUDE.md` / `AGENTS.md`, (3) a shared
149
+ cross-session store. Each rule carries three things: **the rule** in the imperative, **why** (the
150
+ incident, dated, with its receipt), and **how to apply** (the moment it fires). Mark memory rules
151
+ `rule_store: self-critique`, dedupe before writing, run the prune pass, and tell the user what you
152
+ wrote so they can veto it. Shapes table, routing detail, dedupe, redaction, identity and the
153
+ prune pass: `references/rules.md`.
212
154
 
213
155
  ## Critic prompt template
214
156
 
@@ -256,98 +198,14 @@ the default stance is that the answer is wrong until a live source proves otherw
256
198
  >
257
199
  > Do not output a score. It is computed from your claims.
258
200
 
259
- ### Score anchors
260
-
261
- The score is `100` minus penalties, floored at 0. Calibrate against these three ledgers (all claims
262
- `origin: both`; `node <skill>/scripts/claim-ledger.mjs anchors` prints them as JSON).
263
-
264
- **Strong, score 95**
265
-
266
- | id | load_bearing | status | checked_by |
267
- | --- | --- | --- | --- |
268
- | a1 | no | inferred | inferred |
269
-
270
- **Middling, score 72**
271
-
272
- | id | load_bearing | status | checked_by |
273
- | --- | --- | --- | --- |
274
- | b1 | no | refuted | read |
275
- | b2 | no | refuted | read |
276
- | b3 | no | unverifiable | read |
277
- | b4 | no | unverifiable | read |
278
-
279
- **Weak, score 40**
280
-
281
- | id | load_bearing | status | checked_by |
282
- | --- | --- | --- | --- |
283
- | c1 | yes | refuted | read |
284
- | c2 | yes | refuted | read |
285
- | c3 | yes | unverifiable | read |
286
-
287
- Penalties:
288
-
289
- | Finding | Points off |
290
- | --- | --- |
291
- | refuted, load-bearing | 25 |
292
- | refuted | 10 |
293
- | unverifiable, load-bearing | 10 |
294
- | unverifiable | 4 |
295
- | inferred, accepted | 5 |
296
- | missed, load-bearing | 15 |
297
- | missed | 5 |
298
- | verified but found only by the critic | 5 |
299
-
300
- ## Optional: auto-offer via a Claude Code Stop hook
301
-
302
- A hook is a shell command, so it cannot run this loop itself. What it can do is **nudge**: after a
303
- substantial answer, it offers the review and you run the skill only if the user says yes.
304
-
305
- The hook ships with this skill at `scripts/critique-nudge.mjs`. Register it as a `Stop` hook in your
306
- Claude Code settings (`.claude/settings.json` for a team, `.claude/settings.local.json` for
307
- yourself):
308
-
309
- ```json
310
- {
311
- "hooks": {
312
- "Stop": [
313
- {
314
- "hooks": [
315
- {
316
- "type": "command",
317
- "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/critique-nudge.mjs\"",
318
- "timeout": 15
319
- }
320
- ]
321
- }
322
- ]
323
- }
324
- }
325
- ```
326
-
327
- Copy `scripts/critique-nudge.mjs` to `.claude/hooks/critique-nudge.mjs` (or point the command at
328
- wherever you keep it). After an answer whose final prose is at least 1500 characters, the hook blocks
329
- the turn once and instructs the agent to append a one-line "critical-thinking review" offer, then
330
- stop. Two loop guards keep it from firing forever: it does nothing when `stop_hook_active` is set, and
331
- nothing when the answer already contains the offer phrase. On any malformed input it exits silently
332
- and never blocks the user.
333
-
334
- The 1500-character threshold is a heuristic with a known ceiling: it misses short but dense
335
- tool-heavy turns. If that matters, extend the script to also count tool calls since the last user
336
- message.
337
-
338
201
  ## Notes
339
202
 
340
- - One critic round is fine and common. If the answer was already solid, report
203
+ - One critic round is fine and common. If the answer was already solid (`done` true), report
341
204
  `iterations: 1, no revision needed` and the single score rather than forcing a revision.
342
205
  - Diversity beats redundancy: if a claim can fail in more than one way, give the critic distinct
343
206
  lenses (correctness, completeness, does-it-reproduce) instead of repeating the same check.
344
207
  - The critic verifies against live sources; it does not rewrite the answer or score it. You revise;
345
208
  the score is recomputed from the ledger.
346
- - In round two, hand the critic your receipts for the claims still open, so it spends its budget on
347
- the claims still standing instead of re-deriving the ones already settled.
348
209
  - A critic finding you disagree with is worth one challenge. Put the reasoning to it and let it rule;
349
210
  if it concedes, that is a real answer for the report, and the reasoning is what the user needs to
350
211
  see either way.
351
- - The honest test of Step 5 is not that a rule was written, it is that the next task of the same
352
- class does not need this skill to catch the same thing. If it does, the rule named the incident
353
- instead of the shape - rewrite it, do not add another.
@@ -0,0 +1,67 @@
1
+ # Turning a critique into a durable rule (Step 5 detail)
2
+
3
+ A score is a measurement, not an improvement. The improvement is the rule you write down, in a
4
+ place a future session actually reads, before you move on.
5
+
6
+ ## Write the shape, not the incident
7
+
8
+ The incident is the evidence; the shape is the rule. Ask what class of reasoning produced the
9
+ error, then name that class:
10
+
11
+ | Incident | Shape worth keeping |
12
+ | --- | --- |
13
+ | Called an endpoint a read because the path was a noun and a sibling module imported | A conclusion drawn from evidence that does not cover the claim |
14
+ | Priced an open design question as "small" in the same sentence that asked which design was wanted | Never attach a size to an answer you are simultaneously asking for |
15
+ | Described a batch from the one member that was checked | Check the risk-deciding field on every member before describing the set |
16
+
17
+ Broadening a rule's scope so it qualifies for a wider store is the failure mode to avoid: one
18
+ incident on one afternoon is not standing policy. Let the evidence decide where it lands.
19
+
20
+ ## Routing, in order, only one store
21
+
22
+ 1. The user's or project's agent memory: how to work with this user or this project.
23
+ 2. The repository's own `CLAUDE.md` / `AGENTS.md`: true only inside that codebase.
24
+ 3. A shared, cross-session store: holds across projects. Use `context-repo` to resolve it, or
25
+ `shared-knowledge-artifact` when several agents need to read the same ledger.
26
+
27
+ Before writing to shared persistence, redact the incident evidence, including when using
28
+ `context-repo` or `shared-knowledge-artifact`, while still including the incident and its dated
29
+ receipt. This does not apply to local agent memory or repository-rule writes.
30
+
31
+ ## Dedupe
32
+
33
+ Read the store first. If a rule of the same shape exists, add one dated evidence line to it instead
34
+ of creating a second entry, with at most three evidence lines per rule. A fourth incident means the
35
+ rule named the incident, not the shape: rewrite the rule text and keep the three most recent
36
+ evidence lines. Link related rules instead of restating them. When the memory directory exists, run
37
+ `node <skill>/scripts/rule-store.mjs evidence-check --dir <memory dir>` before writing and report
38
+ any rule it flags.
39
+
40
+ ## Identity and counters
41
+
42
+ Mark each rule stored by this workflow with `rule_store: self-critique` under `metadata:` in its
43
+ memory file's frontmatter. The replay pass reads only marked rules, and only marked rules are
44
+ pruning candidates. `fire` adds the marker itself, so a rule that has fired is always both counted
45
+ and prunable. A rule's `fires` and `last_fired` live under `metadata:` and are written only by
46
+ `fire`. Rules routed to `CLAUDE.md`, `AGENTS.md`, or the shared store are neither counted nor pruned.
47
+
48
+ Older rules may have a `fires` counter and no marker (counted, never prunable).
49
+ `node <skill>/scripts/rule-store.mjs adopt --dir <memory dir>` marks them. It edits memory files,
50
+ so tell the user before running it.
51
+
52
+ `rule-store.mjs checklist --dir <dir> --scope all` lists every named memory file, marked or not.
53
+ Use it only to find an unmarked rule that belongs to this workflow.
54
+
55
+ ## Prune pass
56
+
57
+ At the end of Step 5, only when a valid memory directory is available, run
58
+ `node <skill>/scripts/rule-store.mjs prune --dir <memory dir> --idle-days 60` and list the
59
+ candidates in the report under "Rules proposed for deletion". Never delete a rule without the
60
+ user's reply.
61
+
62
+ ## Close the loop
63
+
64
+ State in your report where the rule was written and what it says, so the user can veto it. A rule
65
+ the user has not seen is a rule they cannot correct. The honest test is not that a rule was written
66
+ but that the next task of the same class does not need this skill to catch the same thing. If it
67
+ does, the rule named the incident instead of the shape: rewrite it, do not add another.
@@ -0,0 +1,99 @@
1
+ # Scoring reference
2
+
3
+ The score is `100` minus penalties, floored at 0. It is computed by
4
+ `node <skill>/scripts/claim-ledger.mjs score <ledger>`, never by hand and never by the critic.
5
+
6
+ ## Penalties
7
+
8
+ | Finding | Points off |
9
+ | --- | --- |
10
+ | refuted, load-bearing | 25 |
11
+ | refuted | 10 |
12
+ | unverifiable, load-bearing | 10 |
13
+ | unverifiable | 4 |
14
+ | inferred, accepted, load-bearing | 10 |
15
+ | inferred, accepted | 5 |
16
+ | missed, load-bearing | 15 |
17
+ | missed | 5 |
18
+ | verified but found only by the critic | 5 |
19
+
20
+ An `inferred` missed item (`checked_by: inferred`) is never penalised. A non-load-bearing one is
21
+ not an open defect; a load-bearing one is, so it still blocks the stop rule until you verify it.
22
+
23
+ Why a load-bearing inferred claim costs 10: it used to cost 5, which made "inferred" cheaper than
24
+ "unverifiable" (10) for the same lack of evidence, so unverified claims drifted into the cheaper
25
+ bucket. Load-bearing means the user would act on it, so the two now cost the same.
26
+
27
+ The 5 points for "verified but found only by the critic" can never be revised away. That is why the
28
+ stop rule in `SKILL.md` does not use a score threshold.
29
+
30
+ ## Score anchors
31
+
32
+ Calibrate against these three ledgers (all claims `origin: both`;
33
+ `node <skill>/scripts/claim-ledger.mjs anchors` prints them as JSON).
34
+
35
+ **Strong, score 95**
36
+
37
+ | id | load_bearing | status | checked_by |
38
+ | --- | --- | --- | --- |
39
+ | a1 | no | inferred | inferred |
40
+
41
+ **Middling, score 72**
42
+
43
+ | id | load_bearing | status | checked_by |
44
+ | --- | --- | --- | --- |
45
+ | b1 | no | refuted | read |
46
+ | b2 | no | refuted | read |
47
+ | b3 | no | unverifiable | read |
48
+ | b4 | no | unverifiable | read |
49
+
50
+ **Weak, score 40**
51
+
52
+ | id | load_bearing | status | checked_by |
53
+ | --- | --- | --- | --- |
54
+ | c1 | yes | refuted | read |
55
+ | c2 | yes | refuted | read |
56
+ | c3 | yes | unverifiable | read |
57
+
58
+ ## Ledger shape
59
+
60
+ `version` is always `1`. `author_id` and `critic_ref` let the script cross-check the ledger.
61
+
62
+ ```json
63
+ { "version": 1,
64
+ "claims": [
65
+ { "id": "c1", "text": "...", "load_bearing": true, "origin": "both",
66
+ "author_id": "a1", "critic_ref": "r1:claims.0",
67
+ "status": "verified", "checked_by": "command", "receipt": "quoted output" },
68
+ { "id": "c2", "text": "...", "load_bearing": false, "origin": "critic",
69
+ "critic_ref": "r1:claims.1", "status": "inferred", "checked_by": "inferred" }
70
+ ],
71
+ "missed": [
72
+ { "id": "m1", "text": "...", "load_bearing": false, "checked_by": "read",
73
+ "critic_ref": "r1:missed.0" }
74
+ ] }
75
+ ```
76
+
77
+ - `origin`: `author` | `critic` | `both`
78
+ - `author_id`: the id from `author-claims.json`. Required when `origin` is `author` or `both`;
79
+ forbidden when it is `critic`.
80
+ - `critic_ref`: `"r<round>:claims.<index>"` or `"r<round>:missed.<index>"`, a string or an array,
81
+ pointing into the saved `critic-r<round>.json`. Required when `origin` is `critic` or `both`, and
82
+ on every `missed` entry; forbidden when `origin` is `author`.
83
+ - `status`: `verified` | `refuted` | `unverifiable` | `inferred`
84
+ - `checked_by`: `command` (run, output quoted) | `read` (file or record opened, quoted) |
85
+ `inferred` (reasoning only). Required on `missed` items too. A `verified` or `refuted` claim may
86
+ not use inferred evidence and requires a non-empty receipt.
87
+
88
+ ## Integrity checks
89
+
90
+ When `--author`, `--critic` or `--prev` is passed, the script also fails (exit 2) on:
91
+
92
+ - a duplicate id;
93
+ - an author claim with no ledger entry, or a ledger claim naming an unknown author claim;
94
+ - a critic item (any round) with no ledger entry, or a `critic_ref` that points at nothing;
95
+ - a claim id from the previous ledger that is missing from the new one (a revision may add claims,
96
+ never drop one).
97
+
98
+ Output carries `"integrity": "checked"` when any flag was given and `"unchecked"` otherwise. An
99
+ `unchecked` score is not a reportable score.
@@ -0,0 +1,62 @@
1
+ # Setup notes
2
+
3
+ ## Standalone Cursor installation
4
+
5
+ Use the generated Cursor adapter or the full skill package, including its `scripts/` and
6
+ `references/` directories. Copying only `SKILL.md` is insufficient for this workflow, which calls
7
+ the bundled scripts.
8
+
9
+ ## State directory
10
+
11
+ Each run writes to its own dated folder, outside any repository:
12
+
13
+ - root: `$SELF_CRITIQUE_STATE_DIR`, else `${XDG_STATE_HOME:-~/.local/state}/self-critique`
14
+ - per project: a folder named from the working directory, then one folder per run named from a UTC
15
+ timestamp (`2026-11-19T21-09-27`, with `-1`, `-2` on a same-second collision), mode 0700
16
+
17
+ ```bash
18
+ RUN=$(node <skill>/scripts/run-store.mjs new --cwd "$PWD") # create and print the run folder
19
+ node <skill>/scripts/run-store.mjs latest --cwd "$PWD" # newest run folder
20
+ node <skill>/scripts/run-store.mjs history --cwd "$PWD" --limit 10 # first-answer score trend
21
+ ```
22
+
23
+ A run folder holds `run.json`, `author-claims.json`, `critic-r<N>.json` and `ledger-v<N>.json`.
24
+ Ledgers contain candidate claim text, so keep them out of the repository tree.
25
+
26
+ ## Optional: auto-offer via a Claude Code Stop hook
27
+
28
+ A hook is a shell command, so it cannot run this loop itself. What it can do is **nudge**: after a
29
+ substantial answer, it offers the review and you run the skill only if the user says yes.
30
+
31
+ The hook ships with this skill at `scripts/critique-nudge.mjs`. Register it as a `Stop` hook in your
32
+ Claude Code settings (`.claude/settings.json` for a team, `.claude/settings.local.json` for
33
+ yourself):
34
+
35
+ ```json
36
+ {
37
+ "hooks": {
38
+ "Stop": [
39
+ {
40
+ "hooks": [
41
+ {
42
+ "type": "command",
43
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/critique-nudge.mjs\"",
44
+ "timeout": 15
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
50
+ }
51
+ ```
52
+
53
+ Copy `scripts/critique-nudge.mjs` to `.claude/hooks/critique-nudge.mjs` (or point the command at
54
+ wherever you keep it). After an answer whose final prose is at least 1500 characters, the hook blocks
55
+ the turn once and instructs the agent to append a one-line "critical-thinking review" offer, then
56
+ stop. Two loop guards keep it from firing forever: it does nothing when `stop_hook_active` is set, and
57
+ nothing when the answer already contains the offer phrase. On any malformed input it exits silently
58
+ and never blocks the user.
59
+
60
+ The 1500-character threshold is a heuristic with a known ceiling: it misses short but dense
61
+ tool-heavy turns. If that matters, extend the script to also count tool calls since the last user
62
+ message.