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