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