{"schemaVersion":"1.0","publication":{"slug":"pivot-claude-code","name":"Claude Code Review","description":"Workflows, releases, and field notes for Anthropic's coding agent.","audience":"Developers and teams adopting Claude Code.","geography":null},"edition":{"id":"c927d8ed-e8c4-46f4-8e39-1a184276c5d2","date":"2026-10-12","status":"locked","createdAt":"2026-10-11T15:45:13.916Z","storyCount":9,"newsletterSubject":"Handoff files keep Claude projects coherent, Managed Agents write multi-agent workflows, Free security scans for open-source maintainers"},"updatedAt":"2026-10-11T15:31:34.315Z","stories":[{"id":"621f99a2-d311-45d5-aa60-f06291edcdb2","title":"Two handoff-file habits aim to keep Claude Code projects coherent across sessions","dek":"A short notes file that Claude rereads at the start of each session is said to cut context use and avoid compaction, and a GitHub repo (a shared folder where a project's code lives) wraps the idea in two commands. Context use is how much of Claude's limited working memory for a conversation gets used up, which you can save by keeping notes short. Compaction is Claude automatically squeezing a long conversation into a summary to free up space, which can lose details you were relying on.","bodyMd":"Both techniques below attack the same problem in Claude Code: a new session starts with no memory of the last one, and long chats get compacted or become expensive to carry. Each keeps a small written record of project state that Claude reads at the start of the next session.\n\n**A HANDOFF.md file maintained through CLAUDE.md.** One X post suggests adding an instruction to the project's CLAUDE.md: Claude must maintain a HANDOFF.md file describing current status, what is done, next steps, open decisions and gotchas, and must update it at milestones and before a session ends. The author says this gives Claude a small snapshot to consult at the start of every new chat, which keeps context intact while avoiding compaction. The author also says it lowers overall context usage, makes requests cheaper and avoids expensive cache writes when a session exceeds the cache's time limit. They report good results with Opus 5.5, Anthropic's model, and say it often stretches their subscription usage. That is one user's account, not a measured result.\n\n**A reusable workflow repo with /session-start and /handoff.** A Reddit post in r/ClaudeCode describes a GitHub repo, built by a developer after a year of daily Claude Code use, that the developer now applies to every new project. Each session begins from a short context covering what was done recently, what is being built, what has already been decided (so Claude does not rediscover or \"fix\" it) and which tasks are queued. Old session notes are archived so they stop eating context, and a lessons file collects recurring bugs and tool quirks that every session loads.\n\nTwo commands drive it: `/session-start` when you sit down and `/handoff` before you stop. Before trusting the notes, `/session-start` checks them against git, open pull requests and running jobs, and flags where they are wrong. The developer says it works on Linux, macOS and Windows, for one repo or a folder of several.\n\nTo adopt it, clone `https://github.com/truongfelix/workflow.git`, run `workflow/bin/adopt.sh` on your project directory, then tell Claude to follow \"Adopt in a new project\" in the repo's README.\n\n**A short Instagram reel on the same habit.** A third post frames a simple handoff system as a way to avoid context rot (quality drifting as a long session fills up), saying it helps Claude stay focused and avoid repeated mistakes. The details sit in a guide offered to commenters, so there is no further technique to report.","status":"published","storyType":"roundup","category":"Workflow","clusterKey":"session-handoff-workflow-files","slug":"two-handoff-file-habits-aim-to-keep-claude-code-projects-coherent-across-621f99","url":"https://claudecodereview.ai/a/two-handoff-file-habits-aim-to-keep-claude-code-projects-coherent-across-621f99/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/621f99a2-d311-45d5-aa60-f06291edcdb2","role":"lead","position":0,"imageStatus":"ready","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/two-handoff-file-habits-aim-to-keep-claude-code-projects-coherent-across-621f99/0de4580c27bda271-7a5fe913bf6c6d36/web_hero.webp","imageAlt":"A stack of five small rectangular blocks lifted out of a larger, disorganized pile of fragments.","createdAt":"2026-10-11T04:06:58.726Z","updatedAt":"2026-10-11T04:31:08.646Z","sources":[{"role":"primary","title":"A Year of Daily Claude Code Use Distilled Into a Reusable Session Workflow","url":"https://reddit.com/r/ClaudeCode/comments/1x2os3k/ive_used_claude_code_every_day_for_a_year_this_is","sourceName":"u/Bill-Negative","author":"u/Bill-Negative","publishedAt":"2026-10-10T20:09:52Z"},{"role":"supporting","title":"Multi-Session Context Workflow Keeps Claude Code Projects Coherent Over Time","url":"https://reddit.com/r/ClaudeWorkflows/comments/1x2td6q/workflow_multisession_context_management_workflow","sourceName":"/u/ClaudeAI-mod-bot","author":"/u/ClaudeAI-mod-bot","publishedAt":"2026-10-10T23:39:37Z"},{"url":"https://x.com/ishuagra02/status/2108891293749526823","title":null,"sourceName":"x.com","author":"Ishu Agrawal","publishedAt":"2026-10-10T12:04:00.000Z","role":"supporting"},{"url":"https://instagram.com/reel/DeRgZlhJngj","title":null,"sourceName":"instagram.com","author":"@joestoltelive","publishedAt":"2026-10-09T12:30:16.000Z","role":"supporting"}]},{"id":"2361e0ed-a35b-4434-963c-530d0e0678a9","title":"Claude Managed Agents can now write and run their own multi-agent workflows","dek":"Anthropic's new beta lets an agent split a big job, such as reviewing hundreds of documents, across many agents in phases and merge what they find.","bodyMd":"Anthropic's Claude Managed Agents, Anthropic's agent product, now supports dynamic workflows in beta. The platform release notes dated October 9 say an agent handling work with many pieces, such as reviewing hundreds of documents, can write a workflow. A workflow is a program that runs many agents in phases and combines their results.\n\nThe server runs it in the background as a workflow run. Teams opt in through the managed-agents-2026-04-01 beta header and by setting the agent's multiagent field to `{\"type\": \"multiagent_20261001\", \"workflows\": {\"type\": \"enabled\"}}`. Anthropic says to guide the agent by telling it in its system prompt when to start a run. Progress shows up as workflow_run.* events on the session's event stream.\n\nClaude Code users have a shortcut. The ClaudeDevs account on X points to `/claude-api managed-agents-onboard bug-hunter` as a starting point, plus templates at platform.claude.com/agent-quickstart.\n\nOne builder reported pointing the feature at 18,000 lines of code and getting 21 proven bugs in about five minutes for $8.36, paid from Claude Max API credits. The builder described the pattern as a lead agent writing a plan, running it across many agents in phases, then merging the results. The same post adds that it burns tokens fast.\n\nThe ClaudeDevs account gives similar advice. It says dynamic workflows are powerful and can use a lot of tokens, so it suggests starting with a scoped task and increasing complexity step by step. For teams budgeting agent spend, that makes the first runs a cost test as much as a capability test.","status":"published","storyType":"news","category":"Release","clusterKey":"claude-code-dynamic-workflows-1000-agents","slug":"claude-managed-agents-can-now-write-and-run-their-own-multi-agent-workfl-2361e0","url":"https://claudecodereview.ai/a/claude-managed-agents-can-now-write-and-run-their-own-multi-agent-workfl-2361e0/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/2361e0ed-a35b-4434-963c-530d0e0678a9","role":"item","position":1,"imageStatus":"ready","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/claude-managed-agents-can-now-write-and-run-their-own-multi-agent-workfl-2361e0/77005026a550fe48-c46b5782a82c59e6/web_hero.webp","imageAlt":"A diagram showing a lead agent block branching into four sub-agent blocks, which then merge back into one final result block.","createdAt":"2026-10-10T23:01:52.940Z","updatedAt":"2026-10-10T23:31:51.253Z","sources":[{"url":"https://x.com/ClaudeDevs/status/2108591334449684643","title":null,"sourceName":"x.com","author":"ClaudeDevs","publishedAt":"2026-10-09T16:12:04.000Z","role":"primary"},{"url":"https://platform.claude.com/docs/en/release-notes/overview#october-9-2026","title":null,"sourceName":"platform.claude.com","author":"Claude Platform release notes","publishedAt":"2026-10-09T12:00:00.000Z","role":"primary"},{"url":"https://x.com/daniel_mac8/status/2108640573724786970","title":null,"sourceName":"x.com","author":"Dan McAteer","publishedAt":"2026-10-09T19:27:44.000Z","role":"primary"}]},{"id":"73f67827-2161-4270-bbc5-d2ad1e077794","title":"Anthropic opens free security scans to the people who maintain open-source software","dek":"Maintainers, who run publicly shared software projects, can now apply to have Claude scan a project's code folder (its repository) for security holes and draft fixes at no charge. This refers to software whose code is shared publicly so anyone can view, use and contribute to it.","bodyMd":"Anthropic is offering free, self-serve, Claude-powered vulnerability scans to ordinary open-source maintainers. Startup Fortune reported the change on October 8. It extends access beyond the large foundations invited into the Project Glasswing pilot.\n\nMaintainers can apply for expedited access and run scans of a full repository or of targeted directories. The scans trace how data moves through the code, flag weaknesses across connected components, and generate draft patches for the maintainer to review. Anthropic describes a multi-stage verification pipeline that each finding passes through before a person sees it. That step is meant to cut the false-positive noise (alerts about problems that aren't real) that has long plagued automated scanners.\n\nA companion Claude Security plugin for Claude Code is now in beta. It adds a slash command, a typed shortcut inside Claude Code, that launches a team of Claude agents against your changes before you commit them.\n\nAnthropic's security tooling has been building for most of the year. Claude Code Security launched in February as a limited research preview for Enterprise and Team customers, built on Claude Opus 4.6, and reached public beta in April. Startup Fortune says it traces data flow across a codebase rather than matching known patterns the way Snyk, GitHub's CodeQL or Dependabot do. Project Glasswing, which paired an unreleased model called Claude Mythos Preview with partners including AWS, Google, Microsoft and the Linux Foundation, has passed 23,000 findings across more than 1,000 projects, according to the report. Anthropic says it confirmed 90.6% of what the model flagged.\n\nIt does not replace the tools maintainers already run. Startup Fortune cites independent comparisons from earlier this year: Claude Security scans take minutes rather than the seconds CodeQL needs, and cost roughly $5 to $25 each on pay-per-token pricing. In one fintech test, Claude's scanner caught three real issues that CodeQL and Semgrep missed, including a timing attack and a race condition, but also produced a dozen false positives.\n\nThe open question is data. Startup Fortune says Anthropic has not published detailed terms on data retention or on whether scan results or the code itself feed back into model training. In Startup Fortune's view, that silence will matter more to maintainers than any detection benchmark, and it notes that a free tool that reads an entire codebase, by definition, has that entire codebase.","status":"published","storyType":"news","category":"Release","clusterKey":"claude-code-security-free-oss-scans","slug":"anthropic-opens-free-security-scans-to-the-people-who-maintain-open-sour-73f678","url":"https://claudecodereview.ai/a/anthropic-opens-free-security-scans-to-the-people-who-maintain-open-sour-73f678/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/73f67827-2161-4270-bbc5-d2ad1e077794","role":"item","position":2,"imageStatus":"ready","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/anthropic-opens-free-security-scans-to-the-people-who-maintain-open-sour-73f678/c1c95408e9616d38-0fe0c3e5857ecdd6/web_hero.webp","imageAlt":"A folder lifted from a row of folders is shown as four ranked tiers funnelling into a single exit point.","createdAt":"2026-10-10T00:31:53.094Z","updatedAt":"2026-10-10T01:02:50.261Z","sources":[{"role":"primary","title":"Anthropic Opens Free AI Security Scans to All Open Source Maintainers","url":"https://startupfortune.com/anthropic-offers-free-ai-security-scans-for-open-source-as-claude-code-faces-scrutiny","sourceName":"\"when:7d \"Claude Code\" Anthropic\" - Google News","author":"\"when:7d \"Claude Code\" Anthropic\" - Google News","publishedAt":"2026-10-08T23:01:13Z"}]},{"id":"e157b41a-ffef-49af-9d5e-821d7c33040c","title":"A walkthrough routes Claude Code searches and log reading to cheaper Haiku 5.5 helpers","dek":"A walkthrough shows how to hand narrow jobs to Haiku 5.5 through subagents, the side helpers Claude Code spawns, so Opus 5.5 only runs the hard parts.","bodyMd":"A recent walkthrough lays out a way to cut Claude Code spending: send codebase searches, test runs, log reading and repetitive checks to Claude Haiku 5.5 subagents, and keep planning and multi-file edits on Opus 5.5 or Sonnet 5.5. Subagents are separate helper agents that Claude Code starts for a side task and that report back to the main session.\n\nThe price gap is the draw. Anthropic released Haiku 5.5 on October 7. For prompts up to 100K tokens (tokens are the chunks of text a model reads and bills for) it costs $0.10 per million input tokens and $0.50 per million output. Sonnet 5.5 costs $2 and $10, a 20x difference on both sides. Anthropic's launch post says Sonnet 5.5 and Opus 5.5 \"remain better choices for complex agentic coding tasks,\" and points Haiku at work like \"compaction, summarization, or subagent work.\" On Terminal-Bench 4.0, Haiku 5.5 scores 39.2% against Sonnet 5.5's 70.6%.\n\nThe walkthrough's rule of thumb: if a task has a clear input, a clear output, and a wrong answer only means looking again, it can go to Haiku. Search, running tests and reporting only failures, pulling relevant lines from long logs, and extracting every env var or route across many files qualify. Planning, dependent multi-file edits, subtle debugging and security review stay on the bigger model. The author adds that Haiku 5.5's safeguards still block penetration testing techniques, per Anthropic.\n\nThe biggest single change is Explore, Claude Code's built-in read-only search subagent. According to the subagent docs, Explore runs on the main conversation's model, so a session on Opus does its \"look around the codebase\" steps on Opus too. A user or project subagent named Explore overrides the built-in one and keeps its own model field. Dropping a `.claude/agents/explore.md` file with `model: haiku` and editing tools disallowed moves searches over. If the agents folder did not exist when the session started, restart Claude Code.\n\nThe same pattern covers a test-runner subagent told to report failures and not fix anything, with `maxTurns` capping how long it wanders. Hitting the cap returns partial output that Claude can resume. The walkthrough also shows a pre-deploy sweep that checks which pages lack basic metadata and returns a table.\n\nSeveral settings can quietly undo the savings. The `haiku` alias resolves to Haiku 5.5 only on the Anthropic API. On Claude Platform on AWS, Amazon Bedrock, Google Cloud's Agent Platform and Microsoft Foundry it still points to Haiku 4.5, so those users need to set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to the provider's Haiku 5.5 ID. The docs call for Claude Code v2.1.293 or later.\n\nThe author advises against `CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1`, which pushes every subagent onto one model and ignores model fields in definitions. That would put the general-purpose subagent, which makes code changes, on the model Anthropic calls weaker at complex agentic coding. Setting `CLAUDE_CODE_SUBAGENT_MODEL` alone does not move Explore either. The resolution order is the model Claude passes for the call, then the definition's model field, then that variable, then the main model.\n\nTwo caveats apply. Above 100K tokens per prompt, Haiku 5.5 input rises to $0.50 per million and output to $2.50, and a newer tokenizer counts the same text as roughly 30% more tokens than Haiku 4.5. And at `effort: low`, Anthropic's prompting guide warns the model is more likely to skip a search, stop early or skip a check. Haiku 5.5 defaults to medium in Claude Code. Running `/tasks` on v2.1.242 or later shows which model each active subagent uses; the author suggests checking it once after setup to confirm the alias resolved as expected.","status":"published","storyType":"news","category":"Workflow","clusterKey":"haiku-5-5-subagent-routing","slug":"a-walkthrough-routes-claude-code-searches-and-log-reading-to-cheaper-hai-e157b4","url":"https://claudecodereview.ai/a/a-walkthrough-routes-claude-code-searches-and-log-reading-to-cheaper-hai-e157b4/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/e157b41a-ffef-49af-9d5e-821d7c33040c","role":"item","position":3,"imageStatus":"ready","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/a-walkthrough-routes-claude-code-searches-and-log-reading-to-cheaper-hai-e157b4/bc8b81a46b87eaa2-4d17aef0b97f0189/web_hero.webp","imageAlt":"A diagram shows a main central node branching down into three levels of smaller nodes, with four identical bottom-tier nodes highlighted in a solid color to represent delegated subagent tasks.","createdAt":"2026-10-11T15:26:21.143Z","updatedAt":"2026-10-11T15:31:34.315Z","sources":[{"role":"primary","title":"Claude Haiku 5.5 Is Built for Subagents. Here’s How I Route Claude Code Work to It.","url":"https://medium.com/@vishalchauhan19600/claude-haiku-5-5-is-built-for-subagents-heres-how-i-route-claude-code-work-to-it-127f3a9f7a57?source=rss------claude_code-5","sourceName":"Vishal chauhan","author":"Vishal chauhan","publishedAt":"2026-10-11T09:37:01Z"}]},{"id":"1744edc9-b47b-401b-afe5-ec065b99710a","title":"Claude Code hooks can run a prompt proofreader every time, where a skill may be skipped","dek":"A developer moved some Claude Code skills into hooks, small programs that run on every prompt before the model sees it, so the logic cannot be forgotten or skipped.","bodyMd":"A developer who builds Claude Code skills says some of them failed in the same way: Claude decides whether a skill applies. Sometimes it forgets, sometimes it reads the skill and follows only part of it, and in long sessions the instructions can be lost when the conversation is compacted.\n\nThe fix was to move that logic into what the developer calls mods: function hooks that Claude Code runs on every prompt, before the model sees it. Because a hook is code, it runs every time, and nothing needs to be remembered or requested.\n\n**The example: grammar-fix**\n\nThe developer's grammar-fix mod corrects the spelling and grammar of every English prompt. The flow:\n\n1. You type your prompt, typos and all.\n2. The hook sends it to Haiku, with proofreading instructions. The developer calls this a cheap call.\n3. Haiku returns the corrected text plus a list of fixes.\n4. Claude gets the clean prompt, and you see the changes as ❌ → ✅ lines.\n\nCode, paths, URLs and commands are never touched.\n\n**Why the developer prefers it to a skill**\n\n- It always runs. A skill is a suggestion Claude may or may not pick up.\n- Fewer tokens on the main model. A skill puts its instructions into context. Here a Haiku call does the proofreading, and Opus or Sonnet only see the final clean prompt.\n- Better downstream reasoning, since Claude works from a clear prompt instead of guessing at a messy one.\n- Compaction can't drop it, because the logic never sits in the context. It runs before it.\n\nThe same repository includes georgian-bridge, which translates Georgian prompts into English for Claude to reason in while you still see your original message. The idea is the same: deterministic preprocessing instead of hoping the model follows instructions.\n\n**Install**\n\nBoth need Claude Code v2.1.275 or later. Each installs with `/plugin install` followed by the plugin name (grammar-fix or georgian-bridge) and a `--marketplace` flag pointing at the developer's repository; the developer's post lists the exact commands.","status":"published","storyType":"tip","category":"Workflow","clusterKey":"mods-instead-of-skills-reliability","slug":"claude-code-hooks-can-run-a-prompt-proofreader-every-time-where-a-skill-1744ed","url":"https://claudecodereview.ai/a/claude-code-hooks-can-run-a-prompt-proofreader-every-time-where-a-skill-1744ed/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/1744edc9-b47b-401b-afe5-ec065b99710a","role":"item","position":4,"imageStatus":"ready","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/claude-code-hooks-can-run-a-prompt-proofreader-every-time-where-a-skill-1744ed/7ffb2b83d74bdb05-ce15de3d4c5b5613/web_hero.webp","imageAlt":"A diagram shows jagged shapes moving across a bridge from a disorganized group into an ordered group where they are refined into smooth, uniform shapes.","createdAt":"2026-10-08T15:52:16.508Z","updatedAt":"2026-10-08T16:02:24.537Z","sources":[{"role":"primary","title":"I stopped writing skills for some things and started using mods (hooks). They're more reliable and use fewer tokens.","url":"https://reddit.com/r/claudeskills/comments/1wzboi5/i_stopped_writing_skills_for_some_things_and","sourceName":"r/claudeskills · u/kakha13","author":"r/claudeskills · u/kakha13","publishedAt":"2026-10-06T19:23:46Z"}]},{"id":"592629f6-187e-4137-993f-1aa15642fe7f","title":"Adding a personal CLAUDE.local.md can silently stop Claude Code from reading your team's AGENTS.md","dek":"Claude Code has used AGENTS.md as project instructions since v2.1.277, but a CLAUDE.local.md counts as a CLAUDE.md for the check, so the shared file is skipped with no error.","bodyMd":"Claude Code has been able to use AGENTS.md as its project instructions since v2.1.277 (September 18), so a repo set up for Codex or Cursor works without a CLAUDE.md. According to a developer's reading of the Claude Code docs, the rules for which file gets read are worth knowing, because a couple of them fail silently.\n\n**Default behavior**\n\n- AGENTS.md only, with no CLAUDE.md at or above your working directory: Claude reads AGENTS.md.\n- Both AGENTS.md and a CLAUDE.md: Claude reads CLAUDE.md only, and AGENTS.md is ignored.\n- A CLAUDE.md that imports `@AGENTS.md`: Claude reads both, through the import.\n\n**The trap**\n\nCLAUDE.local.md counts as a CLAUDE.md for that check. On a team repo that relies on AGENTS.md, adding a CLAUDE.local.md for personal, uncommitted notes means Claude stops reading AGENTS.md for you. Everyone else on the team still gets it. Nothing errors.\n\n**Files that don't change the outcome**\n\nYour `~/.claude/CLAUDE.md`, your org's managed CLAUDE.md and `.claude/rules/` files don't count for the check and still load alongside AGENTS.md. Claude never reads AGENTS.local.md, AGENTS.override.md or anything under a `.agents/` directory, so if another tool on your team uses those, Claude won't see them.\n\n**How to check and fix it**\n\nIn an interactive session, when AGENTS.md is used you get a line like \"no CLAUDE.md found; AGENTS.md loaded: /path/AGENTS.md\". The fix for CLAUDE.md taking precedence over AGENTS.md is to have Claude Code read both files every time: set `/config` > Project instructions > `claude-md-and-agents-md`. Each directory's CLAUDE.md loads first, then its AGENTS.md, and a file already pulled in by an import or symlink isn't loaded twice.\n\nThe older route still works: a one-line CLAUDE.md containing `@AGENTS.md`.\n\n**Caveat**\n\nSome sessions can't read AGENTS.md at all and fall back to CLAUDE.md only. In those, the Project instructions option doesn't appear in `/config`.","status":"published","storyType":"tip","category":"Workflow","clusterKey":"agents-md-personal-file-override","slug":"adding-a-personal-claude-local-md-can-silently-stop-claude-code-from-rea-592629","url":"https://claudecodereview.ai/a/adding-a-personal-claude-local-md-can-silently-stop-claude-code-from-rea-592629/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/592629f6-187e-4137-993f-1aa15642fe7f","role":"item","position":5,"imageStatus":"ready","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/adding-a-personal-claude-local-md-can-silently-stop-claude-code-from-rea-592629/2dce2e810770fa46-7afdc45427c7d8b3/web_hero.webp","imageAlt":"Two rectangular sheets are shown; one is being blocked and pushed aside by the other.","createdAt":"2026-10-11T15:27:25.065Z","updatedAt":"2026-10-11T15:31:14.916Z","sources":[{"role":"primary","title":"Claude Code reads AGENTS.md now, but one personal file you might add for yourself quietly switches that off","url":"https://reddit.com/r/ChatGPTCoding/comments/1x0odt7/claude_code_reads_agentsmd_now_but_one_personal","sourceName":"r/ChatGPTCoding · u/Ok_Negotiation_2587","author":"r/ChatGPTCoding · u/Ok_Negotiation_2587","publishedAt":"2026-10-08T11:23:59Z"}]},{"id":"75cf309d-582d-4566-bd13-cc7ebfa8f44d","title":"A typo in a Claude Code safety script's path can silently switch the safeguard off","dek":"Claude Code lets you attach your own scripts (hooks) that run before or after it uses a tool, and for most events a script must finish with the number 2 to block the action.","bodyMd":"Claude Code hooks are small scripts of your own that the tool runs automatically around its actions, such as before it executes a shell command. A hook tells Claude Code what to do through its exit code, the number a script returns when it finishes. According to a roundup of 11 hook techniques checked against the official docs (changelog head v2.1.292), for most events a hook blocks the action only when it exits with code 2. Exit 1, the usual Unix failure code, is a non-blocking error: Claude Code shows a hook error notice and the action goes ahead.\n\nA wrong script path makes the shell exit 127, which is also non-blocking. So a typo in `settings.json` silently turns your guard off. The article's advice is to watch for the hook error notice on the first run.\n\nA working blocker looks like this, as a PreToolUse hook on Bash:\n\n```bash\n#!/bin/bash\n#.claude/hooks/block-rm.sh\ncmd=$(jq -r '.tool_input.command')\nif [[ \"$cmd\" == rm* ]]; then\n echo \"Blocked: rm commands are not allowed\" >&2\n exit 2 # blocks the tool call; stderr goes to Claude as the reason\nfi\nexit 0\n```\n\nTwo exceptions to the exit-code rule: any non-zero exit from WorktreeCreate fails worktree creation, and PermissionRequest ignores exit 2 entirely (deny through its JSON decision object instead). Hooks can also block through JSON decisions, such as a PreToolUse `\"permissionDecision\": \"deny\"` or a Stop `\"decision\": \"block\"`.\n\n**Filter by arguments with `if`.** The matcher only sees the tool name. Add an `if` field to a handler, using permission-rule syntax, to match the tool's arguments:\n\n```json\n{\n \"matcher\": \"Bash\",\n \"hooks\": [\n {\n \"type\": \"command\",\n \"if\": \"Bash(git push *)\",\n \"command\": \"\\\"$CLAUDE_PROJECT_DIR\\\"/.claude/hooks/check-branch.sh\"\n }\n ]\n}\n```\n\nFor Bash, each subcommand is checked, so `npm test && git push` still matches `Bash(git *)`, and commands inside `$()` are checked too. `if` works only on tool events (PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, PermissionDenied). On any other event, a handler with `if` never runs. It takes one rule per handler, and the docs call it best-effort. For a hard rule, use a permission deny rule.\n\n**Matchers read as exact strings until they don't.** A matcher made only of letters, digits, `_`, `-`, spaces, commas and `|` is an exact match or list. Anything else is an unanchored JavaScript regex. So `mcp__memory` matches no tool, because real names look like `mcp__memory__create_entities`; write `mcp__memory__.*`. `Edit.*` also matches NotebookEdit, so use `^Edit$` for one tool. Tools from plugin-bundled MCP servers are named `mcp__plugin_<plugin>_<server>__<tool>`, so a matcher using the bare server name never fires for them.\n\n**Other techniques in the roundup:**\n\n- **Restore context after compaction.** SessionStart fires again after compaction with source `compact`, and plain stdout is added to Claude's context. Use matcher `compact`. CLAUDE.md remains the better home for context that never changes.\n- **Keep Claude working from a Stop hook.** Return `\"decision\": \"block\"` with a reason, or exit 2 with the reason on stderr. Check `stop_hook_active` in the input. After 8 consecutive stop-hook continuations, Claude Code ends the turn anyway (`CLAUDE_CODE_STOP_HOOK_BLOCK_CAP` raises the cap). Read `last_assistant_message` rather than `transcript_path`, which is written asynchronously.\n- **Let a model judge \"done\".** A `prompt` handler sends the hook input to a model and expects `{\"ok\": true}` or `{\"ok\": false, \"reason\": \"...\"}`. On Stop, `ok: false` continues the turn; `impossible: true` lets it end. Prompt hooks time out after 30 seconds by default.\n- **Rewrite inputs and outputs.** PreToolUse can return `updatedInput`, which replaces the whole input object. PostToolUse can return `updatedToolOutput`, which changes only what Claude reads, since the command already ran. If two hooks rewrite the same input, the last to finish wins.\n- **Deny beats bypass.** A PreToolUse `\"permissionDecision\": \"deny\"` blocks the call even in `bypassPermissions` mode or with `--dangerously-skip-permissions`. A hook's allow cannot override a deny rule in settings. Precedence among disagreeing hooks is deny > defer > ask > allow.\n- **Carry environment along.** SessionStart, Setup, CwdChanged and FileChanged hooks get a `CLAUDE_ENV_FILE` path; lines written there apply before each later Bash command, for example `direnv export bash > \"$CLAUDE_ENV_FILE\"`.\n- **Run in the background.** `\"async\": true` runs a command hook without blocking. `\"asyncRewake\": true` wakes Claude if the hook exits 2. Hooks have no controlling terminal, so return notification escape codes in `terminalSequence` instead of writing to `/dev/tty`.\n- **Declare hooks in a skill.** Skill frontmatter can register hooks for the session; `once: true` removes one after its first successful run.\n\n**Debugging.** `/hooks` lists every configured hook and its source. stderr from a hook that exits 0 never reaches the transcript, so run `claude --debug` and read `~/.claude/debug/<session-id>.txt`. If JSON output \"does nothing\", check that stdout contains only the JSON object, since a shell profile that prints on startup breaks parsing. Hook stdout and `additionalContext` are capped at 10,000 characters. `\"disableAllHooks\": true` turns hooks off; there is no switch for a single hook.","status":"published","storyType":"tip","category":"Workflow","clusterKey":"hook-exit-code-pitfalls","slug":"a-typo-in-a-claude-code-safety-script-s-path-can-silently-switch-the-saf-75cf30","url":"https://claudecodereview.ai/a/a-typo-in-a-claude-code-safety-script-s-path-can-silently-switch-the-saf-75cf30/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/75cf309d-582d-4566-bd13-cc7ebfa8f44d","role":"item","position":6,"imageStatus":"ready","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/a-typo-in-a-claude-code-safety-script-s-path-can-silently-switch-the-saf-75cf30/d94b81797dd5b0e9-f9236e40ab83126e/web_hero.webp","imageAlt":"A row of eleven levers with one clay-orange lever lifted out of its spot, showing a gap.","createdAt":"2026-10-07T13:01:52.426Z","updatedAt":"2026-10-07T13:31:41.131Z","sources":[{"role":"primary","title":"11 Claude Code Hook Techniques That Fix Common Guardrail and Automation Mistakes","url":"https://dev.to/runbyagent/claude-code-hooks-most-people-miss-12p2","sourceName":"runbyagent","author":"runbyagent","publishedAt":"2026-10-07T00:55:01Z"}]},{"id":"24b44a4a-4df7-4415-8198-cdf64c253d84","title":"Claude Code hook keeps the cache warm five hours; developer says API cost is about 70 cents","dek":"A hook (a small script Claude Code runs on its own) pings the session every 55 minutes so the cached conversation, which makes repeat requests cheaper and faster, doesn't expire, then saves a summary file so a new session can pick up where this one stopped. API means the way one program lets other programs use it.","bodyMd":"A developer has published a hook for Claude Code that keeps the prompt cache alive across a long idle stretch. The prompt cache is Claude's short-term memory of your conversation: while it lasts, repeat requests run cheaper and faster. The developer says the hook stretches it from one hour to about five, and that the API cost for the whole five-hour wait is around $0.70.\n\n**How it works**\n\n1. The hook starts a background task that pings the session in 55 minutes.\n2. Each ping writes a short note along the lines of \"🕯 cache extended, 1/5\".\n3. After the fifth ping, it writes a markdown summary called `relay.md` into the same branch.\n4. It also prints a code block to copy: `/relay take <claude/branch-name>`. Paste that into a new session and it picks up from where the old one ended.\n5. Pinging then stops.\n\nThe developer describes \"relay\" as \"compact, but put the summary in the branch so a new session can grab it.\" That handoff file is a saved summary of where your work stands, so you don't have to re-explain everything to a fresh session.\n\n**When it runs**\n\nThe agent decides whether to start the keepalive. It will skip it if it judges the codebase to be self-explanatory. The developer's example: a plan already sits in the branch and the session's context adds nothing new to it.\n\n**Trying it**\n\nThe instructions live in a `CLAUDE.md` file in the developer's muthur repository on GitHub, under `.claude/keepalive/`. The developer suggests pointing your own Claude at it to judge whether it's worth adopting.\n\n**Open question**\n\nSome commenters suggested the approach could violate Anthropic's terms of service. The developer says they asked u/bcherny on Twitter whether it does and will post an update if a reply comes. No answer had been reported at the time of the post.","status":"published","storyType":"tip","category":"Workflow","clusterKey":"hook-extends-prompt-cache-5-hours","slug":"claude-code-hook-keeps-the-cache-warm-five-hours-developer-says-api-cost-24b44a","url":"https://claudecodereview.ai/a/claude-code-hook-keeps-the-cache-warm-five-hours-developer-says-api-cost-24b44a/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/24b44a4a-4df7-4415-8198-cdf64c253d84","role":"item","position":7,"imageStatus":"ready","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/claude-code-hook-keeps-the-cache-warm-five-hours-developer-says-api-cost-24b44a/74049e9346f2c735-06ee3f2a5b6fa021/web_hero.webp","imageAlt":"Five small units in a row with the fifth unit lifted up, connected by a line to a separate, smaller stack of two blocks.","createdAt":"2026-10-09T06:08:29.247Z","updatedAt":"2026-10-09T06:30:30.686Z","sources":[{"role":"primary","title":"Claude Code Hook Extends Cache to 5 Hours for 70 Cents","url":"https://reddit.com/r/ClaudeCode/comments/1x0kdz4/wrote_a_hook_that_keeps_your_cache_alive_for_5","sourceName":"u/vzakharov","author":"u/vzakharov","publishedAt":"2026-10-08T07:12:26Z"}]},{"id":"3e13afc7-16e1-4095-ad36-89bcc6c08351","title":"A Claude Code user reports auto-compact running before the prompt cache expires","dek":"One user says Claude Code compacted a long session on its own, shrinking the conversation into a shorter summary, before the prompt cache (the short-term memory that lets the model reuse text it already read) timed out.","bodyMd":"A Claude Code user reported on r/ClaudeAI on October 9 that the tool compacted their session automatically before the prompt cache expired. The prompt cache is a short-term memory that lets the model reuse text it already read, which makes repeat requests cheaper and faster until it times out. The user said it was the first time they had seen this behaviour. The post includes a screenshot, and the user credits Anthropic with \"actively making improvements towards saving our tokens.\"\n\nBy the user's account, the point is tokens expiring. They used to compact by hand, and when they forgot to compact mid-session they watched 600k tokens' worth of context expire. Compacting means shrinking a long conversation into a shorter summary.\n\nA separate post on X the same day asks a different question. That user wrote \"so auto compact basically loads last 1M tokens into context by default on claude?\" The post says only \"claude\" and does not name Claude Code. The user adds that they had assumed auto compact was summarising and reducing the context load, and that people used to burn 2% to 15% of their 5-hour limits simply on auto compacting their sessions.\n\nThe two posts are separate individual reports. The Reddit post is about compaction happening before the cache expires, and it does not mention 5-hour limits or what compaction loads into context. The X post does not mention that behaviour. Its question is whether auto compact loads the last 1M tokens into context by default. The 2% to 15% of 5-hour limits is the author's own statement about what people used to burn, not part of that question.","status":"published","storyType":"news","category":"Release","clusterKey":"claude-code-auto-compact-before-cache-expires","slug":"a-claude-code-user-reports-auto-compact-running-before-the-prompt-cache-3e13af","url":"https://claudecodereview.ai/a/a-claude-code-user-reports-auto-compact-running-before-the-prompt-cache-3e13af/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/3e13afc7-16e1-4095-ad36-89bcc6c08351","role":"item","position":8,"imageStatus":"ready","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/a-claude-code-user-reports-auto-compact-running-before-the-prompt-cache-3e13af/6cd83280036b854b-cc1f8d943ea5f4cd/web_hero.webp","imageAlt":"A long scroll being compressed into a compact cylinder before reaching a boundary line.","createdAt":"2026-10-10T06:09:09.384Z","updatedAt":"2026-10-10T06:31:28.071Z","sources":[{"role":"primary","title":"Claude Code Now Auto-Compacts Before Cache Expires to Save Tokens","url":"https://reddit.com/r/ClaudeAI/comments/1x1a6ym/claude_code_compacts_automatically_before_cache","sourceName":"u/Mrk_J","author":"u/Mrk_J","publishedAt":"2026-10-09T02:51:31Z"},{"url":"https://x.com/wholyv/status/2108393422658908495","title":null,"sourceName":"x.com","author":"Lxyv","publishedAt":"2026-10-09T03:05:38.000Z","role":"supporting"}]}],"tips":[{"id":"a1514f8d-452e-45f5-a72a-2b9592d638e2","title":"Which Claude Code project files to commit, and what goes in CLAUDE.md versus .claude","dek":"Anthropic's docs contrast CLAUDE.md, the instructions file Claude reads every session, with skills, which load only when called or relevant; the hidden .claude folder holds the rest of the project's Claude Code configuration.","bodyMd":"Claude Code's docs say what each project file does and when it loads, and that decides where an instruction belongs. The clearest contrast is between `CLAUDE.md`, the instructions file Claude reads at the start of every session, and skills, which load only when you call them or when they are relevant. Here is the layout, drawn from Anthropic's pages on memory, the `.claude` directory, skills, subagents, MCP and settings (read October 25, 2026).\n\n**CLAUDE.md: what every session needs.** Put build and test commands, naming conventions, project layout and \"always do X\" rules in `CLAUDE.md` at the repo root or in `.claude/CLAUDE.md`. Keep it under 200 lines: longer files use more context and Claude follows them less reliably. Write checkable instructions (\"Run `npm test` before committing\", not \"Test your changes\"). Run `/init` to draft one from your codebase and `/context` to confirm it loaded. Anthropic's trigger for adding a line: Claude made the same mistake twice, a code review caught something it should have known, or you retyped the same correction.\n\nCLAUDE.md is context, not enforcement. If something must happen every time, such as blocking edits to `.env`, use a hook in settings.\n\n**Everything else under `.claude`**\n\n`.claude` is the hidden project folder that holds Claude Code's configuration, skills, agents and rules.\n\n- `.claude/rules/*.md`: topic-specific instructions. A rule with `paths` frontmatter (for example `\"src/api/**/*.ts\"`) loads only when Claude reads or edits a matching file. A rule without `paths` loads at launch, with the same priority as `.claude/CLAUDE.md`. `@path` imports in CLAUDE.md still load with it, so they don't save context. Path-scoped rules do.\n- `.claude/skills/<name>/SKILL.md`: workflows and long checklists that load when called or relevant. The folder name becomes a command such as `/deploy`.\n- `.claude/agents/<name>.md`: subagents with their own system prompt, tools and optional model. They run in a separate context window and return a summary, which suits tasks that read dozens of files.\n- `.claude/settings.json`: team permissions, hooks, plugins and environment variables.\n- `.mcp.json` at the repo root: project MCP servers, added with `claude mcp add --scope project`. Each person is asked to approve them before use. Use `${API_KEY}` or `${VAR:-default}` placeholders so keys expand from each person's environment.\n\n**What to commit.** `CLAUDE.md` (or `.claude/CLAUDE.md`), `.claude/rules/`, `.claude/skills/`, `.claude/agents/`, `.claude/settings.json`, and `.mcp.json` with placeholders.\n\n**What to keep out of git.** `CLAUDE.local.md` (add it to `.gitignore`) and `.claude/settings.local.json`, which holds personal overrides and wins over the team file. Claude Code creates the latter when you pick \"Yes, and don't ask again\" on a permission prompt and adds it to your global git excludes. If you create it by hand, ignore it yourself. Files in `~/.claude` and auto memory under `~/.claude/projects/` never enter the repo.\n\n**If the repo also serves other agents.** By default Claude Code reads `AGENTS.md` only when no `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` exists in the working directory or above. Adding a `CLAUDE.local.md` therefore makes Claude stop reading `AGENTS.md` for you. To keep one shared file, put `@AGENTS.md` on the first line of `CLAUDE.md` and add Claude-only notes below. Alternatively, set **Project instructions** in `/config` to `claude-md-and-agents-md` to read both. Reading `AGENTS.md` directly needs Claude Code v2.1.277 or later, so use the import on older installs.\n\nAnything under `.agents/` is not read as instructions, and the skills docs list only `.claude/skills` locations. Cursor documents reading `.claude/skills`, which makes it the one skills path both tools document.","category":"Workflow","slug":"which-claude-code-project-files-to-commit-and-what-goes-in-claude-md-ver-a1514f","url":"https://claudecodereview.ai/a/which-claude-code-project-files-to-commit-and-what-goes-in-claude-md-ver-a1514f/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/a1514f8d-452e-45f5-a72a-2b9592d638e2","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/which-claude-code-project-files-to-commit-and-what-goes-in-claude-md-ver-a1514f/88eda2ba5e65f4bd-18af441a6d0bd9f4/web_hero.webp","imageAlt":"A tall rectangular prism stands taller than a group of small, varied blocks, representing the distinction between core instructions and modular project configuration.","createdAt":"2026-10-30T03:33:49.533Z"},{"id":"012d35b5-2133-4478-8cb3-f1e7957e1fbe","title":"Keep long sessions from filling up on tool output with the Context Mode plugin","dek":"Context Mode routes raw MCP output into a sandbox and tracks session events in SQLite, which its README says keeps far less raw output from heavy browser, GitHub and log tools in your context.","bodyMd":"Context Mode is an MCP server plus a set of hooks that keeps raw tool output out of the chat. According to its README, a Playwright snapshot costs 56 KB, twenty GitHub issues cost 59 KB and one access log is 45 KB. After about 30 minutes of work, roughly 40% of a Claude Code context can be gone, and after compaction the agent can lose track of which files it was editing. Context Mode keeps the raw output in a sandbox so only a small result reaches the conversation. It also records session events in SQLite so work survives compaction.\n\n## Set it up\n\nYou need Claude Code v1.0.33 or newer (`claude --version`). If `/plugin` is not recognized, update with `brew upgrade claude-code` or `npm update -g @anthropic-ai/claude-code`.\n\n1. **Install.** Inside Claude Code run `/plugin marketplace add mksglu/context-mode`, then `/plugin install context-mode@context-mode`. Restart Claude Code or run `/reload-plugins`.\n2. **Verify.** Run `/context-mode:ctx-doctor`. Every check should show `[x]`. It validates runtimes, hooks, FTS5 and plugin registration. Fix anything red first, because the routing hooks are what make the savings automatic.\n3. **Let the model write code instead of reading files.** Routing is automatic: a SessionStart hook injects instructions at runtime, so nothing is written into your project. The README's example replaces 47 `Read()` calls (700 KB) with one `ctx_execute()` script that prints only line counts (3.6 KB). The README quotes 315 KB shrinking to 5.4 KB for sandboxed output. Those are the project's own numbers, so measure yours.\n4. **Measure.** `/context-mode:ctx-stats` shows a per-tool breakdown, tokens consumed and the savings ratio. For a live meter, add this to `~/.claude/settings.json` and restart:\n\n```json\n{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"context-mode statusline\"\n  }\n}\n```\n\n5. **Index docs you keep re-reading.** `/context-mode:ctx-index` loads a local file or directory into a persistent FTS5 knowledge base. `/context-mode:ctx-search` then returns only the relevant passages through BM25 search. `/context-mode:ctx-purge` permanently deletes everything indexed.\n\n## Try it without the plugin\n\n`claude mcp add context-mode -- npx -y context-mode` adds only the MCP server. You get all 11 tools but no automatic routing or slash commands, so the model is not nudged away from raw Bash, Read and WebFetch and savings are smaller. It works as a low-commitment test.\n\n## When it is worth it\n\nThe plugin targets long sessions that lean on browser, GitHub or log-heavy MCP tools and keep hitting compaction. For short sessions, the write-up says the overhead is not worth it.\n\nOne caution from the README: if you do not start with `--continue`, previous session data is deleted immediately, so a fresh session is a clean slate. After a compaction, Context Mode indexes the recorded events (file edits, git operations, tasks, errors, decisions) and retrieves only what is relevant rather than replaying the history.","category":"Workflow","slug":"keep-long-sessions-from-filling-up-on-tool-output-with-the-context-mode-012d35","url":"https://claudecodereview.ai/a/keep-long-sessions-from-filling-up-on-tool-output-with-the-context-mode-012d35/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/012d35b5-2133-4478-8cb3-f1e7957e1fbe","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/keep-long-sessions-from-filling-up-on-tool-output-with-the-context-mode-012d35/64ab7afaa95425f6-2859cb9dfee6cb92/web_hero.webp","imageAlt":"A funneling graphic showing forty-seven rectangular blocks passing through a narrow aperture into one single, small cube.","createdAt":"2026-10-30T03:31:19.263Z"},{"id":"a3b34cbb-9e00-4643-bdea-82b6d27706e5","title":"Shrink test logs and JSON output before they hit your token bill","dek":"Headroom, an open-source local proxy (a program on your machine that sits between Claude Code and the model), compresses logs and tool output, including JSON and token-heavy text, before it is sent, and one command wraps your sessions.","bodyMd":"Test runs, build logs, large JSON (the structured data format many tools print) and long diffs go back to the model on every step, and you pay for those tokens each time. Tokens are the units of text the model bills by. Headroom is an open-source tool that sits between Claude Code and the model and compresses that material first. Its README gives one example: a log that costs 10,144 tokens shrinks to 1,260 while the same fatal error is still found.\n\nCompression runs on your machine. Headroom routes each piece of content to a fitting compressor (one for JSON, one that understands code structure, a text model for prose) and caches the originals locally. The model gets a `headroom_retrieve` tool to pull back the full text when it needs it. Headroom flags content that would break your provider's prompt cache but does not rewrite your prompts.\n\n## Setup\n\n1. Install the CLI with `uv tool install --python 3.13 \"headroom-ai[all]\"` or `pip install \"headroom-ai[all]\"`. The npm package (`npm install headroom-ai`) is the TypeScript SDK only and has no CLI.\n2. Run `headroom wrap claude`. It starts a local proxy (a program on your machine that sits between Claude Code and the model), installs the Serena MCP server for semantic code navigation (registered for the wrapped project only) and launches Claude Code routed through Headroom. Launch Claude Code this way each session. To back out, run `headroom unwrap claude`.\n3. Check it works: `headroom doctor` confirms routing, `headroom perf` shows compression stats, and `headroom dashboard` shows live savings while the proxy is running. Run `doctor` first.\n4. If you would rather not wrap anything, run `headroom proxy --port 8787` and point your tools at it. Anything that can set an API base URL can use it, including your own scripts.\n5. Optionally, run `headroom learn`. It mines failed sessions and writes corrections to `CLAUDE.local.md` (gitignored) by default, or to `CLAUDE.md` or `AGENTS.md` if you choose. Review what it proposes before committing it to a shared file.\n\n## When it pays off\n\nLong sessions on a large repo, usage limits you keep hitting, or per-token billing are the cases where a quick trial makes sense. Sessions heavy on test runs, build logs and large JSON compress well. A session of short prompts will not move much.\n\n## Caveats\n\nThe 10,144 to 1,260 figure is the README's own example, not a benchmark of your repo, so measure with `headroom perf` on real sessions. Headroom also adds a local proxy to your setup, one more moving part when something breaks. The same `wrap` command works for Codex, Cursor, Aider, Cline, Goose and OpenHands.","category":"Workflow","slug":"shrink-test-logs-and-json-output-before-they-hit-your-token-bill-a3b34c","url":"https://claudecodereview.ai/a/shrink-test-logs-and-json-output-before-they-hit-your-token-bill-a3b34c/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/a3b34cbb-9e00-4643-bdea-82b6d27706e5","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/shrink-test-logs-and-json-output-before-they-hit-your-token-bill-a3b34c/5aa2e890dcb437f0-544c3236601d11e5/web_hero.webp","imageAlt":"A wide funnel feeds three types of data blocks into a single narrow tube, where a clay-orange filter section represents compressed data output.","createdAt":"2026-10-29T21:58:29.261Z"},{"id":"bbbd9b99-2dd4-4c09-9d14-30e77a90254a","title":"Catch file changes a PostToolUse hook misses with a Stop hook that asks git","dek":"In a scripted test, a PostToolUse hook matching Edit|MultiEdit|Write saw 3 of 7 file changes, while a Stop hook running git status saw all 7.","bodyMd":"In a scripted test, a PostToolUse hook matched on `Edit|MultiEdit|Write` saw only the changes made through Claude's file tools. On Claude Code 2.1.312, it caught 3 of 7 changes. The four it missed were made through Bash: `sed -i`, a `>` redirect, `rm` and `git mv`. A Stop hook that runs `git status` listed all seven, including the delete and the rename.\n\nA quick gloss on the terms: a hook is a script Claude Code runs automatically at set points. A PostToolUse hook runs after each tool call, and a Stop hook runs when Claude finishes. Git is the version-control tool that tracks uncommitted changes in a repo, and `git status` lists them.\n\nThe test used a scripted fake model (a local server standing in for the Messages API) that issued a fixed list of tool calls against the real Claude Code binary, so no API key was needed. A real model picks its own routes, and seven routes are a sample, not a census.\n\n**Add the git-backed Stop hook**\n\n1. Create `.claude/stop-check.sh`:\n\n```\ngit status --porcelain -uall > .git/hk-status\ngrep -q '\"stop_hook_active\":true' && exit 0\n[ -s .git/hk-status ] || exit 0\ncat .git/hk-status >&2\nexit 2\n```\n\n2. Register it in `.claude/settings.json` as a `Stop` hook with the command `cd \"$CLAUDE_PROJECT_DIR\" && sh .claude/stop-check.sh`.\n\nThe `cd` matters because hooks run in Claude's current directory, which moves when Claude runs `cd`. Exit code 2 tells Claude Code not to stop yet and passes stderr to the model, so Claude sees the list of changed files before it finishes. The `stop_hook_active` check lets the second stop through, so the hook can't loop. In the test, this cost one extra model call and delivered all seven status lines.\n\n**Why adding Bash to the matcher doesn't fix it**\n\nMatching `Edit|Write|Bash` makes the hook fire on the four Bash changes. But those payloads hold the command string, with no `file_path` and no patch. To learn which files `rm` or `git mv` touched, the hook would have to parse shell.\n\n**New files arrive with an empty patch**\n\nA file created with Write reports `type=create` and `structuredPatch=[]`; the text sits in `tool_response.content`. A hook that reviews `structuredPatch` sees nothing for new files, so read `content` when `type` is `create`.\n\n**Worth using when** a review loop depends on knowing what Claude changed. Keep PostToolUse for instant per-edit checks, since Stop only runs when Claude finishes.\n\n**Limits**\n- Git skips gitignored files, files outside the repo, and anything Claude commits itself.\n- The hook also lists your own uncommitted work.\n- `MultiEdit` did not appear in the request Claude Code 2.1.312 sent the model, so it widens nothing.\n- `NotebookEdit` appears as a deferred tool and the usual matcher doesn't name it; its payload wasn't tested.\n- PostToolUse behavior in subagents wasn't tested.","category":"Workflow","slug":"catch-file-changes-a-posttooluse-hook-misses-with-a-stop-hook-that-asks-bbbd9b","url":"https://claudecodereview.ai/a/catch-file-changes-a-posttooluse-hook-misses-with-a-stop-hook-that-asks-bbbd9b/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/bbbd9b99-2dd4-4c09-9d14-30e77a90254a","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/catch-file-changes-a-posttooluse-hook-misses-with-a-stop-hook-that-asks-bbbd9b/77803526806d849e-d986ba588b19e4b0/web_hero.webp","imageAlt":"A diagram shows seven file blocks being caught by a container versus a sieve that only catches three.","createdAt":"2026-10-29T21:56:56.756Z"},{"id":"8d01e30d-2c9d-4811-9baa-5d6f7de00bfd","title":"See every waiting session, subagent and Codex run that Agent View leaves off its list","dek":"Agent View only lists background sessions, so a JSON command, a Notification hook or ccdeck, a free, open-source dashboard that runs on your machine and shows Claude Code and Codex sessions, has to cover the rest.","bodyMd":"Agent View, opened with `claude agents`, is one screen for background sessions. Anthropic's documentation says interactive sessions open in other terminals don't appear until you background them, and that subagents and teammates a session spawns aren't listed as separate rows. Codex isn't listed either. The feature is in research preview, and a row shows only the session's name, current activity and age: no spend or quota.\n\nTwo terms used below: a subagent is a helper session that a main Claude Code session spawns. Codex is a separate coding-agent CLI that has its own `codex agents` dashboard and writes rollout files under `~/.codex/sessions`.\n\nThree ways to see the rest:\n\n1. **Poll `claude agents --json`.** In Claude Code 2.1.312 the command prints active sessions, interactive and background, as a JSON array. Each entry has a `kind` and, while its process is alive, a `status` of `busy`, `waiting` or `idle`. A waiting session adds `waitingFor`, such as `permission prompt` or `input needed`. Filter it with jq: `claude agents --json | jq '.[] | select(.status == \"waiting\")'`. It lists sessions, not subagents, and it is a snapshot, so poll it to keep it current.\n\n2. **Add a `Notification` hook** to `~/.claude/settings.json`. It applies to every session that reads that file, whichever terminal started it. Match `permission_prompt|idle_prompt` and have the hook command append one line per wait to a log, for example with `jq -c` writing to `~/.claude/waiting.log`. Notification hooks can't block or modify notifications, so this only observes.\n\n3. **Run a dashboard.** ccdeck, a free, open-source dashboard, starts with `npx ccdeck`. Its first run adds a hook to `~/.claude/settings.json`, so sessions from any terminal report to it. Each subagent gets its own card joined to its session, and Codex CLI sessions appear on the same canvas, read from the rollout files under `~/.codex/sessions`. The topbar names Claude Code sessions stopped on a prompt or question, with how long each has waited. It also shows estimated spend per session. `ccdeck sessions` prints the waiting list in a terminal.\n\nFor subagents without a dashboard, hooks from settings files also run inside subagents. Tool events such as `PreToolUse` carry `agent_id` and `agent_type` when a subagent made the call, and `SubagentStart` and `SubagentStop` mark each one's life.\n\n**When to use which.** Dispatch and reply in Agent View. Poll the JSON if all you need is who is waiting in any terminal. Add a hook or dashboard when you want subagents, Codex or spend alongside.\n\n**Limits.** ccdeck can't reply, start or attach to sessions, because its hook is a one-way forwarder. It keeps nothing while no deck is running. Its waiting list covers Claude Code only, and the tool name beside a wait is its inference. Codex logs record no approval request, so a running Codex session shows \"approvals not visible\". Because the hook only observes, it doesn't change what Agent View does, and background sessions read user settings, so they report too.","category":"Workflow","slug":"see-every-waiting-session-subagent-and-codex-run-that-agent-view-leaves-8d01e3","url":"https://claudecodereview.ai/a/see-every-waiting-session-subagent-and-codex-run-that-agent-view-leaves-8d01e3/","relayUrl":"https://relaygrid.com/publications/pivot-claude-code/stories/8d01e30d-2c9d-4811-9baa-5d6f7de00bfd","imageUrl":"https://media.pivotnews.ai/brands/claude-code-review/articles/see-every-waiting-session-subagent-and-codex-run-that-agent-view-leaves-8d01e3/00195507b7b60ff9-5f4c5c671f925426/web_hero.webp","imageAlt":"A diagram shows rectangular session strips, square subagent tiles, and circular coding-agent discs being connected by a single line into a unified cluster.","createdAt":"2026-10-29T21:52:06.001Z"}]}