Architecture
Deep dive into Panopticon’s technical architecture and design decisions.System Overview
Panopticon consists of three main components:projects.yaml registry (see Directory Structure) lets one Panopticon instance manage many repositories at once, the dashboard’s God View aggregates every project’s agents and conversations into a single cross-project surface — one place to see what every agent is doing, regardless of which repo it belongs to.
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, kimi-k2.5, or other provider models |
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.
Remote Workspaces
Panopticon supports remote workspace execution via Fly.io Machines. Remote workspaces provide:- Cloud-hosted agent environments — run agents on remote machines without local resource constraints
- On-demand provisioning — Fly.io Machines spin up per workspace and shut down after merge
- Same workflow —
pan remotecommands mirror local workspace operations
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) - Issue tracker status (reset to Backlog/Open)
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
runtime-metrics.json in the state directory — feeds the dashboard’s Metrics page, where per-model runtime comparisons and performance analytics let you see how different models perform across your workflow.
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, HTTPS at https://pan.localhost |
| Dev | npm run dev | Only for active development on Panopticon itself |
pan up for normal usage. 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