@kontourai/flow-agents 3.6.0 → 3.8.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 (96) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/build/src/builder-flow-run-adapter.d.ts +22 -2
  3. package/build/src/builder-flow-run-adapter.js +93 -28
  4. package/build/src/builder-flow-runtime.d.ts +8 -3
  5. package/build/src/builder-flow-runtime.js +407 -51
  6. package/build/src/cli/assignment-provider.d.ts +4 -7
  7. package/build/src/cli/assignment-provider.js +80 -14
  8. package/build/src/cli/builder-run.js +14 -18
  9. package/build/src/cli/workflow-sidecar.d.ts +28 -4
  10. package/build/src/cli/workflow-sidecar.js +825 -103
  11. package/build/src/cli/workflow.js +301 -43
  12. package/build/src/flow-kit/validate.d.ts +17 -0
  13. package/build/src/flow-kit/validate.js +340 -2
  14. package/build/src/index.js +5 -5
  15. package/build/src/lib/observed-command.d.ts +7 -0
  16. package/build/src/lib/observed-command.js +100 -0
  17. package/build/src/tools/build-universal-bundles.js +53 -3
  18. package/build/src/tools/generate-context-map.js +5 -3
  19. package/context/scripts/hooks/lib/kit-catalog.js +1 -1
  20. package/context/scripts/hooks/stop-goal-fit.js +78 -9
  21. package/docs/context-map.md +22 -20
  22. package/docs/developer-architecture.md +1 -1
  23. package/docs/getting-started.md +9 -1
  24. package/docs/public-workflow-cli.md +76 -7
  25. package/docs/skills-map.md +51 -27
  26. package/docs/spec/builder-flow-runtime.md +75 -40
  27. package/docs/workflow-usage-guide.md +109 -42
  28. package/evals/fixtures/hook-influence/cases.json +2 -2
  29. package/evals/integration/test_builder_entry_enforcement.sh +52 -41
  30. package/evals/integration/test_builder_step_producers.sh +330 -6
  31. package/evals/integration/test_bundle_install.sh +318 -65
  32. package/evals/integration/test_bundle_lifecycle.sh +4 -6
  33. package/evals/integration/test_critique_supersession_roundtrip.sh +21 -8
  34. package/evals/integration/test_current_json_per_actor.sh +12 -0
  35. package/evals/integration/test_dual_emit_flow_step.sh +62 -43
  36. package/evals/integration/test_flowdef_session_activation.sh +145 -25
  37. package/evals/integration/test_flowdef_session_history_preservation.sh +23 -21
  38. package/evals/integration/test_gate_lockdown.sh +3 -5
  39. package/evals/integration/test_goal_fit_hook.sh +60 -2
  40. package/evals/integration/test_install_merge.sh +18 -8
  41. package/evals/integration/test_liveness_verdict.sh +14 -17
  42. package/evals/integration/test_phase_map_and_gate_claim.sh +63 -38
  43. package/evals/integration/test_public_workflow_cli.sh +334 -14
  44. package/evals/integration/test_pull_work_liveness_preflight.sh +22 -66
  45. package/evals/integration/test_sidecar_field_preservation.sh +36 -11
  46. package/evals/integration/test_workflow_sidecar_writer.sh +277 -44
  47. package/evals/integration/test_workflow_steering_hook.sh +15 -38
  48. package/evals/run.sh +2 -0
  49. package/evals/static/test_builder_skill_coherence.sh +247 -0
  50. package/evals/static/test_library_exports.sh +5 -2
  51. package/evals/static/test_universal_bundles.sh +44 -1
  52. package/evals/static/test_workflow_skills.sh +13 -325
  53. package/kits/builder/flows/build.flow.json +22 -0
  54. package/kits/builder/flows/shape.flow.json +9 -9
  55. package/kits/builder/kit.json +70 -16
  56. package/kits/builder/skills/builder-shape/SKILL.md +75 -75
  57. package/kits/builder/skills/continue-work/SKILL.md +45 -106
  58. package/kits/builder/skills/deliver/SKILL.md +96 -442
  59. package/kits/builder/skills/design-probe/SKILL.md +40 -139
  60. package/kits/builder/skills/evidence-gate/SKILL.md +59 -201
  61. package/kits/builder/skills/execute-plan/SKILL.md +54 -125
  62. package/kits/builder/skills/fix-bug/SKILL.md +42 -132
  63. package/kits/builder/skills/gate-review/SKILL.md +60 -211
  64. package/kits/builder/skills/idea-to-backlog/SKILL.md +63 -244
  65. package/kits/builder/skills/learning-review/SKILL.md +63 -170
  66. package/kits/builder/skills/pickup-probe/SKILL.md +54 -111
  67. package/kits/builder/skills/plan-work/SKILL.md +51 -185
  68. package/kits/builder/skills/pull-work/SKILL.md +136 -485
  69. package/kits/builder/skills/release-readiness/SKILL.md +66 -107
  70. package/kits/builder/skills/review-work/SKILL.md +89 -176
  71. package/kits/builder/skills/tdd-workflow/SKILL.md +53 -147
  72. package/kits/builder/skills/verify-work/SKILL.md +101 -113
  73. package/package.json +2 -2
  74. package/packaging/README.md +1 -1
  75. package/scripts/README.md +1 -1
  76. package/scripts/hooks/lib/kit-catalog.js +1 -1
  77. package/scripts/hooks/stop-goal-fit.js +78 -9
  78. package/scripts/install-codex-home.sh +63 -23
  79. package/scripts/install-owned-files.js +18 -2
  80. package/src/builder-flow-run-adapter.ts +118 -32
  81. package/src/builder-flow-runtime.ts +426 -64
  82. package/src/cli/assignment-provider-lock.test.mjs +83 -0
  83. package/src/cli/assignment-provider.ts +75 -14
  84. package/src/cli/builder-flow-run-adapter.test.mjs +4 -2
  85. package/src/cli/builder-flow-runtime.test.mjs +436 -18
  86. package/src/cli/builder-run.ts +3 -9
  87. package/src/cli/kit-metadata-security.test.mjs +232 -6
  88. package/src/cli/public-api.test.mjs +15 -0
  89. package/src/cli/workflow-sidecar-execution-proof.test.mjs +90 -0
  90. package/src/cli/workflow-sidecar.ts +746 -103
  91. package/src/cli/workflow.ts +288 -41
  92. package/src/flow-kit/validate.ts +320 -2
  93. package/src/index.ts +6 -5
  94. package/src/lib/observed-command.ts +96 -0
  95. package/src/tools/build-universal-bundles.ts +51 -3
  96. package/src/tools/generate-context-map.ts +5 -3
@@ -1,133 +1,92 @@
1
1
  ---
2
2
  name: "release-readiness"
3
- description: "Decide whether evidence-backed work is ready to merge, release, deploy, or hold. Use after evidence-gate PASS, before merge/release/deploy, and for post-deploy verification planning."
3
+ description: "Make a provider-neutral merge, release, deploy, or hold decision. Records Builder publish-learn CI merge-readiness in trust.bundle."
4
4
  ---
5
5
 
6
6
  # Release Readiness
7
7
 
8
- Turn a clean evidence result into an explicit release, deploy, or hold decision.
8
+ ## Role
9
9
 
10
- Release Readiness is not Evidence Gate. Evidence Gate decides whether completed work is trustworthy enough to publish or continue fixing. Release Readiness assumes evidence is clean and then checks the real publish/release surface: committed diff, pushed branch, provider change record or explicit no-provider-change reason, provider checks, ownership, rollout timing, rollback, observability, docs, and post-deploy verification.
10
+ This is a Builder step skill.
11
11
 
12
- ## Contract
12
+ Release Readiness turns confidence and published-change evidence into an explicit
13
+ `MERGE`, `RELEASE`, `DEPLOY`, `HOLD`, or `ROLLBACK_REQUIRED` decision. It does
14
+ not fix code, publish a change, or deploy without explicit authorization.
13
15
 
14
- - Use only after `evidence-gate` has produced `PASS`, or explicitly record why release review is blocked.
15
- - Use only after the verified changes have been committed, pushed, and represented by a provider change record or an explicit no-provider-change decision.
16
- - Do not fix code or weaken release criteria.
17
- - Do not deploy unless the user explicitly asks and the environment is clear.
18
- - Treat merge, release, deploy, and post-deploy verification as separate gates.
19
- - Record rollback, observability, and ownership before approving release.
20
- - Treat final acceptance documentation as part of release readiness: CI/merge should leave durable docs or an explicit reason they are not needed.
16
+ ## Binding
21
17
 
