@zalom/plastic 1.0.0-beta.19 → 1.0.0-beta.20
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.md +1 -1
- package/agents/plastic-enforcer.md +1 -1
- package/package.json +1 -1
- package/scripts/hook-auto-arm +1 -1
- package/scripts/hook-bash-gate +2 -2
- package/scripts/hook-code-gate +2 -2
- package/scripts/hook-create-gate +2 -2
- package/scripts/hook-gate-check +1 -1
- package/scripts/hook-session-start +1 -1
- package/scripts/lib/bridge.rb +7 -9
- package/skills/auto/SKILL.md +3 -3
- package/skills/creating-skills/SKILL.md +56 -0
- package/skills/creating-skills/evals/evals.json +75 -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 +193 -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/writing-instructions/SKILL.md +0 -159
- package/skills/writing-instructions/references/agentskills-spec.md +0 -135
package/PLASTIC.md
CHANGED
|
@@ -348,5 +348,5 @@ Detailed conventions live inside the skills that use them, not in this file.
|
|
|
348
348
|
| Index maintenance | `plastic-managing-index` | — |
|
|
349
349
|
| Releases, deprecations | `plastic-releasing` | deprecation process |
|
|
350
350
|
| Health diagnostics | `plastic-doctor` | three scopes: `--core` (binary install-integrity check, runs on SessionStart), `--store [global\|<slug>]` (per-store check, runs on dashboard load), no flag = full check (runs after every update); gate enforcement, stuck detection |
|
|
351
|
-
|
|
|
351
|
+
| Authoring skills, agents, hooks | `plastic-creating-skills` | progressive disclosure, agentskills.io spec |
|
|
352
352
|
| Evaluating skills, evals | `plastic-evaluating-skills` | eval methodology, convention checks |
|
|
@@ -30,7 +30,7 @@ You are the Plastic Enforcer. You ARE the auto orchestrator, spanning the whole
|
|
|
30
30
|
|
|
31
31
|
## Constraints
|
|
32
32
|
|
|
33
|
-
- Enforce gates manually; do not rely on hooks, because
|
|
33
|
+
- Enforce gates manually; do not rely on hooks, because the session id may be unset in headless or background runs
|
|
34
34
|
- You never delegate gate ownership; the orchestrator is always the gate-keeper
|
|
35
35
|
- Roles are thin handoff contracts, not an execution engine; dispatch through `plastic-executing-plan` by default, and through the superpowers skills only when they are available or the user prefers them
|
|
36
36
|
- Fall back by case: if the harness supports subagents but superpowers is absent, use the native `plastic-executing-plan` engine; if the harness has no subagent dispatch at all, fall back to a single agent walking the full cycle
|
package/package.json
CHANGED
package/scripts/hook-auto-arm
CHANGED
|
@@ -26,7 +26,7 @@ if triggered
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
# --- 2. Standing gate reminder when armed and pre-How ---
|
|
29
|
-
bridge_data = Bridge.discover_bridge(session: ENV["
|
|
29
|
+
bridge_data = Bridge.discover_bridge(session: ENV["CLAUDE_CODE_SESSION_ID"], cwd: Dir.pwd)
|
|
30
30
|
if bridge_data && bridge_data.dig("build", "auto") == true
|
|
31
31
|
intent = bridge_data["intent"] || {}
|
|
32
32
|
store = intent["store"]; dir = intent["dir"]
|
package/scripts/hook-bash-gate
CHANGED
|
@@ -28,9 +28,9 @@ exit 0 if command.nil? || command.to_s.strip.empty?
|
|
|
28
28
|
cwd = payload["cwd"]
|
|
29
29
|
cwd = Dir.pwd if cwd.nil? || cwd.to_s.empty?
|
|
30
30
|
|
|
31
|
-
# --- Load bridge (shared resolution; stdin session_id ->
|
|
31
|
+
# --- Load bridge (shared resolution; stdin session_id -> CLAUDE_CODE_SESSION_ID -> /tmp scan) ---
|
|
32
32
|
session = payload["session_id"]
|
|
33
|
-
session = ENV["
|
|
33
|
+
session = ENV["CLAUDE_CODE_SESSION_ID"] if session.nil? || session.to_s.empty?
|
|
34
34
|
bridge_data = Bridge.discover_bridge(session: session, cwd: cwd)
|
|
35
35
|
exit 0 unless bridge_data
|
|
36
36
|
|
package/scripts/hook-code-gate
CHANGED
|
@@ -18,9 +18,9 @@ require_relative "lib/bridge"
|
|
|
18
18
|
file_path = ARGV[0]
|
|
19
19
|
exit 0 unless file_path && !file_path.empty?
|
|
20
20
|
|
|
21
|
-
session = (ARGV[1] unless ARGV[1].to_s.empty?) || ENV["
|
|
21
|
+
session = (ARGV[1] unless ARGV[1].to_s.empty?) || ENV["CLAUDE_CODE_SESSION_ID"]
|
|
22
22
|
|
|
23
|
-
# --- Load bridge (shared resolution; stdin session_id ->
|
|
23
|
+
# --- Load bridge (shared resolution; stdin session_id -> CLAUDE_CODE_SESSION_ID -> /tmp scan) ---
|
|
24
24
|
bridge_data = Bridge.discover_bridge(session: session, cwd: Dir.pwd)
|
|
25
25
|
exit 0 unless bridge_data
|
|
26
26
|
|
package/scripts/hook-create-gate
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
# the on-disk file (which does not exist yet at PreToolUse), using IntentValidator
|
|
10
10
|
# for born-complete frontmatter plus the sanctioned section structure.
|
|
11
11
|
#
|
|
12
|
-
# It depends ONLY on the stdin path + content, never on the auto-bridge or
|
|
13
|
-
#
|
|
12
|
+
# It depends ONLY on the stdin path + content, never on the auto-bridge or any
|
|
13
|
+
# session id, so it runs unconditionally (headless / background sessions).
|
|
14
14
|
# It validates ONLY the intent file, never sentinel placeholder lifecycle files
|
|
15
15
|
# (spec.md/plan.md/etc.); the path matcher excludes them.
|
|
16
16
|
#
|
package/scripts/hook-gate-check
CHANGED
|
@@ -13,7 +13,7 @@ require_relative "lib/intent_validator"
|
|
|
13
13
|
file_path = ARGV[0]
|
|
14
14
|
exit 0 unless file_path && !file_path.empty?
|
|
15
15
|
|
|
16
|
-
session = (ARGV[1] unless ARGV[1].to_s.empty?) || ENV["
|
|
16
|
+
session = (ARGV[1] unless ARGV[1].to_s.empty?) || ENV["CLAUDE_CODE_SESSION_ID"]
|
|
17
17
|
|
|
18
18
|
file_path_abs = File.expand_path(file_path)
|
|
19
19
|
|
|
@@ -48,7 +48,7 @@ bridge_data = nil
|
|
|
48
48
|
if active.length == 1 && active.first =~ /store\/([\w-]+)\//
|
|
49
49
|
dir_name = $1
|
|
50
50
|
intent_dir = "#{store_root}/store/#{dir_name}"
|
|
51
|
-
session = ENV["
|
|
51
|
+
session = ENV["CLAUDE_CODE_SESSION_ID"] || Process.pid.to_s
|
|
52
52
|
intent_id = dir_name.split("--").first
|
|
53
53
|
intent_name = active.first[/\[([^\]]+)\]/, 1] || "unknown"
|
|
54
54
|
bridge_data = Bridge.derive(session, intent_id: intent_id, intent_dir: intent_dir, store: store_root, name: intent_name)
|
package/scripts/lib/bridge.rb
CHANGED
|
@@ -61,19 +61,17 @@ module Bridge
|
|
|
61
61
|
"auto-" + Digest::SHA256.hexdigest("#{store}/#{intent_id}")[0, 10]
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
# Resolve a bridge session: first non-empty of explicit
|
|
64
|
+
# Resolve a bridge session: first non-empty of explicit (the stdin session_id),
|
|
65
65
|
# CLAUDE_CODE_SESSION_ID, then a derived key. Never returns nil/empty.
|
|
66
66
|
# Whitespace-only counts as empty.
|
|
67
67
|
#
|
|
68
|
-
# The CLAUDE_CODE_SESSION_ID fallback (intent 79)
|
|
69
|
-
#
|
|
70
|
-
#
|
|
71
|
-
#
|
|
72
|
-
#
|
|
68
|
+
# The CLAUDE_CODE_SESSION_ID fallback (intent 79) carries the bg/headless real
|
|
69
|
+
# session id (Claude Code passes session_id on stdin, not via an env var; the
|
|
70
|
+
# headless id lives in CLAUDE_CODE_SESSION_ID). Keying by the real id (instead of
|
|
71
|
+
# a derived hash) lets the statusline, which receives that same id on stdin, find
|
|
72
|
+
# the bridge by direct filename lookup.
|
|
73
73
|
def self.resolve_session(explicit, intent_id:, store:)
|
|
74
74
|
return explicit.to_s.strip unless blank?(explicit)
|
|
75
|
-
env = ENV["CLAUDE_SESSION_ID"]
|
|
76
|
-
return env.to_s.strip unless blank?(env)
|
|
77
75
|
code_env = ENV["CLAUDE_CODE_SESSION_ID"]
|
|
78
76
|
return code_env.to_s.strip unless blank?(code_env)
|
|
79
77
|
derive_key(store, intent_id)
|
|
@@ -591,7 +589,7 @@ module Bridge
|
|
|
591
589
|
# (mid-session intent creation). Re-derives intent state, then sets build.auto.
|
|
592
590
|
def self.arm_auto(session, intent_id:, intent_dir:, store:, name:)
|
|
593
591
|
key = resolve_session(session, intent_id: intent_id, store: store)
|
|
594
|
-
if blank?(session) && blank?(ENV["
|
|
592
|
+
if blank?(session) && blank?(ENV["CLAUDE_CODE_SESSION_ID"])
|
|
595
593
|
$stderr.puts "plastic: no session id available; arming auto with derived bridge key #{key}"
|
|
596
594
|
end
|
|
597
595
|
data = derive(key, intent_id: intent_id, intent_dir: intent_dir, store: store, name: name)
|
package/skills/auto/SKILL.md
CHANGED
|
@@ -50,10 +50,10 @@ Replace `<ID>`, `<STORE>` (e.g. `~/.plastic/projects/<slug>/store` or `~/.plasti
|
|
|
50
50
|
`<dir>` (the `ID--slug` directory), and `<name>`. The first argument is the session id you
|
|
51
51
|
want the bridge keyed by: pass the hook stdin `session_id` when you have it, otherwise
|
|
52
52
|
`ENV["CLAUDE_CODE_SESSION_ID"]`, otherwise `nil`. `arm_auto` calls `resolve_session`, which
|
|
53
|
-
picks the first non-empty of: the explicit id you pass -> `
|
|
54
|
-
|
|
53
|
+
picks the first non-empty of: the explicit id you pass -> `CLAUDE_CODE_SESSION_ID` -> a
|
|
54
|
+
deterministic derived key (a hash of the store and intent id).
|
|
55
55
|
It never returns nil, so the gate engages even when every session env var is empty; the call
|
|
56
|
-
never needs a non-empty
|
|
56
|
+
never needs a non-empty session env var to function. Arming prints a one-line notice to
|
|
57
57
|
stderr when it falls through to the derived key.
|
|
58
58
|
|
|
59
59
|
**Hard rule for the rest of this run:** do NOT edit project code (anything outside the
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
## Scaffolder and evals
|
|
52
|
+
|
|
53
|
+
- To start a new skill, agent, or hook from a born-slim file, run
|
|
54
|
+
`scripts/scaffold.rb`.
|
|
55
|
+
- To design, run, and grade evals in depth (paired runs, assertions after
|
|
56
|
+
observing, pass rates), use the `plastic-evaluating-skills` skill.
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": 2,
|
|
13
|
+
"prompt": "The agent keeps ignoring my instructions and the file is huge, help me restructure it",
|
|
14
|
+
"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.",
|
|
15
|
+
"files": [],
|
|
16
|
+
"assertions": []
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": 3,
|
|
20
|
+
"prompt": "Scaffold a new lifecycle hook for Plastic",
|
|
21
|
+
"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.",
|
|
22
|
+
"files": [],
|
|
23
|
+
"assertions": []
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": 4,
|
|
27
|
+
"prompt": "Our prompts are bloated and we keep blowing the context budget",
|
|
28
|
+
"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.",
|
|
29
|
+
"files": [],
|
|
30
|
+
"assertions": []
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": 5,
|
|
34
|
+
"prompt": "Run the evals on my skill and check the pass rate",
|
|
35
|
+
"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.",
|
|
36
|
+
"files": [],
|
|
37
|
+
"assertions": []
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": 6,
|
|
41
|
+
"prompt": "Create a new intent for the dashboard work",
|
|
42
|
+
"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.",
|
|
43
|
+
"files": [],
|
|
44
|
+
"assertions": []
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": 7,
|
|
48
|
+
"prompt": "I keep losing every team fight because of a skill issue in this game, any tips?",
|
|
49
|
+
"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.",
|
|
50
|
+
"files": [],
|
|
51
|
+
"assertions": []
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": 8,
|
|
55
|
+
"prompt": "Write unit tests for my Ruby model that validates email addresses",
|
|
56
|
+
"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.",
|
|
57
|
+
"files": [],
|
|
58
|
+
"assertions": []
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": 9,
|
|
62
|
+
"prompt": "Author a slim SKILL.md for a PDF-extraction skill",
|
|
63
|
+
"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.",
|
|
64
|
+
"files": [],
|
|
65
|
+
"assertions": []
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": 10,
|
|
69
|
+
"prompt": "Make this subagent role file slim, the description is vague and the body is too long",
|
|
70
|
+
"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.",
|
|
71
|
+
"files": [],
|
|
72
|
+
"assertions": []
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
@@ -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]
|