open-multi-agent-kit 0.96.2 → 0.98.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 (368) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +43 -9
  3. package/dist/cli/args.d.ts +2 -3
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +13 -189
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli/help.d.ts +3 -0
  8. package/dist/cli/help.d.ts.map +1 -0
  9. package/dist/cli/help.js +194 -0
  10. package/dist/cli/help.js.map +1 -0
  11. package/dist/cli/initial-message.d.ts.map +1 -1
  12. package/dist/cli/initial-message.js +2 -1
  13. package/dist/cli/initial-message.js.map +1 -1
  14. package/dist/cli/resource-paths.d.ts +4 -0
  15. package/dist/cli/resource-paths.d.ts.map +1 -0
  16. package/dist/cli/resource-paths.js +59 -0
  17. package/dist/cli/resource-paths.js.map +1 -0
  18. package/dist/commands/adaptorch-doctor-cli.d.ts +13 -0
  19. package/dist/commands/adaptorch-doctor-cli.d.ts.map +1 -0
  20. package/dist/commands/adaptorch-doctor-cli.js +115 -0
  21. package/dist/commands/adaptorch-doctor-cli.js.map +1 -0
  22. package/dist/commands/resource-doctor-cli.d.ts +4 -0
  23. package/dist/commands/resource-doctor-cli.d.ts.map +1 -1
  24. package/dist/commands/resource-doctor-cli.js +35 -5
  25. package/dist/commands/resource-doctor-cli.js.map +1 -1
  26. package/dist/core/adaptorch-bridge.d.ts +11 -13
  27. package/dist/core/adaptorch-bridge.d.ts.map +1 -1
  28. package/dist/core/adaptorch-bridge.js +11 -13
  29. package/dist/core/adaptorch-bridge.js.map +1 -1
  30. package/dist/core/agent-session-snapshot.d.ts +16 -0
  31. package/dist/core/agent-session-snapshot.d.ts.map +1 -0
  32. package/dist/core/agent-session-snapshot.js +111 -0
  33. package/dist/core/agent-session-snapshot.js.map +1 -0
  34. package/dist/core/agent-session.d.ts +14 -10
  35. package/dist/core/agent-session.d.ts.map +1 -1
  36. package/dist/core/agent-session.js +102 -217
  37. package/dist/core/agent-session.js.map +1 -1
  38. package/dist/core/agent-tool-settings.d.ts +10 -0
  39. package/dist/core/agent-tool-settings.d.ts.map +1 -1
  40. package/dist/core/agent-tool-settings.js +10 -1
  41. package/dist/core/agent-tool-settings.js.map +1 -1
  42. package/dist/core/attachment-store.d.ts +39 -0
  43. package/dist/core/attachment-store.d.ts.map +1 -0
  44. package/dist/core/attachment-store.js +81 -0
  45. package/dist/core/attachment-store.js.map +1 -0
  46. package/dist/core/command-safety.d.ts +8 -0
  47. package/dist/core/command-safety.d.ts.map +1 -1
  48. package/dist/core/command-safety.js +140 -14
  49. package/dist/core/command-safety.js.map +1 -1
  50. package/dist/core/compaction/compaction.d.ts +13 -1
  51. package/dist/core/compaction/compaction.d.ts.map +1 -1
  52. package/dist/core/compaction/compaction.js +60 -62
  53. package/dist/core/compaction/compaction.js.map +1 -1
  54. package/dist/core/compaction/index.d.ts +1 -0
  55. package/dist/core/compaction/index.d.ts.map +1 -1
  56. package/dist/core/compaction/index.js +1 -0
  57. package/dist/core/compaction/index.js.map +1 -1
  58. package/dist/core/compaction/knowledge-triage-format.d.ts +9 -0
  59. package/dist/core/compaction/knowledge-triage-format.d.ts.map +1 -0
  60. package/dist/core/compaction/knowledge-triage-format.js +71 -0
  61. package/dist/core/compaction/knowledge-triage-format.js.map +1 -0
  62. package/dist/core/compaction/knowledge-triage-types.d.ts +7 -0
  63. package/dist/core/compaction/knowledge-triage-types.d.ts.map +1 -0
  64. package/dist/core/compaction/knowledge-triage-types.js +2 -0
  65. package/dist/core/compaction/knowledge-triage-types.js.map +1 -0
  66. package/dist/core/compaction/knowledge-triage.d.ts +29 -0
  67. package/dist/core/compaction/knowledge-triage.d.ts.map +1 -0
  68. package/dist/core/compaction/knowledge-triage.js +189 -0
  69. package/dist/core/compaction/knowledge-triage.js.map +1 -0
  70. package/dist/core/compaction/transaction.d.ts.map +1 -1
  71. package/dist/core/compaction/transaction.js +1 -1
  72. package/dist/core/compaction/transaction.js.map +1 -1
  73. package/dist/core/compaction/utils.d.ts +4 -0
  74. package/dist/core/compaction/utils.d.ts.map +1 -1
  75. package/dist/core/compaction/utils.js +37 -0
  76. package/dist/core/compaction/utils.js.map +1 -1
  77. package/dist/core/completion-sound-io.d.ts +14 -0
  78. package/dist/core/completion-sound-io.d.ts.map +1 -0
  79. package/dist/core/completion-sound-io.js +64 -0
  80. package/dist/core/completion-sound-io.js.map +1 -0
  81. package/dist/core/completion-sound.d.ts +4 -10
  82. package/dist/core/completion-sound.d.ts.map +1 -1
  83. package/dist/core/completion-sound.js +28 -58
  84. package/dist/core/completion-sound.js.map +1 -1
  85. package/dist/core/context-budget-governor-v2.d.ts +1 -1
  86. package/dist/core/context-budget-governor-v2.d.ts.map +1 -1
  87. package/dist/core/context-budget-governor-v2.js +1 -1
  88. package/dist/core/context-budget-governor-v2.js.map +1 -1
  89. package/dist/core/context-budget-relevance.d.ts +15 -2
  90. package/dist/core/context-budget-relevance.d.ts.map +1 -1
  91. package/dist/core/context-budget-relevance.js +21 -9
  92. package/dist/core/context-budget-relevance.js.map +1 -1
  93. package/dist/core/context-budget-system-prompt-items.d.ts +1 -1
  94. package/dist/core/context-budget-system-prompt-items.d.ts.map +1 -1
  95. package/dist/core/context-budget-system-prompt-items.js.map +1 -1
  96. package/dist/core/context-budget-system-prompt.d.ts +1 -1
  97. package/dist/core/context-budget-system-prompt.d.ts.map +1 -1
  98. package/dist/core/context-budget-system-prompt.js.map +1 -1
  99. package/dist/core/context-budget-v2-cache-keys.d.ts +3 -0
  100. package/dist/core/context-budget-v2-cache-keys.d.ts.map +1 -1
  101. package/dist/core/context-budget-v2-cache-keys.js +2 -0
  102. package/dist/core/context-budget-v2-cache-keys.js.map +1 -1
  103. package/dist/core/context-budget-v2-plan-cache-keys.d.ts.map +1 -1
  104. package/dist/core/context-budget-v2-plan-cache-keys.js +3 -0
  105. package/dist/core/context-budget-v2-plan-cache-keys.js.map +1 -1
  106. package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
  107. package/dist/core/context-budget-v2-planner.js +2 -1
  108. package/dist/core/context-budget-v2-planner.js.map +1 -1
  109. package/dist/core/context-budget-v2-scoring.d.ts +17 -0
  110. package/dist/core/context-budget-v2-scoring.d.ts.map +1 -1
  111. package/dist/core/context-budget-v2-scoring.js +25 -8
  112. package/dist/core/context-budget-v2-scoring.js.map +1 -1
  113. package/dist/core/context-budget-v2-selection.d.ts +2 -2
  114. package/dist/core/context-budget-v2-selection.d.ts.map +1 -1
  115. package/dist/core/context-budget-v2-selection.js +18 -1
  116. package/dist/core/context-budget-v2-selection.js.map +1 -1
  117. package/dist/core/context-budget-v2-types.d.ts +17 -0
  118. package/dist/core/context-budget-v2-types.d.ts.map +1 -1
  119. package/dist/core/context-budget-v2-types.js +15 -0
  120. package/dist/core/context-budget-v2-types.js.map +1 -1
  121. package/dist/core/context-file.d.ts +23 -0
  122. package/dist/core/context-file.d.ts.map +1 -0
  123. package/dist/core/context-file.js +17 -0
  124. package/dist/core/context-file.js.map +1 -0
  125. package/dist/core/extensions/builtin/command-safety-gate.d.ts +3 -1
  126. package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -1
  127. package/dist/core/extensions/builtin/command-safety-gate.js +7 -0
  128. package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -1
  129. package/dist/core/extensions/types.d.ts +12 -1
  130. package/dist/core/extensions/types.d.ts.map +1 -1
  131. package/dist/core/extensions/types.js.map +1 -1
  132. package/dist/core/keybindings.d.ts +1 -1
  133. package/dist/core/keybindings.d.ts.map +1 -1
  134. package/dist/core/keybindings.js +6 -1
  135. package/dist/core/keybindings.js.map +1 -1
  136. package/dist/core/model-prompt-policy.d.ts +1 -1
  137. package/dist/core/model-prompt-policy.d.ts.map +1 -1
  138. package/dist/core/model-prompt-policy.js.map +1 -1
  139. package/dist/core/model-registry.d.ts +8 -3
  140. package/dist/core/model-registry.d.ts.map +1 -1
  141. package/dist/core/model-registry.js +71 -1
  142. package/dist/core/model-registry.js.map +1 -1
  143. package/dist/core/package-doctor-source-scan.d.ts +9 -0
  144. package/dist/core/package-doctor-source-scan.d.ts.map +1 -1
  145. package/dist/core/package-doctor-source-scan.js +77 -4
  146. package/dist/core/package-doctor-source-scan.js.map +1 -1
  147. package/dist/core/prompt-attachment.d.ts +51 -0
  148. package/dist/core/prompt-attachment.d.ts.map +1 -0
  149. package/dist/core/prompt-attachment.js +186 -0
  150. package/dist/core/prompt-attachment.js.map +1 -0
  151. package/dist/core/prompt-settlement.d.ts +6 -3
  152. package/dist/core/prompt-settlement.d.ts.map +1 -1
  153. package/dist/core/prompt-settlement.js +10 -14
  154. package/dist/core/prompt-settlement.js.map +1 -1
  155. package/dist/core/provider-resilience.d.ts +28 -0
  156. package/dist/core/provider-resilience.d.ts.map +1 -1
  157. package/dist/core/provider-resilience.js +50 -0
  158. package/dist/core/provider-resilience.js.map +1 -1
  159. package/dist/core/provider-retry.d.ts +1 -1
  160. package/dist/core/provider-retry.d.ts.map +1 -1
  161. package/dist/core/provider-retry.js +1 -1
  162. package/dist/core/provider-retry.js.map +1 -1
  163. package/dist/core/provider-usage.d.ts.map +1 -1
  164. package/dist/core/provider-usage.js +68 -2
  165. package/dist/core/provider-usage.js.map +1 -1
  166. package/dist/core/reasoning-router-promotion.d.ts +124 -0
  167. package/dist/core/reasoning-router-promotion.d.ts.map +1 -0
  168. package/dist/core/reasoning-router-promotion.js +121 -0
  169. package/dist/core/reasoning-router-promotion.js.map +1 -0
  170. package/dist/core/reasoning-router-replay-stability.d.ts +65 -0
  171. package/dist/core/reasoning-router-replay-stability.d.ts.map +1 -0
  172. package/dist/core/reasoning-router-replay-stability.js +67 -0
  173. package/dist/core/reasoning-router-replay-stability.js.map +1 -0
  174. package/dist/core/reasoning-router-v4-weights.d.ts +6 -6
  175. package/dist/core/reasoning-router-v4-weights.d.ts.map +1 -1
  176. package/dist/core/reasoning-router-v4-weights.js +3 -3
  177. package/dist/core/reasoning-router-v4-weights.js.map +1 -1
  178. package/dist/core/reasoning-router-v4.d.ts.map +1 -1
  179. package/dist/core/reasoning-router-v4.js +6 -6
  180. package/dist/core/reasoning-router-v4.js.map +1 -1
  181. package/dist/core/redaction.d.ts.map +1 -1
  182. package/dist/core/redaction.js +1 -1
  183. package/dist/core/redaction.js.map +1 -1
  184. package/dist/core/resource-admission.d.ts +2 -1
  185. package/dist/core/resource-admission.d.ts.map +1 -1
  186. package/dist/core/resource-admission.js +11 -0
  187. package/dist/core/resource-admission.js.map +1 -1
  188. package/dist/core/resource-governor-format.d.ts +1 -1
  189. package/dist/core/resource-governor-format.d.ts.map +1 -1
  190. package/dist/core/resource-governor-format.js.map +1 -1
  191. package/dist/core/resource-governor-settings.d.ts +6 -12
  192. package/dist/core/resource-governor-settings.d.ts.map +1 -1
  193. package/dist/core/resource-governor-settings.js.map +1 -1
  194. package/dist/core/resource-governor-types.d.ts +24 -0
  195. package/dist/core/resource-governor-types.d.ts.map +1 -0
  196. package/dist/core/resource-governor-types.js +15 -0
  197. package/dist/core/resource-governor-types.js.map +1 -0
  198. package/dist/core/resource-loader.d.ts +1 -7
  199. package/dist/core/resource-loader.d.ts.map +1 -1
  200. package/dist/core/resource-loader.js.map +1 -1
  201. package/dist/core/resource-observation-journal.d.ts +2 -1
  202. package/dist/core/resource-observation-journal.d.ts.map +1 -1
  203. package/dist/core/resource-observation-journal.js +4 -3
  204. package/dist/core/resource-observation-journal.js.map +1 -1
  205. package/dist/core/resource-observation-report-reader.d.ts +7 -0
  206. package/dist/core/resource-observation-report-reader.d.ts.map +1 -0
  207. package/dist/core/resource-observation-report-reader.js +157 -0
  208. package/dist/core/resource-observation-report-reader.js.map +1 -0
  209. package/dist/core/resource-observation-report.d.ts +24 -0
  210. package/dist/core/resource-observation-report.d.ts.map +1 -0
  211. package/dist/core/resource-observation-report.js +101 -0
  212. package/dist/core/resource-observation-report.js.map +1 -0
  213. package/dist/core/router-feedback-collector.d.ts +1 -1
  214. package/dist/core/router-feedback-collector.d.ts.map +1 -1
  215. package/dist/core/router-feedback-collector.js.map +1 -1
  216. package/dist/core/session-bash-service.d.ts.map +1 -1
  217. package/dist/core/session-bash-service.js +4 -3
  218. package/dist/core/session-bash-service.js.map +1 -1
  219. package/dist/core/session-failure-cause.d.ts +33 -0
  220. package/dist/core/session-failure-cause.d.ts.map +1 -0
  221. package/dist/core/session-failure-cause.js +141 -0
  222. package/dist/core/session-failure-cause.js.map +1 -0
  223. package/dist/core/session-system-prompt.d.ts +1 -1
  224. package/dist/core/session-system-prompt.d.ts.map +1 -1
  225. package/dist/core/session-system-prompt.js.map +1 -1
  226. package/dist/core/session-termination.d.ts +1 -1
  227. package/dist/core/session-termination.d.ts.map +1 -1
  228. package/dist/core/session-termination.js +11 -2
  229. package/dist/core/session-termination.js.map +1 -1
  230. package/dist/core/settings-manager.d.ts +1 -1
  231. package/dist/core/settings-manager.d.ts.map +1 -1
  232. package/dist/core/settings-manager.js.map +1 -1
  233. package/dist/core/system-prompt.d.ts +1 -1
  234. package/dist/core/system-prompt.d.ts.map +1 -1
  235. package/dist/core/system-prompt.js.map +1 -1
  236. package/dist/core/tools/bash.d.ts.map +1 -1
  237. package/dist/core/tools/bash.js +10 -14
  238. package/dist/core/tools/bash.js.map +1 -1
  239. package/dist/core/tools/grep.d.ts.map +1 -1
  240. package/dist/core/tools/grep.js +13 -48
  241. package/dist/core/tools/grep.js.map +1 -1
  242. package/dist/core/tools/read.d.ts.map +1 -1
  243. package/dist/core/tools/read.js +1 -34
  244. package/dist/core/tools/read.js.map +1 -1
  245. package/dist/core/workload-classifier.d.ts +2 -10
  246. package/dist/core/workload-classifier.d.ts.map +1 -1
  247. package/dist/core/workload-classifier.js +17 -0
  248. package/dist/core/workload-classifier.js.map +1 -1
  249. package/dist/core/workload-family-matcher.d.ts +1 -1
  250. package/dist/core/workload-family-matcher.d.ts.map +1 -1
  251. package/dist/core/workload-family-matcher.js.map +1 -1
  252. package/dist/core/workload-shard-execution-types.d.ts +40 -0
  253. package/dist/core/workload-shard-execution-types.d.ts.map +1 -0
  254. package/dist/core/workload-shard-execution-types.js +14 -0
  255. package/dist/core/workload-shard-execution-types.js.map +1 -0
  256. package/dist/core/workload-shard-executor.d.ts +3 -27
  257. package/dist/core/workload-shard-executor.d.ts.map +1 -1
  258. package/dist/core/workload-shard-executor.js.map +1 -1
  259. package/dist/core/workload-shard-runner.d.ts +1 -1
  260. package/dist/core/workload-shard-runner.d.ts.map +1 -1
  261. package/dist/core/workload-shard-runner.js.map +1 -1
  262. package/dist/core/workload-types.d.ts +24 -0
  263. package/dist/core/workload-types.d.ts.map +1 -0
  264. package/dist/core/workload-types.js +15 -0
  265. package/dist/core/workload-types.js.map +1 -0
  266. package/dist/index.d.ts +1 -1
  267. package/dist/index.d.ts.map +1 -1
  268. package/dist/index.js +1 -1
  269. package/dist/index.js.map +1 -1
  270. package/dist/main.d.ts +2 -0
  271. package/dist/main.d.ts.map +1 -1
  272. package/dist/main.js +27 -47
  273. package/dist/main.js.map +1 -1
  274. package/dist/modes/interactive/components/attachment-strip.d.ts +21 -0
  275. package/dist/modes/interactive/components/attachment-strip.d.ts.map +1 -0
  276. package/dist/modes/interactive/components/attachment-strip.js +136 -0
  277. package/dist/modes/interactive/components/attachment-strip.js.map +1 -0
  278. package/dist/modes/interactive/components/footer.d.ts +6 -0
  279. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  280. package/dist/modes/interactive/components/footer.js +26 -1
  281. package/dist/modes/interactive/components/footer.js.map +1 -1
  282. package/dist/modes/interactive/components/status-sidebar.d.ts.map +1 -1
  283. package/dist/modes/interactive/components/status-sidebar.js +12 -1
  284. package/dist/modes/interactive/components/status-sidebar.js.map +1 -1
  285. package/dist/modes/interactive/interactive-mode.d.ts +23 -4
  286. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  287. package/dist/modes/interactive/interactive-mode.js +174 -53
  288. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  289. package/dist/modes/interactive/theme/omk-control-panel.json +1 -1
  290. package/dist/utils/clipboard-image.d.ts.map +1 -1
  291. package/dist/utils/clipboard-image.js +42 -33
  292. package/dist/utils/clipboard-image.js.map +1 -1
  293. package/dist/utils/clipboard.d.ts.map +1 -1
  294. package/dist/utils/clipboard.js +14 -2
  295. package/dist/utils/clipboard.js.map +1 -1
  296. package/docs/adaptorch-preview-spec.md +20 -18
  297. package/docs/adaptorch-preview.md +9 -9
  298. package/docs/compaction.md +25 -4
  299. package/docs/correctness-wall.md +10 -10
  300. package/docs/docs.json +12 -0
  301. package/docs/environment-variables.md +9 -2
  302. package/docs/extensions.md +12 -3
  303. package/docs/index.md +7 -1
  304. package/docs/metrics.md +74 -2
  305. package/docs/provider-resilience.md +11 -0
  306. package/docs/runtime-algorithms.md +359 -0
  307. package/docs/sdk.md +2 -2
  308. package/docs/settings.md +11 -10
  309. package/docs/usage.md +19 -3
  310. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  311. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  312. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  313. package/examples/extensions/gondolin/package-lock.json +2 -2
  314. package/examples/extensions/gondolin/package.json +1 -1
  315. package/examples/extensions/sandbox/package-lock.json +2 -2
  316. package/examples/extensions/sandbox/package.json +1 -1
  317. package/examples/extensions/with-deps/package-lock.json +2 -2
  318. package/examples/extensions/with-deps/package.json +1 -1
  319. package/npm-shrinkwrap.json +18 -18
  320. package/package.json +7 -7
  321. package/dist/core/context-budget-governor.d.ts +0 -67
  322. package/dist/core/context-budget-governor.d.ts.map +0 -1
  323. package/dist/core/context-budget-governor.js +0 -224
  324. package/dist/core/context-budget-governor.js.map +0 -1
  325. package/dist/core/lean-ctx.d.ts +0 -99
  326. package/dist/core/lean-ctx.d.ts.map +0 -1
  327. package/dist/core/lean-ctx.js +0 -225
  328. package/dist/core/lean-ctx.js.map +0 -1
  329. package/dist/core/read-anchors.d.ts +0 -110
  330. package/dist/core/read-anchors.d.ts.map +0 -1
  331. package/dist/core/read-anchors.js +0 -193
  332. package/dist/core/read-anchors.js.map +0 -1
  333. package/dist/core/recovery-checkpoint.d.ts +0 -196
  334. package/dist/core/recovery-checkpoint.d.ts.map +0 -1
  335. package/dist/core/recovery-checkpoint.js +0 -382
  336. package/dist/core/recovery-checkpoint.js.map +0 -1
  337. package/dist/core/sandbox-policy-v2.d.ts +0 -49
  338. package/dist/core/sandbox-policy-v2.d.ts.map +0 -1
  339. package/dist/core/sandbox-policy-v2.js +0 -368
  340. package/dist/core/sandbox-policy-v2.js.map +0 -1
  341. package/dist/core/tools/omp-pure-seams.d.ts +0 -41
  342. package/dist/core/tools/omp-pure-seams.d.ts.map +0 -1
  343. package/dist/core/tools/omp-pure-seams.js +0 -142
  344. package/dist/core/tools/omp-pure-seams.js.map +0 -1
  345. package/dist/core/tools/omp-seam-runtime.d.ts +0 -100
  346. package/dist/core/tools/omp-seam-runtime.d.ts.map +0 -1
  347. package/dist/core/tools/omp-seam-runtime.js +0 -40
  348. package/dist/core/tools/omp-seam-runtime.js.map +0 -1
  349. package/dist/guardrails/audit-logger.d.ts +0 -4
  350. package/dist/guardrails/audit-logger.d.ts.map +0 -1
  351. package/dist/guardrails/audit-logger.js +0 -28
  352. package/dist/guardrails/audit-logger.js.map +0 -1
  353. package/dist/guardrails/freedomd-adapter.d.ts +0 -16
  354. package/dist/guardrails/freedomd-adapter.d.ts.map +0 -1
  355. package/dist/guardrails/freedomd-adapter.js +0 -87
  356. package/dist/guardrails/freedomd-adapter.js.map +0 -1
  357. package/dist/orchestration/lane-grant-auditor.d.ts +0 -4
  358. package/dist/orchestration/lane-grant-auditor.d.ts.map +0 -1
  359. package/dist/orchestration/lane-grant-auditor.js +0 -87
  360. package/dist/orchestration/lane-grant-auditor.js.map +0 -1
  361. package/dist/types/guardrails.d.ts +0 -61
  362. package/dist/types/guardrails.d.ts.map +0 -1
  363. package/dist/types/guardrails.js +0 -9
  364. package/dist/types/guardrails.js.map +0 -1
  365. package/dist/types/lane-grant.d.ts +0 -58
  366. package/dist/types/lane-grant.d.ts.map +0 -1
  367. package/dist/types/lane-grant.js +0 -9
  368. package/dist/types/lane-grant.js.map +0 -1
@@ -19,7 +19,7 @@ It does **not** prove that code is correct, complete, or safe for production.
19
19
  | **PASS** | Fast wall (and optional OA) found no blocking issues. |
20
20
  | **ADVISORY** | Proceed with caution; preview limits or weak discrimination may apply. |
21
21
  | **INCONCLUSIVE** | Not enough evidence (empty diff, missing fixture, verifier error). |
22
- | **BLOCKED** | Scope, secret heuristic, or OA contradiction do not apply by default. |
22
+ | **BLOCKED** | Scope, secret heuristic, or OA contradiction. `hard` blocks it; `soft` blocks unless overridden; `shadow` records it and proceeds. |
23
23
 
24
24
  Structured next steps on the verdict card: **Apply**, **Deep Check**, **Regenerate** (see `packages/adaptorch-wpl` B2C mapper).
25
25
 
@@ -28,13 +28,13 @@ Structured next steps on the verdict card: **Apply**, **Deep Check**, **Regenera
28
28
  ## Fast wall vs deep wall
29
29
 
30
30
  - **Fast wall (default):** Pure policy — diff paths, scope globs, secret-shaped lines, preview-only limits (`BATCH1_NO_DOCKER_RUNNER`). No Docker runner in batch 1.
31
- - **Deep wall (Pro / future):** Hermetic paired base/patch replay. Today `deepWall: true` returns **unavailable** (evidence-gated: requires a valid execution receipt per ALG-003 strict mode; no Docker runner wired in batch 1).
31
+ - **Proposed deep wall (unavailable):** Hermetic paired base/patch replay. Today `deepWall: true` returns **unavailable** (evidence-gated: requires a valid execution receipt per ALG-003 strict mode; no Docker runner wired in batch 1).
32
32
 
