@zalom/plastic 1.0.0-beta.9 → 1.0.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.
- package/PLASTIC-reference.md +133 -0
- package/PLASTIC.md +398 -82
- package/README.md +99 -82
- package/agents/plastic-brainstorming.md +12 -9
- package/agents/plastic-enforcer.md +52 -12
- package/agents/plastic-executor.md +10 -10
- package/agents/plastic-future-intent-researcher.md +4 -8
- package/agents/plastic-intent-curator.md +12 -14
- package/agents/plastic-intent-discovery.md +35 -0
- package/agents/plastic-planner.md +15 -10
- package/agents/plastic-spec-specialist.md +15 -10
- package/bin/plastic.js +7 -3
- package/hooks/code-gate +10 -1
- package/hooks/hooks.json +28 -3
- package/hooks/lock-gate +21 -0
- package/hooks/retrieval-gate +10 -0
- package/hooks/savepoint-pre +10 -0
- package/hooks/statusline +48 -6
- package/package.json +2 -1
- package/scripts/agent-report +21 -0
- package/scripts/dashboard.rb +98 -23
- package/scripts/doctor.rb +232 -5
- package/scripts/hook-auto-arm +1 -1
- package/scripts/hook-bash-gate +22 -4
- package/scripts/hook-code-gate +11 -6
- package/scripts/hook-continue +17 -0
- package/scripts/hook-create-gate +45 -9
- package/scripts/hook-gate-check +24 -23
- package/scripts/hook-lock-gate +83 -0
- package/scripts/hook-retrieval-gate +148 -0
- package/scripts/hook-savepoint-pre +32 -0
- package/scripts/hook-session-start +1 -1
- package/scripts/insight-append +51 -0
- package/scripts/install.rb +44 -7
- package/scripts/lib/agent_models.rb +43 -0
- package/scripts/lib/bridge.rb +924 -84
- package/scripts/lib/dashboard_banner.rb +42 -0
- package/scripts/lib/hook_registry.rb +95 -0
- package/scripts/lib/insights.rb +86 -0
- package/scripts/lib/installer_core.rb +100 -60
- package/scripts/lib/link_suggestions.rb +319 -0
- package/scripts/lib/lock.rb +375 -0
- package/scripts/lib/power_tools.rb +22 -21
- package/scripts/lib/preflight.rb +79 -0
- package/scripts/lib/qmd_sync.rb +15 -0
- package/scripts/lib/retrieval_gate.rb +211 -0
- package/scripts/lib/worktree.rb +384 -0
- package/scripts/link-suggest +213 -0
- package/scripts/new-intent +9 -1
- package/scripts/plastic-lock +164 -0
- package/scripts/read-config +4 -0
- package/scripts/spawn-preamble +11 -3
- package/scripts/update.rb +16 -7
- package/skills/auto/SKILL.md +126 -19
- package/skills/auto/references/agent-architecture.md +7 -4
- package/skills/auto/references/agent-report-contract.md +36 -1
- package/skills/auto/references/end-tail.md +56 -0
- package/skills/auto/references/human-report-contract.md +55 -0
- package/skills/auto/references/tiers.md +77 -0
- package/skills/brainstorming/SKILL.md +7 -34
- package/skills/brainstorming/references/design-principles.md +49 -0
- package/skills/continuing/SKILL.md +26 -7
- package/skills/creating-intent/SKILL.md +13 -28
- package/skills/creating-project/SKILL.md +11 -74
- package/skills/creating-project/references/project-scaffolding.md +97 -0
- package/skills/creating-skills/SKILL.md +65 -0
- package/skills/creating-skills/evals/evals.json +108 -0
- package/skills/creating-skills/references/agents.md +168 -0
- package/skills/creating-skills/references/evals.md +41 -0
- package/skills/creating-skills/references/hooks.md +248 -0
- package/skills/creating-skills/references/progressive-disclosure.md +176 -0
- package/skills/creating-skills/references/scripts.md +166 -0
- package/skills/creating-skills/references/skills.md +165 -0
- package/skills/creating-skills/scripts/scaffold.rb +313 -0
- package/skills/dashboard/SKILL.md +13 -11
- package/skills/dashboard/references/classification.md +22 -0
- package/skills/doctor/SKILL.md +10 -7
- package/skills/executing-plan/SKILL.md +4 -4
- package/skills/humanizer/SKILL.md +39 -0
- package/skills/humanizer/evals/evals.json +70 -0
- package/skills/humanizer/references/always-on-snippet.md +9 -0
- package/skills/humanizer/references/examples.md +48 -0
- package/skills/install/SKILL.md +75 -84
- package/skills/intent-curator/SKILL.md +5 -1
- package/skills/intent-discovery/SKILL.md +47 -0
- package/skills/intent-starting/SKILL.md +130 -0
- package/skills/intent-starting/evals/evals.json +117 -0
- package/skills/intent-starting/references/boarding-matrix.md +35 -0
- package/skills/linking-intents/SKILL.md +48 -12
- package/skills/lock/SKILL.md +41 -0
- package/skills/managing-index/SKILL.md +6 -0
- package/skills/releasing/SKILL.md +44 -29
- package/skills/releasing/references/promotion-and-tagging.md +60 -0
- package/skills/roadmap/SKILL.md +51 -0
- package/skills/roadmap/references/file-format.md +91 -0
- package/skills/roadmap/references/operations.md +78 -0
- package/skills/uninstall/SKILL.md +29 -11
- package/skills/update/SKILL.md +34 -23
- package/skills/versions/SKILL.md +27 -12
- package/skills/writing-plans/SKILL.md +10 -88
- package/skills/writing-plans/references/plan-format.md +102 -0
- package/templates/config.yml +8 -0
- package/templates/outcome.md +3 -0
- package/templates/revisions.md +58 -0
- package/templates/roadmap.md +30 -0
- package/skills/writing-instructions/SKILL.md +0 -159
- package/skills/writing-instructions/references/agentskills-spec.md +0 -135
|
@@ -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]
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# Authoring a Lifecycle Hook
|
|
2
|
+
|
|
3
|
+
A hook is a harness: deterministic code the Claude Code runtime fires at a lifecycle
|
|
4
|
+
event. Author one when a probabilistic skill keeps dropping a behavior and that behavior
|
|
5
|
+
must hold every time.
|
|
6
|
+
|
|
7
|
+
For body voice, budgets, and reference rules, see `progressive-disclosure.md` and `skills.md`.
|
|
8
|
+
For deciding script versus prose and writing the handler logic, read `scripts.md` when the
|
|
9
|
+
handler grows past a few lines. This file covers only hook authoring.
|
|
10
|
+
|
|
11
|
+
## Contents
|
|
12
|
+
|
|
13
|
+
- When to reach for a hook (E1)
|
|
14
|
+
- The event to matcher to handler model (E2)
|
|
15
|
+
- Which event for which job (E2)
|
|
16
|
+
- Path rules and executability (E3)
|
|
17
|
+
- No-op by default, opt-in (E4)
|
|
18
|
+
- Exit codes and output channels (E5)
|
|
19
|
+
- Verify the harness engaged (E6)
|
|
20
|
+
- Token levers: global hooks that shrink context (E7)
|
|
21
|
+
- Propose-only self-improving loop (E8)
|
|
22
|
+
- Authoring checklist
|
|
23
|
+
|
|
24
|
+
## When to reach for a hook (E1)
|
|
25
|
+
|
|
26
|
+
Reach for a hook only after a skill has lost the behavior. The documented order is: first
|
|
27
|
+
strengthen the skill description and instructions so the model keeps preferring the skill;
|
|
28
|
+
if it still drops the step, enforce it deterministically with a hook. [E1]
|
|
29
|
+
|
|
30
|
+
Test: ask "does this behavior have to hold even when the model forgets the skill?" If yes
|
|
31
|
+
(a gate before a destructive tool, a savepoint before compaction, a format pass after every
|
|
32
|
+
edit), the runtime must enforce it, not the prompt. If no, leave it in the skill body and
|
|
33
|
+
spend no hook tokens on it. [E1]
|
|
34
|
+
|
|
35
|
+
A hook is code on the critical path of an event. It is not loaded into context, so it costs
|
|
36
|
+
no tokens at trigger time, but a mistuned hook blocks real work. Make it earn the
|
|
37
|
+
intervention. [E1]
|
|
38
|
+
|
|
39
|
+
## The event to matcher to handler model (E2)
|
|
40
|
+
|
|
41
|
+
Hooks are configured in three nested levels: event, then matcher group, then handler list.
|
|
42
|
+
[E2]
|
|
43
|
+
|
|
44
|
+
- Event: the lifecycle moment (for example PreToolUse, SessionStart, PreCompact).
|
|
45
|
+
- Matcher: which instances of that event fire the handler. For tool events the matcher is a
|
|
46
|
+
tool-name pattern (`Bash`, `Edit|Write`, `mcp__memory__.*`). For SessionStart the matcher
|
|
47
|
+
is a source (`startup`, `resume`, `clear`, `compact`). For PreCompact it is `manual` or
|
|
48
|
+
`auto`.
|
|
49
|
+
- Handler: what runs. Handler types include `command` (a script, JSON arrives on stdin),
|
|
50
|
+
`http`, `mcp_tool`, `prompt` (an LLM yes/no), and `agent`. Author `command` handlers as
|
|
51
|
+
scripts unless a non-script handler is clearly required. [E2]
|
|
52
|
+
|
|
53
|
+
Each event exposes different inputs and a different blocking power, so the wrong event cannot
|
|
54
|
+
do the job no matter how the handler is written. Select the event first, then the matcher,
|
|
55
|
+
then the handler. [E2]
|
|
56
|
+
|
|
57
|
+
## Which event for which job (E2)
|
|
58
|
+
|
|
59
|
+
| Job | Event | Matcher example | Can block | Key inputs |
|
|
60
|
+
| --- | --- | --- | --- | --- |
|
|
61
|
+
| Gate or validate before a tool runs | PreToolUse | `Edit\|Write`, `Bash` | yes (exit 2 or `permissionDecision: deny`) | `tool_name`, `tool_input` |
|
|
62
|
+
| Format, lint, or remind after a tool succeeds | PostToolUse | `Edit\|Write` | block before next model call only | `tool_name`, `tool_input`, `tool_output` |
|
|
63
|
+
| Boot or inject context at session start | SessionStart | `startup`, `resume`, `clear`, `compact` | no | `source` |
|
|
64
|
+
| Savepoint before compaction | PreCompact | `manual`, `auto` | no (savepoint; exits 0) | compaction trigger |
|
|
65
|
+
| Erase or augment a prompt before processing | UserPromptSubmit | (none) | yes (exit 2) | `prompt`, `permission_mode` |
|
|
66
|
+
|
|
67
|
+
Notes that change the choice of event: [E2]
|
|
68
|
+
|
|
69
|
+
- PreToolUse fires before the tool runs and can stop it. Use it for gates and pre-act
|
|
70
|
+
validation (block an edit to project code before the plan exists, block a destructive
|
|
71
|
+
Bash command).
|
|
72
|
+
- PostToolUse fires after the tool has already run. It cannot undo the tool. Use it to format
|
|
73
|
+
the result, lint it, or surface a reminder, and to block the next model call when the
|
|
74
|
+
output is unacceptable.
|
|
75
|
+
- SessionStart cannot block. Use it to inject boot context, not to enforce anything. Its
|
|
76
|
+
stdout on exit 0 becomes conversation context (see exit codes).
|
|
77
|
+
- PreCompact fires before the runtime compacts the conversation. Use it to write a savepoint
|
|
78
|
+
while the full context still exists.
|
|
79
|
+
|
|
80
|
+
Plastic ships working instances of each: `scripts/hook-code-gate` (PreToolUse gate),
|
|
81
|
+
`scripts/hook-session-start` (SessionStart boot and inject), `scripts/hook-savepoint-pre`
|
|
82
|
+
(PreCompact savepoint). Read one before authoring a new hook of the same shape.
|
|
83
|
+
|
|
84
|
+
## Path rules and executability (E3)
|
|
85
|
+
|
|
86
|
+
Two failures here are silent: the hook never fires and nothing reports why. [E3]
|
|
87
|
+
|
|
88
|
+
- Reference the handler script through the exported placeholders: `${CLAUDE_PLUGIN_ROOT}` for
|
|
89
|
+
a script shipped inside a plugin, `${CLAUDE_PROJECT_DIR}` for a script that lives in the
|
|
90
|
+
project. A relative path resolves against an unpredictable working directory; a hard-coded
|
|
91
|
+
absolute path works in development and breaks on another machine. [E3]
|
|
92
|
+
- Make the script executable: `chmod +x` the handler file and commit that bit. A
|
|
93
|
+
non-executable `command` handler fails silently. [E3]
|
|
94
|
+
- Give the script a shebang (`#!/usr/bin/env ruby` for Plastic hooks; any shell must run under
|
|
95
|
+
macOS /bin/bash 3.2). [E3]
|
|
96
|
+
|
|
97
|
+
Other placeholders the runtime exports: `${CLAUDE_PLUGIN_DATA}`. [E3]
|
|
98
|
+
|
|
99
|
+
## No-op by default, opt-in (E4)
|
|
100
|
+
|
|
101
|
+
Make a hook a no-op by default and enable it only through explicit config. Exit 0 (allow,
|
|
102
|
+
emit nothing) unless the user has opted in. A reminder or validation hook that fires for users
|
|
103
|
+
who never enabled it blocks or noises work that was never asked for. [E4]
|
|
104
|
+
|
|
105
|
+
Concrete shape of an opt-in, no-op-by-default handler:
|
|
106
|
+
|
|
107
|
+
```ruby
|
|
108
|
+
#!/usr/bin/env ruby
|
|
109
|
+
# PostToolUse reminder. No-op unless explicitly enabled.
|
|
110
|
+
require "json"
|
|
111
|
+
config = ENV["CLAUDE_PROJECT_DIR"] ? File.join(ENV["CLAUDE_PROJECT_DIR"], ".myhook.yml") : nil
|
|
112
|
+
exit 0 unless config && File.exist?(config) # opt-in gate: silent allow when not enabled
|
|
113
|
+
payload = JSON.parse($stdin.read) rescue {}
|
|
114
|
+
# ... emit reminder only past this point ...
|
|
115
|
+
exit 0
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The early `exit 0` is the opt-in gate. Place the enable check before any side effect. [E4]
|
|
119
|
+
Plastic gate hooks follow the same fail-open discipline: no bridge resolved means exit 0
|
|
120
|
+
(allow), seen in `scripts/hook-code-gate`.
|
|
121
|
+
|
|
122
|
+
## Exit codes and output channels (E5)
|
|
123
|
+
|
|
124
|
+
The exit code, not the script's intent, decides what the runtime does with the output. [E5]
|
|
125
|
+
|
|
126
|
+
| Exit code | Meaning | Where output goes |
|
|
127
|
+
| --- | --- | --- |
|
|
128
|
+
| 0 | success | stdout shown; for UserPromptSubmit and SessionStart, stdout becomes conversation context |
|
|
129
|
+
| 2 | blocking error | stdout and JSON ignored; stderr fed back to Claude; blocks the action on events that support blocking |
|
|
130
|
+
| other non-zero | non-blocking error | first stderr line in transcript, full text in debug log; action proceeds |
|
|
131
|
+
|
|
132
|
+
Rules that follow from the table: [E5]
|
|
133
|
+
|
|
134
|
+
- To inject context (SessionStart boot banner, UserPromptSubmit augmentation), exit 0 and
|
|
135
|
+
write the context to stdout. On those two events stdout is consumed as context, not just
|
|
136
|
+
displayed.
|
|
137
|
+
- To block (a gate that refuses an edit, a validator that rejects a command), exit 2 and write
|
|
138
|
+
the reason to stderr. The agent reads stderr and can act on it. Plastic gates do exactly
|
|
139
|
+
this: `$stderr.puts "PLASTIC GATE - <reason>"; exit 2`.
|
|
140
|
+
- For PreToolUse, prefer the structured decision over a bare exit. Emit
|
|
141
|
+
`hookSpecificOutput.permissionDecision` with value `allow`, `deny`, `ask`, or `defer`, plus
|
|
142
|
+
`permissionDecisionReason`. Do not use the deprecated top-level `decision` field. [E5]
|
|
143
|
+
- Blocking with exit 2 works only on events that support it. PreToolUse is the clear gate
|
|
144
|
+
event; UserPromptSubmit, Stop, SubagentStop, and a few task events also support exit-2
|
|
145
|
+
blocking. SessionStart and SessionEnd cannot block; exit 2 there does not stop anything.
|
|
146
|
+
PreCompact runs a savepoint, not a gate (see the job table). [E5]
|
|
147
|
+
|
|
148
|
+
PreToolUse JSON shape:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"hookSpecificOutput": {
|
|
153
|
+
"hookEventName": "PreToolUse",
|
|
154
|
+
"permissionDecision": "deny",
|
|
155
|
+
"permissionDecisionReason": "Plan not yet written; edits to project code are gated."
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`hookSpecificOutput` requires `hookEventName`. [E5]
|
|
161
|
+
|
|
162
|
+
## Verify the harness engaged (E6)
|
|
163
|
+
|
|
164
|
+
A hook that is configured is not a hook that ran. Verify engagement before relying on a hook
|
|
165
|
+
to hold a behavior. [E6]
|
|
166
|
+
|
|
167
|
+
The known failure: in background sessions the session-id environment variable can be unset, so
|
|
168
|
+
hooks that resolve their state through the session (Plastic gates and savepoints resolve a
|
|
169
|
+
per-session bridge) silently no-op. The work proceeds ungated and nothing reports it. [E6]
|
|
170
|
+
This claim is grounded mainly in Plastic's own operation rather than independent reports; treat
|
|
171
|
+
it as Plastic-specific until confirmed elsewhere (LOW-EVIDENCE per E6).
|
|
172
|
+
|
|
173
|
+
Verify by observation, not assumption: [E6]
|
|
174
|
+
|
|
175
|
+
- Trigger the event and confirm the side effect (the gate blocked, the savepoint file appeared,
|
|
176
|
+
the boot context showed). Absence of an error is not proof the hook ran.
|
|
177
|
+
- Check the session-id environment variable is set in the context where the hook must fire;
|
|
178
|
+
if it is unset, session-scoped hooks no-op.
|
|
179
|
+
- For a gate, attempt the action the gate should block and confirm it is refused. A gate that
|
|
180
|
+
never refuses in testing is a gate that is not engaged.
|
|
181
|
+
|
|
182
|
+
## Token levers: global hooks that shrink context (E7)
|
|
183
|
+
|
|
184
|
+
Progressive disclosure trims what a skill loads. Two GLOBAL hooks trim what tool traffic
|
|
185
|
+
costs at runtime, independent of any skill body. Both are token-reduction levers. Reach for
|
|
186
|
+
them when prompts or tool output blow the context budget. [E7]
|
|
187
|
+
|
|
188
|
+
- PostToolUse output preprocessing. Register a GLOBAL PostToolUse hook that trims noisy tool
|
|
189
|
+
output before it enters context: collapse repeated lines, cut a thousand-line log to its
|
|
190
|
+
head and tail, strip ANSI control codes, drop progress chatter. The model never sees the
|
|
191
|
+
noise, so it never pays tokens for it. Scope the hook with a matcher over the loud tools
|
|
192
|
+
(for example `Bash`), keep it lossless on signal (trim volume, never the line that carries
|
|
193
|
+
the answer), and make it no-op by default per E4. This is one GLOBAL hook, not a per-skill
|
|
194
|
+
or frontmatter hook. [E7]
|
|
195
|
+
- Programmatic Tool Calling. When a tool runs in a loop and only the final result matters,
|
|
196
|
+
keep the intermediate results in code and return just the answer, instead of letting every
|
|
197
|
+
call land in context. Reach for it when a skill drives a tool in a loop and the per-call
|
|
198
|
+
output is throwaway. Pointer only: this is a Claude Code runtime feature, not a hook you
|
|
199
|
+
author here. [E7]
|
|
200
|
+
|
|
201
|
+
The first lever trims output already produced; the second avoids producing the context at
|
|
202
|
+
all. Pair either with sub-agent isolation (see `agents.md`) when a whole noisy sub-task can
|
|
203
|
+
run off to the side and return only its conclusion. [E7]
|
|
204
|
+
|
|
205
|
+
Both levers cut the CONTEXT axis (the input the model reads). The model's own OUTPUT tokens
|
|
206
|
+
(what it writes) are a separate axis with no hook: cut them with terse instructions, tool
|
|
207
|
+
responses that offer a concise mode, and sub-agent offloading that returns a short summary
|
|
208
|
+
instead of the full trace. [E7]
|
|
209
|
+
|
|
210
|
+
## Propose-only self-improving loop (E8)
|
|
211
|
+
|
|
212
|
+
A skill can learn from its own real runs without ever editing itself unattended. Reach for
|
|
213
|
+
this shape when a skill should improve from what actually happened in its runs. [E8]
|
|
214
|
+
|
|
215
|
+
Wire a GLOBAL Stop or SubagentStop hook that, once an effort threshold is met, reads the
|
|
216
|
+
just-finished transcript, drafts proposed edits to the skill, and stops. A human reviews the
|
|
217
|
+
proposal, approves it, and the approved change lands in git. The hook never writes the skill
|
|
218
|
+
directly. [E8]
|
|
219
|
+
|
|
220
|
+
The guardrails that make this safe: [E8]
|
|
221
|
+
|
|
222
|
+
- Propose only. The hook emits a diff or a suggestion, never an applied edit. Approval is a
|
|
223
|
+
human step, so a bad proposal costs a review, not a regression.
|
|
224
|
+
- Effort-gated. Run the analysis only past a threshold (a long enough transcript, a real
|
|
225
|
+
failure observed), so cheap runs spend nothing.
|
|
226
|
+
- Git-landed. The approved edit goes through the normal commit path, so every
|
|
227
|
+
self-improvement is reviewable and revertible.
|
|
228
|
+
- Global, not scoped. This is one GLOBAL Stop or SubagentStop hook, not a per-skill
|
|
229
|
+
frontmatter hook.
|
|
230
|
+
|
|
231
|
+
Pointer only. The real self-improving skill is the future `improving-skills` skill; this
|
|
232
|
+
section records the safe shape so a skill author knows the loop exists and keeps it
|
|
233
|
+
propose-only. [E8]
|
|
234
|
+
|
|
235
|
+
## Authoring checklist
|
|
236
|
+
|
|
237
|
+
- [ ] Behavior must hold deterministically; a stronger skill description was tried first (E1).
|
|
238
|
+
- [ ] Event chosen for its inputs and blocking power; matcher scopes it; handler is a script
|
|
239
|
+
unless another handler type is required (E2).
|
|
240
|
+
- [ ] Script referenced through `${CLAUDE_PLUGIN_ROOT}` or `${CLAUDE_PROJECT_DIR}`, has a
|
|
241
|
+
shebang, and is `chmod +x` (E3).
|
|
242
|
+
- [ ] No-op by default; the opt-in check runs before any side effect; exits 0 when not enabled
|
|
243
|
+
(E4).
|
|
244
|
+
- [ ] Exit codes deliberate: 0 to allow or inject context, 2 to block with the reason on
|
|
245
|
+
stderr; PreToolUse uses `hookSpecificOutput.permissionDecision`, not top-level `decision`
|
|
246
|
+
(E5).
|
|
247
|
+
- [ ] Engagement verified by triggering the event and observing the side effect, including the
|
|
248
|
+
unset-session-id no-op case (E6).
|