panopticon-cli 0.4.32 → 0.5.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 +96 -210
- package/dist/{agents-BDFHF4T3.js → agents-E43Y3HNU.js} +10 -7
- package/dist/chunk-7SN4L4PH.js +150 -0
- package/dist/chunk-7SN4L4PH.js.map +1 -0
- package/dist/{chunk-2NIAOCIC.js → chunk-AAFQANKW.js} +358 -97
- package/dist/chunk-AAFQANKW.js.map +1 -0
- package/dist/chunk-AQXETQHW.js +113 -0
- package/dist/chunk-AQXETQHW.js.map +1 -0
- package/dist/chunk-B3PF6JPQ.js +212 -0
- package/dist/chunk-B3PF6JPQ.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/{chunk-VIWUCJ4V.js → chunk-FTCPTHIJ.js} +57 -432
- package/dist/chunk-FTCPTHIJ.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-GR6ZZMCX.js +816 -0
- package/dist/chunk-GR6ZZMCX.js.map +1 -0
- package/dist/chunk-HJSM6E6U.js +1038 -0
- package/dist/chunk-HJSM6E6U.js.map +1 -0
- package/dist/{chunk-XP2DXWYP.js → chunk-HZT2AOPN.js} +164 -39
- package/dist/chunk-HZT2AOPN.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-NTO3EDB3.js +600 -0
- package/dist/chunk-NTO3EDB3.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-PPRFKTVC.js +154 -0
- package/dist/chunk-PPRFKTVC.js.map +1 -0
- package/dist/chunk-WQG2TYCB.js +677 -0
- package/dist/chunk-WQG2TYCB.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 +5103 -3165
- 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 +249 -0
- package/dist/dashboard/public/assets/index-BxpjweAL.css +32 -0
- package/dist/dashboard/public/assets/index-DQHkwvvJ.js +743 -0
- package/dist/dashboard/public/index.html +2 -2
- package/dist/dashboard/server.js +17619 -4044
- 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 +162 -40
- package/dist/index.js +67 -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-ZC6A4M3I.js} +8 -7
- package/dist/{specialist-context-N32QBNNQ.js.map → specialist-context-ZC6A4M3I.js.map} +1 -1
- package/dist/{specialist-logs-GF3YV4KL.js → specialist-logs-KLGJCEUL.js} +7 -6
- package/dist/specialist-logs-KLGJCEUL.js.map +1 -0
- package/dist/{specialists-JBIW6MP4.js → specialists-O4HWDJL5.js} +7 -6
- package/dist/specialists-O4HWDJL5.js.map +1 -0
- package/dist/tldr-daemon-T3THOUGT.js +21 -0
- package/dist/tldr-daemon-T3THOUGT.js.map +1 -0
- package/dist/traefik-QN7R5I6V.js +19 -0
- package/dist/traefik-QN7R5I6V.js.map +1 -0
- package/dist/tunnel-W2GZBLEV.js +13 -0
- package/dist/tunnel-W2GZBLEV.js.map +1 -0
- package/dist/workspace-manager-IE4JL2JP.js +22 -0
- package/dist/workspace-manager-IE4JL2JP.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 +21 -11
- package/scripts/tldr-post-edit +72 -0
- package/scripts/tldr-read-enforcer +275 -0
- package/scripts/work-agent-stop-hook +137 -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/myn-standards/SKILL.md +351 -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/skills/write-spec/SKILL.md +138 -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-E43Y3HNU.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
|
+
```
|