mixdog 1.4.0 → 1.4.2

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 (493) hide show
  1. package/package.json +3 -2
  2. package/scripts/build-shipped-history.mjs +115 -33
  3. package/scripts/check-voice-runtime-inputs.mjs +25 -0
  4. package/scripts/gate-local.mjs +183 -63
  5. package/scripts/latest-guard.mjs +21 -9
  6. package/scripts/lib/gate-scheduler.mjs +138 -32
  7. package/scripts/lib/gate-timing-reporter.mjs +16 -0
  8. package/scripts/lib/isolated-test-env.mjs +10 -5
  9. package/scripts/lib/run-node-tests.mjs +91 -66
  10. package/scripts/lib/scoped-temp.d.mts +16 -0
  11. package/scripts/lib/scoped-temp.mjs +124 -0
  12. package/scripts/lib/stale-temp.mjs +44 -0
  13. package/scripts/lib/test-failure-records.mjs +14 -1
  14. package/scripts/lib/test-failure-summary.mjs +16 -4
  15. package/scripts/lib/test-spawn-ledger.mjs +12 -3
  16. package/scripts/post-release-check.mjs +1 -6
  17. package/scripts/pptx-kit-index.mjs +17 -5
  18. package/scripts/suite-health.mjs +115 -24
  19. package/scripts/test-data-dir.mjs +10 -7
  20. package/scripts/test.mjs +9 -14
  21. package/src/agents/advisor/AGENT.md +4 -4
  22. package/src/agents/advisor/agent.json +1 -1
  23. package/src/agents/explore/AGENT.md +22 -0
  24. package/src/agents/explore/agent.json +6 -0
  25. package/src/app.mjs +4 -0
  26. package/src/cli.mjs +7 -0
  27. package/src/defaults/agents.json +7 -0
  28. package/src/defaults/shipped-history.json +23 -2
  29. package/src/defaults/skills/browser-use/SKILL.md +10 -5
  30. package/src/defaults/skills/code-tidy/SKILL.md +71 -102
  31. package/src/defaults/skills/code-tidy/references/agent-cleanup.md +66 -114
  32. package/src/defaults/skills/code-tidy/references/cleanup-report.md +19 -35
  33. package/src/defaults/skills/code-tidy/references/dead-code.md +3 -9
  34. package/src/defaults/skills/code-tidy/references/test-suite-slop.md +16 -27
  35. package/src/defaults/skills/computer-use/SKILL.md +16 -4
  36. package/src/defaults/skills/goal-management/SKILL.md +1 -1
  37. package/src/defaults/skills/setup/references/actions.md +12 -6
  38. package/src/defaults/skills/setup/references/surfaces.md +2 -2
  39. package/src/defaults/skills/setup-guide/SKILL.md +5 -2
  40. package/src/defaults/skills/setup-guide/model-recommendations.json +13 -0
  41. package/src/defaults/skills/skill-creator/SKILL.md +85 -190
  42. package/src/defaults/skills/skill-creator/references/design.md +70 -162
  43. package/src/defaults/skills/skill-creator/references/evaluation.md +33 -92
  44. package/src/defaults/skills/test-suite/SKILL.md +194 -0
  45. package/src/defaults/skills/test-suite/references/case-management.md +51 -0
  46. package/src/defaults/skills/test-suite/references/flaky-policy.md +39 -0
  47. package/src/defaults/skills/test-suite/references/reliability.md +49 -0
  48. package/src/defaults/skills/test-suite/references/suite-design.md +78 -0
  49. package/src/defaults/skills/test-suite/scripts/inventory.mjs +335 -0
  50. package/src/defaults/skills/visualize/SKILL.md +6 -2
  51. package/src/lib/rules-builder.cjs +35 -42
  52. package/src/output-styles/common.md +2 -2
  53. package/src/output-styles/simple.md +1 -1
  54. package/src/rules/agent/AGENT.md +5 -4
  55. package/src/rules/lead/LEAD.md +12 -7
  56. package/src/rules/shared/10-tool-workflow.md +3 -1
  57. package/src/rules/shared/20-research.md +3 -6
  58. package/src/rules/shared/40-editing.md +1 -0
  59. package/src/rules/shared/45-destructive.md +0 -2
  60. package/src/rules/shared/50-execution.md +2 -0
  61. package/src/rules/shared/60-verification.md +10 -9
  62. package/src/rules/shared/70-delivery.md +8 -9
  63. package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/abort-link.mjs +5 -1
  64. package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +10 -1
  65. package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +156 -24
  66. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +13 -0
  67. package/src/runtime/agent/orchestrator/agent-runtime/maintenance-route.mjs +4 -1
  68. package/src/runtime/agent/orchestrator/cache-break-trace.mjs +2 -0
  69. package/src/runtime/agent/orchestrator/config.mjs +12 -7
  70. package/src/runtime/agent/orchestrator/context/deferred-tools.mjs +8 -8
  71. package/src/runtime/agent/orchestrator/context/role-instructions.mjs +5 -26
  72. package/src/runtime/agent/orchestrator/context/skill-catalog.mjs +3 -1
  73. package/src/runtime/agent/orchestrator/internal-agents.mjs +3 -14
  74. package/src/runtime/agent/orchestrator/mcp/agent-connectors.mjs +122 -12
  75. package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +5 -3
  76. package/src/runtime/agent/orchestrator/mcp/client-config.mjs +13 -2
  77. package/src/runtime/agent/orchestrator/mcp/client-transport.mjs +152 -58
  78. package/src/runtime/agent/orchestrator/mcp/client.mjs +51 -18
  79. package/src/runtime/agent/orchestrator/mcp/oauth-login.mjs +88 -54
  80. package/src/runtime/agent/orchestrator/mcp/oauth.mjs +42 -26
  81. package/src/runtime/agent/orchestrator/providers/account-pool.mjs +54 -8
  82. package/src/runtime/agent/orchestrator/providers/anthropic-api-recovery.mjs +1 -1
  83. package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +37 -31
  84. package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +8 -2
  85. package/src/runtime/agent/orchestrator/providers/anthropic-max-tokens-recovery.mjs +6 -2
  86. package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +2 -2
  87. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
  88. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +31 -21
  89. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-request/initial-status.mjs +3 -1
  90. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +14 -3
  91. package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +6 -0
  92. package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +2 -2
  93. package/src/runtime/agent/orchestrator/providers/antigravity-oauth-login.mjs +3 -1
  94. package/src/runtime/agent/orchestrator/providers/antigravity-oauth-tokens.mjs +2 -2
  95. package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +1 -1
  96. package/src/runtime/agent/orchestrator/providers/command-code-oauth-login.mjs +1 -10
  97. package/src/runtime/agent/orchestrator/providers/command-code-oauth.mjs +1 -1
  98. package/src/runtime/agent/orchestrator/providers/cursor.mjs +3 -0
  99. package/src/runtime/agent/orchestrator/providers/custom-provider-config.mjs +40 -0
  100. package/src/runtime/agent/orchestrator/providers/custom-provider-keys.mjs +34 -0
  101. package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +3 -0
  102. package/src/runtime/agent/orchestrator/providers/devin-auth.mjs +14 -7
  103. package/src/runtime/agent/orchestrator/providers/devin-wire-transport.mjs +3 -2
  104. package/src/runtime/agent/orchestrator/providers/devin.mjs +3 -0
  105. package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +2 -2
  106. package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +4 -1
  107. package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +248 -41
  108. package/src/runtime/agent/orchestrator/providers/lib/anthropic-prefix-trace.mjs +76 -11
  109. package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +45 -6
  110. package/src/runtime/agent/orchestrator/providers/lib/first-output-window.mjs +58 -0
  111. package/src/runtime/agent/orchestrator/providers/lib/listen-on.mjs +14 -0
  112. package/src/runtime/agent/orchestrator/providers/lib/oauth-page.mjs +0 -18
  113. package/src/runtime/agent/orchestrator/providers/lib/oauth-token-utils.mjs +138 -6
  114. package/src/runtime/agent/orchestrator/providers/mimo-oauth-login.mjs +1 -10
  115. package/src/runtime/agent/orchestrator/providers/mimo-oauth.mjs +1 -1
  116. package/src/runtime/agent/orchestrator/providers/model-cache.mjs +100 -33
  117. package/src/runtime/agent/orchestrator/providers/muse-code-oauth.mjs +1 -1
  118. package/src/runtime/agent/orchestrator/providers/oauth-secret-fields.fixtures.mjs +45 -0
  119. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +1 -0
  120. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/chunk-events.mjs +9 -2
  121. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +7 -0
  122. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream.mjs +14 -3
  123. package/src/runtime/agent/orchestrator/providers/openai-compat-responses-events.mjs +4 -2
  124. package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +1 -0
  125. package/src/runtime/agent/orchestrator/providers/openai-compat-stream-common.mjs +5 -3
  126. package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +16 -3
  127. package/src/runtime/agent/orchestrator/providers/openai-compat-xai-send.mjs +1 -0
  128. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events/output-items.mjs +5 -2
  129. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +13 -3
  130. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state.mjs +13 -2
  131. package/src/runtime/agent/orchestrator/providers/openai-http-sse-watchdogs.mjs +81 -42
  132. package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +8 -0
  133. package/src/runtime/agent/orchestrator/providers/openai-oauth-login.mjs +160 -31
  134. package/src/runtime/agent/orchestrator/providers/openai-ws-stream/event-switch.mjs +22 -12
  135. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +7 -1
  136. package/src/runtime/agent/orchestrator/providers/openai-ws-watchdogs.mjs +49 -22
  137. package/src/runtime/agent/orchestrator/providers/opencode-go-oauth.mjs +1 -1
  138. package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +3 -1
  139. package/src/runtime/agent/orchestrator/providers/registry.mjs +45 -2
  140. package/src/runtime/agent/orchestrator/providers/vertex-ai-auth.mjs +622 -0
  141. package/src/runtime/agent/orchestrator/providers/vertex-ai-maas.mjs +185 -0
  142. package/src/runtime/agent/orchestrator/providers/vertex-ai-models.mjs +445 -0
  143. package/src/runtime/agent/orchestrator/providers/vertex-ai.mjs +567 -0
  144. package/src/runtime/agent/orchestrator/runtime-core/ask-user-tool-defs.mjs +41 -13
  145. package/src/runtime/agent/orchestrator/runtime-core/builtin-features.mjs +2 -0
  146. package/src/runtime/agent/orchestrator/runtime-core/orchestration.mjs +8 -6
  147. package/src/runtime/agent/orchestrator/runtime-core/session-text.mjs +7 -3
  148. package/src/runtime/agent/orchestrator/runtime-core/tool-catalog-data.mjs +3 -0
  149. package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +6 -1
  150. package/src/runtime/agent/orchestrator/runtime-core/workflow/context.mjs +14 -5
  151. package/src/runtime/agent/orchestrator/runtime-core/workflow-ids.mjs +1 -0
  152. package/src/runtime/agent/orchestrator/runtime-core/workflow.mjs +5 -2
  153. package/src/runtime/agent/orchestrator/session/agent-room.d.mts +30 -5
  154. package/src/runtime/agent/orchestrator/session/agent-room.mjs +171 -37
  155. package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +1 -3
  156. package/src/runtime/agent/orchestrator/session/cache-warm.mjs +102 -12
  157. package/src/runtime/agent/orchestrator/session/catalog-db/schema.mjs +4 -1
  158. package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +1 -8
  159. package/src/runtime/agent/orchestrator/session/compact/messages.mjs +23 -0
  160. package/src/runtime/agent/orchestrator/session/compact/observation-supersession.mjs +103 -23
  161. package/src/runtime/agent/orchestrator/session/compact/runner.mjs +160 -36
  162. package/src/runtime/agent/orchestrator/session/context-utils.mjs +13 -1
  163. package/src/runtime/agent/orchestrator/session/conversation-import/claude.mjs +164 -23
  164. package/src/runtime/agent/orchestrator/session/conversation-import/codex.mjs +139 -19
  165. package/src/runtime/agent/orchestrator/session/conversation-import/convert.mjs +38 -7
  166. package/src/runtime/agent/orchestrator/session/conversation-import/imported-session.mjs +3 -0
  167. package/src/runtime/agent/orchestrator/session/conversation-import/turns.mjs +100 -22
  168. package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +4 -3
  169. package/src/runtime/agent/orchestrator/session/human-gate/requests.mjs +36 -6
  170. package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +33 -3
  171. package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +9 -2
  172. package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +1 -1
  173. package/src/runtime/agent/orchestrator/session/loop/provider-tool-exclusions.mjs +13 -5
  174. package/src/runtime/agent/orchestrator/session/loop/route-fallback.mjs +14 -0
  175. package/src/runtime/agent/orchestrator/session/loop/send-phase.mjs +13 -1
  176. package/src/runtime/agent/orchestrator/session/loop/tool-exec/before-hook.mjs +23 -4
  177. package/src/runtime/agent/orchestrator/session/loop/tool-exec/dispatch.mjs +2 -0
  178. package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +23 -1
  179. package/src/runtime/agent/orchestrator/session/loop/tool-exposure-migration.mjs +39 -21
  180. package/src/runtime/agent/orchestrator/session/loop/turn-limits.mjs +13 -8
  181. package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +50 -28
  182. package/src/runtime/agent/orchestrator/session/manager/ask-turn-loop-options.mjs +3 -3
  183. package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +3 -1
  184. package/src/runtime/agent/orchestrator/session/manager/owner-route-fallbacks.mjs +2 -2
  185. package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +1 -0
  186. package/src/runtime/agent/orchestrator/session/manager/route-fallback-chain.mjs +2 -1
  187. package/src/runtime/agent/orchestrator/session/manager/rules-cache.mjs +30 -13
  188. package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +63 -6
  189. package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +7 -0
  190. package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +15 -0
  191. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +35 -13
  192. package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +24 -14
  193. package/src/runtime/agent/orchestrator/session/manager/session-scratch-environment.mjs +70 -0
  194. package/src/runtime/agent/orchestrator/session/manager/session-tool-surface.mjs +0 -3
  195. package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +10 -6
  196. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-context.mjs +4 -0
  197. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +3 -0
  198. package/src/runtime/agent/orchestrator/session/manager/turn-interruption.mjs +56 -29
  199. package/src/runtime/agent/orchestrator/session/manager/turn-reap.mjs +125 -0
  200. package/src/runtime/agent/orchestrator/session/mixy-name.mjs +11 -5
  201. package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +5 -1
  202. package/src/runtime/agent/orchestrator/session/prompt-cache-touch-store.mjs +30 -7
  203. package/src/runtime/agent/orchestrator/session/restart-prefix-parity.fixture.mjs +154 -0
  204. package/src/runtime/agent/orchestrator/session/store/session-delete.mjs +7 -0
  205. package/src/runtime/agent/orchestrator/session/store-summary-catalog.mjs +4 -0
  206. package/src/runtime/agent/orchestrator/session/store-summary-fields.mjs +15 -0
  207. package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +37 -8
  208. package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +252 -39
  209. package/src/runtime/agent/orchestrator/session/store-transcript-cache.mjs +163 -64
  210. package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +164 -4
  211. package/src/runtime/agent/orchestrator/session/store-transcript-worker.mjs +142 -18
  212. package/src/runtime/agent/orchestrator/session/transcript-restore/restore.mjs +61 -2
  213. package/src/runtime/agent/orchestrator/stall-policy.mjs +23 -0
  214. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/completed-result.mjs +6 -2
  215. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/invocation-plan.mjs +2 -2
  216. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/spawn-env.mjs +4 -2
  217. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +6 -1
  218. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +46 -20
  219. package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +7 -1
  220. package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +67 -31
  221. package/src/runtime/agent/orchestrator/tools/builtin/git-worktree-tool.mjs +25 -13
  222. package/src/runtime/agent/orchestrator/tools/builtin/lib/scoped-search-flight.mjs +9 -5
  223. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-records.mjs +58 -20
  224. package/src/runtime/agent/orchestrator/tools/builtin/read-single-stream.mjs +7 -1
  225. package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +6 -3
  226. package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-dispatch.mjs +1 -1
  227. package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-publication.mjs +23 -12
  228. package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-snapshot.mjs +6 -1
  229. package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +1 -8
  230. package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.mjs +20 -15
  231. package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +96 -20
  232. package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +59 -10
  233. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch/federation.mjs +3 -1
  234. package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +1 -1
  235. package/src/runtime/agent/orchestrator/tools/graph-manifest.json +13 -13
  236. package/src/runtime/agent/orchestrator/tools/lib/isolated-test-env.mjs +4 -3
  237. package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.mjs +99 -2
  238. package/src/runtime/agent/orchestrator/tools/lib/owned-shell-trees.mjs +2 -0
  239. package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +103 -13
  240. package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promote-job.mjs +3 -1
  241. package/src/runtime/agent/orchestrator/tools/lib/shell-run-settle.mjs +49 -15
  242. package/src/runtime/agent/orchestrator/tools/lib/shell-run-spawn.mjs +45 -27
  243. package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +34 -10
  244. package/src/runtime/agent/orchestrator/tools/lib/shell-warm-standby.mjs +28 -4
  245. package/src/runtime/agent/orchestrator/tools/lib/wait-until-fixture.mjs +26 -0
  246. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +7 -2
  247. package/src/runtime/agent/orchestrator/tools/spawn-manifest.json +13 -13
  248. package/src/runtime/channels/lib/webhook/signature.mjs +4 -1
  249. package/src/runtime/channels/lib/whisper-port.mjs +29 -11
  250. package/src/runtime/channels/lib/whisper-server.mjs +10 -1
  251. package/src/runtime/computer-bridge/action-schema.mjs +2 -2
  252. package/src/runtime/computer-bridge/core-actions.mjs +2 -2
  253. package/src/runtime/computer-bridge/error-recovery.mjs +5 -4
  254. package/src/runtime/computer-bridge/linux-action-capabilities.mjs +24 -5
  255. package/src/runtime/computer-bridge/linux-readiness.d.mts +7 -2
  256. package/src/runtime/connectors/connector-accounts-mcp.mjs +236 -103
  257. package/src/runtime/connectors/gmail-app-password.mjs +3 -3
  258. package/src/runtime/explore/explorer.mjs +93 -0
  259. package/src/runtime/explore/tool-defs.mjs +35 -0
  260. package/src/runtime/explore/tool.mjs +123 -0
  261. package/src/runtime/local-provider/server-process.mjs +2 -1
  262. package/src/runtime/media/adapters/gemini-video.mjs +4 -1
  263. package/src/runtime/media/adapters/xai-media.mjs +2 -1
  264. package/src/runtime/memory/index.mjs +4 -0
  265. package/src/runtime/memory/lib/embedding-provider.mjs +4 -1
  266. package/src/runtime/memory/lib/embedding-worker.mjs +10 -3
  267. package/src/runtime/memory/lib/memory-action-handlers/cycle-backfill-action.mjs +1 -7
  268. package/src/runtime/memory/lib/memory-chunk-quality.mjs +1 -6
  269. package/src/runtime/office/authoring/pdf-author-action.mjs +1 -6
  270. package/src/runtime/office/design/design-art-direction.mjs +29 -27
  271. package/src/runtime/office/pdf/pdf-writer.mjs +6 -1
  272. package/src/runtime/office/portable/portable-snapshot-docx.mjs +7 -1
  273. package/src/runtime/office/portable/portable-snapshot-shared.mjs +6 -1
  274. package/src/runtime/office/quality/assurance-rendered.mjs +9 -2
  275. package/src/runtime/office/quality/assurance-structure-docx.mjs +4 -2
  276. package/src/runtime/office/quality/design-review.mjs +1 -5
  277. package/src/runtime/office/quality/document-brief.mjs +1 -5
  278. package/src/runtime/office/quality/forced-break-pages.mjs +9 -6
  279. package/src/runtime/office/quality/quality-pipeline.mjs +1 -1
  280. package/src/runtime/shared/agent-route-config.mjs +17 -2
  281. package/src/runtime/shared/atomic-file.mjs +103 -2
  282. package/src/runtime/shared/background-tasks.mjs +15 -6
  283. package/src/runtime/shared/bot-owned-work.mjs +56 -0
  284. package/src/runtime/shared/connector-accounts.mjs +5 -5
  285. package/src/runtime/shared/connector-catalog.d.mts +11 -4
  286. package/src/runtime/shared/connector-catalog.mjs +60 -52
  287. package/src/runtime/shared/custom-provider-keys.mjs +20 -0
  288. package/src/runtime/shared/defaults-separation.mjs +1 -4
  289. package/src/runtime/shared/fetch-safe-listen.d.mts +16 -0
  290. package/src/runtime/shared/fetch-safe-listen.mjs +50 -0
  291. package/src/runtime/shared/file-has-data.mjs +26 -2
  292. package/src/runtime/shared/file-lock.mjs +13 -15
  293. package/src/runtime/shared/git-launch.d.mts +9 -0
  294. package/src/runtime/shared/git-launch.mjs +213 -0
  295. package/src/runtime/shared/git-runner-worker.mjs +2 -1
  296. package/src/runtime/shared/handoff-artifacts.d.mts +2 -1
  297. package/src/runtime/shared/handoff-artifacts.mjs +18 -8
  298. package/src/runtime/shared/idle-auto-clear-gate.mjs +29 -7
  299. package/src/runtime/shared/llm/cost.mjs +11 -2
  300. package/src/runtime/shared/llm/http-agent.mjs +313 -29
  301. package/src/runtime/shared/llm/model-catalog-projection.mjs +3 -2
  302. package/src/runtime/shared/llm/model-catalog.mjs +46 -6
  303. package/src/runtime/shared/llm/provider-catalog-registry.mjs +3 -0
  304. package/src/runtime/shared/llm/system-proxy.mjs +452 -0
  305. package/src/runtime/shared/loopback-listener.mjs +25 -2
  306. package/src/runtime/shared/model-route-chain.d.mts +7 -2
  307. package/src/runtime/shared/model-route-chain.mjs +22 -4
  308. package/src/runtime/shared/open-url.mjs +10 -0
  309. package/src/runtime/shared/provider-accounts.mjs +52 -2
  310. package/src/runtime/shared/session-activity-signal.mjs +14 -0
  311. package/src/runtime/shared/session-scratch.mjs +37 -0
  312. package/src/runtime/shared/staged-install-worker.mjs +5 -0
  313. package/src/runtime/shared/staged-update.mjs +47 -2
  314. package/src/runtime/shared/tool-card-model/agent-surface.mjs +1 -3
  315. package/src/runtime/shared/tool-card-model/card-status.mjs +15 -2
  316. package/src/runtime/shared/tool-result-summary.mjs +1 -1
  317. package/src/runtime/shared/tool-surface.mjs +113 -36
  318. package/src/runtime/shared/tool-work-units.mjs +6 -0
  319. package/src/runtime/shared/turn-snapshot-store.mjs +13 -6
  320. package/src/runtime/shared/turn-worktree-snapshot.mjs +414 -54
  321. package/src/runtime/shared/worktrees/activity-gate.mjs +215 -318
  322. package/src/runtime/shared/worktrees/activity-ledger-worker.mjs +56 -0
  323. package/src/runtime/shared/worktrees/activity-ledger.mjs +391 -0
  324. package/src/runtime/shared/worktrees/branch-management.mjs +9 -3
  325. package/src/runtime/shared/worktrees/contract.mjs +4 -1
  326. package/src/runtime/shared/worktrees/git.mjs +72 -0
  327. package/src/runtime/shared/worktrees/manager.mjs +285 -168
  328. package/src/runtime/shared/worktrees/test-support.mjs +6 -10
  329. package/src/runtime/tidy/install.mjs +95 -15
  330. package/src/runtime/tidy/languages.mjs +17 -15
  331. package/src/runtime/tidy/process.mjs +7 -4
  332. package/src/runtime/tidy/resolve.mjs +19 -16
  333. package/src/runtime/tidy/runners/biome.mjs +3 -3
  334. package/src/runtime/tidy/tool.mjs +1 -1
  335. package/src/runtime/tidy/worktree.mjs +10 -6
  336. package/src/runtime/visualize-bridge/client.mjs +6 -1
  337. package/src/runtime/visualize-bridge/tool-defs.mjs +7 -2
  338. package/src/runtime/web-search/index.mjs +1 -1
  339. package/src/session-runtime/agent-home-delivery.mjs +41 -0
  340. package/src/session-runtime/agent-task-sessions.mjs +458 -312
  341. package/src/session-runtime/agent-tool-routing.mjs +8 -41
  342. package/src/session-runtime/boot/tools.mjs +7 -1
  343. package/src/session-runtime/bot-status.mjs +107 -101
  344. package/src/session-runtime/bot-target.mjs +38 -0
  345. package/src/session-runtime/channel-config-api.mjs +6 -1
  346. package/src/session-runtime/connector-merge-migration.mjs +18 -15
  347. package/src/session-runtime/conversation-import/codex-titles.mjs +88 -0
  348. package/src/session-runtime/conversation-import/discovery.mjs +401 -36
  349. package/src/session-runtime/conversation-import/service.mjs +35 -8
  350. package/src/session-runtime/handoff-attachments.mjs +82 -31
  351. package/src/session-runtime/held-requests.mjs +3 -1
  352. package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +12 -13
  353. package/src/session-runtime/internal-tool-executor/bridge-tools.mjs +1 -0
  354. package/src/session-runtime/internal-tool-executor/feature-tools.mjs +2 -0
  355. package/src/session-runtime/internal-tool-executor/knowledge-tools.mjs +8 -0
  356. package/src/session-runtime/internal-tool-executor/reaction-tool.mjs +4 -1
  357. package/src/session-runtime/internal-tool-executor/workspace-tools.mjs +145 -112
  358. package/src/session-runtime/lifecycle/cold-heir.mjs +11 -6
  359. package/src/session-runtime/lifecycle/session-catalog.mjs +9 -1
  360. package/src/session-runtime/lifecycle/teardown/session-close.mjs +6 -1
  361. package/src/session-runtime/lifecycle/teardown.mjs +1 -1
  362. package/src/session-runtime/mcp-glue/server-catalog.mjs +16 -10
  363. package/src/session-runtime/mcp-glue/server-input.mjs +4 -1
  364. package/src/session-runtime/mixy-heartbeat.mjs +1 -1
  365. package/src/session-runtime/model-route/set-route.mjs +11 -2
  366. package/src/session-runtime/provider-auth/login.mjs +2 -2
  367. package/src/session-runtime/provider-catalog-cache.mjs +82 -36
  368. package/src/session-runtime/provider-models/catalog-load.mjs +23 -6
  369. package/src/session-runtime/provider-models.mjs +4 -2
  370. package/src/session-runtime/resource-mcp-api.mjs +98 -35
  371. package/src/session-runtime/resource-mcp-connector-accounts.mjs +44 -31
  372. package/src/session-runtime/resource-mcp-secrets.mjs +28 -11
  373. package/src/session-runtime/resource-mcp-servers.mjs +5 -4
  374. package/src/session-runtime/resource-recall-api.mjs +6 -1
  375. package/src/session-runtime/runtime-feature-gates.mjs +5 -1
  376. package/src/session-runtime/services/agent-tool/execute.mjs +14 -9
  377. package/src/session-runtime/services/agent-tool/job-views/agent-list.mjs +20 -4
  378. package/src/session-runtime/services/agent-tool/model-select.mjs +48 -7
  379. package/src/session-runtime/services/agent-tool/render.mjs +71 -17
  380. package/src/session-runtime/services/agent-tool/send-flow.mjs +10 -2
  381. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-prep.mjs +8 -3
  382. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +4 -1
  383. package/src/session-runtime/services/agent-tool/spawn-preset.mjs +6 -2
  384. package/src/session-runtime/services/agent-tool/tool-def.mjs +9 -9
  385. package/src/session-runtime/services/agent-watchdog-registry.mjs +32 -4
  386. package/src/session-runtime/services/channel-worker/daemon-spawn.mjs +2 -0
  387. package/src/session-runtime/services/daemon-candidate.mjs +4 -1
  388. package/src/session-runtime/services/memory-runtime-proxy/daemon-spawn.mjs +4 -0
  389. package/src/session-runtime/services/plugin-admin.mjs +10 -6
  390. package/src/session-runtime/services/provider-admin.mjs +283 -11
  391. package/src/session-runtime/session-turn-api.mjs +2 -0
  392. package/src/session-runtime/settings-builtin-tools-api.mjs +4 -1
  393. package/src/session-runtime/settings-system-api.mjs +1 -1
  394. package/src/session-runtime/setup-tool/agent-settings-actions.mjs +13 -3
  395. package/src/session-runtime/setup-tool/connector-widen-approval.mjs +96 -0
  396. package/src/session-runtime/setup-tool/executor.mjs +6 -2
  397. package/src/session-runtime/setup-tool/tool-defs.mjs +2 -1
  398. package/src/session-runtime/tool-policy/policy-stage.mjs +1 -0
  399. package/src/session-runtime/turn/agent-ops.mjs +23 -0
  400. package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +49 -11
  401. package/src/session-runtime/workflow-agents-api/agent-editor.mjs +5 -1
  402. package/src/session-runtime/workflow-agents-api/agent-route.mjs +25 -5
  403. package/src/session-runtime/workflow-agents-api/onboarding.mjs +3 -3
  404. package/src/session-runtime/workspace/activity-guards.mjs +176 -0
  405. package/src/session-runtime/workspace/session-view.mjs +149 -0
  406. package/src/session-runtime/workspace/side-checkouts.mjs +203 -0
  407. package/src/session-runtime/workspace/transition-runner.mjs +188 -0
  408. package/src/session-runtime/workspace/transitions.mjs +108 -1041
  409. package/src/session-runtime/workspace/workspace-merge.mjs +132 -0
  410. package/src/session-runtime/workspace/worktree-intents.mjs +242 -0
  411. package/src/session-runtime/workspace/worktree-maintenance.mjs +80 -0
  412. package/src/session-runtime/workspace/worktree-setup.mjs +85 -0
  413. package/src/session-runtime/workspace/worktree-tool.mjs +73 -56
  414. package/src/standalone/daemon-desktop-runtime.mjs +2 -0
  415. package/src/standalone/daemon-session-control.mjs +169 -138
  416. package/src/standalone/daemon.mjs +7 -0
  417. package/src/standalone/desktop-service-registry.mjs +9 -0
  418. package/src/standalone/local-session-runtime.mjs +5 -1
  419. package/src/standalone/session-client/daemon-unavailable.mjs +3 -0
  420. package/src/standalone/session-client.mjs +5 -1
  421. package/src/standalone/session-frame-stream.mjs +83 -11
  422. package/src/standalone/session-protocol.mjs +4 -0
  423. package/src/standalone/session-service/agent-tree/agent-turns.mjs +16 -12
  424. package/src/standalone/session-service/agent-tree.mjs +45 -9
  425. package/src/standalone/session-service/projection/transcript-window.mjs +700 -64
  426. package/src/standalone/session-service/session-calls/session-action.mjs +10 -3
  427. package/src/standalone/session-service/session-calls/session-views.mjs +160 -104
  428. package/src/standalone/session-service/stored-reader.mjs +127 -40
  429. package/src/standalone/session-transport/client-registry/client-grace.mjs +12 -9
  430. package/src/tui/App.jsx +154 -164
  431. package/src/tui/app/app-view/floating-panel.jsx +10 -4
  432. package/src/tui/app/app-view/text-entry-labels.mjs +1 -0
  433. package/src/tui/app/clipboard.mjs +21 -10
  434. package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +1 -3
  435. package/src/tui/app/model-picker/route-selection.mjs +5 -6
  436. package/src/tui/app/prompt-handlers/use-prompt-history-nav.mjs +1 -1
  437. package/src/tui/app/prompt-handlers/use-prompt-interrupt.mjs +3 -0
  438. package/src/tui/app/prompt-submit/provider-prompts.mjs +3 -1
  439. package/src/tui/app/provider-setup/api-key-actions.mjs +31 -1
  440. package/src/tui/app/provider-setup/oauth-actions.mjs +58 -21
  441. package/src/tui/app/provider-setup/provider-items.mjs +8 -2
  442. package/src/tui/app/provider-setup-picker.mjs +29 -18
  443. package/src/tui/app/shell-layout/row-budgets.mjs +12 -10
  444. package/src/tui/app/slash-commands.mjs +1 -0
  445. package/src/tui/app/slash-dispatch/session-commands.mjs +46 -0
  446. package/src/tui/app/slash-dispatch.mjs +1 -1
  447. package/src/tui/app/use-btw-panel.mjs +29 -0
  448. package/src/tui/app/use-context-panel-refresh.mjs +31 -0
  449. package/src/tui/app/use-model-catalog-cache.mjs +13 -10
  450. package/src/tui/app/use-mouse-input.mjs +11 -0
  451. package/src/tui/app/use-onboarding-start.mjs +8 -3
  452. package/src/tui/app/use-panel-transition.mjs +10 -1
  453. package/src/tui/app/use-pasted-buffers.mjs +28 -20
  454. package/src/tui/app/use-prompt-draft-flow.mjs +7 -0
  455. package/src/tui/app/use-prompt-layout-rows.mjs +3 -3
  456. package/src/tui/app/use-prompt-queue-history.mjs +3 -2
  457. package/src/tui/app/use-selection-focus.mjs +11 -2
  458. package/src/tui/app/use-selection-geometry.mjs +18 -9
  459. package/src/tui/app/use-selection-paint.mjs +4 -4
  460. package/src/tui/app/use-selection-stitch.mjs +3 -3
  461. package/src/tui/app/use-slash-palette.mjs +62 -0
  462. package/src/tui/app/use-terminal-chrome.mjs +2 -2
  463. package/src/tui/app/use-transcript-activity.mjs +47 -32
  464. package/src/tui/app/use-transcript-follow.mjs +12 -4
  465. package/src/tui/app/use-transcript-scroll.mjs +46 -17
  466. package/src/tui/app/use-transcript-swap-reset.mjs +27 -0
  467. package/src/tui/app/use-transcript-window/geometry.mjs +19 -5
  468. package/src/tui/app/use-transcript-window/instance-state.mjs +4 -0
  469. package/src/tui/app/use-transcript-window/selection-shift.mjs +5 -1
  470. package/src/tui/app/use-transcript-window.mjs +21 -11
  471. package/src/tui/app/use-tui-ready.mjs +18 -0
  472. package/src/tui/app/use-welcome-prompt-hint.mjs +5 -0
  473. package/src/tui/app/use-workflow-tab-cycle.mjs +5 -3
  474. package/src/tui/components/Picker.jsx +27 -3
  475. package/src/tui/components/QuestionPanel.jsx +13 -4
  476. package/src/tui/components/SignInUrl.jsx +68 -0
  477. package/src/tui/components/TextEntryPanel.jsx +76 -46
  478. package/src/tui/components/sign-in-url-layout.mjs +24 -0
  479. package/src/tui/dist/index.mjs +1963 -1361
  480. package/src/tui/session/goal-turn-state.mjs +6 -2
  481. package/src/tui/session/session-api/controls.mjs +4 -0
  482. package/src/tui/session/session-api/extensions.mjs +8 -0
  483. package/src/tui/session/session-api/intake/abort.mjs +2 -1
  484. package/src/tui/session/session-api/intake.mjs +2 -0
  485. package/src/tui/session/session-api/integrations.mjs +2 -2
  486. package/src/tui/session/session-api/routes-agent-definitions.mjs +1 -0
  487. package/src/tui/session/session-api/settings.mjs +2 -2
  488. package/src/tui/session/session-flow/queue/take-entries.mjs +11 -0
  489. package/src/tui/session/transcript-spill/spill-writer.mjs +15 -0
  490. package/src/tui/session/transcript-spill.mjs +92 -4
  491. package/src/tui/session/transcript-store.mjs +2 -0
  492. package/src/ui/statusline-agents.mjs +1 -3
  493. package/src/defaults/skills/skill-creator/references/source-review.md +0 -94
