@zalom/plastic 1.0.0-beta.2 → 1.0.0-beta.21

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 (82) hide show
  1. package/PLASTIC.md +131 -7
  2. package/agents/plastic-brainstorming.md +9 -1
  3. package/agents/plastic-enforcer.md +1 -1
  4. package/agents/plastic-executor.md +11 -1
  5. package/agents/plastic-intent-curator.md +7 -5
  6. package/agents/plastic-planner.md +11 -1
  7. package/agents/plastic-spec-specialist.md +9 -1
  8. package/hooks/hooks.json +20 -0
  9. package/hooks/retrieval-gate +10 -0
  10. package/hooks/savepoint-pre +10 -0
  11. package/hooks/statusline +150 -41
  12. package/package.json +1 -1
  13. package/scripts/agent-report +163 -0
  14. package/scripts/doctor.rb +172 -0
  15. package/scripts/hook-auto-arm +1 -1
  16. package/scripts/hook-bash-gate +2 -2
  17. package/scripts/hook-code-gate +11 -6
  18. package/scripts/hook-create-gate +2 -2
  19. package/scripts/hook-gate-check +14 -23
  20. package/scripts/hook-retrieval-gate +136 -0
  21. package/scripts/hook-savepoint-pre +32 -0
  22. package/scripts/hook-session-start +1 -1
  23. package/scripts/insight-append +51 -0
  24. package/scripts/lib/bridge.rb +374 -34
  25. package/scripts/lib/frontmatter_writer.rb +130 -0
  26. package/scripts/lib/graph_rebuild.rb +328 -0
  27. package/scripts/lib/insights.rb +86 -0
  28. package/scripts/lib/installer_core.rb +23 -0
  29. package/scripts/lib/link_suggestions.rb +322 -0
  30. package/scripts/lib/links_projection.rb +160 -0
  31. package/scripts/lib/links_section.rb +207 -0
  32. package/scripts/lib/power_tools.rb +76 -0
  33. package/scripts/lib/qmd_hook.rb +38 -25
  34. package/scripts/lib/qmd_sync.rb +36 -0
  35. package/scripts/lib/retrieval_gate.rb +211 -0
  36. package/scripts/lib/worktree.rb +409 -0
  37. package/scripts/link-suggest +211 -0
  38. package/scripts/new-intent +138 -29
  39. package/scripts/project-links +287 -0
  40. package/scripts/qmd-sync +50 -3
  41. package/scripts/rebuild-graph +244 -0
  42. package/scripts/spawn-preamble +26 -1
  43. package/skills/auto/SKILL.md +58 -11
  44. package/skills/auto/evals/evals.json +48 -0
  45. package/skills/auto/references/agent-architecture.md +27 -4
  46. package/skills/auto/references/agent-report-contract.md +121 -0
  47. package/skills/brainstorming/SKILL.md +1 -0
  48. package/skills/brainstorming/evals/evals.json +22 -0
  49. package/skills/continuing/SKILL.md +30 -8
  50. package/skills/continuing/evals/evals.json +9 -0
  51. package/skills/creating-intent/SKILL.md +16 -2
  52. package/skills/creating-intent/evals/evals.json +16 -0
  53. package/skills/creating-intent/references/lifecycle.md +9 -4
  54. package/skills/creating-skills/SKILL.md +65 -0
  55. package/skills/creating-skills/evals/evals.json +108 -0
  56. package/skills/creating-skills/references/agents.md +168 -0
  57. package/skills/creating-skills/references/evals.md +41 -0
  58. package/skills/creating-skills/references/hooks.md +248 -0
  59. package/skills/creating-skills/references/progressive-disclosure.md +176 -0
  60. package/skills/creating-skills/references/scripts.md +166 -0
  61. package/skills/creating-skills/references/skills.md +165 -0
  62. package/skills/creating-skills/scripts/scaffold.rb +313 -0
  63. package/skills/dashboard/SKILL.md +5 -0
  64. package/skills/dashboard/evals/evals.json +22 -0
  65. package/skills/executing-plan/SKILL.md +2 -2
  66. package/skills/humanizer/SKILL.md +39 -0
  67. package/skills/humanizer/evals/evals.json +70 -0
  68. package/skills/humanizer/references/always-on-snippet.md +9 -0
  69. package/skills/humanizer/references/examples.md +48 -0
  70. package/skills/intent-curator/SKILL.md +6 -1
  71. package/skills/intent-curator/evals/evals.json +22 -0
  72. package/skills/linking-intents/SKILL.md +54 -12
  73. package/skills/linking-intents/evals/evals.json +22 -0
  74. package/skills/linking-intents/references/zettelkasten.md +7 -0
  75. package/skills/managing-index/SKILL.md +8 -0
  76. package/skills/managing-index/evals/evals.json +22 -0
  77. package/skills/managing-index/references/zettelkasten-linking.md +6 -1
  78. package/skills/releasing/SKILL.md +32 -0
  79. package/skills/research/SKILL.md +8 -0
  80. package/skills/research/evals/evals.json +22 -0
  81. package/skills/writing-instructions/SKILL.md +0 -159
  82. package/skills/writing-instructions/references/agentskills-spec.md +0 -135
