@dsmm/dsmm 0.2.0 → 0.3.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.
Files changed (285) hide show
  1. package/README.md +37 -67
  2. package/agent-presets/dsmm-builder/agent.cordis.yml +10 -2015
  3. package/agent-presets/dsmm-clarifier/agent.cordis.yml +24 -343
  4. package/agent-presets/dsmm-code-search/agent.cordis.yml +19 -6
  5. package/agent-presets/dsmm-coding/agent.cordis.yml +19 -438
  6. package/agent-presets/dsmm-complex/agent.cordis.yml +23 -1009
  7. package/agent-presets/dsmm-creative/agent.cordis.yml +25 -442
  8. package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +29 -1013
  9. package/agent-presets/dsmm-deep/agent.cordis.yml +24 -1008
  10. package/agent-presets/dsmm-doc-search/agent.cordis.yml +19 -6
  11. package/agent-presets/dsmm-documenting/agent.cordis.yml +26 -439
  12. package/agent-presets/dsmm-frontend/agent.cordis.yml +21 -440
  13. package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +22 -441
  14. package/agent-presets/dsmm-media-reader/agent.cordis.yml +19 -6
  15. package/agent-presets/dsmm-normal-task/agent.cordis.yml +19 -438
  16. package/agent-presets/dsmm-oracle/agent.cordis.yml +25 -340
  17. package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +25 -340
  18. package/agent-presets/dsmm-orchestrator/agent.cordis.yml +29 -2025
  19. package/agent-presets/dsmm-plan-critic/agent.cordis.yml +24 -341
  20. package/agent-presets/dsmm-planner/agent.cordis.yml +14 -344
  21. package/agent-presets/dsmm-quick/agent.cordis.yml +19 -6
  22. package/agent-presets/dsmm-research/agent.cordis.yml +23 -8
  23. package/agent-presets/dsmm-reviewer/agent.cordis.yml +25 -340
  24. package/cordis.patch.yml +14 -0
  25. package/docs/agent-presets.md +36 -52
  26. package/docs/compatibility.md +47 -110
  27. package/docs/deferred-native-approval-risk.md +19 -0
  28. package/docs/design.md +2 -2
  29. package/docs/lsp.md +11 -21
  30. package/docs/migration-from-ocmm.md +2 -2
  31. package/docs/model-routing.md +84 -59
  32. package/docs/native-permissions.md +35 -0
  33. package/docs/profiles.md +40 -87
  34. package/docs/releasing.md +123 -2
  35. package/docs/roadmap.md +71 -17
  36. package/docs/settings-status.md +34 -169
  37. package/docs/skill-sync.md +52 -15
  38. package/lib/agent-registry.d.ts +36 -0
  39. package/lib/agent-registry.js +75 -0
  40. package/lib/child-admission-contract.d.ts +37 -0
  41. package/lib/child-admission-contract.js +2 -0
  42. package/lib/child-admission.d.ts +40 -0
  43. package/lib/child-admission.js +151 -0
  44. package/lib/child-capture.d.ts +85 -0
  45. package/lib/child-capture.js +205 -0
  46. package/lib/child-evidence.d.ts +17 -0
  47. package/lib/child-evidence.js +43 -0
  48. package/lib/client/ChildrenPanel.d.ts +43 -0
  49. package/lib/client/ChildrenPanel.js +82 -0
  50. package/lib/client/DeploymentPage.js +15 -8
  51. package/lib/client/EditableChoice.d.ts +17 -0
  52. package/lib/client/EditableChoice.js +49 -0
  53. package/lib/client/PermissionsPanel.d.ts +14 -0
  54. package/lib/client/PermissionsPanel.js +46 -0
  55. package/lib/client/ProfilesSection.js +30 -15
  56. package/lib/client/RoleAvailability.d.ts +7 -0
  57. package/lib/client/RoleAvailability.js +19 -0
  58. package/lib/client/SessionProfiles.js +27 -9
  59. package/lib/client/StructuredEditor.js +15 -7
  60. package/lib/client/children-controller.d.ts +98 -0
  61. package/lib/client/children-controller.js +296 -0
  62. package/lib/client/children-locales.d.ts +367 -0
  63. package/lib/client/children-locales.js +69 -0
  64. package/lib/client/controller.d.ts +6 -1
  65. package/lib/client/controller.js +14 -8
  66. package/lib/client/deployment-controller.js +1 -1
  67. package/lib/client/deployment-data.d.ts +2 -1
  68. package/lib/client/deployment-data.js +34 -5
  69. package/lib/client/deployment-locales.d.ts +4 -0
  70. package/lib/client/deployment-locales.js +11 -2
  71. package/lib/client/diagnostics.d.ts +14 -0
  72. package/lib/client/diagnostics.js +53 -0
  73. package/lib/client/index.d.ts +4 -0
  74. package/lib/client/index.js +96 -2
  75. package/lib/client/locales.d.ts +54 -0
  76. package/lib/client/locales.js +34 -16
  77. package/lib/client/permission-client.d.ts +16 -0
  78. package/lib/client/permission-client.js +38 -0
  79. package/lib/client/permission-controller.d.ts +62 -0
  80. package/lib/client/permission-controller.js +149 -0
  81. package/lib/client/permission-locales.d.ts +114 -0
  82. package/lib/client/permission-locales.js +75 -0
  83. package/lib/client/session-labels.js +4 -4
  84. package/lib/client/structured.js +19 -5
  85. package/lib/client/styles.d.ts +1 -1
  86. package/lib/client/styles.js +20 -0
  87. package/lib/client.js +5780 -1679
  88. package/lib/core-permission-authority.d.ts +18 -0
  89. package/lib/core-permission-authority.js +255 -0
  90. package/lib/core-permissions.d.ts +8 -0
  91. package/lib/core-permissions.js +33 -0
  92. package/lib/delivery-authority.d.ts +83 -0
  93. package/lib/delivery-authority.js +397 -0
  94. package/lib/deployment-config.d.ts +23 -0
  95. package/lib/deployment-config.js +61 -40
  96. package/lib/deployment-permission-rules.d.ts +55 -0
  97. package/lib/deployment-permission-rules.js +306 -0
  98. package/lib/dsh-types.d.ts +10 -4
  99. package/lib/guards.d.ts +1 -1
  100. package/lib/guards.js +29 -8
  101. package/lib/host-llm-startup.d.ts +41 -0
  102. package/lib/host-llm-startup.js +65 -0
  103. package/lib/host-llm.d.ts +92 -0
  104. package/lib/host-llm.js +325 -0
  105. package/lib/index.d.ts +15 -4
  106. package/lib/index.js +288 -48
  107. package/lib/live-pi-ai-owner.d.ts +18 -0
  108. package/lib/live-pi-ai-owner.js +144 -0
  109. package/lib/llm-runtime.d.ts +11 -0
  110. package/lib/llm-runtime.js +21 -0
  111. package/lib/managed-settings.d.ts +5 -0
  112. package/lib/managed-settings.js +14 -0
  113. package/lib/model-parameter-policy.d.ts +11 -0
  114. package/lib/model-parameter-policy.js +27 -0
  115. package/lib/model-routing.js +28 -17
  116. package/lib/modules.d.ts +13 -5
  117. package/lib/modules.js +17 -1
  118. package/lib/native-child-evidence.d.ts +40 -0
  119. package/lib/native-child-evidence.js +104 -0
  120. package/lib/native-pi-ai-wire.d.ts +37 -0
  121. package/lib/native-pi-ai-wire.js +261 -0
  122. package/lib/native-scope.js +1 -1
  123. package/lib/permission-bash.d.ts +6 -0
  124. package/lib/permission-bash.js +7 -0
  125. package/lib/permission-control.d.ts +73 -0
  126. package/lib/permission-control.js +205 -0
  127. package/lib/permission-controller.d.ts +68 -0
  128. package/lib/permission-controller.js +317 -0
  129. package/lib/permission-errors.d.ts +7 -0
  130. package/lib/permission-errors.js +21 -0
  131. package/lib/permission-fs-search.d.ts +5 -0
  132. package/lib/permission-fs-search.js +7 -0
  133. package/lib/permission-fs.d.ts +5 -0
  134. package/lib/permission-fs.js +7 -0
  135. package/lib/permission-native-access.d.ts +11 -0
  136. package/lib/permission-native-access.js +6 -0
  137. package/lib/permission-native-command.d.ts +10 -0
  138. package/lib/permission-native-command.js +93 -0
  139. package/lib/permission-native-rules.d.ts +75 -0
  140. package/lib/permission-native-rules.js +278 -0
  141. package/lib/permission-pwsh.d.ts +6 -0
  142. package/lib/permission-pwsh.js +7 -0
  143. package/lib/permission-remote.d.ts +26 -0
  144. package/lib/permission-remote.js +53 -0
  145. package/lib/permission-rpc.d.ts +29 -0
  146. package/lib/permission-rpc.js +152 -0
  147. package/lib/permission-rules.d.ts +115 -0
  148. package/lib/permission-rules.js +256 -0
  149. package/lib/permission-settings.d.ts +45 -0
  150. package/lib/permission-settings.js +48 -0
  151. package/lib/permission-shell.d.ts +38 -0
  152. package/lib/permission-shell.js +150 -0
  153. package/lib/permission-web.d.ts +5 -0
  154. package/lib/permission-web.js +7 -0
  155. package/lib/preset-registry.js +36 -25
  156. package/lib/profile-diagnostics.d.ts +45 -0
  157. package/lib/profile-diagnostics.js +148 -0
  158. package/lib/profile-locale.d.ts +3 -0
  159. package/lib/profile-locale.js +2 -0
  160. package/lib/profile-remote.d.ts +8 -0
  161. package/lib/profile-remote.js +163 -39
  162. package/lib/profile-rpc.d.ts +4 -3
  163. package/lib/profile-rpc.js +20 -16
  164. package/lib/profile-runtime.d.ts +40 -1
  165. package/lib/profile-runtime.js +368 -93
  166. package/lib/profile-store.d.ts +11 -0
  167. package/lib/profile-store.js +143 -11
  168. package/lib/profile-types.d.ts +70 -1
  169. package/lib/profile-types.js +1 -0
  170. package/lib/profiles.d.ts +16 -2
  171. package/lib/profiles.js +156 -79
  172. package/lib/prompt-content.js +1 -1
  173. package/lib/prompts.d.ts +37 -2
  174. package/lib/prompts.js +111 -9
  175. package/lib/recovery-policy.js +20 -7
  176. package/lib/role-control-remote.d.ts +38 -0
  177. package/lib/role-control-remote.js +211 -0
  178. package/lib/role-control-rpc.d.ts +51 -0
  179. package/lib/role-control-rpc.js +381 -0
  180. package/lib/role-control-types.d.ts +92 -0
  181. package/lib/role-control-types.js +8 -0
  182. package/lib/role-invocation.d.ts +47 -0
  183. package/lib/role-invocation.js +135 -0
  184. package/lib/role-llm-runtime.d.ts +17 -0
  185. package/lib/role-llm-runtime.js +62 -0
  186. package/lib/role-llm.d.ts +31 -0
  187. package/lib/role-llm.js +66 -0
  188. package/lib/role-policy.d.ts +46 -8
  189. package/lib/role-policy.js +421 -61
  190. package/lib/role-providers.d.ts +2 -2
  191. package/lib/role-providers.js +27 -72
  192. package/lib/role-routing.d.ts +11 -2
  193. package/lib/role-routing.js +42 -25
  194. package/lib/role-runs.d.ts +138 -0
  195. package/lib/role-runs.js +335 -0
  196. package/lib/role-subagents.d.ts +58 -3
  197. package/lib/role-subagents.js +179 -56
  198. package/lib/roles.d.ts +5 -6
  199. package/lib/roles.js +10 -39
  200. package/lib/route-json.d.ts +19 -0
  201. package/lib/route-json.js +129 -0
  202. package/lib/routing-policy.d.ts +2 -0
  203. package/lib/routing-policy.js +12 -2
  204. package/lib/runtime-integration.d.ts +81 -0
  205. package/lib/runtime-integration.js +702 -0
  206. package/lib/runtime-recovery.js +18 -8
  207. package/lib/session-persistence.d.ts +2 -1
  208. package/lib/session-persistence.js +1 -1
  209. package/lib/session-scope.js +4 -1
  210. package/lib/settings.d.ts +47 -13
  211. package/lib/settings.js +217 -82
  212. package/lib/skills.js +2 -2
  213. package/lib/status.d.ts +10 -1
  214. package/lib/status.js +11 -8
  215. package/lib/subagent-runtime.d.ts +57 -0
  216. package/lib/subagent-runtime.js +257 -0
  217. package/package.json +149 -89
  218. package/patches/subagent-runtime.yml +15 -0
  219. package/prompts/deepseek-flash.md +1 -1
  220. package/prompts/deepseek-v4-pro.md +2 -2
  221. package/prompts/deepwork.md +27 -18
  222. package/prompts/source/agents/clarifier.md +5 -3
  223. package/prompts/source/agents/orchestrator.md +18 -9
  224. package/prompts/source/agents/plan-critic.md +5 -1
  225. package/prompts/source/agents/planner.md +4 -2
  226. package/prompts/source/agents/reviewer.md +6 -0
  227. package/prompts/source/category/complex.md +4 -4
  228. package/prompts/source/category/creative.md +6 -4
  229. package/prompts/source/category/cross-cutting.md +10 -8
  230. package/prompts/source/category/deep.md +5 -3
  231. package/prompts/source/category/documenting.md +7 -1
  232. package/prompts/source/category/frontend.md +2 -2
  233. package/prompts/source/category/hard-reasoning.md +3 -3
  234. package/prompts/source/category/research.md +4 -2
  235. package/prompts/source/deepwork/claude-opus-5.md +2 -2
  236. package/prompts/source/deepwork/codex.md +1 -1
  237. package/prompts/source/deepwork/default.md +22 -15
  238. package/prompts/source/deepwork/gemini.md +23 -16
  239. package/prompts/source/deepwork/glm.md +21 -14
  240. package/prompts/source/deepwork/gpt.md +12 -6
  241. package/prompts/source/deepwork/planner.md +8 -5
  242. package/prompts/source/manifest.json +178 -63
  243. package/prompts/source/shared/dsh-host-contract.md +5 -3
  244. package/prompts/source/shared/locale.md +2 -2
  245. package/prompts/source/terminal/orchestrator.md +1 -1
  246. package/skills/ast-grep/SKILL.md +7 -4
  247. package/skills/brainstorming/SKILL.md +43 -22
  248. package/skills/coding-agent-sessions/SKILL.md +7 -4
  249. package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -46
  250. package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -130
  251. package/skills/debugging/SKILL.md +14 -9
  252. package/skills/debugging/references/methodology/00-setup.md +14 -62
  253. package/skills/debugging/references/methodology/02-investigate.md +4 -4
  254. package/skills/debugging/references/methodology/03-flaky-triage.md +3 -3
  255. package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +2 -14
  256. package/skills/debugging/references/methodology/06-fix.md +6 -6
  257. package/skills/debugging/references/methodology/08-qa.md +5 -5
  258. package/skills/debugging/references/methodology/09-cleanup.md +15 -153
  259. package/skills/debugging/references/methodology/partial-runtime-evidence.md +3 -16
  260. package/skills/debugging/references/runtimes/bundled-js-binary.md +1 -16
  261. package/skills/debugging/references/runtimes/native-binary.md +9 -54
  262. package/skills/debugging/references/runtimes/node.md +4 -15
  263. package/skills/debugging/references/runtimes/python.md +3 -15
  264. package/skills/debugging/references/runtimes/rust.md +2 -18
  265. package/skills/debugging/references/tools/dap.md +1 -1
  266. package/skills/debugging/references/tools/ghidra.md +4 -15
  267. package/skills/debugging/references/tools/playwright-cli.md +3 -15
  268. package/skills/debugging/references/tools/pwntools.md +4 -16
  269. package/skills/dispatching-parallel-agents/SKILL.md +18 -16
  270. package/skills/frontend/SKILL.md +7 -4
  271. package/skills/frontend/references/design/react-dev-tooling-skill.md +1 -1
  272. package/skills/git-master/SKILL.md +7 -4
  273. package/skills/init-deep/SKILL.md +7 -4
  274. package/skills/receiving-code-review/SKILL.md +17 -12
  275. package/skills/remove-ai-slops/SKILL.md +39 -38
  276. package/skills/requesting-code-review/SKILL.md +19 -17
  277. package/skills/requesting-code-review/code-reviewer.md +13 -1
  278. package/skills/subagent-driven-development/SKILL.md +29 -26
  279. package/skills/subagent-driven-development/implementer-prompt.md +29 -11
  280. package/skills/subagent-driven-development/spec-reviewer-prompt.md +6 -1
  281. package/skills/using-git-worktrees/SKILL.md +7 -4
  282. package/skills/writing-plans/SKILL.md +29 -24
  283. package/skills/writing-plans/plan-document-reviewer-prompt.md +10 -1
  284. package/scripts/repair-session-log.mjs +0 -476
  285. package/scripts/session-repair-native-verifier.mjs +0 -367
