panopticon-cli 0.4.32 → 0.4.33
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/dist/{agents-BDFHF4T3.js → agents-VLK4BMVA.js} +10 -7
- package/dist/chunk-7SN4L4PH.js +150 -0
- package/dist/chunk-7SN4L4PH.js.map +1 -0
- package/dist/chunk-7XNJJBH6.js +538 -0
- package/dist/chunk-7XNJJBH6.js.map +1 -0
- package/dist/chunk-AQXETQHW.js +113 -0
- package/dist/chunk-AQXETQHW.js.map +1 -0
- package/dist/{chunk-2NIAOCIC.js → chunk-ASY7T35E.js} +170 -64
- package/dist/chunk-ASY7T35E.js.map +1 -0
- package/dist/chunk-B3PF6JPQ.js +212 -0
- package/dist/chunk-B3PF6JPQ.js.map +1 -0
- package/dist/{chunk-XP2DXWYP.js → chunk-BKCWRMUX.js} +88 -35
- package/dist/chunk-BKCWRMUX.js.map +1 -0
- package/dist/chunk-CFCUOV3Q.js +669 -0
- package/dist/chunk-CFCUOV3Q.js.map +1 -0
- package/dist/chunk-CWELWPWQ.js +32 -0
- package/dist/chunk-CWELWPWQ.js.map +1 -0
- package/dist/chunk-DI7ABPNQ.js +352 -0
- package/dist/chunk-DI7ABPNQ.js.map +1 -0
- package/dist/{chunk-VU4FLXV5.js → chunk-FQ66DECN.js} +31 -4
- package/dist/chunk-FQ66DECN.js.map +1 -0
- package/dist/{review-status-GWQYY77L.js → chunk-GFP3PIPB.js} +14 -7
- package/dist/chunk-GFP3PIPB.js.map +1 -0
- package/dist/chunk-JQBV3Q2W.js +29 -0
- package/dist/chunk-JQBV3Q2W.js.map +1 -0
- package/dist/{chunk-BWGFN44T.js → chunk-JT4O4YVM.js} +28 -16
- package/dist/chunk-JT4O4YVM.js.map +1 -0
- package/dist/{chunk-VIWUCJ4V.js → chunk-KJ2TRXNK.js} +34 -36
- package/dist/chunk-KJ2TRXNK.js.map +1 -0
- package/dist/{chunk-JY7R7V4G.js → chunk-OMNXYPXC.js} +2 -2
- package/dist/chunk-OMNXYPXC.js.map +1 -0
- package/dist/chunk-PELXV435.js +215 -0
- package/dist/chunk-PELXV435.js.map +1 -0
- package/dist/chunk-PI7Y3PSN.js +797 -0
- package/dist/chunk-PI7Y3PSN.js.map +1 -0
- package/dist/chunk-RBUO57TC.js +154 -0
- package/dist/chunk-RBUO57TC.js.map +1 -0
- package/dist/chunk-XFR2DLMR.js +600 -0
- package/dist/chunk-XFR2DLMR.js.map +1 -0
- package/dist/chunk-XKT5MHPT.js +677 -0
- package/dist/chunk-XKT5MHPT.js.map +1 -0
- package/dist/{chunk-HCTJFIJJ.js → chunk-YLPSQAM2.js} +2 -2
- package/dist/{chunk-HCTJFIJJ.js.map → chunk-YLPSQAM2.js.map} +1 -1
- package/dist/{chunk-6HXKTOD7.js → chunk-ZTFNYOC7.js} +53 -38
- package/dist/chunk-ZTFNYOC7.js.map +1 -0
- package/dist/cli/index.js +4362 -2927
- package/dist/cli/index.js.map +1 -1
- package/dist/{config-BOAMSKTF.js → config-4CJNUE3O.js} +7 -3
- package/dist/dashboard/prompts/merge-agent.md +217 -0
- package/dist/dashboard/prompts/review-agent.md +409 -0
- package/dist/dashboard/prompts/sync-main.md +84 -0
- package/dist/dashboard/prompts/test-agent.md +283 -0
- package/dist/dashboard/prompts/work-agent.md +247 -0
- package/dist/dashboard/public/assets/index-UjZq6ykz.css +32 -0
- package/dist/dashboard/public/assets/index-kAJqtLDO.js +708 -0
- package/dist/dashboard/public/index.html +2 -2
- package/dist/dashboard/server.js +15194 -3160
- package/dist/{dns-L3L2BB27.js → dns-7BDJSD3E.js} +4 -2
- package/dist/{feedback-writer-AAKF5BTK.js → feedback-writer-LVZ5TFYZ.js} +8 -4
- package/dist/feedback-writer-LVZ5TFYZ.js.map +1 -0
- package/dist/hume-WMAUBBV2.js +13 -0
- package/dist/index.d.ts +153 -40
- package/dist/index.js +65 -23
- package/dist/index.js.map +1 -1
- package/dist/{projects-VXRUCMLM.js → projects-JEIVIYC6.js} +3 -3
- package/dist/rally-RKFSWC7E.js +10 -0
- package/dist/{remote-agents-Z3R2A5BN.js → remote-agents-TFSMW7GN.js} +2 -2
- package/dist/{remote-workspace-2G6V2KNP.js → remote-workspace-AHVHQEES.js} +8 -8
- package/dist/review-status-EPFG4XM7.js +19 -0
- package/dist/shadow-state-5MDP6YXH.js +30 -0
- package/dist/shadow-state-5MDP6YXH.js.map +1 -0
- package/dist/{specialist-context-N32QBNNQ.js → specialist-context-T3NBMCIE.js} +8 -7
- package/dist/{specialist-context-N32QBNNQ.js.map → specialist-context-T3NBMCIE.js.map} +1 -1
- package/dist/{specialist-logs-GF3YV4KL.js → specialist-logs-CVKD3YJ3.js} +7 -6
- package/dist/specialist-logs-CVKD3YJ3.js.map +1 -0
- package/dist/{specialists-JBIW6MP4.js → specialists-TKAP6T6Z.js} +7 -6
- package/dist/specialists-TKAP6T6Z.js.map +1 -0
- package/dist/tldr-daemon-T3THOUGT.js +21 -0
- package/dist/tldr-daemon-T3THOUGT.js.map +1 -0
- package/dist/traefik-QX4ZV4YG.js +19 -0
- package/dist/traefik-QX4ZV4YG.js.map +1 -0
- package/dist/tunnel-W2GZBLEV.js +13 -0
- package/dist/tunnel-W2GZBLEV.js.map +1 -0
- package/dist/workspace-manager-KLHUCIZV.js +22 -0
- package/dist/workspace-manager-KLHUCIZV.js.map +1 -0
- package/package.json +2 -2
- package/scripts/heartbeat-hook +37 -10
- package/scripts/patches/llm-tldr-tsx-support.py +109 -0
- package/scripts/pre-tool-hook +26 -15
- package/scripts/record-cost-event.js +177 -43
- package/scripts/record-cost-event.ts +87 -3
- package/scripts/statusline.sh +169 -0
- package/scripts/stop-hook +14 -11
- package/scripts/tldr-post-edit +72 -0
- package/scripts/tldr-read-enforcer +275 -0
- package/skills/check-merged/SKILL.md +143 -0
- package/skills/crash-investigation/SKILL.md +301 -0
- package/skills/github-cli/SKILL.md +185 -0
- package/skills/pan-reopen/SKILL.md +65 -0
- package/skills/pan-sync-main/SKILL.md +87 -0
- package/skills/pan-tldr/SKILL.md +149 -0
- package/skills/react-best-practices/SKILL.md +125 -0
- package/skills/spec-readiness/REPORT-TEMPLATE.md +158 -0
- package/skills/spec-readiness/SCORING-REFERENCE.md +369 -0
- package/skills/spec-readiness/SKILL.md +400 -0
- package/skills/spec-readiness-setup/SKILL.md +361 -0
- package/skills/workspace-status/SKILL.md +56 -0
- package/templates/traefik/dynamic/panopticon.yml.template +0 -5
- package/templates/traefik/traefik.yml +0 -8
- package/dist/chunk-2NIAOCIC.js.map +0 -1
- package/dist/chunk-3XAB4IXF.js +0 -51
- package/dist/chunk-3XAB4IXF.js.map +0 -1
- package/dist/chunk-6HXKTOD7.js.map +0 -1
- package/dist/chunk-BBCUK6N2.js +0 -241
- package/dist/chunk-BBCUK6N2.js.map +0 -1
- package/dist/chunk-BWGFN44T.js.map +0 -1
- package/dist/chunk-ELK6Q7QI.js +0 -545
- package/dist/chunk-ELK6Q7QI.js.map +0 -1
- package/dist/chunk-JY7R7V4G.js.map +0 -1
- package/dist/chunk-LYSBSZYV.js +0 -1523
- package/dist/chunk-LYSBSZYV.js.map +0 -1
- package/dist/chunk-VIWUCJ4V.js.map +0 -1
- package/dist/chunk-VU4FLXV5.js.map +0 -1
- package/dist/chunk-XP2DXWYP.js.map +0 -1
- package/dist/dashboard/public/assets/index-C7X6LP5Z.css +0 -32
- package/dist/dashboard/public/assets/index-ClYqpcAJ.js +0 -645
- package/dist/feedback-writer-AAKF5BTK.js.map +0 -1
- package/dist/review-status-GWQYY77L.js.map +0 -1
- package/dist/traefik-CUJM6K5Z.js +0 -12
- /package/dist/{agents-BDFHF4T3.js.map → agents-VLK4BMVA.js.map} +0 -0
- /package/dist/{config-BOAMSKTF.js.map → config-4CJNUE3O.js.map} +0 -0
- /package/dist/{dns-L3L2BB27.js.map → dns-7BDJSD3E.js.map} +0 -0
- /package/dist/{projects-VXRUCMLM.js.map → hume-WMAUBBV2.js.map} +0 -0
- /package/dist/{remote-agents-Z3R2A5BN.js.map → projects-JEIVIYC6.js.map} +0 -0
- /package/dist/{specialist-logs-GF3YV4KL.js.map → rally-RKFSWC7E.js.map} +0 -0
- /package/dist/{specialists-JBIW6MP4.js.map → remote-agents-TFSMW7GN.js.map} +0 -0
- /package/dist/{remote-workspace-2G6V2KNP.js.map → remote-workspace-AHVHQEES.js.map} +0 -0
- /package/dist/{traefik-CUJM6K5Z.js.map → review-status-EPFG4XM7.js.map} +0 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: crash-investigation
|
|
3
|
+
description: >
|
|
4
|
+
Investigate system crashes, OOM kills, and unresponsive episodes. Analyzes
|
|
5
|
+
previous boot logs, identifies memory hogs, tallies per-process-group consumption,
|
|
6
|
+
checks agent and workspace state, and produces a recovery summary. Use after a
|
|
7
|
+
hard reset, freeze, or reboot caused by resource exhaustion.
|
|
8
|
+
triggers:
|
|
9
|
+
- crash investigation
|
|
10
|
+
- investigate crash
|
|
11
|
+
- why did my system crash
|
|
12
|
+
- OOM investigation
|
|
13
|
+
- system froze
|
|
14
|
+
- out of memory
|
|
15
|
+
- system was unresponsive
|
|
16
|
+
- what happened to my system
|
|
17
|
+
allowed-tools:
|
|
18
|
+
- Bash
|
|
19
|
+
- Read
|
|
20
|
+
- Grep
|
|
21
|
+
- Glob
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Crash Investigation
|
|
25
|
+
|
|
26
|
+
Post-crash forensic analysis for developer workstations running AI agents, containers, and k8s workloads.
|
|
27
|
+
|
|
28
|
+
## When to Use
|
|
29
|
+
|
|
30
|
+
- System was unresponsive and required a hard reset
|
|
31
|
+
- OOM killer was active (processes were killed unexpectedly)
|
|
32
|
+
- CPU was pegged at 100% for an extended period
|
|
33
|
+
- System rebooted unexpectedly
|
|
34
|
+
- Agents were running overnight and the machine froze
|
|
35
|
+
|
|
36
|
+
## Investigation Workflow
|
|
37
|
+
|
|
38
|
+
Work through each phase in order. Collect all evidence before drawing conclusions.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Phase 1: Establish Timeline
|
|
43
|
+
|
|
44
|
+
Determine when the crash happened and how long the previous session ran.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# List recent boots — the previous boot (-1) is the crashed session
|
|
48
|
+
journalctl --list-boots | tail -5
|
|
49
|
+
|
|
50
|
+
# Check reboot history
|
|
51
|
+
last -x reboot shutdown | head -10
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Record:
|
|
55
|
+
- **Previous boot start**: when the session began
|
|
56
|
+
- **Previous boot end**: when the crash/reset occurred
|
|
57
|
+
- **Duration**: how long it ran before crashing
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Phase 2: Check for OOM Kills
|
|
62
|
+
|
|
63
|
+
OOM (Out of Memory) kills are the most common cause of system freezes on dev machines.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# All OOM events from the crashed boot
|
|
67
|
+
journalctl -b -1 --no-pager | grep -E "oom-kill|Out of memory|Killed process" | head -30
|
|
68
|
+
|
|
69
|
+
# Memory pressure and related failures
|
|
70
|
+
journalctl -b -1 --since "<LAST_FEW_HOURS>" --no-pager | \
|
|
71
|
+
grep -iE "oom|out.of.memory|killed process|enomem|cannot allocate|memory pressure" | tail -50
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If OOM kills are found, note:
|
|
75
|
+
- **First OOM kill timestamp** — this is when trouble started
|
|
76
|
+
- **Which processes were killed** and in what order
|
|
77
|
+
- **Whether the right processes were killed** (OOM killer picks by `oom_score_adj`, not by actual memory usage)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### Phase 3: Identify Memory Hogs
|
|
82
|
+
|
|
83
|
+
When the OOM killer fires, the kernel dumps a full process table. This is the most valuable evidence.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Find the process table dump from the first OOM event
|
|
87
|
+
# Look for lines with [pid] format — these are the process listings
|
|
88
|
+
journalctl -b -1 --since "<FIRST_OOM_TIME>" --until "<FIRST_OOM_TIME + 1min>" --no-pager | \
|
|
89
|
+
grep "kernel:" | grep -P "\[\s*\d+\]" | head -80
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Tally Memory by Process Group
|
|
93
|
+
|
|
94
|
+
For each major process type, sum the RSS (resident memory) column. The OOM dump format is:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
[ pid ] uid tgid total_vm rss rss_anon rss_file rss_shmem pgtables_bytes swapents oom_score_adj name
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
RSS is field `$11` when parsed with awk from the full journalctl line. Values are in **pages** (4 KB each).
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Tally for a specific process name (replace PROCNAME)
|
|
104
|
+
journalctl -b -1 --since "<OOM_TIME>" --until "<OOM_TIME + 1min>" --no-pager | \
|
|
105
|
+
grep "kernel:" | grep -P "\bPROCNAME\b" | \
|
|
106
|
+
awk '{rss=$11; total+=rss} END {printf "%s: %d processes, RSS: %.1f GB\n", "PROCNAME", NR, total*4/1024/1024}'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Common process groups to check:
|
|
110
|
+
- `claude` — Claude Code CLI processes
|
|
111
|
+
- `node` — Node.js (includes vitest workers, MCP servers, dev servers)
|
|
112
|
+
- `vitest` — Test runner workers (often named "node (vitest N)")
|
|
113
|
+
- `java` — JVMs (Spring Boot, Minecraft, Solr, k3s pods)
|
|
114
|
+
- `python` — Python services
|
|
115
|
+
- `beam.smp` — Erlang/RabbitMQ
|
|
116
|
+
- `grafana`, `prometheus` — Monitoring stack
|
|
117
|
+
- `postgres` — Database
|
|
118
|
+
|
|
119
|
+
Compare the total against system RAM:
|
|
120
|
+
```bash
|
|
121
|
+
# System RAM
|
|
122
|
+
free -h
|
|
123
|
+
|
|
124
|
+
# CPU count (vitest/jest default to this many workers)
|
|
125
|
+
nproc
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### Phase 4: Analyze the Death Spiral
|
|
131
|
+
|
|
132
|
+
Check the final minutes/hours of the crashed boot for cascading failures.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Last 100 log entries before the crash
|
|
136
|
+
journalctl -b -1 --since "<LAST_10_MINUTES>" --no-pager | tail -100
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Look for these indicators:
|
|
140
|
+
- **"Under memory pressure, flushing caches"** — system is thrashing
|
|
141
|
+
- **"SYN_DROPPED event"** on input devices — kernel dropping mouse/keyboard events (explains unresponsiveness)
|
|
142
|
+
- **"Can't keep up!"** from game servers or other real-time processes
|
|
143
|
+
- **"Watchdog timeout"** on systemd services — services frozen
|
|
144
|
+
- **Services crash-looping** (e.g., fwupd, journald restarting repeatedly)
|
|
145
|
+
- **DNS timeouts** — networking breaking down under load
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
### Phase 5: Check Agent and Workspace State
|
|
150
|
+
|
|
151
|
+
After understanding what caused the crash, assess what work was in progress.
|
|
152
|
+
|
|
153
|
+
#### Agent States
|
|
154
|
+
```bash
|
|
155
|
+
# List all agents and their last state
|
|
156
|
+
for agent_dir in ~/.panopticon/agents/*/; do
|
|
157
|
+
agent=$(basename "$agent_dir")
|
|
158
|
+
state=$(cat "$agent_dir/state.json" 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'{d.get(\"state\",\"unknown\")} @ {d.get(\"lastActivity\",\"?\")}')" 2>/dev/null || echo "no state")
|
|
159
|
+
echo "$agent: $state"
|
|
160
|
+
done
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### Workspace Git Status
|
|
164
|
+
```bash
|
|
165
|
+
# For each workspace, check for uncommitted work and branch status
|
|
166
|
+
for ws in /path/to/project/workspaces/*/; do
|
|
167
|
+
echo "=== $(basename $ws) ==="
|
|
168
|
+
for repo in "$ws"*/; do
|
|
169
|
+
if [ -d "$repo/.git" ]; then
|
|
170
|
+
echo " $(basename $repo):"
|
|
171
|
+
echo " Branch: $(git -C "$repo" branch --show-current 2>/dev/null)"
|
|
172
|
+
echo " Uncommitted: $(git -C "$repo" status --short 2>/dev/null | wc -l) files"
|
|
173
|
+
echo " Ahead of main: $(git -C "$repo" log --oneline origin/main..HEAD 2>/dev/null | wc -l) commits"
|
|
174
|
+
fi
|
|
175
|
+
done
|
|
176
|
+
done
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### Planning State
|
|
180
|
+
```bash
|
|
181
|
+
# Check STATE.md for each workspace
|
|
182
|
+
for ws in /path/to/project/workspaces/*/; do
|
|
183
|
+
state_file="$ws/.planning/STATE.md"
|
|
184
|
+
if [ -f "$state_file" ]; then
|
|
185
|
+
echo "=== $(basename $ws) ==="
|
|
186
|
+
head -5 "$state_file"
|
|
187
|
+
echo
|
|
188
|
+
fi
|
|
189
|
+
done
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### Phase 6: Check Current System Health
|
|
195
|
+
|
|
196
|
+
Verify the system is stable after reboot before resuming work.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Current memory usage
|
|
200
|
+
free -h
|
|
201
|
+
|
|
202
|
+
# Top memory consumers right now
|
|
203
|
+
ps aux --sort=-%mem | head -15
|
|
204
|
+
|
|
205
|
+
# Any leftover problematic processes
|
|
206
|
+
ps aux | grep -c '[c]laude'
|
|
207
|
+
ps aux | grep -c '[v]itest'
|
|
208
|
+
ps aux | grep -c '[n]ode'
|
|
209
|
+
|
|
210
|
+
# Disk space (OOM can also be triggered by full /tmp or swap partition)
|
|
211
|
+
df -h / /tmp /home
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### Phase 7: Produce Recovery Summary
|
|
217
|
+
|
|
218
|
+
Compile findings into a structured summary. This format is designed to be handed to another AI agent to resume work.
|
|
219
|
+
|
|
220
|
+
```markdown
|
|
221
|
+
## Crash Summary
|
|
222
|
+
|
|
223
|
+
**Crash time**: [timestamp]
|
|
224
|
+
**Cause**: [OOM / CPU exhaustion / disk full / other]
|
|
225
|
+
**Duration of instability**: [how long before reset]
|
|
226
|
+
|
|
227
|
+
### Root Cause
|
|
228
|
+
[1-2 sentences: what process(es) consumed what resource]
|
|
229
|
+
|
|
230
|
+
### Memory Breakdown at Time of Crash
|
|
231
|
+
| Process Group | Count | RSS | Notes |
|
|
232
|
+
|---|---|---|---|
|
|
233
|
+
| ... | ... | ... | ... |
|
|
234
|
+
|
|
235
|
+
### OOM Kill Sequence
|
|
236
|
+
1. [timestamp] - [process] killed ([size])
|
|
237
|
+
2. ...
|
|
238
|
+
|
|
239
|
+
### Agent States
|
|
240
|
+
| Agent | State | Last Activity | What it was doing |
|
|
241
|
+
|---|---|---|---|
|
|
242
|
+
| ... | ... | ... | ... |
|
|
243
|
+
|
|
244
|
+
### Workspace Status
|
|
245
|
+
| Workspace | Status | Uncommitted Changes | Commits Ahead | Notes |
|
|
246
|
+
|---|---|---|---|---|
|
|
247
|
+
| ... | ... | ... | ... | ... |
|
|
248
|
+
|
|
249
|
+
### What Was In-Flight
|
|
250
|
+
- [list of tasks that were actively being worked on]
|
|
251
|
+
|
|
252
|
+
### What Needs to Happen Now
|
|
253
|
+
1. [ordered recovery steps]
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Common Root Causes
|
|
259
|
+
|
|
260
|
+
### Vitest/Jest Worker Explosion
|
|
261
|
+
**Symptom**: Many `node (vitest N)` processes each using 1-3 GB.
|
|
262
|
+
**Cause**: No `maxForks`/`maxThreads` configured; defaults to CPU count.
|
|
263
|
+
**Fix**: Add to `vitest.config.ts`:
|
|
264
|
+
```typescript
|
|
265
|
+
pool: 'forks',
|
|
266
|
+
poolOptions: {
|
|
267
|
+
forks: { maxForks: 4 },
|
|
268
|
+
},
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Multiple Claude Code Agents
|
|
272
|
+
**Symptom**: 10+ `claude` processes, each 200-800 MB RSS plus swap.
|
|
273
|
+
**Cause**: Panopticon agents + specialist agents + sub-agents all running simultaneously.
|
|
274
|
+
**Fix**: Limit concurrent agents in Panopticon config; ensure agents exit cleanly.
|
|
275
|
+
|
|
276
|
+
### K8s Pod Memory Limits Not Set
|
|
277
|
+
**Symptom**: Java/Go processes in k8s pods growing unbounded.
|
|
278
|
+
**Cause**: No resource limits in pod specs; pods consume all available memory.
|
|
279
|
+
**Fix**: Set `resources.limits.memory` in pod specs.
|
|
280
|
+
|
|
281
|
+
### Swap Thrashing
|
|
282
|
+
**Symptom**: System responsive but extremely slow; disk I/O at 100%.
|
|
283
|
+
**Cause**: Total memory demand exceeds RAM but not RAM+swap, causing constant page faults.
|
|
284
|
+
**Fix**: Either add RAM, reduce workload, or set `vm.swappiness=10` to prefer OOM-killing over thrashing.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Prevention
|
|
289
|
+
|
|
290
|
+
1. **Limit test parallelism** — Always set `maxForks`/`maxThreads` in vitest/jest configs
|
|
291
|
+
2. **Set agent concurrency limits** — Don't run more than 3-4 agents simultaneously on 64 GB
|
|
292
|
+
3. **Configure k8s resource limits** — Every pod should have memory limits
|
|
293
|
+
4. **Monitor proactively** — Use `watch -n 5 free -h` or a Grafana dashboard
|
|
294
|
+
5. **Set up earlyoom** — `sudo apt install earlyoom` kills the largest process before the system freezes
|
|
295
|
+
|
|
296
|
+
## Related Skills
|
|
297
|
+
|
|
298
|
+
- `/pan:rescue` — Recover uncommitted work from crashed agents
|
|
299
|
+
- `/pan:session-health` — Clean up stuck Claude Code sessions
|
|
300
|
+
- `/incident-response` — Structured approach to production incidents
|
|
301
|
+
- `/pan:status` — Check current agent and system status
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: github-cli
|
|
3
|
+
description: GitHub CLI (gh) reference for issues, PRs, and API calls
|
|
4
|
+
triggers:
|
|
5
|
+
- gh cli
|
|
6
|
+
- github cli
|
|
7
|
+
- github issues
|
|
8
|
+
- github pull requests
|
|
9
|
+
- gh commands
|
|
10
|
+
allowed-tools:
|
|
11
|
+
- Bash
|
|
12
|
+
- Read
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# GitHub CLI (`gh`) Reference
|
|
16
|
+
|
|
17
|
+
Use `gh` CLI for all GitHub operations. Anthropic recommends `gh` CLI over GitHub MCP servers for Claude Code since you already have shell access.
|
|
18
|
+
|
|
19
|
+
## Common Pitfalls
|
|
20
|
+
|
|
21
|
+
### Invalid JSON fields cause errors
|
|
22
|
+
`--json` only accepts specific fields per command. Using invalid fields (e.g., `stateReason`) causes the command to fail and may cancel sibling tool calls.
|
|
23
|
+
|
|
24
|
+
**Always use fields from the valid lists below.** When in doubt, run `gh <command> --json` with no field names to see the valid list.
|
|
25
|
+
|
|
26
|
+
### Non-interactive mode
|
|
27
|
+
`gh` commands that prompt for input will hang in automated contexts. Always provide all required flags explicitly:
|
|
28
|
+
- `gh pr create` needs `--title` and `--body`
|
|
29
|
+
- `gh issue create` needs `--title`
|
|
30
|
+
- `gh pr merge` needs a merge strategy flag (`--merge`, `--squash`, or `--rebase`)
|
|
31
|
+
|
|
32
|
+
## Issue Commands
|
|
33
|
+
|
|
34
|
+
### `gh issue list`
|
|
35
|
+
```bash
|
|
36
|
+
gh issue list --state open --limit 50
|
|
37
|
+
gh issue list --label "bug" --assignee "@me"
|
|
38
|
+
gh issue list --search "error sort:created-asc"
|
|
39
|
+
gh issue list --json number,title,state,labels
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Flags:** `-s/--state {open|closed|all}`, `-l/--label`, `-a/--assignee`, `-A/--author`, `-m/--milestone`, `-S/--search`, `-L/--limit`, `--json`, `-R/--repo`
|
|
43
|
+
|
|
44
|
+
**Valid `--json` fields:**
|
|
45
|
+
`assignees`, `author`, `body`, `closed`, `closedAt`, `comments`, `createdAt`, `id`, `labels`, `milestone`, `number`, `projectCards`, `projectItems`, `reactionGroups`, `state`, `title`, `updatedAt`, `url`
|
|
46
|
+
|
|
47
|
+
### `gh issue view`
|
|
48
|
+
```bash
|
|
49
|
+
gh issue view 123
|
|
50
|
+
gh issue view 123 --json number,title,state,body
|
|
51
|
+
gh issue view 123 --comments
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Valid `--json` fields:** Same as `gh issue list`.
|
|
55
|
+
|
|
56
|
+
**NOT valid:** `stateReason`, `closedBy`, `reactions`, `timeline`
|
|
57
|
+
|
|
58
|
+
### `gh issue create`
|
|
59
|
+
```bash
|
|
60
|
+
gh issue create --title "Bug: X" --body "Description"
|
|
61
|
+
gh issue create --title "Feature" --label "enhancement" --assignee "@me"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Flags:** `-t/--title`, `-b/--body`, `-F/--body-file`, `-l/--label`, `-a/--assignee`, `-m/--milestone`, `-p/--project`
|
|
65
|
+
|
|
66
|
+
### `gh issue close`
|
|
67
|
+
```bash
|
|
68
|
+
gh issue close 123
|
|
69
|
+
gh issue close 123 --reason "completed"
|
|
70
|
+
gh issue close 123 --comment "Fixed in PR #456"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Flags:** `-r/--reason {completed|not planned}`, `-c/--comment`
|
|
74
|
+
|
|
75
|
+
### `gh issue edit`
|
|
76
|
+
```bash
|
|
77
|
+
gh issue edit 123 --title "New title"
|
|
78
|
+
gh issue edit 123 --add-label "bug" --remove-label "triage"
|
|
79
|
+
gh issue edit 123 --add-assignee "@me"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Pull Request Commands
|
|
83
|
+
|
|
84
|
+
### `gh pr list`
|
|
85
|
+
```bash
|
|
86
|
+
gh pr list --state open
|
|
87
|
+
gh pr list --json number,title,state,headRefName
|
|
88
|
+
gh pr list --head feature/pan-123
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Flags:** `-s/--state {open|closed|merged|all}`, `-B/--base`, `-H/--head`, `-l/--label`, `-a/--assignee`, `-A/--author`, `-S/--search`, `-L/--limit`, `--json`
|
|
92
|
+
|
|
93
|
+
**Valid `--json` fields:**
|
|
94
|
+
`additions`, `assignees`, `author`, `autoMergeRequest`, `baseRefName`, `body`, `changedFiles`, `closed`, `closedAt`, `comments`, `commits`, `createdAt`, `deletions`, `files`, `headRefName`, `headRefOid`, `headRepository`, `headRepositoryOwner`, `id`, `isCrossRepository`, `isDraft`, `labels`, `latestReviews`, `maintainerCanModify`, `mergeCommit`, `mergeStateStatus`, `mergeable`, `mergedAt`, `mergedBy`, `milestone`, `number`, `potentialMergeCommit`, `projectCards`, `projectItems`, `reactionGroups`, `reviewDecision`, `reviewRequests`, `reviews`, `state`, `statusCheckRollup`, `title`, `updatedAt`, `url`
|
|
95
|
+
|
|
96
|
+
### `gh pr view`
|
|
97
|
+
```bash
|
|
98
|
+
gh pr view 456
|
|
99
|
+
gh pr view 456 --json number,title,state,mergeStateStatus,reviews
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Valid `--json` fields:** Same as `gh pr list`.
|
|
103
|
+
|
|
104
|
+
### `gh pr create`
|
|
105
|
+
```bash
|
|
106
|
+
gh pr create --title "feat: Add X" --body "## Summary\n- Added X\n\n## Test plan\n- [ ] Test Y"
|
|
107
|
+
gh pr create --title "fix: Bug" --body "Fixes #123" --label "bug"
|
|
108
|
+
gh pr create --fill # auto-fill from commit messages
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Flags:** `-t/--title`, `-b/--body`, `-F/--body-file`, `-B/--base`, `-H/--head`, `-l/--label`, `-r/--reviewer`, `-a/--assignee`, `-m/--milestone`, `-d/--draft`, `-f/--fill`
|
|
112
|
+
|
|
113
|
+
Use HEREDOC for multi-line body:
|
|
114
|
+
```bash
|
|
115
|
+
gh pr create --title "feat: X" --body "$(cat <<'EOF'
|
|
116
|
+
## Summary
|
|
117
|
+
- Change 1
|
|
118
|
+
|
|
119
|
+
## Test plan
|
|
120
|
+
- [ ] Verify X
|
|
121
|
+
EOF
|
|
122
|
+
)"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### `gh pr merge`
|
|
126
|
+
```bash
|
|
127
|
+
gh pr merge 456 --squash --delete-branch
|
|
128
|
+
gh pr merge 456 --merge
|
|
129
|
+
gh pr merge 456 --rebase
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Flags:** `-m/--merge`, `-s/--squash`, `-r/--rebase`, `-d/--delete-branch`, `--auto`, `-b/--body`, `-t/--subject`
|
|
133
|
+
|
|
134
|
+
**Must specify one of:** `--merge`, `--squash`, or `--rebase`
|
|
135
|
+
|
|
136
|
+
### `gh pr close`
|
|
137
|
+
```bash
|
|
138
|
+
gh pr close 456
|
|
139
|
+
gh pr close 456 --delete-branch
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### `gh pr checkout`
|
|
143
|
+
```bash
|
|
144
|
+
gh pr checkout 456
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## API Commands
|
|
148
|
+
|
|
149
|
+
### `gh api`
|
|
150
|
+
For operations not covered by `gh issue` or `gh pr`, use the REST API directly:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Get PR comments
|
|
154
|
+
gh api repos/{owner}/{repo}/pulls/123/comments
|
|
155
|
+
|
|
156
|
+
# Get PR review comments
|
|
157
|
+
gh api repos/{owner}/{repo}/pulls/123/reviews
|
|
158
|
+
|
|
159
|
+
# Get issue timeline events
|
|
160
|
+
gh api repos/{owner}/{repo}/issues/123/timeline
|
|
161
|
+
|
|
162
|
+
# Add a comment
|
|
163
|
+
gh api repos/{owner}/{repo}/issues/123/comments -f body="Comment text"
|
|
164
|
+
|
|
165
|
+
# Get repo info
|
|
166
|
+
gh api repos/{owner}/{repo}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`{owner}` and `{repo}` are auto-filled from the current repo context.
|
|
170
|
+
|
|
171
|
+
**Flags:** `-X/--method {GET|POST|PUT|PATCH|DELETE}`, `-f/--raw-field key=value`, `-F/--field key=value`, `--paginate`, `-q/--jq`
|
|
172
|
+
|
|
173
|
+
### Filtering with jq
|
|
174
|
+
```bash
|
|
175
|
+
gh issue list --json number,title,labels --jq '.[] | select(.labels[].name == "bug")'
|
|
176
|
+
gh pr list --json number,title,headRefName --jq '.[] | select(.headRefName | startswith("feature/"))'
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Repo-Scoped Operations
|
|
180
|
+
|
|
181
|
+
When not in a git repo or targeting a different repo, use `-R`:
|
|
182
|
+
```bash
|
|
183
|
+
gh issue list -R eltmon/panopticon-cli
|
|
184
|
+
gh pr view 456 -R eltmon/panopticon-cli
|
|
185
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pan-reopen
|
|
3
|
+
description: Reopen a completed issue for re-work. Resets specialist states, removes from queues, and prepares workspace for a new implementation cycle.
|
|
4
|
+
triggers:
|
|
5
|
+
- reopen issue
|
|
6
|
+
- reopen PAN-
|
|
7
|
+
- issue needs re-work
|
|
8
|
+
- re-open this issue
|
|
9
|
+
- reset specialist status
|
|
10
|
+
- reopen for rework
|
|
11
|
+
- issue was closed but needs work
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Reopen Issue for Re-Work
|
|
15
|
+
|
|
16
|
+
Use this skill when an issue needs to be re-worked after being marked done, when review feedback requires significant new work, or when a merged fix turns out to be incomplete.
|
|
17
|
+
|
|
18
|
+
## What Reopen Does
|
|
19
|
+
|
|
20
|
+
1. **Moves tracker status** to "In Progress" (not Backlog — agent resumes with existing plan)
|
|
21
|
+
2. **Resets specialist states** — review/test/merge status → pending
|
|
22
|
+
3. **Removes queue items** — clears any stale entries from specialist queues
|
|
23
|
+
4. **Updates STATE.md** — appends a "Reopened" section with context
|
|
24
|
+
5. **Fetches tracker comments** — injects latest feedback into STATE.md
|
|
25
|
+
|
|
26
|
+
## When to Use
|
|
27
|
+
|
|
28
|
+
- Issue was marked Done but follow-up work is needed
|
|
29
|
+
- Review passed but post-merge testing found regressions
|
|
30
|
+
- User requested changes after review
|
|
31
|
+
- Agent fast-pathed to done on restart (STATE.md said "complete")
|
|
32
|
+
|
|
33
|
+
## How to Reopen
|
|
34
|
+
|
|
35
|
+
### Via CLI (recommended for agents/supervisors)
|
|
36
|
+
```bash
|
|
37
|
+
pan work reopen PAN-123
|
|
38
|
+
# With explicit reason:
|
|
39
|
+
pan work reopen PAN-123 --reason "Post-merge regression in auth flow"
|
|
40
|
+
# Skip confirmation prompt:
|
|
41
|
+
pan work reopen PAN-123 --force
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Via Dashboard API
|
|
45
|
+
```bash
|
|
46
|
+
curl -X POST http://localhost:3011/api/issues/PAN-123/reopen \
|
|
47
|
+
-H "Content-Type: application/json" \
|
|
48
|
+
-d '{"reason": "Post-merge regression found"}'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Via Dashboard UI
|
|
52
|
+
Click the **Reopen** button in the WorkspacePanel (visible when review/test has passed or issue is merged).
|
|
53
|
+
|
|
54
|
+
## After Reopening
|
|
55
|
+
|
|
56
|
+
1. The issue is now "In Progress" in the tracker
|
|
57
|
+
2. Specialist states are all `pending`
|
|
58
|
+
3. STATE.md has a new "Reopened" section with context and tracker comments
|
|
59
|
+
4. Start the agent normally: `pan work PAN-123`
|
|
60
|
+
|
|
61
|
+
The agent will read STATE.md, see the "Reopened" section, and resume work based on the tracker context rather than fast-pathing to done.
|
|
62
|
+
|
|
63
|
+
## Do NOT Use `pan work done` Until Re-Work Is Complete
|
|
64
|
+
|
|
65
|
+
After reopening, the agent must complete the requested changes, pass tests, and go through review again before signaling `pan work done`.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pan-sync-main
|
|
3
|
+
description: Sync latest main into a workspace's feature branch via git merge. Use when a hotfix has been merged to main and active workspaces need to pick up the changes.
|
|
4
|
+
triggers:
|
|
5
|
+
- sync with main
|
|
6
|
+
- sync main into workspace
|
|
7
|
+
- pull in hotfix
|
|
8
|
+
- merge main into branch
|
|
9
|
+
- pan sync-main
|
|
10
|
+
- get latest changes from main
|
|
11
|
+
allowed-tools:
|
|
12
|
+
- Bash
|
|
13
|
+
- Read
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Sync with Main
|
|
17
|
+
|
|
18
|
+
Merges the latest `main` branch into a workspace's feature branch. Uses `git merge` (not rebase) to avoid rewriting history, and delegates conflict resolution to the merge-agent specialist.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# CLI command
|
|
24
|
+
pan work sync-main PAN-XXX
|
|
25
|
+
|
|
26
|
+
# Or via the dashboard API
|
|
27
|
+
curl -X POST http://localhost:3011/api/workspaces/PAN-XXX/sync-main
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## What It Does
|
|
31
|
+
|
|
32
|
+
1. Checks for uncommitted changes (blocks if any — must commit or stash first)
|
|
33
|
+
2. Cleans up any stale git locks
|
|
34
|
+
3. Runs `git fetch origin main`
|
|
35
|
+
4. Runs `git merge origin/main`
|
|
36
|
+
5. If clean merge: reports commit count and changed files
|
|
37
|
+
6. If conflicts: wakes the merge-agent specialist to resolve them
|
|
38
|
+
7. After conflict resolution: scans for leftover markers, then reports result
|
|
39
|
+
|
|
40
|
+
## Outcomes
|
|
41
|
+
|
|
42
|
+
| Result | Meaning |
|
|
43
|
+
|--------|---------|
|
|
44
|
+
| Already up to date | Main has no new commits since last sync |
|
|
45
|
+
| Success (N commits) | Clean merge or agent-resolved conflicts |
|
|
46
|
+
| Uncommitted changes | Commit or stash workspace changes first |
|
|
47
|
+
| Conflict (unresolvable) | Agent could not resolve — merge aborted, workspace unchanged |
|
|
48
|
+
|
|
49
|
+
## Design Decisions
|
|
50
|
+
|
|
51
|
+
- **Merge, not rebase** — Rebase rewrites SHAs and requires force-push. Merge commits serve as audit markers.
|
|
52
|
+
- **No tests/builds** — Feature branch is WIP. Running tests after sync would fail on pre-existing issues.
|
|
53
|
+
- **No push to remote** — This is a local workspace operation only.
|
|
54
|
+
- **All-or-nothing for polyrepo** — If any repo fails, all are aborted (not implemented yet; sync is per-workspace).
|
|
55
|
+
|
|
56
|
+
## Examples
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Sync PAN-123 workspace with latest main
|
|
60
|
+
pan work sync-main PAN-123
|
|
61
|
+
|
|
62
|
+
# Output on success:
|
|
63
|
+
# ✓ Synced 3 commit(s) from main
|
|
64
|
+
# Commits merged: 3
|
|
65
|
+
# Changed files (5):
|
|
66
|
+
# src/lib/auth.ts
|
|
67
|
+
# src/lib/config.ts
|
|
68
|
+
# ...
|
|
69
|
+
|
|
70
|
+
# Output when already current:
|
|
71
|
+
# ✓ PAN-123 is already up to date with main
|
|
72
|
+
|
|
73
|
+
# Output on uncommitted changes (blocks):
|
|
74
|
+
# ✗ Sync failed: Workspace has uncommitted changes. Commit or stash them before syncing with main.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Dashboard
|
|
78
|
+
|
|
79
|
+
The "Sync with Main" button appears in the workspace detail panel:
|
|
80
|
+
- In the **Git Status** section as a small "Sync" button next to the branch name (disabled if uncommitted changes)
|
|
81
|
+
- In the **Actions** section as a full "Sync with Main" button
|
|
82
|
+
|
|
83
|
+
## Related Commands
|
|
84
|
+
|
|
85
|
+
- `pan work approve <id>` — Review and merge to main
|
|
86
|
+
- `pan work request-review <id>` — Trigger review pipeline
|
|
87
|
+
- `pan work tell <id> "<message>"` — Send message to agent
|