Skip to content

Commit bb40d0f

Browse files
committed
Make debug mode analyze code before prompting
1 parent 2319d5d commit bb40d0f

4 files changed

Lines changed: 24 additions & 19 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local loopback collector, wait for you to reproduce manually, fix from log proof
1111
verify once, then clean up.
1212

1313
```text
14-
hypothesize -> instrument -> reproduce -> inspect evidence -> fix -> verify -> clean up
14+
analyze code -> hypothesize -> instrument -> reproduce -> inspect evidence -> fix -> verify -> clean up
1515
```
1616

1717
## When to Use
@@ -30,7 +30,7 @@ Detailed contracts load progressively from `skills/debug-mode/references/`.
3030

3131
## How It Works
3232

33-
1. The agent states ranked hypotheses and adds 3–8 targeted probes.
33+
1. The agent analyzes the relevant code path, states ranked hypotheses, and adds 3–8 targeted probes.
3434
2. A small loopback collector receives structured events at `POST /log` and
3535
writes one NDJSON line per event.
3636
3. The agent stops and asks you to reproduce the bug manually. In Pi, the

‎extensions/cursor-like-debug-mode.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ function stripFrontmatter(source: string) {
7272

7373
function buildSkillPrompt(args: string) {
7474
const body = stripFrontmatter(readFileSync(SKILL_PATH, "utf8"));
75-
const request =
76-
args.trim() || "Start Cursor-like Debug Mode. Ask for the missing Bug Intake information.";
75+
const request = args.trim() || "Start Cursor-like Debug Mode.";
7776
return `<skill name="debug-mode" location="${SKILL_PATH}">\nReferences are relative to ${dirname(SKILL_PATH)}.\n\n${body}\n</skill>\n\n${request}`;
7877
}
7978

‎skills/debug-mode/SKILL.md‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,39 @@ compatibility: The collector and summary scripts require Node.js 24 or a later v
77

88
# Cursor-like Debug Mode
99

10-
Run this evidence loop:
10+
Run this code-first evidence loop:
1111

1212
```text
13-
frame -> hypothesize -> arm -> instrument -> reproduce -> prove -> fix -> verify -> clean
13+
analyze code -> hypothesize -> arm -> instrument -> reproduce -> prove -> fix -> verify -> clean
1414
```
1515

16+
Work autonomously through instrumentation.
17+
The first planned user interaction is the Step 5 reproduction checkpoint.
1618
Reproduction and verification are gates. Cross them only through the checkpoint protocol.
1719

18-
## 1. Frame the Bug
20+
## 1. Analyze the Code Path
1921

20-
Read the relevant code, reproduction details, existing logs, and recent changes.
21-
Write a Bug Card with these fields:
22+
Start repository legwork from the reported symptom.
23+
Read relevant entry points, event handlers, state transitions, existing logs, and recent changes.
24+
Map candidate code paths from the user's trigger to the observed outcome.
25+
Write a provisional Bug Card from available evidence:
2226

23-
- Symptom
24-
- Expected behavior
25-
- Exact trigger, route, command, input, or fixture
26-
- Browser, operating system, runtime, branch, flags, account, and dataset
27-
- Frequency: constant, intermittent, or unknown
28-
- Relevant recent changes and existing evidence
27+
- Symptom and expected behavior
28+
- Known trigger, route, command, input, or fixture
29+
- Candidate runtime path and disputed boundaries
30+
- Relevant environment, frequency, recent changes, and evidence
2931
- Observable acceptance criterion
3032

31-
Reuse facts from the user's report. Ask only for missing facts that block targeted probes.
33+
Record unavailable facts as `unknown`.
34+
Resolve consequential unknowns through code reading or discriminating runtime probes.
3235

33-
**Complete when:** the manual trigger is exact, and the acceptance criterion is observable.
36+
**Complete when:** one candidate path links trigger to symptom, and every disputed branch has a named probe boundary.
3437

3538
## 2. Build the Hypothesis Matrix
3639

37-
Write two to five ranked hypotheses before adding probes. Use this shape:
40+
Write two to five ranked hypotheses before adding probes.
41+
Anchor the first matrix in code analysis and available evidence.
42+
Use this shape:
3843

3944
```text
4045
H1 <short cause>

‎tests/cursor-like-debug-mode-choice.test.mjs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ assert.equal(sentMessages[0].content.includes("description: This opt-in workflow
6161
assert.equal(sentMessages[0].options, undefined);
6262

6363
await commandDefinition.handler("", { isIdle: () => false });
64-
assert.match(sentMessages[1].content, /Ask for the missing Bug Intake information\.$/);
64+
assert.match(sentMessages[1].content, /Start Cursor-like Debug Mode\.$/);
65+
assert.doesNotMatch(sentMessages[1].content, /Bug Intake/);
6566
assert.deepEqual(sentMessages[1].options, { deliverAs: "steer" });
6667

6768
assert.equal(checkpointTool.name, "cursor_like_debug_mode_checkpoint");

0 commit comments

Comments
 (0)