@mrciphersmith/keryx 0.2.69 → 0.2.71

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 (183) hide show
  1. package/dist/cli.js +11136 -4863
  2. package/docs/README.md +54 -0
  3. package/docs/requirements/shared-agent-context/README.md +104 -0
  4. package/package.json +3 -2
  5. package/src/gdgraph/build-lang.test.ts +10 -3
  6. package/src/gdgraph/build.ts +54 -9
  7. package/src/gdgraph/import-kind.test.ts +205 -0
  8. package/src/gdgraph/query.ts +6 -1
  9. package/src/gdgraph/types.ts +34 -0
  10. package/src/gdskills/bundled/rules/core/model-selection.mdc +184 -31
  11. package/src/gdskills/bundled/rules/core/skills-storage-workflow.mdc +36 -0
  12. package/src/gdskills/bundled/rules/core/subagent-status-protocol.md +27 -1
  13. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.codex.md +1 -1
  14. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.cursor.md +1 -1
  15. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.md +2 -1
  16. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.opencode.md +1 -1
  17. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.zed.md +1 -1
  18. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.codex.md +1 -1
  19. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.cursor.md +1 -1
  20. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.md +1 -1
  21. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.opencode.md +1 -1
  22. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.zed.md +1 -1
  23. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.codex.md +1 -1
  24. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.cursor.md +1 -1
  25. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.md +1 -1
  26. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.opencode.md +1 -1
  27. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.zed.md +1 -1
  28. package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.codex.md +1 -1
  29. package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.cursor.md +1 -1
  30. package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.md +1 -1
  31. package/src/gdskills/bundled/skills/orchestration/flow-orchestrator/SKILL.md +159 -20
  32. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.codex.md +1 -1
  33. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.cursor.md +1 -1
  34. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.md +1 -1
  35. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.opencode.md +1 -1
  36. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.zed.md +1 -1
  37. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.codex.md +1 -1
  38. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.cursor.md +1 -1
  39. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.md +2 -1
  40. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.opencode.md +1 -1
  41. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.zed.md +1 -1
  42. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.codex.md +28 -3
  43. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.cursor.md +28 -3
  44. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.md +28 -3
  45. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.opencode.md +28 -3
  46. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.zed.md +28 -3
  47. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.codex.md +20 -2
  48. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.cursor.md +20 -2
  49. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.md +22 -3
  50. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.opencode.md +20 -2
  51. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.zed.md +20 -2
  52. package/src/gdskills/bundled/skills/planning/autodoc-analyst/SKILL.md +2 -1
  53. package/src/gdskills/bundled/skills/planning/autodoc-architect/SKILL.md +3 -1
  54. package/src/gdskills/bundled/skills/planning/autodoc-assembler/SKILL.md +2 -1
  55. package/src/gdskills/bundled/skills/planning/autodoc-orchestrator/SKILL.md +2 -1
  56. package/src/gdskills/bundled/skills/planning/autodoc-scanner/SKILL.md +2 -1
  57. package/src/gdskills/bundled/skills/planning/autodoc-writer/SKILL.md +2 -1
  58. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.codex.md +1 -1
  59. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.cursor.md +1 -1
  60. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.md +1 -1
  61. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.codex.md +1 -1
  62. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.cursor.md +1 -1
  63. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.md +2 -1
  64. package/src/gdskills/bundled/skills/planning/docpack-orchestrator/SKILL.md +1 -1
  65. package/src/gdskills/bundled/skills/planning/docpack-review/SKILL.md +1 -1
  66. package/src/gdskills/bundled/skills/planning/interview/SKILL.codex.md +1 -1
  67. package/src/gdskills/bundled/skills/planning/interview/SKILL.cursor.md +1 -1
  68. package/src/gdskills/bundled/skills/planning/interview/SKILL.md +1 -1
  69. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.codex.md +1 -1
  70. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.cursor.md +1 -1
  71. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.md +1 -1
  72. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.codex.md +1 -1
  73. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.cursor.md +1 -1
  74. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.md +2 -1
  75. package/src/gdskills/bundled/skills/planning/planner/SKILL.codex.md +1 -1
  76. package/src/gdskills/bundled/skills/planning/planner/SKILL.cursor.md +1 -1
  77. package/src/gdskills/bundled/skills/planning/planner/SKILL.md +2 -1
  78. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.codex.md +1 -1
  79. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.cursor.md +1 -1
  80. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.md +1 -1
  81. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.opencode.md +1 -1
  82. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.zed.md +1 -1
  83. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.codex.md +1 -1
  84. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.cursor.md +1 -1
  85. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.md +2 -1
  86. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.codex.md +1 -1
  87. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.cursor.md +1 -1
  88. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.md +2 -1
  89. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.codex.md +1 -1
  90. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.cursor.md +1 -1
  91. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.md +2 -1
  92. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.codex.md +1 -1
  93. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.cursor.md +1 -1
  94. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.md +2 -1
  95. package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.codex.md +1 -1
  96. package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.cursor.md +1 -1
  97. package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.md +1 -1
  98. package/src/gdskills/bundled/skills/platform/hookify/SKILL.codex.md +1 -1
  99. package/src/gdskills/bundled/skills/platform/hookify/SKILL.cursor.md +1 -1
  100. package/src/gdskills/bundled/skills/platform/hookify/SKILL.md +1 -1
  101. package/src/gdskills/bundled/skills/quality/changelog/SKILL.codex.md +1 -1
  102. package/src/gdskills/bundled/skills/quality/changelog/SKILL.cursor.md +1 -1
  103. package/src/gdskills/bundled/skills/quality/changelog/SKILL.md +1 -1
  104. package/src/gdskills/bundled/skills/quality/commit/SKILL.codex.md +1 -1
  105. package/src/gdskills/bundled/skills/quality/commit/SKILL.cursor.md +1 -1
  106. package/src/gdskills/bundled/skills/quality/commit/SKILL.md +1 -1
  107. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.codex.md +1 -1
  108. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.cursor.md +1 -1
  109. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.md +1 -1
  110. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.codex.md +1 -1
  111. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.cursor.md +1 -1
  112. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.md +1 -1
  113. package/src/gdskills/bundled/skills/quality/deploy/SKILL.codex.md +1 -1
  114. package/src/gdskills/bundled/skills/quality/deploy/SKILL.cursor.md +1 -1
  115. package/src/gdskills/bundled/skills/quality/deploy/SKILL.md +1 -1
  116. package/src/gdskills/bundled/skills/quality/metaproject-security/SKILL.md +1 -1
  117. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.codex.md +1 -1
  118. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.cursor.md +1 -1
  119. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.md +1 -1
  120. package/src/gdskills/bundled/skills/quality/pr/SKILL.codex.md +1 -1
  121. package/src/gdskills/bundled/skills/quality/pr/SKILL.cursor.md +1 -1
  122. package/src/gdskills/bundled/skills/quality/pr/SKILL.md +1 -1
  123. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.codex.md +1 -1
  124. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.cursor.md +1 -1
  125. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.md +1 -1
  126. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.opencode.md +1 -1
  127. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.zed.md +1 -1
  128. package/src/gdskills/bundled/skills/quality/push/SKILL.codex.md +1 -1
  129. package/src/gdskills/bundled/skills/quality/push/SKILL.cursor.md +1 -1
  130. package/src/gdskills/bundled/skills/quality/push/SKILL.md +1 -1
  131. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.codex.md +1 -1
  132. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.cursor.md +1 -1
  133. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.md +1 -1
  134. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.codex.md +1 -1
  135. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.cursor.md +1 -1
  136. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.md +1 -1
  137. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.codex.md +1 -1
  138. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.cursor.md +1 -1
  139. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.md +1 -1
  140. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.opencode.md +1 -1
  141. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.zed.md +1 -1
  142. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.codex.md +1 -1
  143. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.cursor.md +1 -1
  144. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.md +1 -1
  145. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.opencode.md +1 -1
  146. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.zed.md +1 -1
  147. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.codex.md +1 -1
  148. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.cursor.md +1 -1
  149. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.md +1 -1
  150. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.opencode.md +1 -1
  151. package/src/gdskills/bundled/skills/review/code-b091-review/SKILL.zed.md +1 -1
  152. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.codex.md +1 -1
  153. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.cursor.md +1 -1
  154. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.md +2 -1
  155. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.opencode.md +1 -1
  156. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.zed.md +1 -1
  157. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.codex.md +1 -1
  158. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.cursor.md +1 -1
  159. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.md +1 -1
  160. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.opencode.md +1 -1
  161. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.zed.md +1 -1
  162. package/src/gdskills/bundled/skills/review/review-architecture/SKILL.md +37 -10
  163. package/src/gdskills/bundled/skills/review/review-backend/SKILL.md +48 -14
  164. package/src/gdskills/bundled/skills/review/review-clean-code/SKILL.md +49 -12
  165. package/src/gdskills/bundled/skills/review/review-core-boundaries/SKILL.md +34 -2
  166. package/src/gdskills/bundled/skills/review/review-flow-graph/SKILL.md +33 -2
  167. package/src/gdskills/bundled/skills/review/review-frontend/SKILL.md +70 -29
  168. package/src/gdskills/bundled/skills/review/review-frontend-conventions/SKILL.md +34 -3
  169. package/src/gdskills/bundled/skills/review/review-highload/SKILL.md +49 -15
  170. package/src/gdskills/bundled/skills/review/review-logic/SKILL.md +39 -11
  171. package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.md +659 -64
  172. package/src/gdskills/bundled/skills/review/review-orchestrator/reviewer-finding.schema.json +7 -0
  173. package/src/gdskills/bundled/skills/review/review-orchestrator/verification-claim.schema.json +78 -0
  174. package/src/gdskills/bundled/skills/review/review-performance/SKILL.md +43 -13
  175. package/src/gdskills/bundled/skills/review/review-pr-feedback/SKILL.md +8 -2
  176. package/src/gdskills/bundled/skills/review/review-regression/SKILL.md +185 -0
  177. package/src/gdskills/bundled/skills/review/review-security-code/SKILL.md +44 -13
  178. package/src/gdskills/bundled/skills/review/review-style/SKILL.md +26 -6
  179. package/src/gdskills/bundled/skills/review/review-testing-practices/SKILL.md +35 -3
  180. package/src/gdskills/bundled/skills/review/review-verifier/SKILL.md +276 -0
  181. package/src/gdskills/contracts/review-finding.schema.json +119 -1
  182. package/src/gdskills/contracts/subagent-dispatch.schema.json +59 -3
  183. package/src/gdskills/bundled/skills/review/review-strict/SKILL.md +0 -328
