@mcoda/codali 0.1.135-codali.2 → 0.1.135-codali.29

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 (246) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/ORCHESTRATION.md +308 -2
  3. package/README.md +184 -7
  4. package/config/AGENTS.md +11 -0
  5. package/config/deterministic/install-python.mjs +16 -0
  6. package/config/deterministic/node-worker.mjs +77 -0
  7. package/config/deterministic/python-worker.py +222 -0
  8. package/config/deterministic/requirements.txt +6 -0
  9. package/config/docdex-tools-0.2.99.json +3977 -0
  10. package/config/documents/install-python.mjs +16 -0
  11. package/config/documents/requirements.txt +10 -0
  12. package/config/documents/worker.py +267 -0
  13. package/config/orchestration.schema.json +94 -3
  14. package/config/skills/planning/SKILL.md +13 -0
  15. package/config/terminal-long-scenarios.v1.json +3 -2
  16. package/dist/cli/TerminalArtifacts.d.ts +5 -0
  17. package/dist/cli/TerminalArtifacts.d.ts.map +1 -0
  18. package/dist/cli/TerminalArtifacts.js +26 -0
  19. package/dist/cli/TerminalCommand.d.ts.map +1 -1
  20. package/dist/cli/TerminalCommand.js +411 -75
  21. package/dist/cli/TerminalCredentials.js +2 -2
  22. package/dist/cli/TerminalInput.d.ts +13 -0
  23. package/dist/cli/TerminalInput.d.ts.map +1 -1
  24. package/dist/cli/TerminalInput.js +55 -7
  25. package/dist/cli/TerminalModels.d.ts +6 -0
  26. package/dist/cli/TerminalModels.d.ts.map +1 -0
  27. package/dist/cli/TerminalModels.js +45 -0
  28. package/dist/cli/TerminalPlan.d.ts +40 -0
  29. package/dist/cli/TerminalPlan.d.ts.map +1 -0
  30. package/dist/cli/TerminalPlan.js +37 -0
  31. package/dist/cli/ToolsCommand.d.ts.map +1 -1
  32. package/dist/cli/ToolsCommand.js +8 -1
  33. package/dist/cli/tui/TerminalCells.d.ts +6 -0
  34. package/dist/cli/tui/TerminalCells.d.ts.map +1 -0
  35. package/dist/cli/tui/TerminalCells.js +47 -0
  36. package/dist/cli/tui/TerminalEditor.d.ts +22 -0
  37. package/dist/cli/tui/TerminalEditor.d.ts.map +1 -0
  38. package/dist/cli/tui/TerminalEditor.js +88 -0
  39. package/dist/cli/tui/TerminalLogo.d.ts +6 -0
  40. package/dist/cli/tui/TerminalLogo.d.ts.map +1 -0
  41. package/dist/cli/tui/TerminalLogo.js +26 -0
  42. package/dist/cli/tui/TerminalMarkdown.d.ts +5 -0
  43. package/dist/cli/tui/TerminalMarkdown.d.ts.map +1 -0
  44. package/dist/cli/tui/TerminalMarkdown.js +118 -0
  45. package/dist/cli/tui/TerminalPresentation.d.ts +4 -0
  46. package/dist/cli/tui/TerminalPresentation.d.ts.map +1 -0
  47. package/dist/cli/tui/TerminalPresentation.js +77 -0
  48. package/dist/cli/tui/TerminalScreen.d.ts +50 -0
  49. package/dist/cli/tui/TerminalScreen.d.ts.map +1 -0
  50. package/dist/cli/tui/TerminalScreen.js +137 -0
  51. package/dist/cli/tui/TerminalSelection.d.ts +15 -0
  52. package/dist/cli/tui/TerminalSelection.d.ts.map +1 -0
  53. package/dist/cli/tui/TerminalSelection.js +38 -0
  54. package/dist/cli/tui/TerminalTui.d.ts +82 -0
  55. package/dist/cli/tui/TerminalTui.d.ts.map +1 -0
  56. package/dist/cli/tui/TerminalTui.js +553 -0
  57. package/dist/cli.d.ts.map +1 -1
  58. package/dist/cli.js +5 -3
  59. package/dist/config/OrchestrationConfig.d.ts +33 -0
  60. package/dist/config/OrchestrationConfig.d.ts.map +1 -1
  61. package/dist/config/OrchestrationConfig.js +59 -1
  62. package/dist/connectors/media/MediaJobStore.d.ts +2 -1
  63. package/dist/connectors/media/MediaJobStore.d.ts.map +1 -1
  64. package/dist/connectors/media/MediaJobStore.js +11 -3
  65. package/dist/docdex/DocdexCatalog.d.ts +12 -0
  66. package/dist/docdex/DocdexCatalog.d.ts.map +1 -0
  67. package/dist/docdex/DocdexCatalog.js +30 -0
  68. package/dist/docdex/DocdexClient.d.ts +8 -2
  69. package/dist/docdex/DocdexClient.d.ts.map +1 -1
  70. package/dist/docdex/DocdexClient.js +86 -11
  71. package/dist/docdex/ManagedDocdex.d.ts +1 -0
  72. package/dist/docdex/ManagedDocdex.d.ts.map +1 -1
  73. package/dist/docdex/ManagedDocdex.js +25 -4
  74. package/dist/eval/TerminalWorkflowCorpus.d.ts +1 -1
  75. package/dist/eval/TerminalWorkflowCorpus.d.ts.map +1 -1
  76. package/dist/eval/TerminalWorkflowCorpus.js +9 -6
  77. package/dist/eval/TrustBenchmark.d.ts +94 -0
  78. package/dist/eval/TrustBenchmark.d.ts.map +1 -0
  79. package/dist/eval/TrustBenchmark.js +199 -0
  80. package/dist/eval/fixtures/ContractReviewProvider.d.ts +4 -0
  81. package/dist/eval/fixtures/ContractReviewProvider.d.ts.map +1 -0
  82. package/dist/eval/fixtures/ContractReviewProvider.js +10 -0
  83. package/dist/eval/fixtures/MixedMediaRecoveryJourney.d.ts +6 -0
  84. package/dist/eval/fixtures/MixedMediaRecoveryJourney.d.ts.map +1 -0
  85. package/dist/eval/fixtures/MixedMediaRecoveryJourney.js +145 -0
  86. package/dist/eval/fixtures/TerminalRecoveryJourney.d.ts.map +1 -1
  87. package/dist/eval/fixtures/TerminalRecoveryJourney.js +14 -1
  88. package/dist/index.d.ts +1 -0
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +1 -0
  91. package/dist/permissions/PermissionGate.d.ts +1 -1
  92. package/dist/permissions/PermissionGate.d.ts.map +1 -1
  93. package/dist/permissions/PermissionGate.js +40 -2
  94. package/dist/permissions/WorkspacePermissions.d.ts +11 -0
  95. package/dist/permissions/WorkspacePermissions.d.ts.map +1 -0
  96. package/dist/permissions/WorkspacePermissions.js +42 -0
  97. package/dist/providers/ConfiguredModelScope.d.ts +1 -0
  98. package/dist/providers/ConfiguredModelScope.d.ts.map +1 -1
  99. package/dist/providers/ConfiguredModelScope.js +17 -1
  100. package/dist/providers/ConfiguredProvider.d.ts +5 -0
  101. package/dist/providers/ConfiguredProvider.d.ts.map +1 -1
  102. package/dist/providers/ConfiguredProvider.js +38 -5
  103. package/dist/providers/ModelServiceError.d.ts +7 -2
  104. package/dist/providers/ModelServiceError.d.ts.map +1 -1
  105. package/dist/providers/ModelServiceError.js +28 -4
  106. package/dist/providers/OpenAiCompatibleProvider.d.ts.map +1 -1
  107. package/dist/providers/OpenAiCompatibleProvider.js +9 -1
  108. package/dist/providers/ProviderTypes.d.ts +2 -0
  109. package/dist/providers/ProviderTypes.d.ts.map +1 -1
  110. package/dist/providers/RequestUsage.d.ts +11 -0
  111. package/dist/providers/RequestUsage.d.ts.map +1 -0
  112. package/dist/providers/RequestUsage.js +33 -0
  113. package/dist/runtime/CodaliRuntime.d.ts +1 -0
  114. package/dist/runtime/CodaliRuntime.d.ts.map +1 -1
  115. package/dist/runtime/CodaliRuntime.js +1 -0
  116. package/dist/runtime/ComputedAnswer.d.ts +13 -0
  117. package/dist/runtime/ComputedAnswer.d.ts.map +1 -0
  118. package/dist/runtime/ComputedAnswer.js +75 -0
  119. package/dist/runtime/ContextCompression.d.ts +22 -0
  120. package/dist/runtime/ContextCompression.d.ts.map +1 -0
  121. package/dist/runtime/ContextCompression.js +53 -0
  122. package/dist/runtime/InspectionBudget.d.ts +8 -0
  123. package/dist/runtime/InspectionBudget.d.ts.map +1 -0
  124. package/dist/runtime/InspectionBudget.js +25 -0
  125. package/dist/runtime/InteractionContract.d.ts +42 -0
  126. package/dist/runtime/InteractionContract.d.ts.map +1 -0
  127. package/dist/runtime/InteractionContract.js +50 -0
  128. package/dist/runtime/InteractionRouter.d.ts +71 -0
  129. package/dist/runtime/InteractionRouter.d.ts.map +1 -0
  130. package/dist/runtime/InteractionRouter.js +134 -0
  131. package/dist/runtime/PreparedDocdex.d.ts +4 -0
  132. package/dist/runtime/PreparedDocdex.d.ts.map +1 -0
  133. package/dist/runtime/PreparedDocdex.js +55 -0
  134. package/dist/runtime/PreparedMemory.d.ts +3 -0
  135. package/dist/runtime/PreparedMemory.d.ts.map +1 -0
  136. package/dist/runtime/PreparedMemory.js +30 -0
  137. package/dist/runtime/ReviewContract.d.ts +35 -0
  138. package/dist/runtime/ReviewContract.d.ts.map +1 -0
  139. package/dist/runtime/ReviewContract.js +132 -0
  140. package/dist/runtime/ReviewCoordinator.d.ts +41 -0
  141. package/dist/runtime/ReviewCoordinator.d.ts.map +1 -0
  142. package/dist/runtime/ReviewCoordinator.js +132 -0
  143. package/dist/runtime/ReviewSource.d.ts +3 -0
  144. package/dist/runtime/ReviewSource.d.ts.map +1 -1
  145. package/dist/runtime/ReviewSource.js +17 -1
  146. package/dist/runtime/Runner.d.ts.map +1 -1
  147. package/dist/runtime/Runner.js +6 -1
  148. package/dist/runtime/SessionController.d.ts +51 -1
  149. package/dist/runtime/SessionController.d.ts.map +1 -1
  150. package/dist/runtime/SessionController.js +1146 -112
  151. package/dist/runtime/TaskReview.d.ts +25 -0
  152. package/dist/runtime/TaskReview.d.ts.map +1 -0
  153. package/dist/runtime/TaskReview.js +109 -0
  154. package/dist/runtime/TaskReviewContext.d.ts +37 -0
  155. package/dist/runtime/TaskReviewContext.d.ts.map +1 -1
  156. package/dist/runtime/TaskReviewContext.js +18 -2
  157. package/dist/runtime/UsageReconciliation.d.ts +28 -0
  158. package/dist/runtime/UsageReconciliation.d.ts.map +1 -0
  159. package/dist/runtime/UsageReconciliation.js +68 -0
  160. package/dist/runtime/VerificationCommand.d.ts +2 -0
  161. package/dist/runtime/VerificationCommand.d.ts.map +1 -1
  162. package/dist/runtime/VerificationCommand.js +28 -0
  163. package/dist/runtime/VerificationReceiptSelection.d.ts +15 -0
  164. package/dist/runtime/VerificationReceiptSelection.d.ts.map +1 -0
  165. package/dist/runtime/VerificationReceiptSelection.js +30 -0
  166. package/dist/session/AtomicState.d.ts.map +1 -1
  167. package/dist/session/AtomicState.js +15 -1
  168. package/dist/session/InstructionLoader.d.ts +5 -1
  169. package/dist/session/InstructionLoader.d.ts.map +1 -1
  170. package/dist/session/InstructionLoader.js +65 -19
  171. package/dist/session/SessionStoragePath.d.ts.map +1 -1
  172. package/dist/session/SessionStoragePath.js +28 -16
  173. package/dist/session/SessionStore.d.ts +5 -1
  174. package/dist/session/SessionStore.d.ts.map +1 -1
  175. package/dist/session/SessionStore.js +11 -2
  176. package/dist/session/SkillCatalog.d.ts +33 -0
  177. package/dist/session/SkillCatalog.d.ts.map +1 -0
  178. package/dist/session/SkillCatalog.js +194 -0
  179. package/dist/session/WorkState.d.ts +9 -0
  180. package/dist/session/WorkState.d.ts.map +1 -1
  181. package/dist/session/WorkState.js +32 -0
  182. package/dist/session/WorkTypes.d.ts +8 -0
  183. package/dist/session/WorkTypes.d.ts.map +1 -1
  184. package/dist/tools/SemanticToolRetrieval.d.ts +19 -0
  185. package/dist/tools/SemanticToolRetrieval.d.ts.map +1 -0
  186. package/dist/tools/SemanticToolRetrieval.js +52 -0
  187. package/dist/tools/ToolRetrieval.d.ts +7 -0
  188. package/dist/tools/ToolRetrieval.d.ts.map +1 -0
  189. package/dist/tools/ToolRetrieval.js +25 -0
  190. package/dist/tools/browser/BrowserTool.d.ts +9 -0
  191. package/dist/tools/browser/BrowserTool.d.ts.map +1 -0
  192. package/dist/tools/browser/BrowserTool.js +152 -0
  193. package/dist/tools/browser/BrowserWorker.d.ts +2 -0
  194. package/dist/tools/browser/BrowserWorker.d.ts.map +1 -0
  195. package/dist/tools/browser/BrowserWorker.js +51 -0
  196. package/dist/tools/calculation/CalculatorTool.d.ts +5 -0
  197. package/dist/tools/calculation/CalculatorTool.d.ts.map +1 -0
  198. package/dist/tools/calculation/CalculatorTool.js +137 -0
  199. package/dist/tools/deterministic/DeterministicRuntime.d.ts +39 -0
  200. package/dist/tools/deterministic/DeterministicRuntime.d.ts.map +1 -0
  201. package/dist/tools/deterministic/DeterministicRuntime.js +98 -0
  202. package/dist/tools/deterministic/DeterministicTools.d.ts +8 -0
  203. package/dist/tools/deterministic/DeterministicTools.d.ts.map +1 -0
  204. package/dist/tools/deterministic/DeterministicTools.js +86 -0
  205. package/dist/tools/deterministic/node-worker.cjs +38 -0
  206. package/dist/tools/deterministic/python-worker.py +222 -0
  207. package/dist/tools/docdex/DocdexCatalogTools.d.ts +4 -0
  208. package/dist/tools/docdex/DocdexCatalogTools.d.ts.map +1 -0
  209. package/dist/tools/docdex/DocdexCatalogTools.js +58 -0
  210. package/dist/tools/docdex/DocdexTools.d.ts +2 -0
  211. package/dist/tools/docdex/DocdexTools.d.ts.map +1 -1
  212. package/dist/tools/docdex/DocdexTools.js +72 -105
  213. package/dist/tools/documents/DocumentRuntime.d.ts +12 -0
  214. package/dist/tools/documents/DocumentRuntime.d.ts.map +1 -0
  215. package/dist/tools/documents/DocumentRuntime.js +59 -0
  216. package/dist/tools/documents/DocumentTools.d.ts +19 -0
  217. package/dist/tools/documents/DocumentTools.d.ts.map +1 -0
  218. package/dist/tools/documents/DocumentTools.js +150 -0
  219. package/dist/tools/documents/worker.py +267 -0
  220. package/dist/tools/entities/AdesTool.d.ts +7 -0
  221. package/dist/tools/entities/AdesTool.d.ts.map +1 -0
  222. package/dist/tools/entities/AdesTool.js +59 -0
  223. package/dist/tools/research/TnlTool.d.ts +22 -0
  224. package/dist/tools/research/TnlTool.d.ts.map +1 -0
  225. package/dist/tools/research/TnlTool.js +246 -0
  226. package/dist/tools/shell/AsyncProcess.d.ts +3 -0
  227. package/dist/tools/shell/AsyncProcess.d.ts.map +1 -1
  228. package/dist/tools/shell/AsyncProcess.js +1 -1
  229. package/dist/tools/shell/HostToolchain.d.ts.map +1 -1
  230. package/dist/tools/shell/HostToolchain.js +18 -4
  231. package/dist/tools/shell/IsolatedExecutor.d.ts +3 -2
  232. package/dist/tools/shell/IsolatedExecutor.d.ts.map +1 -1
  233. package/dist/tools/shell/IsolatedExecutor.js +39 -5
  234. package/dist/tools/system/TimeTool.d.ts +4 -0
  235. package/dist/tools/system/TimeTool.d.ts.map +1 -0
  236. package/dist/tools/system/TimeTool.js +22 -0
  237. package/dist/tools/verification/JavaScriptVerificationTool.d.ts +47 -0
  238. package/dist/tools/verification/JavaScriptVerificationTool.d.ts.map +1 -0
  239. package/dist/tools/verification/JavaScriptVerificationTool.js +71 -0
  240. package/dist/tools/verification/JavaScriptVerificationWorker.d.ts +2 -0
  241. package/dist/tools/verification/JavaScriptVerificationWorker.d.ts.map +1 -0
  242. package/dist/tools/verification/JavaScriptVerificationWorker.js +91 -0
  243. package/dist/tools/verification/VitestTool.d.ts +3 -0
  244. package/dist/tools/verification/VitestTool.d.ts.map +1 -0
  245. package/dist/tools/verification/VitestTool.js +128 -0
  246. package/package.json +16 -5