@@ -54,15 +54,37 @@ intents. Do not start executing work. The branches below are the only follow-ups
54
54
  ## Conditional Ledger-Resume
55
55
 
56
56
  Fires ONLY when the user explicitly asks to continue a SPECIFIC intent, or an agent is
57
- instructed to continue one. It is not part of every boot. For that intent's directory:
58
-
59
- 1. **Read `savepoint.md`.** It is a deterministic, append-only stage ledger (one line per
60
- milestone, newest at the bottom): `{utc-iso8601} {Stage} {milestone}`. The **last line =
61
- current stage**.
62
- 2. **Verify the stage file.** Confirm the file the ledger names exists and is non-empty
63
- (ledger `How plan.md created` → `plan.md` must be present and non-empty).
57
+ instructed to continue one. It is not part of every boot.
58
+
59
+ QMD-first (when available): when the user names the intent by description rather than id, before
60
+ scanning the store with grep/Read run `ruby ~/.plastic/scripts/qmd-sync search "<terms>"` to
61
+ surface the candidate intent, then open the authoritative intent file for the hit you resume. The
62
+ command is a no-op when QMD is absent, so fall back to the existing INDEX.md / file scan.
63
+
64
+ For that intent's directory:
65
+
66
+ 1. **Read `savepoint.md` FIRST (intent 81).** It is a deterministic, append-only ledger
67
+ (one line per event, newest at the bottom): `{utc-iso8601} {Stage} {milestone}`. Classify
68
+ the state from the **last line** alone, then verify ONLY that line's artifact. The bookends
69
+ are fixed: first line `What created`, last line either a cycle position or
70
+ `Done delivered|abandoned`.
71
+
72
+ | Last line | State | Verify only |
73
+ |---|---|---|
74
+ | `What {id}--{slug}.md` | born / parked | intent file exists |
75
+ | `Why started` | Why entered, no spec yet | spec.md not yet real; continue Why |
76
+ | `Why spec.md created` | Why done | spec.md present; continue to How |
77
+ | `How started` / `How plan.md created` | How in progress | plan.md; continue How |
78
+ | `How checklist.md created` / `Exec started` | ready for / in Exec | plan.md + checklist.md present; continue Exec |
79
+ | `Exec outcome.md created` | Exec done | outcome.md present; ready to complete |
80
+ | `Done delivered` / `Done abandoned` | terminal | do NOT cycle-resume; INDEX is authoritative |
81
+
82
+ 2. **Verify the stage file.** Confirm only the last line's artifact exists and is non-empty
83
+ (ledger `How plan.md created` → `plan.md` must be present and non-empty). Do not re-probe
84
+ every lifecycle file.
64
85
  3. **Drift handling.** If the ledger's last line disagrees with files-on-disk, rebuild the
65
- ledger from filesystem state and note the correction:
86
+ ledger from filesystem state and note the correction. A rebuilt ledger is the file-landing
87
+ skeleton (no `started`/`Done` lines), which still pins cycle position:
66
88
  ```bash
67
89
  ruby -r ~/.plastic/scripts/lib/bridge -e 'Bridge.rebuild_savepoint("<intent_dir>")'
68
90
  ```
@@ -131,6 +131,15 @@
131
131
  "assertions": [
132
132
  { "type": "convention", "check": "Determine Store step 2 documents local/project store detection via projects.yml + CWD match", "observed": "filled", "result": "pass" }
133
133
  ]
134
+ },
135
+ {
136
+ "id": 15, "scope": "behavior", "set": "validation",
137
+ "prompt": "QMD is present. The user says: continue the work on the statusline coloring (names the intent by description, not id).",
138
+ "expected_output": "Before scanning the store with grep/Read to locate the named intent, runs `ruby ~/.plastic/scripts/qmd-sync search \"statusline coloring\"` to surface the candidate intent, then opens the authoritative intent file for the hit it resumes. No-op fallback to INDEX.md / file scan when QMD is absent.",
139
+ "files": ["skills/continuing/SKILL.md"],
140
+ "assertions": [
141
+ { "type": "human", "check": "qmd-sync search is run before grep/Read when the intent is named by description; authoritative file opened for the hit", "observed": "Conditional Ledger-Resume carries the QMD-first step: run qmd-sync search before grep/Read, then open the authoritative file; no-op fallback when QMD is absent", "result": "pass" }
142
+ ]
134
143
  }