@@ -1,111 +1,52 @@
1
1
  # Evaluating a skill
2
2
 
3
- Use this reference after a draft exists or when a current skill has a reported
4
- defect.
3
+ Use after a draft exists or when a skill misbehaves. A passing validator
4
+ proves structure only, never behaviour.
5
5
 
6
- ## Separate the questions
6
+ ## Scenarios
7
7
 
8
- A complete evaluation asks:
8
+ Two to five realistic requests, with the context a real user would give:
9
9
 
10
- | Area | Question |
11
- |---|---|
12
- | Selection | Does the description attract relevant requests and reject close alternatives? |
13
- | Execution | Does the loaded workflow produce the required outcome? |
14
- | Integration | Do resources, paths, tools, and feature gates resolve? |
15
- | Recovery | Do failures remain bounded and actionable? |
16
- | Efficiency | Does the skill remove repeated work without adding ritual? |
17
-
18
- Passing a frontmatter check proves none of the execution questions.
19
-
20
- ## Scenario set
21
-
22
- Use two to five realistic requests:
23
-
24
- 1. a normal request that names the intent;
10
+ 1. a request that names the intent;
25
11
  2. an implicit request that should still select the skill;
26
- 3. an important edge or failure condition;
27
- 4. a close negative request owned elsewhere;
28
- 5. a subjective artifact case when human judgement matters.
12
+ 3. an edge or failure condition that matters;
13
+ 4. a near-miss negative: shares the skill's words but belongs to another
14
+ owner;
15
+ 5. a subjective artifact, when taste or domain judgement decides.
29
16
 
