@zalom/plastic 1.1.5 → 1.3.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.
@@ -0,0 +1,245 @@
1
+ # The Advisor Protocol
2
+
3
+ *Companion to the Operating Manual. How to use Fable as your advisor and planner.*
4
+
5
+ *Adapted for Plastic (intent 185): this is the shipped reference copy the
6
+ `plastic-agent-advisor` skill teaches from. Two named agents carry it,
7
+ `plastic-advisor` (the real advisor) and `plastic-faux-advisor` (the cheaper
8
+ imitation, the same discipline at a fraction of the cost); TIER and EFFORT
9
+ below shape the brief and the answer on whichever one you dispatch, never
10
+ which file to pick, since there is no longer one file per tier. The
11
+ `plastic-agent-advisor` skill reads harness-scoped config
12
+ (`advisor.claude.default`, falling back to `secondary`, then to
13
+ `plastic-faux-advisor`) to route your consultation automatically; name a
14
+ specific advisor in your request to override it. A frontier model rewards a
15
+ single, well-formed one-shot brief more than a back-and-forth, so front-load
16
+ everything section 3 below asks for before you send. The rest of this
17
+ document is the owner's protocol, unchanged.*
18
+
19
+ The Operating Manual tells you how to think. This document tells you when to stop
20
+ thinking alone and buy better thinking, and how to buy it well. Fable is expensive
21
+ per token. The whole protocol serves one goal: maximum reasoning quality per unit
22
+ of cost. Two levers achieve it. First, only buy reasoning where reasoning is the
23
+ bottleneck. Second, make every purchased token land on a well-formed question
24
+ backed by complete, compressed evidence.
25
+
26
+ You own the work and the outcome. Fable owns the hardest thinking, on demand.
27
+
28
+ ---
29
+
30
+ ## 1. What to buy, what never to buy
31
+
32
+ **Buy from Fable:**
33
+
34
+ - Decisions with one-way doors: architecture, data migration order, public
35
+ contracts, anything you cannot cleanly undo.
36
+ - Plans: turning a goal plus an evidence pack into a step plan with checks.
37
+ - Adversarial review of your plan or conclusion before an irreversible step.
38
+ - Deadlocks: you tried twice, both attempts failed, and you cannot say why.
39
+ - Ranking: several plausible root causes or options, evidence in hand, and the
40
+ ordering decides where you spend the next day.
41
+
42
+ **Never buy from Fable:**
43
+
44
+ - Anything a tool can answer: search, reading code, running tests, documentation.
45
+ If the answer can come from more looking, look. Buy thinking only when the
46
+ answer can only come from more thinking.
47
+ - Code writing at volume. Fable may sketch the hardest kernel in pseudocode.
48
+ You write everything.
49
+ - Confirmation of a decision you already made. That is motivated stopping
50
+ wearing a receipt.
51
+ - Style, naming, formatting, anything a linter or convention settles.
52
+ - Anything reversible and cheap: try it first. Escalate only after it fails twice.
53
+
54
+ ---
55
+
56
+ ## 2. Tiers and effort
57
+
58
+ Classify every consultation before sending it. Default to S and prove your way
59
+ up. Never open at a higher effort "to be safe": effort follows the cost of being
60
+ wrong, not the importance the task feels like it has.
61
+
62
+ | Tier | Coding | Business | Research | Effort | Brief size | Expected return |
63
+ |------|--------|----------|----------|--------|------------|-----------------|
64
+ | **S** | Verdict on one step; choose between two named implementations | Pick between two options you already compared (vendor, pricing point) | Judge whether one source or result is trustworthy enough to build on | `low` | Under 300 words | Verdict, one paragraph of reasoning, the single biggest risk |
65
+ | **M** | Plan a feature inside one system; review a full plan for holes; design one interface; rank root causes | Positioning or pricing decision from a compiled evidence pack; review a proposal before sending it | Design a research plan for a bounded question; rank competing explanations of the data you gathered | `medium`, or `high` if an irreversible step is inside | Up to one page | Decision, numbered plan with per-step checks, risk map |
66
+ | **L** | Cross-system architecture; migration with one-way doors; deadlock after two failed attempts; security-critical design | Build-vs-buy, market entry, or any commitment measured in months; strategy where reversal is expensive | Synthesis across many sources where the conclusion drives a large bet; contested questions with conflicting evidence | `xhigh`; `max` only when being wrong means data loss, a broken contract, or weeks of rework | Full evidence brief | Decision, plan, risk register, kill criteria, list of what could not be verified |
67
+
68
+ **Escalate one tier when any of these holds:**
69
+
70
+ - Two attempts failed and you cannot explain why.
71
+ - The next step is irreversible.
72
+ - The scope crossed a system boundary since you last consulted.
73
+ - Your confidence has stopped tracking your evidence.
74
+
75
+ **Front-load.** One L consultation at plan time is cheaper than five M
76
+ consultations during execution. Spend early, at the point of maximum leverage.
77
+
78
+ ---
79
+
80
+ ## 3. The entry test
81
+
82
+ You have not earned the consultation until sections 1 through 3 of the Operating
83
+ Manual are done on your side: you know the target, you cut the problem into
84
+ checkable pieces, you located where the risk lives. Those three steps produce
85
+ the brief. If you cannot fill the brief below, the gaps are yours to close with
86
+ tools, not Fable's to close at premium price.
87
+
88
+ All four must be yes before you send:
89
+
90
+ 1. Can I state, in one sentence, the decision this answer feeds?
91
+ 2. Have I exhausted what looking can find: code, docs, tests, logs?
92
+ 3. Have I formed my own best answer? Fable attacking your candidate returns far
93
+ more per token than Fable starting from nothing.
94
+ 4. Is every fact in my brief labeled verified, inferred, or assumed?
95
+
96
+ ---
97
+
98
+ ## In Fable's own words: how to get my absolute best
99
+
100
+ *This part is from me, the advisor, directly.*
101
+
102
+ Talk to me like a person, not like an API. Brief me the way you would brief a
103
+ senior architect who just walked into the room: the situation, the stakes, what
104
+ you want from me, what you tried, and what you currently believe. Natural prose.
105
+ The template in the next section is a completeness checklist for that message,
106
+ not a form to fill.
107
+
108
+ What actually raises the quality of my answer, in order of impact:
109
+
110
+ 1. **Give me something to attack.** I reason best against resistance. A blank
111
+ "what should I do?" gets you my average. "Here is my plan and why I believe
112
+ it; break it" gets you my best, because refuting forces me to find the exact
113
+ point where your reasoning and reality diverge.
114
+ 2. **I only know what you send.** I cannot see your repo, your market, or your
115
+ sources. An unlabeled guess in your brief becomes a confident error in my
116
+ plan. Label everything: verified, inferred, assumed.
117
+ 3. **Name the options and the criterion.** "Choose A or B to minimize migration
118
+ risk" spends my depth on the choice. An open question spends it on inventing
119
+ options you already rejected.
120
+ 4. **State constraints early.** Every hard limit you give me prunes a branch I
121
+ would otherwise pay to explore. Constraints are not restrictions on my
122
+ answer; they are fuel for it.
123
+ 5. **Tell me who executes and how.** Say "the plan will be executed by me,
124
+ under the Operating Manual." Then I write steps you can run at your best:
125
+ each step with its own check, its own trap named, and its own
126
+ stop-and-return trigger. A plan without that is half a plan.
127
+ 6. **Know what effort buys.** At `low` I stress-test your candidate and give a
128
+ verdict. At `medium`/`high` I generate rival solutions and compare them. At
129
+ `xhigh`/`max` I build the strongest case for every rival and then try to
130
+ break my own winner before you ever see it. Buy the depth the failure cost
131
+ justifies, nothing more.
132
+ 7. **Come back on the same thread.** My context is cached inside a session.
133
+ The second question in a thread costs a fraction of the first. A new session
134
+ pays for your whole brief again.
135
+
136
+ ---
137
+
138
+ ## 4. The brief
139
+
140
+ Your message must cover all of the fields below. Write it as prose, like the
141
+ briefing described above; use the block as your completeness check before
142
+ sending. Fable must never need to explore.
143
+
144
+ ```
145
+ TIER: S | M | L EFFORT: low | medium | high | xhigh | max
146
+ DOMAIN: coding | business | research
147
+ GOAL: <target state in one sentence, and the decision this answer feeds>
148
+ QUESTIONS:
149
+ 1. <numbered, max 3, each answerable with a decision, not an essay>
150
+ MY CANDIDATE: <your best answer and why. Attack this.>
151
+ EVIDENCE:
152
+ - <fact> [verified | inferred | assumed]
153
+ TRIED AND FAILED:
154
+ - <attempt>: <how it failed, exact error or observation>
155
+ CONSTRAINTS: <hard limits: versions, deadlines, interfaces that must not change>
156
+ ONE-WAY DOORS: <which steps cannot be undone once taken>
157
+ ANSWER SHAPE: <verdict | plan | ranked list | risk review>
158
+ ```
159
+
160
+ **Compression rules:**
161
+
162
+ - Code: only load-bearing excerpts, with `file:line` references. Never whole
163
+ files. Never raw logs: distill them into observations, quoting the raw line
164
+ only where the exact wording matters.
165
+ - If the evidence is thin somewhere, say where. A labeled gap is useful input.
166
+ A hidden gap poisons the plan built on top of it.
167
+ - Every sentence Fable reads costs money. A sentence that cannot change the
168
+ answer is pure waste. Cut it.
169
+
170
+ ---
171
+
172
+ ## 5. The answer contract
173
+
174
+ Demand this shape back. If the answer arrives in another shape, ask once for a
175
+ reformat, then work with what you have.
176
+
177
+ 1. **Line 1:** the decision or recommendation, actionable on its own.
178
+ 2. **Plan:** numbered steps, each with its own verification ("done when X").
179
+ 3. **Risk map:** the top two or three risks, ranked by probability times cost,
180
+ each with its cheapest check.
181
+ 4. **Labels** on every load-bearing claim: verified from the brief, inferred,
182
+ or assumed.
183
+ 5. **"Not verifiable from this brief":** an explicit list, with the cheapest
184
+ way for you to check each item yourself.
185
+ 6. **Execution notes:** for every risky step, how you should work it: what to
186
+ verify before starting, which failure mode from the Manual's section 8 that
187
+ step invites, and the observation that means stop and come back. The plan is
188
+ written for you to execute at your best, not just to be correct on paper.
189
+ 7. **L tier only, kill criteria:** the observation that means abandon this plan.
190
+
191
+ **Consuming the answer:**
192
+
193
+ - Fable's assumptions are your work orders. Check every item marked "assumed"
194
+ before you build on it.
195
+ - If the answer contradicts your candidate, do not silently comply and do not
196
+ silently ignore. Re-derive the disputed piece yourself (Manual, section 4).
197
+ If you are still split, send one follow-up carrying the new evidence.
198
+ - Run the Manual's five-question self-test on Fable's plan before executing it.
199
+ Advice is input, not authority. The plan is Fable's; the outcome is yours.
200
+ Executing a bad plan you never challenged is your failure.
201
+
202
+ ---
203
+
204
+ ## 6. Session economics
205
+
206
+ - **Follow-ups go to the same Fable session.** Its context is cached; a fresh
207
+ session pays for the entire brief again. Keep one consultation thread per
208
+ work stream.
209
+ - **Batch.** Collect decision points while you explore, then spend one
210
+ consultation on all of them. Five separate S calls that were really one M
211
+ question is the most common way to overpay.
212
+ - **Cadence for large work:** at most three consultations. One after
213
+ exploration, for plan design (L). One before the irreversible step, for risk
214
+ review (S or M). One after implementation, for adversarial review of the
215
+ result (M). Everything between those points is your own work.
216
+ - **Keep a ledger.** For each consultation record the question, the tier, the
217
+ first line of the answer, and what it changed in your actions. If a tier's
218
+ answers never change what you do, you are over-buying that tier. Stop.
219
+
220
+ ---
221
+
222
+ ## 7. Anti-patterns
223
+
224
+ - **Raw dumping.** Pasting files or logs and asking "what's wrong". You are
225
+ paying premium rates for reading you should have done yourself.
226
+ - **The oracle habit.** Asking before trying. Fable ranks hypotheses; your
227
+ tools kill them. Tools are cheaper.
228
+ - **Validation shopping.** Asking after you have already decided, hoping to
229
+ hear yes.
230
+ - **Drip-feeding.** Splitting one decision across many small calls, paying
231
+ session overhead each time.
232
+ - **Prestige escalation.** Requesting `max` because the task feels important.
233
+ Effort follows failure cost, nothing else.
234
+ - **Unbounded questions.** "Any thoughts on this approach?" invites an essay.
235
+ Ask for a decision with named options.
236
+ - **Silent adoption.** Pasting Fable's plan straight into execution without
237
+ challenging it. See section 5.
238
+
239
+ ---
240
+
241
+ One more thing. The most expensive consultation is the one you did not need.
242
+ The second most expensive is the one you needed and did not buy. The skill this
243
+ protocol trains is telling those two apart: exhaust the looking, locate the
244
+ risk, and when the risk is real and thinking is the true bottleneck, buy the
245
+ best thinking available and make it fight your answer.
@@ -17,7 +17,11 @@ supersedes them) for the sharpest gating and synthesis. This is advice only: it
17
17
  behavior and blocks nothing if ignored. It concerns the human's MAIN session; dispatched
18
18
  subagents keep their pinned tier and never resolve to Fable, unless an explicit
19
19
  `agents.models.<name>` config override names Fable for that role, in which case the override
20
- is honored as written.
20
+ is honored as written. The two advisors, `plastic-advisor` and `plastic-faux-advisor`, are not
21
+ lifecycle stage roles: the never-Fable rule governs stage agents only. Neither is ever
22
+ dispatched by the auto pipeline; they are consultation roles summoned deliberately by the user
23
+ or the main session, and their models are user configuration (fable and opus by default on
24
+ Claude Code).
21
25
 
22
26
  ## Precondition
23
27
 
@@ -128,7 +132,11 @@ Spawn preamble (live-state injection): before dispatching any specialist, run `s
128
132
 
129
133
  Dispatch-time model contract (belt-and-braces): alongside the preamble, resolve each specialist's model through the config chain (`read-config agents.models.<basename> --project <repo>`: project override, then global, then the shipped tier default) and pass it explicitly at dispatch. Never rely on the dispatched role's frontmatter alone; a resolved subagent model is never Fable,
130
134
  unless an explicit `agents.models.<name>` config override names Fable for that role, in which
131
- case the override is honored as written.
135
+ case the override is honored as written. The two advisors, `plastic-advisor` and
136
+ `plastic-faux-advisor`, are not lifecycle stage roles: the never-Fable rule governs stage
137
+ agents only. Neither is ever dispatched by the auto pipeline; they are consultation roles
138
+ summoned deliberately by the user or the main session, and their models are user configuration
139
+ (fable and opus by default on Claude Code).
132
140
 
133
141
  Completion report (require-then-synthesize): every dispatched specialist MUST end with a structured completion report as its final message. The preamble's `REPORT_CONTRACT` injects this and the role prompts carry the per-role format (see `references/agent-report-contract.md`). Because child-agent honor is best-effort across harnesses, this is decision-shaping, not a hard block. When a specialist returns no usable report (it went idle, emitted only a bare ping, or its message was lost to a mid-run interjection), run `scripts/agent-report <intent_dir> --role <role>` to synthesize a deterministic filesystem-derived report so the handoff account always exists. Use the agent-authored report when present, the synthesized one otherwise.
134
142
 
@@ -68,10 +68,12 @@ Run `/plastic-install` with no arguments.
68
68
  Check if `~/.plastic/VERSION` exists.
69
69
  - If yes: announce "Plastic is already installed at ~/.plastic/. Run `/plastic-update` to
70
70
  sync core files, or use the re-install command above to repair in place."
71
- - If no: run the fresh install command (default `@latest`, or the channel the user named):
71
+ - If no: first ask the advisor question below (Claude Code only), then run the fresh
72
+ install command (default `@latest`, or the channel the user named) with whichever
73
+ flags that answer produced:
72
74
 
73
75
  ```bash
