Architecture
Deep dive into Panopticonβs technical architecture and design decisions.System Overview
Panopticon consists of three main components:Directory Structure
Panopticon stores all runtime state in~/.panopticon/:
Agent State Management
Each agentβs state is tracked in~/.panopticon/agents/{agent-id}/state.json:
| Field | Description |
|---|---|
phase | Current work phase: planning, implementation, testing, review, merging |
model | Current model: haiku, sonnet, opus |
complexity | Detected complexity: trivial, simple, medium, complex, expert |
handoffCount | Number of times the agent has been handed off to a different model |
sessionId | Claude Code session ID (for resuming after handoff) |
pan work kill), Panopticon automatically cleans up its state files to prevent stale data from affecting future runs.
Deep Wipe
For issues that get into a stuck or inconsistent state, usepan work wipe to completely reset:
- Tmux sessions (
planning-min-123,agent-min-123) - Agent state directories (
~/.panopticon/agents/planning-*,agent-*) - Legacy planning directories (
project/.planning/min-123/) - Workspace (if
-wflag is used) - Linear issue status (reset to Backlog)
- Linear labels (removes βReview Readyβ, βPlanningβ)
Health Monitoring (Deacon Pattern)
Panopticon implements the Deacon pattern for stuck agent detection:- Ping timeout: 30 seconds
- Consecutive failures: 3 before recovery
- Cooldown: 5 minutes between force-kills
- Force kill the tmux session
- Record the kill in health.json
- Respawn with crash recovery context
FPP (Fixed Point Principle)
βAny runnable action is a fixed point and must resolve before the system can rest.βInspired by Doctor Who: a fixed point in time must occur β it cannot be avoided. Fixed Point Principle (FPP): Any runnable bead, hook, or agent action represents a fixed point in execution and must be resolved immediately. Panopticon continues executing until no fixed points remain. FPP ensures agents are self-propelling:
- Work items are pushed to the agentβs hook
- On spawn/recovery, the hook is checked
- Pending work is injected into the agentβs prompt
- Completed work is popped from the hook
Development
Dev vs Production Strategy
Panopticon uses a shared config, switchable CLI approach:Running in Development Mode
Switching Between Dev and Prod
Dashboard Modes
| Mode | Command | Use Case |
|---|---|---|
| Production | pan up | Daily usage, containerized, HTTPS at https://pan.localhost |
| Dev | cd src/dashboard && npm run dev | Only for active development on Panopticon itself |
pan up for normal usage - it runs in Docker and wonβt conflict with your projectβs ports. Only use dev mode when actively working on Panopticonβs codebase.
Working on Panopticon While Using It
If youβre both developing Panopticon AND using it for your own projects:- Use
npm linkso CLI changes take effect immediately - Run dashboard from source for hot reload on UI changes
- Config is shared - workspaces/agents work the same either way
- Test in a real project - your own usage is the best test
PRD Architecture
PRD Types
| PRD Type | Location | Purpose |
|---|---|---|
| Canonical PRD | docs/PRD.md | Core product definition, always on main |
| Feature PRD | workspaces/feature-{issue}/docs/{ISSUE}-plan.md | Feature spec, lives in feature branch, merged with PR |
Feature PRDs Live in Workspaces
When you start planning an issue, Panopticon creates:- A git worktree (workspace) for the feature branch
- A planning session that generates a feature PRD
- It gets merged with the PR (documentation travels with code)
- If you abort planning and delete the workspace, you donβt want orphaned PRDs
- Clean separation - each feature is self-contained
PRD Naming Convention
| Document | Naming | Example |
|---|---|---|
| Canonical PRD | PRD.md | docs/PRD.md |
| Feature PRD | {ISSUE}-plan.md | MIN-123-plan.md, PAN-4-plan.md |
| Planning artifacts | In .planning/{issue}/ | .planning/min-123/STATE.md |
Developer Skills
Panopticon has two types of skills:| Directory | Purpose | Synced When |
|---|---|---|
skills/ | User-facing skills for all Panopticon users | Always via pan sync |
dev-skills/ | Developer-only skills for Panopticon contributors | Only in dev mode |
dev-skills/ are:
- Checked into the repo and version-controlled
- Only synced to developersβ machines, not end users
- Shown with
[dev]label inpan sync --dry-run
Related Guides
- Cloister - AI lifecycle management
- Core Commands - CLI reference
- Troubleshooting - Common issues