22
- ## Inputs
23
-
24
- - Evidence gate artifact and verdict.
25
- - Issue/brief, commit SHA, pushed branch, provider change link or no-provider-change reason, provider check run links, and changed-file summary.
26
- - Release notes, migration notes, feature flags, deploy target, and rollback plan.
27
- - Known incidents, freezes, dependency risk, and owner availability.
28
-
29
- ## Artifact Contract
30
-
31
- Create or update `.kontourai/flow-agents/<slug>/<slug>--release-readiness.md` with:
18
+ | Context | Binding | Flow expectation |
19
+ | --- | --- | --- |
20
+ | Active Builder run | Parent `builder.build` projection at composed `builder.publish-learn` step `merge-ready-ci` | `ci-merge-readiness` |
21
+ | Standalone invocation | No Flow binding | No workflow mutation. |
32
22
 
33
- - `release_scope`: work included, excluded, issue/provider-change links
34
- - `evidence_reference`: evidence artifact, verdict, residual risks
35
- - `risk_review`: migrations, data, security, dependencies, flags, compatibility
36
- - `operational_plan`: deploy target, order, owner, timing, comms
37
- - `rollback_plan`: trigger, steps, owner, expected recovery signal
38
- - `observability_plan`: metrics, logs, traces, alerts, dashboards
39
- - `post_deploy_checks`: checks, commands, URLs, timing, expected signals
40
- - `final_acceptance_docs`: long-lived docs updated, archived `.kontourai/flow-agents/<slug>/` links, and deferred docs follow-ups
41
- - `decision`: MERGE, RELEASE, DEPLOY, HOLD, or ROLLBACK_REQUIRED
42
-
43
- When the repository provides `npm run workflow:sidecar --`, also write `release.json` with:
23
+ For an active run, confirm the binding before making the Flow claim:
44
24
 
45
25
  ```bash
46
- npm run workflow:sidecar -- record-release .kontourai/flow-agents/<slug> \
47
- --decision merge \
48
- --scope "..." \
49
- --evidence-ref evidence.json \
50
- --gate-json '{"name":"merge","status":"pass","summary":"..."}' \
51
- --rollback-json '{"status":"not_required","summary":"...","owner":"..."}' \
52
- --observability-json '{"status":"not_required","summary":"..."}' \
53
- --docs-json '{"status":"updated","summary":"..."}' \
54
- --summary "..."
26
+ flow-agents workflow status --session-dir <session-dir> --json
55
27
  ```
56
28
 
57
- Use additional `--gate-json` and `--post-deploy-json` values for release, deploy, docs, and post-deploy gates as needed.
29
+ Public status reports the parent definition as `builder.build`. Only that parent
30
+ run at `merge-ready-ci`, whose Flow Definition composes the step from
31
+ `builder.publish-learn`, may publish `ci-merge-readiness`.
58
32
 
59
- After writing `release.json`, run artifact validation when available. If `record-release` is unavailable or blocked, keep the release decision as `HOLD` in the Markdown artifact and record the sidecar-write or validation blocker as a `NOT_VERIFIED` evidence gap until the structured release record can be written or the gap is explicitly accepted.
33
+ ## Inputs
60
34
 
