@kontourai/flow-agents 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/.github/workflows/add-to-project.yml +15 -0
  2. package/.github/workflows/ci.yml +173 -0
  3. package/CHANGELOG.md +54 -0
  4. package/CONTEXT.md +5 -1
  5. package/README.md +19 -8
  6. package/build/src/builder-flow-run-adapter.d.ts +80 -0
  7. package/build/src/builder-flow-run-adapter.js +241 -0
  8. package/build/src/builder-flow-runtime.d.ts +16 -0
  9. package/build/src/builder-flow-runtime.js +290 -0
  10. package/build/src/cli/assignment-provider.js +10 -1
  11. package/build/src/cli/builder-run.d.ts +1 -0
  12. package/build/src/cli/builder-run.js +27 -0
  13. package/build/src/cli/effective-backlog-settings.js +70 -2
  14. package/build/src/cli/init.d.ts +34 -0
  15. package/build/src/cli/init.js +341 -61
  16. package/build/src/cli/kit.js +55 -12
  17. package/build/src/cli/pull-work-provider.js +346 -5
  18. package/build/src/cli/skill-drift-check.d.ts +1 -0
  19. package/build/src/cli/skill-drift-check.js +165 -0
  20. package/build/src/cli/telemetry-doctor.d.ts +37 -0
  21. package/build/src/cli/telemetry-doctor.js +53 -6
  22. package/build/src/cli/validate-hook-influence.js +37 -7
  23. package/build/src/cli/workflow-artifact-cleanup-audit.js +418 -11
  24. package/build/src/cli/workflow-sidecar.d.ts +310 -1
  25. package/build/src/cli/workflow-sidecar.js +1914 -126
  26. package/build/src/cli.js +5 -0
  27. package/build/src/flow-kit/validate.d.ts +54 -34
  28. package/build/src/flow-kit/validate.js +237 -26
  29. package/build/src/index.d.ts +2 -0
  30. package/build/src/index.js +1 -0
  31. package/build/src/lib/console-connect-options.d.ts +97 -0
  32. package/build/src/lib/console-connect-options.js +199 -0
  33. package/build/src/lib/console-telemetry-validate.d.ts +49 -0
  34. package/build/src/lib/console-telemetry-validate.js +91 -0
  35. package/build/src/lib/flow-resolver.d.ts +54 -1
  36. package/build/src/lib/flow-resolver.js +112 -5
  37. package/build/src/lib/fs.d.ts +17 -0
  38. package/build/src/lib/fs.js +172 -0
  39. package/build/src/lib/local-artifact-root.d.ts +44 -1
  40. package/build/src/lib/local-artifact-root.js +131 -3
  41. package/build/src/runtime-adapters.d.ts +39 -3
  42. package/build/src/runtime-adapters.js +77 -31
  43. package/build/src/tools/build-universal-bundles.js +40 -2
  44. package/build/src/tools/codex-agent-routing.d.ts +2 -0
  45. package/build/src/tools/codex-agent-routing.js +49 -0
  46. package/build/src/tools/generate-context-map.js +1 -0
  47. package/build/src/tools/validate-source-tree.js +30 -3
  48. package/context/contracts/artifact-contract.md +16 -2
  49. package/context/scripts/hooks/lib/kit-catalog.js +235 -0
  50. package/context/scripts/hooks/lib/runnable-command.js +177 -0
  51. package/context/scripts/hooks/stop-goal-fit.js +278 -48
  52. package/context/scripts/hooks/workflow-steering.js +194 -22
  53. package/context/scripts/package.json +3 -0
  54. package/context/scripts/telemetry/install-console-config.sh +25 -4
  55. package/context/scripts/telemetry/lib/config.sh +102 -12
  56. package/context/scripts/telemetry/lib/pricing.sh +50 -0
  57. package/context/scripts/telemetry/lib/session.sh +3 -0
  58. package/context/scripts/telemetry/lib/transport.sh +87 -0
  59. package/context/scripts/telemetry/lib/usage.sh +205 -4
  60. package/context/scripts/telemetry/telemetry.conf +6 -0
  61. package/context/scripts/telemetry/telemetry.sh +48 -0
  62. package/context/settings/workspace-backlog-provider-settings.example.json +48 -0
  63. package/docs/agent-usage-feedback-loop.md +35 -0
  64. package/docs/architecture-engine-and-kits.md +110 -0
  65. package/docs/context-map.md +2 -0
  66. package/docs/coordination-guide.md +370 -0
  67. package/docs/decisions/agent-coordination.md +26 -9
  68. package/docs/decisions/embeddable-engine.md +152 -0
  69. package/docs/decisions/index.md +5 -3
  70. package/docs/decisions/trust-ledger-retention.md +88 -0
  71. package/docs/decisions/trust-reconcile.md +42 -9
  72. package/docs/decisions/workflow-enforcement.md +31 -9
  73. package/docs/fixture-ownership.md +6 -2
  74. package/docs/implementing-trust-reconciliation.md +129 -0
  75. package/docs/index.md +23 -9
  76. package/docs/integrations/flow-agents-console.md +275 -0
  77. package/docs/integrations/index.md +4 -0
  78. package/docs/kit-authoring-guide.md +52 -21
  79. package/docs/spec/builder-flow-runtime.md +80 -0
  80. package/docs/spec/runtime-hook-surface.md +45 -1
  81. package/docs/specs/economics-record-contract.md +270 -0
  82. package/docs/specs/harness-capability-matrix.md +74 -0
  83. package/docs/specs/learning-review-proposals-contract.md +340 -0
  84. package/docs/specs/routing-efficiency-review.md +59 -0
  85. package/docs/verifiable-trust.md +74 -25
  86. package/docs/workflow-artifact-lifecycle.md +38 -1
  87. package/docs/workflow-usage-guide.md +10 -0
  88. package/evals/acceptance/prove-capture-teeth.sh +132 -0
  89. package/evals/ci/antigaming-suite.sh +2 -0
  90. package/evals/ci/run-baseline.sh +78 -4
  91. package/evals/fixtures/economics/acceptance.json +12 -0
  92. package/evals/fixtures/economics/agents/tool-worker-1/events.jsonl +2 -0
  93. package/evals/fixtures/economics/agents/tool-worker-2/events.jsonl +2 -0
  94. package/evals/fixtures/economics/agents/tool-worker-3/events.jsonl +2 -0
  95. package/evals/fixtures/economics/agents/tool-worker-4/events.jsonl +1 -0
  96. package/evals/fixtures/economics/agents/tool-worker-5/events.jsonl +2 -0
  97. package/evals/fixtures/economics/critique.json +22 -0
  98. package/evals/fixtures/economics/expected-record.json +71 -0
  99. package/evals/fixtures/economics/session-usage-event.json +1 -0
  100. package/evals/fixtures/economics/state.json +11 -0
  101. package/evals/fixtures/economics/transcript.jsonl +3 -0
  102. package/evals/fixtures/hook-influence/cases.json +7 -7
  103. package/evals/fixtures/learning-review-proposals/balanced/economics.jsonl +6 -0
  104. package/evals/fixtures/learning-review-proposals/effect-follow-up/economics.jsonl +5 -0
  105. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-1/trust.bundle +21 -0
  106. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-2/trust.bundle +21 -0
  107. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-3/trust.bundle +21 -0
  108. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-4/trust.bundle +21 -0
  109. package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-5/trust.bundle +21 -0
  110. package/evals/fixtures/learning-review-proposals/pattern-present/economics.jsonl +6 -0
  111. package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.json +30 -0
  112. package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.md +66 -0
  113. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/gate-review.inquiries.json +26 -0
  114. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/trust.bundle +21 -0
  115. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/gate-review.inquiries.json +26 -0
  116. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/trust.bundle +21 -0
  117. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/gate-review.inquiries.json +26 -0
  118. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/trust.bundle +21 -0
  119. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/gate-review.inquiries.json +26 -0
  120. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/trust.bundle +21 -0
  121. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-5/trust.bundle +21 -0
  122. package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-6/trust.bundle +21 -0
  123. package/evals/fixtures/learning-review-proposals/repeat-window/economics.jsonl +6 -0
  124. package/evals/fixtures/learning-review-proposals/under-threshold/economics.jsonl +3 -0
  125. package/evals/fixtures/reconcile-preflight/disputed-critique-unsuperseded.json +48 -0
  126. package/evals/fixtures/reconcile-preflight/standalone-disputed-session-local.json +59 -0
  127. package/evals/fixtures/telemetry/usage-transcript-sample.jsonl +4 -0
  128. package/evals/fixtures/trust-reconcile-exploits/mcp-degrade.json +42 -0
  129. package/evals/integration/test_builder_entry_enforcement.sh +241 -0
  130. package/evals/integration/test_builder_step_producers.sh +18 -10
  131. package/evals/integration/test_bundle_install.sh +172 -0
  132. package/evals/integration/test_checkpoint_signing.sh +10 -2
  133. package/evals/integration/test_ci_actor_identity.sh +221 -0
  134. package/evals/integration/test_console_tenant_isolation.sh +167 -0
  135. package/evals/integration/test_critique_supersession_roundtrip.sh +4 -1
  136. package/evals/integration/test_dual_emit_flow_step.sh +10 -4
  137. package/evals/integration/test_economics_record.sh +674 -0
  138. package/evals/integration/test_effective_backlog_settings.sh +1 -1
  139. package/evals/integration/test_evidence_capture_hook.sh +17 -2
  140. package/evals/integration/test_exemption_usage_review.sh +198 -0
  141. package/evals/integration/test_fixture_retirement_audit.sh +2 -2
  142. package/evals/integration/test_flow_kit_install_git.sh +83 -0
  143. package/evals/integration/test_flowdef_session_activation.sh +0 -1
  144. package/evals/integration/test_flowdef_session_history_preservation.sh +13 -3
  145. package/evals/integration/test_gate_lockdown.sh +7 -0
  146. package/evals/integration/test_gate_review_inquiry_records.sh +9 -1
  147. package/evals/integration/test_goal_fit_hook.sh +2031 -0
  148. package/evals/integration/test_hook_category_behaviors.sh +8 -1
  149. package/evals/integration/test_hook_influence_cases.sh +25 -1
  150. package/evals/integration/test_install_merge.sh +227 -2
  151. package/evals/integration/test_kit_conformance_levels.sh +6 -6
  152. package/evals/integration/test_learning_review_proposals.sh +329 -0
  153. package/evals/integration/test_liveness_conflict_injection.sh +26 -22
  154. package/evals/integration/test_liveness_console_relay.sh +166 -0
  155. package/evals/integration/test_liveness_heartbeat.sh +17 -17
  156. package/evals/integration/test_liveness_worktree_root.sh +575 -0
  157. package/evals/integration/test_phase_map_and_gate_claim.sh +6 -1
  158. package/evals/integration/test_publish_delivery.sh +389 -2
  159. package/evals/integration/test_pull_work_board.sh +200 -0
  160. package/evals/integration/test_pull_work_provider.sh +1 -1
  161. package/evals/integration/test_reconcile_preflight.sh +304 -0
  162. package/evals/integration/test_record_check.sh +378 -0
  163. package/evals/integration/test_routing_efficiency.sh +71 -0
  164. package/evals/integration/test_runtime_adapter_activation.sh +28 -0
  165. package/evals/integration/test_session_resume_roundtrip.sh +16 -19
  166. package/evals/integration/test_skill_drift_check.sh +870 -0
  167. package/evals/integration/test_takeover_protocol.sh +340 -0
  168. package/evals/integration/test_telemetry.sh +445 -0
  169. package/evals/integration/test_telemetry_doctor.sh +66 -0
  170. package/evals/integration/test_telemetry_usage_pipeline.sh +228 -0
  171. package/evals/integration/test_trust_reconcile_negatives.sh +121 -13
  172. package/evals/integration/test_trust_reconcile_trailer_diagnostic.sh +247 -0
  173. package/evals/integration/test_usage_cost.sh +61 -0
  174. package/evals/integration/test_verify_hold.sh +910 -0
  175. package/evals/integration/test_veritas_governance_kit.sh +257 -0
  176. package/evals/integration/test_workflow_artifact_cleanup_audit.sh +575 -3
  177. package/evals/integration/test_workflow_sidecar_writer.sh +1395 -0
  178. package/evals/integration/test_workflow_steering_hook.sh +157 -16
  179. package/evals/integration/test_workspace_settings.sh +176 -0
  180. package/evals/lib/env.sh +26 -0
  181. package/evals/lib/node.sh +8 -0
  182. package/evals/run.sh +37 -0
  183. package/evals/static/test_ci_integration_coverage.sh +115 -0
  184. package/evals/static/test_declared_scope_forms_documented.sh +114 -0
  185. package/evals/static/test_universal_bundles.sh +34 -0
  186. package/evals/static/test_validate_source_kit_asset_scope.sh +259 -0
  187. package/evals/static/test_workflow_skills.sh +1 -1
  188. package/kits/builder/flows/build.flow.json +9 -18
  189. package/kits/builder/flows/publish-learn.flow.json +5 -1
  190. package/kits/builder/kit.json +120 -0
  191. package/kits/builder/skills/continue-work/SKILL.md +2 -0
  192. package/kits/builder/skills/deliver/SKILL.md +115 -0
  193. package/kits/builder/skills/evidence-gate/SKILL.md +12 -0
  194. package/kits/builder/skills/execute-plan/SKILL.md +9 -0
  195. package/kits/builder/skills/learning-review/SKILL.md +51 -0
  196. package/kits/builder/skills/plan-work/SKILL.md +17 -20
  197. package/kits/builder/skills/pull-work/SKILL.md +33 -2
  198. package/kits/builder/skills/release-readiness/SKILL.md +12 -0
  199. package/kits/knowledge/kit.json +9 -0
  200. package/kits/veritas-governance/docs/README.md +113 -7
  201. package/kits/veritas-governance/fixtures/exemption/approved.trust-bundle.json +74 -0
  202. package/kits/veritas-governance/fixtures/exemption/not-approved.trust-bundle.json +74 -0
  203. package/kits/veritas-governance/fixtures/exemption-review/mixed-fresh-stale.DECLARED.json +14 -0
  204. package/kits/veritas-governance/flows/exemption-issuance.flow.json +35 -0
  205. package/kits/veritas-governance/kit.json +19 -0
  206. package/kits/veritas-governance/skills/exemption-usage-review/SKILL.md +128 -0
  207. package/kits/veritas-governance/skills/exemption-usage-review/review-exemptions.mjs +231 -0
  208. package/package.json +2 -2
  209. package/packaging/manifest.json +29 -0
  210. package/schemas/backlog-provider-settings.schema.json +13 -0
  211. package/schemas/workflow-state.schema.json +44 -0
  212. package/scripts/README.md +4 -0
  213. package/scripts/check-content-boundary.cjs +8 -1
  214. package/scripts/ci/trust-reconcile.js +214 -253
  215. package/scripts/hooks/codex-hook-adapter.js +77 -2
  216. package/scripts/hooks/evidence-capture.js +38 -5
  217. package/scripts/hooks/lib/actor-identity.js +82 -0
  218. package/scripts/hooks/lib/codex-exit-code.js +316 -0
  219. package/scripts/hooks/lib/kit-catalog.js +235 -0
  220. package/scripts/hooks/lib/liveness-write.js +28 -1
  221. package/scripts/hooks/lib/local-artifact-paths.js +97 -1
  222. package/scripts/hooks/lib/runnable-command.js +177 -0
  223. package/scripts/hooks/lib/skill-drift.js +350 -0
  224. package/scripts/hooks/stop-goal-fit.js +278 -48
  225. package/scripts/hooks/workflow-steering.js +194 -22
  226. package/scripts/install-codex-home.sh +97 -47
  227. package/scripts/install-merge.js +72 -14
  228. package/scripts/install-owned-files.js +178 -0
  229. package/scripts/lib/reconcile-shape.js +381 -0
  230. package/scripts/liveness/relay.sh +84 -0
  231. package/scripts/telemetry/economics-record.schema.json +145 -0
  232. package/scripts/telemetry/economics-record.sh +331 -0
  233. package/scripts/telemetry/install-console-config.sh +25 -4
  234. package/scripts/telemetry/learning-review-decide.sh +124 -0
  235. package/scripts/telemetry/learning-review-proposals.schema.json +161 -0
  236. package/scripts/telemetry/learning-review-proposals.sh +484 -0
  237. package/scripts/telemetry/lib/config.sh +102 -12
  238. package/scripts/telemetry/lib/pricing.sh +14 -6
  239. package/scripts/telemetry/lib/session.sh +3 -0
  240. package/scripts/telemetry/lib/transport.sh +133 -15
  241. package/scripts/telemetry/lib/usage.sh +121 -28
  242. package/scripts/telemetry/routing-efficiency.sh +0 -0
  243. package/scripts/telemetry/telemetry.conf +6 -0
  244. package/scripts/telemetry/telemetry.sh +48 -0
  245. package/src/builder-flow-run-adapter.ts +357 -0
  246. package/src/builder-flow-runtime.ts +348 -0
  247. package/src/cli/assignment-provider.ts +12 -1
  248. package/src/cli/builder-flow-run-adapter.test.mjs +495 -0
  249. package/src/cli/builder-flow-runtime.test.mjs +213 -0
  250. package/src/cli/builder-run.ts +28 -0
  251. package/src/cli/codex-agent-routing.test.mjs +44 -0
  252. package/src/cli/codex-exit-code.test.mjs +207 -0
  253. package/src/cli/console-connect-options.test.mjs +329 -0
  254. package/src/cli/console-telemetry-validate.test.mjs +157 -0
  255. package/src/cli/effective-backlog-settings.ts +68 -2
  256. package/src/cli/flow-resolver-composition.test.mjs +72 -0
  257. package/src/cli/init.test.mjs +161 -0
  258. package/src/cli/init.ts +407 -62
  259. package/src/cli/kit-metadata-security.test.mjs +443 -0
  260. package/src/cli/kit.ts +50 -12
  261. package/src/cli/pull-work-provider.ts +377 -3
  262. package/src/cli/sidecar-pure-helpers.test.mjs +64 -0
  263. package/src/cli/skill-drift-check.ts +196 -0
  264. package/src/cli/telemetry-doctor.test.mjs +53 -0
  265. package/src/cli/telemetry-doctor.ts +50 -7
  266. package/src/cli/validate-hook-influence.ts +37 -6
  267. package/src/cli/workflow-artifact-cleanup-audit.ts +483 -10
  268. package/src/cli/workflow-sidecar.ts +1980 -119
  269. package/src/cli.ts +5 -0
  270. package/src/flow-kit/validate.ts +277 -38
  271. package/src/index.ts +19 -0
  272. package/src/lib/console-connect-options.ts +261 -0
  273. package/src/lib/console-telemetry-validate.ts +88 -0
  274. package/src/lib/flow-resolver.ts +117 -4
  275. package/src/lib/fs.ts +160 -0
  276. package/src/lib/local-artifact-root.ts +129 -3
  277. package/src/runtime-adapters.ts +113 -33
  278. package/src/tools/build-universal-bundles.ts +36 -2
  279. package/src/tools/codex-agent-routing.ts +48 -0
  280. package/src/tools/generate-context-map.ts +1 -0
  281. package/src/tools/validate-source-tree.ts +29 -3
