@olegkoval/agent-skills 1.88.0 → 1.89.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 (27) hide show
  1. package/adapters/claude/olko-github-pr/skills/lekker-review/SKILL.md +40 -16
  2. package/adapters/claude/olko-github-pr/skills/lekker-review/references/codex-workflow.md +12 -0
  3. package/adapters/claude/olko-github-pr/skills/lekker-review/references/github-post.md +3 -2
  4. package/adapters/claude/olko-github-pr/skills/lekker-review/references/output-format.md +3 -2
  5. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/model-matrix.mjs +152 -0
  6. package/adapters/claude/olko-github-pr/skills/lekker-review/scripts/selftest.mjs +1 -1
  7. package/package.json +1 -1
  8. package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
  9. package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
  10. package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
  11. package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
  12. package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
  13. package/plugins/olko-github-pr/skills/lekker-review/README.md +39 -0
  14. package/plugins/olko-github-pr/skills/lekker-review/SKILL.md +40 -16
  15. package/plugins/olko-github-pr/skills/lekker-review/fix-workflow.js +21 -8
  16. package/plugins/olko-github-pr/skills/lekker-review/references/codex-workflow.md +12 -0
  17. package/plugins/olko-github-pr/skills/lekker-review/references/github-post.md +3 -2
  18. package/plugins/olko-github-pr/skills/lekker-review/references/output-format.md +3 -2
  19. package/plugins/olko-github-pr/skills/lekker-review/scripts/model-matrix.mjs +152 -0
  20. package/plugins/olko-github-pr/skills/lekker-review/scripts/selftest.mjs +1 -1
  21. package/plugins/olko-github-pr/skills/lekker-review/workflow.js +51 -23
  22. package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
  23. package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
  24. package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
  25. package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
  26. package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
  27. package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
@@ -46,7 +46,7 @@ metadata:
46
46
  - multi-agent
47
47
  - workflow
48
48
  - quality
49
- argument-hint: "<github-pr-url | repo pr-number | repo pr-title | branch [ref]> [scan|medium|deep|deps] [--post] [--fix] [--base <ref>]"
49
+ argument-hint: "<github-pr-url | repo pr-number | repo pr-title | branch [ref]> [scan|medium|deep|deps] [--post] [--fix] [--base <ref>] [--risk routine|standard|elevated|critical]"
50
50
  ---
51
51
  <!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
52
52
 
@@ -329,6 +329,24 @@ and gather the newly required Track B sources before Step 2. Branch mode uses
329
329
  Track A's merge-base diff. State final depth and whether auto-selected in the
330
330
  review header.
331
331
 
332
+ **Risk tier and model routing (every depth, after AUTO-DEPTH):** depth decides
333
+ how many agents run; the risk tier decides which model and effort each one
334
+ gets. Run `scripts/model-matrix.mjs` with the same shell-free process API as the
335
+ risk check, using `--host claude|codex` from Host selection, `--lines` as
336
+ additions+deletions without lockfiles, `--categories` as the comma-joined
337
+ `categories[].category` from the risk-paths output, and `--risk <tier>` only
338
+ when the user passed it:
339
+ `execFileSync('node', [matrixScript, '--host', HOST, '--lines', String(lines), '--categories', cats, '--', ...changedPaths])`.
340
+ Store the printed JSON as `ROUTING_RESULT` and its `routing` object as
341
+ `ROUTING`. State the tier in the review header:
342
+ `Risk tier: <tier> (<auto: reason | --risk>)`. On classifier failure, report
343
+ it in one line and leave `ROUTING` unset: every agent then keeps the
344
+ workflow's built-in default (`sonnet`, `haiku` for triage). The full matrix is in `README.md`
345
+ under "Models and effort".
346
+
347
+ **`--risk routine|standard|elevated|critical` flag:** parse and pass to
348
+ `model-matrix.mjs` as `--risk`. It overrides the detected tier, never the depth.
349
+
332
350
  **`--post` flag:** parse and store as `POST_REVIEW=true`.
333
351
 
334
352
  **`--fix` flag:** parse and store as `FIX_MODE=true`. Fix mode needs a real
@@ -440,7 +458,7 @@ skip the review because the log failed, just say `run log unavailable`.
440
458
  | Context: issue-tracker/CI/diff/existing-reviews | always | always | always | always |
441
459
  | Context: chat/docs/framework-docs/monitoring/prior-review-memory (optional, MCP-dependent) | skip | skip | included | included + broader recall |
442
460
  | Worktree + static checks | included (`npm ci` per changed lockfile) | skip (WORKTREE_PATH=null) unless `--fix` | included | included |
443
- | Review agents | 1 deps checklist | 2 triage (haiku) + project-rules (sonnet) | 5 specialists + project-rules (sonnet) | 5 specialists + project-rules (sonnet) |
461
+ | Review agents (model and effort per risk tier, see README) | 1 deps checklist | 2 triage + project-rules | 5 specialists + project-rules | 5 specialists + project-rules |
444
462
  | Per-finding verification | none | Criticals + Importants | Criticals + Importants | Criticals + Importants |
445
463
  | Completeness critic | skip | skip | skip | included |
446
464
  | Proof-of-bug (failing test per Critical or composed-boundary Important) | skip | skip | included (max 5) | included (max 5) |
@@ -804,7 +822,8 @@ args: {
804
822
  cycle, // finding-state.mjs begin output; omit when unknown
805
823
  suppressed, // rejected/intentional findings never to re-raise
806
824
  recurringClasses, // shown in the rethink verdict
807
- testRunner: <worktree.json testRunner, null for scan>
825
+ testRunner: <worktree.json testRunner, null for scan>,
826
+ routing: ROUTING // from model-matrix.mjs; omit when unset
808
827
  }
809
828
  ```
810
829
 
@@ -825,10 +844,10 @@ that only when a specific run needs a smaller footprint.
825
844
 
826
845
  The workflow runs three phases:
827
846
 
828
- - **Review:** deps uses the single `deps` checklist agent; scan uses `[triage-quality, triage-logic]` on `haiku`; medium/deep
847
+ - **Review:** deps uses the single `deps` checklist agent; scan uses `[triage-quality, triage-logic]`; medium/deep
829
848
  use 5 specialists (quality, implementation, simplification, conventions,
830
- test-quality) on `sonnet`. Scan, medium and deep also run `project-rules`
831
- (sonnet), which only checks the diff against each project rule. Agents receive DIFF_FILE + CONTEXT_FILE by path.
849
+ test-quality). Scan, medium and deep also run `project-rules`, which only
850
+ checks the diff against each project rule. Models come from `routing`. Agents receive DIFF_FILE + CONTEXT_FILE by path.
832
851
  All run concurrently: the stage is self-limiting at one agent per
833
852
  dimension. All reviewers run to completion before verification starts.
834
853
  Override per run with the `reviewBatchPlan` arg (e.g. `[1]` runs them
@@ -851,7 +870,7 @@ The workflow runs three phases:
851
870
  - **Critic (deep only):** completeness critic gets the full deduped finding
852
871
  list + DIFF_FILE; its findings go through verifier agents before promotion.
853
872
  - **Prove (medium/deep, worktree and an installed test runner required):**
854
- each Critical without a `rule` tag gets one prover agent (`references/agents/prover.md`, sonnet, max 5, run
873
+ each Critical without a `rule` tag gets one prover agent (`references/agents/prover.md`, `routing.prover`, max 5, run
855
874
  `maxConcurrent` at a time) that writes a test asserting the CORRECT behaviour,
856
875
  runs it in the worktree, and captures it failing because of the bug. The proof rides on the finding as
857
876
  `proof: {attempted, proven, outcome, reason, testCode?, testCommand?, redOutput?}`.
@@ -866,9 +885,13 @@ Findings have schema:
866
885
  `badCode` and `fix` are schema-required: an empty string is allowed only on
867
886
  `observation` / `idiomatic` findings.
868
887
 
869
- Model tiers: triage on `haiku`, specialists on `sonnet`, verifiers + critic +
870
- provers on `sonnet`, housekeeping on `haiku`. Only the synthesis in Step 3 runs
871
- on the session model.
888
+ Model tiers: every agent role (triage, specialist, rules, verifier, critic,
889
+ prover) takes its model and effort from `routing`, chosen by the risk tier;
890
+ see the matrix in `README.md`. Critic re-examine and critic-verify agents use
891
+ the verifier's route. Without `routing` the workflow keeps its defaults:
892
+ triage on `haiku`, everything else on `sonnet`, verifiers and provers at effort
893
+ high. Only the synthesis in Step 3 runs on the session model. The workflow
894
+ returns the routes it used as `routing`; quote them in the Review Cost block.
872
895
 
873
896
  Return value from the workflow:
874
897
  `{engine, findings, droppedCount, downgradedCount, hardRuleCount, proveAttemptCount, provenCount, acCoverage, coverageVerdict, mutationSlip, mockSmells, agentCount, outputTokens, turnTokensTotal}`
@@ -1298,7 +1321,8 @@ Read `references/fix-mode.md` and follow it. Shape of the run:
1298
1321
  ```
1299
1322
  scriptPath: <scratchpad>/fix-workflow.js
1300
1323
  args: { repoSlug, prNumber, targetLabel, worktreePath, diffFile, contextFile,
1301
- promptDir, findings: [<selected findings verbatim>], acList }
1324
+ promptDir, findings: [<selected findings verbatim>], acList,
1325
+ routing: ROUTING }
1302
1326
  ```
1303
1327
  `targetLabel` is required whenever `prNumber` is null, same as the review
1304
1328
  workflow. `acList` is the acceptance criteria from `context.json`, passed as
@@ -1308,10 +1332,10 @@ Read `references/fix-mode.md` and follow it. Shape of the run:
1308
1332
  verdict without verified comparison evidence is downgraded automatically.
1309
1333
  In Codex, run the Fix mode section of `references/codex-workflow.md` with
1310
1334
  the same inputs, including `acList`, and result schema.
1311
- Agent selection is host-specific. Claude uses one `sonnet` fix agent per
1312
- file (never two on the same file), then a read-only `sonnet` fix-verifier per
1313
- file. Codex uses one `worker` fixer per file, then a read-only `default`
1314
- verifier per file. Every verifier reads the actual `git diff`; allow one
1335
+ Agent selection is host-specific. Claude uses one fix agent per file
1336
+ (`routing.fixer`; never two on the same file), then a read-only fix-verifier
1337
+ per file (`routing.verifier`). Codex uses one `worker` fixer per file, then a
1338
+ read-only `default` verifier per file, with the same routes. Every verifier reads the actual `git diff`; allow one
1315
1339
  retry max on a non-`good` verdict.
1316
1340
  4. Revert every group the verifier did not pass.
1317
1341
  5. Run `scripts/verify-fixes.sh <WORKTREE_PATH> <scratchpad>/fix-verify.json tests`
@@ -1492,7 +1516,7 @@ so a nearby finding about a different problem still counts; read recall as an
1492
1516
  upper bound.
1493
1517
 
1494
1518
  If you maintain a persistent notes/memory system across reviews, launch ONE
1495
- background Agent with `model: 'haiku'`, passing the review file path +
1519
+ background Agent with `routing.housekeeping` (default `model: 'haiku'`), passing the review file path +
1496
1520
  repo-short-name + PR author login, instructed to follow
1497
1521
  `references/post-review.md` if you've written one for your own setup:
1498
1522
  - Log durable patterns (recurring findings, confirmed false positives) scoped
@@ -64,6 +64,18 @@ Re-read each JSON file before
64
64
  trusting it. Invalid JSON or a missing required field makes that agent result
65
65
  unavailable; do not infer what it meant from prose.
66
66
 
67
+ ## Model routing
68
+
69
+ SKILL.md runs `scripts/model-matrix.mjs --host codex` and passes its `routing`
70
+ object. Every `spawn_agent` call sets `model` and `reasoning_effort` from the
71
+ role's route and `fork_turns: "none"` (Codex requires it whenever a spawn
72
+ overrides the model). Roles: `triage` (triage dimensions), `specialist` (the
73
+ five specialists), `rules` (`project-rules`, `deps`), `verifier` (verifiers,
74
+ critic re-examine and critic-verify, fix verifiers), `critic` (completeness
75
+ critic), `prover`, `fixer`, `housekeeping`. Without `routing`, omit all three
76
+ fields so agents inherit the session model, as before. Record the route used
77
+ per agent in the `agents` receipt.
78
+
67
79
  ## Review stage
68
80
 
69
81
  Select dimensions exactly as the Claude workflow does:
@@ -153,8 +153,9 @@ an earlier run can never be merged into this one.
153
153
  1. Create the run directory once: `mktemp -d /tmp/lekker-polish.XXXXXX`, and
154
154
  use its printed path as `<POLISH_DIR>`. Copy the payload:
155
155
  `cp <PAYLOAD> <POLISH_DIR>/draft.json`.
156
- 2. Launch ONE agent (`model: 'sonnet'`; in Codex, one native agent or inline
157
- when none is available) with this brief: rewrite each `comments[].body` in
156
+ 2. Launch ONE agent on `ROUTING.polish` (model and effort; default
157
+ `model: 'sonnet'` when `ROUTING` is unset; in Codex, one native agent with
158
+ that route, or inline when none is available) with this brief: rewrite each `comments[].body` in
158
159
  `<POLISH_DIR>/draft.json` per `${SKILL_ROOT}/references/comment-voice.md`
159
160
  and write the full payload to `<POLISH_DIR>/polished.json`, same order, same
160
161
  `path`, `line` and `side`. Keep every identifier, `file:line`, number, link,
@@ -235,7 +235,8 @@ section if empty.)*
235
235
  ```
236
236
  Depth: <📦 deps | ⚡ scan | 🔍 medium | 🔬 deep>
237
237
  Diff size: ~<N> lines (~<N> tokens)
238
- Agents run: <N total>: <breakdown, e.g. "5 reviewers (sonnet) + 6 verifiers (sonnet) + 2 provers (sonnet) + 1 critic (sonnet)">
238
+ Agents run: <N total>: <breakdown, e.g. "5 reviewers (sonnet/high) + 6 verifiers (opus/high) + 2 provers (sonnet/high) + 1 critic (opus/high)">
239
+ Risk tier: <tier> (<auto: reason | --risk>), routes from the workflow's `routing` return value
239
240
  Rule checks: <N> hard-rule finding(s) validated with rule-specific checks (omit the line when 0)
240
241
  Context sources: <the subset of issue-tracker / chat / docs / framework-docs / monitoring / CI / prior-review-memory actually used>
241
242
 
@@ -257,7 +258,7 @@ Per-MTok pricing (input/output) - verified 2026-10-15 from the claude-api refere
257
258
 
258
259
  The main-loop line uses the session model's rate from this list. When the session model is not listed, say so in the cost block rather than leaving the main loop out silently.
259
260
 
260
- Reviewer agents, verifiers, provers, and the critic all run on sonnet; triage and housekeeping on haiku. Only the main loop (context gathering + this synthesis) runs on the session model: use the session model's actual ID for that tier.
261
+ Each agent role runs on the model and effort its risk tier assigns (README "Models and effort"); price each role at its own model. Only the main loop (context gathering + this synthesis) runs on the session model: use the session model's actual ID for that tier.
261
262
 
262
263
  For the Codex engine, use the model and usage metadata actually exposed by the