@@ -1,53 +1,206 @@
1
1
  ---
2
- description: "Model selection workflow for sub-agents. Detects available models and allows user to choose."
2
+ description: "Adaptive model selection for sub-agent dispatches. Skills declare a tier; the tier is resolved against the models the active provider actually reports at runtime, without asking."
3
3
  alwaysApply: false
4
4
  ---
5
5
 
6
6
  # Model Selection for Sub-Agents
7
7
 
8
8
  ## Purpose
9
- When launching a sub-agent or skill, detect available models in the current environment and allow the user to choose.
10
9
 
11
- ## Trigger
12
- When you need to launch a sub-agent/skill and want to use a different model than the current one.
10
+ Match the model to the work. A reviewer scanning a twelve-line diff and a
11
+ regression reviewer reasoning across a forty-file blast radius should not run on
12
+ the same model: the cheap work pays flagship prices, and the hard work gets no
13
+ more capability than the trivial.
13
14
 
14
- ## Available Models Detection
15
+ ## Tiers, not model names
15
16
 
16
- Run to detect available models:
17
+ A skill declares a **tier**. It never declares a model.
18
+
19
+ A model name in a skill is wrong the day the provider changes and unusable for
20
+ anyone on a different provider. There are three tiers:
21
+
22
+ | Tier | For |
23
+ |---|---|
24
+ | `light` | mechanical, verifiable work — pre-filter, `class_scope` existence checks, comment collection, formatting a reply |
25
+ | `standard` | ordinary reviewing and implementation — the default |
26
+ | `deep` | genuinely hard reasoning — regression review across the blast radius, a strategy change after a failed loop, synthesis across many findings |
27
+
28
+ Declared in SKILL.md frontmatter:
29
+
30
+ ```yaml
31
+ ---
32
+ name: review-architecture
33
+ model_tier: deep
34
+ ---
35
+ ```
36
+
37
+ An undeclared skill runs at `standard`. A skill that writes a model name into
38
+ `model_tier` fails the guard in `src/gdskills/model-tier.test.ts`.
39
+
40
+ ## Resolving a tier: discover, rank, fall back
41
+
42
+ There is **no table of models** anywhere in the resolution, and there must not
43
+ be. A fixed list of model ids is stale the day a provider ships anything, and it
44
+ is wrong for every operator whose environment differs from the one it was written
45
+ in. The candidate set is discovered at runtime.
46
+
47
+ `src/commands/select.ts` already detects providers and every `DetectedProvider`
48
+ carries `models: string[]`. That list — for the **session's own provider**, so a
49
+ child never resolves onto a provider the parent holds no grant for — is the whole
50
+ candidate set. `src/gdskills/model-tier.ts` then:
51
+
52
+ 1. **discovers** the candidates (passed in, never looked up: the module reads no
53
+ network, no filesystem, no environment);
54
+ 2. **ranks** them by size markers in their names — `MODEL_RANK_HINTS`;
55
+ 3. **places the tiers relative to the session's own model**:
56
+
57
+ | Tier | Resolves to |
58
+ |---|---|
59
+ | `standard` | the session's model, always |
60
+ | `deep` | the highest-ranked discovered model **strictly above** the session's, else the session's |
61
+ | `light` | the lowest-ranked discovered model **strictly below** the session's, else the session's |
62
+
63
+ Anchoring on the session model is what makes "never a downgrade" checkable
64
+ rather than hoped for: a tier can only move away from the session model in the
65
+ direction its own name points, and a candidate at the session's own rank is a
66
+ lateral move and never taken.
67
+
68
+ ## What the hints are, and what they are not
69
+
70
+ Capability cannot be derived from a bare string — `haiku` is smaller than `opus`
71
+ and nothing about the two strings says so. `MODEL_RANK_HINTS` is that irreducible
72
+ residue, and it is kept in the smallest shape that works:
73
+
74
+ - it names **size words** (`mini`, `lite`, `flash`, `haiku`, `pro`, `opus`,
75
+ `max`, `ultra`, …), never models, so it claims nothing about what exists and
76
+ cannot go stale;
77
+ - it is applied to whatever detection reported, so an unfamiliar vendor is still
78
+ ranked if its names use those words;
79
+ - a model matching **no** hint is *unranked*, which is not the same as ranked
80
+ zero — it is simply not placed;
81
+ - it is one array, overridable per call.
82
+
83
+ A model whose name is a codename carrying no size is unrankable by design. That
84
+ is the honest outcome, not a gap to be patched with folklore.
85
+
86
+ ## Falling back
87
+
88
+ Ranking is **refused**, and every tier keeps the session's provider and model,
89
+ when:
90
+
91
+ - nothing was discovered, or the session's provider is absent from the catalogue
92
+ (an external CLI runtime, or detection that has not run);
93
+ - the provider reported no models;
94
+ - the hints cannot place the **session's own** model — with no anchor, no
95
+ candidate can be called larger or smaller.
96
+
97
+ A refusal **never** fails a dispatch and **never** causes a silent downgrade.
98
+ Degrading capability because discovery failed is the worst of the three outcomes.
99
+
100
+ Do not "fix" a fallback by adding model ids to the code. Add a size word to the
101
+ hints if one genuinely applies, or leave it: running on the session's model is a
102
+ correct answer.
103
+
104
+ ## Where this actually runs
105
+
106
+ Two places, and they are not the same shape:
107
+
108
+ - **`spawn_subagent`** (`src/harness/tool/builtin/spawn-subagent-tool.ts`) takes an
109
+ optional `model_tier` input and does the rest in code: it builds the tier map
110
+ with `buildTierMap` from its host's detection result, hands it to
111
+ `resolveChildModel`, and records the outcome on the dispatch's run trace.
112
+ Omitting `model_tier` inherits the parent's model, exactly as before the field
113
+ existed.
114
+ - **An orchestrator authoring a dispatch document** *runs a command*:
115
+ `keryx review tier`. It takes the signals below as flags and prints the `model`
116
+ block ready to paste — the tier, the ordered rule ids that produced it, the
117
+ resolved provider/model, `tier_resolution` and `model_discovery`. `--json`
118
+ prints the block alone.
119
+
120
+ That second bullet used to say the orchestrator "calls `decideDispatchModel`".
121
+ An orchestrator is an agent following prose and **cannot call a TypeScript
122
+ function**, so what actually happened was a model reading a table of signals and
123
+ doing the arithmetic in its head — the exact mechanical work this programme moves
124
+ out of skills and into the code that consumes them. `keryx review tier` is that
125
+ code's entry point; `decideDispatchModel` is what it calls.
126
+
127
+ Nothing reads a recorded resolution back and checks it. These fields explain a
128
+ finished run; they do not gate one.
129
+
130
+ ## Choosing the tier
131
+
132
+ The tier is **computed, not judged**. Run:
17
133
 
