Skip to content

Commit 27bf0bc

Browse files
committed
Add Codex plugin packaging and native debug checkpoints
1 parent bb40d0f commit 27bf0bc

7 files changed

Lines changed: 196 additions & 19 deletions

File tree

‎.codex-plugin/plugin.json‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "cursor-like-debug-mode",
3+
"version": "0.1.0",
4+
"description": "Evidence-driven runtime debugging with temporary probes and interactive checkpoints.",
5+
"author": {
6+
"name": "wangnan0916",
7+
"url": "https://github.com/wangnan0916"
8+
},
9+
"homepage": "https://github.com/wangnan0916/cursor-like-debug-mode#readme",
10+
"repository": "https://github.com/wangnan0916/cursor-like-debug-mode",
11+
"license": "MIT",
12+
"keywords": [
13+
"debugging",
14+
"runtime",
15+
"instrumentation",
16+
"agent-skill",
17+
"codex-plugin"
18+
],
19+
"skills": "./skills/",
20+
"interface": {
21+
"displayName": "Cursor-like Debug Mode",
22+
"shortDescription": "Diagnose reproducible runtime bugs with log evidence.",
23+
"longDescription": "Diagnose reproducible runtime bugs with temporary probes, local NDJSON evidence, manual verification, and mechanical cleanup.",
24+
"developerName": "wangnan0916",
25+
"category": "Developer Tools",
26+
"capabilities": [
27+
"Interactive",
28+
"Read",
29+
"Write"
30+
],
31+
"defaultPrompt": [
32+
"Use $debug-mode to diagnose this reproducible runtime bug with temporary probes."
33+
]
34+
}
35+
}

‎README.md‎

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Agent-agnostic, opt-in debug mode for reproducible runtime bugs. It includes
44
first-class probe helpers for browser/frontend JavaScript and Node.js, while
55
the local collector accepts the same structured events from other runtimes.
66
Pi installations can also load the bundled interactive checkpoint chooser.
7+
Codex installations prefer the native `request_user_input` checkpoint.
78
The `debug-mode` skill ID remains unchanged for compatibility.
89

910
Agents add temporary structured probes, collect NDJSON evidence through a
@@ -33,10 +34,10 @@ Detailed contracts load progressively from `skills/debug-mode/references/`.
3334
1. The agent analyzes the relevant code path, states ranked hypotheses, and adds 3–8 targeted probes.
3435
2. A small loopback collector receives structured events at `POST /log` and
3536
writes one NDJSON line per event.
36-
3. The agent stops and asks you to reproduce the bug manually. In Pi, the
37-
bundled chooser presents exactly `A - Reproduced`, `B - Fixed`, and
38-
`C - Other: enter details`. If the user selects C, the chooser opens a
39-
free-form editor.
37+
3. The agent stops and asks you to reproduce the bug manually. Codex uses
38+
phase-specific native choices when `request_user_input` is available. Pi
39+
presents exactly `A - Reproduced`, `B - Fixed`, and `C - Other: enter
40+
details`. Other clients use the text fallback.
4041
4. After you choose or type a reply, it summarizes the log, confirms or rejects
4142
hypotheses, states the fix acceptance criteria, makes a minimal fix, verifies
4243
once with probes still active, then removes all instrumentation.
@@ -79,9 +80,9 @@ For Codex and similar clients, invoke the stable Skill ID:
7980
$debug-mode <problem description>
8081
```
8182

82-
When the agent pauses for manual verification, Pi users can select A, B, or C
83-
from the interactive chooser. If you select C, the chooser opens a text editor.
84-
If the chooser is not available, reply with the first letter:
83+
At a manual checkpoint, interactive Codex sessions use native phase-specific
84+
choices. Codex adds a free-form Other choice automatically. Pi users can select
85+
A, B, or C from the bundled chooser. Other clients reply with the first letter:
8586

8687
```text
8788
A - Reproduced
@@ -103,9 +104,11 @@ The main skill owns the evidence format and cleanup criteria.
103104
skill.
104105
- **Pi tool ID:** `cursor_like_debug_mode_checkpoint`. It is optional and is
105106
loaded only when the repository is installed as a Pi package.
106-
- **Other Agent Skills clients:** receive only `skills/debug-mode/`, including
107-
its scripts and assets. They do not receive or execute the Pi extension and
108-
use the plain-text checkpoint with A, B, and C.
107+
- **Codex native checkpoint:** `request_user_input` is preferred when the tool
108+
is available in an interactive session.
109+
- **Other Agent Skills clients:** receive `skills/debug-mode/`, including its
110+
scripts and assets. Clients without a supported chooser use the plain-text
111+
checkpoint with A, B, and C.
109112
- **Runtime:** Node.js 24+ is required only when the bundled collector or summary
110113
scripts run.
111114

@@ -114,6 +117,15 @@ The repository name is `cursor-like-debug-mode`. The stable Skill ID remains
114117

115118
## Install
116119

120+
### Codex plugin package
121+
122+
The repository root is a standard Codex plugin with its manifest at
123+
`.codex-plugin/plugin.json`. It packages the same `debug-mode` skill without an
124+
MCP server, marketplace entry, or external service.
125+
126+
This repository does not install or modify a personal marketplace. Existing
127+
Agent Skills installations continue to work independently of plugin packaging.
128+
117129
### Pi: skill and interactive chooser
118130

119131
Install this repository as a Pi package to load the command, skill, and
@@ -146,6 +158,9 @@ installation path does not load the Pi extension.
146158
## Layout
147159

148160
```text
161+
.codex-plugin/
162+
plugin.json # Codex plugin identity and UI metadata
163+
149164
extensions/
150165
cursor-like-debug-mode.ts # Pi checkpoint tool with A, B, and C
151166
cursor-like-debug-mode-choice.mjs # shared option/result helpers

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"version": "0.1.0",
44
"private": true,
55
"type": "module",
6-
"description": "Cursor-like Debug Mode skill with local NDJSON collection and an optional Pi checkpoint chooser.",
6+
"description": "Cursor-like Debug Mode plugin with local NDJSON collection and native Codex or Pi checkpoints.",
77
"keywords": [
88
"agent-skill",
9+
"codex-plugin",
910
"pi-package",
1011
"debugging"
1112
],

‎skills/debug-mode/SKILL.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
---
22
name: debug-mode
33
description: Diagnose one reproducible runtime bug with temporary probes, NDJSON evidence, manual checkpoints, and mechanical cleanup.
4-
disable-model-invocation: true
5-
compatibility: The collector and summary scripts require Node.js 24 or a later version. The interactive Pi chooser is optional. Other Agent Skills clients use the plain-text fallback for the checkpoint.
4+
compatibility: The collector and summary scripts require Node.js 24 or later. Codex can use native request_user_input. Pi can use its optional chooser.
65
---
76

87
# Cursor-like Debug Mode
98

9+
Activation gate: continue only when the current user message invokes `$debug-mode` or says `debug mode`.
10+
Also continue for explicit requests for instrumented debugging or local runtime log collection.
11+
If the gate is closed, stop before analysis, collector startup, or instrumentation.
12+
1013
Run this code-first evidence loop:
1114

1215
```text
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
interface:
22
display_name: "Cursor-like Debug Mode"
33
short_description: "Runtime diagnosis with three checkpoint options"
4-
default_prompt: "Use $debug-mode to diagnose a reproducible runtime bug. Add temporary probes. Use interactive A, B, and C checkpoints when available. Use log evidence for a small fix and cleanup."
4+
default_prompt: "Use $debug-mode to diagnose a reproducible runtime bug. Add temporary probes. Prefer native interactive checkpoints. Use log evidence for a small fix and cleanup."
5+
policy:
6+
allow_implicit_invocation: false

‎skills/debug-mode/references/checkpoints.md‎

Lines changed: 85 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,91 @@
22

33
Read this reference at each reproduction or verification gate.
44
Checkpoint answers are protocol messages rather than progress summaries.
5-
A checkpoint response contains one interactive tool call or one exact fallback template.
5+
A native checkpoint presents context, then one tool call.
6+
A Pi checkpoint contains only its chooser call.
7+
A plain-text checkpoint contains one exact fallback template.
68