263
264
  native collaboration surface. Never relabel Codex agents as Claude tiers and
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env node
2
+ // Model and effort per lekker agent, picked from the PR's risk tier.
3
+ //
4
+ // Depth decides how many agents run; the tier decides how strong each one is.
5
+ // Effort comes before model size: a tier escalates effort first and moves to a
6
+ // bigger model only for risky changes. Finders stay one step below the gate
7
+ // (verifier), because the verifier decides what survives. The fast models
8
+ // (haiku, luna) only ever do first-pass triage or housekeeping.
9
+ //
10
+ // node model-matrix.mjs --host claude|codex [--risk <tier>] [--lines <n>]
11
+ // [--categories auth,billing,...] -- <changed-file>...
12
+ //
13
+ // `--categories` is the comma-joined `categories[].category` list from
14
+ // risk-paths.mjs. `--lines` is additions+deletions without lockfiles.
15
+ // Prints {host, tier, tierSource, reasons, visual, routing}.
16
+ import { pathToFileURL } from 'node:url'
17
+
18
+ export const TIERS = ['routine', 'standard', 'elevated', 'critical']
19
+ export const HOSTS = ['claude', 'codex']
20
+ export const EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max']
21
+
22
+ // Roles that decide whether a finding survives. Never a fast model.
23
+ export const GATE_ROLES = ['verifier', 'critic']
24
+
25
+ const r = (model, effort) => ({ model, effort })
26
+ const same = cell => [cell, cell, cell, cell]
27
+
28
+ // One row per role: [routine, standard, elevated, critical].
29
+ export const MATRIX = {
30
+ claude: {
31
+ triage: same(r('haiku', 'medium')),
32
+ specialist: [r('sonnet', 'medium'), r('sonnet', 'high'), r('opus', 'high'), r('opus', 'xhigh')],
33
+ rules: [r('sonnet', 'medium'), r('sonnet', 'medium'), r('sonnet', 'high'), r('sonnet', 'high')],
34
+ verifier: [r('sonnet', 'high'), r('sonnet', 'high'), r('opus', 'high'), r('fable', 'high')],
35
+ critic: [r('sonnet', 'medium'), r('sonnet', 'high'), r('opus', 'high'), r('fable', 'xhigh')],
36
+ prover: [r('sonnet', 'high'), r('sonnet', 'high'), r('sonnet', 'high'), r('opus', 'high')],
37
+ fixer: [r('sonnet', 'high'), r('sonnet', 'high'), r('sonnet', 'high'), r('opus', 'high')],
38
+ polish: same(r('sonnet', 'medium')),
39
+ housekeeping: same(r('haiku', 'low')),
40
+ },
41
+ codex: {
42
+ triage: same(r('gpt-6-luna', 'medium')),
43
+ specialist: [r('gpt-6.2-sol', 'medium'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high'), r('gpt-6.2-astra', 'xhigh')],
44
+ rules: [r('gpt-6.2-sol', 'medium'), r('gpt-6.2-sol', 'medium'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high')],
45
+ verifier: [r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high'), r('gpt-6.2-astra', 'high')],
46
+ critic: [r('gpt-6.2-sol', 'medium'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high'), r('gpt-6.2-astra', 'xhigh')],
47
+ prover: [r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high')],
48
+ fixer: [r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high')],
49
+ polish: same(r('gpt-6.2-sol', 'medium')),
50
+ housekeeping: same(r('gpt-6-luna', 'low')),
51
+ },
52
+ }
53
+
54
+ // A UI-only diff: Codex has a model positioned for visual reasoning.
55
+ const VISUAL_SPECIALIST = { codex: r('gpt-6.1-terra', 'high') }
56
+
57
+ export const FAST_MODELS = ['haiku', 'gpt-6-luna']
58
+
59
+ const DOC_FILE = /(^|\/)(docs?\/.*|[^/]+\.(md|mdx|txt|rst)|LICENSE[^/]*)$/i
60
+ const UI_FILE = /\.(tsx|jsx|vue|svelte|css|scss|sass|less|liquid|html)$/i
61
+ const TEST_FILE = /(^|\/)(__tests__|tests?|spec)\/|\.(test|spec)\.[a-z]+$/i
62
+ const MIGRATION_FILE = /(^|\/)migrations?\/|\.sql$/i
63
+
64
+ const CRITICAL_CATEGORIES = ['auth', 'billing']
65
+ const ELEVATED_CATEGORIES = ['ci-workflow', 'installer']
66
+ const DEEP_LINES = 800
67
+ const DEEP_FILES = 25
68
+
69
+ // Each rule: [tier, reason, test]. First match wins, so order is severity order.
70
+ const TIER_RULES = [
71
+ ['critical', 'auth or billing paths', s => s.categories.some(c => CRITICAL_CATEGORIES.includes(c))],
72
+ ['elevated', 'CI workflow or installer paths', s => s.categories.some(c => ELEVATED_CATEGORIES.includes(c))],
73
+ ['elevated', 'migrations or SQL', s => s.files.some(f => MIGRATION_FILE.test(f))],
74
+ ['elevated', `more than ${DEEP_LINES} changed lines or ${DEEP_FILES} files`, s => s.lines > DEEP_LINES || s.files.length > DEEP_FILES],
75
+ ['routine', 'documentation only', s => s.files.length > 0 && s.files.every(f => DOC_FILE.test(f))],
76
+ ]
77
+
78
+ export function tierFor({ files = [], categories = [], lines = 0, override } = {}) {
79
+ if (override !== undefined) {
80
+ if (!TIERS.includes(override)) throw new Error(`unknown risk tier "${override}"; use one of ${TIERS.join(', ')}`)
81
+ return { tier: override, tierSource: 'override', reasons: ['--risk flag'] }
82
+ }
83
+ const signals = { files, categories, lines }
84
+ const hit = TIER_RULES.find(([, , test]) => test(signals))
85
+ return hit
86
+ ? { tier: hit[0], tierSource: 'auto', reasons: [hit[1]] }
87
+ : { tier: 'standard', tierSource: 'auto', reasons: ['default'] }
88
+ }
89
+
90
+ export function isVisual(files = []) {
91
+ const code = files.filter(f => !TEST_FILE.test(f) && !DOC_FILE.test(f))
92
+ return code.length > 0 && code.every(f => UI_FILE.test(f))
93
+ }
94
+
95
+ export function routingFor(host, tier, { visual = false } = {}) {
96
+ if (!HOSTS.includes(host)) throw new Error(`unknown host "${host}"; use one of ${HOSTS.join(', ')}`)
97
+ if (!TIERS.includes(tier)) throw new Error(`unknown risk tier "${tier}"`)
98
+ const column = TIERS.indexOf(tier)
99
+ const routing = Object.fromEntries(Object.entries(MATRIX[host]).map(([role, row]) => [role, row[column]]))
100
+ return visual && VISUAL_SPECIALIST[host] ? { ...routing, specialist: VISUAL_SPECIALIST[host] } : routing
101
+ }
102
+
103
+ const ROLE_LABELS = {
104
+ triage: 'Triage (scan depth, first pass only)',
105
+ specialist: 'Specialists x5 (quality, implementation, simplification, conventions, test-quality)',
106
+ rules: 'Project rules, deps checklist',
107
+ verifier: 'Verifier, critic re-examine, fix verifier',
108
+ critic: 'Completeness critic (deep)',
109
+ prover: 'Prover (writes the failing test)',
110
+ fixer: 'Fixer (--fix)',
111
+ polish: 'Comment polish (--post)',
112
+ housekeeping: 'Housekeeping',
113
+ }
114
+ const MODEL_NAMES = {
115
+ haiku: 'Haiku', sonnet: 'Sonnet', opus: 'Opus', fable: 'Fable',
116
+ 'gpt-6-luna': 'Luna', 'gpt-6.2-sol': 'Sol', 'gpt-6.2-astra': 'Astra', 'gpt-6.1-terra': 'Terra',
117
+ }
118
+
119
+ // The README table, rendered from MATRIX so the two cannot drift
120
+ // (tests/lekker-model-matrix.test.mjs asserts README contains it).
121
+ export function matrixMarkdown() {
122
+ const cell = (c, x) => `${MODEL_NAMES[c.model]} ${c.effort} / ${MODEL_NAMES[x.model]} ${x.effort}`
123
+ const rows = Object.keys(MATRIX.claude).map(role =>
124
+ `| ${ROLE_LABELS[role]} | ${TIERS.map((_, i) => cell(MATRIX.claude[role][i], MATRIX.codex[role][i])).join(' | ')} |`)
125
+ return [`| Agent | ${TIERS.join(' | ')} |`, `| --- |${TIERS.map(() => ' --- |').join('')}`, ...rows].join('\n')
126
+ }
127
+
128
+ function parseArgs(argv) {
129
+ const sep = argv.indexOf('--')
130
+ const flags = sep === -1 ? argv : argv.slice(0, sep)
131
+ const files = sep === -1 ? [] : argv.slice(sep + 1)
132
+ const value = name => {
133
+ const i = flags.indexOf(name)
134
+ return i === -1 ? undefined : flags[i + 1]
135
+ }
136
+ const categories = (value('--categories') ?? '').split(',').map(s => s.trim()).filter(Boolean)
137
+ return { host: value('--host'), override: value('--risk'), lines: Number(value('--lines') ?? 0), categories, files }
138
+ }
139
+
140
+ function main(argv) {
141
+ const { host, override, lines, categories, files } = parseArgs(argv)
142
+ try {
143
+ const { tier, tierSource, reasons } = tierFor({ files, categories, lines, override })
144
+ const visual = isVisual(files)
145
+ console.log(JSON.stringify({ host, tier, tierSource, reasons, visual, routing: routingFor(host, tier, { visual }) }))
146
+ } catch (error) {
147
+ console.error(`model-matrix: ${error.message}`)
148
+ process.exit(2)
149
+ }
150
+ }
151
+
152
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) main(process.argv.slice(2))
@@ -333,7 +333,7 @@ console.log('\ndeps depth: routing, classifier, line validation')
333
333
  check('workflow.js defines dimensionsFor', Boolean(dimsSrc), true)
334
334
  if (dimsSrc) {
335
335
  const dimensionsFor = new Function(dimsSrc + '\nreturn dimensionsFor')()
336
- const M = { review: 'r', triage: 't' }
336
+ const M = { specialist: { model: 's' }, triage: { model: 't' }, rules: { model: 'r' } }
337
337
  check('deps runs exactly one agent', dimensionsFor('deps', M).map(d => d.file), ['deps.md'])
338
338
  check('scan runs the triage pair plus project-rules', dimensionsFor('scan', M).map(d => d.key), ['triage-quality', 'triage-logic', 'project-rules'])
339
339
  check('medium runs five specialists plus project-rules', dimensionsFor('medium', M).length, 6)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olegkoval/agent-skills",
3
- "version": "1.88.0",
3
+ "version": "1.89.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-apple-kit",
3
3
  "description": "Build and ship Apple platform apps: macOS menubar apps, App Store submissions.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-creative",
3
3
  "description": "Creative and personal projects: photo galleries, music players, listings, wiki editing.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-garmin-kit",
3
3
  "description": "Build, test and publish Garmin Connect IQ watch faces.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-git-tools",
3
3
  "description": "Everyday git and GitHub CLI operations: conventional commits, branch hygiene.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-github-pr",
3
3
  "description": "Drive GitHub pull requests to merge-ready: review-bot loops, CI fixes, descriptions, dependency triage.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -29,6 +29,45 @@ This skill spends most of its budget trying to disprove itself.
29
29
  the real `git diff`, and the captured proof re-run. If the proof stays red the
30
30
  group is reverted. Nothing is pushed without explicit confirmation.
31
31
 
32
+ ## Models and effort
33
+
34
+ The model is not the main lever: a reviewer finds more when it spends effort
35
+ checking callers, tests, error paths and assumptions. So each agent's effort
36
+ rises with the PR's risk first, and the model grows only for risky changes.
37
+ Not every agent gets the same tier: the agents that find issues stay one step
38
+ below the verifier, because the verifier decides what survives. Haiku and Luna
39
+ only ever do a cheap first pass, never the final check.
40
+
41
+ Each host uses its own vendor's models: Claude Code runs Claude models, Codex
42
+ runs Codex models. Cells read `Claude / Codex`.
43
+
44
+ | Agent | routine | standard | elevated | critical |
45
+ | --- | --- | --- | --- | --- |
46
+ | Triage (scan depth, first pass only) | Haiku medium / Luna medium | Haiku medium / Luna medium | Haiku medium / Luna medium | Haiku medium / Luna medium |
47
+ | Specialists x5 (quality, implementation, simplification, conventions, test-quality) | Sonnet medium / Sol medium | Sonnet high / Sol high | Opus high / Astra high | Opus xhigh / Astra xhigh |
48
+ | Project rules, deps checklist | Sonnet medium / Sol medium | Sonnet medium / Sol medium | Sonnet high / Sol high | Sonnet high / Sol high |
49
+ | Verifier, critic re-examine, fix verifier | Sonnet high / Sol high | Sonnet high / Sol high | Opus high / Astra high | Fable high / Astra high |
50
+ | Completeness critic (deep) | Sonnet medium / Sol medium | Sonnet high / Sol high | Opus high / Astra high | Fable xhigh / Astra xhigh |
51
+ | Prover (writes the failing test) | Sonnet high / Sol high | Sonnet high / Sol high | Sonnet high / Sol high | Opus high / Astra high |
52
+ | Fixer (--fix) | Sonnet high / Sol high | Sonnet high / Sol high | Sonnet high / Sol high | Opus high / Astra high |
53
+ | Comment polish (--post) | Sonnet medium / Sol medium | Sonnet medium / Sol medium | Sonnet medium / Sol medium | Sonnet medium / Sol medium |
54
+ | Housekeeping | Haiku low / Luna low | Haiku low / Luna low | Haiku low / Luna low | Haiku low / Luna low |
55
+
56
+ The risk tier is picked from the changed files, and `--risk <tier>` overrides it:
57
+
58
+ | Tier | When |
59
+ | --- | --- |
60
+ | routine | every changed file is documentation (`*.md`, `*.mdx`, `*.txt`, `*.rst`, `docs/`, `LICENSE`) |
61
+ | standard | everything else |
62
+ | elevated | CI workflows or installers, migrations or `*.sql`, or more than 800 changed lines or 25 files |
63
+ | critical | auth or billing paths |
64
+
65
+ Depth and tier are separate: depth decides how many agents run, the tier
66
+ decides how strong each one is. A UI-only diff runs the Codex specialists on
67
+ Terra high, the Codex model positioned for visual reasoning. The main loop
68
+ (context gathering and the final write-up) runs on your session model. The
69
+ table is generated from `scripts/model-matrix.mjs`; a test fails if they drift.
70
+
32
71
  ## Comment voice
33
72
 
34
73
  With `--post`, inline comments follow `references/comment-voice.md`: the ask,
@@ -46,7 +46,7 @@ metadata:
46
46
  - multi-agent
47
47
  - workflow
48
48
  - quality
49
- argument-hint: "<github-pr-url | repo pr-number | repo pr-title | branch [ref]> [scan|medium|deep|deps] [--post] [--fix] [--base <ref>]"
49
+ argument-hint: "<github-pr-url | repo pr-number | repo pr-title | branch [ref]> [scan|medium|deep|deps] [--post] [--fix] [--base <ref>] [--risk routine|standard|elevated|critical]"
50
50
  ---
51
51
 
52
52
  # Lekker Review
@@ -328,6 +328,24 @@ and gather the newly required Track B sources before Step 2. Branch mode uses
328
328
  Track A's merge-base diff. State final depth and whether auto-selected in the
329
329
  review header.
330
330
 
331
+ **Risk tier and model routing (every depth, after AUTO-DEPTH):** depth decides
332
+ how many agents run; the risk tier decides which model and effort each one
333
+ gets. Run `scripts/model-matrix.mjs` with the same shell-free process API as the
334
+ risk check, using `--host claude|codex` from Host selection, `--lines` as
335
+ additions+deletions without lockfiles, `--categories` as the comma-joined
336
+ `categories[].category` from the risk-paths output, and `--risk <tier>` only
337
+ when the user passed it:
338
+ `execFileSync('node', [matrixScript, '--host', HOST, '--lines', String(lines), '--categories', cats, '--', ...changedPaths])`.
339
+ Store the printed JSON as `ROUTING_RESULT` and its `routing` object as
340
+ `ROUTING`. State the tier in the review header:
341
+ `Risk tier: <tier> (<auto: reason | --risk>)`. On classifier failure, report
342
+ it in one line and leave `ROUTING` unset: every agent then keeps the
343
+ workflow's built-in default (`sonnet`, `haiku` for triage). The full matrix is in `README.md`
344
+ under "Models and effort".
345
+
346
+ **`--risk routine|standard|elevated|critical` flag:** parse and pass to
347
+ `model-matrix.mjs` as `--risk`. It overrides the detected tier, never the depth.
348
+
331
349
  **`--post` flag:** parse and store as `POST_REVIEW=true`.
332
350
 
333
351
  **`--fix` flag:** parse and store as `FIX_MODE=true`. Fix mode needs a real
@@ -439,7 +457,7 @@ skip the review because the log failed, just say `run log unavailable`.
439
457
  | Context: issue-tracker/CI/diff/existing-reviews | always | always | always | always |
440
458
  | Context: chat/docs/framework-docs/monitoring/prior-review-memory (optional, MCP-dependent) | skip | skip | included | included + broader recall |
441
459
  | Worktree + static checks | included (`npm ci` per changed lockfile) | skip (WORKTREE_PATH=null) unless `--fix` | included | included |
442
- | Review agents | 1 deps checklist | 2 triage (haiku) + project-rules (sonnet) | 5 specialists + project-rules (sonnet) | 5 specialists + project-rules (sonnet) |
460
+ | Review agents (model and effort per risk tier, see README) | 1 deps checklist | 2 triage + project-rules | 5 specialists + project-rules | 5 specialists + project-rules |
443
461
  | Per-finding verification | none | Criticals + Importants | Criticals + Importants | Criticals + Importants |
444
462
  | Completeness critic | skip | skip | skip | included |
445
463
  | Proof-of-bug (failing test per Critical or composed-boundary Important) | skip | skip | included (max 5) | included (max 5) |
@@ -803,7 +821,8 @@ args: {
803
821
  cycle, // finding-state.mjs begin output; omit when unknown
804
822
  suppressed, // rejected/intentional findings never to re-raise
805
823
  recurringClasses, // shown in the rethink verdict
806
- testRunner: <worktree.json testRunner, null for scan>
824
+ testRunner: <worktree.json testRunner, null for scan>,
825
+ routing: ROUTING // from model-matrix.mjs; omit when unset
807
826
  }
808
827
  ```
809
828
 
@@ -824,10 +843,10 @@ that only when a specific run needs a smaller footprint.
824
843
 
825
844
  The workflow runs three phases:
826
845
 
827
- - **Review:** deps uses the single `deps` checklist agent; scan uses `[triage-quality, triage-logic]` on `haiku`; medium/deep
846
+ - **Review:** deps uses the single `deps` checklist agent; scan uses `[triage-quality, triage-logic]`; medium/deep
828
847
  use 5 specialists (quality, implementation, simplification, conventions,
829
- test-quality) on `sonnet`. Scan, medium and deep also run `project-rules`
830
- (sonnet), which only checks the diff against each project rule. Agents receive DIFF_FILE + CONTEXT_FILE by path.
848
+ test-quality). Scan, medium and deep also run `project-rules`, which only
849
+ checks the diff against each project rule. Models come from `routing`. Agents receive DIFF_FILE + CONTEXT_FILE by path.
831
850
  All run concurrently: the stage is self-limiting at one agent per
832
851
  dimension. All reviewers run to completion before verification starts.
833
852
  Override per run with the `reviewBatchPlan` arg (e.g. `[1]` runs them
@@ -850,7 +869,7 @@ The workflow runs three phases:
850
869
  - **Critic (deep only):** completeness critic gets the full deduped finding
851
870
  list + DIFF_FILE; its findings go through verifier agents before promotion.
852
871
  - **Prove (medium/deep, worktree and an installed test runner required):**
853
- each Critical without a `rule` tag gets one prover agent (`references/agents/prover.md`, sonnet, max 5, run
872
+ each Critical without a `rule` tag gets one prover agent (`references/agents/prover.md`, `routing.prover`, max 5, run
854
873
  `maxConcurrent` at a time) that writes a test asserting the CORRECT behaviour,
855
874
  runs it in the worktree, and captures it failing because of the bug. The proof rides on the finding as
856
875
  `proof: {attempted, proven, outcome, reason, testCode?, testCommand?, redOutput?}`.
@@ -865,9 +884,13 @@ Findings have schema:
865
884
  `badCode` and `fix` are schema-required: an empty string is allowed only on
866
885
  `observation` / `idiomatic` findings.
867
886
 
868
- Model tiers: triage on `haiku`, specialists on `sonnet`, verifiers + critic +
869
- provers on `sonnet`, housekeeping on `haiku`. Only the synthesis in Step 3 runs
870
- on the session model.
887
+ Model tiers: every agent role (triage, specialist, rules, verifier, critic,
888
+ prover) takes its model and effort from `routing`, chosen by the risk tier;
889
+ see the matrix in `README.md`. Critic re-examine and critic-verify agents use
890
+ the verifier's route. Without `routing` the workflow keeps its defaults:
891
+ triage on `haiku`, everything else on `sonnet`, verifiers and provers at effort
892
+ high. Only the synthesis in Step 3 runs on the session model. The workflow
893
+ returns the routes it used as `routing`; quote them in the Review Cost block.
871
894
 
872
895
  Return value from the workflow:
873
896
  `{engine, findings, droppedCount, downgradedCount, hardRuleCount, proveAttemptCount, provenCount, acCoverage, coverageVerdict, mutationSlip, mockSmells, agentCount, outputTokens, turnTokensTotal}`
@@ -1297,7 +1320,8 @@ Read `references/fix-mode.md` and follow it. Shape of the run:
1297
1320
  ```
1298
1321
  scriptPath: <scratchpad>/fix-workflow.js
1299
1322
  args: { repoSlug, prNumber, targetLabel, worktreePath, diffFile, contextFile,
1300
- promptDir, findings: [<selected findings verbatim>], acList }
1323
+ promptDir, findings: [<selected findings verbatim>], acList,
1324
+ routing: ROUTING }
1301
1325
  ```
1302
1326
  `targetLabel` is required whenever `prNumber` is null, same as the review
1303
1327
  workflow. `acList` is the acceptance criteria from `context.json`, passed as
@@ -1307,10 +1331,10 @@ Read `references/fix-mode.md` and follow it. Shape of the run:
1307
1331
  verdict without verified comparison evidence is downgraded automatically.
1308
1332
  In Codex, run the Fix mode section of `references/codex-workflow.md` with
1309
1333
  the same inputs, including `acList`, and result schema.
1310
- Agent selection is host-specific. Claude uses one `sonnet` fix agent per
1311
- file (never two on the same file), then a read-only `sonnet` fix-verifier per
1312
- file. Codex uses one `worker` fixer per file, then a read-only `default`
1313
- verifier per file. Every verifier reads the actual `git diff`; allow one
1334
+ Agent selection is host-specific. Claude uses one fix agent per file
1335
+ (`routing.fixer`; never two on the same file), then a read-only fix-verifier
1336
+ per file (`routing.verifier`). Codex uses one `worker` fixer per file, then a
1337
+ read-only `default` verifier per file, with the same routes. Every verifier reads the actual `git diff`; allow one
1314
1338
  retry max on a non-`good` verdict.
1315
1339
  4. Revert every group the verifier did not pass.
1316
1340
  5. Run `scripts/verify-fixes.sh <WORKTREE_PATH> <scratchpad>/fix-verify.json tests`
@@ -1491,7 +1515,7 @@ so a nearby finding about a different problem still counts; read recall as an
1491
1515
  upper bound.
1492
1516
 
1493
1517
  If you maintain a persistent notes/memory system across reviews, launch ONE
1494
- background Agent with `model: 'haiku'`, passing the review file path +
1518
+ background Agent with `routing.housekeeping` (default `model: 'haiku'`), passing the review file path +
1495
1519
  repo-short-name + PR author login, instructed to follow
1496
1520
  `references/post-review.md` if you've written one for your own setup:
1497
1521
  - Log durable patterns (recurring findings, confirmed false positives) scoped
@@ -62,10 +62,23 @@ const {
62
62
  findings,
63
63
  acList,
64
64
  targetLabel: fixTargetLabelArg,
65
+ routing,
65
66
  } = input
66
67
 
67
68
  const targetLabel = fixTargetLabelArg || `PR #${prNumber}`
68
69
 
70
+ // Same contract as routeOf in workflow.js: the routing arg from
71
+ // scripts/model-matrix.mjs, with today's defaults when a cell is absent.
72
+ const VALID_EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max']
73
+ function routeOf(role, fallback) {
74
+ const cell = routing && routing[role]
75
+ const valid = Boolean(cell) && typeof cell.model === 'string' && cell.model.length > 0
76
+ && (cell.effort === undefined || VALID_EFFORTS.includes(cell.effort))
77
+ return valid ? { model: cell.model, effort: cell.effort } : fallback
78
+ }
79
+ const FIXER = routeOf('fixer', { model: 'sonnet', effort: 'high' })
80
+ const FIX_VERIFIER = routeOf('verifier', { model: 'sonnet', effort: 'high' })
81
+
69
82
  if (!repoSlug || (!prNumber && !fixTargetLabelArg) || !worktreePath || !promptDir || !Array.isArray(findings)) {
70
83
  throw new Error(
71
84
  'lekker-review fix workflow: missing required args (got type ' + typeof args +
@@ -275,8 +288,8 @@ async function fixStage(group) {
275
288
  label: `fix:${group.file}`,
276
289
  phase: 'Fix',
277
290
  schema: FIX_RESULT_SCHEMA,
278
- model: 'sonnet',
279
- effort: 'high',
291
+ model: FIXER.model,
292
+ effort: FIXER.effort,
280
293
  })
281
294
 
282
295
  if (!result) {
@@ -381,8 +394,8 @@ async function verifyStage(state) {
381
394
  label: `fix-verify:${state.file}`,
382
395
  phase: 'Fix-verify',
383
396
  schema: FIX_VERDICT_SCHEMA,
384
- model: 'sonnet',
385
- effort: 'high',
397
+ model: FIX_VERIFIER.model,
398
+ effort: FIX_VERIFIER.effort,
386
399
  }))
387
400
 
388
401
  // One retry only (VERIFICATION.md: surface retries, never loop).
@@ -395,8 +408,8 @@ async function verifyStage(state) {
395
408
  label: `fix-retry:${state.file}`,
396
409
  phase: 'Fix',
397
410
  schema: FIX_RESULT_SCHEMA,
398
- model: 'sonnet',
399
- effort: 'high',
411
+ model: FIXER.model,
412
+ effort: FIXER.effort,
400
413
  })
401
414
 
402
415
  if (retryResult) {
@@ -406,8 +419,8 @@ async function verifyStage(state) {
406
419
  label: `fix-reverify:${state.file}`,
407
420
  phase: 'Fix-verify',
408
421
  schema: FIX_VERDICT_SCHEMA,
409
- model: 'sonnet',
410
- effort: 'high',
422
+ model: FIX_VERIFIER.model,
423
+ effort: FIX_VERIFIER.effort,
411
424
  }))
412
425
  }
413
426
  }
@@ -64,6 +64,18 @@ Re-read each JSON file before
64
64
  trusting it. Invalid JSON or a missing required field makes that agent result
65
65
  unavailable; do not infer what it meant from prose.
66
66
 
67
+ ## Model routing
68
+
69
+ SKILL.md runs `scripts/model-matrix.mjs --host codex` and passes its `routing`
70
+ object. Every `spawn_agent` call sets `model` and `reasoning_effort` from the
71
+ role's route and `fork_turns: "none"` (Codex requires it whenever a spawn
72
+ overrides the model). Roles: `triage` (triage dimensions), `specialist` (the
73
+ five specialists), `rules` (`project-rules`, `deps`), `verifier` (verifiers,
74
+ critic re-examine and critic-verify, fix verifiers), `critic` (completeness
75
+ critic), `prover`, `fixer`, `housekeeping`. Without `routing`, omit all three
76
+ fields so agents inherit the session model, as before. Record the route used
77
+ per agent in the `agents` receipt.
78
+
67
79
  ## Review stage
68
80
 
69
81
  Select dimensions exactly as the Claude workflow does:
@@ -153,8 +153,9 @@ an earlier run can never be merged into this one.
153
153
  1. Create the run directory once: `mktemp -d /tmp/lekker-polish.XXXXXX`, and
154
154
  use its printed path as `<POLISH_DIR>`. Copy the payload:
155
155
  `cp <PAYLOAD> <POLISH_DIR>/draft.json`.
156
- 2. Launch ONE agent (`model: 'sonnet'`; in Codex, one native agent or inline
157
- when none is available) with this brief: rewrite each `comments[].body` in
156
+ 2. Launch ONE agent on `ROUTING.polish` (model and effort; default
157
+ `model: 'sonnet'` when `ROUTING` is unset; in Codex, one native agent with
158
+ that route, or inline when none is available) with this brief: rewrite each `comments[].body` in
158
159
  `<POLISH_DIR>/draft.json` per `${SKILL_ROOT}/references/comment-voice.md`
159
160
  and write the full payload to `<POLISH_DIR>/polished.json`, same order, same
160
161
  `path`, `line` and `side`. Keep every identifier, `file:line`, number, link,
@@ -235,7 +235,8 @@ section if empty.)*
235
235
  ```
236
236
  Depth: <📦 deps | ⚡ scan | 🔍 medium | 🔬 deep>
237
237
  Diff size: ~<N> lines (~<N> tokens)
238
- Agents run: <N total>: <breakdown, e.g. "5 reviewers (sonnet) + 6 verifiers (sonnet) + 2 provers (sonnet) + 1 critic (sonnet)">
238
+ Agents run: <N total>: <breakdown, e.g. "5 reviewers (sonnet/high) + 6 verifiers (opus/high) + 2 provers (sonnet/high) + 1 critic (opus/high)">
239
+ Risk tier: <tier> (<auto: reason | --risk>), routes from the workflow's `routing` return value
239
240
  Rule checks: <N> hard-rule finding(s) validated with rule-specific checks (omit the line when 0)
240
241
  Context sources: <the subset of issue-tracker / chat / docs / framework-docs / monitoring / CI / prior-review-memory actually used>
241
242
 
@@ -257,7 +258,7 @@ Per-MTok pricing (input/output) - verified 2026-10-15 from the claude-api refere
257
258
 
258
259
  The main-loop line uses the session model's rate from this list. When the session model is not listed, say so in the cost block rather than leaving the main loop out silently.
259
260
 
260
- Reviewer agents, verifiers, provers, and the critic all run on sonnet; triage and housekeeping on haiku. Only the main loop (context gathering + this synthesis) runs on the session model: use the session model's actual ID for that tier.
261
+ Each agent role runs on the model and effort its risk tier assigns (README "Models and effort"); price each role at its own model. Only the main loop (context gathering + this synthesis) runs on the session model: use the session model's actual ID for that tier.
261
262
 
262
263
  For the Codex engine, use the model and usage metadata actually exposed by the
263
264
  native collaboration surface. Never relabel Codex agents as Claude tiers and
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env node
2
+ // Model and effort per lekker agent, picked from the PR's risk tier.
3
+ //
4
+ // Depth decides how many agents run; the tier decides how strong each one is.
5
+ // Effort comes before model size: a tier escalates effort first and moves to a
6
+ // bigger model only for risky changes. Finders stay one step below the gate
7
+ // (verifier), because the verifier decides what survives. The fast models
8
+ // (haiku, luna) only ever do first-pass triage or housekeeping.
9
+ //
10
+ // node model-matrix.mjs --host claude|codex [--risk <tier>] [--lines <n>]
11
+ // [--categories auth,billing,...] -- <changed-file>...
12
+ //
13
+ // `--categories` is the comma-joined `categories[].category` list from
14
+ // risk-paths.mjs. `--lines` is additions+deletions without lockfiles.
15
+ // Prints {host, tier, tierSource, reasons, visual, routing}.
16
+ import { pathToFileURL } from 'node:url'
17
+
18
+ export const TIERS = ['routine', 'standard', 'elevated', 'critical']
19
+ export const HOSTS = ['claude', 'codex']
20
+ export const EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max']
21
+
22
+ // Roles that decide whether a finding survives. Never a fast model.
23
+ export const GATE_ROLES = ['verifier', 'critic']
24
+
25
+ const r = (model, effort) => ({ model, effort })
26
+ const same = cell => [cell, cell, cell, cell]
27
+
28
+ // One row per role: [routine, standard, elevated, critical].
29
+ export const MATRIX = {
30
+ claude: {
31
+ triage: same(r('haiku', 'medium')),
32
+ specialist: [r('sonnet', 'medium'), r('sonnet', 'high'), r('opus', 'high'), r('opus', 'xhigh')],
33
+ rules: [r('sonnet', 'medium'), r('sonnet', 'medium'), r('sonnet', 'high'), r('sonnet', 'high')],
34
+ verifier: [r('sonnet', 'high'), r('sonnet', 'high'), r('opus', 'high'), r('fable', 'high')],
35
+ critic: [r('sonnet', 'medium'), r('sonnet', 'high'), r('opus', 'high'), r('fable', 'xhigh')],
36
+ prover: [r('sonnet', 'high'), r('sonnet', 'high'), r('sonnet', 'high'), r('opus', 'high')],
37
+ fixer: [r('sonnet', 'high'), r('sonnet', 'high'), r('sonnet', 'high'), r('opus', 'high')],
38
+ polish: same(r('sonnet', 'medium')),
39
+ housekeeping: same(r('haiku', 'low')),
40
+ },
41
+ codex: {
42
+ triage: same(r('gpt-6-luna', 'medium')),
43
+ specialist: [r('gpt-6.2-sol', 'medium'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high'), r('gpt-6.2-astra', 'xhigh')],
44
+ rules: [r('gpt-6.2-sol', 'medium'), r('gpt-6.2-sol', 'medium'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high')],
45
+ verifier: [r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high'), r('gpt-6.2-astra', 'high')],
46
+ critic: [r('gpt-6.2-sol', 'medium'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high'), r('gpt-6.2-astra', 'xhigh')],
47
+ prover: [r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high')],
48
+ fixer: [r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-sol', 'high'), r('gpt-6.2-astra', 'high')],
49
+ polish: same(r('gpt-6.2-sol', 'medium')),
50
+ housekeeping: same(r('gpt-6-luna', 'low')),
51
+ },
52
+ }
53
+
54
+ // A UI-only diff: Codex has a model positioned for visual reasoning.
55
+ const VISUAL_SPECIALIST = { codex: r('gpt-6.1-terra', 'high') }
56
+
57
+ export const FAST_MODELS = ['haiku', 'gpt-6-luna']
58
+
59
+ const DOC_FILE = /(^|\/)(docs?\/.*|[^/]+\.(md|mdx|txt|rst)|LICENSE[^/]*)$/i
60
+ const UI_FILE = /\.(tsx|jsx|vue|svelte|css|scss|sass|less|liquid|html)$/i
61
+ const TEST_FILE = /(^|\/)(__tests__|tests?|spec)\/|\.(test|spec)\.[a-z]+$/i
62
+ const MIGRATION_FILE = /(^|\/)migrations?\/|\.sql$/i
63
+
64
+ const CRITICAL_CATEGORIES = ['auth', 'billing']
65
+ const ELEVATED_CATEGORIES = ['ci-workflow', 'installer']
66
+ const DEEP_LINES = 800
67
+ const DEEP_FILES = 25
68
+
69
+ // Each rule: [tier, reason, test]. First match wins, so order is severity order.
70
+ const TIER_RULES = [
71
+ ['critical', 'auth or billing paths', s => s.categories.some(c => CRITICAL_CATEGORIES.includes(c))],
72
+ ['elevated', 'CI workflow or installer paths', s => s.categories.some(c => ELEVATED_CATEGORIES.includes(c))],
73
+ ['elevated', 'migrations or SQL', s => s.files.some(f => MIGRATION_FILE.test(f))],
74
+ ['elevated', `more than ${DEEP_LINES} changed lines or ${DEEP_FILES} files`, s => s.lines > DEEP_LINES || s.files.length > DEEP_FILES],
75
+ ['routine', 'documentation only', s => s.files.length > 0 && s.files.every(f => DOC_FILE.test(f))],
76
+ ]
77
+
78
+ export function tierFor({ files = [], categories = [], lines = 0, override } = {}) {
79
+ if (override !== undefined) {
80
+ if (!TIERS.includes(override)) throw new Error(`unknown risk tier "${override}"; use one of ${TIERS.join(', ')}`)
81
+ return { tier: override, tierSource: 'override', reasons: ['--risk flag'] }
82
+ }
83
+ const signals = { files, categories, lines }
84
+ const hit = TIER_RULES.find(([, , test]) => test(signals))
85
+ return hit
86
+ ? { tier: hit[0], tierSource: 'auto', reasons: [hit[1]] }
87
+ : { tier: 'standard', tierSource: 'auto', reasons: ['default'] }
88
+ }
89
+
90
+ export function isVisual(files = []) {
91
+ const code = files.filter(f => !TEST_FILE.test(f) && !DOC_FILE.test(f))
92
+ return code.length > 0 && code.every(f => UI_FILE.test(f))
93
+ }
94
+
95
+ export function routingFor(host, tier, { visual = false } = {}) {
96
+ if (!HOSTS.includes(host)) throw new Error(`unknown host "${host}"; use one of ${HOSTS.join(', ')}`)
97
+ if (!TIERS.includes(tier)) throw new Error(`unknown risk tier "${tier}"`)
98
+ const column = TIERS.indexOf(tier)
99
+ const routing = Object.fromEntries(Object.entries(MATRIX[host]).map(([role, row]) => [role, row[column]]))
100
+ return visual && VISUAL_SPECIALIST[host] ? { ...routing, specialist: VISUAL_SPECIALIST[host] } : routing
101
+ }
102
+
103
+ const ROLE_LABELS = {
104
+ triage: 'Triage (scan depth, first pass only)',
105
+ specialist: 'Specialists x5 (quality, implementation, simplification, conventions, test-quality)',
106
+ rules: 'Project rules, deps checklist',
107
+ verifier: 'Verifier, critic re-examine, fix verifier',
108
+ critic: 'Completeness critic (deep)',
109
+ prover: 'Prover (writes the failing test)',
110
+ fixer: 'Fixer (--fix)',
111
+ polish: 'Comment polish (--post)',
112
+ housekeeping: 'Housekeeping',
113
+ }
114
+ const MODEL_NAMES = {
115
+ haiku: 'Haiku', sonnet: 'Sonnet', opus: 'Opus', fable: 'Fable',
116
+ 'gpt-6-luna': 'Luna', 'gpt-6.2-sol': 'Sol', 'gpt-6.2-astra': 'Astra', 'gpt-6.1-terra': 'Terra',
117
+ }
118
+
119
+ // The README table, rendered from MATRIX so the two cannot drift
120
+ // (tests/lekker-model-matrix.test.mjs asserts README contains it).
121
+ export function matrixMarkdown() {
122
+ const cell = (c, x) => `${MODEL_NAMES[c.model]} ${c.effort} / ${MODEL_NAMES[x.model]} ${x.effort}`
123
+ const rows = Object.keys(MATRIX.claude).map(role =>
124
+ `| ${ROLE_LABELS[role]} | ${TIERS.map((_, i) => cell(MATRIX.claude[role][i], MATRIX.codex[role][i])).join(' | ')} |`)
125
+ return [`| Agent | ${TIERS.join(' | ')} |`, `| --- |${TIERS.map(() => ' --- |').join('')}`, ...rows].join('\n')
126
+ }
127
+
128
+ function parseArgs(argv) {
129
+ const sep = argv.indexOf('--')
130
+ const flags = sep === -1 ? argv : argv.slice(0, sep)
131
+ const files = sep === -1 ? [] : argv.slice(sep + 1)
132
+ const value = name => {
133
+ const i = flags.indexOf(name)
134
+ return i === -1 ? undefined : flags[i + 1]
135
+ }
136
+ const categories = (value('--categories') ?? '').split(',').map(s => s.trim()).filter(Boolean)
137
+ return { host: value('--host'), override: value('--risk'), lines: Number(value('--lines') ?? 0), categories, files }
138
+ }
139
+
140
+ function main(argv) {
141
+ const { host, override, lines, categories, files } = parseArgs(argv)
142
+ try {
143
+ const { tier, tierSource, reasons } = tierFor({ files, categories, lines, override })
144
+ const visual = isVisual(files)
145
+ console.log(JSON.stringify({ host, tier, tierSource, reasons, visual, routing: routingFor(host, tier, { visual }) }))
146
+ } catch (error) {
147
+ console.error(`model-matrix: ${error.message}`)
148
+ process.exit(2)
149
+ }
150
+ }
151
+
152
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) main(process.argv.slice(2))
@@ -333,7 +333,7 @@ console.log('\ndeps depth: routing, classifier, line validation')
333
333
  check('workflow.js defines dimensionsFor', Boolean(dimsSrc), true)
334
334
  if (dimsSrc) {
335
335
  const dimensionsFor = new Function(dimsSrc + '\nreturn dimensionsFor')()
336
- const M = { review: 'r', triage: 't' }
336
+ const M = { specialist: { model: 's' }, triage: { model: 't' }, rules: { model: 'r' } }
337
337
  check('deps runs exactly one agent', dimensionsFor('deps', M).map(d => d.file), ['deps.md'])
338
338
  check('scan runs the triage pair plus project-rules', dimensionsFor('scan', M).map(d => d.key), ['triage-quality', 'triage-logic', 'project-rules'])
339
339
  check('medium runs five specialists plus project-rules', dimensionsFor('medium', M).length, 6)
@@ -416,27 +416,39 @@ function shouldVerify(finding, depth) {
416
416
  // a large rules file was missed when the check was only a side duty of generalist
417
417
  // agents. It always runs because the script cannot cheaply tell whether the
418
418
  // context holds rules; its prompt returns no findings when they are absent.
419
- function dimensionsFor(depth, MODEL) {
419
+ function dimensionsFor(depth, ROUTE) {
420
420
  if (depth === 'deps') {
421
- return [{ key: 'deps', file: 'deps.md', model: MODEL.review }]
421
+ return [{ key: 'deps', file: 'deps.md', route: ROUTE.rules }]
422
422
  }
423
423
  if (depth === 'scan') {
424
424
  return [
425
- { key: 'triage-quality', file: 'triage-quality.md', model: MODEL.triage },
426
- { key: 'triage-logic', file: 'triage-logic.md', model: MODEL.triage },
427
- { key: 'project-rules', file: 'project-rules.md', model: MODEL.review },
425
+ { key: 'triage-quality', file: 'triage-quality.md', route: ROUTE.triage },
426
+ { key: 'triage-logic', file: 'triage-logic.md', route: ROUTE.triage },
427
+ { key: 'project-rules', file: 'project-rules.md', route: ROUTE.rules },
428
428
  ]
429
429
  }
430
430
  return [
431
- { key: 'quality', file: 'quality.md', model: MODEL.review },
432
- { key: 'implementation', file: 'implementation.md', model: MODEL.review },
433
- { key: 'simplification', file: 'simplification.md', model: MODEL.review },
434
- { key: 'conventions', file: 'conventions.md', model: MODEL.review },
435
- { key: 'test-quality', file: 'test-quality.md', model: MODEL.review },
436
- { key: 'project-rules', file: 'project-rules.md', model: MODEL.review },
431
+ { key: 'quality', file: 'quality.md', route: ROUTE.specialist },
432
+ { key: 'implementation', file: 'implementation.md', route: ROUTE.specialist },
433
+ { key: 'simplification', file: 'simplification.md', route: ROUTE.specialist },
434
+ { key: 'conventions', file: 'conventions.md', route: ROUTE.specialist },
435
+ { key: 'test-quality', file: 'test-quality.md', route: ROUTE.specialist },
436
+ { key: 'project-rules', file: 'project-rules.md', route: ROUTE.rules },
437
437
  ]
438
438
  }
439
439
 
440
+ // Model and effort for one role, from the `routing` arg that
441
+ // scripts/model-matrix.mjs builds from the PR's risk tier. An absent or
442
+ // malformed cell keeps the historical default, so an older caller runs exactly
443
+ // as before.
444
+ const VALID_EFFORTS = ['low', 'medium', 'high', 'xhigh', 'max']
445
+ function routeOf(routing, role, fallback) {
446
+ const cell = routing && routing[role]
447
+ const valid = Boolean(cell) && typeof cell.model === 'string' && cell.model.length > 0
448
+ && (cell.effort === undefined || VALID_EFFORTS.includes(cell.effort))
449
+ return valid ? { model: cell.model, effort: cell.effort } : fallback
450
+ }
451
+
440
452
  /**
441
453
  * Does the finding carry enough of a composed boundary map to attempt a
442
454
  * proof? Requires an entry point and a consumer, plus at least one of a
@@ -588,6 +600,7 @@ const {
588
600
  engine: engineArg,
589
601
  findingsFile,
590
602
  testRunner,
603
+ routing,
591
604
  } = input
592
605
 
593
606
  // 'revmux' skips straight to Prove on pre-computed findings, so Prove's
@@ -596,6 +609,18 @@ const ENGINE = (engineArg === 'revmux') ? 'revmux' : 'workflow'
596
609
 
597
610
  const targetLabel = targetLabelArg || `PR #${prNumber}`
598
611
 
612
+ const ROUTE = {
613
+ specialist: routeOf(routing, 'specialist', { model: 'sonnet' }),
614
+ triage: routeOf(routing, 'triage', { model: 'haiku' }),
615
+ rules: routeOf(routing, 'rules', { model: 'sonnet' }),
616
+ verifier: routeOf(routing, 'verifier', { model: 'sonnet', effort: 'high' }),
617
+ critic: routeOf(routing, 'critic', { model: 'sonnet' }),
618
+ prover: routeOf(routing, 'prover', { model: 'sonnet', effort: 'high' }),
619
+ }
620
+ const routeLabel = Object.keys(ROUTE).map(function(role) {
621
+ return `${role}=${ROUTE[role].model}${ROUTE[role].effort ? '/' + ROUTE[role].effort : ''}`
622
+ }).join(' ')
623
+
599
624
  if (!repoSlug || (!prNumber && !targetLabelArg) || !depth || !diffFile || !contextFile || !promptDir) {
600
625
  throw new Error(
601
626
  'lekker-review workflow: missing required args (got type ' + typeof args +
@@ -654,8 +679,8 @@ const budgetAtStart = budget.spent()
654
679
  // Dimensions by depth
655
680
  // -------------------------------------------------------------------------
656
681
 
657
- const MODEL = { review: 'sonnet', triage: 'haiku' }
658
- const dimensions = dimensionsFor(depth, MODEL)
682
+ log(`routing: ${routing ? 'tiered' : 'defaults'} ${routeLabel}`)
683
+ const dimensions = dimensionsFor(depth, ROUTE)
659
684
 
660
685
  const wtDisplay = worktreePath || 'null (scan mode: diff only)'
661
686
 
@@ -758,7 +783,8 @@ const budgetAtStart = budget.spent()
758
783
  label: `review:${dim.key}`,
759
784
  phase: 'Review',
760
785
  schema,
761
- model: dim.model,
786
+ model: dim.route.model,
787
+ effort: dim.route.effort,
762
788
  })
763
789
 
764
790
  if (!result) {
@@ -839,10 +865,10 @@ const budgetAtStart = budget.spent()
839
865
 
840
866
  const verdict = await agent(verifierPrompt(finding), {
841
867
  label: `verify:${finding.file}:${finding.line}`,
842
- model: 'sonnet',
868
+ model: ROUTE.verifier.model,
843
869
  phase: 'Verify',
844
870
  schema: VERDICT_SCHEMA,
845
- effort: 'high',
871
+ effort: ROUTE.verifier.effort,
846
872
  })
847
873
 
848
874
  if (!verdict) {
@@ -978,9 +1004,10 @@ const budgetAtStart = budget.spent()
978
1004
  ].join(' '),
979
1005
  {
980
1006
  label: 'critic',
981
- model: 'sonnet',
1007
+ model: ROUTE.critic.model,
982
1008
  phase: 'Critic',
983
1009
  schema: CRITIC_SCHEMA,
1010
+ effort: ROUTE.critic.effort,
984
1011
  }
985
1012
  )
986
1013
 
@@ -1003,10 +1030,10 @@ const budgetAtStart = budget.spent()
1003
1030
  ].join(' '),
1004
1031
  {
1005
1032
  label: `critic-reexamine:${angle.file}:${angle.line}`,
1006
- model: 'sonnet',
1033
+ model: ROUTE.verifier.model,
1007
1034
  phase: 'Critic',
1008
1035
  schema: FINDINGS_SCHEMA,
1009
- effort: 'high',
1036
+ effort: ROUTE.verifier.effort,
1010
1037
  }
1011
1038
  )
