Adding Architecture Checks to Claude Code & Codex
Autonomous CLI coding agents can edit dozens of files in minutes. Here is how to configure a lightweight, noise-free architecture feedback loop that surfaces genuine structural risk without breaking fast feature flow.
The Challenge with Autonomous Terminal Agents
Terminal-first coding agents like Claude Code and OpenAI Codex represent a leap in developer autonomy. Rather than acting as simple auto-completers, they inspect directories, propose multi-file edits, run tests, and commit git changes in rapid succession.
However, this high autonomy creates a specific risk: invisible architecture drift. While every individual unit test passes, the agent may inadvertently:
- Import database query builders directly into client-side API route handlers.
- Duplicate global state stores across loosely coupled feature directories.
- Tangle asynchronous error handling with HTTP transport boundaries.
By the time a human developer reviews the pull request, hundreds of lines have changed across multiple strata, and untangling the architecture requires painful rollbacks.
The Session Lifecycle: How Vibe Monitor Integrates
Vibe Monitor runs as a session-scoped Model Context Protocol (MCP) tool. It observes code evolution locally, tracks trajectory across checkpoints, and applies a strict attention budget so normal development remains quiet.
vibe_session_start
At the start of any coding-project session, before the first project inspection or edit, the agent calls vibe_session_start once to initialize the session baseline.
vibe_checkpoint
After completing a meaningful implementation batch (e.g., editing files and running a test suite), the agent calls vibe_checkpoint to record structural deltas.
Decision Gate
If attentionRequired=false, the agent continues normally without noise. If userNoticeRequired=true, it presents a short, plain-language advisory notice to the human developer.
Real Tool Calls & Verified Output Schema
Let us examine real tool interactions. In the agent prompt instructions configured by Vibe Monitor, the protocol is straightforward and deterministic:
1. Starting the Session
The agent initiates the session with an empty JSON argument payload:
// Tool invocation from Claude Code / Codex
call_mcp_tool({
"ServerName": "vibe-monitor",
"ToolName": "vibe_session_start",
"Arguments": {}
})
Vibe Monitor initializes project identity, checks git fingerprint, and loads cached trajectory. If no urgent issues exist, it responds immediately:
{
"status": {
"highestStage": "S1",
"attentionRequired": false
},
"userNoticeRequired": false
}
2. Checkpointing After a Coding Batch
After modifying project files and verifying local tests, the agent triggers an evaluation:
call_mcp_tool({
"ServerName": "vibe-monitor",
"ToolName": "vibe_checkpoint",
"Arguments": {}
})
When an architectural transition is detected (such as Stage S4 boundary pressure), Vibe Monitor surfaces a concise advisory notice formatted for human consumption:
{
"status": {
"highestStage": "S4",
"attentionRequired": true
},
"userNoticeRequired": true,
"userFacing": {
"summary": "State handling and HTTP transport boundaries are coupling in api/checkout.js.",
"whyItMatters": "Shared mutable variables across concurrent requests increase flakiness and make rollback risky.",
"doNow": "Isolate the order state persistence behind a dedicated interface before continuing.",
"doNotDoYet": "Do not refactor other endpoints or extract services.",
"nextTrigger": "Re-evaluate if concurrent order load requires queue-based processing."
}
}
Human in Control: Non-Invasive by Design
Vibe Monitor enforces strict boundary rules that protect developer sovereignty:
- Zero source modification: Vibe Monitor observes and reports. It never modifies, reformats, or edits your project code files.
- No automated refactoring mandates: Findings are advisory evidence. The developer decides whether to establish a boundary now or continue shipping.
- Realistic scope: Vibe Monitor does not claim to automatically decompose a monolith into microservices, nor does it magically solve cross-hardware portability. It identifies concrete, local structural pressure before it compounds.
Installation for Claude Code & Codex
You can configure both agents with targeted flags using the official public stable package:
npx -y --registry=https://registry.npmjs.org @vibe-monitor/setup@latest install --claude
npx -y --registry=https://registry.npmjs.org @vibe-monitor/setup@latest install --codex
For Claude Code, this registers the MCP server in ~/.claude.json and appends instructions to ~/.claude/CLAUDE.md. For Codex, it writes the server block into ~/.codex/config.toml and instructions to ~/.codex/AGENTS.md.