18
134
  ```bash
19
- .metaproject/scripts/detect-models.sh
135
+ keryx review tier --scope blast-radius --findings 12 --diff-lines 340 \
136
+ --verifier execution --fix-attempt 2 --security \
137
+ --forced-strategy-change --json
20
138
  ```
21
139
 
22
- ## Current Environment Models
140
+ Every flag is a signal the orchestrator already holds before it dispatches: the
141
+ round's scope, its own attempt counter, the diff it computed, the findings it is
142
+ holding, the verification method it is about to ask for. None of them is a
143
+ model's self-report — no model is ever asked to rate its own difficulty.
144
+
145
+ The rules `assignTier` applies, in the order it applies them:
146
+
147
+ | Signal | Flag | Effect |
148
+ |---|---|---|
149
+ | scope is `blast-radius` | `--scope blast-radius` | at least `deep` |
150
+ | fix attempt >= 2 on the same finding | `--fix-attempt <n>` | raise one tier |
151
+ | forced strategy change after the loop cap | `--forced-strategy-change` | `deep` |
152
+ | finding count <= 3 **and** diff <= 50 lines | `--findings <n> --diff-lines <n>` | allow `light` |
153
+ | verification method is `execution` or `site-check` | `--verifier <method>` | `light` — the evidence comes from running something, not from reasoning |
154
+ | any security finding in scope | `--security` | never below `standard` |
155
+
156
+ Floors are applied after downgrades, so "at least `deep`" means at least: a
157
+ blast-radius round over a twelve-line diff is still a blast-radius round.
158
+
159
+ The session's provider/model come from the selection `keryx shell` persisted, and
160
+ the candidate set from live provider detection. A caller that already holds
161
+ either passes `--session-provider`/`--session-model` and `--catalog` instead of
162
+ paying for the lookup. **There is no `--tier` flag, and there will not be**:
163
+ accepting a hand-written tier would put the arithmetic straight back in the
164
+ caller's head.
23
165
 