7-
## Interactive Path
9+
Use the first available path in this order:
10+
11+
1. Native Codex path
12+
2. Pi chooser path
13+
3. Plain-text path
14+
15+
## Native Codex Path
16+
17+
Use this path when `request_user_input` is listed and the session can accept an interactive answer.
18+
Before the call, show these fields in this order:
19+
20+
```text
21+
The manual debug checkpoint is ready:
22+
23+
- Phase: <pre-fix or post-fix>
24+
- Session: <session_id>
25+
- Log file: <LOG_FILE>
26+
- Debug endpoint: <DEBUG_URL>/log
27+
```
28+
29+
Call `request_user_input` once with the applicable payload. Then wait for its result.
30+
31+
### Pre-Fix Native Payload
32+
33+
```json
34+
{
35+
"questions": [
36+
{
37+
"header": "Reproduce",
38+
"id": "reproduction_result",
39+
"question": "Reproduce the original bug manually, then choose the result.",
40+
"options": [
41+
{
42+
"label": "Reproduced (Recommended)",
43+
"description": "The bug appeared again, so the current log can be analyzed."
44+
},
45+
{
46+
"label": "Issue disappeared",
47+
"description": "The bug did not appear, so the trigger or probes need adjustment."
48+
}
49+
]
50+
}
51+
]
52+
}
53+
```
54+
55+
Map `Reproduced (Recommended)` to `A`.
56+
Map `Issue disappeared` to `B`.
57+
58+
### Post-Fix Native Payload
59+
60+
```json
61+
{
62+
"questions": [
63+
{
64+
"header": "Verify fix",
65+
"id": "verification_result",
66+
"question": "Verify the original bug manually, then choose the result.",
67+
"options": [
68+
{
69+
"label": "Fixed (Recommended)",
70+
"description": "The acceptance criterion passed, so temporary instrumentation can be removed."
71+
},
72+
{
73+
"label": "Still reproducible",
74+
"description": "The bug remains, so post-fix evidence needs more analysis."
75+
}
76+
]
77+
}
78+
]
79+
}
80+
```
81+
82+
Map `Fixed (Recommended)` to `B`.
83+
Map `Still reproducible` to `A`.
84+
85+
Codex supplies a free-form Other choice automatically. Map its submitted text to `C` evidence.
86+
If the native tool is absent or errors, continue to the Pi chooser path.
87+
A native cancellation leaves the gate pending. Stop without selecting a result or falling back.
88+
89+
## Pi Chooser Path
890

991
When `cursor_like_debug_mode_checkpoint` is available, call it as the response's only tool.
1092
Pass the real `phase`, `session`, `logFile`, and `debugEndpoint` values.
@@ -23,7 +105,7 @@ A `cancelled` or `ui_unavailable` result switches to the applicable fallback tem
23105

24106
## Plain-Text Path
25107

26-
Use plain text when the interactive tool is absent, cancelled, or unavailable.
108+
Use plain text when both interactive paths are unavailable or the Pi chooser returns a fallback result.
27109
Send exactly the applicable template. Then wait for a typed reply.
28110

29111
### Pre-Fix Template

‎tests/distribution-compatibility.test.mjs‎

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ import { fileURLToPath } from "node:url";
55

66
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
77
const packageJson = JSON.parse(await readFile(path.join(repoRoot, "package.json"), "utf8"));
8+
const pluginJson = JSON.parse(
9+
await readFile(path.join(repoRoot, ".codex-plugin", "plugin.json"), "utf8"),
10+
);
811
const skillDir = path.join(repoRoot, "skills", "debug-mode");
912
const skillPath = path.join(skillDir, "SKILL.md");
1013
const skill = await readFile(skillPath, "utf8");
14+
const openaiAgent = await readFile(path.join(skillDir, "agents", "openai.yaml"), "utf8");
1115
const collector = await readFile(path.join(skillDir, "references", "collector.md"), "utf8");
1216
const checkpoints = await readFile(path.join(skillDir, "references", "checkpoints.md"), "utf8");
1317
const probes = await readFile(path.join(skillDir, "references", "probes.md"), "utf8");
@@ -17,12 +21,32 @@ const troubleshooting = await readFile(
1721
);
1822

