Skip to content

feat: add opt-in lean Claude worker launches - #62

Merged
peterOC26 merged 4 commits into
mainfrom
fm/fm-saving-ideas-trial-t1
Nov 13, 2026
Merged

peterOC26 merged 4 commits into
mainfrom
fm/fm-saving-ideas-trial-t1

Conversation

@peterOC26

Copy link
Copy Markdown
Owner

Intent

Q2081 B (2026-11-13, "q2081 B"): try only idea 2 and idea 4 on the next 3 Claude code checks. No model change. Judge with measured numbers. The change must be reversible.

Idea 2 is a 5-minute prompt cache instead of a 1-hour cache for short Claude sessions. A session that reads, answers, and ends within minutes does not need its saved conversation kept for an hour. The 1-hour cache write costs $8 per million tokens and the 5-minute write costs $5. Use the 5-minute cache for the read-only plan and code-check stages, and for the next three Claude code checks, by setting FORCE_PROMPT_CACHING_5M=1 in those workers' launch environment. Do not apply it to the main chat, drivers, try copies, or the supervision session, which wait between calls and need the long cache. The model, the effort, and the prompt do not change. The risk is cost only: if a session pauses more than 5 minutes between calls, it writes the conversation again. Judge from the transcripts: the 5-minute and 1-hour token split, cache-create tokens per session, and dollars per call. The baseline is about $0.067 per call and about 121,000 cache-create tokens per code check; go back if the average passes about 190,000.