135
144
  ]
136
145
  }
@@ -41,6 +41,14 @@ When creating a tactical intent in a project store:
41
41
  - **Global:** `~/.plastic/store/`
42
42
  - **Project:** `~/.plastic/projects/{slug}/store/`
43
43
 
44
+ ### 1b. Check for a Duplicate or Predecessor (QMD-first)
45
+
46
+ QMD-first (when available): before scanning the store with grep/Read, run
47
+ `ruby ~/.plastic/scripts/qmd-sync search "<terms>"` to surface candidate, prior, or duplicate
48
+ intents, then open the authoritative intent file for any hit you act on. The command is a no-op
49
+ when QMD is absent, so fall back to the existing INDEX.md / file scan. Do this before allocating
50
+ the id so a near-duplicate can be reused and a true predecessor can be set in `--sources`.
51
+
44
52
  ### 2. Decide Branch vs Root
45
53
 
46
54
  Decide this BEFORE scaffolding, because it sets whether you pass `--parent`.
@@ -54,12 +62,18 @@ Having a "parent" in mind does NOT automatically mean branch. Choose by meaning:
54
62
  direct-ascendant provenance (D1).
55
63
  - **Merely related to / inspired by another intent** (it did NOT come out of that
56
64
  intent's lifecycle): carry NO `--sources`. Record the relation on the PREDECESSOR's
57
- `chain` instead, and mirror it as a `[[id]]` wikilink in `## Links` (the
58
- related-but-not-spawned rule).
65
+ `chain` instead (the related-but-not-spawned rule); the `## Links` section follows
66
+ from that edge, you do not write it by hand.
59
67
  - **Rule of thumb:** if the intent could exist without its parent, make it a root; only set
60
68
  `--sources` when it was genuinely created from / emerged from that intent's lifecycle.
61
69
  Topic similarity alone is not a `sources` edge.
62
70
 
71
+ `## Links` is a DERIVED view of `sources`/`chain`. Never hand-write a `## Links` line; add the
72
+ frontmatter edge and reproject. Links are decided by context influence (a `chain` edge has a high
73
+ bar: the candidate's context must materially help deliver this intent), not by shared files or a
74
+ similarity score. To gather candidates with their context and record an edge, use the
75
+ `plastic-linking-intents` skill and `scripts/link-suggest`.
76
+
63
77
  ### 3. Determine Intent Properties
64
78
 
65
79
  Ask or infer from context:
@@ -51,6 +51,22 @@
51
51
  "result": "pass"
52
52
  }
53
53
  ]
54
+ },
55
+ {
56
+ "id": 3,
57
+ "scope": "behavior",
58
+ "set": "validation",
59
+ "prompt": "QMD is present. The user says: create an intent to add retry to the uploader.",
60
+ "expected_output": "Before allocating the id / scaffolding, runs `ruby ~/.plastic/scripts/qmd-sync search \"add retry to the uploader\"` to surface a near-duplicate or true predecessor, then opens the authoritative intent file for any hit (reusing a near-duplicate or setting a real predecessor in --sources). No-op fallback to INDEX.md / file scan when QMD is absent.",
61
+ "files": [],
62
+ "assertions": [
63
+ {
64
+ "type": "human",
65
+ "check": "qmd-sync search is run before id allocation; authoritative file opened for any hit; informs reuse / --sources",
66
+ "observed": "SKILL.md (or agent file) carries the QMD-first step: run qmd-sync search before grep/Read, then open the authoritative file; no-op fallback when QMD is absent",
67
+ "result": "pass"
68
+ }
69
+ ]
54
70
  }
55
71
  ]
56
72
  }
@@ -42,10 +42,15 @@ field.
42
42
 
43
43
  ## `## Links`
44
44
 
