Documentation Index
Fetch the complete documentation index at: https://panopticon-cli.com/llms.txt
Use this file to discover all available pages before exploring further.
Cloister: AI Lifecycle Manager
Cloister is Panopticon’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:| Specialist | Purpose | Trigger |
|---|---|---|
| review-agent | Code review before merge | Human clicks “Review” |
| test-agent | Runs test suite after review | After review passes |
| inspect-agent | Per-step verification during implementation | After each bead completion |
| uat-agent | Browser-based requirement verification | After tests pass |
| merge-agent | Handles git merge and conflict resolution | ”Approve & Merge” button |
Review Pipeline Flow
The review pipeline is a sequential handoff between specialists:- 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 (~/.panopticon/specialists/{name}/hook.json) managed via the FPP (Fixed Point Principle):
urgent > high > normal > low
Completion triggers: When a specialist reports status (passed, failed, or skipped), the dashboard:
- Sets the specialist state to
idle - Checks the specialist’s queue for pending work
- 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:- First human click resets the counter to 0
- Each
pan work request-reviewincrements the counter - After 3 automatic re-requests, returns HTTP 429
- Human must click “Review” in dashboard to continue
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:| Trigger | Condition | Action |
|---|---|---|
| stuck_escalation | No activity for 30+ minutes | Escalate to more capable model |
| complexity_upgrade | Task complexity exceeds model capability | Route to Opus |
| implementation_complete | Agent signals work is done | Wake review-agent |
| test_failure | Tests fail repeatedly | Escalate model or request help |
| planning_complete | Planning session finishes | Transition to implementation |
| merge_requested | User clicks “Approve & Merge” | Wake merge-agent |
Handoff Methods
Cloister supports two handoff methods, automatically selected based on agent type:| Method | When Used | How It Works |
|---|---|---|
| Kill & Spawn | General agents (agent-min-123, etc.) | 1. Captures full context (STATE.md, beads, git state) 2. Kills tmux session 3. Spawns new agent with handoff prompt 4. New agent continues work with preserved context |
| Specialist Wake | Permanent specialists (merge-agent, test-agent, etc.) | 1. Captures handoff context 2. Sends wake message to existing session 3. Specialist resumes with context injection |
- 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
Handoff Context Capture
When a handoff occurs, Cloister captures:~/.panopticon/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
~/.panopticon/heartbeats/:
Heartbeat Hook Installation
The heartbeat hook is automatically synced to~/.panopticon/bin/heartbeat-hook via pan sync. It’s also installed automatically when you install or upgrade Panopticon via npm.
Manual installation:
~/.claude/settings.json:
- The heartbeats directory doesn’t exist
- Write permissions are missing
- The hook script has errors
Configuration
Cloister configuration lives in~/.panopticon/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
| Level | Default Model | Use Case |
|---|---|---|
| trivial | Haiku | Typos, comments, documentation updates |
| simple | Haiku | Small fixes, test additions, minor changes |
| medium | Kimi | Features, components, integrations |
| complex | Kimi | Refactors, migrations, redesigns |
| expert | Opus | Architecture, security, performance optimization |
Complexity Detection Signals
Complexity is detected from multiple signals (in priority order):- Explicit field - Task has a
complexityfield set (e.g., in beads) - Labels/tags - Issue labels like
architecture,security,refactor - Keywords - Title/description contains keywords like “migration”, “overhaul”
- File count - Number of files changed (>20 files = complex)
- Time estimate - If estimate exceeds thresholds
Configuring Model Routing
Model routing is configured via the dashboard Settings page or~/.panopticon/cloister/config.json:
Supported Providers
| Provider | Models | Use Case |
|---|---|---|
| Anthropic | Opus, Sonnet, Haiku | Planning (Opus), review, general |
| OpenAI | GPT-4o, o1 | Alternative implementation |
| Gemini | Alternative implementation | |
| Kimi | Kimi K2.5 | Cost-effective implementation (default) |
| Zhipu | GLM-4 | Alternative implementation |
Cost Optimization
Model routing helps optimize costs:| Model | Relative Cost | Best For |
|---|---|---|
| Haiku | 1x (cheapest) | Simple tasks, bulk operations |
| Kimi | ~2x | Most implementation work (default) |
| Sonnet | 3x | Review, complex implementation |
| Opus | 15x | Planning, architecture, critical fixes |
- Plan with Opus (high-quality strategic decisions)
- Implement with Kimi (cost-effective coding)
- Escalate to Opus only if stuck or complexity detected
Related Guides
- Specialists - Detailed specialist agent documentation
- Convoys - Multi-agent orchestration
- Core Commands - Cloister CLI commands