panopticon-cli 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,8 +19,10 @@ Panopticon is a unified orchestration layer for AI coding assistants. It works w
19
19
  ### Features
20
20
 
21
21
  - **Multi-agent orchestration** - Spawn and manage multiple AI agents in tmux sessions
22
+ - **Cloister AI Lifecycle Manager** - Automatic model routing, stuck detection, and specialist handoffs
22
23
  - **Universal skills** - One SKILL.md format works across all supported tools
23
- - **GUPP Hooks** - Self-propelling agents that auto-resume work
24
+ - **Heartbeat Hooks** - Real-time agent activity monitoring via Claude Code hooks
25
+ - **Multi-project support** - YAML-based project registry with label-based issue routing
24
26
  - **Health Monitoring** - Deacon-style stuck detection with auto-recovery
25
27
  - **Context Engineering** - Structured state management (STATE.md, WORKSPACE.md)
26
28
  - **Agent CVs** - Work history tracking for capability-based routing
@@ -235,8 +237,22 @@ Create `~/.panopticon.env`:
235
237
  ```bash
236
238
  LINEAR_API_KEY=lin_api_xxxxx
237
239
  GITHUB_TOKEN=ghp_xxxxx # Optional: for GitHub-tracked projects
240
+ RALLY_API_KEY=_xxxxx # Optional: for Rally as secondary tracker
238
241
  ```
239
242
 
243
+ ### Issue Trackers
244
+
245
+ Panopticon supports multiple issue trackers:
246
+
247
+ | Tracker | Role | Configuration |
248
+ |---------|------|---------------|
249
+ | **Linear** | Primary tracker | `LINEAR_API_KEY` in `.panopticon.env` |
250
+ | **GitHub Issues** | Secondary tracker | `GITHUB_TOKEN` or `gh auth login` |
251
+ | **GitLab Issues** | Secondary tracker | `glab auth login` |
252
+ | **Rally** | Secondary tracker | `RALLY_API_KEY` in `.panopticon.env` |
253
+
254
+ Secondary trackers sync issues to the dashboard alongside Linear issues, allowing unified project management.
255
+
240
256
  ### Register Projects
241
257
 
242
258
  Register your local project directories so Panopticon knows where to create workspaces:
@@ -272,18 +288,184 @@ If you have multiple Linear projects, configure which local directory each maps
272
288
 
273
289
  The dashboard uses this mapping to determine where to create workspaces when you click "Create Workspace" or "Start Agent" for an issue.
274
290
 