61
- For an active Builder Flow run, record the CI merge-readiness claim only for a `MERGE`, `RELEASE`, or `DEPLOY` decision backed by current provider checks:
35
+ - The evidence-gate confidence report and acceptance evidence.
36
+ - Published-change state from `ChangeProvider` and repository scope from
37
+ `RepositoryAdapter`.
38
+ - Check and review state from `CheckProvider`.
39
+ - Release and deployment capabilities from `ReleaseProvider` and `DeployProvider`.
40
+ - Risk, rollback, observability, ownership, and authorization information.
41
+
42
+ No provider is assumed. A change record, check, release record, or deployment
43
+ record may be unavailable because the repository or provider does not offer it.
44
+ Record the capability and its impact rather than substituting provider-specific
45
+ terms or treating absence as success.
46
+
47
+ ## Decision Work
48
+
49
+ 1. Confirm the confidence report remains applicable to the proposed scope.
50
+ 2. Reconcile current provider checks and review state with the revision covered
51
+ by acceptance evidence. Stale or mismatched evidence is `NOT_VERIFIED`.
52
+ 3. Evaluate change publication, release and deployment implications through the
53
+ available providers. Before `RELEASE` or `DEPLOY`, require an owner, an
54
+ executable rollback or recovery path, observable success and failure
55
+ signals, and a bounded post-release or post-deploy verification plan.
56
+ 4. Require explicit authorization for merge, release, deploy, or rollback.
57
+ Readiness evidence and an available provider capability are not authority to
58
+ perform the operation.
59
+ 5. Use `HOLD` for unresolved required evidence, ownership, rollback,
60
+ observability, post-operation verification, or authority. Use
61
+ `NOT_VERIFIED` for evidence that cannot be collected; it cannot be promoted
62
+ to a clean merge, release, or deploy decision without an explicit accepted gap.
63
+ Use `ROLLBACK_REQUIRED` when observed outcomes cross the recorded rollback
64
+ threshold.
65
+ 6. On a matching active run, publish the resulting evidence through the public
66
+ CLI:
62
67
 
63
68
  ```bash
64
- npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
69
+ flow-agents workflow evidence --session-dir <session-dir> \
65
70
  --expectation ci-merge-readiness \
66
- --status pass \
67
- --summary "Provider checks are current and passing; release-readiness decision and residual risks are recorded." \
68
- --evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/release.json","summary":"Release-readiness decision with provider checks, rollback, and observability evidence."}'
71
+ --status <pass|fail|not_verified> \
72
+ --summary "Release-readiness decision and residual risks are recorded." \
73
+ --evidence-ref-json '{"kind":"artifact","file":"<session-dir>/release.json","summary":"Release-readiness decision, authorization, rollback, and observability state."}'
69
74
  ```
70
75
 
71
- Use `fail` or `not_verified` for `HOLD` and unresolved provider evidence. Flow owns the transition to learning after it verifies this claim.
72
-
73
- ## Workflow
74
-
75
- ### 1. Confirm Evidence
76
-
77
- Verify the evidence verdict is `PASS`, current, and tied to the release scope. If scope changed, return to `evidence-gate`.
78
-
79
- Then verify the publish-change gate:
80
-
81
- - verified diff is committed
82
- - branch is pushed
83
- - provider change record is open or updated, or a no-provider-change reason is explicitly recorded
84
- - provider checks / CI are linked and their status is known
85
- - GitHub PRs remain the first `ChangeProvider` adapter example: for GitHub, the provider change record is the PR and provider checks include PR checks
86
-
87
- If these are missing, return `HOLD` and route back to `publish-change` or `evidence-gate`; do not make a merge/release/deploy decision from local verification alone. Missing provider checks also return `HOLD` unless the risk class supports accepting the gap and the no-check reason is recorded.
88
-
89
- For Flow Agents source changes, the default provider check is the GitHub Actions `Flow Agents CI / Builder Kit Baseline` job. Its summary should list command results, artifact names, and skipped live lanes. A passing baseline supports merge readiness for deterministic workflow, docs, hook, package, and bundle checks, but it does not prove live GitHub mutation, LLM acceptance, or Veritas/governance provider evidence unless those lanes are explicitly run and linked.
90
-
91
- ### 2. Review Release Risk
92
-
93
- Check migrations, feature flags, config, dependency changes, compatibility, security-sensitive paths, customer impact, and deploy timing.
94
-
95
- ### 3. Plan Operation
96
-
97
- Record who owns merge/release/deploy, where it happens, when it happens, what communication is required, and what must not be included.
98
-
99
- ### 4. Plan Rollback
100
-
101
- Define rollback trigger, rollback steps, owner, data recovery limits, and the signal that confirms recovery.
102
-
103
- ### 5. Plan Post-Deploy Verification
104
-
105
- Map expected behavior to production-like checks, telemetry, dashboards, logs, smoke tests, or manual verification. High-risk work must have direct runtime evidence planned.
106
-
107
- ### 6. Decide
108
-
109
- Produce one verdict:
110
-
111
- - `MERGE`: safe to merge, release/deploy not yet authorized.
112
- - `RELEASE`: safe to cut or publish a release artifact.
113
- - `DEPLOY`: safe to deploy with recorded owner and checks.
114
- - `HOLD`: blocked by risk, timing, missing evidence, or ownership.
115
- - `ROLLBACK_REQUIRED`: deployed state is unsafe and rollback should be considered.
116
-
117
- ### 7. Promote Delivery Knowledge
118
-
119
- When CI has passed and merge/release acceptance is clear, require a docs decision:
76
+ ## Output
120
77
 