33
- ## Relationship to Adaptorch
33
+ ## Relationship to AdaptOrch
34
34
 
35
- - Hidden engine: `omk-adaptorch-wpl` (`evaluateCorrectnessWall`, outcome adjudicator, repair hints).
35
+ - Library: published `omk-adaptorch-wpl` (`evaluateCorrectnessWall`, outcome adjudicator, repair hints); the extension remains explicit opt-in.
36
36
  - Optional OA path: `runIds` + `previewOnly: false` + in-memory or MCP transport.
37
- - Adaptorch **preview** planning is separate; see [adaptorch-preview.md](./adaptorch-preview.md).
37
+ - AdaptOrch **preview** planning is separate; see [adaptorch-preview.md](./adaptorch-preview.md).
38
38
 
39
39
  ## Operator environment
40
40
 
@@ -72,7 +72,7 @@ The correctness wall is **not** part of the default `omk-core-verified` preset o
72
72
  | **Scope** | `OMK_WALL_SCOPE` — comma-separated path globs that approve write targets in the diff |
73
73
  | **Mode** | `OMK_PATCH_SAFETY_WALL_MODE` — `shadow` \| `soft` \| `hard` (see [Operator environment](#operator-environment)) |
74
74
  | **Role loadouts** | `code` / `executor` lanes still get `pre-shell-guard`, `protect-secrets`, and `typecheck-after-edit`; the wall **adds** a pre-apply policy gate on `edit` / `write` only when the extension is loaded |
75
- | **Domain router** | No dedicated domain profile today; patch-safety work may route to [`ai-agent-ops`](./loadout-domains/ai-agent-ops.md) for harness/eval discipline, but that does **not** auto-load this extension |
75
+ | **Domain router** | The PATCH SAFETY profile routes relevant prompts, but it does **not** auto-load this extension |
76
76
 
77
77
  **Domain router triggers (implemented):** `packages/coding-agent/src/core/domain-loadouts.ts` already contains keyword triggers (`correctness wall`, `patch safety`) and a path trigger (`correctness-wall`) that route to the PATCH SAFETY domain profile. The profile instructs operators to load the correctness-wall extension explicitly (not in default preset) and follow the shadow → soft → hard rollout. Auto-generated docs under `docs/loadout-domains/` should be regenerated via `gen-domain-docs.mjs`, not hand-edited.
78
78
 
@@ -88,7 +88,7 @@ Roll out in **three phases** so telemetry and false positives are understood bef
88
88
  | **2 — Soft** | `soft` | **BLOCKED** verdicts block apply unless `OMK_WALL_OVERRIDE=1` (or `true` / `yes`). **INCONCLUSIVE** still applies in shadow-like fashion for scope tuning. Use for pilot teams with an explicit override path. |
89
89
  | **3 — Hard** | `hard` | **BLOCKED** and **INCONCLUSIVE** both block `edit` / `write`. Reserve for repos with stable scope globs, OA fixtures wired (`OMK_WALL_RUN_IDS` + `OMK_WALL_OA_FIXTURE_PATH`), and acceptable INCONCLUSIVE rate (missing files, empty diff). |
90
90
 
91
- **Checklist between phases**
91
+ ### Checklist between phases
92
92
 
93
93
  1. AC-1 vitest green for `packages/adaptorch-wpl` and regression `018-b2c-correctness-wall`.
94
94
  2. Root `npm run check` green after any source touch (includes unrelated **browser-smoke** esbuild gate — wall work does not require loading the extension in that script).
@@ -112,8 +112,8 @@ Goal orchestration v2 artifacts (planner P3) live beside batch-1 plan files:
112
112
  - ⬜ Lift `BATCH1_NO_DOCKER_RUNNER` for non-preview deep wall — still stub.
113
113
  - ⬜ Preset documentation in `~/.omk/runtime-preset.json` — deferred.
114
114
 
115
- **Wave 3 (productize) — Not started:**
116
- - Publish `omk-adaptorch-wpl` from `dist/` for out-of-monorepo extensions.
115
+ **Wave 3 (productize) — Partial:**
116
+ - `omk-adaptorch-wpl` is published; out-of-monorepo consumers can install the package.
117
117
  - ✅ `domain-loadouts.ts` profile exists; `gen-domain-docs.mjs` regen pending.
118
118
  - ⬜ Default **soft** for internal dogfood presets after Wave 2 evidence.
119
119
 
@@ -122,4 +122,4 @@ Goal orchestration v2 artifacts (planner P3) live beside batch-1 plan files:
122
122
  - [adaptorch-preview.md](./adaptorch-preview.md)
123
123
  - [LOADOUT.md](../examples/extensions/correctness-wall/LOADOUT.md) — copy-paste for `omk-core-verified` sessions
124
124
  - Goal artifacts: `.omk/goals/b2c-correctness-wall-2026-07-08/` (`algorithm-v2.md`, `dag-v2.json`)
125
- - Extension README: `packages/coding-agent/examples/extensions/correctness-wall/README.md`
125
+ - Extension README: `packages/coding-agent/examples/extensions/correctness-wall/README.md`
package/docs/docs.json CHANGED
@@ -118,6 +118,18 @@
118
118
  "title": "Run Protocol & Durable Goals",
119
119
  "path": "run-protocol.md"
120
120
  },
121
+ {
122
+ "title": "Runtime Algorithms & Direction",
123
+ "path": "runtime-algorithms.md"
124
+ },
125
+ {
126
+ "title": "AdaptOrch Preview",
127
+ "path": "adaptorch-preview.md"
128
+ },
129
+ {
130
+ "title": "Correctness Wall",
131
+ "path": "correctness-wall.md"
132
+ },
121
133
  {
122
134
  "title": "RPC Mode",
123
135
  "path": "rpc.md"
@@ -83,19 +83,26 @@ These variables are read by OMK itself. The four built-in harness flags below ar
83
83
  | `OMK_TELEMETRY` | Override install/update telemetry and provider attribution headers: `1`/`true`/`yes` or `0`/`false`/`no` |
84
84
  | `OMK_SHARE_VIEWER_URL` | Override the base URL used by `/share` |
85
85
  | `OMK_HARDWARE_CURSOR` | Set to `1` to show the hardware cursor; see [Terminal setup](terminal-setup.md) |
86
- | `OMK_CONTEXT_GOVERNOR` | Configure the context-budget governor; see `context-budget-*` sources |
86
+ | `OMK_CONTEXT_GOVERNOR` | Context Budget V2 process override: `1` forces it on and `0` forces it off; otherwise the global `contextBudget.enabled` setting applies |
87
+ | `OMK_CONTEXT_GOVERNOR_CACHE` | Set to `memory` to keep representations, negative results, and plans in session memory instead of persisting representations per workspace |
88
+ | `OMK_CONTEXT_GOVERNOR_CACHE_DIR` | Relocate the Context Budget V2 representation snapshot from `.omk/cache/context-budget-v2`; plans remain session-memory-only |
87
89
  | `OMK_VERIFIED_BASH` | Default-on verified bash adapter for AgentSession/CLI bash. Set to `0` to opt out and use the legacy unverified path (see [SDK — Evidence and Verification](sdk.md#evidence-and-verification)) |
88
90
  | `OMK_BASH_SANDBOX` | AgentSession built-in local bash mode. Unset or unknown values select `enforce`: macOS `sandbox-exec` or Linux `bwrap`, workspace/temp writes only, network disabled, and fail closed without a usable backend. Explicit `audit` selects the unwrapped ledger-only path; `0`/`off` disables the preflight. Use `off` only when a verified outer whole-process sandbox owns isolation; it does not isolate OMK by itself |
89
91
  | `LIVE_E2E` | Test-only: keep provider credentials so live-API e2e suites run on purpose (default scrubbed for hermetic tests) |
90
- | `OMK_OMP_SEAMS` | Default-on OMP pure seams for `read`/`grep`. Set to `0` to opt out |
91
92
  | `OMK_IDENTICAL_LOOP` | Default-on consecutive-loop guard. Warns from the third identical `tool+args` call and blocks the sixth. Set a disabling value to opt out |
92
93
  | `OMK_TOOL_PAIR_REPAIR` | Default-on outbound-context repair. Removes unmatched tool-use and tool-result blocks before provider requests without rewriting the transcript. Set a disabling value to opt out |
93
94
  | `OMK_PROMPT_PRESET` | Default-on model-specific guidance for supported Claude/Anthropic, Kimi, GLM/ZAI, and Grok/xAI models. Set a disabling value to opt out |
94
95
  | `OMK_CLAUDE_CONTEXT_FILES` | Claude models omit discovered `AGENTS.md` and `CLAUDE.md` files by default to prevent unrelated context from causing provider false positives. Set to `1`, `true`, `on`, or `yes` to restore them |
95
96
  | `OMK_GOAL_CONTROLLER` | Default-on working-directory `/goal` command and automatic continuation. Goals created by `/goal` use an eight-round cap. Set a disabling value to opt out |
97
+ | `OMK_COMPLETION_SOUND` | Interactive-TTY terminal notification override: `0` disables it and `1` enables it. Sounds never run in RPC, JSON, print mode, or CI |
98
+ | `OMK_YOLO`, `OMK_COMMAND_SAFETY`, `OMK_DISABLE_COMMAND_SAFETY` | Disable the command-safety gate entirely (YOLO mode). `OMK_YOLO` and `OMK_DISABLE_COMMAND_SAFETY` accept `1`, `true`, `yes`, or `on`; `OMK_COMMAND_SAFETY` accepts `0`, `false`, `off`, `disable`, or `disabled`. Every verdict, including block-tier and privilege commands, is skipped in interactive and headless runs. Use only when a verified outer sandbox owns the boundary |
99
+ | `OMK_COMMAND_SAFETY_ASSUME_YES` | `1` or `true` auto-accepts non-privilege confirm-tier commands in interactive **and headless** runs. Privilege confirmation and block-tier commands remain denied. Use only under a trusted outer sandbox when headless auto-accept is intended |
96
100
  | `OMK_GROK_HARNESS` | Default-on native `xai` provider dispatch to the `grok-harness` loadout. `0`, `false`, `off`, or `no` disables it |
97
101
  | `OMK_DOMAIN_ROUTING` | Set to `1` to enable general prompt-based domain routing. Native xAI harness dispatch does not require it |
98
102
  | `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
99
103
  | `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
104
+ | `OMK_RESOURCE_GOVERNOR` | Resource-governor mode: `off`, `observe` (default), `adaptive`, or `strict`. Feeds `/resource [probe\|policy]` and `omk doctor resources [--json]`; see the resource governor section in [Settings](settings.md) |
105
+ | `OMK_TOOL_SCHEDULER` | Tool scheduler override: `dag-v2` or the `waves-v1` rollback path; see also the `agent.toolScheduler` setting |
106
+ | `OMK_TURN_METRICS`, `OMK_TURN_METRICS_DIR` | Turn metrics are written under `.omk/metrics/` as sessions run; set `OMK_TURN_METRICS=0` to disable or `OMK_TURN_METRICS_DIR` to relocate. Aggregate with `omk stats`; see [Metrics](metrics.md) |
100
107
 
101
108
  Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and cloud-provider configuration are listed in [Providers](providers.md).
@@ -505,15 +505,24 @@ The `systemPromptOptions` field gives extensions access to the same structured d
505
505
 
506
506
  Inside `before_agent_start`, `event.systemPrompt` and `ctx.getSystemPrompt()` both reflect the chained system prompt as of the current handler. Later `before_agent_start` handlers can still modify it again.
507
507
 
508
- #### agent_start / agent_end
508
+ #### agent_start / agent_end / agent_settled
509
509
 
510
- Fired once per user prompt.
510
+ `agent_start` and `agent_end` fire once per agent-loop attempt. When the session
511
+ retries a transient provider failure, the prompt produces several `agent_end`
512
+ events, so `agent_end` alone does not mark the end of the work.
513
+
514
+ `agent_settled` fires once, immediately after the `agent_end` that no retry
515
+ follows. Use it to release per-run state exactly once.
511
516
 
512
517
  ```typescript
513
518
  omk.on("agent_start", async (_event, ctx) => {});
514
519
 
515
520
  omk.on("agent_end", async (event, ctx) => {
516
- // event.messages - messages from this prompt
521
+ // event.messages - messages from this attempt; a retry may still follow
522
+ });
523
+
524
+ omk.on("agent_settled", async (event, ctx) => {
525
+ // No retry follows. Safe to clear activity, finalize queues, or release locks.
517
526
  });
518
527
  ```
519
528
 
package/docs/index.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # OMK Documentation
2
2
 
3
- OMK is a provider-neutral coding agent with multi-agent orchestration, durable harness controls, replayable sessions, SDK/RPC integration, and evidence-backed verification. Its core stays small while extensions, skills, prompts, themes, and packages add workflows.
3
+ OMK is a provider-neutral coding agent with multi-agent orchestration, durable harness controls, replayable sessions, SDK/RPC integration, and evidence-backed verification. Extensions, skills, prompts, themes, and packages add workflows without changing the run contract.
4
+
5
+ OMK targets state-of-the-art quality as a CLI coding-agent harness. That target is not a claim of current leadership; see [Turn metrics and harness evaluation](metrics.md) for the qualification rules and current status.
4
6
 
5
7
  ## Quick start
6
8
 
@@ -59,6 +61,10 @@ For the full first-run flow, see [Quickstart](quickstart.md).
59
61
 
60
62
  - [SDK and Session Control](sdk.md) - embed omk, reuse policy helpers, or inspect stored sessions from scripts.
61
63
  - [Run Protocol and Durable Goals](run-protocol.md) - canonical run contracts and the durable-goal lifecycle.
64
+ - [Runtime algorithms and direction](runtime-algorithms.md) - released, opt-in, internal, working-tree, and proposed mechanisms.
65
+ - [AdaptOrch Preview](adaptorch-preview.md) - planning blueprint and claim boundary; not a default runtime path.
66
+ - [Correctness Wall](correctness-wall.md) - opt-in patch-apply safety extension and evidence limits.
67
+ - [Turn metrics and harness evaluation](metrics.md) - cost, latency, tool reliability, capability baselines, and comparative-claim rules.
62
68
  - [RPC mode](rpc.md) - integrate over stdin/stdout JSONL.
63
69
  - [JSON event stream mode](json.md) - print mode with structured events.
64
70
  - [TUI components](tui.md) - build custom terminal UI for extensions.
package/docs/metrics.md CHANGED
@@ -3,6 +3,76 @@
3
3
  OMK records one JSON line per agent turn so harness changes can be measured
4
4
  instead of guessed.
5
5
 
6
+ ## CLI harness SOTA target
7
+
8
+ OMK targets state-of-the-art quality as a CLI coding-agent harness. **SOTA is
9
+ not verified.** This is a product target, not a statement that the current
10
+ release leads a benchmark or a named competitor cohort.
11
+
12
+ The target covers the harness layer:
13
+
14
+ | Dimension | Primary measure |
15
+ | --- | --- |
16
+ | Task success | solved tasks and pass rate |
17
+ | Cost efficiency | model cost and tokens per solved task |
18
+ | Latency | wall-clock p50/p95 per solved task |
19
+ | Context efficiency | input, cache, compaction, and tool-output tokens per solved task |
20
+ | Tool reliability | failure, retry, refusal, and intervention rates |
21
+ | Orchestration | critical-path time, useful concurrency, and duplicate work |
22
+ | Recovery | interrupted-run resume accuracy and repeated-run variance |
23
+ | Safety | policy violations, unauthorized effects, and false-positive blocks |
24
+ | Maintainability | complexity, module-size debt, and regression-gate health |
25
+
26
+ No single feature count or self-score establishes leadership. OMK reports a
27
+ dimension-specific result unless a preregistered aggregation defines an overall
28
+ score.
29
+
30
+ ### Controlled comparison contract
31
+
32
+ A comparative harness run MUST hold the **same model**, **same provider** and
33
+ model configuration, **same task** and revision, **same budget**, equivalent
34
+ tool permissions, and comparable container, hardware, region, and concurrency
35
+ constant. The harness is the treatment variable. If a factor cannot be held
36
+ constant, the report must label the result non-comparative.
37
+
38
+ Every comparative report must include:
39
+
40
+ - the date, harness versions, and **named comparison cohort**, with its inclusion rule frozen before execution;
41
+ - immutable model, provider, container, environment, and configuration identities;
42
+ - the task manifest, seeds, public prompt or sanitized prompt digest, budgets, run order, and stop policy;
43
+ - sanitized per-task outcomes plus cost, token, latency, retry, and intervention data;
44
+ - the confidence interval, significance threshold, minimum effect, and statistical test chosen before inspecting the result;
45
+ - the exact commands and immutable manifests needed for **reproducible evidence**.
46
+
47
+ Use paired A/B measurements. Randomize or interleave pair order when provider or
48
+ machine drift can bias one side. Do not combine values produced by different
49
+ methods, working directories, task revisions, or warm/cold conditions. A
50
+ roadmap projection remains a hypothesis even when its inputs are measured.
51
+
52
+ ### Evidence privacy
53
+
54
+ Benchmark evidence is private by default. Public artifacts may contain public
55
+ or synthetic task identifiers, version and image digests, allowlisted runtime
56
+ metadata, sanitized outcomes, and aggregate statistics. They must not contain
57
+ credentials, private prompts, proprietary source, raw tool arguments or output,
58
+ environment values, personal data, or absolute user paths.
59
+
60
+ Keep restricted raw evidence local or in an access-controlled store with an
61
+ explicit owner and retention period. Normalize paths, redact content, scan for
62
+ secrets and PII, and obtain human approval before publication. Digests and
63
+ public task manifests preserve reproducibility without disclosing restricted
64
+ content.
65
+
66
+ A public “SOTA,” “best,” “leading,” or “#1” claim requires a dated controlled
67
+ comparison that places OMK on the relevant quality/cost/latency frontier without
68
+ violating declared safety and regression floors. Until then, use “targets
69
+ state-of-the-art quality.”
70
+
71
+ [Harbor's Terminal-Bench runner](https://www.harborframework.com/docs/tutorials/running-terminal-bench)
72
+ and the [SWE-bench containerized harness](https://www.swebench.com/SWE-bench/api/harness/)
73
+ are reference evaluation surfaces. Their presence or a selected task list is
74
+ infrastructure, not a benchmark result.
75
+
6
76
  This is separate from the two things that already existed:
7
77
 
8
78
  | Surface | Purpose |
@@ -83,5 +153,7 @@ node scripts/tb-mini-suite.mjs --seed 7 # a different fixed subset
83
153
 
84
154
  Selection is a pure function of (tasks directory, seed, size): the same inputs
85
155
  always produce the same task list, which is the whole point of using it as a
86
- regression gate. The scoring run itself requires Docker, `harbor`, and real
87
- model spend — it is deliberately not wired into `npm run check`.
156
+ regression gate. Selection alone is not a capability result. The scoring run
157
+ itself requires Docker, `harbor`, and real model spend — it is deliberately not
158
+ wired into `npm run check`. Any comparison produced from it must follow the
159
+ controlled comparison contract above.
@@ -6,6 +6,7 @@ OMK can recover an agent turn from provider failures that are unlikely to succee
6
6
  - billing-cycle or quota exhaustion
7
7
  - orphaned `tool_call_id` protocol errors
8
8
  - transient transport and server failures
9
+ - gateway/upstream availability failures (5xx passthroughs, streams that end without a finish reason)
9
10
 
10
11
  This is availability behavior, not a safety bypass. Provider safety policy and the user's configured model access remain authoritative.
11
12
 
@@ -53,6 +54,8 @@ A content/safety stop gets at most one automatic retry, including a retry that s
53
54
 
54
55
  Recognized quota shapes include billing-cycle usage limits, `insufficient_quota`, exhausted balances, `GoUsageLimitError`, `FreeUsageLimitError`, and out-of-budget responses. These are classified as `provider.rate_limit`, even when a provider wraps them in HTTP 403.
55
56
 
57
+ Gateway/upstream availability failures — "503 Upstream request failed", "Endpoint is unavailable", or a stream that ended without a finish reason — are classified as `provider.network`: transport problems that heal by retry or model switch, never by transcript sanitization.
58
+
56
59
  The default candidate order is:
57
60
 
58
61
  1. `kimi-coding/k3`
@@ -63,6 +66,14 @@ The default candidate order is:
63
66
  6. `modelstudio-maas/deepseek-v4-pro`
64
67
  7. `kimi-coding/kimi-for-coding`
65
68
 
69
+ ## Same-model route rotation
70
+
71
+ The same underlying model is often served by several provider routes (for example `openrouter/stealth/ox-alpha` and `opencode-go/ox-alpha-free`). When the active route fails with an upstream availability error, OMK rotates to another authenticated route of the same model family before touching the cross-model failover chain, so the retry lands on a live endpoint instead of hammering the dead one.
72
+
73
+ Routes already visited this turn and routes without configured authentication are excluded from rotation. Route rotation runs inside the normal retry budget; when no sibling route remains, the standard failover behavior applies.
74
+
75
+ Compaction summarization reuses the same chain: when the summarization model hits quota/billing exhaustion, the configured failover candidates are tried once each before the run fails with a non-retryable `compaction.quota_exhausted` termination cause. See [Compaction](compaction.md).
76
+
66
77
  ## Retry and termination events
67
78
 
68
79
  Each provider attempt is journaled separately and emits `session_termination`. A retryable failure is attempt-level when an `auto_retry_start` event follows it. A recovered retry later emits a `completed` termination; an exhausted retry budget leaves the last provider failure as the final termination.
@@ -0,0 +1,359 @@
1
+ # Runtime Algorithms and Direction
2
+
3
+ This page separates OMK's released behavior from internal mechanisms, current
4
+ working-tree candidates, and proposals. Source and tests remain authoritative.
5
+
6
+ - **Snapshot date:** 2026-08-27
7
+ - **Released baseline:** OMK `v0.97.0` (`b38a2c8c84`)
8
+ - **Repository baseline:** `4b79c65eaf` plus the local working tree
9
+
10
+ ## Status vocabulary
11
+
12
+ | Status | Meaning |
13
+ | --- | --- |
14
+ | **Released / default** | Present in `v0.97.0` and selected when relevant settings do not override it |
15
+ | **Released / opt-in** | Present in `v0.97.0`, but requires a command, setting, or explicit API call |
16
+ | **Released / internal** | Implemented and tested, but not connected to a live user path |
17
+ | **Working tree** | Present in the current checkout only; not shipped and not a release promise |
18
+ | **Proposed** | Design direction without a complete implementation and verification path |
19
+
20
+ A mechanism's existence does not make it authoritative. OMK promotes a mechanism
21
+ only after its live call path, default, evidence, and rollback are all explicit.
22
+
23
+ ## Runtime control path
24
+
25
+ ```text
26
+ Prompt or durable-goal round
27
+ -> system-prompt assembly
28
+ -> Context Budget V2 when globally enabled
29
+ -> local v4 reasoning routing when /think auto is active
30
+ -> provider attempt
31
+ -> same-family route rotation, retry, or configured failover when eligible
32
+ -> tool scheduling
33
+ -> v0.97.0 CLI default: dag-v2; direct core fallback is revision-specific
34
+ -> pre-hook claims -> deferred authorization -> post-hook claim re-plan
35
+ -> deterministic level execution and source-order results
36
+ -> journals, receipts, and session termination records
37
+ -> optional omk-protocol evaluation
38
+ TaskSpec -> ExecutionAttempt -> Observation -> EvaluationResult -> RuntimeDecision
39
+ -> retry, continuation, or final prompt settlement
40
+ ```
41
+
42
+ The protocol line is a released library and adapter surface. An ordinary chat
43
+ turn does not automatically become a `TaskSpec`; callers opt into that semantic
44
+ evaluation contract.
45
+
46
+ ## Current algorithm surface
47
+
48
+ ### Tool scheduling and settlement
49
+
50
+ **Status: Released / default.** The `v0.97.0` CLI sets `dag-v2`; direct
51
+ `omk-agent-core` calls fall back to `waves-v1`. The working tree changes that
52
+ core fallback to `dag-v2`, but that promotion is unreleased. The scheduler canonicalizes resource claims, preserves source order,
53
+ and places conflicting calls in later levels. Before a level executes, OMK authorizes its calls and
54
+ re-plans with post-hook arguments so a hook cannot silently invalidate the
55
+ original claim plan.
56
+
57
+ The live executor uses level barriers. `assignDagDependencies()` computes a
58
+ finer predecessor graph, but no live executor consumes it. Each candidate level
59
+ is authorized and then re-planned from post-hook arguments.
60
+
61
+ Evidence:
62
+
63
+ - `packages/agent/src/tool-dag-scheduler.ts`: `assignDagLevels`,
64
+ `assignDagDependencies`, `scheduleDagLevels`
65
+ - `packages/agent/src/agent-loop.ts`: `executeToolCallsDagLevels`,
66
+ `runDagLevelCalls`
67
+ - `packages/agent/test/tool-dag-scheduler*.test.ts`
68
+ - `packages/agent/test/tool-dag-dependencies.test.ts`
69
+
70
+ **Working tree:** timed-out tools receive a bounded 250 ms teardown window. A
71
+ cooperative process may settle and let the model react to the timeout; a tool
72
+ still running after the window stops the run because it may still mutate the
73
+ workspace. This candidate lives in
74
+ `packages/agent/src/tool-timeout-settlement.ts` and is covered by
75
+ `packages/agent/test/tool-timeout-loop-continuation.test.ts`.
76
+
77
+ ### Context selection
78
+
79
+ **Status: Released / opt-in.** Context Budget V2 is enabled globally through
80
+ `contextBudget.enabled` or per process with `OMK_CONTEXT_GOVERNOR=1`.
81
+
82
+ The planner:
83
+
84
+ 1. reserves response and safety tokens;
85
+ 2. pins hard or required items first;
86
+ 3. computes tier floors and ceilings;
87
+ 4. scores optional items for relevance, recency, evidence, redundancy,
88
+ priority, and full-text token cost;
89
+ 5. sorts optional items by
90
+ `density -> effectiveScore -> priorityRank -> fullTokens -> id`; and
91
+ 6. selects a full, summary, headroom-compressed, pointer, or omitted
92
+ representation that fits.
93
+
94
+ Density divides effective score by the cheapest non-omit representation
95
+ (`admissibleTokens`), not by full-text size. This avoids penalizing an item that
96
+ can be represented by a small evidence pointer. Stable item IDs and explicit
97
+ selection policy `sel-2` make tie-breaking and plan-cache invalidation
98
+ deterministic.
99
+
100
+ When enabled, representation and negative-result entries persist under
101
+ `.omk/cache/context-budget-v2`; plan entries remain session-memory-only.
102
+ `OMK_CONTEXT_GOVERNOR_CACHE=memory` keeps every cache entry in session memory,
103
+ and `OMK_CONTEXT_GOVERNOR_CACHE_DIR` relocates the representation snapshot.
104
+
105
+ Evidence:
106
+
107
+ - `packages/coding-agent/src/core/context-budget-v2-planner.ts`
108
+ - `packages/coding-agent/src/core/context-budget-v2-scoring.ts`
109
+ - `packages/coding-agent/src/core/context-budget-v2-selection.ts`
110
+ - `packages/coding-agent/test/context-budget-v2-knapsack-order.test.ts`
111
+ - `packages/coding-agent/test/context-budget-selection-policy-version.test.ts`
112
+ - `packages/coding-agent/test/context-budget-cache-disk.test.ts`
113
+
114
+ **Working tree:** context files now treat their global/local relevance baseline
115
+ as a floor. Lexical overlap can raise that score but cannot demote standing
116
+ instructions below the no-query baseline. Skills remain topic-scored because
117
+ they are optional capabilities, not standing authority. The change is in
118
+ `scoreContextFileRelevance()` with regression coverage in
119
+ `packages/coding-agent/test/context-budget-relevance.test.ts`.
120
+
121
+ **Working tree:** the default compactor now strips model-generated managed-rule
122
+ sections and deterministically carries explicit user-authored `RULE`/
123
+ `INVARIANT`/`CONSTRAINT`/`MUST`/`NEVER`/`ALWAYS` markers (plus explicit Korean
124
+ markers) outside LLM rewriting. Rules are bounded to 64 × 1,000 characters,
125
+ stored in additive non-hook compaction details, and covered by a five-round
126
+ byte-preservation test. Natural-language classification, hook summaries, branch
127
+ summaries, and cross-session memory remain outside this slice. Persisted rules
128
+ are credential-redacted and source-bound to a user entry/line/digest; previous
129
+ details are reused only when their canonical block matches the prior summary.
130
+
131
+ Evidence:
132
+
133
+ - `packages/coding-agent/src/core/compaction/knowledge-triage.ts`
134
+ - `packages/coding-agent/test/compaction-knowledge-triage.test.ts`
135
+ - `packages/coding-agent/test/compaction-summary-reasoning.test.ts`
136
+
137
+ ### Reasoning routing
138
+
139
+ **Status: Released / opt-in.** `/think auto` uses the local, deterministic v4
140
+ router. It extracts bounded prompt features, classifies one of seven task
141
+ classes, maps the class through `TASK_CLASS_THINKING_LEVELS`, applies lane
142
+ steps, bounded bias/hint adjustments, and non-negative uncertainty escalation,
143
+ then clamps the result to the selected model's supported levels.
144
+
145
+ The released extension-signal coefficients are active and bounded:
146
+ `multiTurnPrior=2`, `pressureBucket=1`, and `judgeVote=2`. History and pressure
147
+ are supplied by the main session; a judge vote affects only callers that provide
148
+ one. A zero-score fallback cannot be hijacked by these signals.
149
+
150
+ The optional learning path is global-only and off by default. When enabled, a
151
+ session loads one strictly validated `RouterBiasSnapshot` from the configured
152
+ path or repository-scoped default, pins that snapshot or miss for the session,
153
+ applies a `-2..2` step bias, and writes only bounded feedback buckets. It never stores prompts, diffs, tool
154
+ output, provider payloads, or repository paths.
155
+
156
+ Evidence:
157
+
158
+ - `packages/coding-agent/src/core/reasoning-router-v4.ts`
159
+ - `packages/coding-agent/src/core/reasoning-router-resolver.ts`
160
+ - `packages/coding-agent/src/core/reasoning-router-bias.ts`
161
+ - `packages/coding-agent/test/suite/regressions/013-reasoning-router-v4-accuracy.test.ts`
162
+ - `packages/coding-agent/test/suite/regressions/014-reasoning-router-v4-learning-wiring.test.ts`
163
+ - `packages/coding-agent/test/suite/regressions/018-reasoning-router-v4-inert-weights.test.ts`
164
+
165
+ **Working tree:** promotion evidence now credits a row only when repeated
166
+ baseline and candidate classifier replays each agree. It also requires a frozen
167
+ baseline and fails closed on insufficient or unstable replays. See
168
+ `reasoning-router-replay-stability.ts`, `reasoning-router-policy-ceiling.test.ts`,
169
+ and `reasoning-router-replay-stability.test.ts`.
170
+
171
+ ### Resource governance, lanes, and shards
172
+
173
+ The resource plane probes memory, workspace disk, V8 heap, and system CPU, then
174
+ produces bounded admission caps.
175
+
176
+ | Mechanism | Status | Authority |
177
+ | --- | --- | --- |
178
+ | Prompt-time probe, admission decision, and journal | Released / default | Observe and record |
179
+ | `/resource` and `omk doctor resources` | Released / opt-in | Inspect current policy and probe state |
180
+ | `omk doctor resources --report` | Working tree | Aggregate bounded local admission evidence; never promotes mode |
181
+ | Per-run tool cap and governed heavy-process permits | Released / opt-in | Enforced in `adaptive` or `strict` mode |
182
+ | `launchSubagentLanes()` | Released / internal | No live child-dispatch consumer |
183
+ | Journaled Vitest/Jest/workspace/Go shard executor | Released / internal | No `autoShard` setting or session-command consumer |
184
+
185
+ `observe` remains the default. Admission caps never raise configured caps.
186
+ Corrupt shard journals are quarantined and block resume; completed shards may be
187
+ skipped, but shard completion is only evidence and never a task verdict.
188
+
189
+ Evidence:
190
+
191
+ - `packages/coding-agent/src/core/resource-admission.ts`
192
+ - `packages/coding-agent/src/core/resource-governor-settings.ts`
193
+ - `packages/coding-agent/src/core/run-resource-lease.ts`
194
+ - `packages/coding-agent/src/commands/resource-doctor-cli.ts`
195
+ - `packages/coding-agent/src/core/resource-observation-report.ts`
196
+ - `packages/coding-agent/test/resource-observation-report.test.ts`
197
+ - `packages/coding-agent/src/core/subagent-lane-launcher.ts
198
+ - `packages/coding-agent/src/core/workload-shard-executor.ts`
199
+ - `packages/coding-agent/test/resource-admission.test.ts`
200
+ - `packages/coding-agent/test/resource-doctor-cli.test.ts`
201
+ - `packages/coding-agent/test/agent-session-resource-lease.test.ts`
202
+ - `packages/coding-agent/test/agent-session-resource-permits.test.ts`
203
+ - `packages/coding-agent/test/subagent-lane-launcher.test.ts`
204
+ - `packages/coding-agent/test/workload-shard-executor.test.ts`
205
+
206
+ ### Terminal settlement notifications
207
+
208
+ **Status: Working tree.** `v0.97.0` released completion sound as opt-in and
209
+ suppressed user aborts. The current working tree enables it by default on an
210
+ interactive TTY and adds an `onAbort` outcome switch. Successful prompts retain
211
+ the 5-second duration floor; failed and aborted/stopped outcomes notify
212
+ immediately.
213
+
214
+ The sound consumes only `prompt_settled`, never intermediate `agent_end`. The
215
+ current live path drains provider attempts, tools, and queued continuations;
216
+ subagent work is awaited inside its tool call. The settlement reducer reserves
217
+ direct child/shard counters, but no production signal call wires them yet, so
218
+ future live lanes/shards must close that gap before activation.
219
+ RPC, JSON, print mode, and CI remain silent. Playback uses fixed absolute
220
+ executable/argv pairs, a minimal environment without inherited `PATH` or
221
+ credentials, and a neutral temporary cwd. WSL uses BEL rather than resolving
222
+ PowerShell through `PATH`. Playback is fire-and-forget and cannot change the
223
+ prompt outcome.
224
+
225
+ Evidence:
226
+
227
+ - `packages/coding-agent/src/core/prompt-settlement.ts`
228
+ - `packages/coding-agent/src/core/completion-sound.ts`
229
+ - `packages/coding-agent/src/core/completion-sound-io.ts`
230
+ - `packages/coding-agent/test/prompt-settlement.test.ts`
231
+ - `packages/coding-agent/test/completion-sound.test.ts`
232
+ - `packages/coding-agent/test/suite/agent-session-retry-events.test.ts`
233
+
234
+ ### Evidence, decisions, and recovery
235
+
236
+ **Status: Released / opt-in.** The explicit `omk-protocol` API provides versioned,
237
+ readonly record contracts and runtime parsers for tasks, attempts, observations,
238
+ evaluations, waivers, and runtime decisions. `evaluateTask()` is pure. Among
239
+ unwaived required claims, any violation yields `fail`; otherwise missing
240
+ evidence yields `inconclusive`; otherwise the verdict is `pass`. A task with no
241
+ required claims is `inconclusive`; explicit waivers remove their claims from
242
+ verdict reduction. Advisory judging can choose among candidates that already
243
+ passed; it cannot create evidence or change a semantic verdict.
244
+
245
+ The coding-agent adds evidence receipts, a replay ledger, workspace
246
+ fingerprints, attempt journals, durable goals, seam checkpoints, session doctor,
247
+ and bounded provider retry/failover. Digests detect mismatch; they do not prove
248
+ runner honesty, OS isolation, freshness, or trusted authorship by themselves.
249
+
250
+ Evidence:
251
+
252
+ - `packages/protocol/src/evaluation.ts`: `evaluateTask`
253
+ - `packages/protocol/src/decision.ts`: `reduceRuntimeDecision`
254
+ - `packages/protocol/test/protocol.test.ts`
255
+ - `packages/coding-agent/src/core/advisory-judge.ts`
256
+ - `packages/coding-agent/test/advisory-judge.test.ts`
257
+
258
+ See [Run Protocol and Durable Goals](run-protocol.md),
259
+ [Sessions](sessions.md), [Provider Resilience](provider-resilience.md), and
260
+ [Turn Metrics](metrics.md).
261
+
262
+ ### AdaptOrch and WPL boundary
263
+
264
+ **Status: Released / opt-in.** Published `omk-adaptorch-wpl` supplies typed packet state, client, adjudication, and
265
+ verdict-projection primitives. Its `loop.ts` explicitly excludes end-to-end
266
+ `adaptorch_run` dispatch, polling, request assembly, and persistence. The
267
+ coding-agent has no production importer that turns those primitives into a
268
+ default execution loop; the Correctness Wall remains an explicitly loaded
269
+ example extension. The default-off AdaptOrch reasoning bridge currently returns
270
+ no advisory hint.
271
+
272
+ Evidence:
273
+
274
+ - `packages/adaptorch-wpl/src/loop.ts`
275
+ - `packages/adaptorch-wpl/test/loop.test.ts`
276
+ - `packages/coding-agent/src/core/adaptorch-bridge.ts`
277
+ - `packages/coding-agent/test/suite/regressions/011-reasoning-router-adaptorch-bridge.test.ts`
278
+ - `packages/coding-agent/test/suite/regressions/012-reasoning-router-learning-adaptorch-activation.test.ts`
279
+
280
+ See [AdaptOrch Preview](adaptorch-preview.md) and
281
+ [Correctness Wall](correctness-wall.md).
282
+
283
+ ### Repository understanding
284
+
285
+ **Status: Working tree.** The `v0.97.0` release shipped policy/workflow only and
286
+ still ignored `/openwiki/` and contained neither the corpus nor its checker.
287
+ Neither the release tag nor the current Git index tracks `openwiki/` or
288
+ `.understand-anything/`; both datasets are untracked or ignored advisory state.
289
+ The current `.last-update.json` says `interrupted` at current HEAD.
290
+
291
+ `scripts/check-openwiki.mjs` validates entry pages, internal links, update-state
292
+ shape, and global symbol-name presence in a source/test/script haystack. It does
293
+ not validate prose or bind each symbol to a declared source path. A current-HEAD
294
+ `interrupted` generation warns; a stale interrupted generation blocks. Source
295
+ and tests outrank every generated page. There is no dedicated checker test in
296
+ the current working tree; the executable checker is the available evidence.
297
+
298
+ This is not a release-grade trust gate: the current corpus is `interrupted`,
299
+ symbol checks are global substrings rather than declared source bindings, and
300
+ the generation workflow still needs an output allowlist plus pre-upload secret
301
+ and private-path scans. Do not load the corpus as trusted context until those
302
+ blockers close.
303
+
304
+ ## Direction
305
+
306
+ **Status: Proposed.** Owning specification:
307
+ `specs/015-runtime-algorithm-direction/spec.md`. This section creates no runtime
308
+ or test evidence; the internal mechanisms above do not satisfy these promotion
309
+ gates. Apply them in order:
310
+
311
+ 1. **Measure before promoting authority.** Run dated, same-model, same-provider,
312
+ same-task comparisons before changing defaults or making leadership claims.
313
+ The protocol in [Turn Metrics](metrics.md) is mandatory.
314
+ 2. **Reduce structure before adding mechanisms.** Do not raise module-size,
315
+ dependency-tree, or import-cycle baselines. The dependency-tree and import-
316
+ cycle gates are working-tree changes. Split large session and interactive
317
+ modules by ownership; do not mix movement-only refactors with behavior.
318
+ 3. **Promote live authority in stages.** Collect resource observations before
319
+ making `adaptive` the default. Wire subagent lanes before exposing automatic
320
+ sharding. Keep automatic sharding opt-in and limited to known, semantically
321
+ equivalent command families.
322
+ 4. **Protect standing context.** The relevance floor and explicit-rule
323
+ compaction slice are Worktree-only. Broader natural-language, hook, and branch
324
+ triage still require evidence before expansion.
325
+ 5. **Design verified memory before implementing it.** Spec 019 requires
326
+ evidence-linked admission, Context Budget V2 data-only injection, source-span
327
+ provenance, staleness, and memory-injection probes. Implementation remains
328
+ blocked until fixtures and evaluation thresholds are preregistered.
329
+ 6. **Keep adaptation evidence-gated.** Do not add online router learning while
330
+ the current instrument cannot show gain after `BIAS_STRONG_THRESHOLD=5`.
331
+ Reopen only through an `advance` spec that preregisters the real outcome-
332
+ linked sample, sample size, minimum effect, confidence rule, and statistical
333
+ test before collecting the promotion result.
334
+ 7. **Keep hosted advice separate from local authority.** AdaptOrch remains a
335
+ separate service and any bridge remains advisory; local deterministic gates
336
+ own execution and completion.
337
+
338
+ ## Deliberate non-goals
339
+
340
+ - Calling a level-barrier schedule an eager critical-path executor
341
+ - Treating internal lane or shard code as a live feature
342
+ - Auto-sharding arbitrary shell, deploy, publish, release, or migration commands
343
+ - Treating model narration, reviewer opinion, or a digest alone as completion
344
+ - Persisting unrestricted prompts or trajectories as learning memory
345
+ - Claiming SOTA from tests, feature counts, self-scores, or roadmap projections
346
+
347
+ ## Verification map
348
+
349
+ | Claim | Fast verification |
350
+ | --- | --- |
351
+ | Documentation links resolve | `npm run check:doc-links` |
352
+ | Specification governance holds | `npm run check:constitution` |
353
+ | Context selection behavior | focused context-budget tests named above |
354
+ | Router behavior and promotion ceiling | focused reasoning-router tests named above |
355
+ | Tool scheduling and timeout candidate | focused `packages/agent` scheduler/timeout tests |
356
+ | Resource and internal execution mechanisms | focused resource, lane, and shard tests named above |
357
+
358
+ A green focused test proves only its declared behavior. Release readiness still
359
+ requires the repository's full release gates.