Is this brief delegable?
Lint a Markdown brief the way Claude Code will meet it. Is the done condition something a /goal evaluator can see? Can a check observe each acceptance criterion? Which boundaries does a permission rule or hook actually enforce? What would Claude have to guess? Session: Structured Briefs, Definition of Done and Interviews with AskUserQuestion.
- Python 3.9+
- standard library only
- offline:
samples/weak_brief.mdandsamples/strong_brief.md
python3 delivery-2/brief_lint.py
Both samples ask for the same tiny-app change: make discount codes case-insensitive (the TODO at tinyapp/pricing.py:29). The weak one is the request as it often arrives. The strong one has intent, existing behavior, a done condition, AC1–AC5, negative examples, boundaries, context and evidence. The linter uses deterministic rules, with no model and no network.
┌──────────────────────────────────────────────┐
│ Brief lint · delivery-2/samples/weak_brief.md │
└──────────────────────────────────────────────┘
title: Discount codes fix
score: 0/100 ······························ not delegable yet
findings: 13 high, 9 medium, 3 low
[1] Findings (line, rule, severity)
line rule sev finding
──── ──── ────── ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
6 S1 high no acceptance criteria section; the Requirements items are graded as criteria below
7 A1 high AC1 is not observable: no literal value and no observable result
7 X3 high contradiction (case): line 7 says 'Case-insensitive', line 10 says 'Case-sensitive'
8 A1 high AC2 is not observable: no literal value and no observable result
9 A1 high AC3 is not observable: no literal value and no observable result
11 A1 high AC5 is not observable: no literal value and no observable result
11 A3 high AC5 leaves a decision open
13 G2 high no stated check: the condition names no command whose output proves it
13 G3 high no measurable end state (exit code, test result, count, empty queue)
13 G4 high 'code is clean' can't be judged from the conversation: the /goal evaluator doesn't run commands or read files
13 G4 high 'everything works' can't be judged from the conversation: the /goal evaluator doesn't run commands or read files
17 B1 high boundaries name no file or directory
17 X3 high contradiction (dependencies): line 18 says 'No new deps', line 17 says 'Add a library'
- S1 medium missing section: no existing behavior: Claude rediscovers today's behavior, and may 'fix' what is intended
- S1 medium missing section: no negative examples: the most likely wrong answers aren't ruled out
- S1 medium missing section: no evidence requirement: Claude may report success instead of showing it
7 A2 medium AC1 uses vague words: properly, etc
8 A2 medium AC2 uses vague words: fast
9 A2 medium AC3 uses vague words: as needed
10 A1 medium AC4 is only partly observable
13 G5 medium no constraint: nothing says what must not change on the way there
17 B2 medium vague boundary: anything important, Feel free, if it helps
- B3 low no autonomy statement (plan first? which permission mode? ask before what?)
4 X2 low vague words: better, robust
13 G7 low no bound: the goal runs until met, judged impossible, or an error clears it
[2] Acceptance criteria: can a check observe each one?
id observable criterion
─── ──────────── ─────────────────────────────────────────────────────────────
AC1 unobservable Codes should be handled properly and case-insensitively, etc.
AC2 unobservable Lookups should be fast.
AC3 unobservable Update the tests as needed.
AC4 weak Keep VIP codes case-sensitive so they stay exclusive.
AC5 unobservable Maybe add a SPRING15 code? TBD
[3] Boundaries -> the control that enforces them (brief text alone is advisory)
L 17 Don't touch anything important. Feel free to refactor pricing if it help
-> advisory only, and vague: name the files or actions so a rule or hook can enforce it
L 18 No new dependencies.
-> permissions.deny: Bash(pip install *), Bash(uv add *), Bash(npm install *) (a speed bump: a Bash deny rule isn't a boundary around the program; the sandbox is)
[4] Interview: 4 AskUserQuestion question(s)
[Conflict] The brief contradicts itself: line 7 says 'Case-insensitive', line 10 says 'Case-sensitive'. Which wins?
- Case-insensitive: Keep this; delete the other line from the brief
- Case-sensitive: Keep this; delete the other line from the brief
[Conflict] The brief contradicts itself: line 18 says 'No new deps', line 17 says 'Add a library'. Which wins?
- No new deps: Keep this; delete the other line from the brief
- Add a library: Keep this; delete the other line from the brief
[Done when] What single check proves this brief is done?
- Suite exits 0: `python3 -m unittest` exits 0 and Claude pastes the output
- New test passes: a named new test passes, and the rest of the suite still passes
- Exact output: a command prints a value you name, shown in the transcript
[Scope] Which files may Claude edit for this change?
- Named files only: list them; anything else needs your approval
- One module + tests: the module that owns the behavior and its test file
- Propose in plan: Claude lists the files in plan mode and you approve
payload valid: 1-4 questions, 2-4 options, headers <= 12 chars
[5] /goal condition (suggested: the brief's own condition isn't checkable)
/goal `python3 -m unittest` exits 0 with new tests for: Discount codes fix. Show the output. No unrelated files change. Or stop after 20 turns and report what is left.
headless, in a scratch copy or a worktree: claude -p "$(cat delivery-2/out/goal_weak_brief.txt)" --permission-mode acceptEdits --allowedTools "Bash(python3 -m unittest *)" "Bash(git diff *)" --output-format stream-json --verbose --max-turns 30 --max-budget-usd 2
(--max-turns counts tool-use turns and is the hard backstop; the condition's own 'or stop after N turns' clause is the bound the evaluator judges.)
/goal doesn't change the permission mode (interactive: run it in auto mode for unattended turns) and is unavailable when disableAllHooks or allowManagedHooksOnly applies.
┌────────────────────────────────────────────────┐
│ Brief lint · delivery-2/samples/strong_brief.md │
└────────────────────────────────────────────────┘
title: Brief: case-insensitive discount codes
score: 100/100 ██████████████████████████████ ready to delegate
findings: 0 high, 0 medium, 0 low
[1] Findings (line, rule, severity)
none
[2] Acceptance criteria: can a check observe each one?
id observable criterion
─── ────────── ──────────────────────────────────────────────────────────────────────────────
AC1 observable AC1: `apply_discount(10000, "welcome10")` returns `1000`, the same as `"WELCOM
AC2 observable AC2: `apply_discount(10000, " vip25 ")` returns `2500`: surrounding whitespace
AC3 observable AC3: `apply_discount(10000, "NOPE")` still returns `0` and raises nothing.
AC4 observable AC4: `DISCOUNTS` is unchanged: `python3 -c "from tinyapp.pricing import DISCOU
AC5 observable AC5: `python3 -m unittest` exits 0 and reports at least 14 tests (13 today).
[3] Boundaries -> the control that enforces them (brief text alone is advisory)
L 24 Don't change `tax_for()` or its half-up rounding; `test_known_region_rou
-> no permission rule can see content (`tax_for()`, `test_known_region_rounds_half_up`): pin it with a test, or check it in a PostToolUse/Stop hook
L 27 Only edit `tinyapp/pricing.py` and `tests/test_pricing.py`.
-> PreToolUse hook (matcher `Edit|Write|Bash`) that denies paths outside: tinyapp/pricing.py, tests/test_pricing.py. Edit|Write alone never sees shell writes (sed -i, redirects, tee, scripts), and a hook can't parse every command, so keep the `git diff --stat` check in the done condition as the backstop. PostToolUse `tool_response.bashEditDiff` (v2.1.269+) can show which files a Bash command changed, but it's best effort and, by default, recorded only in auto and bypassPermissions mode (`bashEditDiffEnabled: true` in user, managed or --settings JSON records it in every mode); the docs say to use it to find what to review, not to enforce a policy
L 28 Never edit the `TAX_BPS` values.
-> no permission rule can see content (`TAX_BPS`): pin it with a test, or check it in a PostToolUse/Stop hook
L 29 Don't add third-party dependencies.
-> permissions.deny: Bash(pip install *), Bash(uv add *), Bash(npm install *) (a speed bump: a Bash deny rule isn't a boundary around the program; the sandbox is)
L 30 Ask before changing the public API in `tinyapp/__init__.py`.
-> permissions.ask: Edit(/tinyapp/__init__.py) (ask rules prompt even in auto mode)
L 31 Start in plan mode (`/plan`). After I approve the plan, edits may run in
-> session setup: `/plan` (or --permission-mode plan); approve with 'Yes, and use auto mode'
[4] Interview: 0 AskUserQuestion question(s)
nothing to ask
[5] /goal condition
/goal `python3 -m unittest` exits 0, `tests/test_pricing.py` has a new test that applies `welcome10` and `Vip25`, and `git diff --stat` lists only `tinyapp/pricing.py` and `tests/test_pricing.py`. Show both outputs. No other test file is modified. Or stop after 15 turns and report what is left.
headless, in a scratch copy or a worktree: claude -p "$(cat delivery-2/out/goal_strong_brief.txt)" --permission-mode acceptEdits --allowedTools "Bash(python3 -m unittest *)" "Bash(git diff *)" --output-format stream-json --verbose --max-turns 30 --max-budget-usd 2
(--max-turns counts tool-use turns and is the hard backstop; the condition's own 'or stop after N turns' clause is the bound the evaluator judges.)
/goal doesn't change the permission mode (interactive: run it in auto mode for unattended turns) and is unavailable when disableAllHooks or allowManagedHooksOnly applies.
┌────────────┐
│ Comparison │
└────────────┘
brief score grade high /goal
───────────────────────────────── ───── ───────────────── ──── ─────────
delivery-2/samples/weak_brief.md 0 not delegable yet 13 suggested
delivery-2/samples/strong_brief.md 100 ready to delegate 0 ready
wrote delivery-2/out/brief_weak_brief.md, delivery-2/out/interview_weak_brief.json, delivery-2/out/goal_weak_brief.txt, delivery-2/out/brief_strong_brief.md, delivery-2/out/interview_strong_brief.json, delivery-2/out/goal_strong_brief.txt
- The weak brief reads fine at a glance and scores 0: 13 high, 9 medium and 3 low findings. It has no acceptance criteria section, so its Requirements bullets are graded as criteria instead.
- "When everything works and the code is clean" fails as a done condition. The
/goalevaluator judges only what's in the conversation, so nothing in the transcript can show "clean". - Two contradictions. Claude would silently pick one side of each, so the interview asks about them first.
- The gaps become four questions in the
AskUserQuestioninput shape. The lab checks the documented limits before it prints them: 1–4 questions, 2–4 options, headers of at most 12 characters (user input). - The strong brief scores 100, and its boundaries still enforce nothing on their own. "Only edit" needs a hook that also covers Bash. "Never edit
TAX_BPS" is about content, which no permission rule can see. - A done condition that works: a command with an exit code, the files that may change, what must not change, the output to show, and a bound.
- CI mode:
python3 delivery-2/brief_lint.py delivery-2/samples/weak_brief.md --fail-under 80exits 1; the strong brief exits 0. --json --max-questions 2on the weak brief keeps the interview to the two conflict questions, in the samequestions[].header/options[]/multiSelectshape the lab writes toout/interview_weak_brief.json.- Break it: in a copy of
samples/strong_brief.md, replace the paragraph under## Done whenwithWhen everything works and the code is clean.The score falls from 100 to 30, with four high findings (G2, G3 and two G4) on that one line. The acceptance criteria haven't changed. - Rewrite
weak_brief.mduntil it scores 85 or more. Which three edits moved the score most? - Then use the interview for real: in a session, ask Claude to "Interview me with AskUserQuestion using
delivery-2/out/interview_weak_brief.json, then rewrite the brief."
- Write the done condition for an evaluator that doesn't run commands or read files: one measurable end state, a stated check, the constraints, and optionally a bound such as
or stop after 20 turns. It can be up to 4,000 characters (/goal). - A boundary in a brief is advisory, like CLAUDE.md. Permission rules match tools and paths, never file content, so a "never change this value" line needs a pinning test or a hook.
- A perfect score grades the text, not the controls. Check that the deny and ask rules and the hooks the map names exist before you hand the brief over.
/goalis unavailable whendisableAllHooksis true or managed settings setallowManagedHooksOnly, because its evaluator is part of the hooks system (/goal requirements).
Review the plan before you approve it
Check a plan-mode plan against the brief it implements before you pick an option at plan mode's approval prompt. The review covers coverage, scope, conflicts, scope creep, vague steps and missing verification. For "No, keep planning" it also writes the feedback for you. Session: Plan Mode and Evidence Requirements.
- Python 3.9+
- standard library only
- offline:
samples/plan_good.md,samples/plan_drifting.mdand the strong brief
python3 delivery-2/plan_review.py
┌──────────────────────────────────────────────┐
│ Plan review · delivery-2/samples/plan_good.md │
└──────────────────────────────────────────────┘
brief: delivery-2/samples/strong_brief.md
[1] Steps (5)
# kind AC step
─ ────────── ─────────── ────────────────────────────────────────────────────────────────────────────────────
1 edit AC1,AC2,AC3 Add tests to `tests/test_pricing.py` first (AC1, AC2, AC3): `welcome10` and `Vip25`
2 edit AC1,AC2 In `tinyapp/pricing.py`, normalize the code in `apply_discount()` with `code.strip()
3 verify AC4 Check AC4: `python3 -c "from tinyapp.pricing import DISCOUNTS; print(DISCOUNTS)"` pr
4 verify AC5 Run the full suite and confirm the scope (AC5): `python3 -m unittest` and `git diff
5 checkpoint - Checkpoint: commit `feat(pricing): accept discount codes in any case`.
[2] Coverage matrix (v = maps and has a check command, o = maps without a command, x = contradicts it)
criterion S1 S2 S3 S4 S5
───────── ── ── ── ── ──
AC1 v o . . .
AC2 v o . . .
AC3 v . . . .
AC4 . . v . .
AC5 . . . v .
[3] Findings
none
[4] Verdict
Yes, and use auto mode
Every criterion maps to a checked step and nothing leaves scope. Pair auto mode with a Stop gate (delivery-4/ci_gate) or a /goal condition so 'done' is checked, not asserted.
┌──────────────────────────────────────────────────┐
│ Plan review · delivery-2/samples/plan_drifting.md │
└──────────────────────────────────────────────────┘
brief: delivery-2/samples/strong_brief.md
[1] Steps (6)
# kind AC step
─ ───── ── ────────────────────────────────────────────────────────────────────────────────────
1 edit - Refactor `tinyapp/pricing.py` into a `Discounts` class and clean up the module as ne
2 edit - Lower-case all `DISCOUNTS` keys and add a `SPRING15` code while I'm in there.
3 edit - Update `tinyapp/__init__.py` to export the new `Discounts` class.
4 edit - Update `tinyapp/discounts.py` so codes load from a JSON file.
5 edit - Tweak the `TAX_BPS` rounding for consistency with the new class.
6 other - Make sure everything works.
[2] Coverage matrix (v = maps and has a check command, o = maps without a command, x = contradicts it)
criterion S1 S2 S3 S4 S5 S6
───────── ── ── ── ── ── ──
AC1 . . . . . .
AC2 . . . . . .
AC3 . . . . . .
AC4 . x . . . .
AC5 . . . . . .
[3] Findings
rule sev step finding
──── ────── ──── ──────────────────────────────────────────────────────────────────────────────────────────────────────────
P6 high - AC1 has no step that implements it
P6 high - AC2 has no step that implements it
P6 high - AC3 has no step that implements it
P6 high - AC4 has no step that implements it
P6 high - AC5 has no step that implements it
P8 high - no step runs a command: nothing in the plan verifies anything
P1 high S2 changes `DISCOUNTS`, which the brief rules out (negative example, AC4)
P2 high S4 edits tinyapp/discounts.py, outside the files the brief allows (tinyapp/pricing.py, tests/test_pricing.py)
P3 high S4 edits tinyapp/discounts.py, which doesn't exist in the repo
P1 high S5 changes `TAX_BPS`, which the brief rules out (boundary)
P5 medium S1 vague step: clean up
P5 medium S2 vague step: while I'm in there
P2 medium S3 edits tinyapp/__init__.py; the brief says to ask before changing it
P4 medium S3 serves no acceptance criterion (unrequested work?)
P4 medium S4 serves no acceptance criterion (unrequested work?)
P4 medium S5 serves no acceptance criterion (unrequested work?)
P5 medium S5 vague step: for consistency
P4 medium S6 serves no acceptance criterion (unrequested work?)
P5 medium S6 vague step: Make sure everything works
P10 low - no risks or rollback section
P9 low - no checkpoint (commit or pause) in a plan of more than three steps
P4 low S1 serves no acceptance criterion (unrequested work?)
[4] Verdict
No, keep planning
Feedback to type after choosing it:
- No step implements AC1, AC2, AC3, AC4, AC5. Add a step for each, with the command that checks it.
- Add a verification step with the exact test command, and paste its output when done.
- Step 1: 'clean up' is vague: say exactly what changes and how you'll check it.
- Step 2: it changes `DISCOUNTS`, which the brief rules out (negative example, AC4): drop or rework it; 'while I'm in there' is vague: say exactly what changes and how you'll check it.
- Step 3: the brief says to ask before changing tinyapp/__init__.py: ask me, or drop the change; it serves no criterion: drop it, or name the criterion it serves.
- Step 4: tinyapp/discounts.py is out of scope (only tinyapp/pricing.py, tests/test_pricing.py); tinyapp/discounts.py doesn't exist: name the real file, or say the step creates it; it serves no criterion: drop it, or name the criterion it serves.
- Step 5: it changes `TAX_BPS`, which the brief rules out (boundary): drop or rework it; it serves no criterion: drop it, or name the criterion it serves; 'for consistency' is vague: say exactly what changes and how you'll check it.
- Step 6: it serves no criterion: drop it, or name the criterion it serves; 'Make sure everything works' is vague: say exactly what changes and how you'll check it.
┌─────────┐
│ Summary │
└─────────┘
plan high medium verdict
────────────────────────────────── ──── ────── ──────────────────────
delivery-2/samples/plan_good.md 0 0 Yes, and use auto mode
delivery-2/samples/plan_drifting.md 10 9 No, keep planning
wrote delivery-2/out/plan_review_plan_good.md, delivery-2/out/plan_review_plan_drifting.md
- The good plan: every criterion maps to a step that carries its own check command (
v).omarks a step that serves a criterion without checking it. - "Yes, and use auto mode", paired with a Stop gate or a
/goalcondition, so that "done" is checked rather than asserted. - Coverage by keyword isn't satisfaction. Step 2 "covers" AC4 only by contradicting it, so the matrix marks it
x. - No step runs a command. A plan that verifies nothing leaves "done" to Claude's own report.
tinyapp/discounts.pyis outside the brief's scope and doesn't exist. An edit to a missing file that the plan doesn't say it creates is a sign Claude is guessing.- "No, keep planning", with one fix per step to type after choosing it, so Claude revises the plan rather than starting over.
--plan delivery-2/samples/plan_drifting.md --strictexits 1, so you can gate a saved plan in a script.- In a copy of
samples/plan_good.md, add a step6. Update `tinyapp/__init__.py` to export a new `normalize_code()` helper.and pass the copy with--plan. Two medium findings (ask before changing__init__.py; serves no criterion) turn the verdict into "Yes, manually approve edits". - Break it: add
6. Round the `TAX_BPS` values to whole percents.instead. That step breaks a boundary, yet the reviewer reports only "serves no acceptance criterion" and approves with manual edits, because "round" isn't in its list of edit verbs (EDIT_VERB). Addroundto that regex in your copy, and P1 fires: "changesTAX_BPS, which the brief rules out", and the verdict becomes "No, keep planning". A rule-based reviewer is a prompt for your judgment, not a judge. - Review a real plan:
--plan ~/.claude/plans/<file>.md --brief my_brief.md --repo /path/to/repo. Press Ctrl+G at the approval prompt to open the plan in your editor.
Ask your own Claude Code for a plan, then review it. The lab sends the strong brief to claude -p in plan mode with read-only tools (--tools Read,Grep,Glob, MCP and hooks off), in a temp copy of tiny-app. It costs money and is capped (default 6 turns):
python3 delivery-2/plan_review.py --real --model haiku --max-budget-usd 0.25
A recorded run with a $0.05 cap and a 6-turn cap (2026-10-20, Claude Code v2.1.303, Haiku) never got as far as a plan. It stopped with subtype: error_max_budget_usd at $0.0586 after 4 turns. The cap is checked against a client-side estimate and can be passed by about one response. Plan-mode runs cost more than delivery-1's read-only exploration ($0.0037), so leave headroom. Each run saves its stream-json to out/plan_real.jsonl and prints the per-model cost from modelUsage.
- Rejecting a plan costs one message, and rejecting a diff costs a session. That is why the review happens here. The same logic runs the other way: if you could describe the diff in one sentence, skip the plan.
- The verdict names map to the approval prompt's default options: "Yes, and use auto mode", "Yes, manually approve edits", "No, keep planning". The first reads "Yes, auto-accept edits" when auto mode isn't available, and
showClearContextOnPlanAcceptadds an option that also clears the planning context (permission modes). Any high finding means keep planning; medium findings only means approve, but review each edit. - Identifiers match case-sensitively.
DISCOUNTS, the dict, conflicts with the negative example; a class namedDiscountsdoesn't.
Rule tests for both reviewers
Pin every rule in brief_lint.py and plan_review.py with a passing and a failing example, the way you'd pin a hook. One broadened regex can silently turn a clean brief noisy, and one dropped rule can silently let a bad plan through. Session: Tests.
- Python 3.9+
- standard library only (
unittest) - offline: the delivery-2 samples and the
explore_readonlyfixture
python3 delivery-2/test_brief_lint.py -v
unittest writes to stderr; the panel shows what your terminal shows. The timing line is cut, because it changes on every run.
test_clean_after_status_is_not_vague (__main__.BriefTests) ... ok test_contradictions_found (__main__.BriefTests) ... ok test_criteria_observability (__main__.BriefTests) ... ok test_deterministic (__main__.BriefTests) ... ok test_enforcement_uses_project_root_anchor (__main__.BriefTests) ... ok test_existing_behavior_is_not_a_contradiction (__main__.BriefTests) ... ok test_goal_ready_only_when_checkable (__main__.BriefTests) ... ok test_interviews_are_valid_ask_user_question_payloads (__main__.BriefTests) ... ok test_invariant_needs_no_alternative (__main__.BriefTests) ... ok test_scores_separate (__main__.BriefTests) ... ok test_todo_in_backticks_is_not_open (__main__.BriefTests) ... ok test_validator_catches_limits (__main__.BriefTests) ... ok test_bound_is_low_severity (__main__.GoalConditionTests) ... ok test_docs_example_passes_the_blocking_rules (__main__.GoalConditionTests) ... ok test_length_limit (__main__.GoalConditionTests) ... ok test_stated_check_with_command (__main__.GoalConditionTests) ... ok test_unobservable_condition (__main__.GoalConditionTests) ... ok test_users_happy_is_unobservable (__main__.GoalConditionTests) ... ok test_conflicts_and_scope (__main__.PlanReviewTests) ... ok test_good_plan_checks_every_criterion (__main__.PlanReviewTests) ... ok test_identifier_match_is_case_sensitive (__main__.PlanReviewTests) ... ok test_plan_from_result_event (__main__.PlanReviewTests) ... ok test_verdicts (__main__.PlanReviewTests) ... ok test_weak_brief_caps_the_verdict (__main__.PlanReviewTests) ... ok ---------------------------------------------------------------------- … OK
- The
/goaldocs' own example, "all tests in test/auth pass and the lint step is clean", must pass the blocking done-condition rules. If a rule rejects the docs' example, the rule is wrong. - Every generated interview is checked against the
AskUserQuestionlimits, and the validator itself is tested on payloads that break them. - The identifier match is case-sensitive:
DISCOUNTSmatches,Discountsdoesn't. - The plan extractor takes the
planfrom an ExitPlanMode tool result if the run has one, and otherwise the finalresulttext. The test feeds it a recorded stream-json run, so--real's extraction path is checked without a model call.
- Break it: in a scratch copy of
labs/, delete the("case", …)pair fromCONTRADICTIONSinbrief_lint.pyand rerun.test_contradictions_foundfails withAssertionError: 1 != 2, and the run endsFAILED (failures=1)with exit 1. - Then the other way round: add a pair of your own (for example "offline" vs "real-time sync") with a line that triggers it in a copy of a sample, and a test that fails first, then passes.
- Broadening isn't always caught. Loosening the "Add a library" pattern to any
add,installorusestill passes all 24 tests. Write the test that would catch it.
- Treat a linter or a gate as code: every rule gets a positive and a negative test, and the tests run whenever a regex changes.
- Use the docs' own examples as fixtures, so that a rule tightening past what the docs call a good condition fails loudly.