@dsmm/dsmm 0.0.0-stage → 0.1.0
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/LICENSE +103 -0
- package/README.md +67 -2
- package/agent-presets/dsmm-builder/agent.cordis.yml +210 -0
- package/agent-presets/dsmm-builder/preset.yml +3 -0
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +34 -0
- package/agent-presets/dsmm-clarifier/preset.yml +3 -0
- package/agent-presets/dsmm-code-search/agent.cordis.yml +34 -0
- package/agent-presets/dsmm-code-search/preset.yml +3 -0
- package/agent-presets/dsmm-creative/agent.cordis.yml +31 -0
- package/agent-presets/dsmm-creative/preset.yml +3 -0
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +34 -0
- package/agent-presets/dsmm-doc-search/preset.yml +3 -0
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +34 -0
- package/agent-presets/dsmm-media-reader/preset.yml +3 -0
- package/agent-presets/dsmm-oracle/agent.cordis.yml +31 -0
- package/agent-presets/dsmm-oracle/preset.yml +3 -0
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +31 -0
- package/agent-presets/dsmm-oracle-2nd/preset.yml +3 -0
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +215 -0
- package/agent-presets/dsmm-orchestrator/preset.yml +3 -0
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +33 -0
- package/agent-presets/dsmm-plan-critic/preset.yml +3 -0
- package/agent-presets/dsmm-planner/agent.cordis.yml +33 -0
- package/agent-presets/dsmm-planner/preset.yml +3 -0
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +33 -0
- package/agent-presets/dsmm-reviewer/preset.yml +3 -0
- package/cordis.patch.yml +8 -0
- package/docs/agent-presets.md +17 -0
- package/docs/compatibility.md +46 -0
- package/docs/design.md +237 -0
- package/docs/lsp.md +40 -0
- package/docs/migration-from-ocmm.md +48 -0
- package/docs/model-routing.md +16 -0
- package/docs/releasing.md +50 -0
- package/docs/research/deepseek-v4-pro.md +74 -0
- package/docs/research/oh-dsh.md +96 -0
- package/docs/roadmap.md +207 -0
- package/docs/runtime-recovery.md +67 -0
- package/docs/safety-guards.md +55 -0
- package/docs/settings-status.md +51 -0
- package/docs/skill-sync.md +20 -0
- package/lib/commands.d.ts +13 -0
- package/lib/commands.js +55 -0
- package/lib/dsh-events.d.ts +13 -0
- package/lib/dsh-events.js +2 -0
- package/lib/dsh-types.d.ts +308 -0
- package/lib/dsh-types.js +2 -0
- package/lib/guards.d.ts +10 -0
- package/lib/guards.js +252 -0
- package/lib/index.d.ts +31 -0
- package/lib/index.js +54 -0
- package/lib/lsp.d.ts +30 -0
- package/lib/lsp.js +154 -0
- package/lib/mode.d.ts +6 -0
- package/lib/mode.js +62 -0
- package/lib/model-family.d.ts +6 -0
- package/lib/model-family.js +49 -0
- package/lib/model-routing.d.ts +11 -0
- package/lib/model-routing.js +103 -0
- package/lib/plan-validation.d.ts +3 -0
- package/lib/plan-validation.js +119 -0
- package/lib/preset-materializer.d.ts +36 -0
- package/lib/preset-materializer.js +258 -0
- package/lib/preset-registry.d.ts +5 -0
- package/lib/preset-registry.js +126 -0
- package/lib/preset-skills.d.ts +12 -0
- package/lib/preset-skills.js +28 -0
- package/lib/prompts.d.ts +13 -0
- package/lib/prompts.js +82 -0
- package/lib/recovery-policy.d.ts +25 -0
- package/lib/recovery-policy.js +252 -0
- package/lib/role-subagents.d.ts +6 -0
- package/lib/role-subagents.js +54 -0
- package/lib/roles.d.ts +28 -0
- package/lib/roles.js +239 -0
- package/lib/runtime-recovery.d.ts +5 -0
- package/lib/runtime-recovery.js +149 -0
- package/lib/session-scope.d.ts +4 -0
- package/lib/session-scope.js +17 -0
- package/lib/settings.d.ts +112 -0
- package/lib/settings.js +363 -0
- package/lib/shell-command.d.ts +18 -0
- package/lib/shell-command.js +492 -0
- package/lib/skills.d.ts +18 -0
- package/lib/skills.js +64 -0
- package/lib/state.d.ts +13 -0
- package/lib/state.js +64 -0
- package/lib/status.d.ts +46 -0
- package/lib/status.js +155 -0
- package/package.json +124 -4
- package/patches/agent-presets-root.example.cordis.patch.yml +14 -0
- package/patches/ocmm-lsp-mcp.example.cordis.patch.yml +15 -0
- package/prompts/deepseek-flash.md +11 -0
- package/prompts/deepseek-v4-pro.md +14 -0
- package/prompts/deepwork.md +32 -0
- package/skills/brainstorming/SKILL.md +15 -0
- package/skills/debugging/SKILL.md +12 -0
- package/skills/debugging/references/logging.md +91 -0
- package/skills/debugging/references/methodology/00-setup.md +108 -0
- package/skills/debugging/references/methodology/02-investigate.md +67 -0
- package/skills/debugging/references/methodology/03-flaky-triage.md +69 -0
- package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +83 -0
- package/skills/debugging/references/methodology/05-escalate.md +69 -0
- package/skills/debugging/references/methodology/06-fix.md +123 -0
- package/skills/debugging/references/methodology/08-qa.md +94 -0
- package/skills/debugging/references/methodology/09-cleanup.md +164 -0
- package/skills/debugging/references/methodology/partial-runtime-evidence.md +217 -0
- package/skills/debugging/references/runtimes/bundled-js-binary.md +415 -0
- package/skills/debugging/references/runtimes/go.md +252 -0
- package/skills/debugging/references/runtimes/native-binary.md +484 -0
- package/skills/debugging/references/runtimes/node.md +260 -0
- package/skills/debugging/references/runtimes/python.md +248 -0
- package/skills/debugging/references/runtimes/rust.md +234 -0
- package/skills/debugging/references/scripts/dap.mjs +533 -0
- package/skills/debugging/references/tools/dap.md +89 -0
- package/skills/debugging/references/tools/ghidra.md +212 -0
- package/skills/debugging/references/tools/playwright-cli.md +316 -0
- package/skills/debugging/references/tools/pwndbg.md +263 -0
- package/skills/debugging/references/tools/pwntools.md +265 -0
- package/skills/dispatching-parallel-agents/SKILL.md +14 -0
- package/skills/receiving-code-review/SKILL.md +13 -0
- package/skills/remove-ai-slops/SKILL.md +14 -0
- package/skills/requesting-code-review/SKILL.md +10 -0
- package/skills/subagent-driven-development/SKILL.md +13 -0
- package/skills/writing-plans/SKILL.md +14 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Rust Debugging
|
|
2
|
+
|
|
3
|
+
Covers `cargo`, `tokio`, panics, and the fact that you usually don't actually need a debugger — Rust's type system, `dbg!`, and logging cover 80% of sessions faster than gdb would.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Environment detection (Phase 0)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cargo --version
|
|
11
|
+
rustc --version
|
|
12
|
+
cat rust-toolchain.toml rust-toolchain 2>/dev/null
|
|
13
|
+
cat Cargo.toml | head -30
|
|
14
|
+
|
|
15
|
+
# Debuggers available
|
|
16
|
+
which rust-gdb
|
|
17
|
+
which rust-lldb
|
|
18
|
+
which lldb
|
|
19
|
+
|
|
20
|
+
# Async infrastructure
|
|
21
|
+
grep -E '"(tokio|async-std|smol)"' Cargo.toml
|
|
22
|
+
|
|
23
|
+
# Profile flags
|
|
24
|
+
grep -E '^\[profile' Cargo.toml
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**The default `cargo run` builds with `dev` profile** which includes debug symbols. `cargo run --release` strips them. For debugging, stay in dev unless the bug only manifests under optimization.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## The Rust debugging hierarchy (use in this order)
|
|
32
|
+
|
|
33
|
+
Rust's ecosystem has a specific order that's faster than reaching for gdb first:
|
|
34
|
+
|
|
35
|
+
1. **`dbg!(expr)` macro** — for a single value at a specific spot. Prints file:line + value, returns the value unchanged so you can inline it. Faster than a debugger for 60% of bugs.
|
|
36
|
+
2. **`RUST_LOG=trace` with `tracing` / `env_logger`** — for flow and state across an operation. Zero code change in dev-time.
|
|
37
|
+
3. **`RUST_BACKTRACE=1` / `=full`** — for crashes. Almost always sufficient; you rarely need a live debugger for a panic.
|
|
38
|
+
4. **`rust-gdb` / `rust-lldb`** — when you need to pause execution and inspect memory, especially for unsafe code or FFI.
|
|
39
|
+
5. **`tokio-console`** — for async deadlocks, stuck tasks, hot loops.
|
|
40
|
+
6. **`cargo-expand`** — when a macro is doing something weird.
|
|
41
|
+
|
|
42
|
+
Reach for the lightest tool that answers the hypothesis.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## `dbg!` — the underused macro
|
|
47
|
+
|
|
48
|
+
```rust
|
|
49
|
+
let x = 5;
|
|
50
|
+
let y = dbg!(x * 2); // prints: [src/main.rs:2] x * 2 = 10
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Inside a complex expression:
|
|
54
|
+
```rust
|
|
55
|
+
let total = items.iter().filter(|i| i.active).map(|i| dbg!(i.cost)).sum::<u64>();
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Multiple values at once:
|
|
59
|
+
```rust
|
|
60
|
+
dbg!(&user, &request, elapsed.as_millis());
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`dbg!` writes to stderr, so it won't corrupt stdout-based pipelines. **Journal each `dbg!` you add**; revert at Phase 9.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## `RUST_LOG` for flow-level debugging
|
|
68
|
+
|
|
69
|
+
If the codebase uses `tracing` or `env_logger`:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
RUST_LOG=debug cargo run
|
|
73
|
+
RUST_LOG=trace cargo run # very verbose
|
|
74
|
+
RUST_LOG=my_crate=trace,hyper=info cargo run # per-module level
|
|
75
|
+
RUST_LOG=debug,tokio=off cargo run # silence noisy crates
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
For `tracing`-based apps, instrument with spans:
|
|
79
|
+
```rust
|
|
80
|
+
#[tracing::instrument]
|
|
81
|
+
fn handle_request(req: &Request) -> Response { ... }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This gives you structured per-call entry/exit logs with args and timing, zero additional code in the body.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## `RUST_BACKTRACE` for panics
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
RUST_BACKTRACE=1 cargo run # backtrace on panic
|
|
92
|
+
RUST_BACKTRACE=full cargo run # include libstd/tokio frames
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The panic itself usually tells you the file:line. The backtrace tells you how it got there. Between the two, most crash bugs are solved without a debugger.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## rust-gdb / rust-lldb
|
|
100
|
+
|
|
101
|
+
### Launch
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Build with debug symbols (default dev profile)
|
|
105
|
+
cargo build
|
|
106
|
+
|
|
107
|
+
# Attach gdb wrapper (applies Rust type pretty-printers)
|
|
108
|
+
rust-gdb ./target/debug/my_binary
|
|
109
|
+
# Or lldb:
|
|
110
|
+
rust-lldb ./target/debug/my_binary
|
|
111
|
+
|
|
112
|
+
# With args
|
|
113
|
+
rust-gdb --args ./target/debug/my_binary arg1 arg2
|
|
114
|
+
|
|
115
|
+
# Attach to running process
|
|
116
|
+
rust-gdb -p $(pgrep my_binary)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Breakpoints
|
|
120
|
+
|
|
121
|
+
Rust symbols are mangled. Use either:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
(gdb) b main # main function
|
|
125
|
+
(gdb) b my_crate::module::function # canonical path
|
|
126
|
+
(gdb) b src/handler.rs:42 # file:line
|
|
127
|
+
(gdb) info functions my_function # find mangled name
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### State inspection
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
(gdb) p x # print value (uses Rust pretty-printer for Vec, Option, HashMap, etc.)
|
|
134
|
+
(gdb) p *ptr # deref
|
|
135
|
+
(gdb) info locals # all locals in current frame
|
|
136
|
+
(gdb) info args # function args
|
|
137
|
+
(gdb) bt # backtrace
|
|
138
|
+
(gdb) frame <n> # switch to stack frame n
|
|
139
|
+
(gdb) watch my_var # stop when my_var changes
|
|
140
|
+
(gdb) rbreak regex # breakpoint all functions matching regex
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Pair with pwndbg** for better layout on native bugs — see [tools/pwndbg.md](../tools/pwndbg.md). Pwndbg works with rust-gdb too.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## tokio-console — async task debugging
|
|
148
|
+
|
|
149
|
+
For tokio-based async apps, this is essential when tasks are stuck or leaking.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Add tokio-console instrumentation to the target binary
|
|
153
|
+
# In Cargo.toml:
|
|
154
|
+
# [dependencies]
|
|
155
|
+
# console-subscriber = "0.2"
|
|
156
|
+
|
|
157
|
+
# In main.rs:
|
|
158
|
+
# console_subscriber::init();
|
|
159
|
+
|
|
160
|
+
# Build with tokio_unstable:
|
|
161
|
+
RUSTFLAGS="--cfg tokio_unstable" cargo run
|
|
162
|
+
|
|
163
|
+
# In another terminal:
|
|
164
|
+
tokio-console # connects to default port 6669
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Shows live tasks, their state, wake counts, poll durations, parent tasks. The single fastest way to find "why is my async thing stuck".
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## cargo-expand — when a macro is suspect
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
cargo install cargo-expand
|
|
175
|
+
cargo expand # expand all macros in the crate
|
|
176
|
+
cargo expand my::module::path # scope to one item
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
If you suspect a macro (especially `#[derive]`, `#[tokio::main]`, `#[async_trait]`) is generating code that doesn't match your mental model, this shows you exactly what the compiler sees.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Release-build gotcha
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
cargo build --release # no debug symbols by default
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
If the bug only shows up in `--release`:
|
|
190
|
+
|
|
191
|
+
```toml
|
|
192
|
+
# Cargo.toml
|
|
193
|
+
[profile.release]
|
|
194
|
+
debug = true # add symbols, keep optimizations
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Now `rust-gdb ./target/release/my_binary` works on release builds. This is required when optimization-enabled codegen bugs (inlining, LLVM folding) are suspected.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Silent-failure patterns in Rust
|
|
202
|
+
|
|
203
|
+
| Pattern | Why it's silent |
|
|
204
|
+
|---|---|
|
|
205
|
+
| `.unwrap_or_default()` | Masks errors as the zero value |
|
|
206
|
+
| `.unwrap_or(fallback)` | Same, with a specific fallback |
|
|
207
|
+
| `let _ = fallible_operation()` | Explicitly discards the Result, no compiler warning |
|
|
208
|
+
| `if let Ok(x) = ... { use(x); } // no else` | Silent on Err |
|
|
209
|
+
| `.ok()` chaining | Converts Result to Option, throwing the error away |
|
|
210
|
+
| Panic inside a tokio task not `.await`ed | Task dies silently; runtime usually logs but it's quiet if logs are off |
|
|
211
|
+
| `eprintln!` that goes to a redirected-null stderr | Looks like nothing happened |
|
|
212
|
+
| `Drop` impl that panics under specific condition | Double-panic aborts process silently if no logging configured |
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Phase 9 cleanup specifics
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Revert dbg! macro additions
|
|
220
|
+
git diff | grep -E 'dbg!\('
|
|
221
|
+
# For any file with dbg! additions:
|
|
222
|
+
git checkout <file>
|
|
223
|
+
|
|
224
|
+
# Unset env vars
|
|
225
|
+
unset RUST_LOG RUST_BACKTRACE
|
|
226
|
+
|
|
227
|
+
# Kill any rust-gdb/lldb sessions
|
|
228
|
+
pkill -f 'rust-gdb' || true
|
|
229
|
+
pkill -f 'rust-lldb' || true
|
|
230
|
+
pkill -f '^lldb ' || true
|
|
231
|
+
|
|
232
|
+
# tokio-console binds 6669 by default
|
|
233
|
+
lsof -iTCP:6669 -sTCP:LISTEN -nP 2>/dev/null
|
|
234
|
+
```
|