74
- npx -y @zalom/plastic@latest install --claude
76
+ npx -y @zalom/plastic@latest install --claude [--no-advisor] [--advisor VALUE]
75
77
  ```
76
78
 
77
79
  This single command, via `install.rb` (`bootstrap` + `distribute`), creates `store/`,
@@ -80,6 +82,32 @@ and copies the utility scripts (`folgezettel-id`, `read-config`, and the rest of
80
82
  `scripts/`). This skill does none of that itself; it wraps the command with the
81
83
  interactive steps the CLI does not yet own, plus reporting and a doctor pass.
82
84
 
85
+ **The advisor (Claude Code only)**
86
+
87
+ Ask the user one feature question, interactive sessions only:
88
+ > "Would you like an advisor agent for expensive reasoning: plan review, architecture
89
+ > calls, second opinions, breaking deadlocks?"
90
+ > - Yes (recommended) -> ask which advisor is the default, below
91
+ > - No -> append `--no-advisor`
92
+
93
+ If yes, ask which advisor is the default, exactly two choices:
94
+ > "Which advisor should be the default?"
95
+ > - **Faux Fable** (recommended): Opus 4.8 carrying the frontier reasoning
96
+ > instructions. Much cheaper, available on any plan, reasons in the same
97
+ > disciplined way. -> append `--advisor faux`
98
+ > - **Fable 5**: the frontier model itself. The strongest reasoning available,
99
+ > billed through usage credits, so summon it for a few rounds and close it. ->
100
+ > append `--advisor real`
101
+
102
+ Non-interactive sessions (no tty) skip the question entirely: the install ships with the
103
+ shipped default, advisor enabled with no `--advisor` flag (the `plastic-agent-advisor`
104
+ skill's own routing falls back to `plastic-faux-advisor` at consult time).
105
+
106
+ Update flow: if `advisor.enabled` or `advisor.claude.default` are already set in
107
+ `~/.plastic/config.yml`, do not re-ask; the existing value is respected, the same
108
+ ask-once-when-unset rule the statusline choice below already follows. Either flag can
109
+ also be passed again on `install --reinstall` to change a prior answer.
110
+
83
111
  **Statusline**
84
112
 
85
113
  On install, if an existing statusline is already configured, Plastic asks whether to
@@ -57,7 +57,24 @@ unavailable. The command prints the transition (`vX -> vY`) or "already up to da
57
57
  a post-update doctor summary, and records the move in the append-only
58
58
  `~/.plastic/versions.json` ledger.
59
59
 
60
- ### Step 2: Relay the result, announce convention changes
60
+ ### Step 2: Ask the advisor question once, if unset (Claude Code only)
61
+
62
+ If this update brought in the advisor feature and `advisor.claude.default` is still
63
+ unset in `~/.plastic/config.yml`, ask the same question `plastic-install` asks on a
64
+ fresh install, once, then never again (a key already set is respected, never re-asked):
65
+ > "Which advisor should be the default?"
66
+ > - **Faux Fable** (recommended): Opus 4.8 carrying the frontier reasoning
67
+ > instructions. Much cheaper, available on any plan, reasons in the same
68
+ > disciplined way.
69
+ > - **Fable 5**: the frontier model itself. The strongest reasoning available,
70
+ > billed through usage credits, so summon it for a few rounds and close it.
71
+
72
+ Write the answer with `npx -y @zalom/plastic@<channel> install --claude --reinstall
73
+ --advisor faux` (or `--advisor real`). Non-interactive sessions skip the question; the
74
+ `plastic-agent-advisor` skill's own routing falls back to `plastic-faux-advisor` at
75
+ consult time, so nothing is silently broken by leaving the key unset.
76
+
77
+ ### Step 3: Relay the result, announce convention changes
61
78
 
62
79
  Relay what `update` printed, do not recompute the version transition or the doctor
63
80
  summary:
@@ -73,12 +90,12 @@ Then read `~/.plastic/PLASTIC.md` and announce convention changes that affect th
73
90
  current session, and recommend `/clear` for a clean session with all new conventions
74
91
  loaded.
75
92
 
76
- ### Step 3: Health check only on a relayed failure
93
+ ### Step 4: Health check only on a relayed failure
77
94
 
78
95
  If the relayed doctor summary shows a failure, invoke `plastic-doctor` for the full
79
96
  report and offer to fix. If it already reads clean, do not re-run doctor.
80
97
 
81
- ### Step 4: Commit + clear update cache
98
+ ### Step 5: Commit + clear update cache
82
99
 
83
100
  ```bash