1923
assert.equal(packageJson.name, "cursor-like-debug-mode");
24+
assert.ok(packageJson.keywords.includes("codex-plugin"));
25+
assert.equal(pluginJson.name, packageJson.name);
26+
assert.equal(pluginJson.version, packageJson.version);
27+
assert.equal(pluginJson.skills, "./skills/");
28+
assert.equal(pluginJson.author.name, "wangnan0916");
29+
assert.equal(pluginJson.repository, "https://github.com/wangnan0916/cursor-like-debug-mode");
30+
assert.ok(pluginJson.keywords.includes("codex-plugin"));
31+
assert.equal(pluginJson.interface.displayName, "Cursor-like Debug Mode");
32+
assert.equal(pluginJson.interface.category, "Developer Tools");
33+
assert.deepEqual(pluginJson.interface.capabilities, ["Interactive", "Read", "Write"]);
34+
assert.deepEqual(pluginJson.interface.defaultPrompt, [
35+
"Use $debug-mode to diagnose this reproducible runtime bug with temporary probes.",
36+
]);
37+
assert.equal(Object.hasOwn(pluginJson, "apps"), false);
38+
assert.equal(Object.hasOwn(pluginJson, "mcpServers"), false);
39+
assert.equal(Object.hasOwn(pluginJson, "hooks"), false);
2040
assert.deepEqual(packageJson.pi.skills, ["./skills"]);
2141
assert.deepEqual(packageJson.pi.extensions, ["./extensions/cursor-like-debug-mode.ts"]);
2242
assert.ok(packageJson.pi.extensions.every((entry) => !entry.startsWith("./skills/")));
2343

2444
assert.match(skill, /^---\nname: debug-mode\n/m);
25-
assert.match(skill, /^disable-model-invocation: true$/m);
45+
assert.doesNotMatch(skill, /^disable-model-invocation:/m);
46+
assert.match(skill, /^Activation gate: continue only when the current user message invokes/m);
47+
assert.match(skill, /Also continue for explicit requests for instrumented debugging or local runtime log collection\./);
48+
assert.match(skill, /If the gate is closed, stop before analysis, collector startup, or instrumentation\./);
49+
assert.match(openaiAgent, /^policy:\n allow_implicit_invocation: false$/m);
2650
assert.equal(path.basename(path.dirname(skillPath)), "debug-mode");
2751
assert.match(skill, /^compatibility: The collector and summary scripts require Node\.js 24/m);
2852
assert.match(skill, /\(references\/collector\.md\)/);
@@ -31,8 +55,23 @@ assert.match(skill, /\(references\/probes\.md\)/);
3155
assert.match(skill, /\(references\/troubleshooting\.md\)/);
3256
assert.match(collector, /node <skill-dir>\/scripts\/start-collector\.mjs --session <session_id>/);
3357
assert.match(probes, /#region DEBUG_MODE_PROBE <session_id>/);
58+
const nativePathIndex = checkpoints.indexOf("## Native Codex Path");
59+
const piPathIndex = checkpoints.indexOf("## Pi Chooser Path");
60+
const plainTextPathIndex = checkpoints.indexOf("## Plain-Text Path");
61+
assert.ok(nativePathIndex >= 0 && nativePathIndex < piPathIndex && piPathIndex < plainTextPathIndex);
62+
assert.match(checkpoints, /Use this path when `request_user_input` is listed/);
63+
assert.match(checkpoints, /"label": "Reproduced \(Recommended\)"/);
64+
assert.match(checkpoints, /"label": "Issue disappeared"/);
65+
assert.match(checkpoints, /"label": "Fixed \(Recommended\)"/);
66+
assert.match(checkpoints, /"label": "Still reproducible"/);
67+
assert.match(checkpoints, /Map `Reproduced \(Recommended\)` to `A`\./);
68+
assert.match(checkpoints, /Map `Issue disappeared` to `B`\./);
69+
assert.match(checkpoints, /Map `Fixed \(Recommended\)` to `B`\./);
70+
assert.match(checkpoints, /Map `Still reproducible` to `A`\./);
71+
assert.match(checkpoints, /Map its submitted text to `C` evidence\./);
72+
assert.match(checkpoints, /A native cancellation leaves the gate pending\./);
3473
assert.match(checkpoints, /When `cursor_like_debug_mode_checkpoint` is available/);
35-
assert.match(checkpoints, /Use plain text when the interactive tool is absent, cancelled, or unavailable\./);
74+
assert.match(checkpoints, /Use plain text when both interactive paths are unavailable/);
3675
assert.match(checkpoints, /A - Reproduced\nB - Fixed\nC - Other: describe what happened/);
3776
assert.match(troubleshooting, /Read only the branch matching the observed collection failure\./);
3877

0 commit comments

Comments
 (0)