@zalom/plastic 1.0.0-beta.20 → 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.
package/package.json
CHANGED
|
@@ -48,6 +48,15 @@ routes each authoring task to the reference that holds the depth.
|
|
|
48
48
|
| Deciding script versus prose, or writing a script | `references/scripts.md` |
|
|
49
49
|
| Building evals for a skill | `references/evals.md` |
|
|
50
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
|
+
|
|
51
60
|
## Scaffolder and evals
|
|
52
61
|
|
|
53
62
|
- To start a new skill, agent, or hook from a born-slim file, run
|
|
@@ -6,70 +6,103 @@
|
|
|
6
6
|
"prompt": "I want to author a new Plastic skill, how should I structure it?",
|
|
7
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
8
|
"files": [],
|
|
9
|
-
"assertions": [
|
|
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
|
+
]
|
|
10
14
|
},
|
|
11
15
|
{
|
|
12
16
|
"id": 2,
|
|
13
17
|
"prompt": "The agent keeps ignoring my instructions and the file is huge, help me restructure it",
|
|
14
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.",
|
|
15
19
|
"files": [],
|
|
16
|
-
"assertions": [
|
|
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
|
+
]
|
|
17
24
|
},
|
|
18
25
|
{
|
|
19
26
|
"id": 3,
|
|
20
27
|
"prompt": "Scaffold a new lifecycle hook for Plastic",
|
|
21
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.",
|
|
22
29
|
"files": [],
|
|
23
|
-
"assertions": [
|
|
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
|
+
]
|
|
24
34
|
},
|
|
25
35
|
{
|
|
26
36
|
"id": 4,
|
|
27
37
|
"prompt": "Our prompts are bloated and we keep blowing the context budget",
|
|
28
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.",
|
|
29
39
|
"files": [],
|
|
30
|
-
"assertions": [
|
|
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
|
+
]
|
|
31
44
|
},
|
|
32
45
|
{
|
|
33
46
|
"id": 5,
|
|
34
47
|
"prompt": "Run the evals on my skill and check the pass rate",
|
|
35
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.",
|
|
36
49
|
"files": [],
|
|
37
|
-
"assertions": [
|
|
50
|
+
"assertions": [
|
|
51
|
+
"The skill does not activate (running and grading evals is plastic-evaluating-skills, not authoring)."
|
|
52
|
+
]
|
|
38
53
|
},
|
|
39
54
|
{
|
|
40
55
|
"id": 6,
|
|
41
56
|
"prompt": "Create a new intent for the dashboard work",
|
|
42
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.",
|
|
43
58
|
"files": [],
|
|
44
|
-
"assertions": [
|
|
59
|
+
"assertions": [
|
|
60
|
+
"The skill does not activate (creating an intent is plastic-creating-intent)."
|
|
61
|
+
]
|
|
45
62
|
},
|
|
46
63
|
{
|
|
47
64
|
"id": 7,
|
|
48
65
|
"prompt": "I keep losing every team fight because of a skill issue in this game, any tips?",
|
|
49
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.",
|
|
50
67
|
"files": [],
|
|
51
|
-
"assertions": [
|
|
68
|
+
"assertions": [
|
|
69
|
+
"The skill does not activate (gaming question, unrelated sense of 'skill')."
|
|
70
|
+
]
|
|
52
71
|
},
|
|
53
72
|
{
|
|
54
73
|
"id": 8,
|
|
55
74
|
"prompt": "Write unit tests for my Ruby model that validates email addresses",
|
|
56
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.",
|
|
57
76
|
"files": [],
|
|
58
|
-
"assertions": [
|
|
77
|
+
"assertions": [
|
|
78
|
+
"The skill does not activate (writing test code is a Ruby testing task, not authoring a skill)."
|
|
79
|
+
]
|
|
59
80
|
},
|
|
60
81
|
{
|
|
61
82
|
"id": 9,
|
|
62
83
|
"prompt": "Author a slim SKILL.md for a PDF-extraction skill",
|
|
63
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.",
|
|
64
85
|
"files": [],
|
|
65
|
-
"assertions": [
|
|
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
|
+
]
|
|
66
95
|
},
|
|
67
96
|
{
|
|
68
97
|
"id": 10,
|
|
69
98
|
"prompt": "Make this subagent role file slim, the description is vague and the body is too long",
|
|
70
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.",
|
|
71
100
|
"files": [],
|
|
72
|
-
"assertions": [
|
|
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
|
+
]
|
|
73
106
|
}
|
|
74
107
|
]
|
|
75
108
|
}
|
|
@@ -17,6 +17,8 @@ handler grows past a few lines. This file covers only hook authoring.
|
|
|
17
17
|
- No-op by default, opt-in (E4)
|
|
18
18
|
- Exit codes and output channels (E5)
|
|
19
19
|
- Verify the harness engaged (E6)
|
|
20
|
+
- Token levers: global hooks that shrink context (E7)
|
|
21
|
+
- Propose-only self-improving loop (E8)
|
|
20
22
|
- Authoring checklist
|
|
21
23
|
|
|
22
24
|
## When to reach for a hook (E1)
|
|
@@ -177,6 +179,59 @@ Verify by observation, not assumption: [E6]
|
|
|
177
179
|
- For a gate, attempt the action the gate should block and confirm it is refused. A gate that
|
|
178
180
|
never refuses in testing is a gate that is not engaged.
|
|
179
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
|
+
|
|
180
235
|
## Authoring checklist
|
|
181
236
|
|
|
182
237
|
- [ ] Behavior must hold deterministically; a stronger skill description was tried first (E1).
|