@dsmm/dsmm 0.0.0-stage → 0.1.1

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 (129) hide show
  1. package/LICENSE +103 -0
  2. package/README.md +70 -2
  3. package/agent-presets/dsmm-builder/agent.cordis.yml +210 -0
  4. package/agent-presets/dsmm-builder/preset.yml +3 -0
  5. package/agent-presets/dsmm-clarifier/agent.cordis.yml +34 -0
  6. package/agent-presets/dsmm-clarifier/preset.yml +3 -0
  7. package/agent-presets/dsmm-code-search/agent.cordis.yml +34 -0
  8. package/agent-presets/dsmm-code-search/preset.yml +3 -0
  9. package/agent-presets/dsmm-creative/agent.cordis.yml +31 -0
  10. package/agent-presets/dsmm-creative/preset.yml +3 -0
  11. package/agent-presets/dsmm-doc-search/agent.cordis.yml +34 -0
  12. package/agent-presets/dsmm-doc-search/preset.yml +3 -0
  13. package/agent-presets/dsmm-media-reader/agent.cordis.yml +34 -0
  14. package/agent-presets/dsmm-media-reader/preset.yml +3 -0
  15. package/agent-presets/dsmm-oracle/agent.cordis.yml +31 -0
  16. package/agent-presets/dsmm-oracle/preset.yml +3 -0
  17. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +31 -0
  18. package/agent-presets/dsmm-oracle-2nd/preset.yml +3 -0
  19. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +215 -0
  20. package/agent-presets/dsmm-orchestrator/preset.yml +3 -0
  21. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +33 -0
  22. package/agent-presets/dsmm-plan-critic/preset.yml +3 -0
  23. package/agent-presets/dsmm-planner/agent.cordis.yml +33 -0
  24. package/agent-presets/dsmm-planner/preset.yml +3 -0
  25. package/agent-presets/dsmm-reviewer/agent.cordis.yml +33 -0
  26. package/agent-presets/dsmm-reviewer/preset.yml +3 -0
  27. package/cordis.patch.yml +8 -0
  28. package/docs/agent-presets.md +19 -0
  29. package/docs/compatibility.md +49 -0
  30. package/docs/design.md +237 -0
  31. package/docs/lsp.md +40 -0
  32. package/docs/migration-from-ocmm.md +54 -0
  33. package/docs/model-routing.md +61 -0
  34. package/docs/releasing.md +52 -0
  35. package/docs/research/deepseek-v4-pro.md +74 -0
  36. package/docs/research/oh-dsh.md +96 -0
  37. package/docs/roadmap.md +207 -0
  38. package/docs/runtime-recovery.md +75 -0
  39. package/docs/safety-guards.md +55 -0
  40. package/docs/settings-status.md +55 -0
  41. package/docs/skill-sync.md +20 -0
  42. package/lib/commands.d.ts +13 -0
  43. package/lib/commands.js +55 -0
  44. package/lib/dsh-events.d.ts +21 -0
  45. package/lib/dsh-events.js +2 -0
  46. package/lib/dsh-types.d.ts +312 -0
  47. package/lib/dsh-types.js +2 -0
  48. package/lib/guards.d.ts +10 -0
  49. package/lib/guards.js +252 -0
  50. package/lib/index.d.ts +33 -0
  51. package/lib/index.js +58 -0
  52. package/lib/lsp.d.ts +30 -0
  53. package/lib/lsp.js +154 -0
  54. package/lib/mode.d.ts +6 -0
  55. package/lib/mode.js +62 -0
  56. package/lib/model-family.d.ts +6 -0
  57. package/lib/model-family.js +49 -0
  58. package/lib/model-routing.d.ts +11 -0
  59. package/lib/model-routing.js +128 -0
  60. package/lib/plan-validation.d.ts +3 -0
  61. package/lib/plan-validation.js +119 -0
  62. package/lib/preset-materializer.d.ts +36 -0
  63. package/lib/preset-materializer.js +258 -0
  64. package/lib/preset-registry.d.ts +5 -0
  65. package/lib/preset-registry.js +126 -0
  66. package/lib/preset-skills.d.ts +12 -0
  67. package/lib/preset-skills.js +28 -0
  68. package/lib/prompts.d.ts +13 -0
  69. package/lib/prompts.js +82 -0
  70. package/lib/recovery-policy.d.ts +25 -0
  71. package/lib/recovery-policy.js +252 -0
  72. package/lib/role-providers.d.ts +13 -0
  73. package/lib/role-providers.js +61 -0
  74. package/lib/role-routing.d.ts +15 -0
  75. package/lib/role-routing.js +144 -0
  76. package/lib/role-subagents.d.ts +6 -0
  77. package/lib/role-subagents.js +54 -0
  78. package/lib/roles.d.ts +29 -0
  79. package/lib/roles.js +241 -0
  80. package/lib/runtime-recovery.d.ts +5 -0
  81. package/lib/runtime-recovery.js +168 -0
  82. package/lib/session-scope.d.ts +9 -0
  83. package/lib/session-scope.js +40 -0
  84. package/lib/settings.d.ts +123 -0
  85. package/lib/settings.js +447 -0
  86. package/lib/shell-command.d.ts +18 -0
  87. package/lib/shell-command.js +492 -0
  88. package/lib/skills.d.ts +18 -0
  89. package/lib/skills.js +64 -0
  90. package/lib/state.d.ts +13 -0
  91. package/lib/state.js +64 -0
  92. package/lib/status.d.ts +55 -0
  93. package/lib/status.js +193 -0
  94. package/package.json +129 -4
  95. package/patches/agent-presets-root.example.cordis.patch.yml +14 -0
  96. package/patches/ocmm-lsp-mcp.example.cordis.patch.yml +15 -0
  97. package/prompts/deepseek-flash.md +11 -0
  98. package/prompts/deepseek-v4-pro.md +14 -0
  99. package/prompts/deepwork.md +32 -0
  100. package/skills/brainstorming/SKILL.md +15 -0
  101. package/skills/debugging/SKILL.md +12 -0
  102. package/skills/debugging/references/logging.md +91 -0
  103. package/skills/debugging/references/methodology/00-setup.md +108 -0
  104. package/skills/debugging/references/methodology/02-investigate.md +67 -0
  105. package/skills/debugging/references/methodology/03-flaky-triage.md +69 -0
  106. package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +83 -0
  107. package/skills/debugging/references/methodology/05-escalate.md +69 -0
  108. package/skills/debugging/references/methodology/06-fix.md +123 -0
  109. package/skills/debugging/references/methodology/08-qa.md +94 -0
  110. package/skills/debugging/references/methodology/09-cleanup.md +164 -0
  111. package/skills/debugging/references/methodology/partial-runtime-evidence.md +217 -0
  112. package/skills/debugging/references/runtimes/bundled-js-binary.md +415 -0
  113. package/skills/debugging/references/runtimes/go.md +252 -0
  114. package/skills/debugging/references/runtimes/native-binary.md +484 -0
  115. package/skills/debugging/references/runtimes/node.md +260 -0
  116. package/skills/debugging/references/runtimes/python.md +248 -0
  117. package/skills/debugging/references/runtimes/rust.md +234 -0
  118. package/skills/debugging/references/scripts/dap.mjs +533 -0
  119. package/skills/debugging/references/tools/dap.md +89 -0
  120. package/skills/debugging/references/tools/ghidra.md +212 -0
  121. package/skills/debugging/references/tools/playwright-cli.md +316 -0
  122. package/skills/debugging/references/tools/pwndbg.md +263 -0
  123. package/skills/debugging/references/tools/pwntools.md +265 -0
  124. package/skills/dispatching-parallel-agents/SKILL.md +14 -0
  125. package/skills/receiving-code-review/SKILL.md +13 -0
  126. package/skills/remove-ai-slops/SKILL.md +14 -0
  127. package/skills/requesting-code-review/SKILL.md +10 -0
  128. package/skills/subagent-driven-development/SKILL.md +13 -0
  129. 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
+ ```