121
- - update long-lived docs with what changed, how to use it, and important why/how decisions; or
122
- - record why no durable docs are needed; and
123
- - link back to the archived `.kontourai/flow-agents/<slug>/` plan/session artifact for implementation history.
78
+ Record the decision as the `ci-merge-readiness` slice in `trust.bundle`. It
79
+ includes assessed scope, confidence evidence, provider capability and check
80
+ state, risks, rollback and observability plan, required authorization, and
81
+ unresolved `NOT_VERIFIED` gaps. For release or deployment decisions, also record
82
+ the owner, success/failure signals, rollback threshold, and post-operation
83
+ verification commands or observations.
124
84
 
125
- ## Gates
85
+ When acceptance behavior is summarized, include a readable `Acceptance
86
+ Evidence` table:
126
87
 
127
- - Merge Gate: evidence is current, scope matches, CI is acceptable, and review ownership is clear.
128
- - Release Gate: versioning, notes, compatibility, and artifact risk are clear.
129
- - Deploy Gate: deploy owner, target, rollback, and observability are ready.
130
- - Post-Deploy Gate: checks are scheduled or completed and signals are recorded.
131
- - Docs Gate: durable docs are updated, intentionally skipped, or routed to an owned follow-up.
88
+ | AC id | Status | Command/Test Evidence | Source Evidence | Gaps |
89
+ | --- | --- | --- | --- | --- |
132
90
 
133
- After deployment evidence exists, hand off to `learning-review` to capture outcomes.
91
+ The claim supports the next Builder step; it does not itself merge, release, or
92
+ deploy anything.
@@ -1,195 +1,108 @@
1
1
  ---
2
2
  name: "review-work"
3
- description: "Review primitive - run report-only code, security, dependency, architecture/standards, and IaC/policy critique before verification; records findings through the critique artifact/sink, currently critique.json locally."
3
+ description: "Report-only critique before Builder verification. Records a critique slice through the public workflow interface without claiming Flow completion."
4
4
  ---
5
5
 
6
- # Review
6
+ # Review Work
7
7
 
8
- Session file in, critique verdict out. Delegates to review agents and records findings separately from verification evidence.
8
+ ## Role
9
9
 
10
- ## Why This Is Separate From Verify
10
+ This is a Builder step skill.
11
11
 
12
- Verification is not critique.
12
+ Review Work is the report-only critique step. It asks whether the changed work
13
+ should change before verification: correctness risks, maintainability, security,
14
+ dependencies, architecture, standards, and applicable policy.
13
15
 
14
- Review asks whether the implementation should change: maintainability, security, architecture, standards, edge cases, and risky assumptions.
16
+ It does not prove accepted behavior and it does not fix source files.
15
17
 
16
- Verify asks whether the behavior is proven: build, lint/types, tests, browser/runtime evidence, acceptance criteria, and Goal Fit.
18
+ ## Binding
17
19
 
18
- Keeping them separate makes failures route cleanly:
20
+ | Context | Binding | Flow expectation |
21
+ | --- | --- | --- |
22
+ | Active Builder run | `builder.build` at `verify` | `clean-critique`. Review Work owns the critique claim, not verification completion. |
23
+ | Standalone invocation | No Flow binding | No workflow mutation. |
19
24
 
20
- - The critique artifact/sink says what a reviewer thinks should be fixed or accepted; the current local sidecar materialization is `critique.json`.
21
- - `evidence.json` says what was proven, failed, or could not be verified.
25
+ For an active run, inspect the binding before work:
22
26
 
23
- ## Agents
27
+ ```bash
28
+ flow-agents workflow status --session-dir <session-dir> --json
29
+ ```
24
30
 