24
- ### Codex
25
- - `gpt-5.2-codex` - Frontier agentic coding model (recommended)
26
- - `gpt-5.3-codex` - Latest frontier agentic coding model
27
- - `gpt-5.1-codex-max` - Codex-optimized flagship for deep reasoning
28
- - `gpt-5.1-codex-mini` - Cheaper, faster, less capable
29
- - `gpt-5.2` - Latest frontier model
166
+ When nothing can be worked out — no persisted session, an unrankable catalogue,
167
+ an unrankable session model — the block says `inherit: true` and the dispatch
168
+ runs on the **caller's own model**. Exit status is still 0: a fallback is an
169
+ answer, not a failure.
30
170
 
31
- ### Cursor
32
- Uses OpenAI models (GPT-4, GPT-4o, etc.)
171
+ ## Recording the decision
33
172
 
34
- ### Antigravity
35
- Check configuration in `~/.antigravity/`
173
+ The dispatch carries the tier, the ordered rule ids that produced it, which of
174
+ the three outcomes occurred, and what was on the table when it did —
175
+ `model.tier`, `model.tier_reasons`, `model.tier_resolution` and
176
+ `model.model_discovery` in
177
+ `.metaproject/core/gdskills/contracts/subagent-dispatch.schema.json`.
36
178
 