@@ -104,8 +104,140 @@ run_bundle(){ # $1 label, $2 install.sh, $3 settings-json-rel, $4 home-env-name
104
104
  fi
105
105
  }
106
106
 
107
+
108
+ # --- Codex-shaped extraction teeth (#470): the codex PostToolUse payload has
109
+ # NO structured exit code; the only deterministic signal is the host-authored
110
+ # banner "Process exited with code N" inside the session rollout's
111
+ # function_call_output at transcript_path. This runs the INSTALLED codex
112
+ # adapter hook command directly (mirrors run_bundle's own live-capture probe)
113
+ # and proves the injected exit code is never coerced to a false "pass".
114
+ codex_banner_teeth(){
115
+ echo ""
116
+ echo "── Codex banner extraction: host-prose exit code teeth ──"
117
+ local home; home="$(mktemp -d)"
118
+ bash "$ROOT/dist/codex/install.sh" "$home" >/dev/null 2>&1 || { _f "Codex banner: install.sh failed"; return; }
119
+ local cfg="$home/.codex/hooks.json"
120
+ local capcmd; capcmd="$(hook_cmd "$cfg" PostToolUse evidence-capture)"
121
+ [ -n "$capcmd" ] || { _f "Codex banner: no PostToolUse evidence-capture hook in shipped config"; return; }
122
+
123
+ # --- FAIL case: rollout banner "Process exited with code 1" → must NEVER be
124
+ # recorded as pass; must be fail with exitCode:1 ---
125
+ local proj_fail; proj_fail="$(mktemp -d)"
126
+ mkdir -p "$proj_fail/.kontourai/flow-agents/cap-codex-fail"
127
+ printf '# Repo\n' > "$proj_fail/AGENTS.md"
128
+ printf '%s' '{"schema_version":"1.0","task_slug":"cap-codex-fail","status":"in_progress","phase":"verification","updated_at":"2026-06-23T00:00:00Z"}' > "$proj_fail/.kontourai/flow-agents/cap-codex-fail/state.json"
129
+ local rollout_fail="$proj_fail/rollout-fail.jsonl"
130
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:00Z","type":"turn_context","payload":{}}' > "$rollout_fail"
131
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:05Z","type":"response_item","payload":{"type":"function_call_output","call_id":"call_x","output":"Chunk ID: x\nWall time: 0.05 seconds\nProcess exited with code 1\nOriginal token count: 25\nOutput:\n..."}}' >> "$rollout_fail"
132
+ printf '{"hook_event_name":"PostToolUse","tool_name":"Bash","cwd":"%s","tool_input":{"command":"npm test"},"transcript_path":"%s"}' "$proj_fail" "$rollout_fail" \
133
+ | env CODEX_HOME="$home" CLAUDE_PROJECT_DIR="$home" bash -c "$capcmd" >/dev/null 2>&1 || true
134
+ local log_fail="$proj_fail/.kontourai/flow-agents/cap-codex-fail/command-log.jsonl"
135
+ if rg -q '"command":"npm test","observedResult":"pass"' "$log_fail" 2>/dev/null; then
136
+ _f "Codex banner: FAIL case falsely recorded observedResult:pass: $(cat "$log_fail" 2>/dev/null)"
137
+ elif rg -q '"command":"npm test","observedResult":"fail","exitCode":1' "$log_fail" 2>/dev/null; then
138
+ _p "Codex banner extraction records host-prose 'Process exited with code 1' as fail, exitCode:1 (never pass)"
139
+ else
140
+ _f "Codex banner: FAIL case did not record fail/exitCode:1: $(cat "$log_fail" 2>/dev/null)"
141
+ fi
142
+
143
+ # --- Positive twin: rollout banner "Process exited with code 0" → pass, exitCode:0 ---
144
+ local proj_pass; proj_pass="$(mktemp -d)"
145
+ mkdir -p "$proj_pass/.kontourai/flow-agents/cap-codex-pass"
146
+ printf '# Repo\n' > "$proj_pass/AGENTS.md"
147
+ printf '%s' '{"schema_version":"1.0","task_slug":"cap-codex-pass","status":"in_progress","phase":"verification","updated_at":"2026-06-23T00:00:00Z"}' > "$proj_pass/.kontourai/flow-agents/cap-codex-pass/state.json"
148
+ local rollout_pass="$proj_pass/rollout-pass.jsonl"
149
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:00Z","type":"turn_context","payload":{}}' > "$rollout_pass"
150
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:05Z","type":"response_item","payload":{"type":"function_call_output","call_id":"call_y","output":"Chunk ID: y\nWall time: 0.03 seconds\nProcess exited with code 0\nOriginal token count: 12\nOutput:\n..."}}' >> "$rollout_pass"
151
+ printf '{"hook_event_name":"PostToolUse","tool_name":"Bash","cwd":"%s","tool_input":{"command":"npm test"},"transcript_path":"%s"}' "$proj_pass" "$rollout_pass" \
152
+ | env CODEX_HOME="$home" CLAUDE_PROJECT_DIR="$home" bash -c "$capcmd" >/dev/null 2>&1 || true
153
+ local log_pass="$proj_pass/.kontourai/flow-agents/cap-codex-pass/command-log.jsonl"
154
+ if rg -q '"command":"npm test","observedResult":"pass","exitCode":0' "$log_pass" 2>/dev/null; then
155
+ _p "Codex banner extraction records host-prose 'Process exited with code 0' as pass, exitCode:0"
156
+ else
157
+ _f "Codex banner: positive twin did not record pass/exitCode:0: $(cat "$log_pass" 2>/dev/null)"
158
+ fi
159
+
160
+ # --- FORGERY case (#470 iteration 2, CRITICAL security finding #1): the host
161
+ # preamble reports "Process exited with code 1" BEFORE the Output: delimiter;
162
+ # the model's OWN stdout AFTER the delimiter maliciously prints "Process
163
+ # exited with code 0" (the exact exploit the security review confirmed).
164
+ # Extraction is preamble-anchored: the post-Output: stdout must never be
165
+ # scanned. Assert the record is fail/exitCode:1 -- NEVER pass.
166
+ local proj_forge; proj_forge="$(mktemp -d)"
167
+ mkdir -p "$proj_forge/.kontourai/flow-agents/cap-codex-forge"
168
+ printf '# Repo\n' > "$proj_forge/AGENTS.md"
169
+ printf '%s' '{"schema_version":"1.0","task_slug":"cap-codex-forge","status":"in_progress","phase":"verification","updated_at":"2026-06-23T00:00:00Z"}' > "$proj_forge/.kontourai/flow-agents/cap-codex-forge/state.json"
170
+ local rollout_forge="$proj_forge/rollout-forge.jsonl"
171
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:00Z","type":"turn_context","payload":{}}' > "$rollout_forge"
172
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:05Z","type":"response_item","payload":{"type":"function_call_output","call_id":"call_forge","output":"Process exited with code 1\nOriginal token count: 25\nOutput:\nProcess exited with code 0\n"}}' >> "$rollout_forge"
173
+ printf '{"hook_event_name":"PostToolUse","tool_name":"Bash","cwd":"%s","tool_input":{"command":"npm test"},"transcript_path":"%s"}' "$proj_forge" "$rollout_forge" \
174
+ | env CODEX_HOME="$home" CLAUDE_PROJECT_DIR="$home" bash -c "$capcmd" >/dev/null 2>&1 || true
175
+ local log_forge="$proj_forge/.kontourai/flow-agents/cap-codex-forge/command-log.jsonl"
176
+ if rg -q '"command":"npm test","observedResult":"pass"' "$log_forge" 2>/dev/null; then
177
+ _f "Codex banner FORGERY: model stdout 'Process exited with code 0' after Output: forged a pass: $(cat "$log_forge" 2>/dev/null)"
178
+ elif rg -q '"command":"npm test","observedResult":"fail","exitCode":1' "$log_forge" 2>/dev/null; then
179
+ _p "Codex banner FORGERY: host preamble 'code 1' wins over forged post-Output: 'code 0' stdout -- recorded fail, exitCode:1, never pass"
180
+ else
181
+ _f "Codex banner FORGERY: did not record fail/exitCode:1 (forgeable path unpinned): $(cat "$log_forge" 2>/dev/null)"
182
+ fi
183
+
184
+ # --- FLOODING case (#470 iteration 2, MEDIUM security finding #5): the
185
+ # failing command's function_call_output carries a valid preamble banner
186
+ # followed by >64KB of stdout after Output: -- a single JSONL line larger
187
+ # than the head-anchored read window. The banner lives at the line HEAD, so
188
+ # the flood must never displace it. Unit tests
189
+ # (src/cli/codex-exit-code.test.mjs) pin this to fail/exitCode:1, never
190
+ # null/ambiguous, via the head-anchored raw-bytes path -- assert the same
191
+ # through the installed adapter.
192
+ local proj_flood; proj_flood="$(mktemp -d)"
193
+ mkdir -p "$proj_flood/.kontourai/flow-agents/cap-codex-flood"
194
+ printf '# Repo\n' > "$proj_flood/AGENTS.md"
195
+ printf '%s' '{"schema_version":"1.0","task_slug":"cap-codex-flood","status":"in_progress","phase":"verification","updated_at":"2026-06-23T00:00:00Z"}' > "$proj_flood/.kontourai/flow-agents/cap-codex-flood/state.json"
196
+ local rollout_flood="$proj_flood/rollout-flood.jsonl"
197
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:00Z","type":"turn_context","payload":{}}' > "$rollout_flood"
198
+ local flood; flood="$(python3 -c "print('A' * 70000, end='')")"
199
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:05Z","type":"response_item","payload":{"type":"function_call_output","call_id":"call_flood","output":"Process exited with code 1\nOriginal token count: 25\nOutput:\n'"$flood"'"}}' >> "$rollout_flood"
200
+ printf '{"hook_event_name":"PostToolUse","tool_name":"Bash","cwd":"%s","tool_input":{"command":"npm test"},"transcript_path":"%s"}' "$proj_flood" "$rollout_flood" \
201
+ | env CODEX_HOME="$home" CLAUDE_PROJECT_DIR="$home" bash -c "$capcmd" >/dev/null 2>&1 || true
202
+ local log_flood="$proj_flood/.kontourai/flow-agents/cap-codex-flood/command-log.jsonl"
203
+ if rg -q '"command":"npm test","observedResult":"pass"' "$log_flood" 2>/dev/null; then
204
+ _f "Codex banner FLOODING: >64KB post-banner stdout falsely forced a pass: $(cat "$log_flood" 2>/dev/null | head -c 300)"
205
+ elif rg -q '"command":"npm test","observedResult":"fail","exitCode":1' "$log_flood" 2>/dev/null; then
206
+ _p "Codex banner FLOODING: >64KB stdout after the banner never displaces the head-anchored preamble -- recorded fail, exitCode:1, never pass"
207
+ else
208
+ _f "Codex banner FLOODING: did not record fail/exitCode:1 (head-anchored read regressed): $(cat "$log_flood" 2>/dev/null | head -c 300)"
209
+ fi
210
+
211
+ # --- CALL_ID case (#470 iteration 2, HIGH finding #4, Decision B): TWO
212
+ # function_call_output entries in the rollout -- an OLDER one (code 0,
213
+ # call_id call_A) and a NEWER one (code 1, call_id call_B). The PostToolUse
214
+ # payload carries call_id call_A (the call this capture actually
215
+ # corresponds to). Assert extraction attributes call_A's exitCode:0 -- call_id
216
+ # correlation wins over "just take the newest banner" -- never mis-attributes
217
+ # call_B's exitCode:1 to call_A's command.
218
+ local proj_callid; proj_callid="$(mktemp -d)"
219
+ mkdir -p "$proj_callid/.kontourai/flow-agents/cap-codex-callid"
220
+ printf '# Repo\n' > "$proj_callid/AGENTS.md"
221
+ printf '%s' '{"schema_version":"1.0","task_slug":"cap-codex-callid","status":"in_progress","phase":"verification","updated_at":"2026-06-23T00:00:00Z"}' > "$proj_callid/.kontourai/flow-agents/cap-codex-callid/state.json"
222
+ local rollout_callid="$proj_callid/rollout-callid.jsonl"
223
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:00Z","type":"turn_context","payload":{}}' > "$rollout_callid"
224
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:05Z","type":"response_item","payload":{"type":"function_call_output","call_id":"call_A","output":"Process exited with code 0\nOriginal token count: 10\nOutput:\n..."}}' >> "$rollout_callid"
225
+ printf '%s\n' '{"timestamp":"2026-06-23T00:00:10Z","type":"response_item","payload":{"type":"function_call_output","call_id":"call_B","output":"Process exited with code 1\nOriginal token count: 8\nOutput:\n..."}}' >> "$rollout_callid"
226
+ printf '{"hook_event_name":"PostToolUse","tool_name":"Bash","cwd":"%s","tool_input":{"command":"npm test"},"transcript_path":"%s","call_id":"call_A"}' "$proj_callid" "$rollout_callid" \
227
+ | env CODEX_HOME="$home" CLAUDE_PROJECT_DIR="$home" bash -c "$capcmd" >/dev/null 2>&1 || true
228
+ local log_callid="$proj_callid/.kontourai/flow-agents/cap-codex-callid/command-log.jsonl"
229
+ if rg -q '"command":"npm test","observedResult":"fail","exitCode":1' "$log_callid" 2>/dev/null; then
230
+ _f "Codex banner CALL_ID: mis-attributed the NEWER call_B's exitCode:1 to the call_A payload instead of call_A's own exitCode:0: $(cat "$log_callid" 2>/dev/null)"
231
+ elif rg -q '"command":"npm test","observedResult":"pass","exitCode":0' "$log_callid" 2>/dev/null; then
232
+ _p "Codex banner CALL_ID: call_id correlation attributes the matching call_A entry's exitCode:0, not the newer call_B's exitCode:1"
233
+ else
234
+ _f "Codex banner CALL_ID: did not record pass/exitCode:0 for the call_id-matched entry: $(cat "$log_callid" 2>/dev/null)"
235
+ fi
236
+ }
237
+
107
238
  run_bundle "Claude Code" "$ROOT/dist/claude-code/install.sh" ".claude/settings.json" "CLAUDE_PROJECT_DIR"
