panopticon-cli 0.1.3 → 0.2.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.
Files changed (37) hide show
  1. package/README.md +645 -22
  2. package/dist/chunk-J7JUNJGH.js +1058 -0
  3. package/dist/chunk-J7JUNJGH.js.map +1 -0
  4. package/dist/cli/index.js +1733 -717
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/index.d.ts +368 -5
  7. package/dist/index.js +43 -1
  8. package/package.json +11 -2
  9. package/templates/context/CLAUDE.md.template +81 -0
  10. package/templates/context/STATE.md.template +106 -0
  11. package/templates/context/WORKSPACE.md.template +90 -0
  12. package/templates/docker/dotnet/Dockerfile.dev +22 -0
  13. package/templates/docker/dotnet/README.md +111 -0
  14. package/templates/docker/dotnet/docker-compose.yml +55 -0
  15. package/templates/docker/monorepo/Dockerfile.backend +15 -0
  16. package/templates/docker/monorepo/Dockerfile.frontend +17 -0
  17. package/templates/docker/monorepo/README.md +208 -0
  18. package/templates/docker/monorepo/docker-compose.yml +88 -0
  19. package/templates/docker/nextjs/Dockerfile.dev +20 -0
  20. package/templates/docker/nextjs/README.md +103 -0
  21. package/templates/docker/nextjs/docker-compose.yml +30 -0
  22. package/templates/docker/python-fastapi/Dockerfile.dev +22 -0
  23. package/templates/docker/python-fastapi/README.md +148 -0
  24. package/templates/docker/python-fastapi/docker-compose.yml +65 -0
  25. package/templates/docker/react-vite/Dockerfile.dev +20 -0
  26. package/templates/docker/react-vite/README.md +94 -0
  27. package/templates/docker/react-vite/docker-compose.yml +29 -0
  28. package/templates/docker/spring-boot/Dockerfile.dev +24 -0
  29. package/templates/docker/spring-boot/README.md +111 -0
  30. package/templates/docker/spring-boot/docker-compose.yml +71 -0
  31. package/templates/traefik/README.md +106 -0
  32. package/templates/traefik/docker-compose.yml +40 -0
  33. package/templates/traefik/dynamic/panopticon.yml +51 -0
  34. package/templates/traefik/dynamic/workspace.yml.template +34 -0
  35. package/templates/traefik/traefik.yml +45 -0
  36. package/dist/chunk-FR2P66GU.js +0 -352
  37. package/dist/chunk-FR2P66GU.js.map +0 -1
package/README.md CHANGED
@@ -25,14 +25,142 @@ Panopticon is a unified orchestration layer for AI coding assistants. It works w
25
25
  - **Context Engineering** - Structured state management (STATE.md, WORKSPACE.md)
26
26
  - **Agent CVs** - Work history tracking for capability-based routing
27
27
 
28
+ ---
29
+
30
+ ## Legacy Codebase Support
31
+
32
+ > **"AI works great on greenfield projects, but it's hopeless on our legacy code."**
33
+ >
34
+ > Sound familiar? Your developers aren't wrong. But they're not stuck, either.
35
+
36
+ ### The Problem Every Enterprise Faces
37
+
38
+ AI coding assistants are trained on modern, well-documented open-source code. When they encounter your 15-year-old monolith with:
39
+
40
+ - Mixed naming conventions (some `snake_case`, some `camelCase`, some `SCREAMING_CASE`)
41
+ - Undocumented tribal knowledge ("we never touch the `processUser()` function directly")
42
+ - Schemas that don't match the ORM ("the `accounts` table is actually users")
43
+ - Three different async patterns in the same codebase
44
+ - Build systems that require arcane incantations
45
+
46
+ ...they stumble. Repeatedly. Every session starts from zero.
47
+
48
+ ### Panopticon's Unique Solution: Adaptive Learning
49
+
50
+ Panopticon includes two AI self-monitoring skills that **no other orchestration framework provides**:
51
+
52
+ | Skill | What It Does | Business Impact |
53
+ |-------|--------------|-----------------|
54
+ | **Knowledge Capture** | Detects when AI makes mistakes or gets corrected, prompts to document the learning | AI gets smarter about YOUR codebase over time |
55
+ | **Refactor Radar** | Identifies systemic code issues causing repeated AI confusion, creates actionable proposals | Surfaces technical debt that's costing you AI productivity |
56
+
57
+ #### How It Works
58
+
59
+ ```
60
+ Session 1: AI queries users.created_at → Error (column is "createdAt")
61
+ → Knowledge Capture prompts: "Document this convention?"
62
+ → User: "Yes, create skill"
63
+ → Creates project-specific skill documenting naming conventions
64
+
65
+ Session 2: AI knows to use camelCase for this project
66
+ No more mistakes on column names
67
+
68
+ Session 5: Refactor Radar detects: "Same entity called 'user', 'account', 'member'
69
+ across layers - this is causing repeated confusion"
70
+ → Offers to create issue with refactoring proposal
71
+ → Tech lead reviews and schedules cleanup sprint
72
+ ```
73
+
74
+ #### The Compound Effect
75
+
76
+ | Week | Without Panopticon | With Panopticon |
77
+ |------|-------------------|-----------------|
78
+ | 1 | AI makes 20 mistakes/day on conventions | AI makes 20 mistakes, captures 8 learnings |
79
+ | 2 | AI makes 20 mistakes/day (no memory) | AI makes 12 mistakes, captures 5 more |
80
+ | 4 | AI makes 20 mistakes/day (still no memory) | AI makes 3 mistakes, codebase improving |
81
+ | 8 | Developers give up on AI for legacy code | AI is productive, tech debt proposals in backlog |
82
+
83
+ #### Shared Team Knowledge
84
+
85
+ **When one developer learns, everyone benefits.**
86
+
87
+ Captured skills live in your project's `.claude/skills/` directory - they're version-controlled alongside your code. When Sarah documents that "we use camelCase columns" after hitting that error, every developer on the team - and every AI session from that point forward - inherits that knowledge automatically.
88
+
89
+ ```
90
+ myproject/
91
+ ├── .claude/skills/
92
+ │ └── project-knowledge/ # ← Git-tracked, shared by entire team
93
+ │ └── SKILL.md # "Database uses camelCase, not snake_case"
94
+ ├── src/
95
+ └── ...
96
+ ```
97
+
98
+ No more repeating the same corrections to AI across 10 different developers. No more tribal knowledge locked in one person's head. The team's collective understanding of your codebase becomes permanent, searchable, and automatically applied.
99
+
100
+ **New hire onboarding?** The AI already knows your conventions from day one.
101
+
102
+ #### For Technical Leaders
103
+
104
+ **What gets measured gets managed.** Panopticon's Refactor Radar surfaces the specific patterns that are costing you AI productivity:
105
+
106
+ - "Here are the 5 naming inconsistencies causing 40% of AI errors"
107
+ - "These 3 missing FK constraints led to 12 incorrect deletions last month"
108
+ - "Mixed async patterns in payments module caused 8 rollbacks"
109
+
110
+ Each proposal includes:
111
+ - **Evidence**: Specific file paths and examples
112
+ - **Impact**: How this affects AI (and new developers)
113
+ - **Migration path**: Incremental fix that won't break production
114
+
115
+ #### For Executives
116
+
117
+ **ROI is simple:**
118
+
119
+ - $200K/year senior developer spends 2 hours/day correcting AI on legacy code
120
+ - That's $50K/year in wasted productivity per developer
121
+ - Team of 10 = **$500K/year** in AI friction
122
+
123
+ Panopticon's learning system:
124
+ - Captures corrections once, applies them forever
125
+ - Identifies root causes (not just symptoms)
126
+ - Creates actionable improvement proposals
127
+ - Works across your entire AI toolchain (Claude, Codex, Cursor, Gemini)
128
+
129
+ **This isn't "AI for greenfield only." This is AI that learns your business.**
130
+
131
+ #### Configurable Per Team and Per Developer
132
+
133
+ Different teams have different ownership boundaries. Individual developers have different preferences. Panopticon respects both:
134
+
135
+ ```markdown
136
+ # In ~/.claude/CLAUDE.md (developer's personal config)
137
+
138
+ ## AI Suggestion Preferences
139
+
140
+ ### refactor-radar
141
+ skip: database-migrations, infrastructure # DBA/Platform team handles these
142
+ welcome: naming, code-organization # Always happy for these
143
+
144
+ ### knowledge-capture
145
+ skip: authentication # Security team owns this
146
+ ```
147
+
148
+ - **"Skip database migrations"** - Your DBA has a change management process
149
+ - **"Skip infrastructure"** - Platform team owns that
150
+ - **"Welcome naming fixes"** - Low risk, high value, always appreciated
151
+
152
+ The AI adapts to your org structure, not the other way around.
153
+
154
+ ---
155
+
28
156
  ## Quick Start
29
157
 
30
158
  ```bash
31
159
  # Install Panopticon
32
160
  npm install -g panopticon-cli
33
161
 
34
- # Initialize configuration
35
- pan init
162
+ # Install prerequisites and setup (includes optional HTTPS/Traefik)
163
+ pan install
36
164
 
37
165
  # Sync skills to all AI tools
38
166
  pan sync
@@ -41,12 +169,64 @@ pan sync
41
169
  pan doctor
42
170
  ```
43
171
 
172
+ ### HTTPS Setup (Optional)
173
+
174
+ Panopticon supports local HTTPS via Traefik reverse proxy:
175
+
176
+ ```bash
177
+ # Full install (includes Traefik + mkcert for HTTPS)
178
+ pan install
179
+
180
+ # Add to /etc/hosts (macOS/Linux)
181
+ echo "127.0.0.1 pan.localhost" | sudo tee -a /etc/hosts
182
+
183
+ # Start with HTTPS
184
+ pan up
185
+ # → Dashboard: https://pan.localhost
186
+ # → Traefik UI: https://traefik.pan.localhost:8080
187
+ ```
188
+
189
+ **Minimal install** (skip Traefik, use ports):
190
+ ```bash
191
+ pan install --minimal
192
+ pan up
193
+ # → Dashboard: http://localhost:3010
194
+ ```
195
+
196
+ See [docs/DNS_SETUP.md](docs/DNS_SETUP.md) for detailed DNS configuration (especially for WSL2).
197
+
198
+ ## Supported Platforms
199
+
200
+ | Platform | Support |
201
+ |----------|---------|
202
+ | **Linux** | Full support |
203
+ | **macOS** | Full support |
204
+ | **Windows** | WSL2 required |
205
+
206
+ > **Windows users:** Panopticon requires WSL2 (Windows Subsystem for Linux 2). Native Windows is not supported. [Install WSL2](https://docs.microsoft.com/en-us/windows/wsl/install)
207
+
44
208
  ## Requirements
45
209
 
210
+ ### Required
46
211
  - Node.js 18+
47
- - tmux (for agent sessions)
48
212
  - Git (for worktree-based workspaces)
49
- - Linear API key (for issue tracking)
213
+ - Docker (for Traefik and workspace containers)
214
+ - tmux (for agent sessions)
215
+ - **ttyd** - Web terminal for interactive planning sessions. Auto-installed by `pan install`.
216
+ - **GitHub CLI (`gh`)** - For GitHub integration (issues, PRs, merges). [Install](https://cli.github.com/)
217
+ - **GitLab CLI (`glab`)** - For GitLab integration (if using GitLab). [Install](https://gitlab.com/gitlab-org/cli)
218
+
219
+ ### Optional
220
+ - **mkcert** - For HTTPS certificates (recommended)
221
+ - **Linear API key** - For issue tracking integration
222
+ - **Beads CLI (bd)** - For persistent task tracking across sessions
223
+
224
+ ### Why CLI tools instead of API tokens?
225
+
226
+ Panopticon uses `gh` and `glab` CLIs instead of raw API tokens because:
227
+ - **Better auth**: OAuth tokens that auto-refresh (no expiring PATs)
228
+ - **Simpler setup**: `gh auth login` handles everything
229
+ - **Agent-friendly**: Agents can use them for PRs, merges, reviews
50
230
 
51
231
  ## Configuration
52
232
 
@@ -54,9 +234,44 @@ Create `~/.panopticon.env`:
54
234
 
55
235
  ```bash
56
236
  LINEAR_API_KEY=lin_api_xxxxx
57
- GITHUB_TOKEN=ghp_xxxxx # Optional: for secondary tracker
237
+ GITHUB_TOKEN=ghp_xxxxx # Optional: for GitHub-tracked projects
238
+ ```
239
+
240
+ ### Register Projects
241
+
242
+ Register your local project directories so Panopticon knows where to create workspaces:
243
+
244
+ ```bash
245
+ # Register a project
246
+ pan project add /path/to/your/project --name myproject
247
+
248
+ # List registered projects
249
+ pan project list
58
250
  ```
59
251
 
252
+ ### Map Linear Projects to Local Directories
253
+
254
+ If you have multiple Linear projects, configure which local directory each maps to. Create/edit `~/.panopticon/project-mappings.json`:
255
+
256
+ ```json
257
+ [
258
+ {
259
+ "linearProjectId": "abc123",
260
+ "linearProjectName": "Mind Your Now",
261
+ "linearPrefix": "MIN",
262
+ "localPath": "/home/user/projects/myn"
263
+ },
264
+ {
265
+ "linearProjectId": "def456",
266
+ "linearProjectName": "Househunt",
267
+ "linearPrefix": "HH",
268
+ "localPath": "/home/user/projects/househunt"
269
+ }
270
+ ]
271
+ ```
272
+
273
+ The dashboard uses this mapping to determine where to create workspaces when you click "Create Workspace" or "Start Agent" for an issue.
274
+
60
275
  ## Commands
61
276
 
62
277
  ### Core Commands
@@ -111,6 +326,93 @@ pan work hook push agent-min-123 "Continue with tests"
111
326
  pan work hook mail agent-min-123 "Review feedback received"
112
327
  ```
113
328
 
329
+ ### Workspace Management
330
+
331
+ **Workspaces are git worktrees** - isolated working directories for each issue/feature. Each workspace:
332
+ - Has its own feature branch (e.g., `feature/min-123-add-login`)
333
+ - Shares git history with the main repo (no separate clone)
334
+ - Can run independently (separate node_modules, builds, etc.)
335
+ - Is located at `{project}/workspaces/{issue-id}/`
336
+
337
+ This allows multiple agents to work on different features simultaneously without conflicts.
338
+
339
+ #### Git-Backed Collaborative Planning
340
+
341
+ | Start Planning | Codebase Exploration | Discovery Questions |
342
+ |----------------|---------------------|---------------------|
343
+ | ![Start](docs/planning-session-dialog.png) | ![Exploring](docs/planning-session-active.png) | ![Discovery](docs/planning-session-discovery.png) |
344
+ | Click to create workspace and start AI planning | Claude explores the codebase, reads docs, understands patterns | Interactive questions to clarify requirements and approach |
345
+
346
+ Planning artifacts are stored **inside the workspace**, making them part of the feature branch:
347
+
348
+ ```
349
+ workspaces/feature-min-123/
350
+ ├── .planning/
351
+ │ ├── output.jsonl # Full conversation history (tool uses + results)
352
+ │ ├── PLANNING_PROMPT.md # Initial planning prompt
353
+ │ ├── CONTINUATION_PROMPT.md # Context for continued sessions
354
+ │ └── output-*.jsonl # Backup of previous rounds
355
+ └── ... (code)
356
+ ```
357
+
358
+ ![Planning Session Output](docs/planning-session-output.png)
359
+
360
+ When the planning session completes, the AI generates:
361
+ - **STATE.md** - Current understanding, decisions made, and implementation plan
362
+ - **Beads tasks** - Trackable sub-tasks with dependencies for the implementation
363
+ - **Feature PRD** - Copied to `docs/prds/active/{issue}-plan.md` for documentation
364
+
365
+ **This enables:**
366
+
367
+ 1. **Collaborative async planning** - Push your branch, someone else pulls and continues the planning session with full context
368
+ 2. **Context recovery** - If Claude's context compacts, the full conversation is preserved in the branch
369
+ 3. **Audit trail** - See how planning decisions were made, what files were explored, what questions were asked
370
+ 4. **Branch portability** - The planning state travels with the feature branch
371
+
372
+ **Dashboard workflow (recommended):**
373
+
374
+ The planning dialog has **Pull** and **Push** buttons that handle git operations automatically:
375
+
376
+ | Button | What it does |
377
+ |--------|--------------|
378
+ | **Pull** | Fetches from origin, creates workspace from remote branch if needed, pulls latest changes |
379
+ | **Push** | Commits `.planning/` artifacts and pushes to origin |
380
+
381
+ 1. Person A starts planning in dashboard, clicks **Push** when interrupted
382
+ 2. Person B opens same issue in dashboard, clicks **Pull** → gets Person A's full context
383
+ 3. Person B continues the planning session and clicks **Push** when done
384
+
385
+ **CLI workflow:**
386
+ ```bash
387
+ # Person A starts planning
388
+ pan work plan MIN-123
389
+ # ... answers discovery questions, gets interrupted ...
390
+
391
+ # Push the branch (includes planning context)
392
+ cd workspaces/feature-min-123
393
+ git add .planning && git commit -m "WIP: planning session"
394
+ git push origin feature/min-123
395
+
396
+ # Person B continues
397
+ git pull origin feature/min-123
398
+ pan work plan MIN-123 --continue
399
+ # Claude has full context from Person A's session
400
+ ```
401
+
402
+ ```bash
403
+ # Create a workspace (git worktree) without starting an agent
404
+ pan workspace create MIN-123
405
+
406
+ # List all workspaces
407
+ pan workspace list
408
+
409
+ # Destroy a workspace
410
+ pan workspace destroy MIN-123
411
+
412
+ # Force destroy (even with uncommitted changes)
413
+ pan workspace destroy MIN-123 --force
414
+ ```
415
+
114
416
  ### Project Management
115
417
 
116
418
  ```bash
@@ -159,33 +461,153 @@ pan work recover --all
159
461
 
160
462
  ## Dashboard
161
463
 
464
+ ![Panopticon Dashboard](docs/dashboard-overview.png)
465
+
162
466
  Start the monitoring dashboard:
163
467
 
164
468
  ```bash
165
469
  pan up
166
470
  ```
167
471
 
168
- - Frontend: http://localhost:3001
169
- - API: http://localhost:3002
472
+ **Recommended (containerized with HTTPS):**
473
+ - Dashboard: https://pan.localhost
474
+ - Traefik UI: https://traefik.pan.localhost:8082
475
+
476
+ This runs everything in Docker containers, avoiding port conflicts with your other projects.
477
+
478
+ **Minimal install (no Docker):**
479
+ ```bash
480
+ pan up --minimal
481
+ ```
482
+ - Dashboard: http://localhost:3010
170
483
 
171
484
  Stop with `pan down`.
172
485
 
486
+ ### Dashboard Tabs
487
+
488
+ | Tab | Purpose |
489
+ |-----|---------|
490
+ | **Board** | Kanban view of Linear issues with drag-and-drop status changes |
491
+ | **Agents** | Running agent sessions with terminal output |
492
+ | **Activity** | Real-time `pan` command output log |
493
+ | **Metrics** | Runtime comparison and cost tracking |
494
+ | **Skills** | Available skills and their descriptions |
495
+ | **Health** | System health checks and diagnostics |
496
+
497
+ ### Metrics & Cost Tracking
498
+
499
+ The **Metrics** tab provides insights into AI agent performance and costs:
500
+
501
+ - **Per-issue cost badges** - See costs directly on Kanban cards (color-coded by amount)
502
+ - **Issue cost breakdown** - Click an issue to see detailed costs by model and session
503
+ - **Runtime comparison** - Compare success rates, duration, and costs across runtimes (Claude, Codex, etc.)
504
+ - **Capability analysis** - See how different task types (feature, bugfix, refactor) perform
505
+
506
+ Cost data is stored in `~/.panopticon/`:
507
+ - `session-map.json` - Links Claude Code sessions to issues
508
+ - `runtime-metrics.json` - Aggregated runtime performance data
509
+ - `costs/` - Raw cost logs
510
+
511
+ **API Endpoints:**
512
+
513
+ | Endpoint | Description |
514
+ |----------|-------------|
515
+ | `GET /api/costs/summary` | Overall cost summary (today/week/month) |
516
+ | `GET /api/costs/by-issue` | Costs grouped by issue |
517
+ | `GET /api/issues/:id/costs` | Cost details for a specific issue |
518
+ | `GET /api/metrics/runtimes` | Runtime comparison metrics |
519
+ | `GET /api/metrics/tasks` | Recent task history |
520
+
173
521
  ## Skills
174
522
 
175
- Panopticon ships with 10+ high-value skills:
523
+ Panopticon ships with 25+ skills organized into categories:
524
+
525
+ ### Development Workflows
176
526
 
177
527
  | Skill | Description |
178
528
  |-------|-------------|
179
529
  | `feature-work` | Standard feature development workflow |
180
530
  | `bug-fix` | Systematic bug investigation and fix |
531
+ | `refactor` | Safe refactoring with test coverage |
181
532
  | `code-review` | Comprehensive code review checklist |
182
533
  | `code-review-security` | OWASP Top 10 security analysis |
183
534
  | `code-review-performance` | Algorithm and resource optimization |
184
- | `refactor` | Safe refactoring with test coverage |
185
535
  | `release` | Step-by-step release process |
186
- | `incident-response` | Production incident handling |
187
536
  | `dependency-update` | Safe dependency updates |
537
+ | `incident-response` | Production incident handling |
188
538
  | `onboard-codebase` | Understanding new codebases |
539
+ | `work-complete` | Checklist for completing agent work |
540
+
541
+ ### AI Self-Monitoring
542
+
543
+ | Skill | Description |
544
+ |-------|-------------|
545
+ | `knowledge-capture` | Captures learnings when AI gets confused or corrected |
546
+ | `refactor-radar` | Detects systemic issues causing AI confusion |
547
+ | `session-health` | Detect and clean up stuck sessions |
548
+
549
+ ### Panopticon Operations (pan-*)
550
+
551
+ | Skill | Description |
552
+ |-------|-------------|
553
+ | `pan-help` | Show all Panopticon commands |
554
+ | `pan-up` | Start dashboard and services |
555
+ | `pan-down` | Stop dashboard and services |
556
+ | `pan-status` | Show running agents |
557
+ | `pan-issue` | Spawn agent for an issue |
558
+ | `pan-plan` | Create execution plan for issue |
559
+ | `pan-tell` | Send message to running agent |
560
+ | `pan-kill` | Kill a running agent |
561
+ | `pan-approve` | Approve agent work and merge |
562
+ | `pan-health` | Check system health |
563
+ | `pan-sync` | Sync skills to AI tools |
564
+ | `pan-install` | Install prerequisites |
565
+ | `pan-setup` | Initial setup wizard |
566
+ | `pan-quickstart` | Quick start guide |
567
+ | `pan-projects` | Manage registered projects |
568
+ | `pan-tracker` | Issue tracker operations |
569
+ | `pan-logs` | View agent logs |
570
+ | `pan-rescue` | Recover crashed agents |
571
+ | `pan-diagnose` | Diagnose agent issues |
572
+ | `pan-docker` | Docker operations |
573
+ | `pan-network` | Network diagnostics |
574
+ | `pan-config` | Configuration management |
575
+ | `pan-convoy-synthesis` | Synthesize convoy coordination |
576
+ | `pan-subagent-creator` | Create specialized subagents |
577
+ | `pan-skill-creator` | Create new skills (guided) |
578
+
579
+ ### Utilities
580
+
581
+ | Skill | Description |
582
+ |-------|-------------|
583
+ | `beads` | Git-backed issue tracking with dependencies |
584
+ | `skill-creator` | Guide for creating new skills |
585
+ | `web-design-guidelines` | UI/UX review checklist |
586
+
587
+ ### Reserved Skill Names
588
+
589
+ Panopticon reserves all skill names listed above. **Do not use these names for project-specific skills** to avoid conflicts.
590
+
591
+ **Recommendation:** Use a project-specific prefix for your skills (e.g., `myn-standards`, `acme-deployment`) to avoid namespace collisions.
592
+
593
+ ### Project-Specific Skills
594
+
595
+ Projects can have their own skills alongside Panopticon's:
596
+
597
+ ```
598
+ ~/.claude/skills/
599
+ ├── pan-help/ # Symlink → ~/.panopticon/skills/pan-help/
600
+ ├── feature-work/ # Symlink → ~/.panopticon/skills/feature-work/
601
+ └── ... (other pan skills)
602
+
603
+ {project}/.claude/skills/
604
+ ├── myn-standards/ # Project-specific (git-tracked)
605
+ └── myn-api-patterns/ # Project-specific (git-tracked)
606
+ ```
607
+
608
+ Project-specific skills in `{project}/.claude/skills/` are **not managed by Panopticon**. They live in your project's git repo and take precedence over global skills with the same name.
609
+
610
+ ### Skill Distribution
189
611
 
190
612
  Skills are synced to all supported AI tools via symlinks:
191
613
 
@@ -197,21 +619,80 @@ Skills are synced to all supported AI tools via symlinks:
197
619
  ~/.gemini/skills/ # Gemini CLI
198
620
  ```
199
621
 
622
+ ## PRD Convention
623
+
624
+ Panopticon enforces a standard approach to Product Requirements Documents (PRDs) across all managed projects.
625
+
626
+ ### PRD Structure
627
+
628
+ Every project has a **canonical PRD** that defines the core product:
629
+
630
+ ```
631
+ {project}/
632
+ ├── docs/
633
+ │ └── PRD.md # The canonical PRD (core product definition)
634
+ ├── workspaces/
635
+ │ └── feature-{issue}/
636
+ │ └── docs/
637
+ │ └── {ISSUE}-plan.md # Feature PRD (lives in feature branch)
638
+ ```
639
+
640
+ | PRD Type | Location | Purpose |
641
+ |----------|----------|---------|
642
+ | **Canonical PRD** | `docs/PRD.md` | Core product definition, always on main |
643
+ | **Feature PRD** | `workspaces/feature-{issue}/docs/{ISSUE}-plan.md` | Feature spec, lives in feature branch, merged with PR |
644
+
645
+ ### Feature PRDs Live in Workspaces
646
+
647
+ When you start planning an issue, Panopticon creates:
648
+ 1. A git worktree (workspace) for the feature branch
649
+ 2. A planning session that generates a feature PRD
650
+
651
+ The feature PRD **lives in the workspace** (feature branch) because:
652
+ - It gets merged with the PR (documentation travels with code)
653
+ - If you abort planning and delete the workspace, you don't want orphaned PRDs
654
+ - Clean separation - each feature is self-contained
655
+
656
+ ### Project Initialization
657
+
658
+ When registering a new project with Panopticon (`pan project add`), the system will:
659
+
660
+ 1. **Check for existing PRD** - Look for `docs/PRD.md`, `PRD.md`, `README.md`, or similar
661
+ 2. **If found**: Use it to create/update the canonical PRD format, prompting for any missing crucial information
662
+ 3. **If not found**: Generate one by:
663
+ - Analyzing the codebase structure
664
+ - Identifying key technologies and patterns
665
+ - Asking discovery questions about the product
666
+
667
+ This ensures every Panopticon-managed project has a well-defined canonical PRD that agents can reference.
668
+
669
+ ### PRD Naming Convention
670
+
671
+ | Document | Naming | Example |
672
+ |----------|--------|---------|
673
+ | Canonical PRD | `PRD.md` | `docs/PRD.md` |
674
+ | Feature PRD | `{ISSUE}-plan.md` | `MIN-123-plan.md`, `PAN-4-plan.md` |
675
+ | Planning artifacts | In `.planning/{issue}/` | `.planning/min-123/STATE.md` |
676
+
200
677
  ## Architecture
201
678
 
202
679
  ```
203
680
  ~/.panopticon/
204
- skills/ # Shared skills (SKILL.md format)
205
- commands/ # Slash commands
206
- agents/ # Per-agent state
681
+ skills/ # Shared skills (SKILL.md format)
682
+ commands/ # Slash commands
683
+ agents/ # Per-agent state
207
684
  agent-min-123/
208
- state.json # Agent state
209
- health.json # Health status
210
- hook.json # GUPP work queue
211
- cv.json # Work history
212
- mail/ # Incoming messages
213
- projects.json # Managed projects
214
- backups/ # Sync backups
685
+ state.json # Agent state
686
+ health.json # Health status
687
+ hook.json # GUPP work queue
688
+ cv.json # Work history
689
+ 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
694
+ costs/ # Raw cost logs (JSONL)
695
+ backups/ # Sync backups
215
696
  ```
216
697
 
217
698
  ## Health Monitoring (Deacon Pattern)
@@ -237,6 +718,148 @@ GUPP ensures agents are self-propelling:
237
718
  3. Pending work is injected into the agent's prompt
238
719
  4. Completed work is popped from the hook
239
720
 
240
- ## License
721
+ ## Development
722
+
723
+ ### Dev vs Production Strategy
724
+
725
+ Panopticon uses a **shared config, switchable CLI** approach:
726
+
727
+ ```
728
+ ~/.panopticon/ # Shared by both dev and prod
729
+ ├── config.toml # Settings
730
+ ├── projects.json # Registered projects
731
+ ├── project-mappings.json # Linear → local path mappings
732
+ ├── agents/ # Agent state
733
+ └── skills/ # Shared skills
734
+ ```
735
+
736
+ Both dev and production versions read/write the same config, so you can switch between them freely.
737
+
738
+ ### Running in Development Mode
739
+
740
+ ```bash
741
+ # Clone and setup
742
+ git clone https://github.com/eltmon/panopticon.git
743
+ cd panopticon
744
+ npm install
745
+
746
+ # Link dev version globally (makes 'pan' use your local code)
747
+ npm link
748
+
749
+ # Start the dashboard (with hot reload)
750
+ cd src/dashboard
751
+ npm run install:all
752
+ npm run dev
753
+ # → Frontend: http://localhost:3010
754
+ # → API: http://localhost:3011
755
+ ```
756
+
757
+ ### Switching Between Dev and Prod
241
758
 
242
- MIT
759
+ ```bash
760
+ # Use dev version (from your local repo)
761
+ cd /path/to/panopticon && npm link
762
+
763
+ # Switch back to stable release
764
+ npm unlink panopticon-cli
765
+ npm install -g panopticon-cli
766
+ ```
767
+
768
+ ### Dashboard Modes
769
+
770
+ | Mode | Command | Use Case |
771
+ |------|---------|----------|
772
+ | **Production** | `pan up` | Daily usage, containerized, HTTPS at https://pan.localhost |
773
+ | **Dev** | `cd src/dashboard && npm run dev` | Only for active development on Panopticon itself |
774
+
775
+ **Note:** Use `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.
776
+
777
+ ### Working on Panopticon While Using It
778
+
779
+ If you're both developing Panopticon AND using it for your own projects:
780
+
781
+ 1. **Use `npm link`** so CLI changes take effect immediately
782
+ 2. **Run dashboard from source** for hot reload on UI changes
783
+ 3. **Config is shared** - workspaces/agents work the same either way
784
+ 4. **Test in a real project** - your own usage is the best test
785
+
786
+ ## Troubleshooting
787
+
788
+ ### Slow Vite/React Frontend with Multiple Workspaces
789
+
790
+ If running multiple containerized workspaces with Vite/React frontends, you may notice CPU spikes and slow HMR. This is because Vite's default file watching polls every 100ms, which compounds with multiple instances.
791
+
792
+ **Fix:** Increase the polling interval in your `vite.config.mjs`:
793
+
794
+ ```javascript
795
+ server: {
796
+ watch: {
797
+ usePolling: true,
798
+ interval: 3000, // Poll every 3s instead of 100ms default
799
+ },
800
+ }
801
+ ```
802
+
803
+ A 3000ms interval supports 4-5 concurrent workspaces comfortably while maintaining acceptable HMR responsiveness.
804
+
805
+ ### Corrupted Workspaces
806
+
807
+ A workspace can become "corrupted" when it exists as a directory but is no longer a valid git worktree. The dashboard will show a yellow "Workspace Corrupted" warning with an option to clean and recreate.
808
+
809
+ **Symptoms:**
810
+ - Dashboard shows "Workspace Corrupted" warning
811
+ - `git status` in the workspace fails with "not a git repository"
812
+ - The `.git` file is missing from the workspace directory
813
+
814
+ **Common Causes:**
815
+
816
+ | Cause | Description |
817
+ |-------|-------------|
818
+ | **Interrupted creation** | `pan workspace create` was killed mid-execution (Ctrl+C, system crash) |
819
+ | **Manual .git deletion** | Someone accidentally deleted the `.git` file in the workspace |
820
+ | **Disk space issues** | Ran out of disk space during workspace creation |
821
+ | **Git worktree pruning** | Running `git worktree prune` in the main repo removed the worktree link |
822
+ | **Force-deleted main repo** | The main repository was moved or deleted while workspaces existed |
823
+
824
+ **Resolution:**
825
+
826
+ 1. **Via Dashboard (recommended):**
827
+ - Click on the issue to open the detail panel
828
+ - Click "Clean & Recreate" button
829
+ - Review the files that will be deleted
830
+ - Check "Create backup" to preserve your work (recommended)
831
+ - Click "Backup & Recreate"
832
+
833
+ 2. **Via CLI:**
834
+ ```bash
835
+ # Option 1: Manual cleanup
836
+ rm -rf /path/to/project/workspaces/feature-issue-123
837
+ pan workspace create ISSUE-123
838
+
839
+ # Option 2: Backup first
840
+ cp -r /path/to/project/workspaces/feature-issue-123 /tmp/backup-issue-123
841
+ rm -rf /path/to/project/workspaces/feature-issue-123
842
+ pan workspace create ISSUE-123
843
+ # Then manually restore files from backup
844
+ ```
845
+
846
+ **Prevention:**
847
+ - Don't interrupt `pan workspace create` commands
848
+ - Don't run `git worktree prune` in the main repo without checking for active workspaces
849
+ - Ensure adequate disk space before creating workspaces
850
+
851
+ ## ⭐ Star History
852
+
853
+ <a href="https://star-history.com/#eltmon/panopticon&Date">
854
+ <picture>
855
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=eltmon/panopticon&type=Date&theme=dark" />
856
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=eltmon/panopticon&type=Date" />
857
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=eltmon/panopticon&type=Date" />
858
+ </picture>
859
+ </a>
860
+
861
+ ## ⚖️ License
862
+
863
+ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
864
+
865
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)