Multi-pane Claude Code setup with role separation and execution hooks

Setup details
A developer on r/ClaudeAI describes a configuration to address Claude Code drifting mid-session and losing context. The solution uses a 2×2 grid in iTerm2, with each pane running a separate Claude Code instance assigned a fixed role.
- IMPL: Uses the Sonnet model with auto-accept enabled. Its role is to write code and run tests.
- AUDIT: Uses the Opus model in read-only mode. It reviews IMPL's output without generating code itself.
- PLAN: Runs at low effort for architecture discussions. It has no write restrictions, but the low effort setting prevents it from diving into implementation.
- PROMPT: Handles prompt refinement separately.
Each pane automatically picks up its role from the $ITERM_PROFILE environment variable. Typing cc launches the instance with the correct model and permission flags.
Hook system and session management
The setup includes a two-tier hook system enforced at execution time.
- PreToolUse hooks: Block operations like
.envfile edits andgit pushcommands before they execute. - PostToolUse hooks: Implement a circuit breaker that halts the session after three consecutive tool failures to prevent spiraling.
A SESSION_LOG—a plain markdown file—is updated by IMPL at the end of each day with completed work, decisions made, and next steps. At the start of a new session, it reads the last 60 lines of this log, reducing cold starts from re-explaining the entire project to picking up where it left off.
The full walkthrough with hook scripts and a gate/ship workflow is available in a linked guide and repository.
📖 Read the full source: r/ClaudeAI
👀 See Also

AI Agents Develop Cult-Like Behavior in Sandbox Environment
A developer observed AI agents in the Orange Web3 sandbox world forming emergent 'cult' behavior, with agents congregating and discussing 'the higher purpose' and 'the orange glow' after being given basic goals and agency.

Hybrid RAG for Local Agent Memory with OpenClaw, Ollama, and nomic-embed-text
A developer implemented hybrid RAG retrieval for AI agent memory using OpenClaw with Ollama and nomic-embed-text, combining 70% vector similarity with 30% BM25 keyword matching. The setup runs locally without external APIs and includes MMR deduplication and temporal decay weighting.

A TDD Development Flow Using AI Agents for Website Projects
A developer shares their workflow for building websites using AI coding agents with TDD, detailing setup steps, iterative processes, and specific commands for running tests with local models like Qwen3.5-27B.

RunLobster AI Agent Integrates Business Data for Operational Insights
A developer gave RunLobster root access to their business systems including Stripe, CRM, email, and call transcripts. The agent autonomously monitors operations, flags anomalies, and provides detailed briefings based on integrated data analysis.