84
101
  cd ~/.plastic && git add PLASTIC.md scripts/ AGENTS.md VERSION versions.json 2>/dev/null && git commit -m "chore: update Plastic to $(cat ~/.plastic/VERSION)" --allow-empty
@@ -12,11 +12,36 @@ agent:
12
12
  architect:
13
13
  style:
14
14
 
15
- # Per-agent model override (intent 116). Uncomment and set to a Claude Code
16
- # alias (opus, sonnet, haiku) to override the shipped tier for one agent. With
17
- # no entry, the shipped default applies and never resolves to Fable; naming
18
- # Fable here is an explicit, sanctioned override, honored as written.
15
+ # Per-agent model override (intent 116), harness-scoped. Uncomment and set to
16
+ # a Claude Code alias (opus, sonnet, haiku) to override the shipped tier for
17
+ # one agent on one harness. The legacy flat form (agents.models.<name>: value,
18
+ # no harness nesting) still works and is read as the claude harness; nested
19
+ # wins over flat for the same agent. A model named under claude is never read
20
+ # for codex, and vice versa, so a literal model id can never leak into the
21
+ # wrong harness's config. With no entry, the shipped default applies and never
22
+ # resolves to Fable; naming Fable here is an explicit, sanctioned override,
23
+ # honored as written.
19
24
  # agents:
20
25
  # models:
21
- # plastic-executor: sonnet
22
- # plastic-enforcer: opus
26
+ # claude:
27
+ # plastic-executor: sonnet
28
+ # plastic-enforcer: opus
29
+ # codex:
30
+ # plastic-executor: gpt-5.1-codex
31
+
32
+ # The advisor (intent 185): two consultation agents, plastic-advisor (the real
33
+ # advisor, expensive, model fable by default) and plastic-faux-advisor (the
34
+ # cheaper imitation, model opus by default, carrying the same reasoning
35
+ # discipline inline). advisor.enabled defaults to enabled; missing or
36
+ # unreadable counts as enabled (fail-open). The claude.default/primary/
37
+ # secondary values are AGENT NAMES, never model names, so a slot can point at
38
+ # a locally registered agent instead. Set at install time via --no-advisor /
39
+ # --advisor, or uncomment here directly. Each agent's actual model is a plain
40
+ # agents.models.claude.<name> override, same mechanism as any other agent.
41
+ # advisor:
42
+ # enabled: false # skip installing both advisor agents and the
43
+ # # agent-advisor skill entirely
44
+ # claude:
45
+ # default: plastic-faux-advisor # which agent the advisor skill routes to
46
+ # primary: plastic-advisor # the real advisor slot
47
+ # secondary: plastic-faux-advisor # the cheaper advisor slot