45
- The human-readable projection of the local knowledge graph: all `sources`
46
- first (top, named), then all `chain` (named), as `[[id]]` wikilinks plus a
47
- short label. Counterpart to the frontmatter `sources` / `chain` edges, for
48
- Obsidian graph navigation.
45
+ The human-readable projection of the local knowledge graph, mirroring the
46
+ frontmatter exactly. Each entry is `- [[id--slug|<target's full intent: text>]]`,
47
+ a clickable `id--slug` wikilink target with the target intent's full `intent:`
48
+ text as the label (cross-store targets render
49
+ `- [[store:id--slug|<target's full intent: text>]]`). Ordering is mandatory: all
50
+ `sources` first (top), then all `chain`, frontmatter order preserved within each
51
+ group. Sources never appear at the end. No source/chain tags, no sub-grouping. An
52
+ intent with empty `sources` and `chain` carries the empty-state comment. Counterpart
53
+ to the frontmatter `sources` / `chain` edges, for Obsidian graph navigation.
49
54
 
50
55
  ## Conventions — Filesystem as Schema
51
56
 
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: plastic-creating-skills
3
+ description: >
4
+ Author or revise a Plastic skill, a subagent or Agent role file, or a
5
+ lifecycle hook with progressive disclosure. Use when creating or editing a
6
+ SKILL.md, writing a description or frontmatter, designing the slim body,
7
+ building references, evals, or scripts, or scaffolding a new skill. Also use
8
+ when a skill is too big or over its token budget, when prompts are bloated,
9
+ when an agent keeps missing a step or ignoring instructions, or when the user
10
+ says "progressive disclosure", "write a skill", "thin router", "split into
11
+ references", or "make this slim".
12
+ ---
13
+
14
+ # Creating Skills
15
+
16
+ Author skills, agents, and hooks as thin routers over deep references. This
17
+ body carries the rules that must stay correct without opening anything, then
18
+ routes each authoring task to the reference that holds the depth.
19
+
20
+ ## Rules (must be right even if no reference is opened)
21
+
22
+ - Three load levels, hard budgets: metadata around 100 tokens (always loaded),
23
+ body under 5000 tokens and under 500 lines (loaded on trigger), references on
24
+ demand. Keep the body well under budget, not at the ceiling.
25
+ - Progressive disclosure first: the body routes, the references hold the depth.
26
+ Any deep how-to in the body belongs in a reference instead.
27
+ - Description states WHEN to use, not the workflow. Write it in third person,
28
+ front-load concrete trigger keywords, and include at least one indirect
29
+ trigger (a request that never names the domain). Never summarize the steps.
30
+ - Bind every reference link to an observable trigger condition. Never leave a
31
+ bare pointer to a reference.
32
+ - References stay one level deep. Any reference over 100 lines opens with a
33
+ table of contents.
34
+ - Build at least three evals before writing extensive docs.
35
+ - Match determinism to fragility: a deterministic script for fragile or
36
+ repeated mechanical steps, prose for judgment calls.
37
+ - Imperative voice, no second person. No em-dashes or en-dashes in any shipped
38
+ skill or doc (use commas, periods, parentheses, colons).
39
+
40
+ ## Route the authoring task to its reference
41
+
42
+ | Authoring task | Open |
43
+ |---|---|
44
+ | Starting any authoring task: load the load-level model and the thin-router pattern first | `references/progressive-disclosure.md` |
45
+ | Authoring an Agent Skill (frontmatter, description, slim body, voice) | `references/skills.md` |
46
+ | Authoring a subagent or Agent role file | `references/agents.md` |
47
+ | Authoring a lifecycle hook | `references/hooks.md` |
48
+ | Deciding script versus prose, or writing a script | `references/scripts.md` |
49
+ | Building evals for a skill | `references/evals.md` |
50
+
51
+ ## Shrink context, or let a skill self-improve
52
+
53
+ - When prompts or tool output blow the context budget, open `references/hooks.md` (E7) for
54
+ the global token levers: a PostToolUse hook that trims noisy tool output before it enters
55
+ context, and Programmatic Tool Calling that keeps looped tool results in code, not context.
56
+ - When a skill should learn from its own real runs, open `references/hooks.md` (E8) for the
57
+ propose-only Stop or SubagentStop loop (transcript to proposed edits to human approval to
58
+ git, effort-gated). The dedicated skill is the future `improving-skills` skill.
59
+
60
+ ## Scaffolder and evals
61
+
62
+ - To start a new skill, agent, or hook from a born-slim file, run
63
+ `scripts/scaffold.rb`.
64
+ - To design, run, and grade evals in depth (paired runs, assertions after
65
+ observing, pass rates), use the `plastic-evaluating-skills` skill.
@@ -0,0 +1,108 @@
1
+ {
2
+ "skill_name": "plastic-creating-skills",
3
+ "evals": [
4
+ {
5
+ "id": 1,
6
+ "prompt": "I want to author a new Plastic skill, how should I structure it?",
7
+ "expected_output": "The skill should activate. This is a direct authoring request that names the domain. Guide the user through progressive disclosure: metadata around 100 tokens, a slim body under 5000 tokens and 500 lines that routes, and references on demand. Point to references/skills.md for frontmatter, description, and voice, and route load-level questions through references/progressive-disclosure.md first.",
8
+ "files": [],
9
+ "assertions": [
10
+ "The skill activates (direct authoring request that names the domain).",
11
+ "The response routes to references rather than dumping deep how-to inline.",
12
+ "The response states the load-level budgets (around 100 token metadata, body under 5000 tokens and 500 lines)."
13
+ ]
14
+ },
15
+ {
16
+ "id": 2,
17
+ "prompt": "The agent keeps ignoring my instructions and the file is huge, help me restructure it",
18
+ "expected_output": "The skill should activate. This is an indirect trigger that never names skills or progressive disclosure, but the symptoms (bloated file, agent missing or skipping steps) are exactly the over-budget body case the skill covers. Guide toward splitting the body into references, keeping the body a thin router, and binding each reference to an observable trigger condition.",
19
+ "files": [],
20
+ "assertions": [
21
+ "The skill activates on the indirect trigger (no skill or progressive-disclosure keyword in the prompt).",
22
+ "The response guides toward splitting the body into references and keeping a thin router."
23
+ ]
24
+ },
25
+ {
26
+ "id": 3,
27
+ "prompt": "Scaffold a new lifecycle hook for Plastic",
28
+ "expected_output": "The skill should activate. Authoring a lifecycle hook is in scope. Route to references/hooks.md and offer scripts/scaffold.rb to start the hook from a born-slim file.",
29
+ "files": [],
30
+ "assertions": [
31
+ "The skill activates (authoring a lifecycle hook is in scope).",
32
+ "The response routes to references/hooks.md and offers scripts/scaffold.rb."
33
+ ]
34
+ },
35
+ {
36
+ "id": 4,
37
+ "prompt": "Our prompts are bloated and we keep blowing the context budget",
38
+ "expected_output": "The skill should activate. This is an indirect trigger: the user describes bloated prompts and a context budget problem without naming skills. The skill restructures instructions into a thin router over deep references with hard load-level budgets, which is the fix for this symptom.",
39
+ "files": [],
40
+ "assertions": [
41
+ "The skill activates on the indirect context-budget trigger (no skill keyword in the prompt).",
42
+ "The response treats the fix as a thin router over deep references with hard load-level budgets."
43
+ ]
44
+ },
45
+ {
46
+ "id": 5,
47
+ "prompt": "Run the evals on my skill and check the pass rate",
48
+ "expected_output": "The skill should NOT trigger. Running evals and reading pass rates is the job of plastic-evaluating-skills, not authoring. Near-miss negative: shares the words 'skill' and 'evals' but the operation is grading an existing skill, not creating or revising one.",
49
+ "files": [],
50
+ "assertions": [
51
+ "The skill does not activate (running and grading evals is plastic-evaluating-skills, not authoring)."
52
+ ]
53
+ },
54
+ {
55
+ "id": 6,
56
+ "prompt": "Create a new intent for the dashboard work",
57
+ "expected_output": "The skill should NOT trigger. Creating an intent is plastic-creating-intent. Near-miss negative: shares the verb 'create' but the object is an intent, not a skill, agent, or hook.",
58
+ "files": [],
59
+ "assertions": [
60
+ "The skill does not activate (creating an intent is plastic-creating-intent)."
61
+ ]
62
+ },
63
+ {
64
+ "id": 7,
65
+ "prompt": "I keep losing every team fight because of a skill issue in this game, any tips?",
66
+ "expected_output": "The skill should NOT trigger. This is a gaming question with no relation to authoring instructions. Near-miss negative: shares the word 'skill' in an unrelated sense.",
67
+ "files": [],
68
+ "assertions": [
69
+ "The skill does not activate (gaming question, unrelated sense of 'skill')."
70
+ ]
71
+ },
72
+ {
73
+ "id": 8,
74
+ "prompt": "Write unit tests for my Ruby model that validates email addresses",
75
+ "expected_output": "The skill should NOT trigger. Writing test code is a Ruby testing task. Near-miss negative: shares 'write' and 'test' but has nothing to do with authoring a skill, agent, or hook.",
76
+ "files": [],
77
+ "assertions": [
78
+ "The skill does not activate (writing test code is a Ruby testing task, not authoring a skill)."
79
+ ]
80
+ },
81
+ {
82
+ "id": 9,
83
+ "prompt": "Author a slim SKILL.md for a PDF-extraction skill",
84
+ "expected_output": "Activation is assumed for this output-quality case. Correct output is a SKILL.md whose frontmatter description is third person, front-loads concrete trigger keywords, states WHEN to use rather than the workflow, and includes at least one indirect trigger. The body stays under 5000 tokens and under 500 lines and routes to references rather than carrying deep how-to. Each reference link names an observable trigger condition with no bare pointer like 'see references/'. References stay one level deep, and no string contains an em-dash or en-dash.",
85
+ "files": [],
86
+ "assertions": [
87
+ "The frontmatter description is written in the third person (no 'you' or 'I').",
88
+ "The description front-loads concrete trigger keywords in its opening clause.",
89
+ "The description includes at least one indirect trigger (a symptom phrasing that never names PDF extraction or skills).",
90
+ "The body is under 5000 tokens and under 500 lines.",
91
+ "Every reference link is bound to an observable trigger condition (no bare pointer such as 'see references/').",
92
+ "References stay one level deep (no reference points to a deeper reference).",
93
+ "No string in the SKILL.md or its references contains an em-dash or en-dash."
94
+ ]
95
+ },
96
+ {
97
+ "id": 10,
98
+ "prompt": "Make this subagent role file slim, the description is vague and the body is too long",
99
+ "expected_output": "The skill should activate. Authoring or revising a subagent or Agent role file is in scope, and the symptoms (vague description, over-long body) are the progressive-disclosure case. Route to references/agents.md, tighten the description to state WHEN, and move depth into references. Output should keep the body under budget and use no em-dashes.",
100
+ "files": [],
101
+ "assertions": [
102
+ "The skill activates (revising a subagent or Agent role file is in scope).",
103
+ "The response routes to references/agents.md and tightens the description to state WHEN.",
104
+ "The proposed output keeps the body under budget and uses no em-dash or en-dash."
105
+ ]
106
+ }
107
+ ]
108
+ }
@@ -0,0 +1,168 @@
1
+ # Authoring an Agent (subagent)
2
+
3
+ How to write a subagent / Agent role file: scope, tools, description, the reviewer pattern,
4
+ collector discipline, and the skill-vs-agent decision. Rules cite section D of the
5
+ best-practices standard (D1 through D6).
6
+
7
+ ## Contents
8
+
9
+ - [When a skill suffices vs escalate to an agent](#when-a-skill-suffices-vs-escalate-to-an-agent)
10
+ - [The agent definition fields](#the-agent-definition-fields)
11
+ - [One focused task per agent](#one-focused-task-per-agent)
12
+ - [Tight tool set](#tight-tool-set)
13
+ - [Description: embedded when-to-use examples](#description-embedded-when-to-use-examples)
14
+ - [Collectors, not implementers](#collectors-not-implementers)
15
+ - [Reviewer / devil's-advocate agents](#reviewer--devils-advocate-agents)
16
+ - [Composing skills and agents](#composing-skills-and-agents)
17
+ - [Self-checks](#self-checks)
18
+
19
+ For load levels, the three-bucket model, and description-as-trigger rules, open
20
+ `progressive-disclosure.md` and `skills.md`. Do not re-derive them here (C7).
21
+
22
+ ## When a skill suffices vs escalate to an agent
23
+
24
+ Decide before authoring an agent at all. A full agent carries its own context window and tool
25
+ grant, so it is too heavyweight for quick work [D5].
26
+
27
+ | Situation | Build | Why |
28
+ | --- | --- | --- |
29
+ | Light read-only check, single-file validation, scaffold one file | Skill | A skill loads on trigger and runs in the current context, no spin-up cost [D5] |
30
+ | Deep multi-file audit, parallel investigation, isolated noisy work | Agent | The isolated context keeps search and log noise off the main thread [D2][D5] |
31
+ | Same task repeated with deterministic steps | Script (see `scripts.md`) | Executed, not loaded; token-free and variance-free |
32
+
33
+ Default to a skill. Escalate to an agent only when the work needs an isolated context budget or
34
+ its own restricted tool grant.
35
+
36
+ ## The agent definition fields
37
+
38
+ An agent file is frontmatter plus a system-prompt body. Set each field for one reason.
39
+
40
+ | Field | When it matters | Set it to |
41
+ | --- | --- | --- |
42
+ | `name` | Always. The orchestrator and `SendMessage` address the agent by it | Lowercase-hyphen, one capability (`spec-reviewer`, `dependency-auditor`) |
43
+ | `description` | Always. The orchestrator delegates purely on this text [D3] | Trigger conditions plus embedded when-to-use example pairs (see below) |
44
+ | `tools` | Always. Omitting it grants every tool, which over-arms the agent [D1] | Only the tools the one task needs |
45
+ | `model` | When the task is cheap (Haiku) or hard (Opus) | The cheapest tier that holds quality |
46
+ | `proactive` marker | When the agent should auto-fire without an explicit ask [D3] | Include "use proactively" inside the description |
47
+
48
+ Keep the body in imperative voice. State the agent's single job, its numbered process, and its
49
+ output contract. Push reference detail into files the agent reads on demand, same as a skill body.
50
+
51
+ ## One focused task per agent
52
+
53
+ Give each agent exactly one task. Focused scope plus a tight tool set is what makes delegation
54
+ decidable and cheap [D1].
55
+
56
+ 1. Name the single responsibility in one phrase. If the name needs "and", split into two agents.
57
+ 2. Start with one agent. Add a specialist only when it materially improves isolation or tool
58
+ scoping [D1]. More agents widen the discovery surface and the orchestrator's choice space.
59
+ 3. Write the body around that one task. An agent that "reviews and also fixes and also reports" has
60
+ three jobs and no clear output contract.
61
+
62
+ ## Tight tool set
63
+
64
+ Grant only the tools the one task requires [D1].
65
+
66
+ | Agent kind | Typical tools | Excluded |
67
+ | --- | --- | --- |
68
+ | Reviewer / auditor | Read, Grep, Glob | Edit, Write, Bash (read-only by design) [D4] |
69
+ | Collector / researcher | Read, Grep, Glob, WebFetch | Edit, Write (returns a summary, does not change code) [D2] |
70
+ | Implementer | Read, Edit, Write, Bash | Only the surface its task touches |
71
+
72
+ A reviewer with Edit can rewrite the code it judges. A collector with Write can leak its noisy
73
+ context back into the tree. The tool list is the guardrail; keep it narrow.
74
+
75
+ ## Description: embedded when-to-use examples
76
+
77
+ The orchestrator never reads the body at delegation time. It routes on the description alone, so
78
+ the description must teach the boundary by example [D3].
79
+
80
+ Write the description with:
81
+
82
+ 1. A trigger clause in third person ("Use when reviewing a spec before the plan stage").
83
+ 2. One or more `<example>` pairs showing a matching prompt, the assistant's choice to delegate, and
84
+ a one-line `<commentary>` on why. Example pairs teach the boundary a keyword list cannot [D3].
85
+ 3. "use proactively" when the agent should auto-fire without the user naming it [D3].
86
+
87
+ Concrete shape:
88
+
89
+ ```
90
+ description: >
91
+ Use when a spec is complete and needs an adversarial review before planning.
92
+ Use proactively after the spec-specialist writes spec.md.
93
+ <example>
94
+ Context: spec.md just landed for the active intent.
95
+ user: "Is this spec ready to plan?"
96
+ assistant: "I'll use the spec-reviewer agent to challenge the spec before planning."
97
+ <commentary>Adversarial review runs at the Why-to-How boundary.</commentary>
98
+ </example>
99
+ ```
100
+
101
+ A description that summarizes the agent's workflow instead of its trigger makes the orchestrator
102
+ act on the summary and skip the body. State when to fire, not how the agent works.
103
+
104
+ ## Collectors, not implementers
105
+
106
+ Use a subagent as an information collector that returns a short summary, not as an implementer [D2].
107
+
108
+ | Do | Avoid |
109
+ | --- | --- |
110
+ | Return a tight summary: findings, file paths, a verdict | Stuffing raw search output or full file dumps back into the main thread |
111
+ | Write a plan or summary markdown file as shared memory; have the main thread read it [D2] | Passing large results inline, which defeats the isolation |
112
+ | Keep search, log, and crawl noise inside the agent's own context [D2] | Re-emitting that noise to the orchestrator |
113
+
114
+ The reason a subagent has an isolated context is to absorb noise. The filesystem (a plan or summary
115
+ file) is the shared memory between agents; the agent's return value is the headline, not the
116
+ transcript [D2].
117
+
118
+ ## Reviewer / devil's-advocate agents
119
+
120
+ A reviewer agent needs four things, or it produces unscoped, unverifiable results [D4].
121
+
122
+ 1. Read-only tools: Read, Grep, Glob, and nothing that edits [D4]. A reviewer that can edit stops
123
+ being a reviewer.
124
+ 2. A numbered review process in the body, so every run covers the same checks in the same order.
125
+ 3. Explicit anti-scope: a "do not use for" clause that names what the agent must not do (implement
126
+ fixes, refactor, approve its own changes) [D4].
127
+ 4. A fixed, severity-bucketed output format, so findings are comparable across runs [D4].
128
+
129
+ Fixed output contract:
130
+
131
+ ```
132
+ ## Critical
133
+ - <finding> (file:line) -> <why it blocks>
134
+
135
+ ## Major
136
+ - <finding> (file:line) -> <impact>
137
+
138
+ ## Minor
139
+ - <finding> (file:line) -> <suggestion>
140
+
141
+ ## Verdict
142
+ PASS | BLOCK, with one-line reason.
143
+ ```
144
+
145
+ The severity buckets and the verdict are mandatory. Empty buckets stay in, marked "none", so a
146
+ reader can tell the agent checked.
147
+
148
+ ## Composing skills and agents
149
+
150
+ Two mechanisms load content into an agent's context. Choose by what budget the isolated agent
151
+ should carry [D6].
152
+
153
+ | Mechanism | Effect | Use when |
154
+ | --- | --- | --- |
155
+ | Subagent `skills:` | Preloads the full skill content into the agent at spawn [D6] | The agent must always have that skill's rules in hand |
156
+ | Skill `context: fork` | Runs the skill body as a task prompt inside a chosen agent type [D6] | A skill should execute as an isolated agent, not inline |
157
+
158
+ Pick deliberately. `skills:` spends the agent's budget up front for guaranteed availability;
159
+ `context: fork` hands the body to a fresh agent so the work runs isolated [D6].
160
+
161
+ ## Self-checks
162
+
163
+ - Could this be a skill instead? If the work is light or single-file, build a skill [D5].
164
+ - Does the agent have exactly one job, named without "and"? [D1]
165
+ - Is the tool list the minimum the job needs, and read-only for a reviewer? [D1][D4]
166
+ - Does the description carry at least one `<example>` pair and "use proactively" if it auto-fires? [D3]
167
+ - Does the agent return a summary and use a file as shared memory, not dump its context? [D2]
168
+ - Does a reviewer have a numbered process, an anti-scope clause, and a severity-bucketed output? [D4]
@@ -0,0 +1,41 @@
1
+ # Evals (author-time gate)
2
+
3
+ This is the gate, not the method. It states the eval decisions an author makes while building a
4
+ skill, then hands the full procedure to one place. Do not duplicate that procedure here.
5
+
6
+ ## Build evals before docs
7
+
8
+ Build at least three evals before writing extensive documentation. A skill without an eval is an
9
+ assertion, not a capability, so the eval forces the skill to close a real observed gap instead of an
10
+ imagined one. [F1]
11
+
12
+ Build RED-GREEN-REFACTOR. Run the scenario without the skill and record the verbatim failure (RED),
13
+ write the minimal instructions that fix exactly that failure (GREEN), then close the loopholes the
14
+ failure exposed (REFACTOR). Only instructions that move a failing eval earn their tokens. [F2]
15
+
16
+ ## What each eval must cover
17
+
18
+ - Description triggering. Pair should-trigger queries with near-miss negatives: prompts that share
19
+ keywords with the skill but need a different skill entirely. Near-miss negatives catch
20
+ over-triggering, the most common description failure. State the trigger set here; do not size the
21
+ query count or split here. [F3]
22
+ - Output quality. Write assertions only after observing real output. Make them specific, verifiable,
23
+ and countable, with no benefit of the doubt and no brittle exact-phrase matching. Assertions
24
+ written before observation encode hopes, not behavior, so include at least one output-quality case
25
+ graded this way. [F4]
26
+ - Discipline under pressure. For a skill whose job is restraint, stack pressures (time, sunk cost,
27
+ authority, exhaustion) with forced options and run the case via a subagent. Reciting the rule is
28
+ not complying with it. [F5]
29
+
30
+ ## Grading and reliability decisions
31
+
32
+ Grade with the cheapest sufficient tier, and track capability (pass@k) separately from reliability
33
+ (pass^k) with k at least three. The evaluating-skills skill owns the grader taxonomy, judge
34
+ calibration, clean-context execution, and cross-model testing. [F6, F7, F8]
35
+
36
+ ## Run them with the methodology skill
37
+
38
+ Use the evaluating-skills skill to author and run the evals. It owns the full method: eval scope
39
+ selection, the query-count and train/validation protocol, the grader taxonomy and judge calibration,
40
+ the iteration loop, and graduation of stable capability evals into regression. It is the source of
41
+ truth for those steps; this file states the author-time gate and stops there. [F6, F7, F8]