xtrm-tools 0.5.45 → 0.5.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +24 -5
  4. package/cli/dist/index.cjs +9812 -9983
  5. package/cli/dist/index.cjs.map +1 -1
  6. package/cli/package.json +1 -1
  7. package/config/instructions/agents-top.md +2 -4
  8. package/config/instructions/claude-top.md +2 -4
  9. package/config/pi/extensions/beads/index.ts +18 -78
  10. package/config/pi/extensions/custom-footer/index.ts +2 -3
  11. package/config/pi/extensions/xtrm-ui/format.ts +93 -0
  12. package/config/pi/extensions/xtrm-ui/index.ts +1044 -0
  13. package/config/pi/extensions/xtrm-ui/package.json +10 -0
  14. package/config/pi/extensions/xtrm-ui/themes/pidex-dark.json +85 -0
  15. package/config/pi/extensions/xtrm-ui/themes/pidex-light.json +85 -0
  16. package/config/pi/install-schema.json +0 -1
  17. package/hooks/beads-claim-sync.mjs +15 -96
  18. package/hooks/beads-gate-messages.mjs +2 -4
  19. package/hooks/beads-gate-utils.mjs +0 -18
  20. package/hooks/statusline.mjs +5 -3
  21. package/package.json +1 -1
  22. package/plugins/xtrm-tools/.claude-plugin/plugin.json +1 -1
  23. package/plugins/xtrm-tools/hooks/beads-claim-sync.mjs +15 -96
  24. package/plugins/xtrm-tools/hooks/beads-gate-messages.mjs +2 -4
  25. package/plugins/xtrm-tools/hooks/beads-gate-utils.mjs +0 -18
  26. package/plugins/xtrm-tools/hooks/statusline.mjs +5 -3
  27. package/plugins/xtrm-tools/skills/planning/SKILL.md +75 -20
  28. package/plugins/xtrm-tools/skills/using-xtrm/SKILL.md +1 -1
  29. package/plugins/xtrm-tools/skills/xt-debugging/SKILL.md +149 -0
  30. package/plugins/xtrm-tools/skills/xt-end/SKILL.md +28 -0
  31. package/skills/planning/SKILL.md +75 -20
  32. package/skills/using-xtrm/SKILL.md +1 -1
  33. package/skills/xt-debugging/SKILL.md +149 -0
  34. package/skills/xt-end/SKILL.md +28 -0
  35. package/plugins/xtrm-tools/skills/gitnexus-debugging/SKILL.md +0 -85
  36. package/skills/gitnexus-debugging/SKILL.md +0 -85
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: xt-debugging
3
+ description: Complete debugging workflow — error analysis, log interpretation, performance profiling, and GitNexus call-chain tracing. Use when investigating bugs, errors, crashes, or performance issues.
4
+ ---
5
+
6
+ # xt-debugging
7
+
8
+ Systematic debugging using the GitNexus knowledge graph for call-chain tracing, combined with error analysis, log interpretation, and performance profiling.
9
+
10
+ ## When to Use
11
+
12
+ - "Why is this function failing?"
13
+ - "Trace where this error comes from"
14
+ - "This endpoint returns 500"
15
+ - Investigating crashes, unexpected behavior, or regressions
16
+ - Performance issues
17
+ - Reading logs or stack traces
18
+
19
+ ---
20
+
21
+ ## Prerequisites
22
+
23
+ GitNexus must be indexed before starting. If you see "index is stale" or no results:
24
+
25
+ ```bash
26
+ npx gitnexus analyze # re-index the repo (run this, then retry)
27
+ npx gitnexus status # verify freshness
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Phase 1 — Triage
33
+
34
+ Understand the symptom before touching any code.
35
+
36
+ 1. Read the full error message and stack trace
37
+ 2. Identify the suspect symbol (function, class, endpoint)
38
+ 3. Check for regressions — what changed recently?
39
+ ```
40
+ gitnexus_detect_changes({scope: "compare", base_ref: "main"})
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Phase 2 — Knowledge Graph Investigation
46
+
47
+ ```
48
+ 1. gitnexus_query({query: "<error text or symptom>"}) → Related execution flows + symbols
49
+ 2. gitnexus_context({name: "<suspect>"}) → Callers, callees, process participation
50
+ 3. READ gitnexus://repo/{name}/process/{processName} → Full step-by-step execution trace
51
+ 4. gitnexus_cypher({...}) → Custom call chain if needed
52
+ ```
53
+
54
+ ### Patterns by Symptom
55
+
56
+ | Symptom | Approach |
57
+ |---------|----------|
58
+ | Error message | `query` for error text → `context` on throw site |
59
+ | Wrong return value | `context` on function → trace callees for data flow |
60
+ | Intermittent failure | `context` → look for external calls, async deps, race conditions |
61
+ | Performance issue | `context` → find hot-path symbols with many callers |
62
+ | Recent regression | `detect_changes` to see what changed |
63
+
64
+ ### Example — "Payment endpoint returns 500 intermittently"
65
+
66
+ ```
67
+ 1. gitnexus_query({query: "payment error handling"})
68
+ → Processes: CheckoutFlow, ErrorHandling
69
+ → Symbols: validatePayment, handlePaymentError
70
+
71
+ 2. gitnexus_context({name: "validatePayment"})
72
+ → Outgoing calls: verifyCard, fetchRates (external API!)
73
+
74
+ 3. READ gitnexus://repo/my-app/process/CheckoutFlow
75
+ → Step 3: validatePayment → calls fetchRates (external, no timeout)
76
+
77
+ 4. Root cause: fetchRates has no timeout → intermittent failures under load
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Phase 3 — Root Cause Analysis
83
+
84
+ 1. **Reproduce** — Identify minimal reproduction steps
85
+ 2. **Trace data flow** — Follow the value/control flow from input to error
86
+ 3. **Isolate** — Narrow to the smallest failing unit
87
+ 4. **Hypothesize** — Form explicit hypothesis before reading more code
88
+ 5. **Confirm** — Verify hypothesis against source, not just symptoms
89
+
90
+ Common root cause categories:
91
+ - **Null/undefined** — missing guard, wrong assumption about data shape
92
+ - **Race condition** — async ordering, missing await, shared mutable state
93
+ - **External dependency** — timeout, API contract change, env difference
94
+ - **Type mismatch** — serialization, casting, implicit coercion
95
+ - **Configuration** — env var missing, wrong default, deployment drift
96
+
97
+ ---
98
+
99
+ ## Phase 4 — Log Analysis
100
+
101
+ 1. Read the full log output (not just the last line)
102
+ 2. Identify: timestamps, error levels, request IDs, correlation tokens
103
+ 3. Correlate events across log lines to build timeline
104
+ 4. Look for: first occurrence, frequency, affected subset, preceding events
105
+ 5. Summarize: what happened, when, why, and what was affected
106
+
107
+ ---
108
+
109
+ ## Phase 5 — Performance Profiling
110
+
111
+ 1. **Measure baseline** — Never optimize blind
112
+ ```bash
113
+ time <command>
114
+ ```
115
+ 2. **Profile** — Language-appropriate tools:
116
+ - Node.js: `--prof`, `clinic.js`, `0x`
117
+ - Python: `cProfile`, `py-spy`, `line_profiler`
118
+ - Go: `pprof`
119
+ 3. **Identify hotspot** — Usually 1–2 functions account for >80% of time; use `gitnexus_context` to confirm call frequency
120
+ 4. **Fix the bottleneck** — Minimal targeted change
121
+ 5. **Verify** — Measure again, compare against baseline
122
+
123
+ ---
124
+
125
+ ## Phase 6 — Remediation
126
+
127
+ 1. **Fix** — Minimal change that addresses the confirmed root cause
128
+ 2. **Verify** — Run the failing case to confirm fix
129
+ 3. **Regression test** — Add a test that would have caught this bug
130
+ 4. **Check blast radius** — `gitnexus_impact({target: "fixedSymbol", direction: "upstream"})`
131
+ 5. **Pre-commit scope check** — `gitnexus_detect_changes({scope: "staged"})`
132
+
133
+ ---
134
+
135
+ ## Checklist
136
+
137
+ ```
138
+ - [ ] Read full error / stack trace
139
+ - [ ] Identify suspect symbol
140
+ - [ ] gitnexus_detect_changes to check for regressions
141
+ - [ ] gitnexus_query for error text or symptom
142
+ - [ ] gitnexus_context on suspect (callers, callees, processes)
143
+ - [ ] Trace execution flow via process resource
144
+ - [ ] Read source files to confirm root cause
145
+ - [ ] Form explicit hypothesis before fixing
146
+ - [ ] Verify fix against failing reproduction
147
+ - [ ] Add regression test
148
+ - [ ] gitnexus_detect_changes() before committing
149
+ ```
@@ -78,6 +78,33 @@ If changes cannot be classified safely, stop with `BLOCKED_DIRTY_UNCLASSIFIED_CH
78
78
 