@@ -1,8 +1,8 @@
1
1
  > DSH adapter boundary: resolve this resource from the loaded skill's directory resourceBase. Examples are not authority: installation/download/login, private state, Git writes and destructive operations need exact explicit authorization. Use only tools and native roles actually exposed in the current catalog and allowed by the caller; otherwise use a real direct fallback or report the limitation. Translate shell examples to the active runtime.
2
2
 
3
- # Phase 0 + 1 — Environment Assessment & Journal Setup
3
+ # Phase 0 + 1: Environment Assessment and Resource Ownership
4
4
 
5
- Before a debugger touches anything, you need a map of what's running and a ledger of what you'll touch. Skipping either phase is how debug sessions turn into "why is my repo dirty a week later" sessions.
5
+ Before attaching, identify what's running and which resources this task will own. Keep current investigation evidence in conversation or task-owned temporary storage, not product process documents.
6
6
 
7
7
  ---
8
8
 
@@ -43,68 +43,20 @@ If any answer is "I'm not sure", you are not ready for Phase 1. Investigate unti
43
43
 
44
44
  ---
45
45
 
46
- ## Phase 1 — Journal Setup
46
+ ## Phase 1: Temporary Resource Ownership
47
47
 
48
- Open **one** journal file at the project root: `.debug-journal.md`. Single source of truth for every artifact this skill creates. The contract with the user that you can undo everything.
48
+ If file-backed debug material is needed, use a unique task-owned directory under the approved OS temporary root and verify its parent before creation. Session-only investigation needs no directory or checklist file. Don't read, modify, delete, or adopt any existing `.debug-journal.md`, and don't change `.git/info/exclude`. No repository hypothesis or experiment journal is required or permitted.
49
49
 