30
- Do not use “load this skill” as a positive test. Include concrete context, files,
31
- or constraints that a real user would provide.
32
-
33
- An optional record shape:
34
-
35
- ```json
36
- {
37
- "id": "short-purpose",
38
- "prompt": "Realistic user request",
39
- "expected_owner": "skill-name or none",
40
- "observable_result": "What must become true",
41
- "inputs": []
42
- }
43
- ```
44
-
45
- Keep evaluation artifacts outside the distributable directory unless the
46
- packaging process explicitly excludes them.
17
+ Never use "load this skill" as a positive case. Keep scenario files outside
18
+ the skill's folder.
47
19
 
48
20
  ## Baseline
49
21
 
50
- Before improving a skill, preserve its exact prior behavior through existing
51
- version history or a read-only evaluation snapshot. Compare identical prompts,
52
- inputs, model class, tool availability, and environment.
53
-
54
- For a new skill, compare against no skill only when the runner can isolate the
55
- draft from the baseline. Otherwise report a smoke test rather than implying a
56
- controlled A/B result.
57
-
58
- The evaluation harness must remain uniform. Do not add task-specific routing,
59
- timeouts, prompt clues, retries, or scoring exceptions to make one version win.
22
+ Before changing a skill, keep a copy of the prior version and run the same
23
+ prompts, inputs, model and tools against both. A new skill with no runnable
24
+ baseline gets a smoke test, not a claimed comparison. Keep the harness the
25
+ same for both: no task-specific hints, retries, timeouts or scoring
26
+ exceptions.
60
27
 