package/CHANGELOG.md CHANGED
@@ -2,6 +2,59 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Unify dispatch/tool/output contracts and validate final replies across modes.
6
+ Add one budgeted, tool-free presentation repair, preserve execution evidence,
7
+ and share the versioned dispatcher prompt with live evaluations. Legacy router
8
+ prompts now supply semantic policy without replacing the response schema.
9
+ - Guide word-bound repairs toward an interior target while retaining exact user
10
+ limits and the single-repair budget; keep failed drafts when validation fails.
11
+ - Add a structured, history-aware tool-scope decision and withhold optional
12
+ calculation when the dispatcher does not explicitly allow tools. Preserve
13
+ host restrictions and record scope conflicts. Fix local skill discovery when
14
+ a workspace path resolves through platform aliases or symlinks.
15
+ - Record the separate 32-question regression and its prompt-template erratum;
16
+ it does not demonstrate better intelligence than raw Qwen.
17
+
18
+ - Add native Docdex repository/web investigation, bounded browser snapshots,
19
+ server time, progressive local skills with a bundled planning workflow, and
20
+ readable TUI tables with narrow-screen layouts.
21
+ - Preserve user constraints through automatic context compression; keep archived
22
+ content recoverable after resume/fork. Reserve final-answer capacity when
23
+ Docdex performs nested inference, and retain plan-writing tools under budget pressure.
24
+ - Label web summaries and unvisited discovery links separately from fetched
25
+ evidence. Preserve failed benchmark attempts; the original and R1 studies did
26
+ not establish the required quality improvement over raw Qwen.
27
+
28
+ - Honor `interaction.answerBinding` for read-only inspections as well as explanations.
29
+
30
+ - Prepare codali.17 with history-aware interaction dispatch before repository
31
+ execution. Greetings and questions no longer create coding tasks or reviewer
32
+ loops; configured small-model prompts prepare bounded stronger-model requests.
33
+ - Record private redacted request/model-response/final-outcome audit events,
34
+ preserve cumulative usage with bounded turn budgets, and remove transport
35
+ metadata from repeated model context. Conversation metadata v2 prevents older
36
+ clients from reinterpreting these sessions as coding jobs; v1 work sessions
37
+ remain readable.
38
+ - Add mouse-wheel scrollback that stays anchored during streaming, readable tool
39
+ activity and errors, and dedicated help/usage views. Preserve keyboard access,
40
+ approval controls and terminal restoration.
41
+
42
+ - Retry transient Windows state-file replacement conflicts without deleting the
43
+ previous state or suppressing permanent errors. Retain file durability checks.
44
+ - Resolve native macOS Git within the selected developer installation so sandboxed
45
+ repository inspection works without launching the Xcode wrapper.
46
+
47
+ ## 0.1.135-codali.3 - 2026-10-26
48
+
49
+ - Allow bounded Git diff/status inspection within the final validation budget;
50
+ keep edits blocked and require actual test evidence before verifying code.
51
+ - Disable terminal echo before displaying the API-key prompt, preventing fast
52
+ input from being echoed. Verify masked entry, backspace, cancellation, key
53
+ rotation, logout, credential-cache refresh and bounded piped input.
54
+
55
+ - Tagged candidate; publication was cancelled after Windows CI exposed a
56
+ transient state-file replacement failure addressed above.
57
+
5
58
  ## 0.1.135-codali.2 - 2026-10-26
