@event4u/agent-config 14.6.0 → 14.7.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 (188) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +260 -7
  3. package/README.md +1 -1
  4. package/dist/agent-src/commands/analyze/inbox.md +264 -10
  5. package/dist/agent-src/commands/analyze.md +1 -1
  6. package/dist/agent-src/commands/roadmap/process-full.md +116 -30
  7. package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +31 -0
  8. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +135 -104
  9. package/dist/agent-src/rules/context-hygiene.md +2 -0
  10. package/dist/agent-src/rules/decision-revisit-gate.md +3 -0
  11. package/dist/agent-src/rules/fix-what-you-see.md +108 -0
  12. package/dist/agent-src/rules/no-roadmap-references.md +0 -5
  13. package/dist/agent-src/rules/recurring-criticism.md +110 -0
  14. package/dist/agent-src/rules/roadmap-progress-sync.md +1 -1
  15. package/dist/agent-src/rules/rule-type-governance.md +0 -2
  16. package/dist/agent-src/rules/self-repair-loop.md +17 -0
  17. package/dist/agent-src/rules/skill-quality.md +0 -2
  18. package/dist/agent-src/rules/source-confidentiality.md +37 -7
  19. package/dist/agent-src/scripts/archival_sweep.ts +117 -0
  20. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +19 -3
  21. package/dist/agent-src/scripts/gate_budget.ts +282 -0
  22. package/dist/agent-src/scripts/gate_execute.ts +72 -31
  23. package/dist/agent-src/scripts/roadmap_gates.ts +74 -3
  24. package/dist/agent-src/scripts/update_roadmap_progress.ts +251 -7
  25. package/dist/agent-src/skills/ai-council/SKILL.md +48 -807
  26. package/dist/agent-src/skills/ai-council/references/advanced-modes.md +320 -0
  27. package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +99 -0
  28. package/dist/agent-src/skills/ai-council/references/execution-modes.md +162 -0
  29. package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +125 -0
  30. package/dist/agent-src/skills/ai-council/references/procedure.md +143 -0
  31. package/dist/agent-src/skills/quality-tools/SKILL.md +34 -326
  32. package/dist/agent-src/skills/quality-tools/references/js-ts-tools.md +113 -0
  33. package/dist/agent-src/skills/quality-tools/references/php-tools.md +222 -0
  34. package/dist/agent-src/skills/roadmap-management/SKILL.md +15 -409
  35. package/dist/agent-src/skills/roadmap-management/references/archival.md +226 -0
  36. package/dist/agent-src/skills/roadmap-management/references/authoring.md +107 -0
  37. package/dist/agent-src/skills/roadmap-management/references/dashboard.md +47 -0
  38. package/dist/agent-src/skills/roadmap-management/references/lifecycle.md +58 -0
  39. package/dist/agent-src/skills/skill-writing/SKILL.md +34 -570
  40. package/dist/agent-src/skills/skill-writing/references/procedure.md +275 -0
  41. package/dist/agent-src/skills/skill-writing/references/read-only-scripts.md +18 -0
  42. package/dist/agent-src/skills/skill-writing/references/section-patterns.md +298 -0
  43. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  44. package/dist/agent-src/templates/roadmaps.md +45 -2
  45. package/dist/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
  46. package/dist/agent-src/templates/scripts/telemetry/remote.ts +160 -7
  47. package/dist/agent-src/templates/scripts/telemetry/transport.ts +169 -0
  48. package/dist/cli/registry.js +1 -1
  49. package/dist/cli/registry.js.map +1 -1
  50. package/dist/cli-delegate/chunk-2GNWGMAL.js +172 -0
  51. package/dist/cli-delegate/{chunk-RLN73PR5.js → chunk-4VR4ORQ6.js} +10 -7
  52. package/dist/cli-delegate/chunk-6EOCNQAM.js +402 -0
  53. package/dist/cli-delegate/{chunk-XURJ4AQC.js → chunk-74E3TKWV.js} +381 -280
  54. package/dist/cli-delegate/{chunk-3UCJWMMP.js → chunk-7F3VYSM2.js} +4 -4
  55. package/dist/cli-delegate/{chunk-BKO2AZ7Z.js → chunk-B2ERU2VA.js} +1 -1
  56. package/dist/cli-delegate/{chunk-NXFWFAYV.js → chunk-G23AT6GD.js} +1 -0
  57. package/dist/cli-delegate/{chunk-63WSP6YZ.js → chunk-GJ5BVHXM.js} +72 -165
  58. package/dist/cli-delegate/{chunk-P6LQDIWK.js → chunk-JZ4NR2TW.js} +338 -0
  59. package/dist/cli-delegate/chunk-MWRD5YOH.js +100 -0
  60. package/dist/cli-delegate/{chunk-GRRPEPRN.js → chunk-T7L2QK3K.js} +24 -5
  61. package/dist/cli-delegate/{chunk-EVTY7ISR.js → chunk-YM4GZDJG.js} +9 -1
  62. package/dist/cli-delegate/cmd_conformance.js +459 -709
  63. package/dist/cli-delegate/cmd_doctor.js +6 -6
  64. package/dist/cli-delegate/cmd_explain.js +1 -1
  65. package/dist/cli-delegate/cmd_export.js +7 -6
  66. package/dist/cli-delegate/cmd_handoff.js +6 -6
  67. package/dist/cli-delegate/cmd_packs_active.js +1 -1
  68. package/dist/cli-delegate/cmd_preflight.js +2 -2
  69. package/dist/cli-delegate/cmd_prune.js +7 -6
  70. package/dist/cli-delegate/cmd_session_recycle.js +840 -30
  71. package/dist/cli-delegate/cmd_settings_migrate.js +7 -6
  72. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  73. package/dist/cli-delegate/cmd_sync.js +7 -6
  74. package/dist/cli-delegate/cmd_uninstall.js +9 -7
  75. package/dist/cli-delegate/cmd_update.js +1 -1
  76. package/dist/cli-delegate/cmd_upgrade.js +1 -1
  77. package/dist/cli-delegate/cmd_validate.js +7 -6
  78. package/dist/discovery/deprecation-report.md +1 -1
  79. package/dist/discovery/discovery-manifest.json +68 -25
  80. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  81. package/dist/discovery/discovery-manifest.summary.md +4 -4
  82. package/dist/discovery/dormancy-report.md +1 -1
  83. package/dist/discovery/orphan-report.md +1 -1
  84. package/dist/discovery/packs.json +10 -8
  85. package/dist/discovery/trust-report.md +3 -3
  86. package/dist/discovery/workspaces.json +8 -6
  87. package/dist/hooks/dispatch.js +2901 -2053
  88. package/dist/install/claudePathsPlan.js +187 -0
  89. package/dist/install/claudePathsPlan.js.map +1 -0
  90. package/dist/install/hostLayerFingerprint.js +136 -0
  91. package/dist/install/hostLayerFingerprint.js.map +1 -0
  92. package/dist/install/install.mjs +553 -425
  93. package/dist/install/partitionEligibility.js +276 -0
  94. package/dist/install/partitionEligibility.js.map +1 -0
  95. package/dist/mcp/registry-manifest.json +3 -3
  96. package/dist/mcp/server.json +2 -2
  97. package/dist/mcp/server.mjs +1744 -1191
  98. package/dist/router.json +1 -1
  99. package/dist/scripts/_lib/agent_src.js +41 -0
  100. package/dist/scripts/_lib/agent_src.js.map +1 -1
  101. package/dist/scripts/_lib/install_layout.js +83 -0
  102. package/dist/scripts/_lib/install_layout.js.map +1 -0
  103. package/dist/scripts/_lib/installed_lock.js +444 -0
  104. package/dist/scripts/_lib/installed_lock.js.map +1 -0
  105. package/dist/scripts/condense.js +13 -164
  106. package/dist/scripts/condense.js.map +1 -1
  107. package/dist/server/schemas/settings.js +4 -0
  108. package/dist/server/schemas/settings.js.map +1 -1
  109. package/docs/contracts/settings-classes.md +12 -6
  110. package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +8 -3
  111. package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +26 -0
  112. package/docs/guidelines/agent-infra/memory-access.md +17 -0
  113. package/docs/guidelines/agent-infra/recurring-criticism-mechanics.md +96 -0
  114. package/package.json +1 -1
  115. package/src/agent-src/scripts/archival_sweep.ts +117 -0
  116. package/src/agent-src/scripts/archive_completed_roadmaps.ts +19 -3
  117. package/src/agent-src/scripts/gate_budget.ts +282 -0
  118. package/src/agent-src/scripts/gate_execute.ts +72 -31
  119. package/src/agent-src/scripts/roadmap_gates.ts +74 -3
  120. package/src/agent-src/scripts/update_roadmap_progress.ts +251 -7
  121. package/src/agent-src/templates/scripts/telemetry/flush_sender.mjs +163 -0
  122. package/src/agent-src/templates/scripts/telemetry/remote.ts +160 -7
  123. package/src/agent-src/templates/scripts/telemetry/transport.ts +169 -0
  124. package/src/config/agent-settings.template.yml +27 -2
  125. package/src/config/ci-local-parity.yml +18 -0
  126. package/src/config/estate-count-budget.json +339 -3
  127. package/src/config/gate-violation-baselines.json +41 -41
  128. package/src/config/rule-activation-census.json +14 -6
  129. package/src/config/rule-stub-ceilings.json +19 -6
  130. package/src/install/claudePathsPlan.ts +196 -0
  131. package/src/install/hostLayerFingerprint.ts +145 -0
  132. package/src/install/partitionEligibility.ts +325 -0
  133. package/src/scripts/_cli/cmd_session_recycle.ts +9 -1
  134. package/src/scripts/_dispatch.bash +6 -1
  135. package/src/scripts/_lib/ac_heading.ts +30 -0
  136. package/src/scripts/_lib/agent_src.ts +42 -0
  137. package/src/scripts/_lib/bench_ab_pinned_repo.ts +162 -0
  138. package/src/scripts/_lib/bench_ab_workspace.ts +10 -1
  139. package/src/scripts/_lib/envelope_grounding.ts +38 -8
  140. package/src/scripts/_lib/installed_lock.ts +50 -5
  141. package/src/scripts/_lib/md_section.ts +129 -0
  142. package/src/scripts/_lib/scope_guard.sh +26 -3
  143. package/src/scripts/_lib/self_repair.ts +19 -0
  144. package/src/scripts/_lib/self_repair_class_b.ts +171 -0
  145. package/src/scripts/ai_council/cli_help.ts +55 -0
  146. package/src/scripts/before_complete_hook.ts +153 -28
  147. package/src/scripts/bench_ab_v2_complexity.ts +27 -7
  148. package/src/scripts/check_references.ts +60 -0
  149. package/src/scripts/check_release_published.ts +32 -11
  150. package/src/scripts/check_single_delivery.ts +59 -15
  151. package/src/scripts/ci_settle.ts +170 -0
  152. package/src/scripts/condense.ts +20 -170
  153. package/src/scripts/council_cli.ts +3 -3
  154. package/src/scripts/dispatch_r2_reviewer.ts +6 -14
  155. package/src/scripts/hook_manifest.json +1 -1
  156. package/src/scripts/hook_manifest.yaml +77 -14
  157. package/src/scripts/hooks/block_no_verify.ts +61 -10
  158. package/src/scripts/hooks/block_unauthorized_git.ts +1 -1
  159. package/src/scripts/hooks/concern_registry.ts +4 -0
  160. package/src/scripts/hooks/rtk_wrap_hook.ts +8 -3
  161. package/src/scripts/hooks/run_continuation_hook.ts +8 -5
  162. package/src/scripts/hooks/ship_diff_volume_hook.ts +81 -15
  163. package/src/scripts/hooks/source_first_gate_hook.ts +464 -0
  164. package/src/scripts/hooks/state_io.ts +782 -20
  165. package/src/scripts/hooks/subagent_ledger_hook.ts +44 -15
  166. package/src/scripts/hooks/telemetry_flush_hook.ts +139 -0
  167. package/src/scripts/hooks/telemetry_self_repair.ts +128 -0
  168. package/src/scripts/hooks/telemetry_usage_hook.ts +22 -4
  169. package/src/scripts/hooks/turn_end_gate_hook.ts +81 -15
  170. package/src/scripts/install.ts +16 -11
  171. package/src/scripts/language_mirror_hook.ts +561 -25
  172. package/src/scripts/lint_framework_leakage_allowlist.json +2 -2
  173. package/src/scripts/lint_plan_risk_register.ts +4 -3
  174. package/src/scripts/lint_skill_router_head.ts +4 -4
  175. package/src/scripts/mcp_server/tools.ts +2 -2
  176. package/src/scripts/new_roadmap.ts +136 -0
  177. package/src/scripts/pack_mcp_content.ts +20 -5
  178. package/src/scripts/release.ts +37 -38
  179. package/src/scripts/report_layer_overlap.ts +6 -0
  180. package/src/scripts/self_repair_hook.ts +37 -5
  181. package/src/scripts/session_register_hook.ts +11 -0
  182. package/src/scripts/skill_usage_collect.ts +11 -1
  183. package/src/scripts/skill_usage_report.ts +278 -8
  184. package/src/scripts/sync_pr_branch.ts +7 -0
  185. package/src/server/schemas/settings.ts +8 -0
  186. package/dist/cli-delegate/chunk-EJITJBJX.js +0 -172
  187. package/dist/cli-delegate/chunk-PZWRPRWP.js +0 -38
  188. /package/dist/cli-delegate/{chunk-RYNADUFG.js → chunk-LWTYTX6F.js} +0 -0