50
- ### Exclude from git (don't pollute the committed ignore list)
50
+ Before creating each artifact or changing temporary state, capture only what's needed for safe cleanup:
51
51
 
52
- ```bash
53
- grep -qx '.debug-journal.md' .git/info/exclude || echo '.debug-journal.md' >> .git/info/exclude
54
- ```
52
+ | Resource | Ownership and restoration information |
53
+ | --- | --- |
54
+ | Temporary file or directory | Exact path, task ownership, and exact cleanup target |
55
+ | Source instrumentation | Initial relevant hunk and task-owned patch to remove it without discarding other edits |
56
+ | Process or debugger session | PID plus start identity, owned session/context, and targeted shutdown action |
57
+ | Environment or configuration override | Scope and previous value/state to restore |
58
+ | Fixture, port, proxy, or browser profile | Unique identity, ownership check, and safe release action |
55
59
 
56
- `.git/info/exclude` is per-clone and not committed — perfect for local-session artifacts.
60
+ Keep this ownership checklist and short-lived hypothesis/evidence state in the agent session; temporary storage is optional when resumption needs it. Synchronize useful findings at delivery or major phase boundaries, not every checklist update. Temporary or disposable artifacts need no repeated stability/hash checks or correct status record at every instant. Store raw reproduction evidence temporarily only as needed; durable tests and docs describe final valid requirements and the current mechanism only. Exact cleanup identities and restoration data must remain available until cleanup succeeds.
57
61
 