6
59
 
7
60
  - Keep core tool definitions available across task handoffs, while requiring a
package/ORCHESTRATION.md CHANGED
@@ -1,5 +1,88 @@
1
1
  # Orchestration configuration
2
2
 
3
+ ## Native tools, skills and bounded context
4
+
5
+ The terminal controller exposes native function calls to capable configured models.
6
+ Read-only inspection uses Docdex for repository search, source reads and structural
7
+ analysis, and `docdex_web_research` for external research. Local searches use the
8
+ index-only batch endpoint; they cannot silently trigger web or model fallback.
9
+ Web calls pass the permission gate before starting the private Docdex runtime.
10
+ With an mswarm lead, discovery uses a capability-authenticated bridge owned by the
11
+ controller; the service credential is never written into the private daemon config.
12
+ An empty result does not automatically replay a metered web request.
13
+ Discovery links remain separate from fetched evidence, and generated summaries
14
+ are labeled. Nested Docdex inference respects its requested output limit and
15
+ cannot spend the token/call reserve needed for a final answer.
16
+ After the first native tool choice, inspection keeps related capability schemas
17
+ in context; other read tools remain available through discovery and explicit
18
+ enabling. This reduces repeated context without classifying prompts by keywords.
19
+
20
+ `server_time` reads the execution host clock, with UTC, Unix milliseconds and an
21
+ optional IANA timezone. `calculate` evaluates bounded numeric expressions without
22
+ running code. `browser_open` reads a rendered accessibility snapshot in an isolated
23
+ Chrome/Chromium process; `browser_read` pages through that captured snapshot without
24
+ another network request. The default snapshot covers the page's main landmark
25
+ when available; `scope: "page"` requests the whole page. Results retain valid bounded JSON and pagination
26
+ handles within the inspection loop's output limit.
27
+ Set `CODALI_BROWSER_PATH` to an absolute executable path
28
+ if automatic discovery cannot find Chrome. Browser navigation requires web
29
+ permission (`--allow-web` or an interactive approval); the planning permission
30
+ profile continues to allow read operations only. Browser contexts have no login
31
+ profile, block POST/form submissions, downloads, service workers and WebSockets,
32
+ and close after each navigation. Page content is untrusted evidence. This browser
33
+ surface supports reading and following URLs, not arbitrary browser automation.
34
+
35
+ Use `/skills` to inspect available `SKILL.md` packages. Codali discovers its bundled
36
+ planning skill, workspace `.codali/skills` and `.agents/skills`, and user
37
+ `~/.codali/skills`, `~/.agents/skills`, `~/.codex/skills` and `~/.claude/skills`.
38
+ Additional roots are configurable:
39
+
40
+ ```json
41
+ "skills": {
42
+ "enabled": true,
43
+ "directories": ["~/shared-agent-skills", ".team/skills"]
44
+ }
45
+ ```
46
+
47
+ Discovery is bounded to 128 skills, 256 directories and three directory levels.
48
+ Each text resource is limited to 64 KiB. Standard YAML `name` and `description`
49
+ metadata are required; optional `compatibility` is shown with the actual host
50
+ platform. A small workspace/builtin catalog enters tool-capable prompts;
51
+ `skill_list` discovers imported packages, `skill_load` reads instructions, and
52
+ `skill_read` retrieves referenced text in pages. Exact IDs disambiguate duplicate
53
+ names. Resources cannot escape their skill directory through traversal or
54
+ symlinks. Scripts and hooks never run automatically, and `allowed-tools` metadata
55
+ does not grant permission. A Mac-specific skill still needs its declared platform
56
+ and tools; loading its text does not provide those dependencies. Configuration
57
+ reload refreshes the skill roots.
58
+
59
+ The bundled planning skill uses durable goals, task dependencies, allowed paths,
60
+ decisions and verification receipts. Planning mode records future work and leaves
61
+ the implementation goal open. If inference budget runs out after a plan was
62
+ saved, the controller shows that record with an explicit partial-work notice;
63
+ it does not mark implementation complete. Markdown tables render as aligned boxes in the TUI,
64
+ or labeled fields on narrow screens, including in command overlays.
65
+
66
+ All model routes account for message content, tool schemas, response format,
67
+ reserved output and a context margin before dispatch. Near the configured model
68
+ window, deterministic compression shortens earlier assistant/tool content while
69
+ preserving user/system messages and native call/result identities. Conversation
70
+ history uses the same extractive approach instead of silently discarding older
71
+ user constraints. Abbreviated content identifies a saved source; `context_read`
72
+ recovers it in bounded pages or exact `offset`/`maxChars` spans, including after resume or conversation fork. Full
73
+ originals remain in the redacted private event transcript. The canonical work
74
+ record retains goals, requirements, decisions, pending tasks and verification
75
+ evidence. Compression makes no additional model calls and is not a semantic
76
+ summary. If immutable instructions and schemas cannot fit, the request fails
77
+ before dispatch with an actionable error rather than dropping constraints.
78
+
79
+ Design references: [Agent Skills specification](https://agentskills.io/specification),
80
+ [Playwright browser contexts](https://playwright.dev/docs/api/class-browsercontext),
81
+ [Playwright accessibility snapshots](https://playwright.dev/docs/api/class-page#page-aria-snapshot),
82
+ and [Browser Use browser configuration](https://docs.browser-use.com/open-source/customize/browser/basics).
83
+ These additions require separate installed/live qualification; the completed
84
+ original and R1 benchmark results remain frozen and did not pass quality promotion.
85
+
3
86
  The JSON file declares providers, model identities, role bindings, effort limits
4
87
  and task-control policy. It contains credential references, never secret values.
5
88
  The loader rejects unknown fields, undeclared models, alias cycles, unsafe URLs,
@@ -56,8 +139,16 @@ The Raijin/Suku example maps low to native `none`, medium to `low` with a
56
139
  request settings; `/status` and model-route events expose them without claiming
57
140
  that an older server applied them. Both the mSwarm proxy and node must contain
58
141
  the native-reasoning transport update before enabling this profile in service.
59
- The CLI checks the proxy's authenticated model catalog before reserving inference
60
- tokens. The selected model must advertise `native_reasoning.transport_version: 1`
142
+ The CLI checks the proxy's authenticated model catalog before dispatching inference.
143
+ Discovery, authentication, capability and context refusals release provisional
144
+ token reservations and persist a `not_dispatched` receipt across resume. Failures
145
+ after the transport handoff retain provisional usage until server reconciliation.
146
+ Read-only model and native-capability discovery may retry an explicit temporary
147
+ service failure twice, with bounded backoff. Authentication, entitlement, quota
148
+ and malformed-response failures are not retried. Server backoff longer than five
149
+ seconds is returned to the caller; inference submissions are never replayed by
150
+ this discovery policy.
151
+ The selected model must advertise `native_reasoning.transport_version: 1`
61
152
  and every requested parameter. The proxy publishes this contract for pinned nodes
62
153
  advertising `native_reasoning_transport_version: 1`, and rejects native requests to older
63
154
  nodes before dispatch. A generic `supports_reasoning` flag is insufficient.
@@ -102,6 +193,33 @@ embedding-space identity, and are reused on restart. The session also pins its
102
193
  space; an incompatible upgrade requires a separate index and session. Query and
103
194
  document receipts retain purpose, model, configuration hash and reported usage.
104
195
 
196
+ The terminal loads its packaged `config/AGENTS.md` guide, optional
197
+ `~/.codali/AGENTS.md` user instructions, `.codali/instructions.md`, workspace
198
+ `AGENTS.md` files from the root through focused directories, then
199
+ `.codali/local.md`. More specific instructions take precedence within their
200
+ scope; none can widen host permissions or authorize unrelated actions. These
201
+ instructions also apply to ordinary conversation and explanations. The
202
+ dispatcher receives the short general part of the packaged guide; investigation
203
+ and execution receive its Docdex recipes. User/workspace instructions remain
204
+ intact. Sources, scopes and content hashes are recorded in `instructions_loaded`
205
+ events and shown in session status. Instructions reload at turn boundaries and
206
+ when execution changes its focused paths.
207
+
208
+ Instruction files must stay within their source directory boundary, be regular
209
+ files of at most 64 KiB, and fit a combined 24,000-character prompt budget.
210
+ Oversized bundles fail explicitly before inference; move supporting material
211
+ into linked documents instead of relying on silent truncation. Repository
212
+ instruction symlinks cannot disclose files outside the workspace.
213
+
214
+ Read-only investigations can use permitted Docdex search, source, structural and
215
+ continuity tools. The managed daemon starts only when the model requests a
216
+ Docdex tool; greetings and direct file reads do not start it. Indexing and
217
+ embedding usage share the turn budget. Host-denied calls cannot start the daemon.
218
+ An unavailable index leaves permitted ordinary file reads usable and is reported
219
+ as missing evidence. Inspection never exposes indexing commands, memory writes,
220
+ shell execution, delegation or work mutations. External research requires an
221
+ advertised tool and the existing web permission.
222
+
105
223
  The managed daemon must advertise workspace-metadata control, query/document
106
224
  embedding input types, strict repository embeddings and deterministic profile
107
225
  embeddings. An older daemon fails startup with an explicit compatibility error.
@@ -143,12 +261,73 @@ by checksums and tool receipts. Review must reject unavailable evidence needed
143
261
  to decide correctness. Passing a test or obtaining reviewer approval alone does
144
262
  not establish a universal correctness guarantee; observed false completions
145
263
  remain release blockers and become regression fixtures.
264
+ If a provider returns an explicit rejection with one finding as a string, the
265
+ controller retains that finding as a one-item list so the agent can repair the
266
+ defect. This normalization cannot turn a malformed approval into acceptance.
267
+
268
+ Review begins with separate specification-only calls, before implementation,
269
+ tests, diffs or claimed results are supplied. Each source is presented as a
270
+ lossless array of excerpts. The model selects a source ID and zero-based excerpt
271
+ index; the controller supplies the exact quotation, preserving whitespace and
272
+ Unicode boundaries. Invalid indexes, conflicting quotations and omitted sources
273
+ cannot establish acceptance. Legacy quoted responses remain valid only when
274
+ their text occurs verbatim in the identified source. Large
275
+ contracts use at most sixteen bounded source groups, with every original source
276
+ retained as context in every call. Text already contained verbatim in the current
277
+ goal is supplied once; all canonical criterion IDs remain in the actual review.
278
+ The review checklist stores repeated quotations once per source and retains each
279
+ check with a reference to that exact quotation; no expected behavior is dropped.
280
+ One format repair per group is permitted; invalid source attribution or missing coverage
281
+ cannot establish acceptance. The checklist supplements the full original
282
+ contract and does not prove correctness. Both preparation and source review use
283
+ the smaller of the configured effort output limit and reviewer model limits,
284
+ reserving that output space in the smallest compatible context window. Native
285
+ reasoning settings remain in the model configuration; no host defaults change.
286
+ Terminal review requests plain model output and strictly parses the JSON protocol
287
+ locally. This preserves the received response and usage when a model emits invalid
288
+ JSON; a native structured-output validator would otherwise reject it before the
289
+ controller can inspect it. Source review permits one format-only repair with the
290
+ complete original authority retained, at most six calls including four source
291
+ rounds and a verdict. This does not retry unknown transport failures or turn an
292
+ invalid or contradictory approval into accepted evidence. Explicit native
293
+ `structured_output_failed` errors elsewhere are classified as `invalid_response`
294
+ without exposing upstream response content.
295
+
296
+ The reviewer can request additional source pages before deciding. Requests are
297
+ read-only and restricted to the current review paths; each page rechecks the
298
+ validated file hash. Four request rounds, eight pages per round and the smallest
299
+ configured reviewer context bound the process. Every model call shares the
300
+ session's usage and effort budget. Repeated requests, exhausted context, missing
301
+ evidence or edits during review cannot establish acceptance. Secrets are redacted
302
+ before paging, including credentials that cross page boundaries.
303
+ Omitting a source-request offset continues at the controller's exact unread
304
+ cursor, including an initial page shorter than 8,000 characters. Whole-goal
305
+ reviews reference repeated requirement text by its exact position in the intact
306
+ goal and identify the checked snapshot with one digest. Full per-file hashes
307
+ remain in controller validation and durable evidence; this saves prompt space
308
+ without summarizing the contract or relaxing freshness checks.
146
309
 
147
310
  Ordinary task review includes its assigned requirements, owned changes and diff,
148
311
  plus relevant read-only dependencies. Other tasks' pending deliverables remain
149
312
  in the canonical backlog. A task assigned the original whole-objective criterion
150
313
  receives the complete current goal and all changes for integration review.
151
314
  Both review scopes retain the same global validation and source-freshness checks.
315
+ Whole-goal integration also reviews every canonical refined criterion. When all
316
+ other active tasks are already verified, the controller first reassesses each
317
+ owner's criteria and read dependencies against the final files. It then supplies
318
+ those successful assessments, bound to one full-workspace digest, to the final
319
+ integration review and to later scoped reassessments, such as delivery inventories.
320
+ Assessed module source remains available for hash-checked
321
+ paging; only remaining source and diff are loaded initially. Initial source
322
+ allocation reserves context space for later pages. Original requirements,
323
+ constraints, architecture decisions and cross-task interactions still govern
324
+ integration acceptance. A failed scoped assessment stops the sequence without
325
+ renewing any proof. Only an accepted final-tree integration review records
326
+ new full-snapshot proofs for those owners, linked to the shared integration
327
+ assessment and their prior evidence. Original proofs remain in the audit trail.
328
+ An assigned-task review cannot renew siblings; partial coverage, unfinished or
329
+ reopened work, stale revisions, and omitted tracked inputs cannot use this path.
330
+ Any later change to the assessed files still invalidates completion.
152
331
 
153
332
  Terminal `model_receipt` events link usage to `model_intent` by ID and identify
154
333
  the role binding. Completed receipts include the reported route and usage;
@@ -357,6 +536,12 @@ the grader before live runs. Retain the frozen installed client and configuratio
357
536
  with every result. First attempts are qualification observations; corrective
358
537
  reruns must be labeled diagnostic, with the original failures preserved.
359
538
 
539
+ Workflow corpus v5 additionally checks immediate dispatch stopping on synchronous
540
+ worker throws, waiting for already-started workers, and preserving falsy thrown
541
+ values. This closes a gap found by live review: public async-only coverage had
542
+ accepted a faulty pool. Earlier frozen runs retain their original version, hash
543
+ and outcomes; regrading known artifacts is diagnostic evidence.
544
+
360
545
  `eval/LongWorkflowJourney.runLongWorkflowJourney` composes four module contracts
361
546
  into one durable goal. Select `data-delivery`, `service-adapters`, `billing-audit`
362
547
  or `localized-export`, and supply `configPath` and a new `outputRoot`. Four child
@@ -385,3 +570,124 @@ receipts and independent-review excerpts preserve the beginning, a detected
385
570
  failure region, and the end of bounded output; omission markers never imply
386
571
  that an unretained full log is available. Successful test exit status remains
387
572
  separate from whether the tests prove the requested behavior.
573
+
574
+ ## Terminal interaction dispatch and audit
575
+
576
+ Natural-language terminal messages first pass through a bounded semantic
577
+ dispatcher. It uses recent conversation and the active goal to choose a direct
578
+ answer, stronger no-tool answer, read-only investigation, action, or clarification.
579
+ It does not match a list of phrases. Conversation does not initialize a work
580
+ record, repository index or verification loop. Side questions preserve active
581
+ work. Action requests retain the original text and relevant conversation beside
582
+ the prepared brief; the brief cannot grant permissions or replace constraints.
583
+
584
+ `codali setup` initially aliases `intent` to `lead`. The smaller resident models
585
+ have not qualified for the current contract; health and availability alone do not
586
+ select them. Operators can bind a smaller model after a measured comparison.
587
+ The older `router` binding used by automation is unchanged. Existing profiles
588
+ without an `intent` binding use a bounded lead call until the operator configures
589
+ one. No model is downloaded automatically.
590
+
591
+ The optional `interaction` object accepts:
592
+
593
+ ```json
594
+ {
595
+ "routerBinding": "intent",
596
+ "answerBinding": "lead",
597
+ "promptVersion": "my-interaction-v1",
598
+ "maxInputChars": 24000,
599
+ "historyChars": 6000,
600
+ "maxOutputTokens": 768,
601
+ "maxTotalTokens": 16000,
602
+ "maxModelCalls": 8,
603
+ "maxInspectionSteps": 6,
604
+ "timeoutMs": 90000
605
+ }
606
+ ```
607
+
608
+ `answerPrompt` replaces the answering instructions. `routerPrompt` is a legacy
609
+ semantic policy carried as data beside the original request. It can guide route
610
+ selection but cannot replace the versioned dispatcher schema or widen scope.
611
+ Live dispatch returns exactly `mode`, `text`, `tools` (`none` or `available`), and
612
+ `output` (`format`, `requiredKeys`, `minWords`, `maxWords`). Unspecified word bounds
613
+ are null. Archived two-/three-field decisions remain readable; live requests
614
+ require all four fields. Runtime and dispatcher evaluations share the same prompt
615
+ builder and record `interaction-v11` separately from the operator's policy version.
616
+ `routerResponseFormat: "json_schema"` optionally sends a native schema for the
617
+ five decision modes, bounded brief, tool scope and output contract. The default remains JSON-object
618
+ mode for adapter compatibility. The selected endpoint must support the schema;
619
+ there is no automatic downgrade or replay after a rejected request. Output is
620
+ still parsed and validated because a schema does not establish correct intent,
621
+ and a response can be truncated or an endpoint can ignore the constraint.
622
+
623
+ Every final interaction reply is checked for nonempty content, extracted JSON-only
624
+ syntax/top-level required keys, and explicit whitespace-separated word bounds.
625
+ These checks do not prove factual correctness, validate an entire JSON Schema,
626
+ compile code or establish work completion. Original user instructions remain
627
+ authoritative when extraction omits a requirement. A failed conversational check
628
+ gets at most one tool-free repair within the same call/token/deadline budget.
629
+ Both drafts and the violations are logged. A failed repair is reported as failure;
630
+ it does not silently publish an invalid final answer. Invalid execution reports
631
+ retain their work checkpoints and cannot use presentation repair to invent action
632
+ claims or change completion evidence. Ordinary valid greetings still take one call.
633
+
634
+ `answerReview: { "enabled": true, "binding": "reviewer", "maxOutputTokens": 2048 }`
635
+ adds one revision pass to `reason` answers. It sees the original request,
636
+ conversation, applicable instructions and untrusted draft, and has no tools.
637
+ The pass shares the existing call/token/deadline limits; it is skipped when
638
+ there is insufficient budget. A failed optional check records its failure and
639
+ returns the original draft unless the user cancelled. It never changes a
640
+ greeting, claims independent verification, or runs automatically by default.
641
+ Use measured quality and latency results before enabling it.
642
+
643
+ `calculator: true` experimentally exposes the pure `calculate` tool only during
644
+ `reason` turns whose dispatcher returns `tools: "available"`. It is off by default. The model chooses whether to use it; the
645
+ dispatcher does not match arithmetic keywords or a list of request types.
646
+ It receives a capability note so requests requiring calculator verification
647
+ reach reasoning mode; the recorded router-prompt hash includes that note.
648
+ The tool accepts numeric expressions, parentheses, powers, signed remainder
649
+ and a small set of arithmetic functions. It cannot execute code, access files
650
+ or use the network. Expressions are limited to 4,096 characters, 1,024 tokens,
651
+ 32 levels of nesting and 128 function arguments. Nonfinite results and unsafe
652
+ integers are rejected. Floating-point results are not exact decimal arithmetic.
653
+
654
+ Calculator calls honor host/repository tool restrictions, consume the shared
655
+ tool budget and create ordinary invocation receipts. The loop reserves capacity
656
+ for a final answer; greetings still use no tools. When answer review is also
657
+ enabled, it receives the actual calculation requests and results. A calculator
658
+ can verify an expression, but it cannot establish that the model chose the
659
+ correct formula, units or interpretation. Enable it only after evaluating that
660
+ tradeoff with the intended model and workload.
661
+
662
+ The router returns `{"mode":"answer","text":"Hello!","tools":"none"}` with mode
663
+ one of `answer`, `reason`, `inspect`, `execute`, `clarify`. For delegated modes,
664
+ text is a task brief of at most 500 characters, not a proposed solution. Invalid
665
+ output gets one bounded repair attempt; it cannot start execution. Model bindings
666
+ still enforce catalog entitlement, backend identity and context capacity.
667
+
668
+ The dispatcher interprets `tools` from the original request and conversation;
669
+ it is `none` or `available`. The host withholds tools for `none`, converting an
670
+ inconsistent inspection/execution decision into a tool-free answer. `available`
671
+ does not override host or repository permissions. Older two-field decisions
672
+ remain readable, but cannot enable the optional calculator. The runtime appends
673
+ this contract to custom router prompts and records the effective prompt hash.
674
+ This model-derived restriction still needs semantic evaluation; it is not proof
675
+ that every natural-language prohibition was understood correctly.
676
+
677
+ Session totals accumulate, while turn budgets restart per message. Unknown
678
+ remote outcomes retain their token reservations until reconciled. Execution
679
+ continues to use the selected effort budget and existing completion gate.
680
+
681
+ Private session `transcript.jsonl` records `interaction_request`, `model_request`,
682
+ `model_response`, and `interaction_result` or `interaction_failed`. Correlation
683
+ IDs, actual message/tool payloads, configuration and prompt hashes, model routes,
684
+ token receipts and final outcomes support later investigation. Registered
685
+ credentials and recognizable token formats are redacted; files have private
686
+ permissions and stay outside the repository. No training or log upload is enabled.
687
+ Cancellation may leave a remote model outcome unknown; the log preserves that
688
+ reservation rather than inventing a response or zero usage.
689
+
690
+ The reproducible conversation, code-answer and repository-inspection study is
691
+ documented in [`docs/benchmarks/codali-1000/README.md`](../../docs/benchmarks/codali-1000/README.md).
692
+ Its independent code checks and rubric reviews supplement the existing terminal
693
+ editing and long-workflow suites; they do not replace those release gates.
package/README.md CHANGED
@@ -11,6 +11,43 @@ codali doctor
11
11
  codali chat --permissions ask --effort medium
12
12
  ```
13
13
 
14
+ Interactive `codali` and `codali chat` open the terminal UI with a scrollable
15
+ conversation, multiline editor, tool cards, approval dialogs and persistent
16
+ model, effort, permission and usage status. `codali resume SESSION_ID` restores
17
+ the conversation and waits for input; `/continue` resumes execution. JSONL and
18
+ noninteractive resume retain their automation behavior.
19
+
20
+ | Key | Action |
21
+ | --- | --- |
22
+ | Enter or Tab | Send, or queue a message while work is running |
23
+ | Alt+Enter or Ctrl+J | Insert a newline |
24
+ | Ctrl+S | Submit a correction; cancel current work and apply it at the next safe checkpoint |
25
+ | Ctrl+P / Ctrl+R | Search commands / input history |
26
+ | Shift+Tab | Complete a slash command or an `@workspace/path` reference |
27
+ | Mouse drag | Select visible text anywhere, including dialogs and the editor; release to copy |
28
+ | Page Up / Page Down | Scroll conversation or inspect a dialog |
29
+ | Ctrl+O | Expand or collapse tool output |
30
+ | Escape | Close a view, deny an approval, or cancel active work |
31
+ | Ctrl+C / Ctrl+Z | Cancel work; press again within one second to exit |
32
+ | Ctrl+D | Exit with an empty editor |
33
+
34
+ Approvals start on **Deny**. Use Up/Down to choose, then Enter to confirm;
35
+ Page Up/Down exposes the complete arguments. Pasted text remains editable and
36
+ cannot select an approval. Use `NO_COLOR=1` for a monochrome TUI or `--plain`
37
+ for a line-oriented interface. Redirected output and `TERM=dumb` use plain mode.
38
+ The UI restores terminal modes and the original screen when it closes.
39
+
40
+ Automatic copy uses the terminal's OSC52 clipboard support, including over SSH.
41
+ Your terminal must permit clipboard writes; Codali cannot override that setting.
42
+ Shift-drag remains available for the terminal's own selection and copy behavior.
43
+
44
+ Interactive work has no cumulative token, model-call, tool-call, step or total
45
+ turn deadline. Usage remains recorded, context is compressed to fit the model,
46
+ and active task leases renew while the controller owns the workspace. Per-request
47
+ model context/output capacities, individual tool/service timeouts, permissions,
48
+ explicit cancellation and failure checks still apply. Noninteractive commands
49
+ and benchmarks retain their configured budgets.
50
+
14
51
  For automation, inject `MCODA_MSWARM_API_KEY` through your secret manager, or pipe
15
52
  the key to `codali login --stdin`. Keys are never command-line arguments. Existing
16
53
  encrypted mcoda credentials are reused when their service origin matches.
@@ -51,19 +88,86 @@ runtime versions remain available for existing profiles.
51
88
 
52
89
  | Command | Purpose |
53
90
  | --- | --- |
54
- | `/status`, `/usage` | Current execution state, local accounting and server limits |
55
- | `/permissions [plan\|ask\|workspace\|clear]` | Inspect/change policy or revoke exact session grants |
91
+ | `/status`, `/usage` | Current execution state, reconciled accounting and server limits |
92
+ | `/permissions [plan\|ask\|workspace\|full\|clear]` | Open the permission menu, save a directory policy, or clear session grants |
56
93
  | `/effort [low\|medium\|high\|max]` | Change the shared model, tool, token and time budget between turns |
57
94
  | `/goal`, `/plan`, `/tasks`, `/decisions` | Read the durable objective, criteria, dependencies and architecture decisions |
58
- | `/models`, `/config [reload]` | Inspect configured routes and the effective configuration hash |
95
+ | `/goal amend TEXT` | Record an explicit goal amendment between turns, preserving the original objective; execution waits for `/continue` |
96
+ | `/model`, `/models`, `/config [reload\|validate PATH\|diff PATH]` | Inspect routes or validate/compare a proposed configuration before reloading |
97
+ | `/plan [show\|history\|edit TEXT\|mode plan\|execute]` | Inspect or revise the plan; execute mode uses the approval policy |
98
+ | `/plan diff [FROM [TO]]` | Review changed task scope, dependencies and phases between saved revisions; defaults to the previous and current plan |
99
+ | `/tools`, `/mcp`, `/docdex` | Inspect available tools, connectors and indexing configuration |
59
100
  | `/context`, `/diff`, `/review` | Inspect retained context/changes or request a new review task |
60
101
  | `/checkpoint`, `/compact` | Save progress or reduce conversation context while preserving canonical work state |
61
- | `/cancel`, `/continue`, `/steer TEXT` | Interrupt, continue, or apply an explicit goal amendment |
62
- | `/sessions`, `/resume ID`, `/fork`, `/new TEXT` | Manage sessions; forks require fresh verification and reset grants |
102
+ | `/stop`, `/cancel`, `/continue`, `/steer TEXT` | Stop the turn and discard queued instructions, continue, or apply an explicit goal amendment |
103
+ | `/sessions`, `/resume ID`, `/fork`, `/new [TEXT]`, `/clear [TEXT]` | Start a fresh prompt or objective without deleting previous sessions; forks require fresh verification and reset grants |
104
+ | `/exit`, `/quit` | Cancel owned work, discard queued instructions and close after cleanup |
63
105
  | `/artifacts` | Inspect durable image, audio and video jobs and artifact checksums |
106
+ | `/model select BINDING MODEL_ID [--save]` | Preview an entitled configured model; `--save` persists the shared binding and activates it between turns. Compatible embedding replicas preserve the index; another vector space requires a separate configuration, fresh session and rebuild |
107
+ | `/artifacts export JOB_ID PATH` | Copy a verified result to a new workspace file, subject to permissions; existing files are preserved |
108
+ | `/artifacts open JOB_ID` | Verify the result and launch the Linux/macOS desktop viewer; over SSH, export and download it if no display is available |
109
+ | `/tasks media JOB_ID`, `/tasks cancel JOB_ID` | Inspect an owned media job or request cancellation; the worker must confirm the final outcome |
64
110
  | `/reconcile ID success\|failed NOTE` | Record an observed outcome for an interrupted tool invocation |
65
111
  | `/export`, `/retention DAYS`, `/delete-session ID` | Export redacted events, preview retention candidates, or delete an inactive session |
66
112
 
113
+ Between turns, `/usage` reconciles up to 16 model requests with authenticated
114
+ mSwarm receipts. Repeat it if `remaining` is nonzero. Durable request IDs join
115
+ local calls to server attempts; successful reconciliation is replay-safe across
116
+ restarts. Missing, active, truncated or unreported receipts remain unresolved,
117
+ and an incomplete legacy ledger cannot reduce the shared budget. Reconciliation
118
+ requires the receipt endpoint and the original configured provider/key; older
119
+ servers return an explicit unavailable result. During a turn it is deferred.
120
+ Accounting settlement does not mark the coding task complete or replay inference.
121
+
122
+ ### Persistent instructions and Docdex
123
+
124
+ Use `/skills` to inspect available local skills. Codali loads `SKILL.md` metadata
125
+ from workspace and user skill directories, then reads instructions/references
126
+ only when needed. The bundled planning skill records dependencies and acceptance
127
+ criteria; imported Mac skills still require their declared platform and tools.
128
+ See [skills and native tools](ORCHESTRATION.md#native-tools-skills-and-bounded-context)
129
+ for directory configuration, browser setup and permission behavior.
130
+
131
+ The TUI renders Markdown tables as aligned boxes or labeled fields on narrow
132
+ screens. Near a model's context limit, Codali abbreviates older assistant/tool
133
+ content, preserves user constraints, and retains recoverable private originals.
134
+
135
+ The terminal loads the packaged [Codali operating guide](config/AGENTS.md),
136
+ including the actual Docdex tool argument names, repository scope, evidence
137
+ requirements and permission boundaries. A greeting does not start repository
138
+ indexing. Repository inspection starts the private Docdex runtime lazily and
139
+ exposes additional read tools when needed.
140
+
141
+ Add your own instructions in these files, listed from general defaults to the
142
+ most specific overrides:
143
+
144
+ 1. `~/.codali/AGENTS.md`: your preferences across workspaces.
145
+ 2. `<workspace>/.codali/instructions.md`: shared workspace guidance.
146
+ 3. `<workspace>/AGENTS.md` and `AGENTS.md` files along the focused file's directory
147
+ ancestry: repository and component guidance.
148
+ 4. `<workspace>/.codali/local.md`: local workspace overrides.
149
+
150
+ For example, a repository `AGENTS.md` can specify the test command, component
151
+ boundaries and documentation conventions. Keep it concise and link supporting
152
+ documents. Each file is limited to 64 KiB; the combined formatted instruction
153
+ bundle is limited to 24,000 characters and 64 sources. Oversized or unreadable
154
+ instructions produce an explicit error rather than being silently truncated.
155
+ Symlinks must stay inside the permitted instruction directory. Source hashes
156
+ are retained with the session's instruction metadata.
157
+
158
+ Instructions guide model behavior; the host still enforces permissions. A file
159
+ cannot grant shell networking, writes or access to another repository. Docdex
160
+ memory writes and web research require their corresponding permissions. If
161
+ Docdex is unavailable, Codali must report the limitation and use permitted file
162
+ reads without claiming that structural analysis succeeded.
163
+
164
+ The [1,000-prompt benchmark](../../docs/benchmarks/codali-1000/README.md) compares
165
+ the real controller with direct and tool-equipped model baselines. Its
166
+ [validation selection](../../docs/benchmarks/codali-1000/validation-selection.json)
167
+ records quality, critical failures, latency and tokens. The selected experimental
168
+ profile is not a production recommendation: validation found critical failures,
169
+ and the full comparison is still in progress.
170
+
67
171
  `plan` permits reads; `ask` asks before side effects; `workspace` permits scoped
68
172
  file edits and isolated shell commands. Web research, memory writes and media
69
173
  generation have separate approval categories. Automation can explicitly enable
@@ -82,6 +186,64 @@ On macOS, the selected installed Xcode developer tools and SDK are also read-onl
82
186
  Use `doctor` to inspect selected executable paths. Dependency installation still
83
187
  requires network permission, and build outputs must fit the task's write scope.
84
188
 
189
+ ### Deterministic and evidence tools (development)
190
+
191
+ The development client exposes direct Decimal.js arithmetic, math.js numerical
192
+ operations, Ajv JSON Schema validation, SymPy algebra/calculus, Z3 constraints,
193
+ DuckDB queries and Polars transforms through tool discovery. These operations
194
+ run in bounded, offline workers over supplied data. Library versions and input
195
+ hashes accompany results. Decimal inputs use strings; floating-point results
196
+ remain approximations. A solver reporting `unknown` is not a proof.
197
+
198
+ Install and verify the Python tools explicitly on the host:
199
+
200
+ ```sh
201
+ codali tools install
202
+ codali tools check --json
203
+ codali doctor
204
+ ```
205
+
206
+ From a source checkout, use `node packages/codali/dist/cli.js` in place of
207
+ `codali` after building. `tools check` uses fixed independent values with no
208
+ model calls; it reports each tool separately and exits nonzero on any failure.
209
+ `doctor` reports installation metadata, isolation, the browser executable and
210
+ local TNL credential status. Credential metadata alone does not verify server
211
+ access or expiry enforcement. The lower-level installer remains available as
212
+ `config/deterministic/install-python.mjs` inside the package.
213
+ The default private environment is
214
+ `~/.local/state/codali/tool-runtimes/python-v1`; the host can override it with
215
+ `CODALI_TOOL_PYTHON_ROOT`. A missing or incompatible runtime produces an explicit
216
+ tool error. The model cannot choose runtime paths or install dependencies through
217
+ these tools. JavaScript verification and Vitest execute supplied checks in the
218
+ existing isolated executor. Passing model-authored checks is useful evidence,
219
+ but does not establish independent test coverage.
220
+
221
+ `extract_entities` uses the locally served ADES extractor for bounded entity
222
+ hints. Confidence scores and canonical links can be wrong; the original query
223
+ and source evidence remain authoritative. Docdex supplies repository and web
224
+ retrieval, structural analysis, memory and additional versioned capabilities.
225
+ Optional daemon features can be unavailable even when their schemas are known.
226
+
227
+ Browser navigation uses the npm `browser-use` direct session API in a temporary
228
+ worker with a restricted environment. Codali owns Chrome and closes it on
229
+ cancellation; workspace `.env` files and model-service credentials are not
230
+ loaded by the browser worker. New setup configurations select local specialist
231
+ image/audio/video backends and pin their advertised identity. Missing local
232
+ routes remain unavailable; setup does not substitute a text model or cloud route.
233
+
234
+ `tnl_read` retrieves source-linked news, entity/impact relationships and data
235
+ catalog records from The Neural Ledger. Configure its host credential at
236
+ `~/.config/codali/credentials/tnl.json` with `apiKey`, `baseUrl` and `expiresAt`,
237
+ owned by the current user with mode `0600`. The key must have a real server-side
238
+ expiry as well as this local expiry. Never put it in a prompt or repository.
239
+ `CODALI_TNL_CREDENTIAL_FILE` can select another private host file. Requests are
240
+ GET-only and restricted to the credential's origin; web permission still
241
+ applies. Retrieved dates, sources and inferred relationships require evaluation,
242
+ and an outage or empty response must not be presented as an established fact.
243
+
244
+ These additions remain under qualification and are not present in the older
245
+ installed `.26` preview merely because this source documentation is available.
246
+
85
247
  Each task is tied to the original goal and a bounded path scope. A successful tool
86
248
  call is not task completion: changed code needs recorded validation and separate
87
249
  review, and the goal gate checks requirement coverage, current file hashes and
@@ -90,8 +252,13 @@ they do not trigger an automatic retry of a side effect. Session data lives unde
90
252
  `~/.local/state/codali/workspaces/`, outside the editable repository. Media workers
91
253
  survive terminal disconnects and keep binary artifacts out of model transcripts.
92
254
 
93
- `--json` emits JSONL events. Stable fields are `schemaVersion`, `type` and `data`;
94
- session events also carry `id`, `sessionId`, `sequence` and `at`. `turn_result`
255
+ `--json` emits JSONL events; `--output-format jsonl` is its explicit alias
256
+ (`text` selects readable output).
257
+ `--permission-profile` aliases `--permissions`. Validate a shared configuration
258
+ without inference with `codali config validate --file PATH`.
259
+
260
+ Stable event fields are `schemaVersion`, `type` and `data`; session events also
261
+ carry `id`, `sessionId`, `sequence` and `at`. `turn_result`
95
262
  contains `completed`; consumers must check it. `command_failed` covers command
96
263
  failures. Exit codes are 0 for verified completion (or a requested planning turn),
97
264
  1 for errors, 2 for open/blocked work, and 130 for cancellation. `--plain` disables
@@ -211,3 +378,13 @@ codali writes JSONL logs under `logs/codali/<runId>.jsonl`, rooted in the global
211
378
 
212
379
  ## Docdex integration
213
380
  codali calls docdex over HTTP for search/snippets/graphs and uses MCP for symbols/AST/memory. Ensure `docdexd` is running and `DOCDEX_HTTP_BASE_URL` is set if needed.
381
+
382
+ Local document tools support PDF, Word (`.docx`), Excel (`.xlsx`) and UTF-8 Markdown. Install their separate pinned runtime with `codali tools install --documents`, then run `codali tools check --documents --json`. These host commands do not require a model or a tenant connection. The tool names are `document_read` and `document_create`; creation uses typed text blocks or literal spreadsheet rows, requires workspace write permission, and never overwrites an existing file.
383
+
384
+ The offline worker receives only copied input and returns checksums, library versions, bounded text/tables and explicit truncation. Formula expressions are not calculated values; formula-looking strings supplied to creation remain literal text. PDF extraction does not perform OCR, and document reading does not claim complete interpretation of images, headers, tracked changes or complex layouts. PDF creation uses a bundled font and fails on unsupported characters; DOCX/Markdown preserve broader Unicode. Image, audio and video generation use the separately configured local specialist models.
385
+
386
+ The opening screen displays the supplied ANSI Codali artwork when the terminal is at least 91 columns by 24 rows. Scrolling or starting a conversation restores the compact header. Tab completes a slash-command prefix; ordinary drafts are queued with Tab.
387
+
388
+ Use `/permissions` to choose Plan, Ask, Workspace or Full with Up/Down and Enter. Full automatically approves available tools, including web, memory, media and connectors, and enables isolated shell networking. The choice is saved outside the repository for this exact directory; `/permissions ask` restores prompts. `--permissions full` overrides only the current launch. Workspace boundaries, explicit deny rules and shell isolation remain enforced.
389
+
390
+ At 100 columns by 28 rows or larger, the regular header uses the three-line CODALI mark with a pink-to-purple gradient. Smaller windows keep the single-line name. `NO_COLOR` preserves the artwork without ANSI colors.