Skip to main content

Cloister: AI Lifecycle Manager

Cloister is Overdeck’s intelligent agent lifecycle manager. It monitors all running agents and automatically handles:
  • Model Routing - Routes tasks to appropriate models based on complexity, across multiple providers
  • Stuck Detection - Identifies agents that have stopped making progress
  • Automatic Handoffs - Escalates to specialists when needed
  • Specialist Coordination - Manages review-agent, test-agent, inspect-agent, uat-agent, and merge-agent

How Cloister Works

Starting Cloister

Specialists

Cloister manages five specialized agents that handle specific phases of the development lifecycle: See the Specialists feature guide for detailed information on specialist agents.

Review Pipeline Flow

The review pipeline is a sequential handoff between specialists:
Additionally, inspect-agent runs during implementation (between beads), not as part of this post-implementation pipeline. Key Points:
  • Human-initiated start - A human must click “Review” to start the pipeline
  • Automatic handoffs - review-agent → test-agent → uat-agent happens automatically
  • Human approval for merge - Merge is NOT automatic; human clicks “Approve & Merge”
  • Feedback loops - Failed reviews/tests/UAT send feedback back to the work-agent

Queue Processing

Each specialist has a task queue (~/.overdeck/specialists/{name}/hook.json) managed via the FPP (Fixed Point Principle):
Queue priority order: urgent > high > normal > low Completion triggers: When a specialist reports status (passed, failed, or skipped), the dashboard:
  1. Sets the specialist state to idle
  2. Checks the specialist’s queue for pending work
  3. If work exists, immediately wakes the specialist with the next task

Agent Self-Requeue (Circuit Breaker)

After a human initiates the first review, work-agents can request re-review up to 3 times automatically:
Circuit breaker behavior:
  • First human click resets the counter to 0
  • Each pan work request-review increments the counter
  • After 3 automatic re-requests, returns HTTP 429
  • Human must click “Review” in dashboard to continue
This prevents infinite loops where an agent repeatedly fails review. API endpoint: POST /api/workspaces/:issueId/request-review

Specialist Auto-Initialization

When Cloister starts, it automatically initializes specialists that don’t exist yet. This ensures all five specialists are ready to receive wake signals without manual setup.

Automatic Handoffs

Cloister detects situations that require intervention:
The same lifecycle signals that drive these handoffs also feed the Fix-All Flywheel orchestrator, which keeps the pipeline turning autonomously — prioritizing what to work on next, launching planning and work agents, and escalating where Cloister flags a problem. Cloister is the per-agent lifecycle layer; the Flywheel is the cross-issue orchestrator built on top of it.

Handoff Methods

Cloister supports two handoff methods, automatically selected based on agent type: Kill & Spawn is used for temporary agents that work on specific issues. It creates a clean handoff by:
  • Capturing the agent’s current understanding (from STATE.md)
  • Preserving beads task progress and open items
  • Including relevant git diff and file context
  • Building a comprehensive handoff prompt for the new model
Specialist Wake is used for permanent specialists that persist across multiple issues. It avoids the overhead of killing/respawning by injecting context into the existing session.

Handoff Context Capture

When a handoff occurs, Cloister captures:
Handoff prompts are saved to ~/.overdeck/agents/{agent-id}/handoffs/ for debugging.

Heartbeat Monitoring

Agents send heartbeats via Claude Code hooks. Cloister tracks:
  • Last tool use and timestamp
  • Current task being worked on
  • Git branch and workspace
  • Process health
What Cloister tracks per agent surfaces directly on the dashboard’s Agents page, which rolls the live heartbeat data up into a fleet view: each card shows the agent’s model, runtime, and last activity, topped by a metric strip (Running, Stuck, Cost 24h, Tokens 24h, runtime, Queue). This is where the stuck-detection and process-health signals described below become operator-visible. Heartbeat files are stored in ~/.overdeck/heartbeats/:

Heartbeat Hook Installation

The heartbeat hook is automatically synced to ~/.overdeck/bin/heartbeat-hook via pan sync. It’s also installed automatically when you install or upgrade Overdeck via npm. Manual installation:
Hook configuration in ~/.claude/settings.json:
Hook resilience: The heartbeat hook is designed to fail silently if:
  • The heartbeats directory doesn’t exist
  • Write permissions are missing
  • The hook script has errors
This prevents hook failures from interrupting agent work. If heartbeats stop arriving — or any other part of the lifecycle plumbing drifts — the dashboard’s Health page surfaces it. Its system health checks and diagnostics cover the same hooks, sockets, and services Cloister depends on, so you can confirm the monitoring stack itself is sound before trusting the stuck-detection signals it produces.

Configuration

Cloister configuration lives in ~/.overdeck/cloister/config.json:

Model Routing & Complexity Detection

Cloister automatically routes tasks to the appropriate model based on detected complexity, optimizing for cost while ensuring quality. Model routing supports multiple providers: Anthropic, OpenAI, Google, Kimi, and Zhipu.

Complexity Levels

The default implementation model is configurable per-project. Kimi is the current default for medium/complex tasks, providing a cost-effective alternative to Sonnet with strong coding performance.

Complexity Detection Signals

Complexity is detected from multiple signals (in priority order):
  1. Explicit field - Task has a complexity field set (e.g., in beads)
  2. Labels/tags - Issue labels like architecture, security, refactor
  3. Keywords - Title/description contains keywords like “migration”, “overhaul”
  4. File count - Number of files changed (>20 files = complex)
  5. Time estimate - If estimate exceeds thresholds
Keyword patterns:

Configuring Model Routing

Model routing is configured via the dashboard Settings page or ~/.overdeck/cloister/config.json:

Supported Providers

Cost Optimization

Model routing helps optimize costs: A typical agent run might:
  1. Plan with Opus (high-quality strategic decisions)
  2. Implement with Kimi (cost-effective coding)
  3. Escalate to Opus only if stuck or complexity detected