@@ -134,275 +134,34 @@ A `references/` split does not change the gates that already apply: a
134
134
  `token_budget_class: rich` skill still meets its 3,500-token ceiling on the
135
135
  body alone.
136
136
 
137
- ## Procedure
138
-
139
- ### 0. Inspect, then run the Drafting Protocol
140
-
141
- Before writing, **inspect** the landscape: grep
142
- `src/skills/` and `src/rules/` for duplicates or
143
- near-matches, and **analyze** 1–2 gold-standard peers (e.g. `pest-testing`,
144
- `php-coder`) to anchor shape and tone. If requirements are unclear or
145
- incomplete, stop and ask — do not assume.
146
-
147
- Then run the Understand → Research → Draft sequence from the
148
- [`artifact-drafting-protocol`](../../rules/artifact-drafting-protocol.md)
149
- rule. Skip only on explicit *"just do it"* bypass or trivial edits
150
- (typo, link, single-line clarification).
151
-
152
- ### 0b. Skill-growth gate (new skill only)
153
-
154
- The skill count keeps climbing; nothing forces *"should this be a new skill at
155
- all?"*. Before creating a **new** skill, answer these in the PR body — a new
156
- skill that cannot answer them is a merge / guideline / no-op in disguise:
157
-
158
- 1. **Family** — which capability family does it join? (engineering, product, …)
159
- 2. **Capability** — what does it do that no existing skill does? Name the gap.
160
- 3. **Why not extend / merge** — which nearest skill did you consider folding into, and why is a separate skill better?
161
- 4. **Why not a guideline** — is this executable workflow (skill) or reference material (guideline)? Guideline-shaped content does not become a skill.
162
- 5. **Visibility tier** — `core` or `lab`? Which pack?
163
-
164
- **Surface overlap before deciding** — run `./scripts-run src/scripts/skill_overlap`
165
- (or `audit_skill_overlap`) and read the nearest matches; a high-overlap hit is a
166
- merge signal, not a green light. This gate is the authoring-time companion to the
167
- [capability-boundary matrix](../../../docs/contracts/capability-boundary.md): the
168
- matrix governs packs, this governs the skills inside them.
169
-
170
- ### 1. Define the trigger
171
-
172
- Write "When to use" first. This is the in-body trigger — it documents the
173
- workflow's entry conditions for anyone reading the skill.
174
-
175
- Good:
176
- Use when creating Laravel middleware for request filtering
177
-
178
- Bad:
179
- Use when working with Laravel
180
-
181
- ### 1b. Write a pushy frontmatter description
182
-
183
- The `description:` field is what Claude reads at routing time. Polite or
184
- generic descriptions cause **undertriggering**. Normative source:
185
- `skill-quality` rule § *Description Triggering*.
186
-
187
- Three rules: name 2+ triggers (domains, symptoms, user phrasing), end with
188
- `... even if they don't explicitly ask for \`<skill-name>\`.`, and stay
189
- **≤ 200 characters** (`skill_linter.ts` errors `description_too_long` above
190
- that — a hard cap). When trimming to fit, drop adjectives or the second example phrasing
191
- before you drop a trigger class or the `even if ...` tail.
192
-
193
- Canonical before/after (2026-04-21 audit baseline):
194
-
195
- ```yaml
196
- # Bad (138 chars, polite, single trigger class):
197
- description: "Use when writing Playwright E2E tests — browser automation,
198
- visual regression testing, Page Objects, fixtures, and reliable test
199
- patterns."
200
-
201
- # Good (pushy, second trigger class, explicit tail):
202
- description: "Use when writing Playwright E2E tests — locators, assertions,
203
- Page Objects, fixtures, CI, and flaky test prevention — even if the user
204
- doesn't say Playwright."
205
- ```
206
-
207
- The *good* version routes correctly on *"my E2E keeps flaking on CI"*
208
- without naming Playwright. Run `./scripts-run src/scripts/audit_skill_descriptions`
209
- after writing; if flagged `too-short` or `no-trigger-prefix`, rewrite
210
- before commit.
211
-
212
- When iterating on phrasing with the user (e.g. "make this pushier",
213
- "will this ever fire"), delegate to the
214
- [`description-assist`](../description-assist/SKILL.md) skill — it runs the
215
- approval-gated propose / pick loop with at most two rounds.
216
-
217
- ### 1c. Propose a trigger-eval stub (new skills only)
218
-
219
- When creating a new skill, propose a stub
220
- `src/skills/{name}/evals/triggers.json` before writing
221
- the body. Draw the queries from Phase A of the drafting protocol (the
222
- user's "should trigger" and "must not trigger" answers).
223
-
224
- Stub shape — 5 should-trigger + 5 should-not-trigger queries, first-person,
225
- single-sentence, **no leakage of the skill name** in the queries:
226
-
227
- ```json
228
- {
229
- "skill": "{name}",
230
- "description": "5 should-trigger + 5 should-not-trigger queries. No query mentions '{name}' directly. Near-misses share domain vocabulary without being the actual task.",
231
- "queries": [
232
- {"q": "<phrasing from user Phase A that MUST route here>", "trigger": true},
233
- {"q": "<another should-trigger phrasing>", "trigger": true},
234
- {"q": "<...3 more>", "trigger": true},
235
- {"q": "<near-miss sharing vocabulary but different task>", "trigger": false},
236
- {"q": "<another near-miss>", "trigger": false},
237
- {"q": "<...3 more>", "trigger": false}
238
- ]
239
- }
240
- ```
241
-
242
- Present the stub as a numbered-options prompt (per `user-interaction`):
243
-
244
- ```
245
- > 1. Accept stub as drafted — commit alongside the skill
246
- > 2. Edit queries before commit
247
- > 3. Skip evals for now — create later
248
- ```
137
+ ## Modes
249
138
 
250
- Nothing is committed without the user's pick. If the user picks *skip*,
251
- record it in the commit message (`Eval stub: deferred`). Peer examples
252
- for the expected format: `php-coder/evals/triggers.json`,
253
- `eloquent/evals/triggers.json`, `skill-writing/evals/triggers.json`.
139
+ This skill is a router head. The decision layer above — what goes where, the
140
+ critical test, the namespace note, the size and progressive-disclosure hints —
141
+ is true across every mode and stays here, as do the Frugality Standards below.
142
+ The procedure body and the section-pattern catalogue live in `references/`; load
143
+ the one the task calls for.
254
144
 
255
- Presence is CI-enforced for new skills: `check_trigger_eval_presence`
256
- fails any skill outside the shrink-only grandfather allowlist that
257
- lacks `evals/triggers.json` — *skip* therefore defers the queries'
258
- quality, never the file itself.
259
-
260
- Rules / commands / guidelines do **not** get eval stubs — only skills
261
- route through the top-level catalogue.
262
-
263
- ### 2. Write the procedure
264
-
265
- Use numbered, verifiable steps.
266
-
267
- Good:
268
-
269
- 1. Check if middleware exists
270
- 2. Create with artisan command
271
- 3. Implement logic
272
- 4. Register in route or kernel
273
-
274
- Bad:
275
-
276
- 1. Create middleware
277
- 2. Add logic
278
-
279
- ### 3. Add validation
280
-
281
- End with concrete validation.
282
-
283
- Good:
284
-
285
- * Route returns expected status
286
- * Appears in route list
287
- * No static analysis errors
288
-
289
- Bad:
290
-
291
- * Vague statements like "see if outcome is correct" (no concrete command or assertion)
292
-
293
- ### 4. Add safe/unsafe example
294
-
295
- Show minimal contrast.
296
-
297
- Good:
298
-
299
- * Typed middleware, correctly registered
300
-
301
- Bad:
302
-
303
- * Business logic inside middleware
304
-
305
- ### 5. Define output format
306
-
307
- Control response structure.
308
-
309
- Example:
310
-
311
- 1. Code snippet
312
- 2. Registration location
313
- 3. Gotcha (if relevant)
314
-
315
- ### 6. Validate against quality checklist
316
-
317
- * K1: Description is a trigger ("Use when...")
318
- * K2: Not over-defined
319
- * K3: No obvious content
320
- * K4: Contains gotchas
321
- * K5: Has Output format (numbered, 2-4 deliverables)
322
- * K6: Not pointer-only (executable without opening guidelines)
323
- * K7: Created with analysis (not blind, expected behavior defined)
324
- * Size: Within limits (see size-and-scope guideline)
325
-
326
- ### 7. Run + iterate evals (quantitative loop)
327
-
328
- Triggers (`evals/triggers.json`) check **routing**. A separate
329
- `evals/evals.json` checks **behavior** — does the skill make the agent
330
- produce a better answer than baseline? Add this layer for any skill
331
- where the procedure has measurable output (commands, artifacts,
332
- structured text). Skip for evergreen heuristics with no falsifiable
333
- output (e.g. `direct-answers`, `language-and-tone`) unless the user
334
- asks for it.
335
-
336
- **Workspace layout** (all under `.gitignore`):
337
-
338
- ```
339
- src/skills/{name}/evals/
340
- triggers.json # tracked — routing eval (§ 1c)
341
- evals.json # tracked — behavior eval definitions
342
- runs/ # gitignored — per-iteration outputs
343
- {timestamp}-baseline/ # sub-agent run without the skill
344
- {timestamp}-with-skill/ # sub-agent run with the skill
345
- {timestamp}-benchmark.json
346
- ```
347
-
348
- **`evals.json` shape** — 3–10 scenarios, each with prompt + grading
349
- rubric:
145
+ | Task | Mode body | Covers |
146
+ |---|---|---|
147
+ | Author a new skill, or rewrite one end to end | [`references/procedure.md`](references/procedure.md) | Steps 0 → 7: inspect + Drafting Protocol, skill-growth gate, trigger definition, pushy description, trigger-eval stub, procedure, validation, safe/unsafe example, output format, quality checklist, eval loop |
148
+ | Pick or write an optional / required section pattern | [`references/section-patterns.md`](references/section-patterns.md) | Description-optimizer loop, self-QA loop, known-pitfalls, rationalizations-to-reject, non-negotiable-deliverable, destructive-operation gates, upstream-version-notes, security-constraints, action-reference split, mechanism-teaching, illustrative-not-verbatim, headline metric, contrastive-example |
149
+ | Ship a script inside a skill | [`references/read-only-scripts.md`](references/read-only-scripts.md) | The read-only-by-default rule and its allowlist, whose violation fails the build |
350
150
 
351
- ```json
352
- {
353
- "skill": "{name}",
354
- "scenarios": [
355
- {
356
- "id": "happy-path",
357
- "prompt": "<full user-shaped task that exercises the skill>",
358
- "assertions": [
359
- {"kind": "contains", "value": "<expected substring in output>"},
360
- {"kind": "file_exists", "path": "<artifact path the skill should create>"},
361
- {"kind": "rubric", "criterion": "<one-line judgement, e.g. 'output includes a numbered procedure'>"}
362
- ]
363
- }
364
- ]
365
- }
366
- ```
367
-
368
- `contains` / `file_exists` grade deterministically. `rubric` items grade
369
- via a fresh sub-agent reading the output against the criterion — keep
370
- each criterion to one falsifiable sentence.
371
-
372
- **Loop** (orchestrated by `scripts/run_skill_evals.ts`):
151
+ ## Procedure
373
152
 
374
- 1. **Scaffold** — `./scripts-run src/scripts/run_skill_evals scaffold {skill}`
375
- creates `runs/{timestamp}-{baseline,with-skill}/` and seeds each
376
- scenario's `meta.json`.
377
- 2. **Baseline run** — spawn one sub-agent per scenario **without** the
378
- skill loaded. Capture stdout + any artifacts into
379
- `runs/{timestamp}-baseline/{scenario-id}/`.
380
- 3. **With-skill run** — same scenarios, same sub-agent harness, **with**
381
- the skill loaded. Capture into `runs/{timestamp}-with-skill/{scenario-id}/`.
382
- 4. **Grade** — for each scenario, write a `grade.json` file with
383
- per-assertion pass/fail. Deterministic assertions auto-grade;
384
- rubric assertions need a grader sub-agent.
385
- 5. **Aggregate** — `./scripts-run src/scripts/run_skill_evals aggregate {skill}
386
- --run {timestamp}` produces `runs/{timestamp}-benchmark.json` with
387
- pass-rate, timing, token deltas baseline-vs-with-skill.
388
- 6. **Report** — `./scripts-run src/scripts/run_skill_evals report {skill}
389
- --run {timestamp}` prints the diff. Iterate on the skill body
390
- until `with-skill` outperforms `baseline` on every scenario.
391
-
392
- The script ships with sub-agent spawning **stubbed** — the orchestration
393
- layer is per-environment (Claude Code, Augment, council). Implement
394
- the spawn function once for your environment, the rest of the loop
395
- (aggregate / report / scaffold) works out of the box.
396
-
397
- **Exit criterion** — every scenario passes with-skill, at least one
398
- fails baseline (proves the skill earns its slot). Commit the
399
- `evals.json` alongside the skill; never commit `runs/`.
400
-
401
- Neighbors:
402
- * `description-assist` — iterate on the trigger phrasing
403
- * `skill-reviewer` — structural 7-Killers audit
404
- * `lint-skills` — static checks (frontmatter, sections, size)
405
- * `skill-improvement-pipeline` — production-learning capture
153
+ 1. **Inspect first.** Read the existing skill (or the nearest three matches) and
154
+ run the decision matrix above before writing anything. If the answer is
155
+ "Nothing", stop — that is a real answer and the cheapest one.
156
+ 2. Authoring or rewriting a skill → load
157
+ [`references/procedure.md`](references/procedure.md) and follow steps 0 → 7
158
+ in order. The steps are sequenced, not a menu.
159
+ 3. Reaching for a named section pattern → load
160
+ [`references/section-patterns.md`](references/section-patterns.md) and use
161
+ the one pattern that matches; the catalogue is not a checklist to satisfy.
162
+ 4. **Validate before saving** — the quality checklist in
163
+ [`references/procedure.md`](references/procedure.md) § 6, the Frugality
164
+ Standards below, and `./scripts-run src/scripts/skill_linter` at 0 FAIL.
406
165
 
407
166
  ## Output format
408
167
 
@@ -479,311 +238,16 @@ to every skill you author.
479
238
  4. Does the description carry filler ("comprehensive", "advanced",
480
239
  "powerful")?
481
240
 
482
- ## Read-only-by-default scripts
483
-
484
- A script shipped inside a skill (`scripts/**`) is **side-effect-free by
485
- default** — it inspects, computes, and prints; it does not mutate the
486
- filesystem. Any mutation (writing a file, deleting, rename/copy) must be gated
487
- behind an explicit flag named in this SKILL.md — `--writable` / `--apply` /
488
- `--write` / `--output` / `--fix` — so the default invocation is safe to run
489
- blind. A generator whose *declared purpose* is to write (it emits an artifact
490
- to a caller-supplied path) is allowlisted with a rationale in
491
- `src/scripts/lint_skill_scripts_readonly_allowlist.json` rather than carrying a
492
- redundant flag. `lint_skill_scripts_readonly` enforces this: an ungated,
493
- non-allowlisted write fails the build.
494
-
495
- ## Description-optimizer loop (U1 — held-out, not vibes)
496
-
497
- Descriptions are the trigger surface; tune them like a model, not like prose:
498
-
499
- 1. Draft 2-3 candidate descriptions for the skill.
500
- 2. Ensure `evals/triggers.json` has should- AND should-not-trigger queries
501
- (grow beyond the 5+5 stub when optimizing — more queries = a real test split).
502
- 3. Run the helper: `npx tsx src/scripts/optimize_skill_description.ts
503
- --skill <id> --candidate "…" [--candidate "…"] [--live]` — it splits the
504
- queries deterministically into train/held-out, scores every candidate
505
- (deterministic token-overlap proxy by default; `--live` = haiku judge,
506
- ~$0.001 per query·candidate), and picks the best **held-out** accuracy.
507
- 4. Adopt the pick ONLY if it beats the current description on the held-out
508
- split — a train-only win is overfitting to the queries you wrote.
509
-
510
- ## Self-QA loop for output-producing skills (optional pattern)
511
-
512
- For skills whose product is a rendered/structural artifact (decks, docs,
513
- diagrams, dashboards, generated UI): **assume there are problems** and have a
514
- fresh-eyes pass find them before handing back. The author-context is blind to
515
- its own omissions; a context-free verifier is not.
516
-
517
- 1. Produce the artifact.
518
- 2. Dispatch a fresh subagent (no authoring context) with ONLY the artifact +
519
- the acceptance criteria: "list every visual/structural defect; assume at
520
- least one exists."
521
- 3. Fix what it finds; re-run once. Two clean passes → done.
522
-
523
- Worked example (deck skill): the author renders 12 slides; the fresh-eyes
524
- pass gets the PDF + "check overflow, contrast, orphaned bullets, broken
525
- images" — it flags a clipped title on slide 7 the author never re-read.
526
- One fix, one re-check, done.
527
-
528
- Scope: complements `verify-before-complete` (which gates the completion
529
- claim); this pattern is HOW to get the fresh evidence for artifacts where no
530
- deterministic checker exists. Skip it when a real validator covers the
531
- surface (linter, schema, test) — deterministic checks beat judge passes.
532
-
533
- ## Known-pitfalls section (optional pattern, tool skills)
534
-
535
- Tool/integration skills teach the happy path; the recurring support burden is
536
- the *silent* failures — the ones that cost money, corrupt state, or fail with no
537
- error. For a high-support-burden tool skill, add a `## Known pitfalls` section
538
- in this micro-format:
539
-
540
- 1. **A Symptom → Root cause → Fix table.** Each row starts from the *observable
541
- symptom* (what the user sees), not the internal cause — the user greps for
542
- the symptom, not the fix.
543
-
544
- | Symptom | Root cause | Fix |
545
- |---|---|---|
546
- | `<what the user observes>` | `<why it happens>` | `<the concrete action>` |
547
-
548
- 2. **Optionally, a quick-reference anti-pattern checklist** (Anti-pattern ·
549
- cost/impact · fix difficulty) for traps worth scanning before shipping — add
550
- it only when it does not restate the skill's existing `## Gotcha` / `## Do
551
- NOT`; the table is the load-bearing part.
552
-
553
- Sourcing floor — **real, not invented**: every entry names a genuinely common
554
- failure (a high-vote community question, a documented incident class), never a
555
- hypothetical. **≤ 5 entries per skill.** The value is a short, sourced,
556
- high-signal list; a long one is noise. A pitfall is a *section on the existing
557
- tool skill*, **never** a new skill per pitfall and never a generated grid (see
558
- [`size-enforcement`](../../rules/size-enforcement.md) § Per-tool pitfall
559
- content).
560
-
561
- ## Rationalizations-to-reject section (recommended pattern, security-stop-routed skills)
562
-
563
- A skill routed by `security-sensitive-stop` already carries a forbidden-moves or
564
- failure-mode list. Those describe **what is wrong**. They do not answer the
565
- sentence the agent actually produces at the moment it skips the control:
566
- *"this one is internal, so the tenant check is not needed here."*
567
-
568
- So those skills add `## Rationalizations to reject`, where each entry is a pair:
569
-
570
- - **the shortcut, in the words it will be argued in** — not a label. "It is an
571
- internal endpoint" beats "insufficient authorization".
572
- - **the mechanism that defeats it** — the concrete fact that makes the argument
573
- wrong. "Internal is a network claim, not an identity claim; the object id
574
- still comes from the request."
575
-
576
- Writing the shortcut in its persuasive form is the whole point. A list of
577
- labelled anti-patterns is matched against by a reader who has already decided;
578
- a list of *arguments* is matched against by a reader mid-decision, which is when
579
- the skip actually happens.
580
-
581
- Keep it to the arguments that have really been made. An invented rationalization
582
- teaches nothing and dilutes the ones that recur.
583
-
584
- ## Non-negotiable-deliverable section (recommended pattern, adjacent-technology clusters)
585
-
586
- Some skills sit next to a technology that is a *tempting wrong answer* — close
587
- enough to look interchangeable, different enough that picking it silently loses
588
- something. The framework-cluster skills the routing rules already disambiguate
589
- pairwise are the standing example.
590
-
591
- For those, state the deliverable as a constraint rather than as a preference:
592
-
593
- 1. **What the output must use.** One sentence, unhedged.
594
- 2. **The substitutes to refuse, named.** The agent will meet them; naming them
595
- is what makes the refusal recognisable rather than a judgement call.
596
- 3. **What each substitute loses.** This is the load-bearing line. A prohibition
597
- without a cost reads as arbitrary and gets argued away the first time the
598
- substitute is more convenient; a named loss survives that conversation.
599
-
600
- The routing rules answer *which skill loads*. This section answers *what the
601
- skill may emit once it has loaded* — a different question, and the one that goes
602
- wrong quietly.
603
-
604
- ## Destructive-operation gates belong in the description
605
-
606
- If a skill performs an operation the user cannot undo — deleting, removing,
607
- publishing, spending — the confirmation gate goes in the **description**, not
608
- only in the body.
609
-
610
- The reason is routing order: the description is what the agent reads when
611
- choosing a skill, and the body loads afterwards. A gate stated only in the body
612
- is invisible at exactly the moment the skill is being selected for a task whose
613
- shape the gate might forbid.
614
-
615
- One clause is enough — `worktree-lifecycle` carries "safe cleanup that refuses
616
- while unique unmerged commits exist", which tells a router both what the skill
617
- does and what it will not do. Verified by
618
- `./scripts-run src/scripts/lint_skill_descriptions`.
619
-
620
- ## Upstream-version-notes section (optional pattern, wrapped fast-moving tools)
621
-
622
- A skill that wraps an external tool is written against one version of it. When
623
- the tool renames a flag, restructures its report, or drops a subcommand, the
624
- skill does not fail loudly — it fails as **the agent concluding the skill is
625
- wrong**, or, worse, inventing the removed surface so its own instructions still
626
- make sense. Both are silent.
627
-
628
- For a skill wrapping a tool that moves faster than this package's release
629
- cadence, add `## Upstream version notes` carrying exactly three things:
630
-
631
- 1. **The version this skill was written against, and the date it was checked.**
632
- A version alone rots into a claim nobody can date.
633
- 2. **What was renamed** — old → new, one line each. This is the row that stops
634
- an agent inventing a flag that no longer exists.
635
- 3. **How to read older output** — the agent will meet reports from earlier
636
- versions in logs, issues and fixtures, and needs to know which fields moved
637
- rather than guessing.
638
-
639
- State briefly what is **unchanged** too. "The subcommand set is unchanged since
640
- X" is what lets an agent trust the rest of the skill after finding one stale
641
- flag, instead of second-guessing every instruction that follows.
642
-
643
- Scope floor — add it only where drift is **observed**, never anticipated. A
644
- version-notes block on a stable tool is maintenance with no reader, and a stale
645
- one is worse than none: it is a dated claim that is now false.
646
-
647
- ## Security-constraints section (required pattern, script-bearing skills)
648
-
649
- A skill that ships an executable script carries its constraints in the
650
- always-loaded rules — `tool-safety`, `runtime-safety`, `lethal-trifecta-guard`.
651
- That holds while the skill is read inside this suite. It stops holding the
652
- moment the script travels: vendored into a consumer, copied into another
653
- project, or run by an agent whose rule set is not ours. The constraints stay
654
- behind; the script does not.
655
-
656
- So a skill with anything under its `scripts/` directory states them **on the
657
- artifact**, in a `## Security constraints` section:
658
-
659
- - **What it may touch** — the paths and hosts it legitimately reads or writes.
660
- Naming the boundary is what makes an overreach reviewable.
661
- - **What it must never do** — the prohibitions specific to THIS script, not a
662
- restatement of the general rules. "Never writes outside the target directory"
663
- is checkable; "follows security best practice" is not.
664
- - **Its default-invocation behaviour** — read-only or mutating. A script that
665
- mutates on a bare invocation already violates the `## Do NOT` list below; if
666
- it is gated behind a flag, name the flag here.
667
- - **What it sends outbound, if anything** — the egress leg of the lethal
668
- trifecta. A script with no network access says so in four words, and that
669
- sentence is the cheapest possible answer to a reviewer's first question.
670
-
671
- This duplicates the rules on purpose, and the duplication is the point: the
672
- rules are the enforcement, the section is what survives the artifact leaving
673
- their reach.
674
-
675
- ## Action-reference split (required pattern, `safety_mode: strict` skills)
676
-
677
- `execution.safety_mode: strict` says the skill's execution path may mutate
678
- something. That is a claim made in the frontmatter, and until the body backs it
679
- the claim costs nothing: a reader who follows the procedure top to bottom finds
680
- the mutating step sitting inline with every other step, indistinguishable from a
681
- read.
682
-
683
- A strict skill therefore takes one of exactly two shapes, and says which:
684
-
685
- - **Gate it inline.** The mutating step carries its precondition in the same
686
- breath — propose the exact command first, `--dry-run` before the live run, the
687
- user confirms, verify the effect landed afterwards. The precondition is part of
688
- the step, never a general reassurance three sections away.
689
- - **Defer it.** The SKILL.md states plainly that it **does not define the
690
- mutating workflow**, and points the write-path steps at a file under the
691
- skill's own `references/`. The pointer is the precondition's home: the
692
- reference opens with what must be true before its first step runs.
693
-
694
- Deferring is the better shape once the write path has more than a couple of
695
- steps, and for the reason the split exists at all — the main body stays readable
696
- as the thing an agent loads to decide *whether* to act, while the steps that
697
- change something live behind one deliberate extra read. What it must never
698
- become is a second copy: the reference holds the write path, the SKILL.md holds
699
- the pointer, and neither restates the other.
700
-
701
- `skill_linter` nudges (`strict_mode_missing_write_gate`, warning) when a strict
702
- skill's body carries neither shape. It is a warning and it matches on prose, so
703
- treat it as a prompt to check the body rather than a verdict on it — a skill that
704
- gates its write path some third way is doing the right thing and should say so
705
- plainly enough that the next reader sees the gate without running the linter.
706
-
707
- Read with § Security-constraints above: that section states what the script may
708
- touch, this one states what must be true before it touches it.
709
-
710
- ## Mechanism-teaching section (optional pattern, skills whose subject has one)
711
-
712
- A procedure tells the agent what to do in the cases you thought of. A
713
- **mechanism** tells it why those steps work, which is the only thing that
714
- transfers to the case you did not. Where a skill's subject has a mechanism worth
715
- one screen — how the cascade resolves, why the queue drops the message, what the
716
- scheduler actually orders — state it in a `## How it works` section, ahead of the
717
- procedure that depends on it.
718
-
719
- Keep it to one screen and to mechanisms only: no history, no alternatives-considered,
720
- no restating the procedure in prose. If it takes more than a screen, the skill is
721
- carrying a guideline's worth of material and should point at one instead.
722
-
723
- The test for whether it earns its place: name a plausible situation the procedure
724
- does not cover, and check whether this section is enough to answer it. If the
725
- answer is still "read the source", the section is decoration.
726
-
727
- Optional, and it gets no gate: "teaches a mechanism" is a prose judgement, and a
728
- predicate over prose is the false-positive class this file's other patterns avoid.
729
-
730
- ## Illustrative-not-verbatim marker (optional pattern, reference code)
731
-
732
- A code block in a skill is read as copy-me by default. When a block is teaching a
733
- *shape* — a signature to mirror, a structure to follow, pseudocode standing in for
734
- the real call — say so on the line above it:
735
-
736
- ```
737
- <!-- illustrative: shape only, not a working snippet -->
738
- ```
739
-
740
- One line, immediately above the fence, in the skill's own words if you prefer.
741
- What matters is that the reader can tell shape-teaching code from code that runs,
742
- because the failure mode is silent: an agent pastes the illustration, it almost
743
- works, and the debugging starts from the wrong premise.
744
-
745
- The inverse deserves the same care — a block that IS meant to be run verbatim,
746
- where a reader might assume otherwise, says so too. See also `### 4. Add
747
- safe/unsafe example`, which governs a different axis: safe-vs-unsafe, not
748
- runnable-vs-illustrative.
749
-
750
- ## Headline metric + closing report (optional pattern, optimization skills)
751
-
752
- A skill whose job is to make something better — smaller, faster, cheaper, quieter
753
- — has to say **which single number it moves**. Without one, "optimized" is a
754
- claim nobody can check and every run reports success.
755
-
756
- So an optimization skill names, up front:
757
-
758
- 1. **The headline metric.** One number, with its unit and how it is measured.
759
- "Initial-context tokens, measured by `audit-tokens`" — not "context cost".
760
- 2. **The closing report shape.** Before, after, delta, and the command that
761
- produced both. The same command for both readings, or the delta is not a delta.
762
-
763
- State what the metric does **not** capture, in one line. An optimization that
764
- moves the headline number by degrading something it does not measure is the
765
- failure this pattern exists to make visible, and only the author knows where that
766
- edge is.
767
-
768
- ## Contrastive-example slot (optional pattern, authoring and behaviour skills)
769
-
770
- Where a skill's guidance is easy to agree with and hard to apply — tone, phrasing,
771
- question shape, what counts as evidence — a wrong/right pair does what prose
772
- cannot: it shows the near-miss. Six live corpora already carry them:
773
- [`direct-answers-demos`](../../../docs/guidelines/agent-infra/direct-answers-demos.md),
774
- [`asking-and-brevity-examples`](../../../docs/guidelines/agent-infra/asking-and-brevity-examples.md),
775
- [`language-and-tone-examples`](../../../docs/guidelines/agent-infra/language-and-tone-examples.md),
776
- and `autonomy-examples` / `interrupt-examples` / `cheap-question-mechanics` under
777
- `src/agent-src/contexts/execution/`.
778
-
779
- Follow one of those rather than inventing a format. The shape they share: the
780
- **wrong** version first, in the form it actually gets written; the **right**
781
- version second; and one line of **why** — which is the load-bearing part, because
782
- a pair without it teaches the specific case and not the rule.
783
-
784
- Put the corpus in a guideline or context file and point at it from the skill when
785
- it outgrows a section. A near-miss corpus is reference material read on demand,
786
- not always-loaded prose.
241
+
242
+ ## Section patterns
243
+
244
+ The thirteen optional and required section patterns moved verbatim to
245
+ [`references/section-patterns.md`](references/section-patterns.md). Two of them
246
+ are marked **required** for a named population — security-constraints for
247
+ script-bearing skills, and the action-reference split for `safety_mode: strict`
248
+ skills — so a skill in either population reads that file rather than skipping it.
249
+ The read-only-by-default script rule moved to
250
+ [`references/read-only-scripts.md`](references/read-only-scripts.md).
787
251
 
788
252
  ## Do NOT
789
253