1012
1039
 
@@ -1022,10 +1049,10 @@ const budgetAtStart = budget.spent()
1022
1049
  agentCount++
1023
1050
  const verdict = await agent(verifierPrompt(newFinding), {
1024
1051
  label: `critic-verify:${newFinding.file}:${newFinding.line}`,
1025
- model: 'sonnet',
1052
+ model: ROUTE.verifier.model,
1026
1053
  phase: 'Critic',
1027
1054
  schema: VERDICT_SCHEMA,
1028
- effort: 'high',
1055
+ effort: ROUTE.verifier.effort,
1029
1056
  })
1030
1057
 
1031
1058
  if (!verdict || verdict.verdict === 'dropped') {
@@ -1121,8 +1148,8 @@ const budgetAtStart = budget.spent()
1121
1148
  label: 'prove:' + finding.file + ':' + finding.line,
1122
1149
  phase: 'Prove',
1123
1150
  schema: PROOF_SCHEMA,
1124
- model: 'sonnet',
1125
- effort: 'high',
1151
+ model: ROUTE.prover.model,
1152
+ effort: ROUTE.prover.effort,
1126
1153
  })
1127
1154
 
1128
1155
  if (!result) {
@@ -1195,4 +1222,5 @@ const budgetAtStart = budget.spent()
1195
1222
  mockSmells: Array.isArray(testQualityResult.mockSmells) ? testQualityResult.mockSmells : [],
1196
1223
  outputTokens: budget.spent() - budgetAtStart,
1197
1224
  turnTokensTotal: budget.spent(),
1225
+ routing: ROUTE,
1198
1226
  }, Object.assign({ engine: ENGINE }, revmuxPassthrough || {}))
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-obsidian",
3
3
  "description": "Keep an Obsidian vault in sync with work: PR sync, task rollover, morning routine.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-product",
3
3
  "description": "Take a product idea to a shippable build: MVP passes, full-stack scaffolds, UX/UI quality loops, launch plans.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-reflection",
3
3
  "description": "Look back and improve: self-critique, retrospectives, performance review, rapid learning.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-release",
3
3
  "description": "Ship a release: semantic-release setup, changelogs, store listing copy, release-day routine.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-skill-meta",
3
3
  "description": "Author and maintain agent skills and the AI toolchain itself.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "olko-web-ops",
3
3
  "description": "Operate a website: WAF rules, search console audits, analytics bootstrap, docs indexes.",
4
- "version": "1.88.0",
4
+ "version": "1.89.0",
5
5
  "author": {
6
6
  "name": "Oleg Koval"
7
7
  },