291
+ ## Cloister: AI Lifecycle Manager
292
+
293
+ Cloister is Panopticon's intelligent agent lifecycle manager. It monitors all running agents and automatically handles:
294
+
295
+ - **Model Routing** - Routes tasks to appropriate models based on complexity
296
+ - **Stuck Detection** - Identifies agents that have stopped making progress
297
+ - **Automatic Handoffs** - Escalates to specialists when needed
298
+ - **Specialist Coordination** - Manages test-agent, review-agent, and merge-agent
299
+
300
+ ### How Cloister Works
301
+
302
+ ```
303
+ ┌─────────────────────────────────────────────────────────────┐
304
+ │ CLOISTER SERVICE │
305
+ │ │
306
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
307
+ │ │ Heartbeat │───▶│ Trigger │───▶│ Handoff │ │
308
+ │ │ Monitor │ │ Detector │ │ Manager │ │
309
+ │ └─────────────┘ └─────────────┘ └─────────────┘ │
310
+ │ │ │ │ │
311
+ │ ▼ ▼ ▼ │
312
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
313
+ │ │ Agent │ │ Complexity │ │ Specialists │ │
314
+ │ │ Health │ │ Analysis │ │ │ │
315
+ │ └─────────────┘ └─────────────┘ └─────────────┘ │
316
+ └─────────────────────────────────────────────────────────────┘
317
+ ```
318
+
319
+ ### Starting Cloister
320
+
321
+ ```bash
322
+ # Via dashboard - click "Start" in the Cloister status bar
323
+ # Or via CLI:
324
+ pan cloister start
325
+
326
+ # Check status
327
+ pan cloister status
328
+
329
+ # Stop monitoring
330
+ pan cloister stop
331
+ ```
332
+
333
+ ### Specialists
334
+
335
+ Cloister manages specialized agents that handle specific phases of the development lifecycle:
336
+
337
+ | Specialist | Purpose | Trigger |
338
+ |------------|---------|---------|
339
+ | **test-agent** | Runs test suite after implementation | `implementation_complete` signal |
340
+ | **review-agent** | Code review before merge | After tests pass (manual trigger) |
341
+ | **merge-agent** | Handles git merge and conflict resolution | "Approve & Merge" button |
342
+
343
+ ### Automatic Handoffs
344
+
345
+ Cloister detects situations that require intervention:
346
+
347
+ | Trigger | Condition | Action |
348
+ |---------|-----------|--------|
349
+ | **stuck_escalation** | No activity for 30+ minutes | Escalate to more capable model |
350
+ | **complexity_upgrade** | Task complexity exceeds model capability | Route to Opus |
351
+ | **implementation_complete** | Agent signals work is done | Wake test-agent |
352
+ | **merge_requested** | User clicks "Approve & Merge" | Wake merge-agent |
353
+
354
+ ### Heartbeat Monitoring
355
+
356
+ Agents send heartbeats via Claude Code hooks. Cloister tracks:
357
+
358
+ - Last tool use and timestamp
359
+ - Current task being worked on
360
+ - Git branch and workspace
361
+ - Process health
362
+
363
+ Heartbeat files are stored in `~/.panopticon/heartbeats/`:
364
+
365
+ ```json
366
+ {
367
+ "timestamp": "2024-01-22T10:30:00-08:00",
368
+ "agent_id": "agent-min-123",
369
+ "tool_name": "Edit",
370
+ "last_action": "{\"file_path\":\"/path/to/file.ts\"...}",
371
+ "git_branch": "feature/min-123",
372
+ "workspace": "/home/user/projects/myapp/workspaces/feature-min-123"
373
+ }
374
+ ```
375
+
376
+ ### Configuration
377
+
378
+ Cloister configuration lives in `~/.panopticon/cloister/config.json`:
379
+
380
+ ```json
381
+ {
382
+ "monitoring": {
383
+ "heartbeat_interval_ms": 5000,
384
+ "stuck_threshold_minutes": 30,
385
+ "health_check_interval_ms": 30000
386
+ },
387
+ "specialists": {
388
+ "test_agent": { "enabled": true, "auto_wake": true },
389
+ "review_agent": { "enabled": true, "auto_wake": false },
390
+ "merge_agent": { "enabled": true, "auto_wake": false }
391
+ },
392
+ "triggers": {
393
+ "stuck_escalation": { "enabled": true },
394
+ "complexity_upgrade": { "enabled": true }
395
+ }
396
+ }
397
+ ```
398
+
399
+ ---
400
+
401
+ ## Multi-Project Support
402
+
403
+ Panopticon supports managing multiple projects with intelligent issue routing.
404
+
405
+ ### Project Registry
406
+
407
+ Projects are registered in `~/.panopticon/projects.yaml`:
408
+
409
+ ```yaml
410
+ projects:
411
+ myn:
412
+ name: "Mind Your Now"
413
+ path: /home/user/projects/myn
414
+ linear_team: MIN
415
+ issue_routing:
416
+ - labels: [splash, landing-pages, seo]
417
+ path: /home/user/projects/myn/splash
418
+ - labels: [docs, marketing]
419
+ path: /home/user/projects/myn/docs
420
+ - default: true
421
+ path: /home/user/projects/myn
422
+
423
+ panopticon:
424
+ name: "Panopticon"
425
+ path: /home/user/projects/panopticon
426
+ linear_team: PAN
427
+ ```
428
+
429
+ ### Label-Based Routing
430
+
431
+ Issues are routed to different subdirectories based on their labels:
432
+
433
+ 1. **Labeled issues** - Matched against `issue_routing` rules in order
434
+ 2. **Default route** - Issues without matching labels use the `default: true` path
435
+ 3. **Fallback** - If no default, uses the project root path
436
+
437
+ Example: An issue with label "splash" in the MIN team would create its workspace at `/home/user/projects/myn/splash/workspaces/feature-min-xxx/`.
438
+
439
+ ### Managing Projects
440
+
441
+ ```bash
442
+ # List registered projects
443
+ pan project list
444
+
445
+ # Add a project
446
+ pan project add /path/to/project --name myproject --linear-team PRJ
447
+
448
+ # Remove a project
449
+ pan project remove myproject
450
+ ```
451
+
452
+ ---
453
+
275
454
  ## Commands
276
455
 
277
456
  ### Core Commands
278
457
 
279
458
  ```bash
280
459
  pan init # Initialize ~/.panopticon/
281
- pan sync # Sync skills to all AI tools
460
+ pan sync # Sync skills, commands, agents, AND hooks to all AI tools
461
+ pan sync --dry-run # Preview what will be synced
282
462
  pan doctor # Check system health
283
463
  pan skills # List available skills
284
464
  pan status # Show running agents
285
465
  ```
286
466
 
467
+ > **Note:** `pan sync` now automatically syncs heartbeat hooks to `~/.panopticon/bin/`. This happens automatically on `npm install/upgrade` as well.
468
+
287
469
  ### Agent Management
288
470
 
289
471
  ```bash
@@ -459,6 +641,31 @@ pan work recover min-123
459
641
  pan work recover --all
460
642
  ```
461
643
 
644
+ ### Cloister Commands
645
+
646
+ ```bash
647
+ # Start Cloister monitoring service
648
+ pan cloister start
649
+
650
+ # Stop Cloister
651
+ pan cloister stop
652
+
653
+ # Check Cloister status
654
+ pan cloister status
655
+
656
+ # List all specialists
657
+ pan specialists list
658
+
659
+ # Wake a specific specialist
660
+ pan specialists wake merge-agent --issue MIN-123
661
+
662
+ # View specialist queue
663
+ pan specialists queue
664
+
665
+ # Reset specialist state
666
+ pan specialists reset merge-agent
667
+ ```
668
+
462
669
  ## Dashboard
463
670
 
464
671
  ![Panopticon Dashboard](docs/dashboard-overview.png)
@@ -494,6 +701,37 @@ Stop with `pan down`.
494
701
  | **Skills** | Available skills and their descriptions |
495
702
  | **Health** | System health checks and diagnostics |
496
703
 
704
+ ### Issue Cards
705
+
706
+ Issue cards on the Kanban board display:
707
+
708
+ - **Cost badges** - Color-coded by amount ($0-5 green, $5-20 yellow, $20+ red)
709
+ - **Container status** - Shows if workspace has Docker containers (running/stopped)
710
+ - **Agent status** - Indicates if an agent is currently working on the issue
711
+ - **Workspace status** - Shows if workspace exists, is corrupted, or needs creation
712
+
713
+ ### Workspace Actions
714
+
715
+ Click an issue card to open the workspace detail panel:
716
+
717
+ | Button | Action |
718
+ |--------|--------|
719
+ | **Create Workspace** | Creates git worktree for the issue |
720
+ | **Containerize** | Adds Docker containers to an existing workspace |
721
+ | **Start Containers** | Starts stopped Docker containers |
722
+ | **Start Planning** | Opens interactive planning session with AI |
723
+ | **Start Agent** | Spawns autonomous agent in tmux |
724
+ | **Approve & Merge** | Triggers merge-agent to handle PR merge |
725
+
726
+ ### Interactive Planning
727
+
728
+ The planning dialog provides a real-time terminal for collaborative planning:
729
+
730
+ - **Discovery questions** - AI asks clarifying questions before implementation
731
+ - **Codebase exploration** - AI reads files and understands patterns
732
+ - **Pull/Push buttons** - Git operations to share planning context with teammates
733
+ - **AskUserQuestion rendering** - Questions from the AI appear as interactive prompts
734
+
497
735
  ### Metrics & Cost Tracking
498
736
 
499
737
  The **Metrics** tab provides insights into AI agent performance and costs:
@@ -572,6 +810,8 @@ Panopticon ships with 25+ skills organized into categories:
572
810
  | `pan-docker` | Docker operations |
573
811
  | `pan-network` | Network diagnostics |
574
812
  | `pan-config` | Configuration management |
813
+ | `pan-restart` | Safely restart Panopticon dashboard and services |
814
+ | `pan-code-review` | Orchestrate parallel code review (3 reviewers + synthesis) |
575
815
  | `pan-convoy-synthesis` | Synthesize convoy coordination |
576
816
  | `pan-subagent-creator` | Create specialized subagents |
577
817
  | `pan-skill-creator` | Create new skills (guided) |
@@ -584,6 +824,98 @@ Panopticon ships with 25+ skills organized into categories:
584
824
  | `skill-creator` | Guide for creating new skills |
585
825
  | `web-design-guidelines` | UI/UX review checklist |
586
826
 
827
+ ## Subagents
828
+
829
+ Panopticon includes specialized subagent templates for common development tasks. Subagents are invoked via the Task tool or convoy orchestration for parallel execution.
830
+
831
+ ### Code Review Subagents
832
+
833
+ | Subagent | Model | Focus | Output |
834
+ |----------|-------|-------|--------|
835
+ | `code-review-correctness` | haiku | Logic errors, edge cases, type safety | `.claude/reviews/<timestamp>-correctness.md` |
836
+ | `code-review-security` | sonnet | OWASP Top 10, vulnerabilities | `.claude/reviews/<timestamp>-security.md` |
837
+ | `code-review-performance` | haiku | Algorithms, N+1 queries, memory | `.claude/reviews/<timestamp>-performance.md` |
838
+ | `code-review-synthesis` | sonnet | Combines all findings into unified report | `.claude/reviews/<timestamp>-synthesis.md` |
839
+
840
+ **Usage Example:**
841
+ ```bash
842
+ /pan-code-review --files "src/auth/*.ts"
843
+ ```
844
+
845
+ This spawns all three reviewers in parallel, then synthesizes their findings into a prioritized report.
846
+
847
+ ### Planning & Exploration Subagents
848
+
849
+ | Subagent | Model | Focus | Permission Mode |
850
+ |----------|-------|-------|-----------------|
851
+ | `planning-agent` | sonnet | Codebase research, execution planning | `plan` (read-only) |
852
+ | `codebase-explorer` | haiku | Fast architecture discovery, pattern finding | `plan` (read-only) |
853
+ | `triage-agent` | haiku | Issue categorization, complexity estimation | default |
854
+ | `health-monitor` | haiku | Agent stuck detection, log analysis | default |
855
+
856
+ **Usage Examples:**
857
+ ```bash
858
+ # Explore codebase architecture
859
+ Task(subagent_type='codebase-explorer', prompt='Map out the authentication system')
860
+
861
+ # Triage an issue
862
+ Task(subagent_type='triage-agent', prompt='Categorize and estimate ISSUE-123')
863
+
864
+ # Check agent health
865
+ Task(subagent_type='health-monitor', prompt='Check status of all running agents')
866
+ ```
867
+
868
+ ### Parallel Code Review Workflow
869
+
870
+ The `/pan-code-review` skill orchestrates a comprehensive parallel review:
871
+
872
+ ```
873
+ 1. Determine scope (git diff, files, or branch)
874
+ 2. Spawn 3 parallel reviewers:
875
+ ├─→ correctness (logic, types)
876
+ ├─→ security (vulnerabilities)
877
+ └─→ performance (bottlenecks)
878
+ 3. Each writes findings to .claude/reviews/
879
+ 4. Spawn synthesis agent
880
+ 5. Synthesis combines all findings
881
+ 6. Present unified, prioritized report
882
+ ```
883
+
884
+ **Benefits:**
885
+ - **3x faster** than sequential reviews
886
+ - **Comprehensive coverage** across all dimensions
887
+ - **Prioritized findings** (blocker > critical > high > medium > low)
888
+ - **Actionable recommendations** with code examples
889
+
890
+ **Review Output:**
891
+ ```markdown
892
+ # Code Review - Complete Analysis
893
+
894
+ ## Executive Summary
895
+ **Overall Assessment:** Needs Major Revisions
896
+ **Key Findings:**
897
+ - 1 blocker (SQL injection)
898
+ - 4 critical issues
899
+ - 6 high-priority items
900
+
901
+ ## Blocker Issues
902
+ ### 1. [Security] SQL Injection in login endpoint
903
+ ...
904
+
905
+ ## Critical Issues
906
+ ...
907
+ ```
908
+
909
+ ### Creating Custom Subagents
910
+
911
+ Use the `/pan-subagent-creator` skill to create project-specific subagents:
912
+
913
+ ```bash
914
+ /pan-subagent-creator
915
+ ```
916
+
917
+ Subagent templates live in `~/.panopticon/agents/` and sync to `~/.claude/agents/`.
918
+
587
919
  ### Reserved Skill Names
588
920
 
589
921
  Panopticon reserves all skill names listed above. **Do not use these names for project-specific skills** to avoid conflicts.
@@ -678,21 +1010,39 @@ This ensures every Panopticon-managed project has a well-defined canonical PRD t
678
1010
 
679
1011
  ```
680
1012
  ~/.panopticon/
1013
+ config.toml # Main configuration
1014
+ projects.yaml # Multi-project registry with issue routing
1015
+ project-mappings.json # Linear project → local path mappings (legacy)
1016
+ session-map.json # Claude sessions → issue linking
1017
+ runtime-metrics.json # Runtime performance metrics
1018
+
681
1019
  skills/ # Shared skills (SKILL.md format)
682
1020
  commands/ # Slash commands
683
- agents/ # Per-agent state
1021
+ agents/ # Subagent templates (.md files)
1022
+ bin/ # Hook scripts (synced via pan sync)
1023
+ heartbeat-hook # Real-time activity monitoring hook
1024
+
1025
+ agents/ # Per-agent runtime state
684
1026
  agent-min-123/
685
- state.json # Agent state
1027
+ state.json # Agent state (model, phase, complexity)
686
1028
  health.json # Health status
687
1029
  hook.json # GUPP work queue
688
1030
  cv.json # Work history
689
1031
  mail/ # Incoming messages
690
- projects.json # Managed projects
691
- project-mappings.json # Linear project local path mappings
692
- session-map.json # Claude sessions → issue linking
693
- runtime-metrics.json # Runtime performance metrics
1032
+
1033
+ cloister/ # Cloister AI lifecycle manager
1034
+ config.json # Cloister settings
1035
+ state.json # Running state
1036
+ events.jsonl # Handoff event log
1037
+
1038
+ heartbeats/ # Real-time agent activity
1039
+ agent-min-123.json # Last heartbeat from agent
1040
+
694
1041
  costs/ # Raw cost logs (JSONL)
695
1042
  backups/ # Sync backups
1043
+ traefik/ # Traefik reverse proxy config
1044
+ dynamic/ # Dynamic route configs
1045
+ certs/ # TLS certificates
696
1046
  ```
697
1047
 
698
1048
  ## Health Monitoring (Deacon Pattern)