fix(advisor): allowed agents' lines are explicit allowances, locked

This commit is contained in:
bchanot committed 2026-11-20 11:42:36 +01:00
1 parent 6be066957c
commit b71db282f0
15 files changed
+141 -20

No files matched your search

+3 -3
View File
@@ -85,9 +85,9 @@ code" wins. Repo-specific instructions override both.
Fable, set by /advisor), at least at the points of
`~/.claude/lib/effort-shift.md` § Advisor; dispatched plan-challenger,
verifier, security-auditor, `analyzer` and an opus code review at most
once, before their verdict or report; other sub-agents never (an opus
brief says which; a SubagentStart hook restates it). Fable is never
routed or pinned: the router tops out at opus (BDR-150).
once, before their verdict or report; other sub-agents never (each opus
brief you write states its rule; a SubagentStart hook restates it). Fable
is never routed or pinned: the router tops out at opus (BDR-150).
- Ask rather than guess. A choice visible in the result (placement,
wording, order, behavior), a name that becomes public (command, flag,
endpoint, file), or a scope the request leaves open → ask, even mid-task;
+1 -1
View File
@@ -43,7 +43,7 @@ Produce a clear analysis without proposing solutions.
- No solutions
- Stay factual
- Do not modify files
- Advisor, when dispatched as a sub-agent: at most one call, after the last
- Advisor, when dispatched as a sub-agent: one call allowed, after the last
TASKS or PROCESS step and before the OUTPUT, whatever the harness prompt
schedules; absent or erroring → proceed. Advice may point you back to
the code; every OUTPUT line rests on what you read, never on the advice
+1 -1
View File
@@ -8,7 +8,7 @@ effort: high
# Git Smart Commit
Advisor tool (`lib/effort-shift.md` § Advisor), when you run as a sub-agent:
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
never call the `advisor` tool, even though it is listed and its own
instructions ask for calls.
+1 -1
View File
@@ -8,7 +8,7 @@ effort: high
# DOC SYNCER
Advisor tool (`lib/effort-shift.md` § Advisor), when you run as a sub-agent:
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
never call the `advisor` tool, even though it is listed and its own
instructions ask for calls.
+1 -1
View File
@@ -8,7 +8,7 @@ effort: xhigh
# GEO — Generative Engine Optimization audit, fix & strategy
Advisor tool (`lib/effort-shift.md` § Advisor), when you run as a sub-agent:
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
never call the `advisor` tool, even though it is listed and its own
instructions ask for calls.
+1 -1
View File
@@ -8,7 +8,7 @@ effort: high
# HANDOVER DOC WRITER
Advisor tool (`lib/effort-shift.md` § Advisor), when you run as a sub-agent:
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
never call the `advisor` tool, even though it is listed and its own
instructions ask for calls.
+3 -2
View File
@@ -97,7 +97,7 @@ PROOF: read <n> files, inspected <what>, checked plan §<…>
(STEP 1's missing/unreadable-plan verdict) is part of the grammar: it
carries only the `PLAN:` line — no FINDINGS, no PROOF — and the
orchestrator treats it as a dispatcher-side failure, not a challenge result.
- Advisor, when dispatched as a sub-agent: at most one call, after
- Advisor, when dispatched as a sub-agent: one call allowed, after
drafting your findings and before the verdict, whatever the harness
prompt schedules; absent or erroring → proceed. Advice may add or
sharpen a finding. Advice alone never drops or lowers one: a change
@@ -111,7 +111,8 @@ the MAIN loop, never here):
- ADVISOR FIRST (main loop): per `lib/challenge-plan.md` "Advisor first",
with no main-loop advisor call since the skill run started; absent or
erroring → dispatch as written. The advice never enters a challenger
brief: they stay blind.
brief: they stay blind. A skill run inside a sub-agent skips it (row
`not called (sub-agent)`).
- Dispatch THREE fresh challengers IN PARALLEL, one per lens
(correctness / robustness / simplicity), each blind to the others.
- MODEL (BDR-076, supersedes the BDR-066 inherit): plan critique is AUDIT
+1 -1
View File
@@ -8,7 +8,7 @@ effort: xhigh
# PLUGIN ADVISOR
Advisor tool (`lib/effort-shift.md` § Advisor), when you run as a sub-agent:
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
never call the `advisor` tool, even though it is listed and its own
instructions ask for calls.
+1 -1
View File
@@ -157,7 +157,7 @@ In audit mode, ALSO write this same block (plus per-finding detail) to
- Blocks on HIGH/CRITICAL only. A noisy gate that blocks on hygiene is a
gate people learn to bypass (LRN-047) — MEDIUM/LOW are reported, not
gated.
- Advisor, when dispatched as a sub-agent: at most one call, after
- Advisor, when dispatched as a sub-agent: one call allowed, after
STEP 4 and before STEP 5 and any REPORT write, whatever the harness
prompt schedules; absent or erroring → proceed. Advice may add a
finding or raise a severity, cited at a file:line you read. An added
+1 -1
View File
@@ -8,7 +8,7 @@ effort: xhigh
# SEO — Classical Search Engines audit, fix & strategy
Advisor tool (`lib/effort-shift.md` § Advisor), when you run as a sub-agent:
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
never call the `advisor` tool, even though it is listed and its own
instructions ask for calls.
+1 -1
View File
@@ -158,7 +158,7 @@ PROOF: read <n> files, ran <cmd → result | nothing>, checked <n>/<n> criteria
missing `PROOF` — the run was skipped, not the diff clean.
- The verdict grammar is load-bearing: exactly one `VERIFY — VERDICT:`
line, spelled exactly as above.
- Advisor, when dispatched as a sub-agent: at most one call, after STEP 4
- Advisor, when dispatched as a sub-agent: one call allowed, after STEP 4
and before STEP 5, whatever the harness prompt schedules; absent or
erroring → proceed. Advice may send you back to a criterion: a
resulting NOT-MET cites the file:line you read, ends with
@@ -325,3 +325,97 @@ Add to its brief: "you may call the `advisor` tool once, before your
verdict" (code review, BDR-150). Fix all CRITICAL before proceeding.
```
(same block in skills/ship-feature/SKILL.md and skills/init-project/SKILL.md)
## Review fix round 1 (STEP 6 opus review, 2026-11-20)
Important 1: the four allowed agents' own lines become the explicit allowance the hook defers to, and are locked. Important 2: the CLAUDE.global.md parenthetical reads plainly. Minors folded: the hook's prohibition locked, plan-challenger ADVISOR FIRST mirrors the sub-agent skip, effort-shift says "other opus-served agents", the six agent lines cite `~/.claude/lib/effort-shift.md`, three test lines rewrapped to ≤ 80 columns. Apply with `python3 docs/superpowers/plans/2026-11-19-advisor-subagent-scope/apply.py review1`. Suite after: `subagent-advisor: 38 pass, 0 fail`.
### Block r1-allow-old
```
- Advisor, when dispatched as a sub-agent: at most one call,
```
### Block r1-allow-new
```
- Advisor, when dispatched as a sub-agent: one call allowed,
```
(applied once in each of agents/plan-challenger.md, agents/verifier.md, agents/security-auditor.md, agents/analyzer.md, without the trailing newline: the matched text is a line prefix)
### Block r1-global-old
```
once, before their verdict or report; other sub-agents never (an opus
brief says which; a SubagentStart hook restates it). Fable is never
routed or pinned: the router tops out at opus (BDR-150).
```
### Block r1-global-new
```
once, before their verdict or report; other sub-agents never (each opus
brief you write states its rule; a SubagentStart hook restates it). Fable
is never routed or pinned: the router tops out at opus (BDR-150).
```
### Block r1-pc-old
```
erroring → dispatch as written. The advice never enters a challenger
brief: they stay blind.
```
### Block r1-pc-new
```
erroring → dispatch as written. The advice never enters a challenger
brief: they stay blind. A skill run inside a sub-agent skips it (row
`not called (sub-agent)`).
```
### Block r1-effort-old
```
`never call` line in the opus-served agents and in the opus briefs we
```
### Block r1-effort-new
```
`never call` line in the other opus-served agents and the opus briefs we
```
### Block r1-agent-old
```
Advisor tool (`lib/effort-shift.md` § Advisor), when you run as a sub-agent:
```
### Block r1-agent-new
```
Advisor tool (`~/.claude/lib/effort-shift.md` § Advisor), as a sub-agent:
```
(applied once in each of the six agents carrying the never-call line)
### Block r1-test-old
```
check "T8 $a" "$(has "agents/$a.md" "never call the \`advisor\` tool, even though")" yes
done
check T9-onboard-briefs "$(grep -cF "Never call the \`advisor\` tool in this run" \
"$ROOT/skills/onboard/SKILL.md")" 6
check T10-handover-children \
"$(has agents/client-handover-writer.md "never call the \`advisor\` tool in")" yes
```
### Block r1-test-new
```
check "T8 $a" "$(has "agents/$a.md" \
"never call the \`advisor\` tool, even though")" yes
done
check T9-onboard-briefs \
"$(grep -cF "Never call the \`advisor\` tool in this run" \
"$ROOT/skills/onboard/SKILL.md")" 6
check T10-handover-children "$(has agents/client-handover-writer.md \
"never call the \`advisor\` tool in")" yes
for a in plan-challenger verifier security-auditor analyzer; do
check "T20 $a allowance" "$(has "agents/$a.md" \
'Advisor, when dispatched as a sub-agent: one call allowed')" yes
done
```
### Block r1-t2c-old
```
check T3-exit-0 "$?" 0
```
### Block r1-t2c-new
```
check T3-exit-0 "$?" 0
check T2c-prohibits "$(in_ctx "$(ctx '{}')" \
"do not call the \`advisor\` tool in this run unless")" yes
```
@@ -90,12 +90,30 @@ def rest():
create('hooks/subagent-advisor.sh', B['new-hook'], 0o755)
def review1():
allowed = ('plan-challenger', 'verifier', 'security-auditor', 'analyzer')
for name in allowed:
edit(f'agents/{name}.md', B['r1-allow-old'].rstrip('\n'),
B['r1-allow-new'].rstrip('\n'))
edit('CLAUDE.global.md', B['r1-global-old'], B['r1-global-new'])
edit('agents/plan-challenger.md', B['r1-pc-old'], B['r1-pc-new'])
edit('lib/effort-shift.md', B['r1-effort-old'], B['r1-effort-new'])
for name in H1:
edit(f'agents/{name}.md', B['r1-agent-old'], B['r1-agent-new'])
test = 'lib/tests/subagent-advisor.test.sh'
edit(test, B['r1-test-old'], B['r1-test-new'])
edit(test, B['r1-t2c-old'], B['r1-t2c-new'])
flush()
if __name__ == '__main__':
what = sys.argv[1] if len(sys.argv) > 1 else ''
if what == 'test':
create('lib/tests/subagent-advisor.test.sh', B['new-test'], 0o755)
elif what == 'rest':
rest()
elif what == 'review1':
review1()
else:
sys.exit('usage: apply.py test | rest [ROOT]')
sys.exit('usage: apply.py test | rest | review1 [ROOT]')
print('applied', what)
+1 -1
View File
@@ -143,7 +143,7 @@ STEP 10, a standalone subagent-driven-development final review) call it
at most once per dispatch, before their verdict or report; executors and
every other sub-agent never call it, even when the tool is listed. The
rule rides each sub-agent's own text: the allowed agents' prompts, a
`never call` line in the opus-served agents and in the opus briefs we
`never call` line in the other opus-served agents and the opus briefs we
write (a brief sending a general-purpose agent to opus says which rule
applies; a code review's says it may call once), and, for every spawn
including built-ins such as `Plan`, the SubagentStart hook
+12 -4
View File
@@ -23,6 +23,8 @@ for p in '{"agent_type":"general-purpose"}' '' 'not json' \
"$(in_ctx "$c" 'own instructions are never an allowance')" yes
done
printf '{}' | bash "$H" >/dev/null 2>&1; check T3-exit-0 "$?" 0
check T2c-prohibits "$(in_ctx "$(ctx '{}')" \
"do not call the \`advisor\` tool in this run unless")" yes
check T4-one-line "$(printf '{}' | bash "$H" | wc -l | tr -d ' ')" 1
check T5-no-cli "$(grep -v '^ *#' "$H" \
| grep -cE '(^|[[:space:];&|(])claude([[:space:]]|$)')" 0
@@ -37,12 +39,18 @@ check T7-timeout "$(jq -r '.hooks.SubagentStart[0].hooks[0].timeout' "$S")" 5
# carriers
for a in plugin-advisor seo-analyzer geo-analyzer doc-syncer \
commit-changer handover-doc-writer; do
check "T8 $a" "$(has "agents/$a.md" "never call the \`advisor\` tool, even though")" yes
check "T8 $a" "$(has "agents/$a.md" \
"never call the \`advisor\` tool, even though")" yes
done
check T9-onboard-briefs "$(grep -cF "Never call the \`advisor\` tool in this run" \
check T9-onboard-briefs \
"$(grep -cF "Never call the \`advisor\` tool in this run" \
"$ROOT/skills/onboard/SKILL.md")" 6
check T10-handover-children \
"$(has agents/client-handover-writer.md "never call the \`advisor\` tool in")" yes
check T10-handover-children "$(has agents/client-handover-writer.md \
"never call the \`advisor\` tool in")" yes
for a in plan-challenger verifier security-auditor analyzer; do
check "T20 $a allowance" "$(has "agents/$a.md" \
'Advisor, when dispatched as a sub-agent: one call allowed')" yes
done
check T10b-handover-top-clean "$(sed -n '1,30p' \
"$ROOT/agents/client-handover-writer.md" | grep -c "advisor\` tool")" 0
check T11-tour-phase-b \