61
28
  ## Evidence
62
29
 
63
- Use deterministic checks for mechanical outcomes:
64
-
65
- - required files exist and open;
66
- - structured fields and values are valid;
67
- - references resolve;
68
- - malformed input fails with useful guidance;
69
- - resource and retry limits hold;
70
- - an irreversible action waits for approval;
71
- - prohibited side effects do not occur.
72
-
73
- Do not test exact prose, source strings, internal algorithms, or snapshots whose
74
- expected behavior has intentionally changed.
75
-
76
- Use user review for clarity, visual quality, writing taste, and domain
77
- judgement. Present the full-size persisted output rather than a description of
78
- it.
30
+ - Mechanical outcomes get deterministic checks: files exist and open, fields
31
+ are valid, references resolve, bad input fails with useful guidance, an
32
+ irreversible step waits for approval, no forbidden side effect happens.
33
+ - Never assert exact prose or internal steps.
34
+ - Clarity, taste and domain judgement go to the user, shown the real output.
79
35
 
80
36
  ## Diagnose before revising
81
37
 
82
- Classify a failure:
83
-
84
- - **selection** — description signal or neighboring boundary;
85
- - **instruction** — missing decision, sequence, or completion evidence;
86
- - **resource** — broken script, reference, asset, or path;
87
- - **integration** — unavailable tool, feature, dependency, or platform;
88
- - **harness** — invalid comparison or test infrastructure;
89
- - **underlying capability** — the tool or product cannot deliver the outcome.
90
-
91
- Edit the component that owns the failure. More prompt text does not repair a
92
- broken tool, and body changes cannot fix a description that never selects the
93
- skill.
38
+ | Class | Where the fix goes |
39
+ |---|---|
40
+ | Selection | Trigger or the neighbour's boundary |
41
+ | Instruction | A missing decision, step order or completion result in the body |
42
+ | Resource | The broken script, reference, asset or path |
43
+ | Integration | The unavailable tool, feature or dependency |
44
+ | Harness | The test setup, not the skill |
45
+ | Capability | The tool or product; the skill cannot deliver it |
94
46
 
