@kontourai/flow-agents 2.3.0 → 2.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.
- package/.github/CODEOWNERS +8 -0
- package/.github/workflows/ci.yml +32 -0
- package/AGENTS.md +4 -4
- package/CHANGELOG.md +39 -0
- package/CONTEXT.md +14 -0
- package/README.md +9 -3
- package/agents/dev.json +1 -1
- package/agents/tool-code-reviewer.json +1 -1
- package/agents/tool-planner.json +3 -3
- package/agents/tool-verifier.json +3 -3
- package/build/src/cli/console-learning-projection.js +3 -2
- package/build/src/cli/init.js +104 -21
- package/build/src/cli/kit.js +37 -6
- package/build/src/cli/pull-work-provider.js +1 -1
- package/build/src/cli/usage-feedback.js +3 -3
- package/build/src/cli/validate-hook-influence.js +1 -0
- package/build/src/cli/validate-workflow-artifacts.js +22 -6
- package/build/src/cli/workflow-artifact-cleanup-audit.js +36 -2
- package/build/src/cli/workflow-sidecar.d.ts +14 -7
- package/build/src/cli/workflow-sidecar.js +792 -69
- package/build/src/flow-kit/validate.d.ts +23 -0
- package/build/src/flow-kit/validate.js +67 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +1 -1
- package/build/src/lib/flow-resolver.d.ts +6 -4
- package/build/src/lib/flow-resolver.js +125 -58
- package/build/src/lib/local-artifact-root.d.ts +14 -2
- package/build/src/lib/local-artifact-root.js +22 -5
- package/build/src/lib/workflow-learning-projection.js +2 -2
- package/build/src/runtime-adapters.d.ts +12 -0
- package/build/src/runtime-adapters.js +56 -16
- package/build/src/tools/build-universal-bundles.js +49 -16
- package/build/src/tools/generate-context-map.js +10 -8
- package/build/src/tools/validate-source-tree.js +23 -1
- package/console.telemetry.json +22 -0
- package/context/contracts/artifact-contract.md +38 -7
- package/context/contracts/builder-kit-workflow-state-contract.md +3 -2
- package/context/contracts/decision-registry-contract.md +263 -0
- package/context/contracts/delivery-contract.md +1 -1
- package/context/contracts/planning-contract.md +2 -1
- package/context/contracts/review-contract.md +5 -3
- package/context/contracts/verification-contract.md +9 -1
- package/context/contracts/work-item-contract.md +1 -1
- package/context/deferred/parallelization.md +1 -1
- package/context/gate-awareness.md +4 -4
- package/context/scripts/git-status.sh +2 -2
- package/context/scripts/hooks/config-protection.js +502 -2
- package/context/scripts/hooks/lib/config-protection-remedies.js +69 -0
- package/context/scripts/hooks/run-hook.js +14 -1
- package/context/scripts/hooks/stop-goal-fit.js +1140 -99
- package/context/scripts/hooks/workflow-steering.js +212 -6
- package/docs/adr/0007-flow-skill-kit-tool-boundary.md +2 -0
- package/docs/adr/0015-flow-flow-agents-boundary-reconciliation.md +35 -0
- package/docs/adr/0019-kit-dependency-ownership.md +62 -0
- package/docs/adr/0020-trust-reconcile-manifest-and-claim-classification.md +290 -0
- package/docs/adr/0021-assignment-leases-and-stale-claim-takeover.md +221 -0
- package/docs/adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md +283 -0
- package/docs/agent-system-guidebook.md +3 -3
- package/docs/agent-usage-feedback-loop.md +6 -6
- package/docs/context-map.md +9 -7
- package/docs/decisions/decision-records.md +57 -0
- package/docs/decisions/index.md +14 -0
- package/docs/decisions/promotion-gate.md +52 -0
- package/docs/developer-architecture.md +1 -1
- package/docs/fixture-ownership.md +3 -0
- package/docs/flow-kit-repository-contract.md +5 -5
- package/docs/getting-started.md +12 -2
- package/docs/integrations/harness-install.md +2 -1
- package/docs/kit-authoring-guide.md +64 -5
- package/docs/knowledge-kit.md +5 -1
- package/docs/learnings/2026-07-improvement-program.md +203 -0
- package/docs/migrations.md +6 -5
- package/docs/north-star.md +2 -2
- package/docs/operating-layers.md +4 -3
- package/docs/repository-structure.md +5 -5
- package/docs/skills-map.md +8 -8
- package/docs/spec/runtime-hook-surface.md +19 -15
- package/docs/spikes/graph-provider-2026-07.md +155 -0
- package/docs/standards-register.md +7 -7
- package/docs/trust-anchor-adoption.md +105 -4
- package/docs/work-item-adapters.md +1 -1
- package/docs/workflow-artifact-lifecycle.md +72 -9
- package/docs/workflow-eval-strategy.md +3 -3
- package/docs/workflow-shared-contracts.md +1 -1
- package/docs/workflow-usage-guide.md +254 -21
- package/evals/acceptance/DEMO-false-completion.md +20 -11
- package/evals/acceptance/prove-capture-teeth-declared.sh +15 -15
- package/evals/acceptance/prove-capture-teeth.sh +11 -11
- package/evals/acceptance/test_kiro_harness.sh +1 -1
- package/evals/ci/antigaming-suite.sh +5 -0
- package/evals/ci/run-baseline.sh +65 -1
- package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/flows/review.flow.json +26 -0
- package/evals/fixtures/flow-kit-repository/invalid-bad-dependency/kit.json +13 -0
- package/evals/fixtures/flow-kit-repository/valid-with-dependency/flows/review.flow.json +26 -0
- package/evals/fixtures/flow-kit-repository/valid-with-dependency/kit.json +13 -0
- package/evals/fixtures/hook-influence/cases.json +32 -0
- package/evals/fixtures/pull-work-provider/github-issues.json +6 -6
- package/evals/fixtures/trust-reconcile-exploits/fabricated-attestation.json +59 -0
- package/evals/fixtures/trust-reconcile-exploits/no-label-bypass.json +36 -0
- package/evals/fixtures/trust-reconcile-exploits/skip-assumed-bypass.json +59 -0
- package/evals/fixtures/trust-reconcile-exploits/status-misassertion.json +48 -0
- package/evals/fixtures/trust-reconcile-exploits/waived-command-check.json +44 -0
- package/evals/fixtures/trust-reconcile-mixed-bundle/mixed-bundle.json +159 -0
- package/evals/fixtures/trust-reconcile-ws3/ws3-bundle.json +920 -0
- package/evals/integration/test_actor_identity.sh +254 -0
- package/evals/integration/test_builder_step_producers.sh +33 -23
- package/evals/integration/test_bundle_install.sh +22 -16
- package/evals/integration/test_bundle_lifecycle.sh +11 -11
- package/evals/integration/test_captured_fail_reconciliation.sh +50 -50
- package/evals/integration/test_checkpoint_signing.sh +43 -0
- package/evals/integration/test_claim_lookup.sh +4 -4
- package/evals/integration/test_codex_hook_resolution.sh +114 -0
- package/evals/integration/test_command_log_concurrency.sh +8 -8
- package/evals/integration/test_command_log_fork_classification.sh +3 -3
- package/evals/integration/test_command_log_integrity.sh +16 -16
- package/evals/integration/test_console_learning_projection.sh +1 -1
- package/evals/integration/test_dual_emit_flow_step.sh +145 -0
- package/evals/integration/test_enforcer_expects_driven.sh +12 -12
- package/evals/integration/test_evidence_capture_hook.sh +14 -13
- package/evals/integration/test_fixture_retirement_audit.sh +2 -2
- package/evals/integration/test_flow_agents_statusline.sh +2 -2
- package/evals/integration/test_flow_kit_install_git.sh +52 -0
- package/evals/integration/test_flow_kit_repository.sh +2 -0
- package/evals/integration/test_flowdef_session_activation.sh +6 -6
- package/evals/integration/test_flowdef_union_floor_regression.sh +429 -0
- package/evals/integration/test_gate_bypass_chain.sh +52 -40
- package/evals/integration/test_gate_lockdown.sh +97 -73
- package/evals/integration/test_gate_review_inquiry_records.sh +3 -3
- package/evals/integration/test_goal_fit_escape_hatch.sh +10 -10
- package/evals/integration/test_goal_fit_ghost_session.sh +104 -0
- package/evals/integration/test_goal_fit_hook.sh +32 -32
- package/evals/integration/test_goal_fit_rederive.sh +9 -9
- package/evals/integration/test_hook_category_behaviors.sh +103 -0
- package/evals/integration/test_hook_influence_cases.sh +1 -0
- package/evals/integration/test_install_merge.sh +262 -1
- package/evals/integration/test_kit_identity_trust.sh +6 -6
- package/evals/integration/test_liveness_conflict_injection.sh +587 -0
- package/evals/integration/test_liveness_heartbeat.sh +677 -0
- package/evals/integration/test_liveness_verdict.sh +394 -0
- package/evals/integration/test_local_flow_kit_install.sh +15 -0
- package/evals/integration/test_phase_map_and_gate_claim.sh +63 -11
- package/evals/integration/test_promote_gate.sh +178 -0
- package/evals/integration/test_publish_delivery.sh +2 -2
- package/evals/integration/test_pull_work_liveness_preflight.sh +386 -0
- package/evals/integration/test_pull_work_provider.sh +2 -2
- package/evals/integration/test_reconcile_soundness.sh +4 -4
- package/evals/integration/test_resolvefirststep_security.sh +22 -0
- package/evals/integration/test_runtime_adapter_activation.sh +87 -18
- package/evals/integration/test_session_resume_roundtrip.sh +147 -0
- package/evals/integration/test_sidecar_field_preservation.sh +249 -0
- package/evals/integration/test_trust_reconcile.sh +2 -2
- package/evals/integration/test_trust_reconcile_manifest.sh +79 -0
- package/evals/integration/test_trust_reconcile_mixed_bundle.sh +96 -0
- package/evals/integration/test_trust_reconcile_negatives.sh +151 -0
- package/evals/integration/test_usage_feedback_global.sh +5 -5
- package/evals/integration/test_validate_artifacts_portability.sh +60 -0
- package/evals/integration/test_verify_cli.sh +2 -2
- package/evals/integration/test_veritas_governance_kit.sh +117 -0
- package/evals/integration/test_workflow_artifact_cleanup_audit.sh +26 -1
- package/evals/integration/test_workflow_artifacts.sh +33 -0
- package/evals/integration/test_workflow_sidecar_writer.sh +723 -74
- package/evals/integration/test_workflow_steering_hook.sh +175 -5
- package/evals/lib/codex-provider.sh +1 -1
- package/evals/lib/node.sh +19 -1
- package/evals/run.sh +22 -0
- package/evals/static/test_decisions.sh +150 -0
- package/evals/static/test_flowdef_codeowners_coverage.sh +56 -0
- package/evals/static/test_package.sh +19 -10
- package/evals/static/test_universal_bundles.sh +48 -3
- package/evals/static/test_workflow_skills.sh +41 -8
- package/kits/builder/flows/build.flow.json +3 -74
- package/kits/builder/flows/publish-learn.flow.json +90 -0
- package/kits/builder/kit.json +11 -0
- package/kits/builder/skills/builder-shape/SKILL.md +1 -1
- package/kits/builder/skills/deliver/SKILL.md +13 -11
- package/kits/builder/skills/design-probe/SKILL.md +4 -4
- package/kits/builder/skills/evidence-gate/SKILL.md +26 -1
- package/kits/builder/skills/execute-plan/SKILL.md +2 -2
- package/kits/builder/skills/fix-bug/SKILL.md +2 -0
- package/kits/builder/skills/gate-review/SKILL.md +6 -6
- package/kits/builder/skills/idea-to-backlog/SKILL.md +1 -1
- package/kits/builder/skills/learning-review/SKILL.md +7 -7
- package/kits/builder/skills/pickup-probe/SKILL.md +5 -4
- package/kits/builder/skills/plan-work/SKILL.md +27 -5
- package/kits/builder/skills/pull-work/SKILL.md +80 -5
- package/kits/builder/skills/release-readiness/SKILL.md +4 -4
- package/kits/builder/skills/review-work/SKILL.md +24 -1
- package/kits/builder/skills/tdd-workflow/SKILL.md +2 -0
- package/kits/builder/skills/verify-work/SKILL.md +8 -1
- package/kits/catalog.json +6 -0
- package/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +178 -0
- package/kits/veritas-governance/docs/README.md +75 -0
- package/kits/veritas-governance/fixtures/readiness/not-ready.readiness-report.json +4645 -0
- package/kits/veritas-governance/fixtures/readiness/ready.readiness-report.json +4403 -0
- package/kits/veritas-governance/flows/readiness-check.flow.json +35 -0
- package/kits/veritas-governance/kit.json +16 -0
- package/package.json +8 -4
- package/packaging/README.md +2 -2
- package/packaging/conformance/fixtures/config-protection--allow-read-state-json.json +20 -0
- package/packaging/conformance/fixtures/config-protection--block-write-state-json.json +20 -0
- package/packaging/conformance/fixtures/stop-goal-fit--block-bundle-disputed-claim.json +1 -1
- package/packaging/conformance/fixtures/stop-goal-fit--block-capture-contradicts-claimed-pass.json +1 -1
- package/packaging/manifest.json +9 -10
- package/schemas/decision-record.schema.json +109 -0
- package/schemas/workflow-evidence.schema.json +1 -1
- package/schemas/workflow-state.schema.json +5 -0
- package/scripts/README.md +8 -3
- package/scripts/check-content-boundary.cjs +1 -1
- package/scripts/check-decisions.cjs +356 -0
- package/scripts/ci/derive-claim-status.mjs +74 -0
- package/scripts/ci/trust-reconcile.js +436 -79
- package/scripts/git-status.sh +2 -2
- package/scripts/hooks/claude-telemetry-hook.js +37 -3
- package/scripts/hooks/codex-telemetry-hook.js +36 -2
- package/scripts/hooks/config-protection.js +102 -30
- package/scripts/hooks/evidence-capture.js +3 -3
- package/scripts/hooks/lib/actor-identity.js +368 -0
- package/scripts/hooks/lib/config-protection-remedies.js +69 -0
- package/scripts/hooks/lib/liveness-heartbeat.js +361 -0
- package/scripts/hooks/lib/liveness-policy.js +127 -0
- package/scripts/hooks/lib/liveness-read.js +105 -12
- package/scripts/hooks/lib/liveness-write.js +46 -0
- package/scripts/hooks/lib/local-artifact-paths.js +12 -6
- package/scripts/hooks/opencode-telemetry-hook.js +27 -1
- package/scripts/hooks/pi-telemetry-hook.js +27 -1
- package/scripts/hooks/stop-goal-fit.js +157 -26
- package/scripts/hooks/workflow-steering.js +77 -3
- package/scripts/install-codex-home.sh +138 -38
- package/scripts/statusline/flow-agents-statusline.js +2 -2
- package/src/cli/console-learning-projection.ts +3 -2
- package/src/cli/init.ts +101 -21
- package/src/cli/kit.ts +37 -6
- package/src/cli/public-api.test.mjs +58 -6
- package/src/cli/pull-work-provider.ts +1 -1
- package/src/cli/trust-bundle-policy-order.test.mjs +87 -0
- package/src/cli/usage-feedback.ts +3 -3
- package/src/cli/validate-hook-influence.ts +1 -0
- package/src/cli/validate-workflow-artifacts.ts +22 -6
- package/src/cli/veritas-readiness-adapter.test.mjs +267 -0
- package/src/cli/workflow-artifact-cleanup-audit.ts +35 -2
- package/src/cli/workflow-sidecar.ts +795 -71
- package/src/flow-kit/validate.ts +74 -1
- package/src/index.ts +6 -2
- package/src/lib/flow-resolver.ts +123 -55
- package/src/lib/local-artifact-root.ts +24 -5
- package/src/lib/workflow-learning-projection.ts +2 -2
- package/src/runtime-adapters.ts +61 -15
- package/src/tools/build-universal-bundles.ts +49 -16
- package/src/tools/generate-context-map.ts +10 -8
- package/src/tools/validate-source-tree.ts +23 -1
package/.github/CODEOWNERS
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
# The anti-gaming gate + its enforcement hooks
|
|
23
23
|
/scripts/hooks/stop-goal-fit.js @briananderson1222
|
|
24
24
|
/scripts/hooks/config-protection.js @briananderson1222
|
|
25
|
+
/scripts/hooks/lib/config-protection-remedies.js @briananderson1222
|
|
25
26
|
/scripts/hooks/evidence-capture.js @briananderson1222
|
|
26
27
|
|
|
27
28
|
# FlowDefinition resolution + the trust producer/checkpoint/signing the gate depends on
|
|
@@ -29,3 +30,10 @@
|
|
|
29
30
|
/src/cli/workflow-sidecar.ts @briananderson1222
|
|
30
31
|
# Modules decomposed out of workflow-sidecar.ts (ops#22) keep the same ownership.
|
|
31
32
|
/src/cli/sidecar-*.ts @briananderson1222
|
|
33
|
+
|
|
34
|
+
# Kit FlowDefinitions — the enforcer's expects[] taxonomy (ADR 0016 Abstraction A) comes
|
|
35
|
+
# from these files. Narrowing a gate's expects[] locally is a real self-tamper vector
|
|
36
|
+
# that Layer 2 (CI trust-reconcile) does not catch for non-command-shaped claims. Per
|
|
37
|
+
# ADR 0018 Decision #2, route new kill-switch vectors to Layer 4 (this file), not a new
|
|
38
|
+
# config-protection.js matcher.
|
|
39
|
+
/kits/*/flows/*.flow.json @briananderson1222
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -64,6 +64,10 @@ jobs:
|
|
|
64
64
|
continue-on-error: true
|
|
65
65
|
run: bash evals/ci/run-baseline.sh --check content-boundary
|
|
66
66
|
|
|
67
|
+
- name: Decision registry
|
|
68
|
+
continue-on-error: true
|
|
69
|
+
run: bash evals/ci/run-baseline.sh --check decision-registry
|
|
70
|
+
|
|
67
71
|
- name: Source tree validation
|
|
68
72
|
continue-on-error: true
|
|
69
73
|
run: bash evals/ci/run-baseline.sh --check source-tree-validation
|
|
@@ -137,6 +141,14 @@ jobs:
|
|
|
137
141
|
continue-on-error: true
|
|
138
142
|
run: bash evals/ci/run-baseline.sh --check workflow-sidecar-writer-integration
|
|
139
143
|
|
|
144
|
+
- name: Sidecar field preservation integration
|
|
145
|
+
continue-on-error: true
|
|
146
|
+
run: bash evals/ci/run-baseline.sh --check sidecar-field-preservation-integration
|
|
147
|
+
|
|
148
|
+
- name: Actor identity resolver integration
|
|
149
|
+
continue-on-error: true
|
|
150
|
+
run: bash evals/ci/run-baseline.sh --check actor-identity-resolver-integration
|
|
151
|
+
|
|
140
152
|
- name: Finalize CI evidence
|
|
141
153
|
if: always()
|
|
142
154
|
run: bash evals/ci/run-baseline.sh --finalize
|
|
@@ -246,6 +258,10 @@ jobs:
|
|
|
246
258
|
continue-on-error: true
|
|
247
259
|
run: bash evals/ci/run-baseline.sh --check telemetry-contract-integration
|
|
248
260
|
|
|
261
|
+
- name: Liveness heartbeat integration
|
|
262
|
+
continue-on-error: true
|
|
263
|
+
run: bash evals/ci/run-baseline.sh --check liveness-heartbeat-integration
|
|
264
|
+
|
|
249
265
|
- name: Telemetry doctor integration
|
|
250
266
|
continue-on-error: true
|
|
251
267
|
run: bash evals/ci/run-baseline.sh --check telemetry-doctor-integration
|
|
@@ -262,6 +278,22 @@ jobs:
|
|
|
262
278
|
continue-on-error: true
|
|
263
279
|
run: bash evals/ci/run-baseline.sh --check pull-work-provider-integration
|
|
264
280
|
|
|
281
|
+
- name: Pull work liveness preflight integration
|
|
282
|
+
continue-on-error: true
|
|
283
|
+
run: bash evals/ci/run-baseline.sh --check pull-work-liveness-preflight-integration
|
|
284
|
+
|
|
285
|
+
- name: Liveness verdict integration
|
|
286
|
+
continue-on-error: true
|
|
287
|
+
run: bash evals/ci/run-baseline.sh --check liveness-verdict-integration
|
|
288
|
+
|
|
289
|
+
- name: Liveness conflict injection integration
|
|
290
|
+
continue-on-error: true
|
|
291
|
+
run: bash evals/ci/run-baseline.sh --check liveness-conflict-injection-integration
|
|
292
|
+
|
|
293
|
+
- name: Veritas governance kit integration
|
|
294
|
+
continue-on-error: true
|
|
295
|
+
run: bash evals/ci/run-baseline.sh --check veritas-governance-kit-integration
|
|
296
|
+
|
|
265
297
|
# The anti-gaming + trust regression suite runs in this REQUIRED lane so that
|
|
266
298
|
# weakening the gate / CI anchor / their protections (or removing a regression
|
|
267
299
|
# test) is caught and cannot merge. Convergence red-team (Round 5/7) closure.
|
package/AGENTS.md
CHANGED
|
@@ -7,7 +7,7 @@ This bundle was generated from the canonical source in this repo. Treat the repo
|
|
|
7
7
|
- **Commit messages drive releases.** Releases are automated with release-please: `feat:` bumps minor, `fix:` bumps patch, `feat!:`/`BREAKING CHANGE` bumps major; `docs:`/`chore:`/`test:`/`refactor:` don't bump. Commits without a conventional prefix are invisible to version inference — use one. Details: CONTRIBUTING.md ("Releases").
|
|
8
8
|
- **Never hand-edit release PRs** (`release-please--branches--*`); they are regenerated on every push to main.
|
|
9
9
|
- **Evidence hygiene:** issue/PR permalinks must pin a real commit SHA (`git rev-parse`, never typed by hand); claims about behavior need command/test evidence.
|
|
10
|
-
- `.flow-agents/` runtime artifacts stay untracked; durable records belong in docs/, issues, or tracked source.
|
|
10
|
+
- `.kontourai/flow-agents/` runtime artifacts stay untracked; durable records belong in docs/, issues, `.flow-agents/` config/state when explicitly owned by Flow Agents, or tracked source.
|
|
11
11
|
|
|
12
12
|
### Operating discipline (working agreements)
|
|
13
13
|
|
|
@@ -24,7 +24,7 @@ Confirmed agreements for developing this repo — the *kit-discipline* bucket of
|
|
|
24
24
|
## Shared Conventions
|
|
25
25
|
|
|
26
26
|
- `skills/`, `context/`, `powers/`, `prompts/`, `scripts/`, and `evals/` were copied from the canonical source.
|
|
27
|
-
- Cross-session task artifacts should live under `.flow-agents`.
|
|
27
|
+
- Cross-session task artifacts should live under `.kontourai/flow-agents`.
|
|
28
28
|
- Kiro-only hook wiring was stripped from exported non-Kiro agents to keep the package portable.
|
|
29
29
|
- **Gate awareness:** `context/gate-awareness.md` — the three active gates (goal-fit/Stop, evidence-capture, reground), why a block is the system working, and how to diagnose a suspected missed block.
|
|
30
30
|
|
|
@@ -39,8 +39,8 @@ Confirmed agreements for developing this repo — the *kit-discipline* bucket of
|
|
|
39
39
|
- `tool-explore-patterns` — Delegate to me for Pattern detection - identifies architectural patterns, frameworks, and coding conventions
|
|
40
40
|
- `tool-explore-structure` — Delegate to me to scout out the project structure - maps directory layout and identifies key folders in a codebase
|
|
41
41
|
- `tool-explore-tests` — Delegate to me to find and understand testing strategies - locates test files and understands testing strategy
|
|
42
|
-
- `tool-planner` — Delegate to me for codebase analysis and execution planning. Explores code, identifies patterns and dependencies, and writes plan/sidecar artifacts under .flow-agents. No production file modifications.
|
|
42
|
+
- `tool-planner` — Delegate to me for codebase analysis and execution planning. Explores code, identifies patterns and dependencies, and writes plan/sidecar artifacts under .kontourai/flow-agents. No production file modifications.
|
|
43
43
|
- `tool-playwright` — Delegate to me for browser automation, testing, and debugging - loading real pages, testing navigation, checking accessibility via structured snapshots, evaluating scripts, and visual verification. Anything that would otherwise require a browser. Do NOT use for general web search or fetching content
|
|
44
44
|
- `tool-security-reviewer` — Delegate to me for security analysis. Checks OWASP Top 10, secrets detection, input validation, injection vulnerabilities, auth/authz, and rate limiting. Read-only analysis with shell for scanning tools.
|
|
45
|
-
- `tool-verifier` — Delegate to me for implementation verification. Read-only + shell for source code; writes review/evidence artifacts under .flow-agents. Verifies acceptance criteria and produces PASS/FAIL/NOT_VERIFIED verdicts with evidence. No production file modifications.
|
|
45
|
+
- `tool-verifier` — Delegate to me for implementation verification. Read-only + shell for source code; writes review/evidence artifacts under .kontourai/flow-agents. Verifies acceptance criteria and produces PASS/FAIL/NOT_VERIFIED verdicts with evidence. No production file modifications.
|
|
46
46
|
- `tool-worker` — Delegate to me for writing and developing source code for a project. Works best when a detailed plan can be provided. NO access to web tools. Can be used in parallel for any coding tasks that require trusted access to the write and shell tools. WARNING: May spawn a `git worktree`
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.4.0](https://github.com/kontourai/flow-agents/compare/v2.3.0...v2.4.0) (2026-07-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **decisions:** topic-keyed living decision registry contract (Closes [#310](https://github.com/kontourai/flow-agents/issues/310)) ([#316](https://github.com/kontourai/flow-agents/issues/316)) ([0bd4e0b](https://github.com/kontourai/flow-agents/commit/0bd4e0ba593480c1e11988d2f9257082a3f06b4a))
|
|
9
|
+
* **gates:** regression-lock the FlowDefinition-driven stop gate + gate-named block messages (ADR 0016 Abstraction A closeout) ([#265](https://github.com/kontourai/flow-agents/issues/265)) ([0fd0c0e](https://github.com/kontourai/flow-agents/commit/0fd0c0e56c3a8e007f116c77937f9fc61d9a6be7))
|
|
10
|
+
* **kits:** cross-kit dependencies, skill-collision fixes, sidecar governance ([#264](https://github.com/kontourai/flow-agents/issues/264)) ([b2a4cc8](https://github.com/kontourai/flow-agents/commit/b2a4cc8abc1d7a822274fae90ee5e5e9e6dc7de5))
|
|
11
|
+
* **kits:** veritas-governance kit — readiness→trust-bundle adapter with settled gate semantics ([#269](https://github.com/kontourai/flow-agents/issues/269)) ([7a08396](https://github.com/kontourai/flow-agents/commit/7a083966db47672ea552f13264ea3111e08fa06b))
|
|
12
|
+
* **liveness:** default-on lifecycle + tool-activity heartbeats ([#288](https://github.com/kontourai/flow-agents/issues/288)) ([#306](https://github.com/kontourai/flow-agents/issues/306)) ([3134614](https://github.com/kontourai/flow-agents/commit/31346147311e829352b2219ce1a91b6babc5ec27))
|
|
13
|
+
* **liveness:** runtime-agnostic actor identity; retire the "local" default ([#287](https://github.com/kontourai/flow-agents/issues/287)) ([#296](https://github.com/kontourai/flow-agents/issues/296)) ([204a4c6](https://github.com/kontourai/flow-agents/commit/204a4c68643587727b7d0c22390de4375a24ea6e))
|
|
14
|
+
* promote-then-archive gate — durable-residue extraction is the archival act (Closes [#312](https://github.com/kontourai/flow-agents/issues/312)) ([#319](https://github.com/kontourai/flow-agents/issues/319)) ([490542c](https://github.com/kontourai/flow-agents/commit/490542caf461ab4e5bff1542f3e56f4fdc9fd234))
|
|
15
|
+
* **pull-work:** liveness selection preflight — exclude held, claim on selection ([#329](https://github.com/kontourai/flow-agents/issues/329)) ([8c76568](https://github.com/kontourai/flow-agents/commit/8c76568407d37b145b5d3ea420c8b9746d2b5ac5))
|
|
16
|
+
* **trust-anchor:** manifest-based reconcile, claim classification, loud attestations (WS8) ([55b66db](https://github.com/kontourai/flow-agents/commit/55b66dbf8c3c30f828439f1983669722981bcbae))
|
|
17
|
+
* **trust-bundle:** migrate to @kontourai/surface 2.0.0 (Claim.facet rename) ([#277](https://github.com/kontourai/flow-agents/issues/277)) ([573b45e](https://github.com/kontourai/flow-agents/commit/573b45ec28453392bc11286ef7378b6627c790e0))
|
|
18
|
+
* **veritas-governance:** migrate adapter to facet + schemaVersion 5 ([#285](https://github.com/kontourai/flow-agents/issues/285)) ([1948639](https://github.com/kontourai/flow-agents/commit/19486395e1c57231b9b8c9ec805d2fe2f720426e)), closes [#281](https://github.com/kontourai/flow-agents/issues/281)
|
|
19
|
+
* **workflow:** branch as first-class routing state with agent/<actor>/<slug> convention ([#308](https://github.com/kontourai/flow-agents/issues/308)) ([739575c](https://github.com/kontourai/flow-agents/commit/739575c8f5f43a1f056982201cddaae699fe6409))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Fixes
|
|
23
|
+
|
|
24
|
+
* **bundles:** resolve Codex hook script with HOME fallback; fail open with diagnostic ([e9c5993](https://github.com/kontourai/flow-agents/commit/e9c5993d84483c114641090026afaedc70afdcdb))
|
|
25
|
+
* **evals:** heal integration lanes after runtime-path split ([20cdb36](https://github.com/kontourai/flow-agents/commit/20cdb36ac4b5704599faa524a5189d288b6d8a40))
|
|
26
|
+
* **evals:** register WS8 fixtures with the retirement audit ([95f6baf](https://github.com/kontourai/flow-agents/commit/95f6bafe37a4eb492d6ccb70892f0038e35a3850))
|
|
27
|
+
* **flow-agents:** resolve claude-code --global hook paths absolutely ([9148033](https://github.com/kontourai/flow-agents/commit/9148033f7c1e02512550f342d1bf3ac5e80fdf9d))
|
|
28
|
+
* **sidecar:** preserve branch and created_at across init-plan; add field-preservation invariant sweep ([#315](https://github.com/kontourai/flow-agents/issues/315)) ([cae9c38](https://github.com/kontourai/flow-agents/commit/cae9c38d2d311e6205f665cc4943808748effaec))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Documentation
|
|
32
|
+
|
|
33
|
+
* **adr:** ADR 0021 — assignment leases and stale-claim takeover ([#286](https://github.com/kontourai/flow-agents/issues/286)) ([df345dd](https://github.com/kontourai/flow-agents/commit/df345dd8a1dc067fff2d03334041b373057eb79c))
|
|
34
|
+
* **adr:** ADR 0022 — fail-closed delivery reconciliation with governed exemptions ([#299](https://github.com/kontourai/flow-agents/issues/299)) ([046005a](https://github.com/kontourai/flow-agents/commit/046005af025663de005684c92fd825eab73fb8b1))
|
|
35
|
+
* **learnings:** 2026-07 improvement-program learning review ([#284](https://github.com/kontourai/flow-agents/issues/284)) ([514b6ad](https://github.com/kontourai/flow-agents/commit/514b6ad346d0e42939b4c03bdee976fe0c166bf3))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Refactoring
|
|
39
|
+
|
|
40
|
+
* **flow-agents:** centralize Codex home default helper ([dc9995c](https://github.com/kontourai/flow-agents/commit/dc9995cdc43a456ab6248307ef6d5ace59559313))
|
|
41
|
+
|
|
3
42
|
## [2.3.0](https://github.com/kontourai/flow-agents/compare/v2.2.0...v2.3.0) (2026-07-01)
|
|
4
43
|
|
|
5
44
|
|
package/CONTEXT.md
CHANGED
|
@@ -256,6 +256,20 @@ _Avoid_: Retrospective as the generic term
|
|
|
256
256
|
|
|
257
257
|
The ability to inspect what the agent was asked to do, which operating path it followed, what evidence was collected, which gates passed or failed, and why the next action is trustworthy or blocked.
|
|
258
258
|
|
|
259
|
+
### Decision Records
|
|
260
|
+
|
|
261
|
+
Topic-keyed living decision records at `docs/decisions/<topic-slug>.md`, one file per decision subject, that hold the current answer to a settled question plus lean rationale. Supersession is an edit to the file; derivation context is linked via evidence refs, never inlined. Slugs are nouns from this glossary. Numbered ADRs under `docs/adr/` are frozen history and are never written for new decisions.
|
|
262
|
+
_Avoid_: Numbered ADR as the format for new decisions
|
|
263
|
+
|
|
264
|
+
### Decision Registry
|
|
265
|
+
|
|
266
|
+
The system of Decision Records plus the generated index at [docs/decisions/index.md](docs/decisions/index.md) (slug + one-line summary). The contract is [context/contracts/decision-registry-contract.md](context/contracts/decision-registry-contract.md); the frontmatter schema is `schemas/decision-record.schema.json`; `npm run check:decisions` validates it. Consult the index at write time to decide revise-vs-create.
|
|
267
|
+
|
|
268
|
+
### Promotion Gate
|
|
269
|
+
|
|
270
|
+
The gated sequence — final acceptance -> promote -> archive — that makes durable-residue extraction the archival act: a delivered session's decisions, vocabulary, learnings, and doc updates must be promoted into durable living docs before the session is archived. The `promote` step records what was promoted where and writes a session-local **promotion claim** into the session `trust.bundle` (evidence refs = the durable doc paths written, or an explicit `--none` no-residue reason). `workflow-artifact-cleanup-audit` classifies a delivered/accepted session with no promotion claim as a cleanup candidate (archive blocked), not terminal. See [docs/decisions/promotion-gate.md](docs/decisions/promotion-gate.md) and [docs/workflow-artifact-lifecycle.md](docs/workflow-artifact-lifecycle.md).
|
|
271
|
+
_Avoid_: Docs-promotion as a parallel checklist chore
|
|
272
|
+
|
|
259
273
|
### Governance Adapter
|
|
260
274
|
|
|
261
275
|
An optional integration that supplies policy, proof, or trust evidence without making Flow Agents own the external tool's rule semantics. Veritas is the first known governance adapter candidate.
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Flow Agents addresses this with a process-discipline layer that sits between the
|
|
|
25
25
|
|
|
26
26
|
- **One workflow across runtimes** — the same `idea → backlog → plan → build → review → verify → evidence → release → learning` path installs into Claude Code, Codex, Kiro, opencode, and pi without rewriting it per tool.
|
|
27
27
|
- **Workflow skills** — `idea-to-backlog`, `pull-work`, `plan-work`, `execute-plan`, `review-work`, `verify-work`, `evidence-gate`, `release-readiness`, `learning-review`, and orchestrators like `deliver` and `fix-bug` that chain them.
|
|
28
|
-
- **
|
|
28
|
+
- **Resumable workflow state** — schema-validated sidecars under `.kontourai/flow-agents/` record acceptance criteria, evidence, critique, handoff, and learning, so any session can resume from recorded state instead of chat memory.
|
|
29
29
|
- **Four canonical policies** — workflow steering (phase reminders at each turn), quality gate (per-file checks after edits), stop-goal-fit (evidence check before the agent stops), and config protection (veto writes to linter/formatter configs). Each policy class has a canonical script under `scripts/hooks/` and compiles to the host's native hook format.
|
|
30
30
|
- **Evidence over confidence** — important work ends with tests, browser checks, CI results, review findings, governance reports, or an explicit `NOT_VERIFIED` gap. Optional [Veritas](docs/veritas-integration.md) integration attaches repo-governance evidence without making it mandatory.
|
|
31
31
|
- **Verifiable, un-gameable "done"** — the agent can't mark work complete that isn't: the gate re-derives the verdict from independent evidence, an external CI anchor re-runs the verification fresh and fails the merge on any divergence, and CI mints a Sigstore-signed record of what shipped. See [Verifiable Trust — why "done" actually means done](docs/verifiable-trust.md).
|
|
@@ -88,6 +88,8 @@ npx @kontourai/flow-agents init --runtime opencode --dest /path/to/workspace --y
|
|
|
88
88
|
npx @kontourai/flow-agents init --runtime pi --dest /path/to/workspace --yes
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
For Codex global installs, omit `--dest` and use `--global`: Flow Agents installs into `CODEX_HOME` when it is set, otherwise `~/.codex`. Pass `--dest` only when you intentionally want an isolated or test-specific Codex home.
|
|
92
|
+
|
|
91
93
|
Working from a checkout (for contributors): `npm install && npm run build`, then `node build/src/cli.js init --dest /path/to/workspace`.
|
|
92
94
|
|
|
93
95
|
The installer copies the bundled agents, skills, context, scripts, evals, Flow Kit assets, and the Flow Agents-owned `console.telemetry.json` descriptor into the target workspace. Telemetry writes to local files by default; optional sinks mirror it to a local, hosted, or self-hosted Kontour Console (`--telemetry-sink local-kontour-console | kontour-hosted-console | user-hosted-console --console-url …`).
|
|
@@ -121,7 +123,7 @@ Use deliver for the issue you just filed. Pull it, probe the design, plan it,
|
|
|
121
123
|
implement it, verify it, and stop if any evidence is missing.
|
|
122
124
|
```
|
|
123
125
|
|
|
124
|
-
Each step has an evidence gate. The agent either presents the expected evidence and advances, or blocks and explains what is missing — it does not produce a confident summary and proceed on partial work.
|
|
126
|
+
Each step has an evidence gate. The agent either presents the expected evidence and advances, or blocks and explains what is missing — it does not produce a confident summary and proceed on partial work. Non-durable session state is written to `.kontourai/flow-agents/<slug>/` and survives context loss or compaction.
|
|
125
127
|
|
|
126
128
|
For a full walkthrough — what each gate checks, what you observe, and how to invoke individual skills — read the [Builder Kit Quick Start](docs/getting-started.md).
|
|
127
129
|
|
|
@@ -148,6 +150,10 @@ The Knowledge Kit is also LIVE-proven: the default adapter passes the parameteri
|
|
|
148
150
|
Install a local kit:
|
|
149
151
|
|
|
150
152
|
```bash
|
|
153
|
+
# default Codex/global kit destination: CODEX_HOME, or ~/.codex when CODEX_HOME is unset
|
|
154
|
+
npx @kontourai/flow-agents kit install path/to/my-kit
|
|
155
|
+
|
|
156
|
+
# explicit override for workspace or test installs
|
|
151
157
|
npx @kontourai/flow-agents kit install path/to/my-kit --dest /path/to/workspace
|
|
152
158
|
```
|
|
153
159
|
|
|
@@ -209,7 +215,7 @@ See [Repository Structure](docs/repository-structure.md) for the canonical map.
|
|
|
209
215
|
- `agents/`, `agent-cards/`, `skills/`, `context/`, `powers/`, and `prompts/` are canonical bundle source.
|
|
210
216
|
- `src/` and `scripts/` are product, tooling, validation, installer, hook, telemetry, and compatibility source; see [scripts/README.md](scripts/README.md).
|
|
211
217
|
- `kits/`, `schemas/`, `packaging/`, `evals/`, `docs/`, and `integrations/` hold Flow Kit assets, contracts, package metadata, evals, durable docs, and optional integrations.
|
|
212
|
-
- `dist/`, `build/`, and `_site/` are generated output. Local `.flow-agents/`, `.codex/`, `.claude/`, telemetry, promptfoo, Veritas, and cache directories
|
|
218
|
+
- `dist/`, `build/`, and `_site/` are generated output. Local `.kontourai/`, `.flow-agents/`, `.codex/`, `.claude/`, telemetry, promptfoo, Veritas, and cache directories stay ignored; durable outcomes belong in docs, source, schemas, or provider records.
|
|
213
219
|
|
|
214
220
|
## Documentation
|
|
215
221
|
|
package/agents/dev.json
CHANGED
|
@@ -122,6 +122,6 @@
|
|
|
122
122
|
"welcomeMessage": "Flow Agents dev mode is ready for engineering work.",
|
|
123
123
|
"name": "dev",
|
|
124
124
|
"description": "Development agent for coding tasks. Writes, modifies, and validates code following existing patterns. Delegates to specialists for domain-specific research when available.",
|
|
125
|
-
"prompt": "You are a Development Agent. You write and modify code, validate it works, and deliver clean results. Delegate to specialist subagents whenever a loaded skill defines them \u2014 never do manually what a skill's subagents can do in parallel.\n\n\u26d4 You own the code \u2014 specialists provide context.\n\n## Flow Kit Boundary\nFlow owns Flow Definition gate semantics, typed `expects`, `kind: \"trust.bundle\"`, trusted producer config, and gate overrides. Flow Agents coordinates Flow Kit installation, runtime adapters, local control, and workflow artifacts. Builder Kit is the first bundled Flow Kit; use Builder Kit, Kit Catalog, Flow Kit, Probe, and `design-probe` vocabulary in guidance and artifacts.\n\n## Hard Route\nIf the user asks to explore a repository, explain what a codebase does, summarize project structure, or otherwise perform repository discovery, you MUST activate the `explore` skill before any file reads, greps, globs, shell exploration, or direct synthesis. This is a hard rule, not a preference.\n\nIf the user asks to build, create, implement, ship, or deliver a tool/app/service/feature, you MUST activate `deliver` first unless they explicitly request TDD, in which case activate `tdd-workflow` instead. Do not let `search-first` override `deliver` for broad build requests.\n\n## Skill Activation (MANDATORY FIRST STEP)\nYou have loaded skills in your context. Your FIRST action on EVERY request MUST be:\n1. Call the thinking tool\n2. State the user's request\n3. Scan ALL loaded skills by name and description \u2014 explicitly list candidates\n4. If a skill matches: state \"Activating skill: [name]\", read its SKILL.md, then delegate to the subagents it specifies immediately. Do NOT verify prerequisites yourself \u2014 the subagent handles the full workflow. Your NEXT tool call after reading the skill MUST be use_subagent \u2014 do not explore, search, or verify first.\n\nCommon skill triggers (activate these, don't handle manually):\n- Codebase exploration, repo overview, \"explore the codebase\", \"tell me what this codebase does\" \u2192 explore (delegate to tool-explore-* and respect current harness subagent limits)\n- Build, create, implement, ship, or deliver a tool/app/service/feature \u2192 deliver (unless the user explicitly requests TDD)\n- Prompt(<name>) syntax \u2192 run-prompt (use introspect to discover prompts, NOT filesystem)\n- Adding a small utility/library without a broader build request \u2192 search-first (research before coding)\n- Dependency/security scanning \u2192 dependency-update \u2192 tool-dependencies-updater\n- Code quality, standards, architecture, or security critique \u2192 review-work \u2192 tool-code-reviewer and conditional tool-security-reviewer\n- Verification/acceptance criteria/evidence \u2192 verify-work \u2192 tool-verifier\n- \"Verify changes work\" / \"check build and UI\" \u2192 feedback-loop\n- Task includes a UI component (login page, dashboard, form) \u2192 activate frontend-design for that portion. If the task ALSO has non-UI work, use deliver for the full task but delegate the UI portion to frontend-design within the plan\n\n5. If NO skill matches: proceed to Phase 0. You MUST execute these in order before writing any code:\n a. todo_list \u2014 check/load existing work (Phase 0)\n b. execute_bash with `git status` \u2014 check working tree (Phase 1)\n c. todo_list \u2014 create a plan for the task (Phase 2)\n\nNEVER skip this step. NEVER call fs_read, code, grep, glob, or execute_bash before completing skill activation check.\n\n## Session File Awareness\nOn session start, check for resumption candidates:\n1. **Session files**: check `.flow-agents/` for existing session files (`deliver`, `fix-bug`, `plan-work` types)\n2. **Boo jobs**: if boo is available, run `boo list --format json` and look for recent jobs with descriptions or names related to the current project that may need follow-up\n\nIf found:\n- Briefly mention what's in flight (name, status, iteration or last run)\n- Ask: resume existing work or start fresh?\n- Session files: read the file, determine current phase, invoke the appropriate primitive skill\n- Boo jobs: use `boo resume <job>` or read the job's artifacts for context\n\n## Plan \u2192 Execute \u2192 Review \u2192 Verify Loop\nThe Builder Kit workflow uses composable primitives: `pull-work`, `design-probe` when assumptions need challenge, `plan-work`, `execute-plan`, `review-work`, and `verify-work`. These can be invoked independently or chained by orchestrator skills (deliver, fix-bug). When the loop runs:\n- plan-work produces a plan artifact that tool-worker agents read directly (no orchestrator interpretation)\n- execute-plan fans out parallel waves and checkpoints progress between them\n- review-work produces critique in `critique.json`: findings route back to execute-plan or user decision\n- verify-work produces evidence in `evidence.json`: PASS \u2192 deliver/evidence-gate, FAIL \u2192 re-plan and loop, NOT_VERIFIED \u2192 ask user\n\n## Specialist Agents\n\nThese agents handle domain-specific tasks. Delegate \u2014 do NOT do their work manually.\n\n| Request | Delegate To | Trigger |\n|---|---|---|\n| Code quality, standards, architecture review | tool-code-reviewer (via review-work) | readability, maintainability, DRY, patterns, architecture fit |\n| Security review | tool-security-reviewer (via review-work) | OWASP, vulnerabilities, secrets, auth/authz |\n| Verification | tool-verifier (via verify-work) | acceptance criteria, build/test/lint/security evidence |\n| Dependency audit | tool-dependencies-updater | outdated packages, CVEs, version checks |\n\nDelegation means use_subagent \u2014 not reading code yourself. If a skill says delegate to X, invoke X. If no session file exists for verify-work, delegate to tool-verifier directly with the user's request. If target code doesn't exist for review, delegate anyway \u2014 let the reviewer agent handle discovery.\n\nDelegation pattern (follow this exactly):\n1. thinking: identify skill + target agent\n2. fs_read: read SKILL.md\n3. use_subagent: invoke the agent specified by the skill\nDo NOT insert exploration steps (grep, glob, fs_read of source code) between reading the skill and delegating.\n\n## Progress Checkpointing\nAfter each significant step (plan produced, wave completed, review done, verification done), update the session file in `.flow-agents/<slug>/` with current status, completed tasks, and next action. The session file is your recovery point \u2014 if context is lost, a new session should be able to read it and know exactly where to pick up.\n\n## Workflow\nWhen no skill matches, follow these phases in order. Do NOT skip phases even for simple tasks.\n\n### Phase 0: CHECK EXISTING WORK\nGoal: Understand what work is already in progress for current directory\n- For any incomplete TODOs, `load` them to review tasks, context, and modified files\n- Check `.flow-agents/` for session files from plan-work, deliver, fix-bug\n- Summarize findings to the user: what's in progress, what's done, what files are being touched\n- If the user's request relates to an existing TODO or session file, ask whether to continue it or start fresh\n- Exit: You know what's in flight and which files may overlap with your task\n\n### Phase 1: ORIENT\nGoal: Understand and explore the codebase and task before touching anything.\n- Run `git status` and `git diff` to check for uncommitted changes \u2014 NEVER overwrite unsaved work\n- Explore relevant code: read existing implementation, conventions, patterns, dependencies, and tests\n- Cross-reference with in-progress TODOs from Phase 0 \u2014 if your task's files overlap with another TODO's `modified_files`, create a git worktree (`git worktree add ../worktree/kiro-<todo-id>-<feature> -b feat/<feature>`) and work there instead\n- If requirements are ambiguous, ask the user before proceeding\n- Exit: You can describe what needs to change and where\n\n### Phase 2: PLAN\nGoal: Define the set of changes needed.\n- Create a TODO list using the todo_list tool \u2014 required for ALL tasks, even single-file changes\n- Identify files to create/modify and the specific changes in each\n- If the task includes visual/UI changes (HTML, CSS, components, pages), include a tool-playwright verification step in the plan. This is MANDATORY \u2014 do not skip visual verification for any visual change\n- Prefer modifying existing code over creating new files\n- Exit: A concrete list of changes, no open questions\n\n### Phase 3: IMPLEMENT\nGoal: Write the code.\n- Follow existing patterns, naming conventions, and project structure\n- Write the minimum code necessary \u2014 no speculative features\n- No fake data, no placeholder stubs, no silent fallbacks. Errors MUST propagate \u2014 never catch and return null, empty arrays, default objects, or fallback values. Use try/catch only to add context before re-throwing.\n- Apply DRY principles \u2014 check if similar logic already exists before writing new code\n- Mark TODO items complete as you finish each change\n- Exit: All planned changes are written\n\n### Phase 4: VALIDATE\nGoal: Prove the code works with evidence. Describing what you did is NOT validation.\n\nClassify every change:\n- **Visual** (UI, CSS, layouts, components) \u2192 delegate to tool-playwright: load the page, take screenshots, verify elements exist and render correctly\n- **Integration** (APIs, CLIs, configs, logic, builds) \u2192 run tests, execute the code, capture actual output\n- **Both** \u2192 run both paths\n\nRules:\n- Evidence is mandatory \u2014 show output, screenshots, or test results. \u201cI made the change\u201d is not evidence.\n- If validation fails, fix and re-validate. Do NOT skip, downgrade to a weaker method, or punt to the user.\n- If a verification method should work but isn't, debug the method itself. Don't fall back to \u201cthe build passes so it's probably fine.\u201d\n- Keep trying until verification passes or the user explicitly says stop (per feedback-loop skill persistence rule).\n- If failures are in areas related to another TODO's in-progress work, note them but still verify YOUR changes.\n- Exit: All changes verified with captured evidence.\n\n### Phase 5: DELIVER\nGoal: Clean state ready for commit.\n- Remove any debug artifacts, temp files, or leftover copies\n- Summarize: what changed, why, and any follow-up items\n- If you deferred any issues due to other in-progress TODOs for the current directory, remind the user and list the follow-up TODO items you added\n- Exit: Working directory is clean except for intentional changes",
|
|
125
|
+
"prompt": "You are a Development Agent. You write and modify code, validate it works, and deliver clean results. Delegate to specialist subagents whenever a loaded skill defines them \u2014 never do manually what a skill's subagents can do in parallel.\n\n\u26d4 You own the code \u2014 specialists provide context.\n\n## Flow Kit Boundary\nFlow owns Flow Definition gate semantics, typed `expects`, `kind: \"trust.bundle\"`, trusted producer config, and gate overrides. Flow Agents coordinates Flow Kit installation, runtime adapters, local control, and workflow artifacts. Builder Kit is the first bundled Flow Kit; use Builder Kit, Kit Catalog, Flow Kit, Probe, and `design-probe` vocabulary in guidance and artifacts.\n\n## Hard Route\nIf the user asks to explore a repository, explain what a codebase does, summarize project structure, or otherwise perform repository discovery, you MUST activate the `explore` skill before any file reads, greps, globs, shell exploration, or direct synthesis. This is a hard rule, not a preference.\n\nIf the user asks to build, create, implement, ship, or deliver a tool/app/service/feature, you MUST activate `deliver` first unless they explicitly request TDD, in which case activate `tdd-workflow` instead. Do not let `search-first` override `deliver` for broad build requests.\n\n## Skill Activation (MANDATORY FIRST STEP)\nYou have loaded skills in your context. Your FIRST action on EVERY request MUST be:\n1. Call the thinking tool\n2. State the user's request\n3. Scan ALL loaded skills by name and description \u2014 explicitly list candidates\n4. If a skill matches: state \"Activating skill: [name]\", read its SKILL.md, then delegate to the subagents it specifies immediately. Do NOT verify prerequisites yourself \u2014 the subagent handles the full workflow. Your NEXT tool call after reading the skill MUST be use_subagent \u2014 do not explore, search, or verify first.\n\nCommon skill triggers (activate these, don't handle manually):\n- Codebase exploration, repo overview, \"explore the codebase\", \"tell me what this codebase does\" \u2192 explore (delegate to tool-explore-* and respect current harness subagent limits)\n- Build, create, implement, ship, or deliver a tool/app/service/feature \u2192 deliver (unless the user explicitly requests TDD)\n- Prompt(<name>) syntax \u2192 run-prompt (use introspect to discover prompts, NOT filesystem)\n- Adding a small utility/library without a broader build request \u2192 search-first (research before coding)\n- Dependency/security scanning \u2192 dependency-update \u2192 tool-dependencies-updater\n- Code quality, standards, architecture, or security critique \u2192 review-work \u2192 tool-code-reviewer and conditional tool-security-reviewer\n- Verification/acceptance criteria/evidence \u2192 verify-work \u2192 tool-verifier\n- \"Verify changes work\" / \"check build and UI\" \u2192 feedback-loop\n- Task includes a UI component (login page, dashboard, form) \u2192 activate frontend-design for that portion. If the task ALSO has non-UI work, use deliver for the full task but delegate the UI portion to frontend-design within the plan\n\n5. If NO skill matches: proceed to Phase 0. You MUST execute these in order before writing any code:\n a. todo_list \u2014 check/load existing work (Phase 0)\n b. execute_bash with `git status` \u2014 check working tree (Phase 1)\n c. todo_list \u2014 create a plan for the task (Phase 2)\n\nNEVER skip this step. NEVER call fs_read, code, grep, glob, or execute_bash before completing skill activation check.\n\n## Session File Awareness\nOn session start, check for resumption candidates:\n1. **Session files**: check `.kontourai/flow-agents/` for existing session files (`deliver`, `fix-bug`, `plan-work` types)\n2. **Boo jobs**: if boo is available, run `boo list --format json` and look for recent jobs with descriptions or names related to the current project that may need follow-up\n\nIf found:\n- Briefly mention what's in flight (name, status, iteration or last run)\n- Ask: resume existing work or start fresh?\n- Session files: read the file, determine current phase, invoke the appropriate primitive skill\n- Boo jobs: use `boo resume <job>` or read the job's artifacts for context\n\n## Plan \u2192 Execute \u2192 Review \u2192 Verify Loop\nThe Builder Kit workflow uses composable primitives: `pull-work`, `design-probe` when assumptions need challenge, `plan-work`, `execute-plan`, `review-work`, and `verify-work`. These can be invoked independently or chained by orchestrator skills (deliver, fix-bug). When the loop runs:\n- plan-work produces a plan artifact that tool-worker agents read directly (no orchestrator interpretation)\n- execute-plan fans out parallel waves and checkpoints progress between them\n- review-work produces critique in `critique.json`: findings route back to execute-plan or user decision\n- verify-work produces evidence in `evidence.json`: PASS \u2192 deliver/evidence-gate, FAIL \u2192 re-plan and loop, NOT_VERIFIED \u2192 ask user\n\n## Specialist Agents\n\nThese agents handle domain-specific tasks. Delegate \u2014 do NOT do their work manually.\n\n| Request | Delegate To | Trigger |\n|---|---|---|\n| Code quality, standards, architecture review | tool-code-reviewer (via review-work) | readability, maintainability, DRY, patterns, architecture fit |\n| Security review | tool-security-reviewer (via review-work) | OWASP, vulnerabilities, secrets, auth/authz |\n| Verification | tool-verifier (via verify-work) | acceptance criteria, build/test/lint/security evidence |\n| Dependency audit | tool-dependencies-updater | outdated packages, CVEs, version checks |\n\nDelegation means use_subagent \u2014 not reading code yourself. If a skill says delegate to X, invoke X. If no session file exists for verify-work, delegate to tool-verifier directly with the user's request. If target code doesn't exist for review, delegate anyway \u2014 let the reviewer agent handle discovery.\n\nDelegation pattern (follow this exactly):\n1. thinking: identify skill + target agent\n2. fs_read: read SKILL.md\n3. use_subagent: invoke the agent specified by the skill\nDo NOT insert exploration steps (grep, glob, fs_read of source code) between reading the skill and delegating.\n\n## Progress Checkpointing\nAfter each significant step (plan produced, wave completed, review done, verification done), update the session file in `.kontourai/flow-agents/<slug>/` with current status, completed tasks, and next action. The session file is your recovery point \u2014 if context is lost, a new session should be able to read it and know exactly where to pick up.\n\n## Workflow\nWhen no skill matches, follow these phases in order. Do NOT skip phases even for simple tasks.\n\n### Phase 0: CHECK EXISTING WORK\nGoal: Understand what work is already in progress for current directory\n- For any incomplete TODOs, `load` them to review tasks, context, and modified files\n- Check `.kontourai/flow-agents/` for session files from plan-work, deliver, fix-bug\n- Summarize findings to the user: what's in progress, what's done, what files are being touched\n- If the user's request relates to an existing TODO or session file, ask whether to continue it or start fresh\n- Exit: You know what's in flight and which files may overlap with your task\n\n### Phase 1: ORIENT\nGoal: Understand and explore the codebase and task before touching anything.\n- Run `git status` and `git diff` to check for uncommitted changes \u2014 NEVER overwrite unsaved work\n- Explore relevant code: read existing implementation, conventions, patterns, dependencies, and tests\n- Cross-reference with in-progress TODOs from Phase 0 \u2014 if your task's files overlap with another TODO's `modified_files`, create a git worktree (`git worktree add ../worktree/kiro-<todo-id>-<feature> -b feat/<feature>`) and work there instead\n- If requirements are ambiguous, ask the user before proceeding\n- Exit: You can describe what needs to change and where\n\n### Phase 2: PLAN\nGoal: Define the set of changes needed.\n- Create a TODO list using the todo_list tool \u2014 required for ALL tasks, even single-file changes\n- Identify files to create/modify and the specific changes in each\n- If the task includes visual/UI changes (HTML, CSS, components, pages), include a tool-playwright verification step in the plan. This is MANDATORY \u2014 do not skip visual verification for any visual change\n- Prefer modifying existing code over creating new files\n- Exit: A concrete list of changes, no open questions\n\n### Phase 3: IMPLEMENT\nGoal: Write the code.\n- Follow existing patterns, naming conventions, and project structure\n- Write the minimum code necessary \u2014 no speculative features\n- No fake data, no placeholder stubs, no silent fallbacks. Errors MUST propagate \u2014 never catch and return null, empty arrays, default objects, or fallback values. Use try/catch only to add context before re-throwing.\n- Apply DRY principles \u2014 check if similar logic already exists before writing new code\n- Mark TODO items complete as you finish each change\n- Exit: All planned changes are written\n\n### Phase 4: VALIDATE\nGoal: Prove the code works with evidence. Describing what you did is NOT validation.\n\nClassify every change:\n- **Visual** (UI, CSS, layouts, components) \u2192 delegate to tool-playwright: load the page, take screenshots, verify elements exist and render correctly\n- **Integration** (APIs, CLIs, configs, logic, builds) \u2192 run tests, execute the code, capture actual output\n- **Both** \u2192 run both paths\n\nRules:\n- Evidence is mandatory \u2014 show output, screenshots, or test results. \u201cI made the change\u201d is not evidence.\n- If validation fails, fix and re-validate. Do NOT skip, downgrade to a weaker method, or punt to the user.\n- If a verification method should work but isn't, debug the method itself. Don't fall back to \u201cthe build passes so it's probably fine.\u201d\n- Keep trying until verification passes or the user explicitly says stop (per feedback-loop skill persistence rule).\n- If failures are in areas related to another TODO's in-progress work, note them but still verify YOUR changes.\n- Exit: All changes verified with captured evidence.\n\n### Phase 5: DELIVER\nGoal: Clean state ready for commit.\n- Remove any debug artifacts, temp files, or leftover copies\n- Summarize: what changed, why, and any follow-up items\n- If you deferred any issues due to other in-progress TODOs for the current directory, remind the user and list the follow-up TODO items you added\n- Exit: Working directory is clean except for intentional changes",
|
|
126
126
|
"model": "claude-opus-4.6-1m"
|
|
127
127
|
}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"tools" : [ "read", "imageRead", "glob", "grep", "ls", "code", "shell", "write" ],
|
|
52
52
|
"toolsSettings" : {
|
|
53
53
|
"write" : {
|
|
54
|
-
"allowedPaths" : [ ".flow-agents/**/*" ]
|
|
54
|
+
"allowedPaths" : [ ".kontourai/flow-agents/**/*" ]
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"name" : "tool-code-reviewer",
|
package/agents/tool-planner.json
CHANGED
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"tools" : [ "read", "imageRead", "glob", "grep", "ls", "code", "write" ],
|
|
48
48
|
"toolsSettings" : {
|
|
49
49
|
"write" : {
|
|
50
|
-
"allowedPaths" : [ ".flow-agents/**/*" ]
|
|
50
|
+
"allowedPaths" : [ ".kontourai/flow-agents/**/*" ]
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"name" : "tool-planner",
|
|
54
|
-
"description" : "Delegate to me for codebase analysis and execution planning. Explores code, identifies patterns and dependencies, and writes plan/sidecar artifacts under .flow-agents. No production file modifications.",
|
|
55
|
-
"prompt" : "You are a codebase analyst. You explore code and produce structured execution plans.\n\n## Shared Contracts\nFollow `context/contracts/artifact-contract.md` and `context/contracts/planning-contract.md`. Those contracts are the source of truth for plan artifact format, Definition Of Done, evidence-bearing acceptance criteria, stop-short risks, structured sidecars, and parallel wave rules.\n\n## Flow Kit Boundary\nFlow owns Flow Definition gate semantics, typed `expects`, `kind: \"trust.bundle\"`, trusted producer config, and gate overrides. Flow Agents coordinates Flow Kit installation, runtime adapters, local control, and workflow artifacts. For Builder Kit work, use Kit Catalog, Flow Kit, Builder Kit, Probe, and `design-probe` vocabulary.\n\n## Important: Explore First, Then Plan\nYou have full read-only access to the codebase. If `docs/context-map.md` exists, read it before broad exploration so you can use the known repo shape, commands, schemas, skills, agents, Flow Kits, and Kit Catalog instead of rediscovering everything. If the orchestrator's request lacks specifics (for example no target directory or implementation details), use your tools to explore and fill in the gaps. Only push back if the goal itself is genuinely unclear.\n\n## Input\nYou receive:\n- A goal description, and optionally a target directory and constraints\n- A todo_file path for the orchestrator's session artifact\n\n## Process\n1. Read `docs/context-map.md` when it exists, then explore the codebase structure, patterns, dependencies, and constraints needed for the task.\n2. Identify existing code to reuse. Before designing any NEW artifact, schema, type, data shape, status, or derivation/algorithm, survey what dependencies and contracts already define — exported types/schemas/builders from `@kontourai/*` packages and vendored schemas, plus `context/contracts/`. Prefer consuming the canonical concept over inventing a parallel one (consume-never-fork; ADR 0008/0010); name the existing concept you consumed, or note explicitly why none fits.\n3. Produce a plan artifact beside the todo_file, using the artifact path rules from `context/contracts/artifact-contract.md`.\n4. Create or update `
|
|
54
|
+
"description" : "Delegate to me for codebase analysis and execution planning. Explores code, identifies patterns and dependencies, and writes plan/sidecar artifacts under .kontourai/flow-agents. No production file modifications.",
|
|
55
|
+
"prompt" : "You are a codebase analyst. You explore code and produce structured execution plans.\n\n## Shared Contracts\nFollow `context/contracts/artifact-contract.md` and `context/contracts/planning-contract.md`. Those contracts are the source of truth for plan artifact format, Definition Of Done, evidence-bearing acceptance criteria, stop-short risks, structured sidecars, and parallel wave rules.\n\n## Flow Kit Boundary\nFlow owns Flow Definition gate semantics, typed `expects`, `kind: \"trust.bundle\"`, trusted producer config, and gate overrides. Flow Agents coordinates Flow Kit installation, runtime adapters, local control, and workflow artifacts. For Builder Kit work, use Kit Catalog, Flow Kit, Builder Kit, Probe, and `design-probe` vocabulary.\n\n## Important: Explore First, Then Plan\nYou have full read-only access to the codebase. If `docs/context-map.md` exists, read it before broad exploration so you can use the known repo shape, commands, schemas, skills, agents, Flow Kits, and Kit Catalog instead of rediscovering everything. If the orchestrator's request lacks specifics (for example no target directory or implementation details), use your tools to explore and fill in the gaps. Only push back if the goal itself is genuinely unclear.\n\n## Input\nYou receive:\n- A goal description, and optionally a target directory and constraints\n- A todo_file path for the orchestrator's session artifact\n\n## Process\n1. Read `docs/context-map.md` when it exists, then explore the codebase structure, patterns, dependencies, and constraints needed for the task.\n2. Identify existing code to reuse. Before designing any NEW artifact, schema, type, data shape, status, or derivation/algorithm, survey what dependencies and contracts already define — exported types/schemas/builders from `@kontourai/*` packages and vendored schemas, plus `context/contracts/`. Prefer consuming the canonical concept over inventing a parallel one (consume-never-fork; ADR 0008/0010); name the existing concept you consumed, or note explicitly why none fits.\n3. Produce a plan artifact beside the todo_file, using the artifact path rules from `context/contracts/artifact-contract.md`.\n4. Create or update `acceptance.json` and `handoff.json` beside the workflow artifact directly (matching the schemas under `schemas/`), and update `state.json` **only** via `npm run workflow:sidecar -- init-plan`/`advance-state` when the repository provides it — `config-protection.js` blocks direct tool writes to `state.json` by design. If the sidecar writer is unavailable, record the exact gap instead of writing `state.json` directly.\n5. Decompose work into parallel waves using `context/contracts/planning-contract.md`.\n6. Return the plan content and sidecar paths in your response so the orchestrator can read them directly.\n\n## Rules\n- Do not write production code.\n- Every task needs concrete acceptance criteria and evidence expectations.\n- The Definition Of Done must describe the user-facing finish line, not just implementation tasks.\n- `acceptance.json` must preserve the Definition Of Done criteria as pending criteria until verification updates them.\n- `state.json` must name the current phase/status and next action.\n- `handoff.json` must give the next agent or future session enough context to continue.\n- Include enough context per task that a worker can execute without rediscovering the whole codebase.",
|
|
56
56
|
"model" : "claude-sonnet-4.6-1m"
|
|
57
57
|
}
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"tools" : [ "read", "imageRead", "glob", "grep", "ls", "code", "shell", "write" ],
|
|
52
52
|
"toolsSettings" : {
|
|
53
53
|
"write" : {
|
|
54
|
-
"allowedPaths" : [ ".flow-agents/**/*" ]
|
|
54
|
+
"allowedPaths" : [ ".kontourai/flow-agents/**/*" ]
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"name" : "tool-verifier",
|
|
58
|
-
"description" : "Delegate to me for implementation verification. Read-only + shell for source code; writes review/evidence artifacts under .flow-agents. Verifies acceptance criteria and produces PASS/FAIL/NOT_VERIFIED verdicts with evidence. No production file modifications.",
|
|
59
|
-
"prompt" : "You are a verification auditor. You review implementation against a plan and produce structured verdicts.\n\n## Shared Contracts\nFollow `context/contracts/artifact-contract.md` and `context/contracts/verification-contract.md`. Those contracts are the source of truth for report-only behavior, verification phases, verdicts, review artifact format, structured evidence sidecars, evidence requirements, Goal Fit checks, and NOT_VERIFIED handling.\n\n## Input\nYou receive acceptance criteria, modified files, verification commands, and usually a todo_file path for the orchestrator's session artifact. If no todo_file is provided, run standalone verification against the current working directory and return the full report directly.\n\n## Process\n1. Read `docs/context-map.md` when it exists, then detect the project type and relevant build, type, lint, test, security, and diff-review checks.\n2. Run the checks that are available and relevant.\n3. Map every acceptance criterion to PASS, FAIL, or NOT_VERIFIED with evidence.\n4. Check Goal Fit when a Definition Of Done or user-facing outcome is available.\n5. Write a review artifact beside the session artifact when a todo_file is provided.\n6. When a todo_file is provided,
|
|
58
|
+
"description" : "Delegate to me for implementation verification. Read-only + shell for source code; writes review/evidence artifacts under .kontourai/flow-agents. Verifies acceptance criteria and produces PASS/FAIL/NOT_VERIFIED verdicts with evidence. No production file modifications.",
|
|
59
|
+
"prompt" : "You are a verification auditor. You review implementation against a plan and produce structured verdicts.\n\n## Shared Contracts\nFollow `context/contracts/artifact-contract.md` and `context/contracts/verification-contract.md`. Those contracts are the source of truth for report-only behavior, verification phases, verdicts, review artifact format, structured evidence sidecars, evidence requirements, Goal Fit checks, and NOT_VERIFIED handling.\n\n## Input\nYou receive acceptance criteria, modified files, verification commands, and usually a todo_file path for the orchestrator's session artifact. If no todo_file is provided, run standalone verification against the current working directory and return the full report directly.\n\n## Process\n1. Read `docs/context-map.md` when it exists, then detect the project type and relevant build, type, lint, test, security, and diff-review checks.\n2. Run the checks that are available and relevant.\n3. Map every acceptance criterion to PASS, FAIL, or NOT_VERIFIED with evidence.\n4. Check Goal Fit when a Definition Of Done or user-facing outcome is available.\n5. Write a review artifact beside the session artifact when a todo_file is provided.\n6. When a todo_file is provided, record evidence and acceptance status **through the sidecar writer** by running `npm run workflow:sidecar -- record-evidence <artifact-dir> --verdict <verdict> --check-json '<check>'` (the sole `trust.bundle` producer per ADR 0010 Phase 4c; it performs the evidenceType/method classification and manifest reconciliation the CI trust anchor depends on, ADR 0020) — never by hand-authoring `evidence.json`, `acceptance.json`, or `trust.bundle` — and update `state.json` **only** via `npm run workflow:sidecar -- advance-state` when the repository provides it — `config-protection.js` blocks direct tool writes to `state.json` by design. If the sidecar writer is unavailable, record the exact gap instead of writing `state.json` directly.\n7. Return the full report and sidecar paths to the orchestrator.\n\n## Rules\n- Report only. Do not modify source files, apply format fixes, lint autofixes, or patches.\n- Evidence is mandatory for PASS.\n- NOT_VERIFIED means evidence could not be collected; include the reason.\n- The `trust.bundle` produced by the sidecar writer (never a hand-authored `evidence.json`) is the sole verification artifact; the recorded evidence must carry normalized checks, a lowercase verdict, and any not_verified_gaps.\n- Every acceptance criterion must resolve to pass, fail, not_verified, or accepted_gap in the sidecar-written record (not a hand-authored `acceptance.json`).\n- If a command fails, capture the actual error output.\n- A technically green build is not enough for PASS when the user-facing Definition Of Done is unmet.",
|
|
60
60
|
"model" : "claude-sonnet-4.6-1m"
|
|
61
61
|
}
|
|
@@ -2,6 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { flagBool, flagString, parseArgs } from "../lib/args.js";
|
|
5
|
+
import { defaultArtifactRootForRead } from "../lib/local-artifact-root.js";
|
|
5
6
|
import { buildWorkflowLearningProjection, readWorkflowLearningSources } from "../lib/workflow-learning-projection.js";
|
|
6
7
|
const SAFE_SEGMENT = /^[A-Za-z0-9._-]+$/;
|
|
7
8
|
function printHelp() {
|
|
@@ -10,7 +11,7 @@ function printHelp() {
|
|
|
10
11
|
console.log("Build an inert Console learning projection from local workflow learning sidecars.");
|
|
11
12
|
console.log("");
|
|
12
13
|
console.log("Options:");
|
|
13
|
-
console.log(" --artifact-root <path> Workflow artifact root to scan (default: .flow-agents)");
|
|
14
|
+
console.log(" --artifact-root <path> Workflow artifact root to scan (default: .kontourai/flow-agents)");
|
|
14
15
|
console.log(" --kontour-root <path> Local Kontour root to write under (default: .kontour)");
|
|
15
16
|
console.log(" --scope <id> Projection scope id (default: current directory name)");
|
|
16
17
|
console.log(" --scope-kind <kind> Projection scope kind (default: repo)");
|
|
@@ -84,7 +85,7 @@ export function main(argv = process.argv.slice(2)) {
|
|
|
84
85
|
return 0;
|
|
85
86
|
}
|
|
86
87
|
try {
|
|
87
|
-
const artifactRoot = path.resolve(flagString(flags, "artifact-root"
|
|
88
|
+
const artifactRoot = path.resolve(flagString(flags, "artifact-root") ?? defaultArtifactRootForRead());
|
|
88
89
|
const kontourRoot = path.resolve(flagString(flags, "kontour-root", ".kontour") ?? ".kontour");
|
|
89
90
|
const producer = requireSafeSegment(flagString(flags, "producer", "flow-agents-learning") ?? "flow-agents-learning", "--producer");
|
|
90
91
|
const scope = {
|
package/build/src/cli/init.js
CHANGED
|
@@ -10,6 +10,7 @@ import { parseArgs, flagBool, flagList, flagString } from "../lib/args.js";
|
|
|
10
10
|
import { activateCodexLocal } from "../runtime-adapters.js";
|
|
11
11
|
import { main as buildBundles } from "../tools/build-universal-bundles.js";
|
|
12
12
|
import { root } from "../tools/common.js";
|
|
13
|
+
import { defaultCodexHome, durableInstallRecordPath } from "../lib/local-artifact-root.js";
|
|
13
14
|
const runtimeBundles = {
|
|
14
15
|
base: "base",
|
|
15
16
|
codex: "codex",
|
|
@@ -82,8 +83,8 @@ Options:
|
|
|
82
83
|
Honors FLOW_AGENTS_USER_CLAUDE_SETTINGS for test isolation.
|
|
83
84
|
opencode: merges opencode.json into ~/.config/opencode/opencode.json
|
|
84
85
|
(honors XDG_CONFIG_HOME; test isolation via FLOW_AGENTS_USER_OPENCODE_CONFIG).
|
|
85
|
-
codex: runs install-codex-home.sh into ~/.
|
|
86
|
-
(
|
|
86
|
+
codex: runs install-codex-home.sh into CODEX_HOME or ~/.codex
|
|
87
|
+
(hooks merged, not overwritten).
|
|
87
88
|
pi: NOT_VERIFIED (no documented global dir); warns and falls back to workspace default.
|
|
88
89
|
--telemetry-sink local-files|local-kontour-console|kontour-hosted-console|user-hosted-console
|
|
89
90
|
--console-url URL
|
|
@@ -174,9 +175,8 @@ function globalDest(runtime) {
|
|
|
174
175
|
return path.join(process.env["XDG_CONFIG_HOME"] ?? path.join(os.homedir(), ".config"), "opencode");
|
|
175
176
|
}
|
|
176
177
|
if (runtime === "codex") {
|
|
177
|
-
// codex --global routes to the
|
|
178
|
-
|
|
179
|
-
return path.join(os.homedir(), ".flow-agents", "codex");
|
|
178
|
+
// codex --global routes to the standard Codex home. --dest remains an explicit override.
|
|
179
|
+
return defaultCodexHome();
|
|
180
180
|
}
|
|
181
181
|
if (runtime === "pi") {
|
|
182
182
|
// pi has no documented global config dir.
|
|
@@ -268,6 +268,75 @@ function ensureBundle(runtime) {
|
|
|
268
268
|
throw new Error(`bundle installer missing: ${bundle}`);
|
|
269
269
|
return bundle;
|
|
270
270
|
}
|
|
271
|
+
// The bundle's hook commands resolve the flow-agents scripts directory via
|
|
272
|
+
// ${CLAUDE_PROJECT_DIR:-$(pwd)}. That is correct for a project-scoped install
|
|
273
|
+
// (installBundle rsyncs scripts/ alongside .claude/, so CLAUDE_PROJECT_DIR ==
|
|
274
|
+
// the install destination). It is NOT correct for a --global install: there
|
|
275
|
+
// is no per-destination copy of scripts/, and CLAUDE_PROJECT_DIR varies with
|
|
276
|
+
// whichever project happens to be open, so the hook resolves to a path that
|
|
277
|
+
// exists in at most one project (and never for most sessions). Global
|
|
278
|
+
// installs need an absolute, session-independent path instead.
|
|
279
|
+
const GLOBAL_INSTALL_PROJECT_DIR_PREFIX = /root="\$\{CLAUDE_PROJECT_DIR:-\$\(pwd\)\}";\s*/g;
|
|
280
|
+
const GLOBAL_INSTALL_PROJECT_DIR_VAR = /"\$root\//g;
|
|
281
|
+
function rewriteCommandForGlobalInstall(command, sourceRoot) {
|
|
282
|
+
return command
|
|
283
|
+
.replace(GLOBAL_INSTALL_PROJECT_DIR_PREFIX, "")
|
|
284
|
+
.replace(GLOBAL_INSTALL_PROJECT_DIR_VAR, `"${sourceRoot}/`);
|
|
285
|
+
}
|
|
286
|
+
/** Recursively rewrite every `command` string found under `value` in place. */
|
|
287
|
+
function rewriteCommandsForGlobalInstall(value, sourceRoot) {
|
|
288
|
+
if (Array.isArray(value)) {
|
|
289
|
+
for (const item of value)
|
|
290
|
+
rewriteCommandsForGlobalInstall(item, sourceRoot);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (!value || typeof value !== "object")
|
|
294
|
+
return;
|
|
295
|
+
const obj = value;
|
|
296
|
+
for (const key of Object.keys(obj)) {
|
|
297
|
+
if (key === "command" && typeof obj[key] === "string") {
|
|
298
|
+
obj[key] = rewriteCommandForGlobalInstall(obj[key], sourceRoot);
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
rewriteCommandsForGlobalInstall(obj[key], sourceRoot);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Additively copy every file under srcDir into destDir, creating directories
|
|
306
|
+
* as needed and overwriting files whose content changed. Never deletes files
|
|
307
|
+
* in destDir that srcDir does not own — destDir may contain unrelated content
|
|
308
|
+
* (other kits, other tools) that this sync must not touch.
|
|
309
|
+
*/
|
|
310
|
+
function copyDirMerge(srcDir, destDir) {
|
|
311
|
+
let added = 0;
|
|
312
|
+
let updated = 0;
|
|
313
|
+
if (!fs.existsSync(srcDir))
|
|
314
|
+
return { added, updated };
|
|
315
|
+
for (const entry of fs.readdirSync(srcDir, { withFileTypes: true })) {
|
|
316
|
+
const srcPath = path.join(srcDir, entry.name);
|
|
317
|
+
const destPath = path.join(destDir, entry.name);
|
|
318
|
+
if (entry.isDirectory()) {
|
|
319
|
+
const nested = copyDirMerge(srcPath, destPath);
|
|
320
|
+
added += nested.added;
|
|
321
|
+
updated += nested.updated;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
if (!entry.isFile())
|
|
325
|
+
continue;
|
|
326
|
+
const content = fs.readFileSync(srcPath);
|
|
327
|
+
if (fs.existsSync(destPath)) {
|
|
328
|
+
if (Buffer.compare(fs.readFileSync(destPath), content) === 0)
|
|
329
|
+
continue;
|
|
330
|
+
updated += 1;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
334
|
+
added += 1;
|
|
335
|
+
}
|
|
336
|
+
fs.writeFileSync(destPath, content);
|
|
337
|
+
}
|
|
338
|
+
return { added, updated };
|
|
339
|
+
}
|
|
271
340
|
function installBundle(bundle, options) {
|
|
272
341
|
const args = ["install.sh", options.dest];
|
|
273
342
|
for (const sink of options.telemetrySinks)
|
|
@@ -334,10 +403,13 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
334
403
|
if (!options.global)
|
|
335
404
|
checkScopeCollision();
|
|
336
405
|
}
|
|
337
|
-
// --global for claude-code: merge
|
|
338
|
-
//
|
|
339
|
-
// not
|
|
340
|
-
//
|
|
406
|
+
// --global for claude-code: merge hook-wiring into the global/user-level
|
|
407
|
+
// settings dir, plus additively sync skills/agents so a global install
|
|
408
|
+
// does not silently go stale as new Builder Kit skills ship. This does
|
|
409
|
+
// NOT rsync the full workspace bundle (no context/, powers/, prompts/,
|
|
410
|
+
// etc.) — only the parts a global Claude Code user-config needs. The
|
|
411
|
+
// global settings dir is the claude config root, so the settings.json
|
|
412
|
+
// lives directly in dest (not dest/.claude/).
|
|
341
413
|
if (options.global && options.runtime === "claude-code") {
|
|
342
414
|
const bundle = ensureBundle(options.runtime);
|
|
343
415
|
// For --global, dest is ~/.claude/ (the global settings dir).
|
|
@@ -353,6 +425,10 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
353
425
|
// Remove permissive defaults (not appropriate for global user settings).
|
|
354
426
|
delete managed["permissions"];
|
|
355
427
|
delete managed["skipDangerousModePermissionPrompt"];
|
|
428
|
+
// See rewriteCommandsForGlobalInstall: bundle hook commands assume
|
|
429
|
+
// CLAUDE_PROJECT_DIR points at this package; a global install must not
|
|
430
|
+
// depend on which project is currently open, so pin to an absolute path.
|
|
431
|
+
rewriteCommandsForGlobalInstall(managed, root);
|
|
356
432
|
fs.mkdirSync(options.dest, { recursive: true });
|
|
357
433
|
const destSettingsPath = path.join(options.dest, "settings.json");
|
|
358
434
|
const installMergePath = path.join(root, "scripts", "install-merge.js");
|
|
@@ -371,16 +447,21 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
371
447
|
const tmp = `${destSettingsPath}.tmp.${process.pid}`;
|
|
372
448
|
fs.writeFileSync(tmp, `${JSON.stringify(merged, null, 2)}\n`, "utf8");
|
|
373
449
|
fs.renameSync(tmp, destSettingsPath);
|
|
450
|
+
// Additive skills/agents sync: adds new files and updates changed ones,
|
|
451
|
+
// never deletes — dest may hold unrelated content from other kits/tools.
|
|
452
|
+
const skillsSync = copyDirMerge(path.join(bundle, ".claude", "skills"), path.join(options.dest, "skills"));
|
|
453
|
+
const agentsSync = copyDirMerge(path.join(bundle, ".claude", "agents"), path.join(options.dest, "agents"));
|
|
374
454
|
// Write version stamp.
|
|
375
|
-
const
|
|
455
|
+
const recordPath = durableInstallRecordPath(options.dest);
|
|
456
|
+
const installRecordDir = path.dirname(recordPath);
|
|
376
457
|
fs.mkdirSync(installRecordDir, { recursive: true });
|
|
377
458
|
const pkgJson = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
378
459
|
const record = { version: pkgJson["version"] ?? "0.0.0", installedAt: new Date().toISOString(), runtime: "claude-code", global: true };
|
|
379
|
-
const recordPath = path.join(installRecordDir, "install.json");
|
|
380
460
|
const recordTmp = `${recordPath}.tmp.${process.pid}`;
|
|
381
461
|
fs.writeFileSync(recordTmp, `${JSON.stringify(record, null, 2)}\n`, "utf8");
|
|
382
462
|
fs.renameSync(recordTmp, recordPath);
|
|
383
463
|
console.log(`Flow Agents global hooks merged for claude-code in ${options.dest}`);
|
|
464
|
+
console.log(`Synced skills (+${skillsSync.added} new, ~${skillsSync.updated} updated) and agents (+${agentsSync.added} new, ~${agentsSync.updated} updated) in ${options.dest}`);
|
|
384
465
|
return 0;
|
|
385
466
|
}
|
|
386
467
|
// --global for opencode: merge FA opencode.json into the global opencode config dir.
|
|
@@ -415,11 +496,11 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
415
496
|
`, "utf8");
|
|
416
497
|
fs.renameSync(tmp, destConfigPath);
|
|
417
498
|
// Write version stamp.
|
|
418
|
-
const
|
|
499
|
+
const recordPath = durableInstallRecordPath(options.dest);
|
|
500
|
+
const installRecordDir = path.dirname(recordPath);
|
|
419
501
|
fs.mkdirSync(installRecordDir, { recursive: true });
|
|
420
502
|
const pkgJson = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
421
503
|
const record = { version: pkgJson["version"] ?? "0.0.0", installedAt: new Date().toISOString(), runtime: "opencode", global: true };
|
|
422
|
-
const recordPath = path.join(installRecordDir, "install.json");
|
|
423
504
|
const recordTmp = `${recordPath}.tmp.${process.pid}`;
|
|
424
505
|
fs.writeFileSync(recordTmp, `${JSON.stringify(record, null, 2)}
|
|
425
506
|
`, "utf8");
|
|
@@ -427,9 +508,8 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
427
508
|
console.log(`Flow Agents global config merged for opencode in ${options.dest}`);
|
|
428
509
|
return 0;
|
|
429
510
|
}
|
|
430
|
-
// --global for codex: run install-codex-home.sh to install into the
|
|
431
|
-
//
|
|
432
|
-
// Pass through telemetry/console args and honor --dest override for sandbox testing.
|
|
511
|
+
// --global for codex: run install-codex-home.sh to install into the Codex home.
|
|
512
|
+
// Defaults to CODEX_HOME or ~/.codex. --dest remains an explicit override.
|
|
433
513
|
if (options.global && options.runtime === "codex") {
|
|
434
514
|
const codexHomeScript = path.join(root, "scripts", "install-codex-home.sh");
|
|
435
515
|
if (!fs.existsSync(codexHomeScript)) {
|
|
@@ -452,7 +532,10 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
452
532
|
console.error(`flow-agents init: unable to run install-codex-home.sh: ${result.error.message}`);
|
|
453
533
|
return 1;
|
|
454
534
|
}
|
|
455
|
-
|
|
535
|
+
const installed = result.status ?? 1;
|
|
536
|
+
if (installed !== 0)
|
|
537
|
+
return installed;
|
|
538
|
+
return activateKits(options);
|
|
456
539
|
}
|
|
457
540
|
// --global for pi: NOT_VERIFIED (no documented global dir). Warn and fall through to workspace install.
|
|
458
541
|
if (options.global && options.runtime === "pi") {
|
|
@@ -541,11 +624,11 @@ function dogfoodClaudeCode(bundleRoot, dest) {
|
|
|
541
624
|
fs.writeFileSync(tmp, `${JSON.stringify(merged, null, 2)}\n`, "utf8");
|
|
542
625
|
fs.renameSync(tmp, destSettingsPath);
|
|
543
626
|
// Write version stamp.
|
|
544
|
-
const
|
|
627
|
+
const recordPath = durableInstallRecordPath(dest);
|
|
628
|
+
const installRecordDir = path.dirname(recordPath);
|
|
545
629
|
fs.mkdirSync(installRecordDir, { recursive: true });
|
|
546
630
|
const pkgJson = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
547
631
|
const record = { version: pkgJson["version"] ?? "0.0.0", installedAt: new Date().toISOString(), runtime: "claude-code" };
|
|
548
|
-
const recordPath = path.join(installRecordDir, "install.json");
|
|
549
632
|
const recordTmp = `${recordPath}.tmp.${process.pid}`;
|
|
550
633
|
fs.writeFileSync(recordTmp, `${JSON.stringify(record, null, 2)}\n`, "utf8");
|
|
551
634
|
fs.renameSync(recordTmp, recordPath);
|
|
@@ -584,11 +667,11 @@ function dogfoodCodex(bundleRoot, dest) {
|
|
|
584
667
|
fs.writeFileSync(tmp, `${JSON.stringify(merged, null, 2)}\n`, "utf8");
|
|
585
668
|
fs.renameSync(tmp, destHooksPath);
|
|
586
669
|
// Write version stamp.
|
|
587
|
-
const
|
|
670
|
+
const recordPath = durableInstallRecordPath(dest);
|
|
671
|
+
const installRecordDir = path.dirname(recordPath);
|
|
588
672
|
fs.mkdirSync(installRecordDir, { recursive: true });
|
|
589
673
|
const pkgJson = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
590
674
|
const record = { version: pkgJson["version"] ?? "0.0.0", installedAt: new Date().toISOString(), runtime: "codex" };
|
|
591
|
-
const recordPath = path.join(installRecordDir, "install.json");
|
|
592
675
|
const recordTmp = `${recordPath}.tmp.${process.pid}`;
|
|
593
676
|
fs.writeFileSync(recordTmp, `${JSON.stringify(record, null, 2)}\n`, "utf8");
|
|
594
677
|
fs.renameSync(recordTmp, recordPath);
|