58
- ### Journal template
59
-
60
- ```markdown
61
- # Debug Journal — <short bug name>
62
- Started: <ISO timestamp>
63
- Goal: <one-sentence user request>
64
-
65
- ## Environment snapshot (Phase 0)
66
- - Runtime: <language + version + launcher>
67
- - Entry: <command that starts the process>
68
- - Ports / sockets: <app=..., debugger=..., etc>
69
- - Git HEAD: <sha>, working tree clean? <yes/no>
70
- - References read: <list the files from references/ you loaded — proves you did the gate>
71
-
72
- ## Hypotheses
73
- 1. [STATUS] <hypothesis> — distinguishing evidence: <what would confirm/refute> — if true, fix is: <two words>
74
- 2. ...
75
-
76
- ## Failed hypothesis round counter
77
- - Round 1: <result>
78
- - Round 2: <result>
79
- <!-- At 2 consecutive evidence-backed failures, the task qualifies for one hard-reasoning escalation (see 04-hard-reasoning-escalation.md). -->
80
-
81
- ## Artifacts to revert
82
- <!-- Every temp edit, tmux session, fixture, env override, saved debugger session goes here
83
- BEFORE it is created. The rule is journal-then-modify. -->
84
- - [ ] `src/foo.py` — added `breakpoint()` on 2 lines. Revert: `git checkout src/foo.py`
85
- - [ ] tmux session `debug-server`. Kill: `tmux kill-session -t debug-server`
86
- - [ ] `/tmp/debug-payload.json`. Remove: `rm /tmp/debug-payload.json`
87
- - [ ] env var in current shell: `FOO_BASE_URL=...`. Unset when done.
88
- - [ ] GDB session save: `~/ghidra-projects/scratch.gzf`. Remove if not promoting.
89
-
90
- ## Findings
91
- <!-- Append observed values here with timestamp. Verbatim only, no paraphrasing. -->
92
-
93
- ## Hard-Reasoning Escalation (if invoked)
94
- <!-- Record why the difficulty threshold was met and the resulting hypothesis set. -->
95
-
96
- ## Final fix
97
- <!-- File paths + test path. Filled during Phase 7. -->
98
- ```
99
-
100
- ### The journal-then-modify rule
101
-
102
- Before any modification to the repo, shell, or system state, append to "Artifacts to revert" first. This one discipline is what prevents debug sessions from becoming git cleanup sessions.
103
-
104
- If you catch yourself about to run a command that creates a file, opens a port, or modifies source — stop, journal the intended artifact with its revert command, then run the command. Not the other way around.
105
-
106
- ### Why a single journal (not scattered TODO comments)
107
-
108
- - One `git checkout`, one `rm`, one `tmux kill-session` list — simple Phase 9 walk.
109
- - Survives interruptions. If you get pulled away mid-session, the next agent (or you later) can continue or revert without guessing.
110
- - Prevents the most common failure: leaving `console.log`/`print()`/`dbg!` scattered across the tree.
62
+ Inspect the initial working-tree state so cleanup can distinguish this task's edits from existing user work. Resource ownership doesn't confer permission to kill another process, alter system configuration, or discard a file. Escalate when safe restoration or required authorization is uncertain.
@@ -27,7 +27,7 @@ If your three hypotheses are all variations of "the handler has a bug", you don'
27
27
  | **Binary-level** (when applicable) | "The function we think is running is actually jumped over by a patched thunk / a different version loaded" |
28
28
  | **Build-vs-runtime** | "The code we're reading is not the code that's running — stale build, wrong symlink, cached wheel, or dist/ ahead of src/" |
29
29
 
30
- ### For each hypothesis, write in the journal
30
+ ### Keep the active hypothesis set in conversation or disposable investigation state
31
31
 
32
32
  1. **Claim** — one sentence.
33
33
  2. **Distinguishing evidence** — the exact value or state that confirms or refutes it, AND where to read it (file:line, log source, breakpoint location, memory address).
@@ -43,13 +43,13 @@ If two hypotheses have identical distinguishing evidence, they aren't actually d
43
43
 
44
44
  Use independent direct probes first. If the current role policy and actual DSH catalog permit delegation, assign distinct bounded evidence to available roles; otherwise investigate sequentially. DSH does not provide the OpenCode team registry or debug-squad configuration. Do not write host-private team configuration or invent task calls.
45
45
 
46
- Retain the source responsibilities: inspect observed runtime state; correlate logs/timing; minimize a reproducible input; cross-link observations into a causal chain and identify the next falsifying query. Read-only lookup roles may inspect evidence but cannot create instrumentation/reproduction files by proxy. The lead journals artifacts before creation, approves authorized edits, integrates evidence, and owns cancellation/cleanup via actual host controls. Reviewer/Oracle remain implementation-acceptance roles, not debugging consultants. After two failed evidence rounds, return a genuinely difficult decision to the stage owner for optional hard-reasoning, subject to the caller's permitted targets.
46
+ Retain the source responsibilities: inspect observed runtime state; correlate logs/timing; minimize a reproducible input; cross-link observations into a causal chain and identify the next falsifying query. Read-only lookup roles may inspect evidence but cannot create instrumentation/reproduction files by proxy. The lead keeps exact task-owned resource/cleanup identities in session or disposable investigation state before creation, approves authorized edits, integrates evidence, and owns cancellation/cleanup via actual host controls; no repository journal or per-file ledger is created. Reviewer/Oracle remain implementation-acceptance roles, not debugging consultants. After two failed evidence rounds, return a genuinely difficult decision to the stage owner for optional hard-reasoning, subject to the caller's permitted targets.
47
47
 
48
48
  ---
49
49
 
50
50
  ## Evidence capture discipline (both paths)
51
51
 
52
- For every piece of runtime state captured, record in the journal:
52
+ For relevant runtime state, capture evidence in conversation or task-owned temporary storage, not a repository journal:
53
53
 
54
54
  ```markdown
55
55
  ### <ISO timestamp> — <what you looked at>
@@ -70,4 +70,4 @@ If you find yourself about to paraphrase, stop, go back, and copy the raw value.
70
70
 
71
71
  ## Round completion
72
72
 
73
- A "round" is complete when every hypothesis has either confirming or refuting evidence — or when you have exhausted the evidence sources available without a decisive result. If the round ends inconclusively, that counts as a failed round for the counter in the journal. See `04-hard-reasoning-escalation.md` for what to do at 2 consecutive failed rounds.
73
+ A "round" is complete when every hypothesis has confirming or refuting evidence, or available evidence sources are exhausted without a decisive result. An inconclusive round increments the current failed-round count in disposable investigation state. Don't retain a round history in product artifacts. See `04-hard-reasoning-escalation.md` for the two-consecutive-failure threshold.
@@ -7,7 +7,7 @@ Use this reference when a test is intermittent, passes in isolation, changes its
7
7
  ## Safety boundary
8
8
 
9
9
  - Start with an unchanged rerun. Do not install tools, terminate another user's process, overwrite user configuration, or use a shared temp root.
10
- - Journal every command, run-owned artifact, and cleanup action. Clean only artifacts that this run owns.
10
+ - Capture relevant run evidence temporarily; list exact run-owned artifacts and cleanup actions in the temporary resource checklist. Clean only resources this run owns.
11
11
  - Retry wrappers, arbitrary sleeps, quarantine, deletion, and assertion weakening are not fixes. They hide evidence and must not be used to claim resolution.
12
12
  - Keep test commands and environment changes scoped to the affected test or suite. Do not turn a flaky-test investigation into a full-suite mutation.
13
13
 
@@ -57,7 +57,7 @@ pnpm test -- --test-name-pattern "affected test"
57
57
  Get-NetTCPConnection -LocalPort 3000
58
58
  ```
59
59
 
60
- Do not install a port inspector and never kill a port owner. If a listener is relevant, record it and namespace the port for the run instead. Journal cleanup and remove only the unique root created by the current investigation.
60
+ Do not install a port inspector and never kill a port owner. If a listener is relevant, capture its identity and namespace the port for the run instead. Use the temporary resource checklist and remove only the unique root created by the current investigation.
61
61
 
62
62
  ## Cause-oriented repair
63
63
 
@@ -68,4 +68,4 @@ Do not install a port inspector and never kill a port owner. If a listener is re
68
68
 
69
69
  After two failed evidence rounds, the local workflow permits one `hard-reasoning` escalation only when the root cause is genuinely difficult. Reviewer and Oracle profiles are not debugging agents and must not be used for this triage.
70
70
 
71
- If the evidence remains unresolved, return a classification receipt: the three-run signature, observed shared-state checks, remaining hypotheses, controlled toggles attempted, run-owned artifacts cleaned, and the explicit statement that no fix is claimed.
71
+ If the evidence remains unresolved, report the current classification, decisive shared-state evidence, remaining evidence gaps, owned-resource cleanup, and the explicit statement that no fix is claimed. Don't require a receipt or experiment history.
@@ -58,19 +58,7 @@ Treat the response as hypotheses, not proof. Pull the ranked candidates and fals
58
58
 