37
- ### OpenCode
38
- Check configuration in `~/.config/opencode/`
179
+ `tier_resolution` distinguishes three facts that must not be flattened:
39
180
 
40
- ### Zed
41
- Uses AI models configured in Zed settings
181
+ | Value | Means |
182
+ |---|---|
183
+ | `discovered` | a discovered model was assigned to this tier |
184
+ | `session-ranked` | ranking worked and placed the tier at the session's model |
185
+ | `session-fallback` | ranking was refused; the session's model is kept |
42
186
 
43
- ## Workflow
187
+ "Fell back to the session model" and "assigned the session model because it
188
+ ranked there" are different facts. A run that cannot be explained afterwards is
189
+ what these fields exist to prevent. Record them on every dispatch that resolves
190
+ a tier — `keryx review tier` prints all four together as one pasteable block, so
191
+ recording them is one copy rather than four decisions.
44
192
 
45
- 1. **Detect available models** - Run `detect-models.sh` or check known configurations
46
- 2. **Present options** - Show user available models with descriptions
47
- 3. **Get confirmation** - Ask user which model to use
48
- 4. **Launch sub-agent** - Use selected model for the sub-agent
193
+ ## Mandatory behavior
49
194
 
50
- ## Mandatory Behavior
51
- - Always ask user before changing model for sub-agents
52
- - Show model descriptions to help user decide
53
- - Default to current model unless user explicitly chooses otherwise
195
+ - Declare a tier in the skill; resolve the model at dispatch time.
196
+ - **Run `keryx review tier` — do not work the tier out by hand.** Assigning it
197
+ from the table above by reading is the mechanical step this rule exists to
198
+ remove.
199
+ - **Do not ask the operator which model to use per dispatch.** Asking every time
200
+ is what made adaptive selection impossible.
201
+ - Never write a concrete model name into a skill, a rule, a dispatch template, or
202
+ the resolution code.
203
+ - Take the candidate set from runtime detection. Never from a literal list of
204
+ what exists.
205
+ - When the candidates cannot be ranked, keep the session model. Never substitute
206
+ a cheaper one.
@@ -29,6 +29,42 @@ Before creating or editing a skill, ask and confirm:
29
29
 