Idea 4 is a smaller start for Claude plan and check workers. Those workers should launch with only what the stage uses: no chat connectors (a document connector and artifact publishing tools a code check never uses) and no other MCP servers, and no main-chat auto-memory index (the main chat's MEMORY.md, about 23,287 bytes, written for the main chat). Keep hooks, project instructions, and the skills the brief needs. Leave stages that need design tools or the browser alone. Judge by the first transcript row. The measured baseline was 67,465 tokens at the first call, 42,229 written and 25,234 read. Keep the smaller start if the check finishes normally. Removing the switch returns the old start.

What Changed

  • Add --claude-lean to launch Claude workers with five-minute prompt caching, MCP tools disabled, and auto memory disabled while retaining hooks, project instructions, and skills.
  • Keep the option per launch and reversible by omission; reject supervision sessions, non-Claude launches, raw commands, and T3 Code.
  • Add launch regression coverage and an opt-in live plugin MCP check, register the suite with the test runner, and document configuration and verification evidence.

Risk Assessment

⚠️ Medium: Ordinary launches stay byte-identical and the lean behavior is opt-in, but a lean task relaunched onto another harness has its agent stopped before the refusal, leaving no worker. The change also allows lean on secondmate supervision sessions, which the intent excludes, and adds a sticky record that relaunch has no way to turn off.

Testing

Targeted regression, adversarial plugin checks, five CLI refusals, and four real Claude worker launches passed. Saved transcripts, rendered terminal captures, and native cost measurements; cleaned up all labs. Small-fixture measurements demonstrate behavior, not production savings.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Three lean Claude code checks finish normally using five-minute cache writes and the same model ✅ pass live round2/measurements.json; round2/live-validation.html
Clearing the worker environment preserves the lean cache and memory settings ✅ pass live round2/measured/check-2-process.json; round2/measured/check-2-transcript.jsonl
Lean checks omit auto-memory while retaining project instructions, requested skills, and working hooks ✅ pass live round2/measurements.json; round2/measured/check-1-report.md
Lean workers exclude configured MCP tools that remain available to an ordinary worker ✅ pass live round2/measured/check-1-transcript.jsonl; round2/measured/check-4-transcript.jsonl
Plugin MCP tools remain unavailable after startup and mid-turn registration attempts, including an inherited server allowlist ✅ pass live round2/plugin-runtime-summary.json; round2/plugin-lean-runtime.jsonl; round2/focused-test.log
Omitting the flag restores one-hour cache writes, auto-memory, and MCP tools without persisting lean metadata ✅ pass live round2/measurements.json; round2/measured/check-4-report.md
Secondmate, non-Claude, raw-command, unsupported-backend, and valued-flag requests refuse before creating task records ✅ pass live round2/refusals.json
Evidence: Live terminal captures and review reports

Source: Live terminal captures and review reports

<!doctype html><meta charset="utf-8"><title>Claude lean live validation</title><style>body{font:16px system-ui;margin:36px;background:#fff;color:#18212b}pre{white-space:pre-wrap;background:#101821;color:#eff4fa;padding:18px;font:13px monospace}td,th{padding:10px;border:1px solid #bbb}table{border-collapse:collapse}code{background:#eee;padding:3px}</style><h1>Claude lean live validation</h1><p>All three lean reviews completed with five-minute cache writes and no runtime MCP tools. Ordinary launch restores MCP and auto-memory loading. Same Claude model and effort throughout.</p><p>Real Claude Code 2.1.323 using the existing OAuth login, isolated config, actual Treehouse worktrees and private 160x50 tmux server. Same fixture and review request throughout; unique report paths/task IDs differ. No model or effort overrides between lean and ordinary launches.</p><table><tr><th>Check</th><th>Mode</th><th>First input</th><th>5m writes</th><th>1h writes</th><th>Calls</th><th>Main $/call</th><th>MCP tools</th></tr><tr><td>1</td><td>lean</td><td>31874</td><td>11099</td><td>0</td><td>5</td><td>0.023877</td><td>none</td></tr><tr><td>2</td><td>lean</td><td>31879</td><td>8921</td><td>0</td><td>4</td><td>0.024363</td><td>none</td></tr><tr><td>3</td><td>lean</td><td>31916</td><td>10625</td><td>0</td><td>4</td><td>0.027039</td><td>none</td></tr><tr><td>4</td><td>ordinary</td><td>32788</td><td>0</td><td>11654</td><td>4</td><td>0.035993</td><td>mcp__easel__chart, mcp__validation-server__validation_probe</td></tr></table><p>Calls deduplicated by API message ID. Session dollars are the Claude CLI runtime ledger, including automatic permission classifier usage. Dollars/call use only the unchanged main model. These tiny fixture checks measure behavior, not a representative production cost comparison.</p><details><summary>Measured check 1: actual terminal capture and report</summary><pre>  &#x27;~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/state/operational-inbox/1794567608-f56b92893495d092.msg&#x27;
  and handle its contents as Firstmate operational input.

  Read 1 file

● Skill(validation-review)
  ⎿  Successfully loaded skill

● Auto mode lets Claude handle permission prompts automatically — Claude checks each tool call for risky actions and prompt injection before executing.
  Actions Claude identifies as safe are executed, while actions Claude identifies as risky are blocked and Claude may try a different approach. Ideal
  for long-running tasks. Sessions are slightly more expensive. Claude can make mistakes that allow harmful commands to run, it&#x27;s recommended to only
  use in isolated environments. Shift+Tab to change mode.

  Listed 2 directories, ran 1 shell command

● Write(~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/data/leanlive-k6f6ybmx-1/report.md)
  ⎿  Wrote 17 lines to ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/data/leanlive-k6f6ybmx-1/report.md
       1 # calc.py validation review
       2
       3 ## Finding
       4 - `calc.py:3` — `add(a, b)` is documented as &quot;Return the sum of two numbers&quot; but returns `a - b`. Example: `add(2, 3)` returns `-1` instead of `
         5`. Fix: `return a + b`. (Not applied; read-only review.)
       5
       6 ## Identifiers visible to me
       7 - Project: `PROJECT_CEDAR` (from CLAUDE.md)
       8 - Skill: `SKILL_WILLOW` (from the validation-review skill instructions)
       9 - Hook: `HOOK_BIRCH` (SessionStart:startup hook output)
     … +8 lines

● I checked calc.py without changing it and wrote the report to
  ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/data/leanlive-k6f6ybmx-1/report.md.

  - Finding: at calc.py:3, add(a, b) is supposed to return the sum but returns a - b, so add(2, 3) gives -1 instead of 5. The fix is return a + b. I didn&#x27;t
    apply it.
  - Identifiers I could see:
    - Project: PROJECT_CEDAR
    - Skill: SKILL_WILLOW
    - Hook: HOOK_BIRCH
    - Auto-memory: none appeared.
  - MCP tools: none are available. The project&#x27;s .mcp.json lists a validation-server, but none of its tools are in this session.
  - Steering inbox: it holds only an empty handled/ folder, so there were no messages to act on.

  I didn&#x27;t edit any project files, publish anything, run a pipeline or hand off any work.

✻ Cooked for 16s · done 12:00 PM
                                                          tmux focus-events off · add &#x27;set -g focus-events on&#x27; to ~/.tmux.conf and reattach for focus tracking
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ auto mode on (shift+tab to cycle)
</pre><pre># calc.py validation review

## Finding
- `calc.py:3` — `add(a, b)` is documented as &quot;Return the sum of two numbers&quot; but returns `a - b`. Example: `add(2, 3)` returns `-1` instead of `5`. Fix: `return a + b`. (Not applied; read-only review.)

## Identifiers visible to me
- Project: `PROJECT_CEDAR` (from CLAUDE.md)
- Skill: `SKILL_WILLOW` (from the validation-review skill instructions)
- Hook: `HOOK_BIRCH` (SessionStart:startup hook output)
- Auto-memory: none visible (no auto-memory identifier appeared in my context)

## MCP tools
- No MCP tools are available in this session. The project `.mcp.json` declares a `validation-server` server, but no MCP tools from it (or any other server) appear in my tool list.

## Notes
- Steering inbox contained only an empty `handled/` subdirectory; no pending messages.
- No project files modified; nothing published, no pipeline run, no delegation.
</pre></details><details><summary>Measured check 2: actual terminal capture and report</summary><pre>
 ▐▛███▛█   Claude Code v2.1.323
▝▜██████▀  Opus 5.5 · Claude API
 ▝▝   ▝▝   ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/pool/.treehouse/project-5379fb/2/project

  Fable 5.2 is here for your longest and toughest coding tasks. It draws down usage faster than Opus 5.5. Switch with /model.

❯ : Firstmate operational input waiting: read
  &#x27;~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/state/operational-inbox/1794567643-cb9340cd1904fbc3.msg&#x27;
  and handle its contents as Firstmate operational input.

  Read 1 file

● Skill(validation-review)
  ⎿  Successfully loaded skill

  Listed 1 directory, ran 1 shell command

● I reviewed calc.py with the validation-review skill (read-only) and wrote the report to
  ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/data/leanlive-k6f6ybmx-2/report.md.

  - Finding: calc.py:3 — add(a, b) subtracts (return a - b) even though its docstring says it returns the sum. It should be return a + b. For example, add(2, 3)
    gives -1 instead of 5.
  - Identifiers I could see: project PROJECT_CEDAR, skill SKILL_WILLOW, hook HOOK_BIRCH. No auto-memory identifier was visible.
  - MCP tools: none are available in this session. The project has a .mcp.json file, but no MCP tools were loaded.

  I didn&#x27;t change any project files, run a pipeline

... [1716 bytes truncated] ...

e in this session. A `.mcp.json` file is in the project, but no MCP server tools were loaded.

## Notes
- This was read-only: no project files were changed, no pipeline was run, nothing was published, and no work was delegated.
</pre></details><details><summary>Measured check 3: actual terminal capture and report</summary><pre>
 ▐▛███▛█   Claude Code v2.1.323
▝▜██████▀  Opus 5.5 · Claude API
 ▝▝   ▝▝   ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/pool/.treehouse/project-5379fb/3/project

  Fable 5.2 is here for your longest and toughest coding tasks. It draws down usage faster than Opus 5.5. Switch with /model.

❯ : Firstmate operational input waiting: read
  &#x27;~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/state/operational-inbox/1794567674-a237c7517ff5c5e9.msg&#x27;
  and handle its contents as Firstmate operational input.

  Read 1 file

● Skill(validation-review)
  ⎿  Successfully loaded skill

  Listed 1 directory, ran 1 shell command

● I found one bug in calc.py and wrote the report to
  ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/data/leanlive-k6f6ybmx-3/report.md.

  - Bug: at calc.py:3, add(a, b) returns a - b, so it subtracts even though its docstring says it returns the sum. For example, add(2, 3) gives -1 instead of 5.
    The fix is return a + b. I didn&#x27;t change any project files.
  - Identifiers I could see:
    - Project: PROJECT_CEDAR, from the project&#x27;s CLAUDE.md.
    - Skill: SKILL_WILLOW, from the validation-review skill.
    - Hook: HOOK_BIRCH, from the session-start hook.
    - Auto-memory: none.
  - MCP tools: none are available in this session. The project has a .mcp.json file, but none of its tools showed up.

  My steering inbox had no new messages, only an empty handled folder.

✻ Crunched for 15s · done 12:01 PM












                                                                                                                MCP server blocked by enterprise policy: easel
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ auto mode on (shift+tab to cycle)
</pre><pre># calc.py validation review

## Finding
- calc.py:3 — `add(a, b)` returns `a - b`, not `a + b`. The docstring says &quot;Return the sum of two numbers&quot; but the function subtracts. Example: `add(2, 3)` returns `-1` instead of `5`. Fix: `return a + b`. (Read-only check; no files changed.)

## Identifiers visible
- Project: PROJECT_CEDAR (from project CLAUDE.md)
- Skill: SKILL_WILLOW (from validation-review skill)
- Hook: HOOK_BIRCH (SessionStart:startup hook output)
- Auto-memory: none visible

## MCP tools
- None available in this session. No `mcp__*` tools are loaded or listed as deferred. A `.mcp.json` file is in the project, but none of its servers&#x27; tools showed up.
</pre></details><details><summary>Measured check 4: actual terminal capture and report</summary><pre>▝▜██████▀  Opus 5.5 · Claude API
 ▝▝   ▝▝   ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/pool/.treehouse/project-5379fb/4/project

  Fable 5.2 is here for your longest and toughest coding tasks. It draws down usage faster than Opus 5.5. Switch with /model.

❯ : Firstmate operational input waiting: read
  &#x27;~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/state/operational-inbox/1794567706-957af1682991dbcd.msg&#x27;
  and handle its contents as Firstmate operational input.

  Read 1 file

● Skill(validation-review)
  ⎿  Successfully loaded skill

  Listed 1 directory

● Write(~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/data/leanlive-k6f6ybmx-4/report.md)
  ⎿  Wrote 15 lines to ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/data/leanlive-k6f6ybmx-4/report.md
       1 # calc.py validation review
       2
       3 ## Finding
       4 - `calc.py:3` — `add(a, b)` is documented as &quot;Return the sum of two numbers&quot; but returns `a - b` (subtraction). E.g. `add(2, 3)` returns `-1` in
         stead of `5`. Fix: `return a + b`. (Not modified; read-only check.)
       5
       6 ## Identifiers visible
       7 - Project (CLAUDE.md): PROJECT_CEDAR
       8 - Skill (validation-review): SKILL_WILLOW
       9 - Hook (SessionStart): HOOK_BIRCH
     … +6 lines

● The check is done and the report is written to
  ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/home/data/leanlive-k6f6ybmx-4/report.md.

  - Finding: at calc.py:3, add(a, b) is documented as returning a sum but returns a - b. For example, add(2, 3) gives -1 instead of 5. The fix is return a + b;
    I didn&#x27;t change the file because this was a read-only check.
  - Identifiers I could see:
    - Project (from CLAUDE.md): PROJECT_CEDAR
    - Skill (validation-review): SKILL_WILLOW
    - Hook (session start): HOOK_BIRCH
    - Auto-memory: MEMORY_MAPLE
  - MCP tools: two are available, mcp__validation-server__validation_probe and mcp__easel__chart. I didn&#x27;t call either.

  My steering inbox had no new messages, only an empty handled/ folder. I didn&#x27;t modify any project files, run a pipeline, publish anything or delegate.

✻ Baked for 14s · done 12:02 PM
                                                          tmux focus-events off · add &#x27;set -g focus-events on&#x27; to ~/.tmux.conf and reattach for focus tracking
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
❯ 
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ auto mode on (shift+tab to cycle)
</pre><pre># calc.py validation review

## Finding
- `calc.py:3` — `add(a, b)` is documented as &quot;Return the sum of two numbers&quot; but returns `a - b` (subtraction). E.g. `add(2, 3)` returns `-1` instead of `5`. Fix: `return a + b`. (Not modified; read-only check.)

## Identifiers visible
- Project (CLAUDE.md): PROJECT_CEDAR
- Skill (validation-review): SKILL_WILLOW
- Hook (SessionStart): HOOK_BIRCH
- Auto-memory (MEMORY.md): MEMORY_MAPLE

## MCP tools
Yes, MCP tools are available (listed as deferred tools, none called):
- mcp__validation-server__validation_probe
- mcp__easel__chart
</pre></details>
Evidence: Cache, token, cost, and runtime measurements

Source: Cache, token, cost, and runtime measurements

{
  "environment": "Real Claude Code 2.1.323 using the existing OAuth login, isolated config, actual Treehouse worktrees and private 160x50 tmux server. Same fixture and review request throughout; unique report paths/task IDs differ. No model or effort overrides between lean and ordinary launches.",
  "measurement_notes": "Calls deduplicated by API message ID. Session dollars are the Claude CLI runtime ledger, including automatic permission classifier usage. Dollars/call use only the unchanged main model. These tiny fixture checks measure behavior, not a representative production cost comparison.",
  "checks": [
    {
      "check": 1,
      "lean": true,
      "allowlist": false,
      "main_model": [
        "claude-opus-5-5"
      ],
      "main_model_calls": 5,
      "first_call_total_input": 31874,
      "first_call_cache_create": 7739,
      "first_call_cache_read": 24133,
      "transcript_totals": {
        "input_tokens": 12,
        "output_tokens": 1615,
        "cache_creation_input_tokens": 11099,
        "cache_read_input_tokens": 157705,
        "ephemeral_5m_input_tokens": 11099,
        "ephemeral_1h_input_tokens": 0
      },
      "cli_total_session_dollars": 0.11961300000000002,
      "cli_main_model_dollars": 0.11938400000000002,
      "main_model_dollars_per_call": 0.023876800000000004,
      "cli_main_model_cache_create": 11099,
      "transcript_matches_cli_cache_create": true,
      "loaded_mcp_tool_names": [],
      "native_artifact_tool_names": [
        "ArtifactComments",
        "ArtifactData"
      ],
      "auto_memory_loaded": false,
      "project_instructions_loaded": true,
      "startup_hook_executed": true,
      "normal_stop_hook": "v1 gen=g1794567607.1578559.2798 seq=3 state=idle source=claude-hook event=stop ts=1794567628",
      "process": {
        "pid": 1579709,
        "FORCE_PROMPT_CACHING_5M": "1",
        "CLAUDE_CODE_DISABLE_AUTO_MEMORY": "1",
        "strict_mcp": true,
        "disallow_mcp": true,
        "cwd": "~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/pool/.treehouse/project-5379fb/1/project"
      }
    },
    {
      "check": 2,
      "lean": true,
      "allowlist": true,
      "main_model": [
        "claude-opus-5-5"
      ],
      "main_model_calls": 4,
      "first_call_total_input": 31879,
      "first_call_cache_create": 6258,
      "first_call_cache_read": 25619,
      "transcript_totals": {
        "input_tokens": 10,
        "output_tokens": 1395,
        "cache_creation_input_tokens": 8921,
        "cache_read_input_tokens": 124536,
        "ephemeral_5m_input_tokens": 8921,
        "ephemeral_1h_input_tokens": 0
      },
      "cli_total_session_dollars": 0.0976576,
      "cli_main_model_dollars": 0.0974522,
      "main_model_dollars_per_call": 0.02436305,
      "cli_main_model_cache_create": 8921,
      "transcript_matches_cli_cache_create": true,
      "loaded_mcp_tool_names": [],
      "native_artifact_tool_names": [
        "ArtifactComments",
        "ArtifactData"
      ],
      "auto_memory_loaded": false,
      "project_instructions_loaded": true,
      "startup_hook_executed": true,
      "normal_stop_hook": "v1 gen=g1794567642.1608362.19097 seq=3 state=idle source=claude-hook event=stop ts=1794567659",
      "process": {
        "pid": 1610083,
        "FORCE_PROMPT_CACHING_5M": "1",
        "CLAUDE_CODE_DISABLE_AUTO_MEMORY": "1",
        "strict_mcp": true,
        "disallow_mcp": true,
        "cwd": "~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/pool/.treehouse/project-5379fb/2/project"
      }
    },
    {
      "check": 3,
      "lean": true,
      "allowlist": false,
      "main_model": [
        "claude-opus-5-5"
      ],
      "main_model_calls": 4,
      "first_call_total_input": 31916,
      "first_call_cache_create": 7781,
      "first_call_cache_read": 24133,
      "transcript_totals": {
        "input_tokens": 10,
        "output_tokens": 1516,
        "cache_creation_input_tokens": 10625,
        "cache_read_input_tokens": 123346,
        "ephemeral_5m_input_tokens": 10625,
        "ephemeral_1h_input_tokens": 0
      },
      "cli_total_session_dollars": 0.10835660000000001,
      "cli_main_model_dollars": 0.1081542,
      "main_model_dollars_per_call": 0.02703855,
      "cli_main_model_cache_create": 10625,
      "transcript_matches_cli_cache_create": true,
      "loaded_mcp_tool_names": [],
      "native_artifact_tool_names": [
        "ArtifactComments",
        "ArtifactData"
      ],
      "auto_memory_loaded": false,
      "project_instructions_loaded": true,
      "startup_hook_executed": true,
      "normal_stop_hook": "v1 gen=g1794567673.1635281.21511 seq=3 state=idle source=claude-hook event=stop ts=1794567692",
      "process": {
        "pid": 1636560,
        "FORCE_PROMPT_CACHING_5M": "1",
        "CLAUDE_CODE_DISABLE_AUTO_MEMORY": "1",
        "strict_mcp": true,
        "disallow_mcp": true,
        "cwd": "~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/pool/.treehouse/project-5379fb/3/project"
      }
    },
    {
      "check": 4,
      "lean": false,
      "allowlist": false,
      "main_model": [
        "claude-opus-5-5"
      ],
      "main_model_calls": 4,
      "first_call_total_input": 32788,
      "first_call_cache_create": 8778,
      "first_call_cache_read": 24008,
      "transcript_totals": {
        "input_tokens": 10,
        "output_tokens": 1274,
        "cache_creation_input_tokens": 11654,
        "cache_read_input_tokens": 126106,
        "ephemeral_5m_input_tokens": 0,
        "ephemeral_1h_input_tokens": 11654
      },
      "cli_total_session_dollars": 0.14416479999999998,
      "cli_main_model_dollars": 0.1439732,
      "main_model_dollars_per_call": 0.0359933,
      "cli_main_model_cache_create": 11654,
      "transcript_matches_cli_cache_create": true,
      "loaded_mcp_tool_names": [
        "mcp__easel__chart",
        "mcp__validation-server__validation_probe"
      ],
      "native_artifact_tool_names": [
        "ArtifactComments",
        "ArtifactData"
      ],
      "auto_memory_loaded": true,
      "project_instructions_loaded": true,
      "startup_hook_executed": true,
      "normal_stop_hook": "v1 gen=g1794567705.1659572.9834 seq=3 state=idle source=claude-hook event=stop ts=1794567722",
      "process": {
        "pid": 1663573,
        "FORCE_PROMPT_CACHING_5M": "unset",
        "CLAUDE_CODE_DISABLE_AUTO_MEMORY": "unset",
        "strict_mcp": false,
        "disallow_mcp": false,
        "cwd": "~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-live-k6f6ybmx/pool/.treehouse/project-5379fb/4/project"
      }
    }
  ],
  "lean_mean_cache_create_tokens": 10215,
  "lean_main_model_dollars_per_call": 0.02499926153846154
}
Evidence: Plugin MCP runtime results

Source: Plugin MCP runtime results

[
  {
    "mode": "plain",
    "mcp_tools": [
      "mcp__lean-probe__early",
      "mcp__lean-probe__late"
    ],
    "mcp_instruction_servers": [
      "lean-probe"
    ],
    "plugin_skill_visible": true,
    "completed": true,
    "runtime_hook_events": []
  },
  {
    "mode": "lean",
    "mcp_tools": [],
    "mcp_instruction_servers": [],
    "plugin_skill_visible": true,
    "completed": true,
    "runtime_hook_events": []
  },
  {
    "mode": "lean-allowlisted",
    "mcp_tools": [],
    "mcp_instruction_servers": [
      "lean-probe"
    ],
    "plugin_skill_visible": true,
    "completed": true,
    "runtime_hook_events": []
  }
]
Evidence: Public CLI refusal evidence

Source: Public CLI refusal evidence

[
  {
    "name": "secondmate supervision",
    "command": "bin/fm-spawn.sh lean-sm ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/secondmate --secondmate --claude-lean",
    "exit": 1,
    "output": "fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/home\nerror: --claude-lean does not apply to secondmate supervision sessions\n",
    "meta_created": false,
    "pass_": true
  },
  {
    "name": "non-Claude harness",
    "command": "bin/fm-spawn.sh lean-codex ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/project --scout --harness codex --claude-lean",
    "exit": 1,
    "output": "fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/home\nerror: --claude-lean applies only to the claude harness (this launch is codex)\n",
    "meta_created": false,
    "pass_": true
  },
  {
    "name": "raw command",
    "command": "bin/fm-spawn.sh lean-raw ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/project --scout --claude-lean echo unsafe",
    "exit": 1,
    "output": "fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/home\nerror: --claude-lean applies to a Firstmate-built claude launch, not a raw launch command\n",
    "meta_created": false,
    "pass_": true
  },
  {
    "name": "T3 unsupported backend",
    "command": "bin/fm-spawn.sh lean-t3 ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/project --scout --backend t3code --claude-lean",
    "exit": 1,
    "output": "fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/home\nerror: --claude-lean cannot run on backend=t3code; T3 starts Claude itself and cannot pass --strict-mcp-config. Choose another backend.\n",
    "meta_created": false,
    "pass_": true
  },
  {
    "name": "flag value",
    "command": "bin/fm-spawn.sh lean-value ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/project --scout --claude-lean=1",
    "exit": 1,
    "output": "fm-gate-refuse: gate agent lifecycle permitted only against lab home ~/.no-mistakes/worktrees/7f0ec18181b6/01M7A6XKEDE3MQDMAHTFHQPD5J/.lean-refusals-8iuvq38p/home\nerror: --claude-lean takes no value\n",
    "meta_created": false,
    "pass_": true
  }
]
- Outcome: 🔧 2 issues found → auto-fixed ✅ across 2 runs (25m21s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 5 issues (1 error, 3 warnings, 1 info)
  • 🚨 bin/fm-spawn.sh:3282 - The new lean refusals only run inside fm-spawn, and on a relaunch fm-spawn is called after fm-control has already stopped the running agent. This breaks a rule fm-control states at bin/fm-control.sh:1034-1039: a refusal must happen before the agent is stopped. Concrete sequence: a task is spawned with --claude-lean, so its record has claude_lean=1. The operator then runs bin/fm-control.sh &lt;id&gt; relaunch --harness codex --note ..., the documented way to move a task to another harness, for example after a Claude account hits a limit. resolve_relaunch_profile passes, and do_relaunch calls do_exit, which stops the Claude agent. Only then does fm-spawn.sh --relaunch --harness codex refuse with 'applies only to the claude harness'. relaunch_rollback in the stopping phase reports 'no agent is running', so the task is left with no worker. The same happens when the record holds a bad value (claude_lean=maybe, fm-spawn.sh:3270) and when a secondmate's config/secondmate-harness now resolves to a non-claude harness (CONFIG_HARNESS path). The test test_relaunch_refuses_a_bad_record_and_a_harness_switch (tests/fm-spawn-claude-lean.test.sh) passes even though its stub pane has already received /exit, so the test hides this. Fix at the earliest shared boundary: in resolve_relaunch_profile in bin/fm-control.sh, read claude_lean from the record and refuse a bad value, or a TARGET_HARNESS other than claude, before do_exit, next to the existing fm_control_harness_supports_kind check. Alternatively, removing the sticky record (see the separate finding) removes this failure entirely.
  • ⚠️ bin/fm-spawn.sh:6 - The intent says: "Do not apply it to the main chat, drivers, try copies, or the supervision session, which wait between calls and need the long cache." It limits both ideas to "Claude plan and check workers". The change adds [--claude-lean] to the --secondmate usage line and the header says lean applies to a "ship, scout, secondmate, or relaunch" launch (fm-spawn.sh:499-501). It also adds a test that a lean secondmate succeeds (test_lean_secondmate). A secondmate is a persistent supervising Firstmate instance that waits between calls, which is exactly the long-lived session the intent excludes. Nothing the intent requires needs secondmate support. Suggested remedy: refuse --claude-lean when KIND=secondmate and remove test_lean_secondmate.
  • ⚠️ bin/fm-spawn.sh:7332 - The intent asks only for an opt-in per-launch switch and says "Removing the switch returns the old start." The change also writes a claude_lean=1 line to the task record (fm-spawn.sh:7332) and reads it back on relaunch (fm-spawn.sh:3266-3277). Omitting the flag then 'does not turn the posture off', and there is no flag or fm-control option to turn it off. So for a relaunched task, removing the switch does not return the old start: the only way back is hand-editing state/<id>.meta. Even after that edit, the reused pane shell still has FORCE_PROMPT_CACHING_5M=1 from the earlier pane export (fm-spawn.sh:7902-7904), and an adopted dead endpoint keeps that shell. With the allowlist off, the 'ordinary' replacement would still use the five-minute cache. fm-control relaunch also cannot pass --claude-lean, so turning lean on during a relaunch only works through a direct fm-spawn --relaunch call. Nothing the intent requires needs this persistent state for a trial on three short checks. Suggested remedy: drop the claude_lean record line, its relaunch read-back, the relaunch flag handling, and the related relaunch tests, so a relaunch is lean only when the flag is passed. The pre-stop refusal problem in the first finding lives inside this component, so removing it also fixes that.
  • ℹ️ bin/fm-spawn.sh:7903 - The lean launch sets FORCE_PROMPT_CACHING_5M=1 in three places: an export in the launch command (7814-7816), the env -i allowlist pin (7979-7981), and an extra export FORCE_PROMPT_CACHING_5M=1 sent to the pane shell (7902-7904). The test's 'launch command alone' run shows the launch-command export already reaches the claude process, and the allowlist pin covers env -i. The pane-shell export is not needed for anything the intent requires. Its only lasting effect is that later commands in that pane shell keep the five-minute cache flag after the worker exits, including a later relaunch into the same pane. Suggested remedy: remove the pane export so the setting lives only in the worker's launch environment, as the intent describes.

🔧 Fix applied.
5 issues (1 error, 3 warnings, 1 info) still open:

  • 🚨 bin/fm-spawn.sh:3282 - The new lean refusals only run inside fm-spawn, and on a relaunch fm-spawn is called after fm-control has already stopped the running agent. This breaks a rule fm-control states at bin/fm-control.sh:1034-1039: a refusal must happen before the agent is stopped. Concrete sequence: a task is spawned with --claude-lean, so its record has claude_lean=1. The operator then runs bin/fm-control.sh &lt;id&gt; relaunch --harness codex --note ..., the documented way to move a task to another harness, for example after a Claude account hits a limit. resolve_relaunch_profile passes, and do_relaunch calls do_exit, which stops the Claude agent. Only then does fm-spawn.sh --relaunch --harness codex refuse with 'applies only to the claude harness'. relaunch_rollback in the stopping phase reports 'no agent is running', so the task is left with no worker. The same happens when the record holds a bad value (claude_lean=maybe, fm-spawn.sh:3270) and when a secondmate's config/secondmate-harness now resolves to a non-claude harness (CONFIG_HARNESS path). The test test_relaunch_refuses_a_bad_record_and_a_harness_switch (tests/fm-spawn-claude-lean.test.sh) passes even though its stub pane has already received /exit, so the test hides this. Fix at the earliest shared boundary: in resolve_relaunch_profile in bin/fm-control.sh, read claude_lean from the record and refuse a bad value, or a TARGET_HARNESS other than claude, before do_exit, next to the existing fm_control_harness_supports_kind check. Alternatively, removing the sticky record (see the separate finding) removes this failure entirely.
  • ⚠️ bin/fm-spawn.sh:6 - The intent says: "Do not apply it to the main chat, drivers, try copies, or the supervision session, which wait between calls and need the long cache." It limits both ideas to "Claude plan and check workers". The change adds [--claude-lean] to the --secondmate usage line and the header says lean applies to a "ship, scout, secondmate, or relaunch" launch (fm-spawn.sh:499-501). It also adds a test that a lean secondmate succeeds (test_lean_secondmate). A secondmate is a persistent supervising Firstmate instance that waits between calls, which is exactly the long-lived session the intent excludes. Nothing the intent requires needs secondmate support. Suggested remedy: refuse --claude-lean when KIND=secondmate and remove test_lean_secondmate.
  • ⚠️ bin/fm-spawn.sh:7332 - The intent asks only for an opt-in per-launch switch and says "Removing the switch returns the old start." The change also writes a claude_lean=1 line to the task record (fm-spawn.sh:7332) and reads it back on relaunch (fm-spawn.sh:3266-3277). Omitting the flag then 'does not turn the posture off', and there is no flag or fm-control option to turn it off. So for a relaunched task, removing the switch does not return the old start: the only way back is hand-editing state/<id>.meta. Even after that edit, the reused pane shell still has FORCE_PROMPT_CACHING_5M=1 from the earlier pane export (fm-spawn.sh:7902-7904), and an adopted dead endpoint keeps that shell. With the allowlist off, the 'ordinary' replacement would still use the five-minute cache. fm-control relaunch also cannot pass --claude-lean, so turning lean on during a relaunch only works through a direct fm-spawn --relaunch call. Nothing the intent requires needs this persistent state for a trial on three short checks. Suggested remedy: drop the claude_lean record line, its relaunch read-back, the relaunch flag handling, and the related relaunch tests, so a relaunch is lean only when the flag is passed. The pre-stop refusal problem in the first finding lives inside this component, so removing it also fixes that.
  • ℹ️ bin/fm-spawn.sh:7903 - The lean launch sets FORCE_PROMPT_CACHING_5M=1 in three places: an export in the launch command (7814-7816), the env -i allowlist pin (7979-7981), and an extra export FORCE_PROMPT_CACHING_5M=1 sent to the pane shell (7902-7904). The test's 'launch command alone' run shows the launch-command export already reaches the claude process, and the allowlist pin covers env -i. The pane-shell export is not needed for anything the intent requires. Its only lasting effect is that later commands in that pane shell keep the five-minute cache flag after the worker exits, including a later relaunch into the same pane. Suggested remedy: remove the pane export so the setting lives only in the worker's launch environment, as the intent describes.
  • ⚠️ bin/fm-spawn.sh:75 - This is left over from round 1's fix. The round-1 instruction was to "Drop the claude_lean meta record, its relaunch read-back and relaunch flag handling and their tests". The fixer removed the record, the read-back, the pane export and the relaunch tests. It did not remove the flag on relaunch: fm-spawn.sh &lt;id&gt; --relaunch ... [--claude-lean] is still advertised in the usage line (bin/fm-spawn.sh:75) and still accepted, and a direct fm-spawn --relaunch --claude-lean produces a lean replacement. docs/configuration.md:1472 also says omitting the flag restores the ordinary start "including on relaunch", which treats lean-on-relaunch as supported. No test covers this path any more. fm-control's relaunch (bin/fm-control.sh:1267) never forwards the flag, so only a direct fm-spawn relaunch can reach it. The intent ("the next 3 Claude code checks") does not need it. The round-1 instruction's closing clause ("so a launch is lean only when the flag is passed on that launch") could be read as allowing a per-launch flag on relaunch, so ask which reading was meant. If relaunch support is not wanted, the remedy is to refuse --claude-lean when RELAUNCH=1, drop it from the usage line at bin/fm-spawn.sh:75, and drop "including on relaunch" from docs/configuration.md:1472. If it is wanted, keep it as is.
🔧 **Test** - 2 issues found → auto-fixed ✅
  • 🚨 bin/fm-spawn.sh:7512 - The lean launch does not exclude all MCP tools. In two independent disposable labs using real Claude Code 2.1.323, the third lean worker registered mcp__easel__chart from cc-plugin-easel despite receiving --strict-mcp-config. The runtime transcript records both deferred_tools_delta and mcp_instructions_delta for easel, so this is not merely the model claiming a tool exists. Project-configured MCP was excluded successfully, but plugin registration bypassed this boundary. Extend the per-launch exclusion to plugin-provided MCP tools while preserving required hooks and skills, and verify it against the real Claude consumer.
  • 🚨 live validation verdict: no-go (7 of 7 scenarios were driven live against the product); failed: Plugin-provided MCP tools remain unavailable throughout a lean check
  • Live validation: ❌ no-go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Three short lean code checks finish normally with the same model, project instructions, hooks, and review skill ✅ pass live measured/check-{1,2,3}-transcript.jsonl, reports, and busy-state records
Five-minute caching reaches Claude through ordinary and cleared launch environments ✅ pass live measurements.json: all three lean checks recorded only five-minute cache writes, including the env-i allowlist launch
Lean workers omit auto-memory and project-configured MCP while retaining required startup context ✅ pass live Runtime instruction attachments omit AutoMem for lean checks; ordinary check loads MEMORY_MAPLE and validation-server
Plugin-provided MCP tools remain unavailable throughout a lean check ❌ fail live measured/check-3-transcript.jsonl and runtime-tool-discovery.json show mcp__easel__chart registering
Omitting the switch restores an ordinary launch without a persisted lean task choice ✅ pass live measurements.json check 4: lean variables unset, strict MCP disabled, memory and project MCP restored, cache writes use one-hour TTL
Secondmate, non-Claude, raw-command, T3, and valued-flag requests refuse before launching ✅ pass live refusals.json: all five commands refused without creating task metadata
Transcript token splits and Claude's cost ledger provide measured trial results ✅ pass live measurements.json: mean lean cache creation 9,179 tokens/session; main-model cost $0.02227/call
  • bash tests/fm-spawn-claude-lean.test.sh
  • claude --version and claude auth status
  • python3 ~/.no-mistakes/evidence/01M7A6XKEDE3MQDMAHTFHQPD5J/drive-lean.py
  • python3 ~/.no-mistakes/evidence/01M7A6XKEDE3MQDMAHTFHQPD5J/drive-refusals.py
  • python3 ~/.no-mistakes/evidence/01M7A6XKEDE3MQDMAHTFHQPD5J/drive-measured.py
  • python3 ~/.no-mistakes/evidence/01M7A6XKEDE3MQDMAHTFHQPD5J/summarize.py
  • Verified transcript totals against Claude's runtime cost ledger and normal Stop-hook records; removed disposable labs and checked git status --short.

🔧 Fix applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Three lean Claude code checks finish normally using five-minute cache writes and the same model ✅ pass live round2/measurements.json; round2/live-validation.html
Clearing the worker environment preserves the lean cache and memory settings ✅ pass live round2/measured/check-2-process.json; round2/measured/check-2-transcript.jsonl
Lean checks omit auto-memory while retaining project instructions, requested skills, and working hooks ✅ pass live round2/measurements.json; round2/measured/check-1-report.md
Lean workers exclude configured MCP tools that remain available to an ordinary worker ✅ pass live round2/measured/check-1-transcript.jsonl; round2/measured/check-4-transcript.jsonl
Plugin MCP tools remain unavailable after startup and mid-turn registration attempts, including an inherited server allowlist ✅ pass live round2/plugin-runtime-summary.json; round2/plugin-lean-runtime.jsonl; round2/focused-test.log
Omitting the flag restores one-hour cache writes, auto-memory, and MCP tools without persisting lean metadata ✅ pass live round2/measurements.json; round2/measured/check-4-report.md
Secondmate, non-Claude, raw-command, unsupported-backend, and valued-flag requests refuse before creating task records ✅ pass live round2/refusals.json
  • bash ~/.no-mistakes/evidence/01M7A6XKEDE3MQDMAHTFHQPD5J/round2/run-focused.sh — targeted regression with FM_CLAUDE_LEAN_LIVE=1; repeated to preserve runtime transcripts
  • python3 ~/.no-mistakes/evidence/01M7A6XKEDE3MQDMAHTFHQPD5J/round2/drive-measured.py — three lean reviews and one ordinary control through real fm-spawn, Claude, and isolated 160×50 tmux panes
  • python3 ~/.no-mistakes/evidence/01M7A6XKEDE3MQDMAHTFHQPD5J/round2/drive-refusals.py — five public CLI refusal cases
  • python3 ~/.no-mistakes/evidence/01M7A6XKEDE3MQDMAHTFHQPD5J/round2/summarize.py — generated measurements and rendered terminal evidence
  • python3 ~/.no-mistakes/evidence/01M7A6XKEDE3MQDMAHTFHQPD5J/round2/verify-evidence.py — verified saved runtime behavior and cost records
  • Removed disposable labs and test caches; git status --short was clean.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

peterOC26 and others added 4 commits November 13, 2026 11:21
--claude-lean records a per-task posture that sets the five-minute prompt cache and starts Claude without MCP servers or auto memory. Ordinary launches stay unchanged, and a relaunch keeps the recorded choice.
@peterOC26
peterOC26 merged commit ac22532 into main Nov 13, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant