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.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +14 -0
- package/README.md +24 -5
- package/cli/dist/index.cjs +9812 -9983
- package/cli/dist/index.cjs.map +1 -1
- package/cli/package.json +1 -1
- package/config/instructions/agents-top.md +2 -4
- package/config/instructions/claude-top.md +2 -4
- package/config/pi/extensions/beads/index.ts +18 -78
- package/config/pi/extensions/custom-footer/index.ts +2 -3
- package/config/pi/extensions/xtrm-ui/format.ts +93 -0
- package/config/pi/extensions/xtrm-ui/index.ts +1044 -0
- package/config/pi/extensions/xtrm-ui/package.json +10 -0
- package/config/pi/extensions/xtrm-ui/themes/pidex-dark.json +85 -0
- package/config/pi/extensions/xtrm-ui/themes/pidex-light.json +85 -0
- package/config/pi/install-schema.json +0 -1
- package/hooks/beads-claim-sync.mjs +15 -96
- package/hooks/beads-gate-messages.mjs +2 -4
- package/hooks/beads-gate-utils.mjs +0 -18
- package/hooks/statusline.mjs +5 -3
- package/package.json +1 -1
- package/plugins/xtrm-tools/.claude-plugin/plugin.json +1 -1
- package/plugins/xtrm-tools/hooks/beads-claim-sync.mjs +15 -96
- package/plugins/xtrm-tools/hooks/beads-gate-messages.mjs +2 -4
- package/plugins/xtrm-tools/hooks/beads-gate-utils.mjs +0 -18
- package/plugins/xtrm-tools/hooks/statusline.mjs +5 -3
- package/plugins/xtrm-tools/skills/planning/SKILL.md +75 -20
- package/plugins/xtrm-tools/skills/using-xtrm/SKILL.md +1 -1
- package/plugins/xtrm-tools/skills/xt-debugging/SKILL.md +149 -0
- package/plugins/xtrm-tools/skills/xt-end/SKILL.md +28 -0
- package/skills/planning/SKILL.md +75 -20
- package/skills/using-xtrm/SKILL.md +1 -1
- package/skills/xt-debugging/SKILL.md +149 -0
- package/skills/xt-end/SKILL.md +28 -0
- package/plugins/xtrm-tools/skills/gitnexus-debugging/SKILL.md +0 -85
- package/skills/gitnexus-debugging/SKILL.md +0 -85
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// Line 2: ◐ italic(claim title) OR ○ bold(N) open — no background
|
|
5
5
|
//
|
|
6
6
|
// Colors: bold/dim/italic only — no explicit fg/bg, adapts to dark & light themes.
|
|
7
|
-
// State: .xtrm/statusline-claim (written by beads-claim-sync.mjs)
|
|
7
|
+
// State: .xtrm/statusline-claim[-<worktreeName>] (written by beads-claim-sync.mjs)
|
|
8
8
|
// Cache: /tmp per cwd, 5s TTL
|
|
9
9
|
|
|
10
10
|
import { execSync } from 'node:child_process';
|
|
@@ -125,8 +125,10 @@ if (!data) {
|
|
|
125
125
|
let claimTitle = null;
|
|
126
126
|
let openCount = 0;
|
|
127
127
|
if (existsSync(join(cwd, '.beads')) || existsSync(join(mainRoot, '.beads'))) {
|
|
128
|
-
//
|
|
129
|
-
const
|
|
128
|
+
// Per-worktree claim file — prevents cross-session contamination.
|
|
129
|
+
const worktreeMatch = cwd.match(/\/\.xtrm\/worktrees\/([^/]+)/);
|
|
130
|
+
const claimFileName = worktreeMatch ? `statusline-claim-${worktreeMatch[1]}` : 'statusline-claim';
|
|
131
|
+
const claimFile = join(mainRoot, '.xtrm', claimFileName);
|
|
130
132
|
claimId = existsSync(claimFile) ? (readFileSync(claimFile, 'utf8').trim() || null) : null;
|
|
131
133
|
if (claimId) {
|
|
132
134
|
try {
|
|
@@ -62,16 +62,33 @@ If the request is under 8 words or the scope is unclear, ask **one** clarifying
|
|
|
62
62
|
|
|
63
63
|
Use GitNexus and Serena to understand the landscape. No file edits.
|
|
64
64
|
|
|
65
|
+
### GitNexus-first protocol (mandatory when available)
|
|
66
|
+
|
|
65
67
|
```bash
|
|
66
|
-
# Find relevant execution flows
|
|
68
|
+
# 1) Find relevant execution flows by concept
|
|
67
69
|
gitnexus_query({query: "<concept related to task>"})
|
|
68
70
|
|
|
69
|
-
#
|
|
71
|
+
# 2) Get full caller/callee/process context for likely symbols
|
|
70
72
|
gitnexus_context({name: "<affected symbol>"})
|
|
71
73
|
|
|
72
|
-
#
|
|
74
|
+
# 3) Assess blast radius before locking the implementation plan
|
|
73
75
|
gitnexus_impact({target: "<symbol to change>", direction: "upstream"})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Refactor planning checks (when rename/extract/move is in scope)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Preview safe multi-file rename plan first
|
|
82
|
+
gitnexus_rename({symbol_name: "<old>", new_name: "<new>", dry_run: true})
|
|
83
|
+
|
|
84
|
+
# Confirm context before extraction/split plans
|
|
85
|
+
gitnexus_context({name: "<symbol to extract/split>"})
|
|
86
|
+
gitnexus_impact({target: "<symbol to extract/split>", direction: "upstream"})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Serena symbol-level inspection (targeted reads)
|
|
74
90
|
|
|
91
|
+
```bash
|
|
75
92
|
# Map a file without reading all of it
|
|
76
93
|
get_symbols_overview("path/to/relevant/file.ts")
|
|
77
94
|
|
|
@@ -79,11 +96,44 @@ get_symbols_overview("path/to/relevant/file.ts")
|
|
|
79
96
|
find_symbol("SymbolName", include_body=true)
|
|
80
97
|
```
|
|
81
98
|
|
|
99
|
+
### Fallback when GitNexus MCP tools are unavailable
|
|
100
|
+
|
|
101
|
+
If MCP GitNexus tools are unavailable, use the GitNexus CLI first, then Serena symbol exploration if needed.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Verify index freshness / repository indexing
|
|
105
|
+
npx gitnexus status
|
|
106
|
+
npx gitnexus list
|
|
107
|
+
|
|
108
|
+
# Concept and architecture exploration
|
|
109
|
+
npx gitnexus query "<concept or symptom>" --limit 5
|
|
110
|
+
npx gitnexus context "<symbolName>"
|
|
111
|
+
|
|
112
|
+
# Blast radius before committing to a plan
|
|
113
|
+
npx gitnexus impact "<symbolName>" --direction upstream --depth 3
|
|
114
|
+
|
|
115
|
+
# If index is stale
|
|
116
|
+
npx gitnexus analyze
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Notes:
|
|
120
|
+
- In this environment, `detect_changes` and `rename` are available via MCP tools, not GitNexus CLI subcommands.
|
|
121
|
+
- If both MCP and CLI are unavailable, fall back to Serena search + symbols and state this explicitly in your plan output.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
search_for_pattern("<concept or symbol>")
|
|
125
|
+
get_symbols_overview("path/to/relevant/file.ts")
|
|
126
|
+
find_symbol("<candidate symbol>", include_body=true)
|
|
127
|
+
find_referencing_symbols("<symbol>", "path/to/file.ts")
|
|
128
|
+
```
|
|
129
|
+
|
|
82
130
|
**Capture from exploration:**
|
|
83
131
|
- Which files/symbols will be affected
|
|
132
|
+
- Which execution flows/processes are involved (from `gitnexus_query`/`gitnexus_context`)
|
|
84
133
|
- What existing patterns to follow (naming, structure, error handling)
|
|
85
134
|
- Any d=1 dependents that require updates when you change a symbol
|
|
86
|
-
- Risk level: if CRITICAL or HIGH → warn user before proceeding
|
|
135
|
+
- Risk level from impact analysis: if CRITICAL or HIGH → warn user before proceeding
|
|
136
|
+
- If GitNexus fallback path was used, explicitly call it out in the handoff
|
|
87
137
|
|
|
88
138
|
---
|
|
89
139
|
|
|
@@ -101,6 +151,7 @@ Think through the plan before writing any bd commands. Use structured CoT:
|
|
|
101
151
|
3. What are the dependencies? (what must be done before X can start?)
|
|
102
152
|
4. What can run in parallel? (independent tasks → no deps between them)
|
|
103
153
|
5. What are the risks? (complex areas, unclear spec, risky refactors)
|
|
154
|
+
6. What is the blast-radius summary from GitNexus? (direct callers, affected processes, risk level)
|
|
104
155
|
</thinking>
|
|
105
156
|
|
|
106
157
|
<plan>
|
|
@@ -244,7 +295,13 @@ test-planning will:
|
|
|
244
295
|
|
|
245
296
|
## Phase 6 — Handoff
|
|
246
297
|
|
|
247
|
-
Present the board and transition to implementation
|
|
298
|
+
Present the board and transition to implementation.
|
|
299
|
+
|
|
300
|
+
Include a short **Architecture & Impact Summary** in your handoff message:
|
|
301
|
+
- Key execution flows/processes involved
|
|
302
|
+
- Top d=1 dependents to watch
|
|
303
|
+
- Highest observed risk (LOW/MEDIUM/HIGH/CRITICAL)
|
|
304
|
+
- Whether GitNexus-first or fallback exploration was used
|
|
248
305
|
|
|
249
306
|
```bash
|
|
250
307
|
# Show the full board
|
|
@@ -292,30 +349,26 @@ Then begin work on the first task. The planning phase is complete.
|
|
|
292
349
|
### Example 2 — Bug fix with investigation
|
|
293
350
|
|
|
294
351
|
<example>
|
|
295
|
-
<scenario>User: "bd close
|
|
352
|
+
<scenario>User: "bd close doesn't commit my changes"</scenario>
|
|
296
353
|
|
|
297
354
|
<exploration>
|
|
298
|
-
gitnexus_query({query: "bd close
|
|
355
|
+
gitnexus_query({query: "bd close commit workflow"})
|
|
299
356
|
→ finds: beads-claim-sync.mjs, close event handler
|
|
300
|
-
find_symbol("
|
|
301
|
-
→ discovers:
|
|
357
|
+
find_symbol("main", include_body=true)
|
|
358
|
+
→ discovers: bd close sets closed-this-session KV only; no git commit
|
|
302
359
|
</exploration>
|
|
303
360
|
|
|
304
361
|
<thinking>
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
Single task, no phases needed.
|
|
362
|
+
bd close does NOT auto-commit (removed in xtrm-wr0o).
|
|
363
|
+
Correct workflow: bd close <id>, then git add + git commit separately, then xt end.
|
|
364
|
+
No issue needed — this is expected behavior.
|
|
309
365
|
</thinking>
|
|
310
366
|
|
|
311
367
|
<bd_command>
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
'git add -A' scoped to expected paths before committing.
|
|
317
|
-
AC: [ ] auto-commit includes new untracked files [ ] existing behavior preserved"
|
|
318
|
-
--type=bug --priority=1
|
|
368
|
+
# No issue needed — explain the correct workflow to the user:
|
|
369
|
+
# 1. bd close <id> --reason="..." ← closes issue
|
|
370
|
+
# 2. git add . && git commit -m "..." ← commit changes manually
|
|
371
|
+
# 3. xt end ← push, PR, merge, worktree cleanup
|
|
319
372
|
</bd_command>
|
|
320
373
|
</example>
|
|
321
374
|
|
|
@@ -343,6 +396,8 @@ Before presenting the plan to the user:
|
|
|
343
396
|
- [ ] Every issue has context / what / AC / notes
|
|
344
397
|
- [ ] Dependencies are correct (A blocks B when B needs A's output)
|
|
345
398
|
- [ ] No task is more than "one session" of work (split if needed)
|
|
399
|
+
- [ ] GitNexus evidence captured (query/context/impact) or fallback path explicitly stated
|
|
400
|
+
- [ ] If refactor scope exists, rename/extract safety checks were included in plan
|
|
346
401
|
- [ ] test-planning was invoked (or scheduled as next step)
|
|
347
402
|
- [ ] First implementation issue is ready to claim
|
|
348
403
|
|
|
@@ -78,7 +78,7 @@ gitnexus_impact({target: "parseComposeServices", direction: "upstream"})
|
|
|
78
78
|
get_symbols_overview("hooks/init.ts") # map file
|
|
79
79
|
find_symbol("parseComposeServices", include_body=True) # read just this
|
|
80
80
|
replace_symbol_body("parseComposeServices", newBody) # Serena edit
|
|
81
|
-
bd close bd-xyz --reason="Fix YAML parse edge case" # close
|
|
81
|
+
bd close bd-xyz --reason="Fix YAML parse edge case" # close issue
|
|
82
82
|
xt end # push, PR, merge, cleanup
|
|
83
83
|
```
|
|
84
84
|
|
|
@@ -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
|
package/skills/planning/SKILL.md
CHANGED
|
@@ -62,16 +62,33 @@ If the request is under 8 words or the scope is unclear, ask **one** clarifying
|
|
|
62
62
|
|
|
63
63
|
Use GitNexus and Serena to understand the landscape. No file edits.
|
|
64
64
|
|
|
65
|
+
### GitNexus-first protocol (mandatory when available)
|
|
66
|
+
|
|
65
67
|
```bash
|
|
66
|
-
# Find relevant execution flows
|
|
68
|
+
# 1) Find relevant execution flows by concept
|
|
67
69
|
gitnexus_query({query: "<concept related to task>"})
|
|
68
70
|
|
|
69
|
-
#
|
|
71
|
+
# 2) Get full caller/callee/process context for likely symbols
|
|
70
72
|
gitnexus_context({name: "<affected symbol>"})
|
|
71
73
|
|
|
72
|
-
#
|
|
74
|
+
# 3) Assess blast radius before locking the implementation plan
|
|
73
75
|
gitnexus_impact({target: "<symbol to change>", direction: "upstream"})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Refactor planning checks (when rename/extract/move is in scope)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Preview safe multi-file rename plan first
|
|
82
|
+
gitnexus_rename({symbol_name: "<old>", new_name: "<new>", dry_run: true})
|
|
83
|
+
|
|
84
|
+
# Confirm context before extraction/split plans
|
|
85
|
+
gitnexus_context({name: "<symbol to extract/split>"})
|
|
86
|
+
gitnexus_impact({target: "<symbol to extract/split>", direction: "upstream"})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Serena symbol-level inspection (targeted reads)
|
|
74
90
|
|
|
91
|
+
```bash
|
|
75
92
|
# Map a file without reading all of it
|
|
76
93
|
get_symbols_overview("path/to/relevant/file.ts")
|
|
77
94
|
|
|
@@ -79,11 +96,44 @@ get_symbols_overview("path/to/relevant/file.ts")
|
|
|
79
96
|
find_symbol("SymbolName", include_body=true)
|
|
80
97
|
```
|
|
81
98
|
|
|
99
|
+
### Fallback when GitNexus MCP tools are unavailable
|
|
100
|
+
|
|
101
|
+
If MCP GitNexus tools are unavailable, use the GitNexus CLI first, then Serena symbol exploration if needed.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Verify index freshness / repository indexing
|
|
105
|
+
npx gitnexus status
|
|
106
|
+
npx gitnexus list
|
|
107
|
+
|
|
108
|
+
# Concept and architecture exploration
|
|
109
|
+
npx gitnexus query "<concept or symptom>" --limit 5
|
|
110
|
+
npx gitnexus context "<symbolName>"
|
|
111
|
+
|
|
112
|
+
# Blast radius before committing to a plan
|
|
113
|
+
npx gitnexus impact "<symbolName>" --direction upstream --depth 3
|
|
114
|
+
|
|
115
|
+
# If index is stale
|
|
116
|
+
npx gitnexus analyze
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Notes:
|
|
120
|
+
- In this environment, `detect_changes` and `rename` are available via MCP tools, not GitNexus CLI subcommands.
|
|
121
|
+
- If both MCP and CLI are unavailable, fall back to Serena search + symbols and state this explicitly in your plan output.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
search_for_pattern("<concept or symbol>")
|
|
125
|
+
get_symbols_overview("path/to/relevant/file.ts")
|
|
126
|
+
find_symbol("<candidate symbol>", include_body=true)
|
|
127
|
+
find_referencing_symbols("<symbol>", "path/to/file.ts")
|
|
128
|
+
```
|
|
129
|
+
|
|
82
130
|
**Capture from exploration:**
|
|
83
131
|
- Which files/symbols will be affected
|
|
132
|
+
- Which execution flows/processes are involved (from `gitnexus_query`/`gitnexus_context`)
|
|
84
133
|
- What existing patterns to follow (naming, structure, error handling)
|
|
85
134
|
- Any d=1 dependents that require updates when you change a symbol
|
|
86
|
-
- Risk level: if CRITICAL or HIGH → warn user before proceeding
|
|
135
|
+
- Risk level from impact analysis: if CRITICAL or HIGH → warn user before proceeding
|
|
136
|
+
- If GitNexus fallback path was used, explicitly call it out in the handoff
|
|
87
137
|
|
|
88
138
|
---
|
|
89
139
|
|
|
@@ -101,6 +151,7 @@ Think through the plan before writing any bd commands. Use structured CoT:
|
|
|
101
151
|
3. What are the dependencies? (what must be done before X can start?)
|
|
102
152
|
4. What can run in parallel? (independent tasks → no deps between them)
|
|
103
153
|
5. What are the risks? (complex areas, unclear spec, risky refactors)
|
|
154
|
+
6. What is the blast-radius summary from GitNexus? (direct callers, affected processes, risk level)
|
|
104
155
|
</thinking>
|
|
105
156
|
|
|
106
157
|
<plan>
|
|
@@ -244,7 +295,13 @@ test-planning will:
|
|
|
244
295
|
|
|
245
296
|
## Phase 6 — Handoff
|
|
246
297
|
|
|
247
|
-
Present the board and transition to implementation
|
|
298
|
+
Present the board and transition to implementation.
|
|
299
|
+
|
|
300
|
+
Include a short **Architecture & Impact Summary** in your handoff message:
|
|
301
|
+
- Key execution flows/processes involved
|
|
302
|
+
- Top d=1 dependents to watch
|
|
303
|
+
- Highest observed risk (LOW/MEDIUM/HIGH/CRITICAL)
|
|
304
|
+
- Whether GitNexus-first or fallback exploration was used
|
|
248
305
|
|
|
249
306
|
```bash
|
|
250
307
|
# Show the full board
|
|
@@ -292,30 +349,26 @@ Then begin work on the first task. The planning phase is complete.
|
|
|
292
349
|
### Example 2 — Bug fix with investigation
|
|
293
350
|
|
|
294
351
|
<example>
|
|
295
|
-
<scenario>User: "bd close
|
|
352
|
+
<scenario>User: "bd close doesn't commit my changes"</scenario>
|
|
296
353
|
|
|
297
354
|
<exploration>
|
|
298
|
-
gitnexus_query({query: "bd close
|
|
355
|
+
gitnexus_query({query: "bd close commit workflow"})
|
|
299
356
|
→ finds: beads-claim-sync.mjs, close event handler
|
|
300
|
-
find_symbol("
|
|
301
|
-
→ discovers:
|
|
357
|
+
find_symbol("main", include_body=true)
|
|
358
|
+
→ discovers: bd close sets closed-this-session KV only; no git commit
|
|
302
359
|
</exploration>
|
|
303
360
|
|
|
304
361
|
<thinking>
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
Single task, no phases needed.
|
|
362
|
+
bd close does NOT auto-commit (removed in xtrm-wr0o).
|
|
363
|
+
Correct workflow: bd close <id>, then git add + git commit separately, then xt end.
|
|
364
|
+
No issue needed — this is expected behavior.
|
|
309
365
|
</thinking>
|
|
310
366
|
|
|
311
367
|
<bd_command>
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
'git add -A' scoped to expected paths before committing.
|
|
317
|
-
AC: [ ] auto-commit includes new untracked files [ ] existing behavior preserved"
|
|
318
|
-
--type=bug --priority=1
|
|
368
|
+
# No issue needed — explain the correct workflow to the user:
|
|
369
|
+
# 1. bd close <id> --reason="..." ← closes issue
|
|
370
|
+
# 2. git add . && git commit -m "..." ← commit changes manually
|
|
371
|
+
# 3. xt end ← push, PR, merge, worktree cleanup
|
|
319
372
|
</bd_command>
|
|
320
373
|
</example>
|
|
321
374
|
|
|
@@ -343,6 +396,8 @@ Before presenting the plan to the user:
|
|
|
343
396
|
- [ ] Every issue has context / what / AC / notes
|
|
344
397
|
- [ ] Dependencies are correct (A blocks B when B needs A's output)
|
|
345
398
|
- [ ] No task is more than "one session" of work (split if needed)
|
|
399
|
+
- [ ] GitNexus evidence captured (query/context/impact) or fallback path explicitly stated
|
|
400
|
+
- [ ] If refactor scope exists, rename/extract safety checks were included in plan
|
|
346
401
|
- [ ] test-planning was invoked (or scheduled as next step)
|
|
347
402
|
- [ ] First implementation issue is ready to claim
|
|
348
403
|
|
|
@@ -78,7 +78,7 @@ gitnexus_impact({target: "parseComposeServices", direction: "upstream"})
|
|
|
78
78
|
get_symbols_overview("hooks/init.ts") # map file
|
|
79
79
|
find_symbol("parseComposeServices", include_body=True) # read just this
|
|
80
80
|
replace_symbol_body("parseComposeServices", newBody) # Serena edit
|
|
81
|
-
bd close bd-xyz --reason="Fix YAML parse edge case" # close
|
|
81
|
+
bd close bd-xyz --reason="Fix YAML parse edge case" # close issue
|
|
82
82
|
xt end # push, PR, merge, cleanup
|
|
83
83
|
```
|
|
84
84
|
|