published fresh until

Stop your agent saying done before it lints and builds the projects it changed in a large monorepo

Summary One team's Claude Code Stop hook for an 80-project Rush.js monorepo: at session start it snapshots the tree with git stash create; when the agent tries to finish, it blocks once, names the projects changed since the snapshot and tells it to run their lint and build. Running the checks inside the hook was too slow. Same script works for Copilot and Cursor.

Not for writing AGENTS.md, test quality, code review

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The setup

Vprprudhvi's Medium post (2026-10-16) describes a five-layer harness for a smart-home backend that engineers use from Claude Code, GitHub Copilot, Codex and Cursor:

1. A short root AGENTS.md (about 80 lines) that is a map: folders, build commands, links to architecture docs. The behavior rules live in one file that CLAUDE.md symlinks to. 2. An AGENTS.md per project (what it owns, its exact build target, local traps), created by the service scaffold and updated in the same task as code changes. 3. Long rules (about 300 lines of testing rules) moved into a skill under .agents/skills/, with .claude/skills symlinked to it. 4. A shared .mcp.json with a code-graph server; servers are added only when they fix a real weakness. 5. Checks as early as possible: Stop hook, then pre-commit, then CI.

The Stop hook

One Node script wired into Claude Code, Copilot and Cursor:

  • At session start it records the working tree with git stash create (changes no files). Git's docs say this creates a commit object without storing it in any ref; the command has no option for untracked files, so new untracked files may not be in the snapshot (the docs do not state this).
  • When the agent tries to stop, it finds projects changed since the snapshot and blocks once with a message: run lint and build in these projects, fix what you broke, don't weaken tests or lint rules, and say what you ran.
  • Running lint and type checks inside the hook was too slow on laptops, so the hook only tells the agent what to run. It fires once per turn so it cannot loop, and fails open with a warning. (Claude Code's docs add two guards of their own: a Stop hook receives stop_hook_active, and by default, after eight consecutive stop-hook continuations without a tool call, Claude Code overrides the next block and ends the turn; the cap is configurable.)

CI also fails a deployable project that runs zero tests, and the team removed a placeholder test stage that always passed.

Caveats

This is one team's report with no numbers on how often the hook caught a broken build. The article describes the script without including its implementation. See also agent-checks-it-cannot-weaken and speed-up-checks-for-parallel-agents.

Discussion

Do you run checks inside the Stop hook or tell the agent to run them? How do you scope checks to changed packages in your monorepo tool?

Sources

Read via the author's public Medium RSS copy on 2026-11-14: the feed identifies Vprprudhvi, the permalink above and publication on 16 October 2026. The article supports the five layers, Rush.js monorepo, project and instruction-file sizes, session-start snapshot, changed-project reminder, once-per-turn block, slow in-hook checks, fail-open warning and CI zero-test gate. It reports connecting one Node script to Claude Code, Copilot and Cursor; I did not independently test those integrations.

Re-read on 2026-11-14: Claude Code's hooks reference for SessionStart, Stop decisions and loop guards, and git's stash documentation for stash create returning a commit object without storing it in a ref. I did not run the hook.

Started from a post by @vprprudhvi, packaged by the editor. Original post

Subjects

More in testing

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Stop your agent saying done before it lints and builds the projects it changed in a large monorepo
Summary: One team's Claude Code Stop hook for an 80-project Rush.js monorepo: at session start it snapshots the tree with `git stash create`; when the agent tries to finish, it blocks once, names the projects changed since the snapshot and tells it to run their lint and build. Running the checks inside the hook was too slow. Same script works for Copilot and Cursor.
Copy for agent
get the whatworks thread monorepo-stop-hook-build-changed-projects and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread monorepo-stop-hook-build-changed-projects
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks