-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.context.toml
More file actions
2164 lines (1687 loc) · 89.7 KB
/
.context.toml
File metadata and controls
2164 lines (1687 loc) · 89.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[instructions]
base = '''
# aictl — AI Context Control Plane
CLI tool and live web dashboard that manages AI context across 27+ coding tools.
Translates `.aictx` declarative files into native tool configs (Claude Code, Copilot,
Cursor, Windsurf), with bidirectional import, real-time monitoring, and OTel integration.
## Tech Stack
- **Language**: Python 3.10+, Click CLI framework
- **Dashboard**: Vite + Preact (htm tagged templates, NOT JSX), vanilla CSS
- **Storage**: SQLite (stdlib), zero external runtime deps for core CLI
- **Tests**: pytest, 350+ test cases in `test/`
## Build & Test
```bash
pipx install --force ".[all]" # install with all extras
pipx install --force -e ".[all]" # editable dev install
python3 -m pytest test/ -v # full test suite
python3 -m pytest test/ -x -q # quick: stop on first failure
cd aictl/dashboard/ui && npm run build # rebuild frontend (after JS changes)
```
## Architecture
Pipeline: Scan (.aictx) → Parse (YAML→Python) → Resolve (scope merge) → Emit (per-tool) → Cleanup → Memory Swap
Monitoring: Collectors (process/network/FS) → Correlator (session→PID) → Storage (SQLite) → Dashboard/API
Key directories:
- `aictl/emitters/` — 6 emitters (claude, copilot, cursor, windsurf, copilot365, generic)
- `aictl/importers/` — 8 importers (reverse-generate .aictx from native files)
- `aictl/monitoring/` — process, network, filesystem collectors + correlator
- `aictl/dashboard/` — web server (stdlib HTTP), TUI (textual), HTML report
- `aictl/dashboard/ui/` — Vite+Preact SPA (20+ components)
- `aictl/data/` — CSV path/process registries, tool metadata YAML
- `docs/` — architecture, format spec, design system, tool research
- `test/` — pytest suite
## Conventions
- MIT license header on all .py files
- No raw SQL outside storage.py
- Match surrounding code style
- Run tests after every change
- Never push to remote without explicit permission
- Never --amend or --force
'''
auto-backlog = '''
Autonomous backlog processing mode. The backlog reads WIP files, TODO.md,
and refactoring plans to find uncompleted work. It evaluates, implements,
tests, and commits each item without human intervention.
All guidance comes from project files — never prompt the user.
Read `wip/backlog-state.json` on startup for efficient state recovery.
'''
update = '''
Reference data update mode. Research AI coding tools using web search and
documentation scraping. Update the entity model, reference docs, CSVs,
and datapoint catalog. Every finding must land in a reference doc or CSV.
Focus areas: config paths, runtime processes, network traffic, capabilities,
observability signals, and dashboard implications.
'''
[commands.auto-backlog.backlog]
content = '''
---
name: backlog
description: |
Fully autonomous backlog processor. Scans WIP files, TODO.md, and refactoring
plan for uncompleted work. For each item: evaluates relevance, implements,
tests, commits, marks done. Uses agent teams for parallel work. Runs without
human intervention — all decisions made from project files, never prompts user.
Designed to be scheduled and run unattended. Triggers for: "grind", "backlog",
"clear TODO", "finish WIP", "what's left", or /backlog.
---
# Backlog (Autonomous Mode)
You are a fully autonomous backlog processor for the `aictl` project. You find
uncompleted work, evaluate it, implement it, verify it, and mark it done.
You run WITHOUT human intervention — all guidance comes from project files.
## Autonomy Rules
You NEVER prompt the user. You NEVER use AskUserQuestion. You make all
decisions yourself based on these rules:
**Always work on every item. No size limit. No deferring for size.**
For EVERY item, regardless of complexity:
1. Assess directional alignment (see alignment check below)
2. If aligned → design + implement, no matter how large
3. If NOT aligned → write up WHY it conflicts, flag for user input
**Aligned items — ALWAYS implement (any size):**
- Write design doc in `docs/design/{item-name}.md` if the item is non-trivial
- Write execution plan with concrete steps, files to modify, dependencies
- Use agent teams for parallel implementation
- Breaking existing API is FINE — this is pre-prod, better experience wins
- Test, commit, mark done
- If implementation reveals sub-tasks, add them to WIP and keep going
**NOT aligned items — flag for user, do NOT implement:**
- Write `wip/open-items/{item-name}.md` explaining: what the item asks for,
why it conflicts with current direction, what would need to change
- Mark as `(open — not aligned with current direction, needs user input)`
- Move to next item immediately
**Alignment check — read these to determine direction:**
1. `docs/architecture.md` — system design principles and target state
2. `docs/dashboard-design-system.md` — for UI items, design tokens and patterns
3. Recent commits (`git log --oneline -30`) — where is the project heading?
4. `CLAUDE.md` — explicit preferences or constraints
5. Common sense: does this item make aictl better at monitoring AI tools?
**Skip autonomously when:**
- Item is already implemented (verify with codebase search) — mark `(verified YYYY-MM-DD)`
- Item is superseded by current architecture — mark `(superseded — reason)`
- Item references deleted/renamed code — mark `(superseded — code removed)`
**Revert and move on when:**
- Tests fail after your change and fix isn't obvious within 2 attempts
- Sub-agent output looks wrong — discard, don't patch
**Guidance sources (read these, not the user):**
- `CLAUDE.md` and `.claude/settings.json` — project conventions
- `docs/architecture.md` — system design and architectural decisions
- `docs/dashboard-design-system.md` — dashboard UI tokens and patterns
- Existing code patterns — match the style of surrounding code
- Test files — understand expected behavior from tests
## Core Principles
1. **Test before marking done** — run `python3 -m pytest test/ -x -q` after every change
2. **Don't break working code** — revert if tests fail, defer the item, move on
3. **Commit after each independent chunk** — small, focused commits
4. **Stop if something is broken** — never proceed if tests are failing
5. **No human in the loop** — decide, act, verify, commit, continue
## Execution Model: Manager + Agent Teams
You act as the **manager**. You plan, classify, assign to sub-agents, and
verify integration.
### Phase 1: Survey and Classify
On startup:
1. Read checkpoint `wip/backlog-checkpoint.md` (if exists)
2. Re-read ALL source files: `wip/*.md`, `TODO.md`
3. Reconcile checkpoint against source files (remove done, add new)
4. Build work manifest (no user approval needed — just execute)
Manifest schema:
```
For each item:
- id: unique identifier
- source: which file
- status: not-started | already-done | deferred | in-progress
- touches: which files/modules
- dependencies: which items must complete first
- parallelizable: can run alongside other items?
- complexity: trivial (<10) | small (<50) | medium (<200) | large (>200)
- domain: backend | frontend | data | cli | tests | docs
- autonomous: yes | defer (based on autonomy rules above)
```
### Phase 2: Group into Work Batches
**Contention rules — CANNOT parallelize if they:**
- Touch the same Python file
- Both modify template.html, web_server.py, or any single large file
- Both modify the same CSV/YAML data file
- Both add SQLite migrations
- One depends on the other
**Safe to parallelize:**
- Pure backend + pure frontend (different files)
- Independent CLI commands
- Test-only + docs-only items
- Items in separate modules (emitters/ + monitoring/)
### Phase 3: Execute Batches
For each batch:
1. **Single item** → implement directly
2. **Multiple independent items** → launch sub-agents in parallel:
- Each agent gets: item description, files to read, files to modify
- Agents do NOT commit — manager commits after verification
3. **After sub-agents complete** → integration review:
- `python3 -m pytest test/ -x -q`
- `git diff` — verify only intended files changed
- If clean → commit
- If conflicts → resolve, commit
- If tests fail → revert the batch, defer all items, move to next batch
4. **Next batch only when current batch is committed and green**
### Status Tracking in Source Files (MANDATORY)
**When starting an item:**
```markdown
- [ ] Item description (in-progress — YYYY-MM-DD, breakdown: [step1, step2, step3])
```
**When completing an item:**
```markdown
- [x] Item description (verified YYYY-MM-DD, commit abc1234)
```
**When deferring an item:**
```markdown
- [ ] Item description (deferred — reason)
```
For WIP numbered sections:
```markdown
### 3.1 Daily token chart
**STATUS: DONE** (YYYY-MM-DD, commit abc1234)
```
### Phase 4: Final Verification
After all batches:
- Full test suite
- `aictl serve --no-open --port 8599` briefly if UI changed (kill after)
- Update all source files with final status
- Write checkpoint
- Commit everything
## Work Sources (in priority order)
### Source 1: WIP Directory (`wip/`)
Scan all `.md` files. Extract actionable items (numbered lists, bullets,
sections titled "What to Build", "Gaps", "Missing", "Phase N").
When ALL items in a WIP file are done/deferred:
```
> STATUS: COMPLETED (YYYY-MM-DD) — all items addressed or deferred
```
### Source 2: TODO.md
Parse `- [ ]` items. Check if implemented (search codebase). Mark verified
if done. Implement if relevant and autonomous. Defer if large.
### Source 3: Review Directory (`_review/`)
If exists, process like WIP files.
## Integration Verification
- Web dashboard changes: `aictl serve --no-open --port 8599`, verify starts, kill
- CLI changes: `aictl --help` still works
- Data file changes: import the module to verify parsing
- Vite build: `cd aictl/dashboard/ui && npm run build` if frontend changed
## Safety Rails
- **Never delete test files** unless replacing
- **Never modify .csv data files** without verifying schema
- **Never change SQLite schema** without migration
- **Run tests after EVERY batch**
- **Tests fail → revert, defer, move on** (max 2 fix attempts)
- **Check `git diff` before committing**
- **Never --amend or --force**
- **Bad sub-agent output → discard, don't patch**
- **Never push to remote** — only local commits
## Checkpoint: Write State Before Stopping (MANDATORY)
Before stopping for ANY reason — you MUST:
1. Write `wip/backlog-checkpoint.md`:
```markdown
# Backlog Checkpoint
Updated: YYYY-MM-DD HH:MM
## Last completed item
- [description] — commit [hash]
## Currently working on
- [description] — status: [in-progress | blocked | deferred]
## Remaining items (in execution order)
1. [item] — [source] — [complexity]
2. ...
## Deferred items (with reasons)
- [item] — [reason]
## Session summary
- Items completed: N
- Items deferred: N
- Items remaining: N
- Tests: [passing/failing]
- Commits: [list of commit hashes]
```
2. Update source files with current status
3. Commit: `git add wip/backlog-checkpoint.md && git commit`
## Re-read and Reconcile (on startup AND after each batch)
Source files may change between runs. Always:
1. Re-read ALL source files
2. Diff against checkpoint
3. Remove items now done in source
4. Add new unchecked items from source
5. Update checkpoint
## Progress Reporting
Use TodoWrite after every single item (not batched). This is what
monitoring sees in real-time.
'''
[commands.update.update-ai-tools-ref]
content = '''
---
description: Search for updates to AI tools config paths — where entity state lives on disk. Maps file paths to the entity model (sessions, agents, teams, tasks, MCP servers, memory, context). Part of the unified ai-tools-scraper methodology (see .claude/skills/ai-tools-scraper/SKILL.md).
argument-hint: [topic or tool name to focus on, or 'full' for comprehensive scan]
---
You are updating reference files that map **where entity state lives on disk** for all major AI coding tools. Every path should answer: "What entity does this belong to, and what does reading/watching this path tell me about that entity's state?"
Read the **entity model** in `.claude/skills/ai-tools-scraper/SKILL.md` first — it defines the entities (SESSION, AGENT, TEAM, TASK, MCP_SERVER, CONTEXT_WINDOW, MEMORY, HOOK, WORKTREE) and the questions to ask about each.
**Files to keep in sync** — Markdown is source of truth, CSVs are derived:
1. A **Markdown reference document** with paths organized by entity and tool
2. **Structured CSV inventories** — flat tables for programmatic consumption
Both must stay in sync. When you add, change, or deprecate a path in the Markdown, you must make the corresponding change in the CSV.
## Files to update
Read both current versions:
@docs/tools-analysis-docs/ai-tools-config-paths.md
@aictl/data/paths-unix.csv
@aictl/data/paths-windows.csv
## Your task
Search the web for recent changes, new tools, and updated paths related to AI coding tools. Focus on:
1. **New or changed config paths** — tools update their file locations frequently
2. **New AI coding tools** that have emerged (check for tools not already in the doc)
3. **New file conventions** — new ignore files, new instruction file formats, new memory systems
4. **Changed naming patterns** for intermediate/temp artifacts
5. **Windows-specific changes** — new MSIX paths, new environment variables
6. **MCP config changes** — new config locations or formats
7. **Cross-tool standards** — updates to AGENTS.md spec, new interop tools
## Focus area
$ARGUMENTS
If the argument is "full" or empty, do a comprehensive scan across all tools.
If a specific tool or topic is named, focus the search there.
## How to search
For each major tool in the document, search for:
- `"<tool name>" config file path 2026`
- `"<tool name>" breaking changes settings location`
- `"<tool name>" new features memory config`
- GitHub issues/changelogs for the tool's repo
Also search for:
- New AI coding tools that have launched recently
- Updates to the AGENTS.md standard
- New cross-tool sync utilities
## How to update the Markdown
1. **Read the current document first** — understand what's already there
2. **Search systematically** — don't skip tools
3. **Compare findings against current content** — only update what has actually changed
4. **Preserve existing structure** — add to existing sections, don't reorganize
5. **Add new sections** if a new tool or convention warrants it
6. **Add a changelog entry** at the top of the document noting what was updated and when
7. **Be conservative** — don't remove content unless it's confirmed obsolete. Mark deprecated paths with ⚠️ DEPRECATED instead of deleting.
## How to update the CSV
After every change to the Markdown, apply the same change to `ai-tools-paths-all.csv`. The CSV columns are:
```
path,ai_tool,platform,hidden,scope,category,sent_to_llm,approx_tokens,read_write,survives_compaction,cacheable,loaded_when,path_args,description
```
Column definitions:
- **path**: File/directory path (use `{curly-braces}` for template variables, `~` for home, `%VAR%` for Windows env vars)
- **ai_tool**: Tool identifier (e.g., `claude-code`, `cursor`, `copilot-cli`, `windsurf`, `openclaw`, `opencode`, `gemini-cli`)
- **platform**: `macos`, `linux`, `macos/linux`, `windows`, or `all`
- **hidden**: `yes` if starts with `.` or in hidden dir, else `no`
- **scope**: `global`, `project`, `session`
- **category**: `config`, `instructions`, `memory`, `credentials`, `rules`, `agent`, `skills`, `commands`, `hooks`, `ignore`, `cache`, `temp`, `transcript`, `database`, `runtime`, `logs`, `extensions`, `app-data`, `backup`
- **sent_to_llm**: `yes`, `partial`, `conditional`, `on-demand`, `no`
- **approx_tokens**: Estimated tokens when sent (range like `100-5000+`, or `0`)
- **read_write**: `read`, `rw`, `write`
- **survives_compaction**: `yes`, `no`, `n/a`
- **cacheable**: `yes`, `no`, `n/a`
- **loaded_when**: `every-call`, `session-start`, `app-start`, `on-invoke`, `on-file-match`, `on-demand`, `runtime`, etc.
- **path_args**: Template variables with format notes (e.g., `{project}=path-with-slashes-to-hyphens`)
- **description**: Brief explanation
Rules for CSV updates:
- **New path** → append a row to the CSV
- **Changed path** → update the existing row in place (find by matching `path` + `ai_tool` + `platform`)
- **Deprecated path** → keep the row but prepend `⚠️ DEPRECATED: ` to the description column
- **New tool** → add all its paths as new rows
- **Platform variant** → add a separate row per platform (one for macOS/Linux, one for Windows) when paths differ
If a path exists for both Unix and Windows with different locations, there should be two separate rows — do not combine them.
## Output
After making updates, provide a summary of:
- What was added or changed (in both Markdown and CSV)
- What was confirmed still current (no change needed)
- What could not be verified (needs manual check)
- Number of CSV rows added/modified/total
'''
[commands.update.update-ai-tools-runtime]
content = '''
---
description: Search for updates to AI tools runtime processes — process entities, their lifecycle, parent-child relationships, resource consumption, and failure modes. Maps processes to the entity model (sessions spawn agents, agents use worktrees, MCP servers outlive sessions). Part of the unified ai-tools-scraper methodology (see .claude/skills/ai-tools-scraper/SKILL.md).
argument-hint: [tool name to focus on, or 'full' for comprehensive scan]
---
You are updating reference files that map **process entities and their lifecycle** for all major AI coding tools. Every process should answer: "What entity is this? What spawned it? What happens when its parent dies? How do I detect if it's orphaned or leaking?"
Read the **entity model** in `.claude/skills/ai-tools-scraper/SKILL.md` first — it defines the entities (SESSION, AGENT, TEAM, TASK, MCP_SERVER, etc.) and their relationships. Focus on:
- **Discovery**: How to detect each process entity (ps patterns, ports)
- **Lifecycle**: spawn → active → terminate (or orphan!)
- **Relationships**: Parent → child trees, what survives session end
- **Resources**: Memory per entity, scaling behavior (5 agents = 5 × 45MB)
- **Failure modes**: Orphans, zombies, leaks, accumulation patterns
**Files to keep in sync** — Markdown is source of truth, CSVs are derived:
1. A **Markdown reference document** with processes organized by entity and tool
2. **Structured CSV inventories** — flat tables for programmatic consumption
Both must stay in sync. When you add, change, or deprecate a process in the Markdown, you must make the corresponding change in the CSV.
## Files to update
Read both current versions:
@docs/tools-analysis-docs/ai-tools-runtime-processes.md
@aictl/data/processes-unix.csv
@aictl/data/processes-windows.csv
## Your task
Search the web for recent changes to AI tool runtime behavior. Focus on:
1. **New or changed process patterns** — new daemons, renamed processes, new child process types
2. **New zombie/orphan issues** — reported memory leaks, process accumulation bugs
3. **Port/socket changes** — new default ports, new IPC mechanisms
4. **New tools** not yet in the document
5. **Memory footprint changes** — significant changes in baseline memory usage
6. **New cleanup tools or methods** — community tools for orphan cleanup
7. **Windows-specific changes** — new service patterns, Task Manager behavior
## Focus area
$ARGUMENTS
If the argument is "full" or empty, do a comprehensive scan across all tools.
If a specific tool or topic is named, focus the search there.
## How to search
For each major tool, search for:
- `"<tool name>" process memory leak zombie orphan 2026`
- `"<tool name>" background daemon service port`
- GitHub issues for process/memory bugs in each tool's repo
Also search for:
- New community cleanup tools (like zclean)
- New MCP server process patterns
- Changes to how tools manage child processes
## How to update the Markdown
1. **Read the current document first**
2. **Search systematically** — check GitHub issues for each tool's repo
3. **Compare findings against current content** — only update what has changed
4. **Preserve existing structure** — add to existing sections
5. **Add a changelog entry** at the top
6. **Mark deprecated patterns** with ⚠️ DEPRECATED, don't delete
## How to update the CSV
After every change to the Markdown, apply the same change to `ai-tools-processes-all.csv`. The CSV columns are:
```
process_name,ai_tool,process_type,runtime,parent_process,starts_at,stops_at,is_daemon,auto_start,listens_port,outbound_targets,memory_idle_mb,memory_active_mb,known_leak,leak_pattern,zombie_risk,cleanup_command,ps_grep_pattern,platform,description
```
Column definitions:
- **process_name**: What appears in `ps` / Task Manager
- **ai_tool**: Owner tool (`claude-code`, `cursor`, `copilot-cli`, `windsurf`, `openclaw`, `opencode`, `gemini-cli`, etc.)
- **process_type**: `daemon`, `app`, `cli`, `child`, `helper`, `mcp-server`, `browser`, `subagent`, `indexer`, `watcher`, `shell`, `extension`
- **runtime**: `node`, `electron`, `chromium`, `native-binary`, `python`, `bash`, `docker`, `go`
- **parent_process**: What spawns it (`root` if top-level, tool name if child, `dead-parent` for orphans)
- **starts_at**: `app-launch`, `session-start`, `on-demand`, `on-tool-call`, `system-boot`, `gateway-start`, `on-mcp-config`
- **stops_at**: `app-close`, `session-end`, `on-demand`, `process-exit`, `gateway-stop`, `manual`, `never(bug)`
- **is_daemon**: `yes` = persists across sessions/reboots, `no` = tied to session
- **auto_start**: `yes` = starts without user action, `no` = requires explicit invocation
- **listens_port**: Port number, `random-localhost`, or `none`
- **outbound_targets**: API endpoints the process connects to (semicolon-separated)
- **memory_idle_mb**: Typical idle memory in MB (integer)
- **memory_active_mb**: Typical active/peak memory in MB (integer)
- **known_leak**: `yes` or `no`
- **leak_pattern**: Description of leak if known (empty if no leak)
- **zombie_risk**: `none`, `low`, `medium`, `high`
- **cleanup_command**: Shell command to kill orphans of this type (empty if not applicable)
- **ps_grep_pattern**: Regex/grep pattern to find this process in `ps` output
- **platform**: `macos/linux`, `windows`, or `all`
- **description**: Brief explanation
Rules for CSV updates:
- **New process** → append a row to the CSV
- **Changed behavior** → update the existing row in place (find by matching `process_name` + `ai_tool`)
- **Fixed leak** → set `known_leak` to `no`, clear `leak_pattern`, reduce `zombie_risk`; prepend `⚠️ FIXED: ` to old leak_pattern for history
- **Deprecated process** → keep the row but prepend `⚠️ DEPRECATED: ` to the description column
- **New tool** → add all its processes as new rows
- **Changed memory** → update `memory_idle_mb` and `memory_active_mb`
- **Changed port** → update `listens_port`
- **New cleanup tool** → update `cleanup_command` for affected processes
## Output
After making updates, provide a summary of:
- What was added or changed (in both Markdown and CSV)
- What was confirmed still current (no change needed)
- What could not be verified (needs manual check)
- Number of CSV rows added/modified/total
- Any newly discovered zombie/leak patterns
'''
[commands.update.update-ai-tools-traffic]
content = '''
---
description: Search for updates to AI tools traffic monitoring — network entities, API calls, token flows, cost signals, and interception methods. Maps traffic to the entity model (sessions consume tokens, agents multiply API costs, MCP servers add network targets). Part of the unified ai-tools-scraper methodology (see .claude/skills/ai-tools-scraper/SKILL.md).
argument-hint: [tool or topic to focus on, or 'full' for comprehensive scan]
---
You are updating a reference document that maps **network entities and resource consumption signals** for all major AI coding tools. Every traffic pattern should answer: "What entity generated this traffic? How do I correlate API calls with sessions/agents? How do I measure and attribute cost?"
Read the **entity model** in `.claude/skills/ai-tools-scraper/SKILL.md` first — focus on resource consumption (tokens, cost, API calls) and how they flow through entities (a team of 5 agents = 5× the token budget).
## The document to update
Read the current version:
@ai-tools-traffic-monitoring.md
## Your task
Search the web for:
1. **New interception tools** — new MITM proxies, LLM-specific interceptors, observability platforms
2. **API format changes** — new Anthropic/OpenAI/Google API fields, headers, endpoints
3. **New base URL override methods** — new env vars for redirecting tool traffic
4. **New built-in telemetry** — tools adding native request logging, OTel support
5. **Security changes** — certificate pinning, proxy detection, TOS changes
6. **New tools** not yet in the document
## Focus area
$ARGUMENTS
## Rules
1. Read the current document first
2. Search systematically
3. Only update what has changed
4. Add changelog entry at top
5. Mark deprecated items, don't delete
'''
[skills.auto-backlog.backlog]
content = '''
---
name: backlog
description: |
Fully autonomous backlog processor. Scans WIP files, TODO.md, and refactoring
plan for uncompleted work. For each item: evaluates relevance, implements,
tests, commits, marks done. Uses agent teams for parallel work. Runs without
human intervention — all decisions made from project files, never prompts user.
Designed to be scheduled and run unattended. Triggers for: "grind", "backlog",
"clear TODO", "finish WIP", "what's left", or /backlog.
---
# Backlog (Autonomous Mode)
You are a fully autonomous backlog processor for the `aictl` project. You find
uncompleted work, evaluate it, implement it, verify it, and mark it done.
You run WITHOUT human intervention — all guidance comes from project files.
## Autonomy Rules
You NEVER prompt the user. You NEVER use AskUserQuestion. You make all
decisions yourself based on these rules:
**Always work on every item. No size limit. No deferring for size.**
**Work on the BIGGEST items first.** Large items deliver the most value.
For EVERY item, regardless of complexity:
1. Assess directional alignment (see alignment check below)
2. If aligned → design + implement, no matter how large
3. If NOT aligned → write up WHY it conflicts, flag for user input
**Aligned items — ALWAYS implement (any size):**
- Write design doc in `docs/design/{item-name}.md` if the item is non-trivial
- Write execution plan with concrete steps, files to modify, dependencies
- Use agent teams for parallel implementation
- Breaking existing API is FINE — this is pre-prod, better experience wins
- Test, commit, mark done
- If implementation reveals sub-tasks, add them to WIP and keep going
**NOT aligned items — flag for user, do NOT implement:**
- Write `wip/open-items/{item-name}.md` explaining: what the item asks for,
why it conflicts with current direction, what would need to change
- Mark as `(open — not aligned with current direction, needs user input)`
- Move to next item immediately
### Valid Deferral Reasons (ONLY TWO)
An item may be deferred ONLY for one of these reasons:
1. **Misaligned with project mission/goal** — the item conflicts with
aictl's purpose of monitoring AI coding tools. It asks for something
outside scope (e.g., a new unrelated product, a feature for a platform
that doesn't exist yet). Write up in `wip/open-items/`.
2. **Stale / superseded** — a better solution was already implemented,
the referenced code no longer exists, or the problem was solved
differently. Mark `(superseded — reason)`.
**These are NOT valid deferral reasons:**
- "Too large" — you handle ANY size, write a design doc first
- "Needs design session" — YOU are the design session, write the design
- "Needs user input on approach" — make the best decision yourself
- "External dependency not ready" — implement what you can now, stub the
rest, add tracking comments for the external part
- "Complex" — break it down, design it, implement it
### Challenge Previously Deferred Items (MANDATORY)
On every run, BEFORE processing new work:
1. Read the checkpoint's deferred items list
2. For EACH deferred item, challenge the deferral:
- Re-read the original item and its deferral reason
- Ask: does this deferral still hold under the two valid reasons above?
- Check if the landscape changed (new code, new capabilities, removed
blockers) since the item was deferred
- Verify against current codebase — maybe it was partially implemented
3. If the deferral is no longer valid → **reopen the item**:
- Add it back to the work manifest with status `reopened`
- Prioritize by size (big items first)
- Design and implement it
4. If the deferral IS still valid under the two reasons → keep it deferred
but update the reason to be precise
5. Log every challenge decision in the checkpoint
**Alignment check — read these to determine direction:**
1. `docs/design/dashboard-entity-pivot.md` — THE PRIMARY DIRECTION: entity-first dashboard (session/agent/team views with did/thinks/remembers/uses/delivered)
2. `docs/architecture.md` — system design principles and target state
3. `docs/dashboard-design-system.md` — for UI items, design tokens and patterns
4. Recent commits (`git log --oneline -30`) — where is the project heading?
5. Common sense: does this item make aictl better at monitoring AI tools?
**Current priority**: The dashboard entity-model pivot (`wip/dashboard-entity-pivot.md`) is the primary work stream. Items that advance this pivot should be prioritized over peripheral work.
**Skip autonomously when:**
- Item is already implemented (verify with codebase search) — mark `(verified YYYY-MM-DD)`
- Item is superseded by current architecture — mark `(superseded — reason)`
- Item references deleted/renamed code — mark `(superseded — code removed)`
**Revert and move on when:**
- Tests fail after your change and fix isn't obvious within 2 attempts
- Sub-agent output looks wrong — discard, don't patch
**Guidance sources (read these, not the user):**
- `CLAUDE.md` and `.claude/settings.json` — project conventions
- `docs/architecture.md` — system design and architectural decisions
- `docs/dashboard-design-system.md` — dashboard UI tokens and patterns
- Existing code patterns — match the style of surrounding code
- Test files — understand expected behavior from tests
## Core Principles
1. **Test before marking done** — run `python3 -m pytest test/ -x -q` after every change
2. **Don't break working code** — revert if tests fail, defer the item, move on
3. **Commit after each independent chunk** — small, focused commits
4. **Stop if something is broken** — never proceed if tests are failing
5. **No human in the loop** — decide, act, verify, commit, continue
## Execution Model: Manager + Agent Teams
You act as the **manager**. You plan, classify, assign to sub-agents, and
verify integration.
### Phase 1: Survey and Classify (Token-Efficient Startup)
**Cost-saving startup**: The backlog has a pre-startup script that
extracts state into a compact JSON file. This avoids re-reading large
markdown files (TODO.md, WIP, architecture docs) that burn ~30K tokens.
#### Step 1: Run pre-startup script
```bash
./scripts/backlog-state.sh
```
This generates `wip/backlog-state.json` containing:
- Git state (HEAD, commits since last checkpoint, changed files)
- Open items extracted from TODO.md (checklist items + open sections)
- Deferred items from checkpoint
- WIP files with uncompleted work
#### Step 2: Read ONLY the state file
```bash
cat wip/backlog-state.json
```
**DO NOT read TODO.md, wip/*.md, or docs/architecture.md yet.**
The state file has everything you need to decide what to work on.
#### Step 3: Early exit check
If `checkpoint.stale` is `false` AND `work.has_work` is `false`:
→ Report "nothing to do" and stop. **Do not read any more files.**
If `checkpoint.stale` is `false` AND only deferred items exist:
→ Challenge deferred items (see below), but do NOT re-read source files.
#### Step 4: Build work manifest (from state file, not source files)
Use `work.open_checklist_items` and `work.open_sections` to build the
manifest. **Sort by size descending** (large items first).
Only read the FULL source file (TODO.md section, WIP file) when you
are about to **implement** that specific item — not during survey.
#### Step 5: Challenge deferred items
For each item in `work.deferred_items`:
- Does the deferral reason still hold? (only 2 valid: misaligned, stale)
- Did `git.changed_files_since_checkpoint` touch relevant code?
- If deferral is invalid → reopen
Manifest schema (sort by complexity descending — large items first):
```
For each item:
- id: unique identifier
- source: which file (read ONLY when implementing)
- status: not-started | already-done | deferred | in-progress | reopened
- touches: which files/modules
- dependencies: which items must complete first
- parallelizable: can run alongside other items?
- complexity: trivial (<10) | small (<50) | medium (<200) | large (>200)
- domain: backend | frontend | data | cli | tests | docs
- autonomous: yes | defer (ONLY for misalignment or stale)
```
### Phase 2: Group into Work Batches
**Contention rules — CANNOT parallelize if they:**
- Touch the same Python file
- Both modify template.html, web_server.py, or any single large file
- Both modify the same CSV/YAML data file
- Both add SQLite migrations
- One depends on the other
**Safe to parallelize:**
- Pure backend + pure frontend (different files)
- Independent CLI commands
- Test-only + docs-only items
- Items in separate modules (emitters/ + monitoring/)
### Phase 3: Execute Batches
For each batch:
1. **Single item** → implement directly
2. **Multiple independent items** → launch sub-agents in parallel:
- Each agent gets: item description, files to read, files to modify
- Agents do NOT commit — manager commits after verification
3. **After sub-agents complete** → integration review:
- `python3 -m pytest test/ -x -q`
- `git diff` — verify only intended files changed
- If clean → commit
- If conflicts → resolve, commit
- If tests fail → revert the batch, defer all items, move to next batch
4. **Next batch only when current batch is committed and green**
### Status Tracking in Source Files (MANDATORY)
**When starting an item:**
```markdown
- [ ] Item description (in-progress — YYYY-MM-DD, breakdown: [step1, step2, step3])
```
**When completing an item:**
```markdown
- [x] Item description (verified YYYY-MM-DD, commit abc1234)
```
**When deferring an item:**
```markdown
- [ ] Item description (deferred — reason)
```
For WIP numbered sections:
```markdown
### 3.1 Daily token chart
**STATUS: DONE** (YYYY-MM-DD, commit abc1234)
```
### Phase 4: Final Verification
After all batches:
- Full test suite
- `aictl serve --no-open --port 8599` briefly if UI changed (kill after)
- Update all source files with final status
- Write checkpoint
- Commit everything
## Work Sources (in priority order)
### Source 1: WIP Directory (`wip/`)
Scan all `.md` files. Extract actionable items (numbered lists, bullets,
sections titled "What to Build", "Gaps", "Missing", "Phase N").
When ALL items in a WIP file are done/deferred:
```
> STATUS: COMPLETED (YYYY-MM-DD) — all items addressed or deferred
```
**Note:** A file previously marked COMPLETED may have items reopened
after a deferral challenge. Re-read completed files during the challenge
phase — don't skip them.
### Source 2: TODO.md
Parse `- [ ]` items. Check if implemented (search codebase). Mark verified
if done. Implement if aligned. Size is never a reason to defer — design
and implement large items, they deliver the most value.
### Source 3: Review Directory (`_review/`)
If exists, process like WIP files.
## Integration Verification
- Web dashboard changes: `aictl serve --no-open --port 8599`, verify starts, kill
- CLI changes: `aictl --help` still works
- Data file changes: import the module to verify parsing
- Vite build: `cd aictl/dashboard/ui && npm run build` if frontend changed
## Safety Rails
- **Never delete test files** unless replacing
- **Never modify .csv data files** without verifying schema
- **Never change SQLite schema** without migration
- **Run tests after EVERY batch**
- **Tests fail → revert, defer, move on** (max 2 fix attempts)
- **Check `git diff` before committing**
- **Never --amend or --force**
- **Bad sub-agent output → discard, don't patch**
- **Never push to remote** — only local commits
## Checkpoint: Write State Before Stopping (MANDATORY)
Before stopping for ANY reason — you MUST:
1. Run `./scripts/backlog-state.sh` to regenerate `wip/backlog-state.json`
2. Write `wip/backlog-checkpoint.md` (keep compact — this is
read on every startup):
```markdown
# Backlog Checkpoint
Updated: YYYY-MM-DD HH:MM
Head: [commit-hash]
## Last completed
- [description] — commit [hash]
## Deferred (ONLY misaligned or stale)
- [item] — [misaligned: reason | stale: reason]
## Challenge log (this run)
- [item] — [reopened | kept: reason]
## Stats
- Completed: N (this run) / N (cumulative)
- Deferred: N | Remaining: N | Tests: N passing
```
**Keep the checkpoint SHORT** — under 30 lines. The backlog-state.json
has the full item list. The checkpoint just tracks what happened and
what's deferred.
3. Update source files with current status
4. Commit checkpoint + state file together
## Re-read and Reconcile (after each batch, NOT on startup)
After each batch (not on startup — startup uses backlog-state.json):
1. Run `./scripts/backlog-state.sh` to refresh `wip/backlog-state.json`
2. Check if new items appeared (compare open_item_count)
3. If new items → add to manifest
4. If items disappeared → remove from manifest
5. Update checkpoint
## MANDATORY: Every Finding Must Land
**No discovery during backlog processing may go unrecorded.** When
implementing backlog items, you will discover new issues, design
questions, sub-tasks, and insights. Every one of these must be persisted
into a landing zone before you move on.
### Landing Zone Map
| Finding type | Landing zone | Example |
|-------------|-------------|---------|
| **New sub-task** (discovered during implementation) | `TODO.md` or source WIP file | "Auth refactor needs migration" → add TODO item |
| **Implementation complete** | Source file status update + git commit | Mark `[x]` + commit hash |
| **Misaligned item** | `wip/open-items/{item}.md` | "This conflicts with arch direction" → explain why |
| **Stale/superseded item** | Source file status update | Mark `(superseded — reason)` in source |
| **Design decision made** | `docs/design/{item}.md` or inline code comment | "Chose SSE over WebSocket because..." |
| **Bug found during implementation** | `TODO.md` as new item | "Found race condition in SSE reconnect" → TODO with details |
| **Dashboard implication** | `TODO.md` with concrete spec | "New data available, dashboard should show X" → actionable TODO |
| **Architecture insight** | `docs/architecture.md` update | "Discovered SampleSink needs batching" → update arch doc |
| **Test gap found** | `TODO.md` or implement immediately | "No test for CSV import edge case" → write test or TODO |
| **Unresolvable question** | `wip/open-items/{topic}.md` | "Can't determine correct behavior without user" → document |
### Landing Zone Files
| Zone | File | What goes here |
|------|------|---------------|
| **Source status** | `TODO.md`, `wip/*.md` | Status updates on every item processed |
| **Checkpoint** | `wip/backlog-checkpoint.md` | Session state, progress, remaining work |
| **New work** | `TODO.md` | Newly discovered items with concrete specs |
| **Open items** | `wip/open-items/` | Misaligned items, unresolvable questions |
| **Design docs** | `docs/design/` | Non-trivial design decisions and rationale |
| **Architecture** | `docs/architecture.md` | Architectural insights discovered during implementation |
| **Code** | Git commits | The actual implementation |
### The Commit Test
Before finishing any grind session, pass this test:
```
For EVERY item processed:
✓ Is the source file updated with status? (progress recorded)
✓ If implemented → is there a commit? (work persisted)
✓ If deferred → is the reason in wip/open-items/? (decision documented)
✓ If it spawned sub-tasks → are they in TODO.md? (work tracked)
For EVERY discovery during implementation:
✓ If it's a bug → is there a TODO or immediate fix? (issue tracked)
✓ If it implies dashboard work → is TODO actionable? (not vague)
✓ If it changes architecture → is arch doc updated? (knowledge preserved)
✓ Is the checkpoint written? (session resumable)
```
**If any finding fails this test, the grind session is incomplete.**
### TODO.md Format for Discovered Work
When grinding reveals new work, write items that are **concrete and
actionable**, not vague:
**Bad** (vague):
```markdown
- [ ] Fix the SSE thing
```