79
79
  ---
80
80
 
81
+ ## Stage 2.5 — Scope Verification
82
+
83
+ Before committing or pushing, verify that branch changes match the expected scope of the session's closed issues. **Never skip this step** — unreviewed scope is the primary source of oversized or unintended PRs.
84
+
85
+ Run:
86
+ ```bash
87
+ git diff --stat origin/main..HEAD 2>/dev/null || git diff --stat $(git merge-base HEAD main)..HEAD
88
+ ```
89
+
90
+ For each significantly changed symbol, check blast radius:
91
+ ```bash
92
+ npx gitnexus impact <symbol-name> # upstream dependants — what else breaks
93
+ npx gitnexus impact <symbol-name> -d downstream # downstream dependencies
94
+ ```
95
+
96
+ For Claude agents with MCP access, also run:
97
+ ```
98
+ gitnexus_detect_changes({scope: "compare", base_ref: "main"})
99
+ ```
100
+
101
+ **Rules:**
102
+ - Changes clearly tied to session issues → continue
103
+ - Files unrelated to session issues → classify as overscoped (handle in Stage 3D)
104
+ - `npx gitnexus impact` returns HIGH or CRITICAL risk on a changed symbol → **stop and report to user** before continuing
105
+
106
+ ---
107
+
81
108
  ## Stage 3 — Dry Run and Anomaly Detection