108
239
  run_bundle "Codex" "$ROOT/dist/codex/install.sh" ".codex/hooks.json" "CODEX_HOME"
240
+ codex_banner_teeth
109
241
 
110
242
  echo ""
111
243
  echo "──────────────────────────────────"
@@ -25,6 +25,7 @@ TESTS=(
25
25
  "evals/integration/test_enforcer_expects_driven.sh"
26
26
  "evals/integration/test_goal_fit_rederive.sh"
27
27
  "evals/integration/test_flowdef_session_activation.sh"
28
+ "evals/integration/test_builder_entry_enforcement.sh"
28
29
  "evals/integration/test_flowdef_union_floor_regression.sh"
29
30
  "evals/integration/test_trust_reconcile.sh"
30
31
  "evals/integration/test_trust_checkpoint.sh"
@@ -35,6 +36,7 @@ TESTS=(
35
36
  "evals/integration/test_trust_reconcile_manifest.sh"
36
37
  "evals/integration/test_trust_reconcile_mixed_bundle.sh"
37
38
  "evals/integration/test_trust_reconcile_negatives.sh"
39
+ "evals/integration/test_reconcile_preflight.sh"
38
40
  "evals/integration/test_goal_fit_ghost_session.sh"
39
41
  )
40
42
 
@@ -21,13 +21,19 @@ CHECKS=(
21
21
  "Publish-change helper integration|bash evals/integration/test_publish_change_helper.sh"
22
22
  "Workflow sidecar writer integration|bash evals/integration/test_workflow_sidecar_writer.sh"
23
23
  "Sidecar field preservation integration|bash evals/integration/test_sidecar_field_preservation.sh"
24
+ "Record-check integration|bash evals/integration/test_record_check.sh"
24
25
  "Actor identity resolver integration|bash evals/integration/test_actor_identity.sh"
26
+ "CI-runtime actor identity integration|bash evals/integration/test_ci_actor_identity.sh"
25
27
  "Assignment provider local-file integration|bash evals/integration/test_assignment_provider_local_file.sh"
26
28
  "Assignment provider github integration|bash evals/integration/test_assignment_provider_github.sh"
27
29
  "Stop hook release-with-handoff integration|bash evals/integration/test_stop_hook_release.sh"
28
30
  "Pull work assignment join integration|bash evals/integration/test_pull_work_assignment_join.sh"
29
31
  "Ensure-session ownership guard integration|bash evals/integration/test_ensure_session_ownership_guard.sh"
32
+ "Verify-hold gate integration|bash evals/integration/test_verify_hold.sh"
33
+ "Takeover protocol integration|bash evals/integration/test_takeover_protocol.sh"
30
34
  "Current.json per-actor integration|bash evals/integration/test_current_json_per_actor.sh"
35
+ "Liveness console relay integration|bash evals/integration/test_liveness_console_relay.sh"
36
+ "Console tenant isolation integration|bash evals/integration/test_console_tenant_isolation.sh"
31
37
  "Goal Fit hook integration|bash evals/integration/test_goal_fit_hook.sh"
32
38
  "Hook category behavior integration|bash evals/integration/test_hook_category_behaviors.sh"
33
39
  "Workflow steering hook integration|bash evals/integration/test_workflow_steering_hook.sh"
@@ -51,9 +57,36 @@ CHECKS=(
51
57
  "Liveness conflict injection integration|bash evals/integration/test_liveness_conflict_injection.sh"
52
58
  "Telemetry doctor integration|bash evals/integration/test_telemetry_doctor.sh"
53
59
  "Usage and cost integration|bash evals/integration/test_usage_cost.sh"
60
+ "Telemetry usage pipeline integration|bash evals/integration/test_telemetry_usage_pipeline.sh"
61
+ "Economics record integration|bash evals/integration/test_economics_record.sh"
62
+ "Learning review proposals integration|bash evals/integration/test_learning_review_proposals.sh"
54
63
  "Utterance check integration|bash evals/integration/test_utterance_check.sh"
55
64
  "Pull work provider integration|bash evals/integration/test_pull_work_provider.sh"
56
65
  "Veritas governance kit integration|bash evals/integration/test_veritas_governance_kit.sh"
66
+ "Builder step producers integration|bash evals/integration/test_builder_step_producers.sh"
67
+ "Builder canonical Flow run integration|bash evals/integration/test_builder_entry_enforcement.sh"
68
+ "Codex hook resolution integration|bash evals/integration/test_codex_hook_resolution.sh"
69
+ "Critique supersession roundtrip integration|bash evals/integration/test_critique_supersession_roundtrip.sh"
70
+ "Dual emit flow step integration|bash evals/integration/test_dual_emit_flow_step.sh"
71
+ "Evidence capture hook integration|bash evals/integration/test_evidence_capture_hook.sh"
72
+ "Exemption usage review integration|bash evals/integration/test_exemption_usage_review.sh"
73
+ "FlowDefinition session history preservation integration|bash evals/integration/test_flowdef_session_history_preservation.sh"
74
+ "Gate review inquiry records integration|bash evals/integration/test_gate_review_inquiry_records.sh"
75
+ "Install merge integration|bash evals/integration/test_install_merge.sh"
76
+ "Kit identity trust integration|bash evals/integration/test_kit_identity_trust.sh"
77
+ "Liveness worktree root integration|bash evals/integration/test_liveness_worktree_root.sh"
78
+ "Migrate local artifacts integration|bash evals/integration/test_migrate_local_artifacts.sh"
79
+ "Model routing escalation integration|bash evals/integration/test_model_routing_escalation.sh"
80
+ "Promote gate integration|bash evals/integration/test_promote_gate.sh"
81
+ "Pull work board integration|bash evals/integration/test_pull_work_board.sh"
82
+ "Routing efficiency integration|bash evals/integration/test_routing_efficiency.sh"
83
+ "Session resume roundtrip integration|bash evals/integration/test_session_resume_roundtrip.sh"
84
+ "Skill drift check integration|bash evals/integration/test_skill_drift_check.sh"
85
+ "Trust reconcile trailer diagnostic integration|bash evals/integration/test_trust_reconcile_trailer_diagnostic.sh"
86
+ "Validate artifacts portability integration|bash evals/integration/test_validate_artifacts_portability.sh"
87
+ "Verify CLI integration|bash evals/integration/test_verify_cli.sh"
88
+ "Veritas governance adapter integration|bash evals/integration/test_veritas_governance_adapter.sh"
89
+ "Workspace settings integration|bash evals/integration/test_workspace_settings.sh"
57
90
  "Anti-gaming and trust suite|bash evals/ci/antigaming-suite.sh"
58
91
  "Usage feedback import integration|bash evals/integration/test_usage_feedback_import.sh"
59
92
  "Usage feedback outcomes integration|bash evals/integration/test_usage_feedback_outcomes.sh"
@@ -77,13 +110,19 @@ LANE_WORKFLOW_CONTRACTS=(
77
110
  "Publish-change helper integration"
78
111
  "Workflow sidecar writer integration"
79
112
  "Sidecar field preservation integration"
113
+ "Record-check integration"
80
114
  "Actor identity resolver integration"
115
+ "CI-runtime actor identity integration"
81
116
  "Assignment provider local-file integration"
82
117
  "Assignment provider github integration"
83
118
  "Stop hook release-with-handoff integration"
84
119
  "Pull work assignment join integration"
85
120
  "Ensure-session ownership guard integration"
121
+ "Verify-hold gate integration"
122
+ "Takeover protocol integration"
86
123
  "Current.json per-actor integration"
124
+ "Liveness console relay integration"
125
+ "Console tenant isolation integration"
87
126
  )
88
127
 
89
128
  LANE_RUNTIME_AND_KIT=(
@@ -110,12 +149,42 @@ LANE_RUNTIME_AND_KIT=(
110
149
  "Liveness conflict injection integration"
111
150
  "Telemetry doctor integration"
112
151
  "Usage and cost integration"
152
+ "Telemetry usage pipeline integration"
153
+ "Economics record integration"
154
+ "Learning review proposals integration"
113
155
  "Utterance check integration"
114
156
  "Pull work provider integration"
115
157
  "Veritas governance kit integration"
116
158
  "Anti-gaming and trust suite"
117
159
  )
118
160
 
161
+ LANE_INTEGRATION_COVERAGE=(
162
+ "Builder step producers integration"
163
+ "Builder canonical Flow run integration"
164
+ "Codex hook resolution integration"
165
+ "Critique supersession roundtrip integration"
166
+ "Dual emit flow step integration"
167
+ "Evidence capture hook integration"
168
+ "Exemption usage review integration"
169
+ "FlowDefinition session history preservation integration"
170
+ "Gate review inquiry records integration"
171
+ "Install merge integration"
172
+ "Kit identity trust integration"
173
+ "Liveness worktree root integration"
174
+ "Migrate local artifacts integration"
175
+ "Model routing escalation integration"
176
+ "Promote gate integration"
177
+ "Pull work board integration"
178
+ "Routing efficiency integration"
179
+ "Session resume roundtrip integration"
180
+ "Skill drift check integration"
181
+ "Trust reconcile trailer diagnostic integration"
182
+ "Validate artifacts portability integration"
183
+ "Verify CLI integration"
184
+ "Veritas governance adapter integration"
185
+ "Workspace settings integration"
186
+ )
187
+
119
188
  LANE_USAGE_FEEDBACK=(
120
189
  "Usage feedback import integration"
121
190
  "Usage feedback outcomes integration"
@@ -130,10 +199,11 @@ slugify() {
130
199
 
131
200
  # WS8 (ADR 0020): the reconcile manifest is THIS registry, not a new file. Every entry
132
201
  # EMITTED below is a member of a REQUIRED LANE_* array (source-and-static, workflow-contracts,
133
- # runtime-and-kit), each of which gates a merge — so a manifest command is, by construction, a
134
- # required-lane command. The advisory LANE_USAGE_FEEDBACK lane (continue-on-error, non-blocking)
135
- # is EXCLUDED from the emit so a test_output claim can never reconcile against a non-gating
136
- # command. scripts/ci/trust-reconcile.js consumes this emit to resolve the manifest.
202
+ # runtime-and-kit, integration-coverage), each of which gates a merge — so a manifest command
203
+ # is, by construction, a required-lane command. The advisory LANE_USAGE_FEEDBACK lane
204
+ # (continue-on-error, non-blocking) is EXCLUDED from the emit so a test_output claim can
205
+ # never reconcile against a non-gating command. scripts/ci/trust-reconcile.js consumes this
206
+ # emit to resolve the manifest.
137
207
  _json_str() {
138
208
  local s="$1"
139
209
  s="${s//\\/\\\\}"
@@ -152,6 +222,7 @@ _lanes_for_label() {
152
222
  for x in "${LANE_SOURCE_AND_STATIC[@]}"; do [[ "$x" == "$label" ]] && { out="${out}\"source-and-static\","; break; }; done
153
223
  for x in "${LANE_WORKFLOW_CONTRACTS[@]}"; do [[ "$x" == "$label" ]] && { out="${out}\"workflow-contracts\","; break; }; done
154
224
  for x in "${LANE_RUNTIME_AND_KIT[@]}"; do [[ "$x" == "$label" ]] && { out="${out}\"runtime-and-kit\","; break; }; done
225
+ for x in "${LANE_INTEGRATION_COVERAGE[@]}"; do [[ "$x" == "$label" ]] && { out="${out}\"integration-coverage\","; break; }; done
155
226
  printf '%s' "${out%,}"
156
227
  }
157
228
 
@@ -194,6 +265,9 @@ lane_labels() {
194
265
  runtime-and-kit)
195
266
  printf '%s\n' "${LANE_RUNTIME_AND_KIT[@]}"
196
267
  ;;
268
+ integration-coverage)
269
+ printf '%s\n' "${LANE_INTEGRATION_COVERAGE[@]}"
270
+ ;;
197
271
  usage-feedback)
198
272
  printf '%s\n' "${LANE_USAGE_FEEDBACK[@]}"
199
273
  ;;
@@ -0,0 +1,12 @@
1
+ {
2
+ "schema_version": "1.0",
3
+ "task_slug": "kontourai-flow-agents-349",
4
+ "repo": "kontourai/flow-agents",
5
+ "source_request": "per-run kit-economics record",
6
+ "criteria": [
7
+ { "id": "AC1", "text": "golden fixture validates against the schema", "status": "pass" },
8
+ { "id": "AC2", "text": "cost totals equal the session.usage usage block", "status": "pass" },
9
+ { "id": "AC3", "text": "phase-sum invariant holds", "status": "pass" }
10
+ ],
11
+ "goal_fit": { "status": "verified", "summary": "Economics record measures the value proof." }
12
+ }
@@ -0,0 +1,2 @@
1
+ {"timestamp":"2026-07-05T00:00:01Z","agent_id":"tool-worker-1","kind":"delegation","status":"active","role":"delegate-mechanical","model":"claude-haiku-4-5@anthropic","summary":"mechanical slice: routine config edit"}
2
+ {"timestamp":"2026-07-05T00:00:07Z","agent_id":"tool-worker-1","kind":"evidence","status":"pass","summary":"tests green"}
@@ -0,0 +1,2 @@
1
+ {"timestamp":"2026-07-05T00:00:02Z","agent_id":"tool-worker-2","kind":"delegation","status":"active","role":"delegate-implementation","model":"claude-sonnet-5@anthropic","summary":"impl slice"}
2
+ {"timestamp":"2026-07-05T00:00:09Z","agent_id":"tool-worker-2","kind":"escalation","status":"active","role":"delegate-design","model":"claude-opus-4-8@anthropic","escalated_from":"delegate-implementation","summary":"escalated: design divergence"}
@@ -0,0 +1,2 @@
1
+ {"timestamp":"2026-07-05T00:00:03Z","agent_id":"tool-worker-3","kind":"delegation","status":"active","role":"delegate-design","model":"claude-opus-4-8@anthropic","summary":"design slice"}
2
+ {"timestamp":"2026-07-05T00:00:11Z","agent_id":"tool-worker-3","kind":"verdict","status":"fail","summary":"acceptance failed"}
@@ -0,0 +1 @@
1
+ {"timestamp":"2026-07-05T00:00:04Z","agent_id":"tool-worker-4","kind":"delegation","status":"active","role":"delegate-mechanical","model":"claude-haiku-4-5@anthropic","summary":"mech, no verdict recorded"}
@@ -0,0 +1,2 @@
1
+ {"timestamp":"2026-07-05T00:00:05Z","agent_id":"tool-worker-5","kind":"delegation","status":"active","role":"delegate-mechanical","model":"claude-haiku-4-5@anthropic","summary":"try 1"}
2
+ {"timestamp":"2026-07-05T00:00:12Z","agent_id":"tool-worker-5","kind":"delegation","status":"active","role":"delegate-mechanical","model":"claude-haiku-4-5@anthropic","summary":"re-prompted: fix it"}
@@ -0,0 +1,22 @@
1
+ {
2
+ "schema_version": "1.0",
3
+ "task_slug": "kontourai-flow-agents-349",
4
+ "required": true,
5
+ "status": "changes_requested",
6
+ "critiques": [
7
+ {
8
+ "id": "review-1",
9
+ "reviewer": "tool-code-reviewer",
10
+ "verdict": "changes_requested",
11
+ "summary": "Findings across severities plus one caught false-completion.",
12
+ "findings": [
13
+ { "id": "f1", "severity": "critical", "description": "Injection: JSON built by string concat." },
14
+ { "id": "f2", "severity": "high", "description": "Local write skipped when console unset." },
15
+ { "id": "f3", "severity": "high", "description": "Phase sum drifts from cost total." },
16
+ { "id": "f4", "severity": "medium", "description": "estimated_cost_usd re-estimated from prompt length." },
17
+ { "id": "f5", "description": "Missing severity field defaults here to low." },
18
+ { "id": "f6", "severity": "low", "false_completion": true, "description": "AC3 was claimed pass but a trusted-backstop re-run contradicted it." }
19
+ ]
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "at": "1751731200000",
3
+ "cost": {
4
+ "by_model": [
5
+ {
6
+ "cache_creation_input_tokens": 0,
7
+ "cache_read_input_tokens": 500000,
8
+ "estimated_cost_usd": 0.305,
9
+ "input_tokens": 1000,
10
+ "model": "claude-opus-4-8",
11
+ "output_tokens": 2000
12
+ },
13
+ {
14
+ "cache_creation_input_tokens": 0,
15
+ "cache_read_input_tokens": 0,
16
+ "estimated_cost_usd": 0.005,
17
+ "input_tokens": 0,
18
+ "model": "claude-fable-5",
19
+ "output_tokens": 100
20
+ }
21
+ ],
22
+ "cache_creation_input_tokens": 0,
23
+ "cache_read_input_tokens": 500000,
24
+ "estimated_cost_usd": 0.31,
25
+ "input_tokens": 1000,
26
+ "output_tokens": 2100
27
+ },
28
+ "defects": {
29
+ "caught_false_completions": 1,
30
+ "findings_by_severity": {
31
+ "critical": 1,
32
+ "high": 2,
33
+ "low": 2,
34
+ "medium": 1
35
+ },
36
+ "gate_fires": 3,
37
+ "verification_verdict": "PASS"
38
+ },
39
+ "iterations": {
40
+ "count": 2,
41
+ "route_backs": 1
42
+ },
43
+ "model": "claude-opus-4-8",
44
+ "phases": [
45
+ {
46
+ "cache_creation_input_tokens": 0,
47
+ "cache_read_input_tokens": 500000,
48
+ "estimated_cost_usd": 0.31,
49
+ "input_tokens": 1000,
50
+ "output_tokens": 2100,
51
+ "phase": "verify",
52
+ "wall_clock_s": 420
53
+ }
54
+ ],
55
+ "pricing_version": "2026-06-28",
56
+ "run_id": "kontourai-flow-agents-349-run-01",
57
+ "schema": "kontour.console.economics",
58
+ "task_slug": "kontourai-flow-agents-349",
59
+ "tenant_id": null,
60
+ "time": {
61
+ "human_wait_s": 45,
62
+ "wall_clock_s": 420
63
+ },
64
+ "version": "0.1",
65
+ "delegations": [],
66
+ "signals": {
67
+ "runtime": "claude-code",
68
+ "per_delegation_tokens": false,
69
+ "per_delegation_outcome": "n/a"
70
+ }
71
+ }
@@ -0,0 +1 @@
1
+ {"schema_version":"0.3.0","timestamp":"1751731200000","session_id":"kontourai-flow-agents-349-run-01","event_id":"evt-01-usage","event_type":"session.usage","agent":{"name":"dev","runtime":"claude-code","version":"1"},"context":{"cwd":"/workspace/flow-agents"},"usage":{"model":"claude-opus-4-8","duration_s":420,"tool_invocations":12,"delegations":3,"input_tokens":1000,"output_tokens":2100,"cache_creation_input_tokens":0,"cache_read_input_tokens":500000,"estimated_cost_usd":0.31,"pricing_version":"2026-06-28","by_model":[{"model":"claude-opus-4-8","input_tokens":1000,"output_tokens":2000,"cache_creation_input_tokens":0,"cache_read_input_tokens":500000,"estimated_cost_usd":0.305},{"model":"claude-fable-5","input_tokens":0,"output_tokens":100,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.005}]}}
@@ -0,0 +1,11 @@
1
+ {
2
+ "schema_version": "1.0",
3
+ "task_slug": "kontourai-flow-agents-349",
4
+ "repo": "kontourai/flow-agents",
5
+ "status": "verified",
6
+ "phase": "verify",
7
+ "iterations": { "count": 2, "route_backs": 1 },
8
+ "gate_fires": 3,
9
+ "human_wait_s": 45,
10
+ "verification_verdict": "PASS"
11
+ }
@@ -0,0 +1,3 @@
1
+ {"type":"assistant","message":{"model":"claude-opus-4-8","usage":{"input_tokens":1000,"output_tokens":2000,"cache_creation_input_tokens":0,"cache_read_input_tokens":500000}}}
2
+ {"type":"user","message":{"content":"continue"}}
3
+ {"type":"assistant","message":{"model":"claude-fable-5","usage":{"input_tokens":0,"output_tokens":100,"cache_creation_input_tokens":0,"cache_read_input_tokens":0}}}
@@ -108,7 +108,7 @@
108
108
  }
109
109
  },
110
110
  {
111
- "id": "dev-builder-review-before-verify-after-execute",
111
+ "id": "kit:builder:dev-builder-review-before-verify-after-execute",
112
112
  "description": "After execute-plan completes in the Builder Kit build flow, the next gate is review-work critique before verify-work evidence. Review is report-only and cannot be treated as verification evidence. Open critique findings route back through execution before re-review and re-verify.",
113
113
  "runtime_scope": ["claude-code", "codex", "kiro-cli"],
114
114
  "hook": "workflow-steering",
@@ -141,8 +141,8 @@
141
141
  }
142
142
  },
143
143
  {
144
- "id": "dev-builder-route-fresh-coding-prompt",
145
- "description": "A fresh coding/build prompt with no active sidecar should still steer into Builder Kit delivery workflow before source edits. Claude Code must receive this as prompt-submit additional context through the hook adapter.",
144
+ "id": "kit:builder:dev-builder-route-fresh-coding-prompt",
145
+ "description": "A fresh coding/build prompt with no active sidecar should still steer into the builder kit's builder.build workflow before source edits. Claude Code must receive this as prompt-submit additional context through the hook adapter.",
146
146
  "runtime_scope": ["claude-code", "codex", "kiro-cli"],
147
147
  "hook": "workflow-steering",
148
148
  "event": "UserPromptSubmit",
@@ -154,14 +154,14 @@
154
154
  "prompt": "Please implement the new settings API and update its tests."
155
155
  },
156
156
  "guidance_must_include": [
157
- "BUILDER WORKFLOW ROUTE",
157
+ "KIT WORKFLOW ROUTE",
158
158
  "activate `deliver`",
159
159
  "--flow-id builder.build",
160
160
  "plan-work -> execute-plan -> review-work -> verify-work",
161
- "publish/release-readiness and learning-review"
161
+ "release-readiness and learning-review"
162
162
  ],
163
163
  "agent_must_do": [
164
- "activate Builder Kit delivery workflow before source edits or implementation commands",
164
+ "use the `builder` kit's `builder.build` workflow before source edits or implementation commands",
165
165
  "use deliver by default for coding/build work unless the user explicitly requested TDD",
166
166
  "keep the session on builder.build and do not bypass plan-work -> execute-plan -> review-work -> verify-work",
167
167
  "continue from local verification into publish, release readiness, and learning feedback"
@@ -261,7 +261,7 @@
261
261
  }
262
262
  },
263
263
  {
264
- "id": "dev-builder-build-requires-pickup-probe-before-plan",
264
+ "id": "kit:builder:dev-builder-build-requires-pickup-probe-before-plan",
265
265
  "description": "When Builder Kit build flow reaches planning without recorded pickup Probe decisions or accepted gaps, the hook must steer back to design-probe instead of allowing plan-work to proceed. Direct pull-work and plan-work remain valid when the user invokes those primitives outside Builder Kit build flow.",
266
266
  "runtime_scope": ["claude-code", "codex", "kiro-cli"],
267
267
  "hook": "workflow-steering",
@@ -0,0 +1,6 @@
1
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"bal-r1","at":1751600000000,"task_slug":null,"cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.10,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":1},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":1,"low":1},"caught_false_completions":0,"verification_verdict":"PASS"}}
2
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"bal-r2","at":1751600001000,"task_slug":null,"cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.10,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":1},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":1,"low":1},"caught_false_completions":0,"verification_verdict":"PASS"}}
3
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"bal-r3","at":1751600002000,"task_slug":null,"cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.10,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":1},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":1,"low":2},"caught_false_completions":0,"verification_verdict":"PASS"}}
4
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"bal-r4","at":1751600003000,"task_slug":null,"cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.13,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":1},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":1,"low":2},"caught_false_completions":0,"verification_verdict":"PASS"}}
5
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"bal-r5","at":1751600004000,"task_slug":null,"cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.13,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":1},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":1,"low":2},"caught_false_completions":0,"verification_verdict":"PASS"}}
6
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"bal-r6","at":1751600005000,"task_slug":null,"cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.13,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":1},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":2,"medium":1,"low":2},"caught_false_completions":0,"verification_verdict":"PASS"}}
@@ -0,0 +1,5 @@
1
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"ef-r1","at":1751600000000,"task_slug":"task-lr-ef-1","cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.05,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":0},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":0,"low":1},"caught_false_completions":1,"verification_verdict":"PASS"}}
2
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"ef-r2","at":1751600001000,"task_slug":"task-lr-ef-2","cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.05,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":0},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":0,"low":1},"caught_false_completions":1,"verification_verdict":"PASS"}}
3
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"ef-r3","at":1751600002000,"task_slug":"task-lr-ef-3","cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.05,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":0},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":0,"low":1},"caught_false_completions":1,"verification_verdict":"PASS"}}
4
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"ef-r4","at":1751600003000,"task_slug":"task-lr-ef-4","cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.05,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":0},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":0,"low":1},"caught_false_completions":1,"verification_verdict":"PASS"}}
5
+ {"schema":"kontour.console.economics","version":"0.1","run_id":"ef-r5","at":1751600004000,"task_slug":"task-lr-ef-5","cost":{"input_tokens":1000,"output_tokens":500,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"estimated_cost_usd":0.05,"by_model":[]},"time":{"wall_clock_s":100,"human_wait_s":10},"iterations":{"count":2,"route_backs":0},"defects":{"gate_fires":1,"findings_by_severity":{"critical":0,"high":1,"medium":0,"low":1},"caught_false_completions":1,"verification_verdict":"PASS"}}
@@ -0,0 +1,21 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "source": "flow-agents/workflow-sidecar;statusFunctionVersion=1",
4
+ "claims": [
5
+ {
6
+ "id": "task-lr-ef-1-gate-claim-unit-tests.flow-agents-workflow.unit-tests-pass",
7
+ "subjectType": "workflow-check",
8
+ "subjectId": "task-lr-ef-1/unit-tests",
9
+ "facet": "flow-agents.workflow",
10
+ "claimType": "builder.verify.tests",
11
+ "fieldOrBehavior": "unit tests pass",
12
+ "value": "pass",
13
+ "createdAt": "2026-07-04T00:00:00Z",
14
+ "updatedAt": "2026-07-04T00:00:00Z",
15
+ "status": "verified"
16
+ }
17
+ ],
18
+ "evidence": [],
19
+ "events": [],
20
+ "policies": []
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "source": "flow-agents/workflow-sidecar;statusFunctionVersion=1",
4
+ "claims": [
5
+ {
6
+ "id": "task-lr-ef-2-gate-claim-unit-tests.flow-agents-workflow.unit-tests-pass",
7
+ "subjectType": "workflow-check",
8
+ "subjectId": "task-lr-ef-2/unit-tests",
9
+ "facet": "flow-agents.workflow",
10
+ "claimType": "builder.verify.tests",
11
+ "fieldOrBehavior": "unit tests pass",
12
+ "value": "pass",
13
+ "createdAt": "2026-07-04T00:00:00Z",
14
+ "updatedAt": "2026-07-04T00:00:00Z",
15
+ "status": "verified"
16
+ }
17
+ ],
18
+ "evidence": [],
19
+ "events": [],
20
+ "policies": []
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "source": "flow-agents/workflow-sidecar;statusFunctionVersion=1",
4
+ "claims": [
5
+ {
6
+ "id": "task-lr-ef-3-gate-claim-unit-tests.flow-agents-workflow.unit-tests-pass",
7
+ "subjectType": "workflow-check",
8
+ "subjectId": "task-lr-ef-3/unit-tests",
9
+ "facet": "flow-agents.workflow",
10
+ "claimType": "builder.verify.tests",
11
+ "fieldOrBehavior": "unit tests pass",
12
+ "value": "pass",
13
+ "createdAt": "2026-07-04T00:00:00Z",
14
+ "updatedAt": "2026-07-04T00:00:00Z",
15
+ "status": "verified"
16
+ }
17
+ ],
18
+ "evidence": [],
19
+ "events": [],
20
+ "policies": []
21
+ }