30
30
  `SKILL.md` is always required. Platform variants are optional — if absent, `keryx update` installs `SKILL.md` as fallback.
31
31
 
32
+ ## Frontmatter Fields (Agent Skills spec alignment)
33
+
34
+ `SKILL.md` frontmatter follows the published Agent Skills specification
35
+ (agentskills.io — the format Zed adopted when it dropped its own Rules
36
+ Library), with two deliberate additions. Flow 203 removed two accidental
37
+ divergences that had crept in; keep both fixes intact when authoring or
38
+ editing a skill:
39
+
40
+ - **`version` lives in `metadata.version` only.** The spec has no top-level
41
+ `version` field — its own example nests it under `metadata`. Do not
42
+ reintroduce a top-level `version:` key; nothing in this codebase reads one.
43
+ - **`compatibility` carries the spec's meaning, not ours.** The spec defines
44
+ `compatibility` as environment requirements written in prose (e.g. "Requires
45
+ git, docker, jq, and access to the internet"). Our machine-readable CSV of
46
+ supported harnesses (`cursor,codex,zed,opencode,claude`) lives instead at
47
+ `metadata.compatible_harnesses`. Do not put a harness CSV back into
48
+ `compatibility` — if a skill genuinely needs to declare environment
49
+ requirements, write them there as prose, per the spec.
50
+
51
+ Two divergences are deliberate and stay — a later pass must not "fix" them
52
+ back toward the spec:
53
+
54
+ - **`triggers`** — a list of trigger phrases. Not in the spec, and absent from
55
+ every skill collection surveyed while building this convention; the spec's
56
+ only discovery mechanism is semantic matching on `description`. `triggers`
57
+ gives the router a cheap, deterministic first-pass match before falling back
58
+ to semantic matching. It is additive and costs nothing as long as
59
+ `description` stays self-sufficient on its own — never let `triggers` carry
60
+ meaning `description` lacks.
61
+ - **Per-skill `input-contract.schema.json` / `output-contract.schema.json`**
62
+ (sibling files, not frontmatter keys) — genuinely unique to this codebase.
63
+ Nothing in the spec or any surveyed collection defines one, because the spec
64
+ assumes a single agent reading a single skill file. This project dispatches
65
+ typed payloads to subagent workers instead, which the spec does not attempt
66
+ to address.
67
+
32
68
  ## Global Sync Mapping
33
69
  - `SKILL.cursor.md` (or `SKILL.md`) → `~/.cursor/skills/<skill-name>/SKILL.md`
34
70
  - `SKILL.codex.md` (or `SKILL.md`) → `${CODEX_HOME:-~/.codex}/skills/<skill-name>/SKILL.md`
@@ -32,7 +32,11 @@ If the first line is not `STATUS: <STATUS>`, the orchestrator MUST treat the res
32
32
 
33
33
  ---
34
34
 
35
- ## The Four Statuses
35
+ ## The Five Statuses
36
+
37
+ Four of them are for **skill workers** — the subagents an orchestrator dispatches
38
+ from `.metaproject/skills/`. The fifth, `FAILED`, belongs to a different worker
39
+ family and is documented at the end of this section.
36
40
 
37
41
  ### `DONE`
38
42
  Task fully complete. All acceptance criteria met. Orchestrator can continue the pipeline.
@@ -66,6 +70,28 @@ Use when:
66
70
  - The task references files or components that don't exist and no context explains them
67
71
  - Acceptance criteria use terms not defined anywhere in the provided context
68
72
 
73
+ ### `FAILED` — harness child workers only
74
+
75
+ **Do not emit `FAILED` as a skill worker.** A skill worker that cannot finish
76
+ reports `BLOCKED`; `task-implementer` maps its own internal `failed` to
77
+ `STATUS: BLOCKED` for exactly this reason.
78
+
79
+ `FAILED` exists in `subagent-result.schema.json` because a **different** worker
80
+ family uses it: external child processes launched through the harness. Their
81
+ `STATUS:` line is parsed by `parseChildResult` in `src/harness/child/contract.ts`
82
+ — which mirrors this enum as `CanonicalSubagentStatus` — and is wired into
83
+ production at `src/harness/extension/execute.ts`. `spawn.test.ts` pins the
84
+ behaviour it guarantees: a `FAILED` child disposition must reach the parent's
85
+ gate as a *failed* completion, **never as a false `completed`**.
86
+
87
+ So the enum has five values and this document previously described four, which
88
+ made `FAILED` look unreachable. It is not. It is unreachable *from a skill
89
+ worker*, and load-bearing for the child-process layer.
90
+
91
+ Orchestrators dispatching skill workers may therefore treat a `FAILED` reply as
92
+ a protocol violation and re-request. Orchestrators reading harness child results
93
+ must handle it as a real terminal failure.
94
+
69
95
  ---
70
96
 
71
97
  ## Exact Response Formats
@@ -10,8 +10,8 @@ metadata:
10
10
  author: "MrCipherSmith"
11
11
  version: "1.0.0"
12
12
  category: "verification"
13
+ compatible_harnesses: "cursor,codex,zed,opencode"
13
14
  license: "MIT"
14
- compatibility: "cursor,codex,zed,opencode"
15
15
  ---
16
16
 
17
17
  # Code Verifier
@@ -11,8 +11,8 @@ metadata:
11
11
  author: "MrCipherSmith"
12
12
  version: "1.0.0"
13
13
  category: "verification"
14
+ compatible_harnesses: "cursor,codex,zed,opencode"
14
15
  license: "MIT"
15
- compatibility: "cursor,codex,zed,opencode"
16
16
  ---
17
17
 
18
18
  # Code Verifier
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  name: code-verifier
3
+ model_tier: light
3
4
  description: "Use when running a full quality gate after implementation — lint, type-check, tests, and import validation. Mandatory step in job-orchestrator after task-implementer and after fix iterations. Use standalone when you need a structured verification report."
4
5
  triggers:
5
6
  - "Run verification"
@@ -13,8 +14,8 @@ metadata:
13
14
  version: "1.0.0"
14
15
  category: "verification"
15
16
  agent_worthy: true
17
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
18
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
19
  ---
19
20
 
20
21
  # Code Verifier
@@ -11,8 +11,8 @@ metadata:
11
11
  author: "MrCipherSmith"
12
12
  version: "1.0.0"
13
13
  category: "verification"
14
+ compatible_harnesses: "cursor,codex,zed,opencode"
14
15
  license: "MIT"
15
- compatibility: "cursor,codex,zed,opencode"
16
16
  ---
17
17
 
18
18
  # Code Verifier
@@ -10,8 +10,8 @@ metadata:
10
10
  author: "MrCipherSmith"
11
11
  version: "1.0.0"
12
12
  category: "verification"
13
+ compatible_harnesses: "cursor,codex,zed,opencode"
13
14
  license: "MIT"
14
- compatibility: "cursor,codex,zed,opencode"
15
15
  ---
16
16
 
17
17
  # Code Verifier
@@ -13,8 +13,8 @@ metadata:
13
13
  author: "MrCipherSmith"
14
14
  version: "1.0.0"
15
15
  category: "context"
16
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
17
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
18
  ---
19
19
 
20
20
  # Context Collector
@@ -13,8 +13,8 @@ metadata:
13
13
  author: "MrCipherSmith"
14
14
  version: "1.0.0"
15
15
  category: "context"
16
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
17
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
18
  ---
19
19
 
20
20
  # Context Collector
@@ -14,8 +14,8 @@ metadata:
14
14
  version: "1.1.0"
15
15
  category: "context"
16
16
  agent_worthy: true
17
+ compatible_harnesses: "cursor,codex,zed,opencode"
17
18
  license: "MIT"
18
- compatibility: "cursor,codex,zed,opencode"
19
19
  ---
20
20
 
21
21
  <SUBAGENT-STOP>
@@ -13,8 +13,8 @@ metadata:
13
13
  author: "MrCipherSmith"
14
14
  version: "1.0.0"
15
15
  category: "context"
16
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
17
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
18
  ---
19
19
 
20
20
  # Context Collector
@@ -13,8 +13,8 @@ metadata:
13
13
  author: "MrCipherSmith"
14
14
  version: "1.0.0"
15
15
  category: "context"
16
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
17
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
18
  ---
19
19
 
20
20
  # Context Collector
@@ -13,8 +13,8 @@ metadata:
13
13
  author: "MrCipherSmith"
14
14
  version: "2.4.0"
15
15
  category: "analysis"
16
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
17
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
18
  ---
19
19
 
20
20
  # Feature Analyzer
@@ -13,8 +13,8 @@ metadata:
13
13
  author: "MrCipherSmith"
14
14
  version: "2.4.0"
15
15
  category: "analysis"
16
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
17
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
18
  ---
19
19
 
20
20
  # Feature Analyzer
@@ -13,8 +13,8 @@ metadata:
13
13
  author: "MrCipherSmith"
14
14
  version: "2.4.0"
15
15
  category: "analysis"
16
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
17
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
18
  ---
19
19
 
20
20
  <SUBAGENT-STOP>
@@ -13,8 +13,8 @@ metadata:
13
13
  author: "MrCipherSmith"
14
14
  version: "2.4.0"
15
15
  category: "analysis"
16
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
17
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
18
  ---
19
19
 
20
20
  # Feature Analyzer
@@ -13,8 +13,8 @@ metadata:
13
13
  author: "MrCipherSmith"
14
14
  version: "2.4.0"
15
15
  category: "analysis"
16
+ compatible_harnesses: "cursor,codex,zed,opencode"
16
17
  license: "MIT"
17
- compatibility: "cursor,codex,zed,opencode"
18
18
  ---
19
19
 
20
20
  # Feature Analyzer
@@ -11,8 +11,8 @@ metadata:
11
11
  author: "MrCipherSmith"
12
12
  version: "1.0.0"
13
13
  category: "workflow"
14
+ compatible_harnesses: "cursor,codex,zed,opencode,claude"
14
15
  license: "MIT"
15
- compatibility: "cursor,codex,zed,opencode,claude"
16
16
  ---
17
17
 
18
18
  # Feature Development (7-Phase)
@@ -11,8 +11,8 @@ metadata:
11
11
  author: "MrCipherSmith"
12
12
  version: "1.0.0"
13
13
  category: "workflow"
14
+ compatible_harnesses: "cursor,codex,zed,opencode,claude"
14
15
  license: "MIT"
15
- compatibility: "cursor,codex,zed,opencode,claude"
16
16
  ---
17
17
 
18
18
  # Feature Development (7-Phase)
@@ -11,8 +11,8 @@ metadata:
11
11
  author: "MrCipherSmith"
12
12
  version: "2.0.0"
13
13
  category: "workflow"
14
+ compatible_harnesses: "cursor,codex,zed,opencode,claude"
14
15
  license: "MIT"
15
- compatibility: "cursor,codex,zed,opencode,claude"
16
16
  ---
17
17
 
18
18
  <SUBAGENT-STOP>