82
109
 
83
110
  Run:
@@ -260,6 +287,7 @@ If linkage had to be inferred from commits rather than detected by `xt end`, say
260
287
 
261
288
  The autonomous rule is simple:
262
289
  - normalize the session
290
+ - verify scope with gitnexus before committing
263
291
  - dry-run
264
292
  - auto-fix predictable anomalies
265
293
  - rerun dry-run
@@ -1,85 +0,0 @@
1
- ---
2
- name: gitnexus-debugging
3
- description: Trace bugs through call chains using knowledge graph
4
- ---
5
-
6
- # Debugging with GitNexus
7
-
8
- ## When to Use
9
- - "Why is this function failing?"
10
- - "Trace where this error comes from"
11
- - "Who calls this method?"
12
- - "This endpoint returns 500"
13
- - Investigating bugs, errors, or unexpected behavior
14
-
15
- ## Workflow
16
-
17
- ```
18
- 1. gitnexus_query({query: "<error or symptom>"}) → Find related execution flows
19
- 2. gitnexus_context({name: "<suspect>"}) → See callers/callees/processes
20
- 3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
21
- 4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
22
- ```
23
-
24
- > If "Index is stale" → run `npx gitnexus analyze` in terminal.
25
-
26
- ## Checklist
27
-
28
- ```
29
- - [ ] Understand the symptom (error message, unexpected behavior)
30
- - [ ] gitnexus_query for error text or related code
31
- - [ ] Identify the suspect function from returned processes
32
- - [ ] gitnexus_context to see callers and callees
33
- - [ ] Trace execution flow via process resource if applicable
34
- - [ ] gitnexus_cypher for custom call chain traces if needed
35
- - [ ] Read source files to confirm root cause
36
- ```
37
-
38
- ## Debugging Patterns
39
-
40
- | Symptom | GitNexus Approach |
41
- |---------|-------------------|
42
- | Error message | `gitnexus_query` for error text → `context` on throw sites |
43
- | Wrong return value | `context` on the function → trace callees for data flow |
44
- | Intermittent failure | `context` → look for external calls, async deps |
45
- | Performance issue | `context` → find symbols with many callers (hot paths) |
46
- | Recent regression | `detect_changes` to see what your changes affect |
47
-
48
- ## Tools
49
-
50
- **gitnexus_query** — find code related to error:
51
- ```
52
- gitnexus_query({query: "payment validation error"})
53
- → Processes: CheckoutFlow, ErrorHandling
54
- → Symbols: validatePayment, handlePaymentError, PaymentException
55
- ```
56
-
57
- **gitnexus_context** — full context for a suspect:
58
- ```
59
- gitnexus_context({name: "validatePayment"})
60
- → Incoming calls: processCheckout, webhookHandler
61
- → Outgoing calls: verifyCard, fetchRates (external API!)
62
- → Processes: CheckoutFlow (step 3/7)
63
- ```
64
-
65
- **gitnexus_cypher** — custom call chain traces:
66
- ```cypher
67
- MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
68
- RETURN [n IN nodes(path) | n.name] AS chain
69
- ```
70
-
71
- ## Example: "Payment endpoint returns 500 intermittently"
72
-
73
- ```
74
- 1. gitnexus_query({query: "payment error handling"})
75
- → Processes: CheckoutFlow, ErrorHandling
76
- → Symbols: validatePayment, handlePaymentError
77
-
78
- 2. gitnexus_context({name: "validatePayment"})
79
- → Outgoing calls: verifyCard, fetchRates (external API!)
80
-
81
- 3. READ gitnexus://repo/my-app/process/CheckoutFlow
82
- → Step 3: validatePayment → calls fetchRates (external)
83
-
84
- 4. Root cause: fetchRates calls external API without proper timeout
85
- ```
@@ -1,85 +0,0 @@
1
- ---
2
- name: gitnexus-debugging
3
- description: Trace bugs through call chains using knowledge graph
4
- ---
5
-
6
- # Debugging with GitNexus
7
-
8
- ## When to Use
9
- - "Why is this function failing?"
10
- - "Trace where this error comes from"
11
- - "Who calls this method?"
12
- - "This endpoint returns 500"
13
- - Investigating bugs, errors, or unexpected behavior
14
-
15
- ## Workflow
16
-
17
- ```
18
- 1. gitnexus_query({query: "<error or symptom>"}) → Find related execution flows
19
- 2. gitnexus_context({name: "<suspect>"}) → See callers/callees/processes
20
- 3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
21
- 4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
22
- ```
23
-
24
- > If "Index is stale" → run `npx gitnexus analyze` in terminal.
25
-
26
- ## Checklist
27
-
28
- ```
29
- - [ ] Understand the symptom (error message, unexpected behavior)
30
- - [ ] gitnexus_query for error text or related code
31
- - [ ] Identify the suspect function from returned processes
32
- - [ ] gitnexus_context to see callers and callees
33
- - [ ] Trace execution flow via process resource if applicable
34
- - [ ] gitnexus_cypher for custom call chain traces if needed
35
- - [ ] Read source files to confirm root cause
36
- ```
37
-
38
- ## Debugging Patterns
39
-
40
- | Symptom | GitNexus Approach |
41
- |---------|-------------------|
42
- | Error message | `gitnexus_query` for error text → `context` on throw sites |
43
- | Wrong return value | `context` on the function → trace callees for data flow |
44
- | Intermittent failure | `context` → look for external calls, async deps |
45
- | Performance issue | `context` → find symbols with many callers (hot paths) |
46
- | Recent regression | `detect_changes` to see what your changes affect |
47
-
48
- ## Tools
49
-
50
- **gitnexus_query** — find code related to error:
51
- ```
52
- gitnexus_query({query: "payment validation error"})
53
- → Processes: CheckoutFlow, ErrorHandling
54
- → Symbols: validatePayment, handlePaymentError, PaymentException
55
- ```
56
-
57
- **gitnexus_context** — full context for a suspect:
58
- ```
59
- gitnexus_context({name: "validatePayment"})
60
- → Incoming calls: processCheckout, webhookHandler
61
- → Outgoing calls: verifyCard, fetchRates (external API!)
62
- → Processes: CheckoutFlow (step 3/7)
63
- ```
64
-
65
- **gitnexus_cypher** — custom call chain traces:
66
- ```cypher
67
- MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
68
- RETURN [n IN nodes(path) | n.name] AS chain
69
- ```
70
-
71
- ## Example: "Payment endpoint returns 500 intermittently"
72
-
73
- ```
74
- 1. gitnexus_query({query: "payment error handling"})
75
- → Processes: CheckoutFlow, ErrorHandling
76
- → Symbols: validatePayment, handlePaymentError
77
-
78
- 2. gitnexus_context({name: "validatePayment"})
79
- → Outgoing calls: verifyCard, fetchRates (external API!)
80
-
81
- 3. READ gitnexus://repo/my-app/process/CheckoutFlow
82
- → Step 3: validatePayment → calls fetchRates (external)
83
-
84
- 4. Root cause: fetchRates calls external API without proper timeout
85
- ```