59
59
  Minimum 3, same rules as Phase 2. Aim to have hypotheses drawn from the agreement scan (likely cause) AND from the disagreement scan (so one round's evidence resolves the disagreement).
60
60
 
61
- Record in the journal:
62
-
63
- ```markdown
64
- ## Hard-Reasoning Escalation — Round <N>
65
- - Invoked at: <ISO timestamp>
66
- - Reason escalation was permitted: <two failed evidence rounds or equivalent strict difficulty evidence>
67
- - Ranked candidates: <one line each>
68
- - Decisive runtime queries: <one line each>
69
-
70
- ### New hypothesis set
71
- 1. <hypothesis> — evidence to gather: <one-liner>
72
- 2. ...
73
- ```
61
+ Keep the currently permitted escalation, next hypothesis set, decisive queries, and evidence gaps in conversation or disposable investigation state. Don't create a repository escalation or hypothesis history.
74
62
 
75
63
  ### Reset the counter
76
64
 
@@ -82,4 +70,4 @@ Reset the "consecutive failed rounds" counter to 0. Return to Phase 3 (parallel
82
70
 
83
71
  You are genuinely stuck. This is the escalation threshold.
84
72
 
85
- Escalate to the user (see `05-escalate.md`) with the full trace: every hypothesis tried, every piece of evidence captured, and the hard-reasoning reframing. Do not guess a fix.
73
+ Escalate to the user (see `05-escalate.md`) with the unresolved question, decisive observed evidence, current constraints, and missing authorization or evidence. Don't guess a fix or require a full investigation transcript.
@@ -35,7 +35,7 @@ Examples of a valid toggle proof:
35
35
 
36
36
  If you can't construct a toggle proof, you haven't confirmed the cause. Run one more round.
37
37
 
38
- ### Update the journal
38
+ ### Capture current mechanism and proof in temporary evidence
39
39
 
40
40
  ```markdown
41
41
  ## Root cause (confirmed <ISO timestamp>)
@@ -61,7 +61,7 @@ Capture a case that fails *specifically because of this bug*. Where the reposito
61
61
  - **Failure output clearly shows what the bug looks like.** If someone reads only the failure output, they understand what's broken.
62
62
  - **Minimum infrastructure.** Don't spin up the whole server if a smaller reproducible run captures the mechanism.
63
63
 
64
- Run the test or scenario. Confirm it fails before the fix. Paste the failure output into the journal:
64
+ Run the test or scenario. Confirm it fails before the fix. Capture the failure output in conversation or task-owned temporary evidence:
65
65
 
66
66
  ```markdown
67
67
  ### Red phase (<ISO timestamp>)
@@ -92,7 +92,7 @@ Resist all of these. Fix the bug. Note the surrounding issues for follow-up. Mov
92
92
 
93
93
  Only cleanup directly related to the fix. Do not re-architect.
94
94
 
95
- If the code around the fix is rough, note it in the journal as a follow-up for the user; do not expand scope here. Refactoring during a bugfix is how one-line fixes turn into hundred-line diffs nobody can review.
95
+ If the code around the fix has an unresolved concern, report its current impact to the user; don't expand scope or create a repository follow-up journal.
96
96
 
97
97
  ### 4. Regression — full suite green
98
98
 
@@ -104,9 +104,9 @@ If they don't, your "fix" broke something else. Back to Phase 6 with the new fai
104
104
 
105
105
  If diagnosis burned extra rounds *because state was invisible* — no log line told you which branch ran, what the value was, whether the fallback engaged — that invisibility is a defect adjacent to the bug, and this is the one moment where adding a log line is NOT "just in case": this session is the evidence that the line earns its place. Ship the fix WITH that line, written to the standard of `references/logging.md` — level chosen by consumer, placed at the decision point, data in fields not interpolation, through the project's designated logger. If the project deliberately does not log, respect that and skip this step.
106
106
 
107
- This does not soften the artifact rule: every temporary `print` / `dbg!` / `console.log` planted *during* diagnosis stays journaled and gets scrubbed in Phase 9. The triage is the consumer test — a line whose ongoing consumer you can name is part of the fix; a line that only served today's session is an artifact.
107
+ Every temporary `print` / `dbg!` / `console.log` added during diagnosis belongs in the task-owned resource checklist and is removed in Phase 9. A line with a current ongoing consumer may be part of the authorized fix; a line used only for diagnosis is temporary instrumentation.
108
108
 
109
- ### Update the journal
109
+ ### Capture current verification evidence
110
110
 
111
111
  ```markdown
112
112
  ### Green phase (<ISO timestamp>)
@@ -122,4 +122,4 @@ Full suite: <N tests, <M failures — should be 0> (or <none exists>)
122
122
 
123
123
  No captured failure → no proof the fix addresses the reported bug. Only proof it doesn't break tests that already existed. Keep the reproduction as a test where the repository keeps tests for this behavior; otherwise the captured before/after run is the proof.
124
124
 
125
- Where tests are kept, a test written *after* the fix might still pass with the fix reverted. If that's the case, the test doesn't lock the bug — it locks something else. Always verify the same case fails without the fix and passes with it, whether test or captured run. The journal should show both outputs.
125
+ Where tests are kept, verify that the same valid regression case fails without the fix and passes with it. Keep before/after outputs in task-owned temporary evidence or conversation, not a repository journal. Tests protect final valid functionality and external interfaces, not descriptive wording, decision counterexamples, or removed-component absence. Update tests for changed requirements and delete tests dedicated to removed components; committed contracts and authorization remain binding.
@@ -14,7 +14,7 @@ Pick the row that matches the product. Do what it says. Do not substitute.
14
14
 
15
15
  | Product type | QA means… |
16
16
  |---|---|
17
- | **CLI tool** | Open `tmux`, run the actual command end-to-end, capture output. Paste the session transcript into the journal. Include exit code, stdout, stderr, side-effect check (files created/modified). |
17
+ | **CLI tool** | Run the actual command end-to-end with available tools. Capture relevant output, exit code, and side-effect checks in task-owned temporary evidence or conversation. |
18
18
  | **HTTP API** | Start the real server, hit endpoints with `curl` or `httpie`, inspect response status + body + headers. Hit the specific endpoint that reproduced the bug. If there's auth, use real auth. |
19
19
  | **Browser-served web app** | **Drive a real browser via Playwright CLI.** See [tools/playwright-cli.md](../tools/playwright-cli.md). Navigate the exact page/flow that reproduced the bug. Capture screenshot + DOM + network evidence. **Do not substitute with curl** — browsers have state (cookies, localStorage, service workers, client-side JS, viewport-dependent CSS) that curl does not have. |
20
20
  | **Agent / LLM pipeline** | Run the same user prompt that originally failed. Capture the full turn — tool calls, messages, usage counters. **Confirm non-zero usage** (zero usage = still failing silently, see silent-failure check below). |
@@ -26,9 +26,9 @@ Pick the row that matches the product. Do what it says. Do not substitute.
26
26
 
27
27
  ---
28
28
 
29
- ## Journal format
29
+ ## Current QA evidence
30
30
 
31
- Every QA run goes in the journal under "Findings":
31
+ Capture relevant QA evidence in conversation or task-owned temporary storage, not a repository run history:
32
32
 
33
33
  ```markdown
34
34
  ### Manual QA — <product type> (<ISO timestamp>)
@@ -79,7 +79,7 @@ Check the runtime reference for additional patterns:
79
79
 
80
80
  Don't fix it. This is out of scope for the current bug.
81
81
 
82
- Note it in the journal under a "Follow-ups" section with:
82
+ Report the current unresolved concern with:
83
83
  - File:line
84
84
  - Pattern matched
85
85
  - Proposed fix sketch (one line)
@@ -93,4 +93,4 @@ Surface these to the user in the final message under "Next steps I didn't take".
93
93
 
94
94
  "Fix verified" means: the exact original failing scenario, re-run, now produces the correct output. Not a similar scenario. Not a unit test of the fix. The original scenario.
95
95
 
96
- If you can't re-run the original scenario (e.g. it required a specific data state that's gone), construct the closest equivalent and document the difference in the journal. Escalate to the user if the equivalent is materially different.
96
+ If you can't rerun the original scenario, state the current verification limitation and the evidence from the closest valid equivalent. Escalate if the equivalent is materially different. Don't create a repository QA journal.
@@ -1,166 +1,28 @@
1
1
  > DSH adapter boundary: resolve this resource from the loaded skill's directory resourceBase. Examples are not authority: installation/download/login, private state, Git writes and destructive operations need exact explicit authorization. Use only tools and native roles actually exposed in the current catalog and allowed by the caller; otherwise use a real direct fallback or report the limitation. Translate shell examples to the active runtime.
2
2
 
3
- # Phase 9 + 10 — Cleanup & Final Verification
3
+ # Phase 9 + 10: Cleanup and Final Verification
4
4
 
5
- The working tree after the session must differ from before only by the real fix and any retained reproduction evidence. Anything else is a process failure.
5
+ The working tree must retain its initial user changes plus only the authorized fix and valid regression evidence. Cleanup doesn't authorize Git writes or changes to other tasks' files.
6
6
 
7
- ---
7
+ ## Phase 9: Clean Task-Owned Resources
8
8
 
9
- ## Phase 9 — Cleanup & Revert
9
+ Use the session-level or optional temporary resource ownership checklist from Phase 1 to clean only owned resources. Check cleanup success, but don't write completed status before deleting a disposable checklist or resource journal. No per-update persistence, repeated stability/hash check, repository debug journal, or extra ledger is needed. Never read, edit, adopt, or delete an existing `.debug-journal.md` or modify `.git/info/exclude`.
10
10
 
11
- ### The walk
11
+ Remove temporary source instrumentation with a patch limited to this task's exact hunks. Don't restore a whole file from Git: that could discard user edits or the real fix. Close only owned debugger/browser contexts and task-owned sessions. Terminate a process only after verifying its recorded PID and start identity; don't use broad process-name kills. Restore environment overrides to their captured prior state, rather than blindly unsetting them.
12
12
 
13
- Open the journal's "Artifacts to revert" list. Walk it top to bottom. Check each box only after the revert command succeeds and produces no error.
13
+ Delete only exact paths created by this task, after resolving and checking each target and its ownership. Don't use wildcard cleanup for fixtures, core dumps, libraries, browser reports, or scratch projects. Browser cleanup also follows its profile-marker and process-identity checks. Existing files, processes, configuration, and other tasks' resources aren't cleanup targets.
14
14
 
15
- ### Standard revert operations
15
+ Inspect `git status --short`, the relevant diff, and new files against the initial working-tree state. Check this task's edits for leftover debug statements, temporary logs, commented-out trial code, and unrelated formatting. Report existing unrelated changes without cleaning them.
16
16
 
17
- Most sessions create some combination of these artifacts. The commands below are the defaults — your journal should have the exact commands for this session.
17
+ Once owned resources are clean, remove any task-owned temporary checklist and raw debug material no longer needed, without a final status-write ceremony. Retained product tests must protect final valid functional or external-interface requirements, not decision counterexamples, descriptive-text locks, or the absence of removed components.
18
18
 
19
- ```bash
20
- # --- Temporary source edits (instrumentation statements, debug prints) ---
21
- git checkout <file> # reverts only that file
22
- git diff <file> # verify clean
19
+ ## Phase 10: Final Verification
23
20
 
24
- # --- tmux sessions ---
25
- tmux kill-session -t <session-name>
26
- tmux ls # confirm gone
21
+ Report evidence for each required claim:
27
22
 
28
- # --- Temp fixtures / scratch scripts ---
29
- rm -f /tmp/debug-*.*
30
- ls /tmp/debug-*.* 2>/dev/null # confirm gone (ls returns non-zero when no match)
23
+ 1. **Reproduction:** The captured failing case before the fix and the same case passing after it, with command/scenario and relevant observed output.
24
+ 2. **Regression:** Results of the affected package's required tests, or the explicit absence of a suite or inability to run it.
25
+ 3. **Real-surface QA:** The original scenario's correct observed result. State any inaccessible or authentication-gated coverage honestly.
26
+ 4. **Ownership cleanup:** Confirmation that task-owned artifacts were removed and initial unrelated work remains untouched.
31
27
 
32
- # --- Background processes (debugger-attached runtimes) ---
33
- pkill -f 'node --inspect' || true
34
- pkill -f 'python -m pdb' || true
35
- pkill -f 'debugpy' || true
36
- pkill -f 'dlv' || true
37
- pkill -f 'gdb' || true
38
- pkill -f 'lldb' || true
39
-
40
- # --- Debug-relevant ports confirmed free ---
41
- lsof -iTCP:9229 -sTCP:LISTEN -nP 2>/dev/null # Node inspector default
42
- lsof -iTCP:5678 -sTCP:LISTEN -nP 2>/dev/null # debugpy default
43
- lsof -iTCP:2345 -sTCP:LISTEN -nP 2>/dev/null # dlv default
44
- lsof -iTCP:9999 -sTCP:LISTEN -nP 2>/dev/null # pwndbg/gdb-server default
45
-
46
- # --- Env var overrides in current shell ---
47
- unset DEBUG_OVERRIDE_FOO
48
- unset PYTHONBREAKPOINT
49
- unset RUST_LOG
50
- unset DEBUG
51
-
52
- # --- Ghidra scratch projects (if created just for this session) ---
53
- # rm -rf ~/ghidra-projects/debug-scratch
54
-
55
- # --- Core dumps from debugging (if any) ---
56
- rm -f ./core ./core.* ~/core.*
57
-
58
- # --- Playwright trace files ---
59
- rm -rf playwright-report/ test-results/
60
- ```
61
-
62
- ### The verify command
63
-
64
- This is the single most important check of the whole skill:
65
-
66
- ```bash
67
- git status
68
- git diff --stat
69
- ```
70
-
71
- The diff must contain **only**:
72
-
73
- 1. The real fix.
74
- 2. Any retained regression test or reproduction evidence, if tracked.
75
- 3. Nothing else.
76
-
77
- ### Detector checklist — scan the diff for these
78
-
79
- If `git status` shows any untracked debug file, or `git diff` shows any of the patterns below, **you are not done**. Clean it.
80
-
81
- | Pattern | Usually means |
82
- |---|---|
83
- | `debugger;` | Node debug statement left behind |
84
- | `breakpoint()` | Python debug statement left behind |
85
- | `dbg!(...)` | Rust debug macro left behind |
86
- | `fmt.Println("DEBUG: ...")` | Go ad-hoc print |
87
- | `console.log("[DEBUG]` | Node ad-hoc log |
88
- | `print(f"DEBUG: ` | Python ad-hoc print |
89
- | `// TODO DEBUG`, `// HACK`, `// XXX` | Stale debug marker |
90
- | `// <PROJECT>-DEBUG` | Session-specific marker from this skill's edits |
91
- | Commented-out code blocks near the fix | Dead code from trial fixes |
92
- | Reordered imports or formatting in unrelated files | Drift from your editor's autoformat during the session |
93
-
94
- ### Remove the journal
95
-
96
- Only once the git check is clean:
97
-
98
- ```bash
99
- rm .debug-journal.md
100
- sed -i.bak '/^\.debug-journal\.md$/d' .git/info/exclude && rm -f .git/info/exclude.bak
101
- ```
102
-
103
- The journal is not part of the fix; it doesn't belong in the commit or in the git exclude list.
104
-
105
- ---
106
-
107
- ## Phase 10 — Final Verification
108
-
109
- Last gate before reporting done. All four gates must be true, and all four must have **evidence in your final message** to the user. Passing a gate without evidence is the same as failing it.
110
-
111
- ### The four gates
112
-
113
- 1. **Red→green reproduction confirmed** — show the failing case's output from before the fix and the same case's passing output after. Both outputs visible in the reply (and journaled during work).
114
-
115
- 2. **Existing test suite green** — show the suite's final pass line when one exists (e.g. `42 passed in 3.14s`); otherwise state that no suite exists. Not just the targeted test, if any.
116
-
117
- 3. **Manual QA reproduced the fix** — show the command or scenario that originally failed and its now-correct output. Verbatim, not paraphrased.
118
-
119
- 4. **Working tree clean of debug artifacts** — show `git diff --stat` output containing only the fix and any retained reproduction evidence, plus `git status` clean of untracked debug files.
120
-
121
- If any of the four lacks evidence, you have not finished — return to the appropriate phase.
122
-
123
- ### Final message template
124
-
125
- Keep it short. Evidence-dense. The user should be able to skim it in 30 seconds.
126
-
127
- ```markdown
128
- Fixed.
129
-
130
- **Root cause**: <one sentence — the mechanism, not the symptom>
131
- **Fix**: `<file:line>` — <two words>
132
- **Reproduction**: `<test file>::<test name>` or <scenario> — failure before fix, same case passing after
133
- **QA**: <one line describing what you ran and what you saw>
134
-
135
- Diff:
136
- ```
137
- <git diff --stat output — should be tiny>
138
- ```
139
-
140
- **Next steps I didn't take** (awaiting your decision):
141
- - <follow-up 1, if any — from QA silent-failure scan or refactor opportunities noted during Phase 7>
142
- - <follow-up 2 — or "none" if nothing else surfaced>
143
- ```
144
-
145
- ### Example (from a real session)
146
-
147
- ```markdown
148
- Fixed.
149
-
150
- **Root cause**: pi-mono Agent's `model.baseUrl` was hardcoded to `api.anthropic.com`, so the `ANTHROPIC_BASE_URL` env var was silently ignored. The proxy API key was rejected by the real Anthropic API with 401, but pi-mono packaged the error into the assistant message's `errorMessage` field instead of throwing, so the route's try/catch never fired and the client received HTTP 200 with empty content.
151
-
152
- **Fix**: `core/pi-bridge/modelResolver.ts:117` — override baseUrl
153
- **Test**: `__tests__/core/modelResolver.test.ts::resolves_env_override` — red without fix, green with fix
154
- **QA**: `curl -X POST /api/refinement/chat` with proxy env set, observed non-zero usage and non-empty content
155
-
156
- Diff:
157
- ```
158
- core/pi-bridge/modelResolver.ts | 3 +++
159
- __tests__/core/modelResolver.test.ts | 42 ++++++++++++++++++++++
160
- 2 files changed, 45 insertions(+)
161
- ```
162
-
163
- **Next steps I didn't take** (awaiting your decision):
164
- - pi-mono itself silently swallows LLM errors into `errorMessage`; adding a throw-on-error wrapper at our orchestrator layer would surface these upstream
165
- - Same silent-failure pattern exists in the planning route — likely the same fix applies
166
- ```
28
+ Don't claim completion when a required check is missing or a substantive risk remains unresolved. Keep the final report concise: current root-cause mechanism, fix location, verification results, and remaining risks or unverified items. Don't append a hypothesis, trial, or decision history to product docs or the final report.
@@ -99,7 +99,7 @@ If the operation succeeded earlier (before quota ran out, before access was revo
99
99
 
100
100
  ### Tier 6 — Pure code reading with independent research verification
101
101
 
102
- If literally none of the above is available, read the code carefully and use one bounded `research` pass to verify cited claims against the available source. This is the weakest tier and you must explicitly mark conclusions as "unverified" in the journal.
102
+ If none of the above is available, read the code carefully and use one bounded `research` pass to verify cited claims against the available source. This is the weakest tier: explicitly mark the claim as unverified in the deliverable, without creating a repository journal.
103
103
 
104
104
  ---
105
105
 
@@ -116,7 +116,7 @@ A defensible conclusion **prefers two independent signals from different tiers**
116
116
  | Tier 3 + Tier 4 (cross-check + contrastive run) | medium — both partial |
117
117
  | Tier 6 alone (code reading only) | **insufficient** — escalate or mark unverified |
118
118
 
119
- Record in the journal:
119
+ State the current evidence and verification limit in conversation or the deliverable, not a repository journal:
120
120
 
121
121
  ```markdown
122
122
  ## Partial runtime evidence
@@ -203,17 +203,4 @@ Use `research` to verify factual artifact claims. Use the Phase 4 hard-reasoning
203
203
 
204
204
  ## Cleanup additions for partial-evidence work
205
205
 
206
- ```bash
207
- # Proxy artifacts
208
- pkill -f mitmproxy 2>/dev/null
209
- rm -f ~/.mitmproxy/cache_* 2>/dev/null
210
-
211
- # Debug log files
212
- rm -f /tmp/trace.log /tmp/*-debug-trace.log
213
-
214
- # DYLD_INSERT / LD_PRELOAD shim libraries
215
- rm -f /tmp/*.dylib /tmp/*.so
216
-
217
- # Verify env vars set in your shell are not persisted
218
- unset HTTPS_PROXY APP_DEBUG APP_LOG_LEVEL APP_LOG_FILE 2>/dev/null
219
- ```
206
+ Put proxy processes, logs, shim libraries, and environment overrides in the temporary resource ownership checklist before creation. Follow Phase 9: stop only identity-verified owned processes, delete exact owned paths, and restore captured prior environment values. Never remove shared proxy caches or use wildcard cleanup.
@@ -393,22 +393,7 @@ If reverse-engineering proprietary software, the extracted source is the vendor'
393
393
 
394
394
  ## Phase 9 cleanup specifics for bundled-JS work
395
395
 
396
- ```bash
397
- # Remove extracted bundles — they may contain proprietary source
398
- rm -f /tmp/extracted-bundle.js /tmp/extracted-*.js
399
- rm -rf /tmp/asar-extracted/
400
- rm -rf /tmp/_MEI*
401
-
402
- # Remove strings dumps
403
- rm -f /tmp/*-strings.txt /tmp/*-strings-v*.txt
404
-
405
- # Remove Python helper scripts created for parsing
406
- rm -f /tmp/extract_bundled_js.py /tmp/parse_template.py
407
-
408
- # Verify the extraction directory is gone (if you used a workspace dir)
409
- ls /Users/$USER/local-workspaces/*-extracted/ 2>/dev/null
410
- # rm -rf only after journal review confirms nothing important is there
411
- ```
396
+ Follow [central cleanup rules](../methodology/09-cleanup.md). Register exact task-owned paths for extracted bundles, ASAR or `_MEI` extraction directories, strings dumps, and parsing helpers in the temporary resource checklist. Resolve and verify each path and its ownership before deletion, then verify cleanup. Don't infer ownership from a filename, directory prefix, or location under `/tmp`; extracted proprietary source must stay out of commits and public reports.
412
397
 
413
398
  ---
414
399
 
@@ -109,7 +109,7 @@ print(repr(data[max(0,pos-100):pos+200]))
109
109
 
110
110
  If you must keep using `strings`, lower the threshold: `strings -n 1 -t x ./target | rg ...`. The signal-to-noise drops sharply but short content is preserved.
111
111
 
112
- Write the triage summary to the journal:
112
+ Keep current triage facts in conversation or task-owned temporary evidence:
113
113
 
114
114
  ```markdown
115
115
  ## Binary triage
@@ -189,7 +189,7 @@ spctl --assess --type execute -vv ./target # Gatekeeper assessment
189
189
  tmp=$(mktemp -d)
190
190
  codesign -dvv --extract-certificates="$tmp/cert" ./target 2>&1
191
191
  ls -la "$tmp"
192
- # rm -rf "$tmp" # journal first, clean up later
192
+ # Clean only this exact owned directory after checking the resource checklist.
193
193
 
194
194
  # Strings inside specific segments only (less noise than full-binary strings)
195
195
  otool -s __TEXT __cstring ./target # C string section
@@ -297,8 +297,8 @@ else
297
297
  echo "Using service: $SERVICE"
298
298
  fi
299
299
 
300
- # 2. JOURNAL the original proxy state before changing it (REQUIRED for safe rollback):
301
- networksetup -getwebproxy "$SERVICE" # save this output to journal
300
+ # 2. Capture original state in the temporary resource checklist before an authorized change:
301
+ networksetup -getwebproxy "$SERVICE" # capture exact prior state temporarily
302
302
  networksetup -getsecurewebproxy "$SERVICE" # save this too
303
303
 
304
304
  # 3. Start mitmproxy with persistent CA at ~/.mitmproxy/
@@ -316,13 +316,10 @@ HTTPS_PROXY=http://127.0.0.1:8888 SSL_CERT_FILE=~/.mitmproxy/mitmproxy-ca-cert.p
316
316
  networksetup -setwebproxy "$SERVICE" 127.0.0.1 8888
317
317
  networksetup -setsecurewebproxy "$SERVICE" 127.0.0.1 8888
318
318
 
319
- # 6. Cleanup — RESTORE original state from journal, untrust CA:
320
- networksetup -setwebproxystate "$SERVICE" off
321
- networksetup -setsecurewebproxystate "$SERVICE" off
322
- sudo security delete-certificate -c "mitmproxy" /Library/Keychains/System.keychain
319
+ # 6. Cleanup follows ../methodology/09-cleanup.md using captured service and certificate identities.
323
320
  ```
324
321
 
325
- **Critical**: forgetting step 6 leaves all your subsequent traffic mis-routed and silently MITM-able. Journal every step.
322
+ System proxy and trust changes require specific authorization. Follow [central cleanup rules](../methodology/09-cleanup.md). Before any authorized change, capture the service's exact proxy configuration, certificate fingerprint and keychain, and prior certificate/trust state in the temporary resource checklist. Restore that state, including any prior trust settings; remove a certificate only if this task introduced it and its exact identity is verified. Don't assume proxies were disabled or delete a certificate by name. The checklist records temporary resource ownership and restoration data, not repository development history.
326
323
 
327
324
  ### What to look for
328
325
 
@@ -407,7 +404,7 @@ For tiny fixes (one byte, one branch inversion):
407
404
  printf '\x90\x90' | dd of=./target bs=1 seek=$((0x1234)) conv=notrunc
408
405
  ```
409
406
 
410
- Journal the exact `dd` command and the original bytes so you can revert.
407
+ Before an authorized binary patch, capture the exact target identity, offset, original bytes, and restoration action in the temporary resource checklist. Never adopt another task's patch as an owned cleanup target.
411
408
 
412
409
  ### Option C: Wrap / shim
413
410
 
@@ -439,48 +436,6 @@ If it's a third-party binary and none of the above are feasible, the "fix" is a
439
436
 
440
437
  ## Phase 9 cleanup specifics
441
438
 
442
- ```bash
443
- # Kill debugger sessions
444
- pkill -f 'gdb' || true
445
- pkill -f 'lldb' || true
446
-
447
- # Ghidra scratch projects (if made just for this session)
448
- # Named something like ~/ghidra-projects/debug-<timestamp>:
449
- ls -la ~/ghidra-projects/ 2>/dev/null
450
- # rm -rf ~/ghidra-projects/debug-scratch # only if the journal says to
451
-
452
- # Core dumps left from crashes
453
- rm -f ./core ./core.* ~/core.*
454
-
455
- # strace/ltrace output files
456
- rm -f trace.out ltrace.out
457
-
458
- # If you made a binary patch (Option B above), confirm revert
459
- # The journal should have the original bytes — restore them:
460
- # printf '<original-bytes>' | dd of=./target bs=1 seek=<offset> conv=notrunc
461
-
462
- # Trace-output files
463
- rm -f /tmp/debug-*.bin /tmp/debug-*.strace /tmp/debug-*.ltrace
439
+ Follow [central cleanup rules](../methodology/09-cleanup.md). Register exact owned scratch projects, core dumps, traces, shim libraries, and extracted data, plus debugger and proxy PIDs and start identities. Restore only this task's temporary binary patch at its recorded target identity and offsets using captured original bytes, preserving the authorized final fix.
464
440
 
465
- # macOS-specific:
466
- # Restore proxy settings if you set them (CRITICAL — leaves system traffic mis-routed otherwise)
467
- # Use the SAME $SERVICE you used when enabling the proxy (read it from the journal).
468
- # Do NOT hardcode "Wi-Fi" — many machines route traffic over Ethernet, USB tether, or a VPN service.
469
- [ -n "$SERVICE" ] && {
470
- networksetup -setwebproxystate "$SERVICE" off 2>/dev/null
471
- networksetup -setsecurewebproxystate "$SERVICE" off 2>/dev/null
472
- }
473
- # Or restore explicitly from the journaled original state — see the proxy section above.
474
-
475
- # Stop mitmproxy
476
- pkill -f 'mitmproxy' 2>/dev/null
477
-
478
- # Remove DYLD shim libraries you built
479
- rm -f /tmp/*-shim.dylib
480
-
481
- # Clear extracted strings dumps (these can be huge and may contain secrets)
482
- rm -f /tmp/*-strings*.txt
483
-
484
- # Verify hostname resolution returns to normal (mitmproxy can leave entries)
485
- scutil --dns | head -20
486
- ```
441
+ For authorized macOS proxy/trust changes, restore the exact captured prior state for the same service and certificate identity. Don't assume the prior proxy was disabled, delete certificates by a shared name, or clean another task's files. Report any restoration that can't be verified.