95
47
  ## Improve without sediment
96
48
 
97
- After each revision:
98
-
99
- 1. rerun affected scenarios;
100
- 2. validate structure and resource paths;
101
- 3. retain safety, recovery, and bounded execution;
102
- 4. remove rules superseded by the fix;
103
- 5. check whether the change generalizes beyond the failing example.
104
-
105
- Look for tests that always pass, high variance, repeated helper work, excessive
106
- token or time cost, and rules that change no outcome. Those are signals to
107
- improve the evaluation or simplify the skill.
108
-
109
- Stop when required behavior passes, subjective review is accepted, and further
110
- edits no longer produce meaningful gains.
111
-
49
+ After each revision, rerun the affected scenarios, validate, keep safety and
50
+ recovery, delete the rules the fix superseded, and check that the fix is not
51
+ tailored to one example. Stop when the required behaviour passes, the user
52
+ accepts the subjective parts, and further edits stop paying off.
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: test-suite
3
+ description: Write, run, diagnose, prune and audit a project's tests without overloading the machine.
4
+ when_to_use: 'Write, fix, run, diagnose, prune or audit tests, flaky failures, suite health; not live UI checks.'
5
+ dependencies:
6
+ tools:
7
+ - type: tool
8
+ value: read
9
+ - type: tool
10
+ value: shell
11
+ ---
12
+
13
+ # Test suite
14
+
15
+ Owns how tests in any project are written, run during a change, diagnosed when
16
+ they fail intermittently, pruned and audited. The project's own
17
+ commands, lanes and conventions win over every default here; this skill
18
+ supplies the judgement and procedure around them. Driving a running app or
19
+ device by hand is outside it.
20
+
21
+ ## Pick the mode
22
+
23
+ | Request | Mode |
24
+ |---|---|
25
+ | Add a test, fix a bug test-first | Write |
26
+ | Check a change while editing | Run |
27
+ | A test fails sometimes, only in a full run, only in CI, only on this machine | Diagnose |
28
+ | Duplicate, dead, obsolete or worthless tests | Prune |
29
+ | Review the suite's health or a whole area | Audit |
30
+
31
+ ## Prerequisites: find the project's own way
32
+
33
+ Before the first run, look for the project's focused test command in this
34
+ order, and stop at the first source that gives it plus any constraint that
35
+ affects the change (lane, setup, needed service): `AGENTS.md` or `CLAUDE.md`,
36
+ `docs/testing*`, `CONTRIBUTING*`, package scripts (`package.json`, `Makefile`,
37
+ `pyproject.toml`, `Cargo.toml`), then CI workflows. Do not survey every
38
+ manifest or CI lane. Result: one focused command, copied from the project,
39
+ never invented; a broader command only when the change is broad. When nothing
40
+ is documented, fall back to the
41
+ runner's own selection: `node --test <file>`, `vitest run <file>`,
42
+ `jest <file>`, `pytest <file>::<test>`, `go test -run <Name> ./<pkg>`,
43
+ `cargo test <name>`.
44
+
45
+ ## Machine rules
46
+
47
+ Tests run on the user's working machine. These hold in every mode.
48
+
49
+ - The Verification section of your system rules owns the evidence budget,
50
+ reruns, fix attempts, heavy runs and stopping what you started; follow it.
51
+ - Never loop a test to "reproduce" flakiness here, and never shard in
52
+ parallel locally; repetition belongs to CI history.
53
+ - Confirm by PID or command line that detached processes you started are gone.
54
+
55
+ ## Write
56
+
57
+ What a change gets:
58
+
59
+ | Change | New tests |
60
+ |---|---|
61
+ | Bug fix | One regression test for the reported behaviour |
62
+ | New behaviour | One per observable behaviour the requirement names (its success and its stated rejections) |
63
+ | Refactor, rename, move | None; the existing tests must still pass unchanged |
64
+ | Removal | None; delete the removed behaviour's tests, never assert the absence |
65
+ | Docs, copy, style, config values | None |
66
+
67
+ Only a test owning a lasting contract joins the suite and its CI lane.
68
+ Reproductions, probes and one-off checks are scratch: they live in a temp
69
+ directory outside the repository, are never committed, and are deleted when
70
+ the task ends. A scratch reproduction that proves a bug becomes the
71
+ regression test above or is deleted, never both kept.
72
+
73
+ 1. Name the behaviour and its owner: the one contract this test owns, beside
74
+ the code it exercises. If a test already owns it, extend that test
75
+ (`references/suite-design.md`). Result: one file and test name chosen.
76
+ 2. Name the production change that would make the test fail; if you cannot,
77
+ redesign it around an observable behaviour (`references/suite-design.md`).
78
+ Write the test through the user's interface (caller, CLI,
79
+ HTTP, rendered output) with the expected value from the requirement, not
80
+ from running the code. For a new regression test, show it failing first:
81
+ the failure names the missing behaviour. An existing failing test already
82
+ counts as that evidence.
83
+ 3. Apply `references/reliability.md` for any time, process, port, file,
84
+ environment, locale or platform dependency. Result: no fixed sleep, no
85
+ fixed port, no unrestored global, no host-locale assumption.
86
+ 4. Make it pass with the smallest change, then rerun the same file. Result:
87
+ a new regression test's fail-before and pass-after pair goes into the
88
+ report. Add no further
89
+ tests unless the user asks.
90
+ 5. Put it in the lane its duration and needs call for (`suite-design.md`).
91
+
92
+ ## Run
93
+
94
+ 1. Run the covering file(s) only. Result: the selected count matches the files
95
+ you meant.
96
+ 2. On failure read the full log before editing; do not rerun to see if it
97
+ passes.
98
+ 3. Run a broader lane once after the last edit only if the change touches a
99
+ shared contract or an integration point; otherwise stop at the covering
100
+ file. Reuse an earlier pass only when no later edit touched the code it
101
+ checks.
102
+ 4. After two evidence-backed fix attempts, report what was tried and the log.
103
+
104
+ ## Diagnose
105
+
106
+ An intermittent failure is a defect in the test or the product, never noise
107
+ (`references/flaky-policy.md`).
108
+
109
+ 1. Collect evidence without reruns: the failing assertion, the full log, what
110
+ else was running, the OS and locale. Result: the failing line and the
111
+ condition it waited on.
112
+ 2. Classify the cause with the table in `references/reliability.md`. Result:
113
+ one named cause with the line that assumes it.
114
+ 3. Propose the fix: in the test, or in the product when real users can hit
115
+ the same race. A longer timeout, a retry or a skip is not a fix.
116
+
117
+ Diagnose ends at a report: cause, evidence, proposed fix. Only when the user
118
+ asked for a fix, apply it and prove it with the focused file plus a
119
+ deterministic trigger of the cause (a held promise, a fake clock, a localized
120
+ fixture), not by looping. It never becomes an open-ended fix loop. Never
121
+ skip or disable a failing test; when the fix cannot land now, report it and
122
+ leave that decision to the user. Only a capability skip (a platform or tool
123
+ the test needs is absent) is allowed, and its reason names that capability.
124
+
125
+ ## Prune
126
+
127
+ First tell redundant coverage from removing a supported behaviour, and keep
128
+ distinct observable success, rejection, error and compatibility cases.
129
+ Removing a behaviour with its tests needs evidence independent of those tests
130
+ (current requirements, real callers, a specification); a test existing only
131
+ for a branch, or a fallback and test justifying each other, is no evidence,
132
+ and unresolved intent blocks deletion.
133
+
134
+ - Delete a test only when it is dominated (same branch and result as a
135
+ stronger test), tautological (cannot fail), a permutation crossing no new
136
+ branch, or verification theater (verifier and producer share one failure
137
+ domain). Name the test that still owns the contract.
138
+ - Deleting a contract test needs the user's approval.
139
+ - Same contract owned twice → merge the unique cases into the owner at the
140
+ user's interface.
141
+ - Asserts that something was removed, restates a constant, copies production
142
+ logic or source text into the test, or pins internals no user observes →
143
+ delete it, or rewrite it at the interface when a real contract is behind it.
144
+ - Passes only alone → Diagnose; never mark it serial to hide it.
145
+
146
+ Prune as you go: a change that touches a test file applies these rules to that
147
+ file only. A whole-suite sweep is an Audit the user asked for.
148
+
149
+ Result: each removal names the owning test that still covers the contract, or
150
+ states that the contract is gone.
151
+
152
+ ## Audit
153
+
154
+ 1. Run `node ${MIXDOG_SKILL_DIR}/scripts/inventory.mjs <project-root>`
155
+ (`--json` for data). Result: per-area counts, lanes, languages, risk
156
+ markers, and defect skips for JS/TS, Python, Go and Rust.
157
+ 2. Read `references/case-management.md` and rank findings by impact: defect
158
+ skips, risky markers in the fast lane, duplicate owners.
159
+ 3. Report one table (area, finding, count, proposed action) and wait for the
160
+ user's choice of batches. Audit ends at this report; fix only the batches
161
+ the user picks, one or two at a time, each verified by its covering files.
162
+
163
+ ## Pitfalls
164
+
165
+ - Parsing localized tool output (a console in another language, a busy host
166
+ dropping rows) passed on the author's machine and failed elsewhere. Query a
167
+ structured source.
168
+ - Fixed sleeps passed alone and failed in bulk when other work ran.
169
+ - A load generator or server started by an agent was detached, outlived the
170
+ agent and froze the machine. Nothing detached survives a report.
171
+ - Render tests passed while the real screen hid a row: assert the rendered
172
+ output, not the inputs.
173
+ - Full lanes that take many minutes fail under load; selection, not more
174
+ retries, fixes that.
175
+
176
+ ## Verification
177
+
178
+ - Write/fix: the focused file passes; a new regression test also failed
179
+ before, and the report quotes both.
180
+ - Diagnose: the named cause and its evidence. Only when the user asked for a
181
+ fix: the deterministic trigger and its passing run.
182
+ - Every mode: no process you started is still running.
183
+
184
+ ## Resources
185
+
186
+ - `references/reliability.md` — read when a test touches time, processes,
187
+ ports, files, environment, locale or the platform, or when diagnosing.
188
+ - `references/flaky-policy.md` — read when a failure is intermittent.
189
+ - `references/suite-design.md` — read when writing a test, choosing its lane
190
+ or file, or reviewing how a suite is organized.
191
+ - `references/case-management.md` — read for Audit, or when adding a new
192
+ area.
193
+ - `scripts/inventory.mjs` — run for Audit; read-only, bounded, Markdown or
194
+ `--json`.
@@ -0,0 +1,51 @@
1
+ # Test case management
2
+
3
+ Every test has an owner, a single contract and a lane. None of this belongs in a hand-written registry: hand lists
4
+ drift from the code. It is derived from where the file lives, its name and its
5
+ text, and `scripts/inventory.mjs` reports it.
6
+
7
+ ## Where a test lives
8
+
9
+ - Beside the code it exercises, in the same area directory; the inventory's
10
+ area is the path below the source root, two levels deep.
11
+ - One domain per file (`suite-design.md`).
12
+ - Cross-area contract suites live in their own directory and still run in CI.
13
+
14
+ ## What the inventory reads
15
+
16
+ | Ecosystem | Test files found by | Skip records |
17
+ |---|---|---|
18
+ | JS/TS (`node:test`, Vitest, Jest) | `*.test.*`, `*.spec.*`, `*-test.mjs`, `__tests__/` | `skip:` option, `it.skip`, `xit`, `skipIf` |
19
+ | Python (pytest, unittest) | `test_*.py`, `*_test.py` | `pytest.mark.skip/skipif/xfail`, `unittest.skip*`, `pytest.skip` |
20
+ | Go | `*_test.go` | `t.Skip`, `t.Skipf`, `t.SkipNow` |
21
+ | Rust | `tests/` directories, files with `#[test]` or `#[cfg(test)]` | `#[ignore]`, `#[ignore = "…"]`, `cfg_attr(…, ignore)` |
22
+
23
+ Lane comes from a `.slow.`, `.live.`, `.e2e.`, `.integration.` or `.electron.`
24
+ name tag (JS/TS); everything else counts as fast. Vendored, build and cache
25
+ directories are skipped and links are not followed.
26
+
27
+ Skip kinds: `capability` (the reason names a missing platform, tool or
28
+ privilege; a conditional skip with no reason counts here), `tracked` (`#N`),
29
+ `untracked` (a defect-looking skip with no issue) and `expired` (`until
30
+ YYYY-MM-DD` in the past). Every kind but `capability` is a defect skip that
31
+ needs a fix; an issue number does not make it acceptable.
32
+
33
+ ## Risk markers
34
+
35
+ | Marker | Meaning | Expected action |
36
+ |---|---|---|
37
+ | `timer` | Sleep, timeout or ticker in a test | Replace with a signal or fake clock unless time is the subject |
38
+ | `spawn` | Real child process | Keep only when the process is the subject; await exit |
39
+ | `port` | Listener on a fixed port | Bind port 0 |
40
+ | `clock` | Real clock read without a fake clock | Inject or fake the clock when the verdict depends on it |
41
+ | `source-text` | Reads source and matches its text | Rewrite at a runnable interface, or justify in the test |
42
+
43
+ A fake-clock library in the file clears `timer` and `clock`. Markers are
44
+ leads, not verdicts: a timer in a test about timers is correct.
45
+
46
+ ## Audit report
47
+
48
+ One table per project: area, files, fast/slow counts, marker counts, defect
49
+ skips. Rank batches by: defect skips, fast-lane
50
+ files with `timer`+`spawn`, then the rest by area. The audit ends at the
51
+ report; fix only the batches the user picks.
@@ -0,0 +1,39 @@
1
+ # Flaky-test policy
2
+
3
+ ## Rules
4
+
5
+ 1. **Zero flakes.** A test that passes and fails on the same code is a defect.
6
+ CI never retries automatically, and a passing rerun clears nothing.
7
+ 2. **Fix, never skip.** Fix the cause, or move a correctly slow test to the
8
+ slow lane. A failure that cannot be fixed now is reported; skipping it is
9
+ the user's decision, never the agent's.
10
+ 3. **Capability skips only.** A skip states the capability the platform or
11
+ machine lacks (a tool, an OS feature), never a defect.
12
+ 4. **Evidence over memory.** Decide from the failing log and CI history, not
13
+ from "it is always flaky". Keep both the failed and the passing log.
14
+ 5. **No local stress.** Reproduction happens through a deterministic trigger
15
+ in the test, or in CI history; never by loading or looping on the user's
16
+ machine.
17
+
18
+ ## A flake report
19
+
20
+ When a flake is handed off, one tracked issue carries: the test and file, the
21
+ failing assertion and log, the platform and load conditions, when it first
22
+ appeared, how often in CI history, and the suspected cause with its evidence.
23
+ One issue per test, so ownership stays clear.
24
+
25
+ ## Priority
26
+
27
+ Fix in this order:
28
+
29
+ 1. Tests that block a release or a push.
30
+ 2. Tests failing most often across recent CI runs.
31
+ 3. Tests whose cause can also hit users (product races, localized output).
32
+ 4. Everything else, batched by area.
33
+
34
+ ## What does not count as a fix
35
+
36
+ - Raising a timeout to absorb a sleep, poll or production interval.
37
+ - Adding retries, a rerun-failed CI step, or a serial flag to hide contention.
38
+ - Skipping on a platform that has the capability.
39
+ - Deleting the assertion that failed.
@@ -0,0 +1,49 @@
1
+ # Reliable tests
2
+
3
+ A test must give the same verdict alone, beside other suites, on a busy
4
+ machine, on a localized OS and in CI. Process isolation does not isolate
5
+ ports, paths, child processes, the clock or the host's language.
6
+
7
+ ## Cause table
8
+
9
+ | Cause | Signal | Fix |
10
+ |---|---|---|
11
+ | Timing | Passes alone, fails when other work runs; a sleep or a fixed budget decides the verdict | Wait on the event, promise or state the code produces; fake the clock when time is the subject |
12
+ | Shared resource | Fixed port, fixed temp path, shared data dir, a leftover process | Bind port 0 and read the assigned port; a fresh temp dir per test; per-test data dirs |
13
+ | Unrestored global | Later tests change behaviour; order matters | Restore environment variables, working directory, timers, mocks and locale in a `finally`/fixture teardown right after the change |
14
+ | Platform / locale | Fails on another OS, language or console code page | Query structured sources; never parse localized tool text; remember Windows environment names are case-insensitive |
15
+ | Order | Depends on a previous test's state | Each test creates and removes its own prerequisites |
16
+ | Teardown | Next test sees a live child, open handle or locked file | Await child exit, server close and handle release before the test ends |
17
+
18
+ ## Time
19
+
20
+ - A timeout only bounds a wait on a real signal; it never makes the assertion
21
+ true. Keep the outer wait far larger than any deadline under test.
22
+ - When the deadline itself is the subject, inject or fake the clock and
23
+ restore real time in teardown.
24
+ - Do not assert scheduler ordering unless the order is the product contract;
25
+ place races with deferred promises at a chosen point instead.
26
+
27
+ ## Processes and ports
28
+
29
+ - Count spawns: a process start costs tens of milliseconds on Windows and much
30
+ more under load. Spawn once per file when the behaviour allows it.
31
+ - A test that starts a process owns its whole tree: kill it and await exit,
32
+ detached children included, before the test ends.
33
+ - Prefer an in-process fake over a real server unless the real process is the
34
+ subject.
35
+
36
+ ## Files and environment
37
+
38
+ - Use a private temp root per test and remove it afterwards; never write into
39
+ the user's home configuration or the repository tree.
40
+ - Windows releases handles asynchronously: a rename or delete right after a
41
+ close may need a bounded retry sized to the observed contention.
42
+ - Point every home, data or cache directory variable the code reads at the
43
+ test's own root.
44
+
45
+ ## Proof
46
+
47
+ A reliability fix is proven by a deterministic trigger of the named cause
48
+ (held promise, fake clock, localized fixture, pre-bound port) that fails before
49
+ and passes after, not by repeating the test until it stays green.
@@ -0,0 +1,78 @@
1
+ # Suite design
2
+
3
+ How a suite stays small, fast and honest. Apply when writing, placing or
4
+ reviewing tests.
5
+
6
+ ## A good test
7
+
8
+ - **Names the break.** Before writing, state the production change that should
9
+ make it fail, and whether that change is a bug or a decision. Cannot name
10
+ one → redesign around an observable behaviour.
11
+ - **Independent expected value.** A literal or hand-checked fixture, never a
12
+ value recomputed with the code under test or its helpers.
13
+ - **No change detectors.** If only intentional decisions can fail it (a
14
+ constant, exact message wording, private structure), test the behaviour that
15
+ depends on the decision instead.
16
+ - **Your code, not the framework's.** Test the contract at your boundaries;
17
+ trivial getters and forwarding earn tests only when they validate,
18
+ normalize, derive or cause side effects.
19
+ - **Through the interface.** Mock only at system boundaries (network, clock,
20
+ randomness, slow or external stores), never your own modules; pass
21
+ dependencies in so a boundary is easy to replace.
22
+ - **One behaviour per test**, small enough that a failure points at one cause.
23
+ Write one test at a time, as needed; never bulk-generate cases.
24
+
25
+ ## One invariant, one owning test
26
+
27
+ Two tests asserting the same contract drift apart instead of reinforcing each
28
+ other: when the contract changes, one is updated and the other keeps asserting
29
+ a retired behaviour. Name an owner per contract; every other test covers a
30
+ distinct observable boundary. When an overlap appears, reduce both to what is
31
+ distinct, or keep the owner and move the unique cases into it.
32
+
33
+ ## Text matching is a last resort
34
+
35
+ Asserting against source text pins names, spacing and constants instead of
36
+ behaviour. It breaks on harmless refactors and passes on wrong behaviour, so it
37
+ proves neither direction. Reserve it for artifacts with no runnable surface
38
+ (generated scripts, workflow YAML, prompt text) or for ordering invariants in
39
+ code a test cannot import (a guard must precede a send), and say why in the
40
+ test. Keep the list of such files short and known.
41
+
42
+ ## A contract suite must run in CI
43
+
44
+ A suite that asserts a contract but runs nowhere automatic is documentation
45
+ with an expiry date: nothing forces it to follow the code, and it fails the
46
+ first time someone runs it. Make it discoverable like every other test and give
47
+ it a CI job. Checks that need a built artifact run after the build step, not
48
+ nowhere. Scripts that are not test files (smoke scripts, harness runners) get a
49
+ scheduled sweep that enumerates them, so new ones join automatically and stale
50
+ exclusions fail closed.
51
+
52
+ ## One domain per file
53
+
54
+ A multi-domain test file makes every change pay a whole-file search. Split when
55
+ one change forces a search across domains, not on line count alone; shared
56
+ fixtures move into a helper beside the files. One stateful fixture chain over
57
+ one domain stays one file whatever its length.
58
+
59
+ ## Slow work gets its own lane
60
+
61
+ A test over roughly ten seconds alone goes to a slow lane marked by name,
62
+ directory or tag, whichever the runner selects on. It still runs in CI, in a
63
+ parallel job, so the gate takes the longer of the two instead of their sum.
64
+ Tests that need a built artifact or a live system get a live lane. If a file
65
+ is slow only in a full run because processes contend, the cause is contention,
66
+ not a slow file: Diagnose, do not move it.
67
+
68
+ ## Selection beats retries
69
+
70
+ During a change run the files that reach the changed code (the project's
71
+ changed-files selection, a path or name filter, a single test id). The full
72
+ lanes gate the push. A suite that takes minutes is a design problem to fix by
73
+ selection and sharding in CI, not by waiting on the user's machine.
74
+
75
+ ## Published artifacts carry no tests
76
+
77
+ Check that packaging excludes test sources, and that test-only changes do not
78
+ invalidate caches keyed on the shipped files.