25
- | Agent | Role |
26
- |---|---|
27
- | tool-code-reviewer | Quality, maintainability, correctness, architecture fit, and project standards |
28
- | tool-security-reviewer | Security review when risk triggers are present |
29
- | tool-dependencies-updater | Dependency review when package manifests, dependency manifests, package manager config, or lockfiles change |
30
- | configured architecture/domain/IaC/policy reviewer | Optional reviewer when the project or user configures one |
31
+ Run this skill only when the reported run is `builder.build` at `verify`.
32
+ If there is no matching active run, operate standalone. Do not publish a gate
33
+ expectation from this skill.
31
34
 
32
35
  ## Model Routing
33
36
 
34
- Review roles never resolve **below** the tier of the work they check (Goodhart
35
- guard): default `delegate-implementation`, raised to match or exceed the tier
36
- that produced the work under review a reviewer of `delegate-design` work
37
- resolves `delegate-design` or `orchestrator`, never a cheaper tier. Resolve the
38
- role from `.datum/config.json` (`npx @kontourai/datum resolve <role> --json`) and
39
- pass the model explicitly. See `context/contracts/execution-contract.md`
40
- § Delegation: Model Routing and § Goodhart guard. Fallback: inherit the session
41
- model when datum/config is absent, noted in the artifact.
42
-
43
- ## Shared Contracts
44
-
45
- Follow:
46
- - `context/contracts/artifact-contract.md`
47
- - `context/contracts/review-contract.md`
48
- - `context/contracts/planning-contract.md` for acceptance criteria and Definition Of Done context
49
-
50
- ## Read-Only Rule (STRICT)
51
-
52
- Reviewers NEVER modify source code:
53
- - No code patches
54
- - No format fixes
55
- - No lint autofixes
56
- - No "found and fixed"
57
-
58
- If a fix is needed, report it as a finding. The orchestrator routes it back to execution.
59
-
60
- ## Input
61
-
62
- - Session file path in `.kontourai/flow-agents/<slug>/` when available
63
- - Plan artifact or implementation summary
64
- - Modified files from execution progress or `git diff --name-only`
65
- - Project standards, especially `context/code-review-standards.md` when present
66
- - Security trigger context when present
67
- - Dependency trigger context when package manifests, dependency manifests, package manager config, or lockfiles change
68
- - IaC/policy trigger context when infrastructure, deployment, or policy files change
69
-
70
- ## Security Review Triggers
71
-
72
- Run `tool-security-reviewer` when modified files or the task touch:
73
-
74
- - authentication or authorization
75
- - user input handling, forms, query params, headers, templates, or serialization
76
- - database queries, migrations, schemas, or persistence
77
- - filesystem paths, uploads, downloads, archives, or generated files
78
- - API endpoints, webhooks, external API calls, or network operations
79
- - cryptography, token handling, secrets, payments, billing, CI, deployment, or feature flags
80
-
81
- If trigger detection is uncertain for a substantial change, run the security reviewer or record the security review as `not_verified`.
82
-
83
- ## Dependency Review Triggers
84
-
85
- Delegate to `tool-dependencies-updater` when modified files include package
86
- manifests, dependency manifests, package manager configuration, or lockfiles.
87
- Common triggers include `package.json`, `package-lock.json`, `pnpm-lock.yaml`,
88
- `yarn.lock`, `requirements.txt`, `pyproject.toml`, `poetry.lock`,
89
- `Pipfile.lock`, `Cargo.toml`, `Cargo.lock`, `go.mod`, `go.sum`, `pom.xml`,
90
- `build.gradle`, `Gemfile.lock`, `composer.lock`, NuGet lock files, Docker base
91
- image dependency declarations, and dependency update policy files.
92
-
93
- The dependency lane is report-only. It may inspect version, advisory, and
94
- lockfile risk using configured read-only tooling, but review-work must not add
95
- package-registry behavior, update dependencies, or install scanners. If the
96
- required dependency review cannot run, record the dependency lane as
97
- `not_verified`.
98
-
99
- For multi-repo or cross-product work, dependency review must preserve the full
100
- scope. Before delegating, enumerate every affected repo/package-manager root and
101
- record one status per root:
102
-
103
- - `pass`: dependency review ran and found no blocking issue
104
- - `fail`: dependency review ran and found a blocking advisory, version, or
105
- lockfile issue
106
- - `skip_no_manifest`: the root has no supported dependency manifest
107
- - `not_verified`: review could not run or the result is unavailable
108
-
109
- Do not narrow the dependency lane to only roots that failed build/test. If the
110
- work changed shared conventions, generated artifact paths, install scripts, CI,
111
- or workspace-wide guidance, the dependency review summary must say which product
112
- roots were included and which were out of scope.
113
-
114
- External advisory/audit services can disclose private dependency metadata. Before
115
- running tools such as `npm audit`, registry lookups, or vendor advisory APIs,
116
- record whether the user explicitly approved that disclosure for the affected
117
- roots. If approval is absent, rejected, or too ambiguous for the local execution
118
- policy, keep local inventory evidence and mark the external-audit portion
119
- `not_verified` with the approval/privacy blocker. Do not convert that blocker
120
- into a clean pass.
121
-
122
- ## IaC/Policy Review Triggers
123
-
124
- Run security and configured IaC/policy review when modified files touch
125
- infrastructure as code, policy as code, cloud/deployment config, Terraform,
126
- OpenTofu, CloudFormation, Kubernetes manifests, Helm charts, Dockerfiles,
127
- Compose files, GitHub Actions, CI/CD permissions, IAM, OPA/Rego, Sentinel, or
128
- environment provisioning.
129
-
130
- IaC/policy scanner guidance is vendor-neutral. Acceptable scanner classes
131
- include Checkov, tfsec, Trivy, Semgrep, and project-configured policy scanners;
132
- do not hard-require one vendor. Treat scanner output as report-only critique
133
- input. If repo-local scanner tooling is unavailable, record the IaC/policy lane
134
- as `not_verified` instead of installing tools or silently passing it.
135
-
136
- ## Workflow
137
-
138
- 1. Read the session file to find the plan artifact path and modified files.
139
- 2. Mark review as in progress. Markdown session files may use human-readable progress labels such as `reviewing`, but machine-readable workflow sidecars must use canonical `state.status` and `state.phase` values. For review-work, keep the lifecycle phase in execution and record critique results through the critique artifact/sink, currently `critique.json` locally:
140
-
141
- ```bash
142
- npm run workflow:sidecar -- advance-state <artifact-dir> \
143
- --status in_progress \
144
- --phase execution \
145
- --summary "Review in progress." \
146
- --next-action "Resolve review findings, then run verify-work."
147
- ```
148
-
149
- 3. Delegate in parallel:
150
-
151
- ```text
152
- tool-code-reviewer:
153
- - Modified files
154
- - Plan/acceptance criteria and user outcome
155
- - context/code-review-standards.md when present
156
- - Architecture, standards, maintainability, and correctness focus
157
- - todo_file path or artifact root for writing a review artifact
158
-
159
- tool-security-reviewer (when triggered):
160
- - Modified files
161
- - Security-sensitive areas to inspect
162
- - Dependency/security commands available to run read-only
163
-
164
- tool-dependencies-updater (when dependency triggers are present):
165
- - Modified package manifests, dependency manifests, package manager config, and lockfiles
166
- - Plan/acceptance criteria and dependency-risk context
167
- - Read-only dependency review focus; no dependency updates or registry behavior changes from review-work
168
-
169
- configured IaC/policy reviewer or repo-local scanner output (when IaC/policy triggers are present):
170
- - Modified Terraform, Kubernetes, Docker, Helm, GitHub Actions, policy-as-code, cloud, or deployment files
171
- - Read-only scanner classes such as Checkov, tfsec, Trivy, and Semgrep when already configured
172
- - Missing scanner or reviewer recorded as not_verified
173
- ```
174
-
175
- 4. Import or record reviewer results into the critique artifact/sink, currently `critique.json` locally:
176
-
177
- ```bash
178
- npm run workflow:sidecar -- import-critique <artifact-dir> <review-artifact> \
179
- --reviewer tool-code-reviewer
180
- ```
181
-
182
- Use `record-critique` directly when the reviewer returns structured findings instead of a Markdown artifact.
183
-
184
- 5. Route on critique status:
185
- - **pass/comment with no blocking findings** -> proceed to `verify-work`
186
- - **fail** -> route findings back to `execute-plan` or `plan-work`
187
- - **not_verified** -> surface the gap for user decision or run the missing reviewer
37
+ Resolve `delegate-implementation` from `.datum/config.json` and follow
38
+ `context/contracts/execution-contract.md`. The Goodhart guard applies: review
39
+ must never resolve below the reasoning tier of the checked work. Record any
40
+ fallback or escalation in the critique artifact.
41
+
42
+ ## Inputs
43
+
44
+ - Changed-file scope from the session, plan, or `RepositoryAdapter`.
45
+ - Acceptance criteria and implementation intent.
46
+ - Repository standards and relevant decisions.
47
+ - Available `CheckProvider` evidence and policy constraints.
48
+
49
+ ## Review Work
50
+
51
+ 1. Establish the changed-file scope. If it cannot be established, record the
52
+ scope review as `NOT_VERIFIED`.
53
+ 2. Select review lanes from the changed scope and risk, not from a fixed list
54
+ run unconditionally:
55
+ - `tool-code-reviewer` for code quality, correctness, architecture, and standards.
56
+ - `tool-security-reviewer` for authentication, authorization, secrets,
57
+ untrusted input, data handling, network boundaries, infrastructure, and
58
+ security-policy changes.
59
+ - `tool-dependencies-updater` for dependency-manifest, lockfile, or dependency-tooling changes.
60
+ - A configured domain or policy reviewer when the repository requires one.
61
+ 3. Use repository-provided scanners and checks when applicable. Do not install
62
+ a scanner, silently substitute a different one, or mark an unavailable
63
+ required lane clean; record the lane as `NOT_VERIFIED` with the missing
64
+ capability and consequence.
65
+ 4. Keep findings actionable: severity, affected scope, evidence, and the
66
+ required route back. Do not install scanners or change code to obtain a
67
+ cleaner result.
68
+ 5. Produce the critique artifact. Open blocking findings route to implementation;
69
+ unavailable required review remains `NOT_VERIFIED`.
188
70
 
189
71
  ## Output
190
72
 
191
- - Review artifacts written by reviewers when available
192
- - Critique artifact/sink updated with reviewer verdicts and findings; locally this is currently `critique.json`
193
- - Session or sidecar state updated so the next step is clear
194
-
195
- Do not treat a clean review as proof that the feature works. It only clears the critique gate; `verify-work` still has to collect evidence.
73
+ For a matching active run, record the review through the public interface:
74
+
75
+ ```bash
76
+ flow-agents workflow critique --session-dir <session-dir> \
77
+ --verdict <pass|fail|not_verified> \
78
+ --summary "Review scope, findings, and unresolved gaps are recorded." \
79
+ --artifact-ref ".kontourai/flow-agents/<slug>/<slug>--deliver.md" \
80
+ --artifact-ref "<reviewed-changed-file>" \
81
+ --lane-json '{"id":"code-review","status":"pass","summary":"Code quality, correctness, architecture, and standards were reviewed.","evidence_refs":[{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<slug>--deliver.md","summary":"Reviewed delivery artifact and changed-scope context."}]}'
82
+ ```
83
+
84
+ The delegated reviewer must invoke this operation under its own runtime actor
85
+ identity. The public operation requires an active implementation assignment but
86
+ rejects the assigned implementation actor as the reviewer; do not proxy the
87
+ review through the implementation actor or supply a caller-selected reviewer
88
+ label. The critique is stored as the review slice in `trust.bundle`: reviewer
89
+ identity, covered scope, lane verdicts, severity-tagged findings, evidence, and
90
+ unresolved `NOT_VERIFIED` gaps. A clean critique satisfies the declared
91
+ `clean-critique` expectation, but it is not test evidence, does not satisfy
92
+ `tests-evidence`, and does not independently advance a Flow run.
93
+
94
+ Runtime actor separation is a coordination guarantee, not cryptographic
95
+ attestation. When repository policy requires an externally attested reviewer
96
+ credential and the runtime cannot provide one, record reviewer identity as
97
+ `NOT_VERIFIED`; do not describe the review as independently authenticated.
98
+
99
+ Every critique needs at least one substantive `--lane-json`. A passing critique
100
+ also needs existing local `--artifact-ref` values for the delivery report and
101
+ reviewed changed files. The writer hashes those files and captures the current
102
+ workspace snapshot in `review_target`. Git repositories bind the review to
103
+ `HEAD`, the tracked diff, and untracked file bytes; non-Git repositories bind it
104
+ to the explicitly reviewed files. A later implementation change makes the
105
+ critique stale rather than silently clean.
106
+
107
+ For standalone use, return the same report to the caller without creating a
108
+ workflow record.