@kontourai/flow-agents 2.3.0 → 3.0.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 +16 -0
- package/.github/workflows/ci.yml +44 -0
- package/.github/workflows/trust-reconcile.yml +62 -4
- package/AGENTS.md +4 -4
- package/CHANGELOG.md +62 -0
- package/CONTEXT.md +35 -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/assignment-provider.d.ts +1 -0
- package/build/src/cli/assignment-provider.js +748 -0
- package/build/src/cli/console-learning-projection.js +3 -2
- package/build/src/cli/effective-assignment-provider-settings.d.ts +1 -0
- package/build/src/cli/effective-assignment-provider-settings.js +125 -0
- 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 +27 -7
- 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 +938 -168
- package/build/src/cli.js +6 -0
- 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 +24 -1
- package/console.telemetry.json +22 -0
- package/context/contracts/artifact-contract.md +40 -7
- package/context/contracts/assignment-provider-contract.md +239 -0
- package/context/contracts/builder-kit-workflow-state-contract.md +5 -2
- package/context/contracts/decision-registry-contract.md +265 -0
- package/context/contracts/delivery-contract.md +3 -1
- package/context/contracts/execution-contract.md +25 -0
- package/context/contracts/governance-adapter-contract.md +2 -0
- package/context/contracts/knowledge-store-contract.md +197 -0
- package/context/contracts/planning-contract.md +4 -1
- package/context/contracts/review-contract.md +7 -3
- package/context/contracts/sandbox-policy.md +2 -0
- package/context/contracts/standing-directives.md +13 -0
- package/context/contracts/verification-contract.md +11 -1
- package/context/contracts/work-item-contract.md +3 -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/context/settings/assignment-provider-settings.json +33 -0
- 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 +463 -0
- package/docs/agent-system-guidebook.md +3 -3
- package/docs/agent-usage-feedback-loop.md +6 -6
- package/docs/context-map.md +10 -7
- package/docs/decisions/decision-records.md +57 -0
- package/docs/decisions/index.md +17 -0
- package/docs/decisions/knowledge-store-provider.md +51 -0
- package/docs/decisions/model-routing.md +63 -0
- package/docs/decisions/promotion-gate.md +52 -0
- package/docs/decisions/standing-directives.md +66 -0
- package/docs/developer-architecture.md +1 -1
- package/docs/fixture-ownership.md +4 -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 +3 -2
- package/docs/workflow-usage-guide.md +260 -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 +71 -1
- package/evals/fixtures/assignment-provider/actor-a.json +6 -0
- package/evals/fixtures/assignment-provider/actor-b.json +6 -0
- package/evals/fixtures/assignment-provider/github-issue-claimed.json +27 -0
- package/evals/fixtures/assignment-provider/github-issue-unassigned.json +7 -0
- package/evals/fixtures/assignment-provider/liveness-fresh.json +9 -0
- package/evals/fixtures/assignment-provider/liveness-stale.json +9 -0
- 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_assignment_provider_github.sh +318 -0
- package/evals/integration/test_assignment_provider_local_file.sh +222 -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_critique_supersession_roundtrip.sh +182 -0
- 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 +23 -6
- package/evals/integration/test_pull_work_assignment_join.sh +132 -0
- package/evals/integration/test_pull_work_liveness_preflight.sh +394 -0
- package/evals/integration/test_pull_work_provider.sh +2 -2
- package/evals/integration/test_reconcile_soundness.sh +37 -13
- 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 +11 -10
- 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 +759 -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 +802 -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 +32 -0
- package/evals/static/test_decisions.sh +150 -0
- package/evals/static/test_flowdef_codeowners_coverage.sh +62 -0
- package/evals/static/test_knowledge_providers.sh +23 -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 +32 -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 +148 -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/knowledge/kit.json +35 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/CONTEXT.md +12 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/old-sprocket-shape.md +13 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/sprocket-shape.md +14 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/widget-format.md +14 -0
- package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/learnings/fixture-learning.md +7 -0
- package/kits/knowledge/providers/conformance/fixtures/work-item/issues.json +30 -0
- package/kits/knowledge/providers/conformance/suite.test.js +125 -0
- package/kits/knowledge/providers/git-repo/index.js +236 -0
- package/kits/knowledge/providers/health/health-pass.test.js +99 -0
- package/kits/knowledge/providers/health/index.js +153 -0
- package/kits/knowledge/providers/index.js +24 -0
- package/kits/knowledge/providers/lib/model.js +91 -0
- package/kits/knowledge/providers/lib/schema-validate.js +119 -0
- package/kits/knowledge/providers/markdown-vault/index.js +169 -0
- package/kits/knowledge/providers/work-item/index.js +204 -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 +11 -5
- 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/assignment-provider-settings.schema.json +125 -0
- package/schemas/decision-record.schema.json +109 -0
- package/schemas/knowledge/edge.schema.json +54 -0
- package/schemas/knowledge/health-report.schema.json +45 -0
- package/schemas/knowledge/node.schema.json +49 -0
- package/schemas/knowledge/proposal.schema.json +53 -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 +957 -103
- 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/assignment-provider.ts +845 -0
- package/src/cli/console-learning-projection.ts +3 -2
- package/src/cli/effective-assignment-provider-settings.ts +112 -0
- 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 +27 -7
- 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 +933 -168
- package/src/cli.ts +6 -0
- 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 +24 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Knowledge Store Provider Contract
|
|
2
|
+
|
|
3
|
+
Normative contract for the Knowledge Kit's typed graph MODEL and its pluggable
|
|
4
|
+
storage/sync PROVIDERS. The model (nodes, edges, provenance) is owned by the Kit;
|
|
5
|
+
storage and synchronisation are provider concerns. The same ingest/link/health
|
|
6
|
+
verbs run over every provider, so backlog hygiene is a knowledge-health pass over
|
|
7
|
+
the work-item provider rather than a bespoke tool.
|
|
8
|
+
|
|
9
|
+
Machine-checkable structure lives in `schemas/knowledge/*.schema.json`
|
|
10
|
+
(`node`, `edge`, `proposal`, `health-report`). Reference implementations live in
|
|
11
|
+
`kits/knowledge/providers/` (markdown-vault, git-repo, work-item) with health
|
|
12
|
+
verbs in `kits/knowledge/providers/health/` and the conformance suite in
|
|
13
|
+
`kits/knowledge/providers/conformance/`.
|
|
14
|
+
|
|
15
|
+
This contract applies the portfolio provider pattern (hachure format/adapters;
|
|
16
|
+
Builder Kit work-item contract/providers) to knowledge, which until now was fused
|
|
17
|
+
to one storage shape (the markdown vault).
|
|
18
|
+
|
|
19
|
+
## 1. Graph model
|
|
20
|
+
|
|
21
|
+
### 1.1 Node
|
|
22
|
+
|
|
23
|
+
A node is a typed, identified unit of knowledge. Validated by
|
|
24
|
+
`schemas/knowledge/node.schema.json`.
|
|
25
|
+
|
|
26
|
+
| Field | Required | Meaning |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| `id` | yes | Provider-scoped stable id, unique within a single `readGraph` result. |
|
|
29
|
+
| `type` | yes | Node type (see §1.3). EXTENSIBLE. |
|
|
30
|
+
| `title` | yes | Human-readable title; the basis for duplicate detection. |
|
|
31
|
+
| `body` | no | Primary content; format is provider/type-specific. |
|
|
32
|
+
| `attributes` | no | Provider-specific structured fields (issue state/labels, decision status, note category/tags). |
|
|
33
|
+
| `provenance` | yes | Where this node was read from (§1.4). |
|
|
34
|
+
|
|
35
|
+
### 1.2 Edge
|
|
36
|
+
|
|
37
|
+
An edge is a typed, directed relationship. Validated by
|
|
38
|
+
`schemas/knowledge/edge.schema.json`.
|
|
39
|
+
|
|
40
|
+
| Field | Required | Meaning |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| `id` | yes | Provider-scoped stable edge id. |
|
|
43
|
+
| `type` | yes | One of the CLOSED edge vocabulary (§1.3). |
|
|
44
|
+
| `from` | yes | Source node id. |
|
|
45
|
+
| `to` | yes | Target node id. |
|
|
46
|
+
| `resolved` | no | `true` (default) means `to` is expected to resolve to a node in the same graph (an internal dependency link); `false` marks a deliberate external reference (e.g. `evidence-of` a PR outside the store). |
|
|
47
|
+
| `attributes` | no | Provider-specific structured fields. |
|
|
48
|
+
| `provenance` | yes | Where this edge was derived from (§1.4). |
|
|
49
|
+
|
|
50
|
+
### 1.3 Vocabularies
|
|
51
|
+
|
|
52
|
+
**Node types are EXTENSIBLE.** The recommended core vocabulary is `note`,
|
|
53
|
+
`decision`, `issue`, `session`, `person`. Providers MAY emit additional types;
|
|
54
|
+
consumers MUST NOT reject unknown node types.
|
|
55
|
+
|
|
56
|
+
**Edge types are CLOSED** (schema-enforced enum):
|
|
57
|
+
|
|
58
|
+
| Edge type | Direction | Meaning |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| `supersedes` | from → to | `from` replaces `to`. |
|
|
61
|
+
| `merged-into` | from → to | `from` was folded into `to`. |
|
|
62
|
+
| `blocks` | from → to | `from` must complete before `to`. |
|
|
63
|
+
| `evidence-of` | from → to | `from` is provenance/evidence for `to`. |
|
|
64
|
+
| `mentions` | from → to | `from` references `to` in prose. |
|
|
65
|
+
| `relates` | from → to | General association. |
|
|
66
|
+
|
|
67
|
+
Adding an edge type is a contract change (schema + this table), because health
|
|
68
|
+
verbs reason over the closed vocabulary (e.g. `blocks` is the dependency-link
|
|
69
|
+
relation).
|
|
70
|
+
|
|
71
|
+
### 1.4 Provenance
|
|
72
|
+
|
|
73
|
+
Provenance appears on BOTH nodes and edges. Every assertion in the graph is
|
|
74
|
+
traceable back to the store it came from — no orphan facts.
|
|
75
|
+
|
|
76
|
+
| Field | Required | Meaning |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| `provider` | yes | Provider id that produced the element. |
|
|
79
|
+
| `source` | yes | Concrete origin: a file path, an issue ref, or a URL. |
|
|
80
|
+
| `locator` | no | Finer locator (line, anchor, frontmatter field, link kind). |
|
|
81
|
+
| `retrieved_at` | yes | ISO-8601 read timestamp. |
|
|
82
|
+
| `agent` | no | Agent/process id that performed the read. |
|
|
83
|
+
|
|
84
|
+
## 2. Provider interface
|
|
85
|
+
|
|
86
|
+
A provider is an ESM module exporting a default class constructed with a
|
|
87
|
+
provider-specific options object. Every provider implements the READ interface
|
|
88
|
+
and the PROPOSALS-ONLY write interface.
|
|
89
|
+
|
|
90
|
+
### 2.1 Read
|
|
91
|
+
|
|
92
|
+
| Method | Signature | Behaviour |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| `capabilities()` | `() => Capabilities` | Static description (§2.3). Synchronous. |
|
|
95
|
+
| `readNodes(options?)` | `(o?) => Promise<Node[]>` | All nodes; `options.type` filters by node type. Every node schema-valid. |
|
|
96
|
+
| `readEdges()` | `() => Promise<Edge[]>` | All edges; every edge schema-valid and in the closed vocabulary. |
|
|
97
|
+
| `queryByType(type)` | `(t) => Promise<Node[]>` | Convenience: the nodes of one type (a consistent subset of `readNodes`). |
|
|
98
|
+
| `readGraph()` | `() => Promise<{nodes, edges}>` | The full graph. |
|
|
99
|
+
|
|
100
|
+
### 2.2 Write — proposals only
|
|
101
|
+
|
|
102
|
+
Knowledge stores are HUMAN-CURATED. No provider auto-writes to a store. The only
|
|
103
|
+
write surface is:
|
|
104
|
+
|
|
105
|
+
| Method | Signature | Behaviour |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| `proposeWrite(intent)` | `(i) => Promise<Proposal>` | Returns a `Proposal` (§2.4) describing an intended change. MUST NOT mutate the store, disk, or the remote board. |
|
|
108
|
+
|
|
109
|
+
**How proposals-only is expressed structurally:** the `Proposal` schema fixes
|
|
110
|
+
`status` to the const `"proposed"`. A provider can never return an applied
|
|
111
|
+
proposal, and the conformance suite asserts that `readNodes()` is byte-stable
|
|
112
|
+
across a `proposeWrite` call. Enactment happens DOWNSTREAM of the provider:
|
|
113
|
+
|
|
114
|
+
- **git-repo** renders a decision-registry topic file (frontmatter compatible
|
|
115
|
+
with `schemas/decision-record.schema.json`) shaped for the **promote sub-flow**
|
|
116
|
+
(`docs/decisions/promotion-gate.md`). The promote step is the enactor.
|
|
117
|
+
- **work-item** renders a draft `gh issue comment` / `gh issue edit --add-label`
|
|
118
|
+
the operator files. The provider never runs a mutating `gh` command.
|
|
119
|
+
- **markdown-vault** renders a note in native frontmatter + `[[wikilink]]` form
|
|
120
|
+
for the Knowledge Kit ingest/compile flow to file.
|
|
121
|
+
|
|
122
|
+
This is the same proposals-only discipline as the store contract's
|
|
123
|
+
`propose → apply/reject` gate and the ADR-0003-style "proposals, never silent
|
|
124
|
+
writes to a curated store" precedent. A provider is the propose half; a human or
|
|
125
|
+
a gated flow is the apply half.
|
|
126
|
+
|
|
127
|
+
### 2.3 Capabilities
|
|
128
|
+
|
|
129
|
+
`capabilities()` returns `{ id, node_types, edge_types, writable, write_mode,
|
|
130
|
+
proposal_targets, source_of_truth }`. `writable` is always `false` and
|
|
131
|
+
`write_mode` is always `"proposals-only"` in this version — a graph-database
|
|
132
|
+
provider that owns its store is a separate, gated spike (issue #318), not a
|
|
133
|
+
loophole here.
|
|
134
|
+
|
|
135
|
+
### 2.4 Proposal
|
|
136
|
+
|
|
137
|
+
Validated by `schemas/knowledge/proposal.schema.json`.
|
|
138
|
+
|
|
139
|
+
| Field | Required | Meaning |
|
|
140
|
+
| --- | --- | --- |
|
|
141
|
+
| `schema_version` | yes | `"1.0"`. |
|
|
142
|
+
| `provider` | yes | Emitting provider id. |
|
|
143
|
+
| `kind` | yes | `create-node` \| `update-node` \| `add-edge` \| `comment` \| `label` \| `decision-topic`. |
|
|
144
|
+
| `target` | yes | Where the change would land (descriptive only). |
|
|
145
|
+
| `payload` | no | The structured node/edge/field proposed. |
|
|
146
|
+
| `rendered` | no | The provider-native form an enactor would apply. |
|
|
147
|
+
| `status` | yes | The const `"proposed"`. |
|
|
148
|
+
| `rationale` | no | Why the change is proposed. |
|
|
149
|
+
| `provenance` | yes | §1.4. |
|
|
150
|
+
|
|
151
|
+
## 3. Health verbs
|
|
152
|
+
|
|
153
|
+
Health verbs are PROVIDER-AGNOSTIC pure functions over a graph
|
|
154
|
+
(`{ nodes, edges }`) — they never inspect provider internals, which is what lets
|
|
155
|
+
one health command run identically over any provider (R4). Each returns a
|
|
156
|
+
schema-valid Knowledge Health Report
|
|
157
|
+
(`schemas/knowledge/health-report.schema.json`). Reference verbs live in
|
|
158
|
+
`kits/knowledge/providers/health/`.
|
|
159
|
+
|
|
160
|
+
| Verb | Report `check` | Behaviour |
|
|
161
|
+
| --- | --- | --- |
|
|
162
|
+
| `detectDuplicates(graph, o?)` | `duplicate-detection` | Flags node pairs whose titles match / are highly similar (token Jaccard ≥ `threshold`, default 0.7; same-type by default). |
|
|
163
|
+
| `checkDependencyLinkIntegrity(graph, o?)` | `dependency-link-integrity` | Flags dependency edges (default type `blocks`) whose endpoints are missing from the graph, unless the edge is `resolved:false` (deliberate external ref). |
|
|
164
|
+
|
|
165
|
+
Every finding cites its evidence (the compared titles + similarity, or the edge
|
|
166
|
+
+ which endpoint is missing). A report's `summary.finding_count` MUST equal
|
|
167
|
+
`findings.length`.
|
|
168
|
+
|
|
169
|
+
## 4. Reference providers
|
|
170
|
+
|
|
171
|
+
| Provider | Reads | Node types | Write proposal |
|
|
172
|
+
| --- | --- | --- | --- |
|
|
173
|
+
| `markdown-vault` | The existing Knowledge Kit store (markdown + frontmatter + `[[wikilinks]]` + graph index) via an existing store adapter — thin wrapper, existing skills unaffected. | `note`, `person` | `create-node` rendered as a native vault note. |
|
|
174
|
+
| `git-repo` | `docs/decisions/*` (tombstones → `supersedes`/`merged-into`; `evidence[]` → `evidence-of`), CONTEXT.md glossary, `docs/learnings/*`. | `decision`, `note` | `decision-topic` shaped for the promote sub-flow. |
|
|
175
|
+
| `work-item` | GitHub issues via an INJECTABLE runner (default `gh`), `flow-agents:work-item-metadata` blockers + prose refs → `blocks`/`relates`. | `issue` | `comment` / `label` draft. |
|
|
176
|
+
|
|
177
|
+
## 5. Conformance
|
|
178
|
+
|
|
179
|
+
`kits/knowledge/providers/conformance/suite.test.js` is the parameterized
|
|
180
|
+
conformance suite EVERY provider must pass (issue #317, AC3). It asserts:
|
|
181
|
+
capabilities declare proposals-only/non-writable; `readNodes` returns unique,
|
|
182
|
+
schema-valid nodes with provider provenance; `readEdges` returns schema-valid
|
|
183
|
+
edges in the closed vocabulary; `queryByType` is a consistent subset of
|
|
184
|
+
`readNodes`; `readGraph` returns `{nodes, edges}`; and `proposeWrite` returns a
|
|
185
|
+
schema-valid `"proposed"` proposal that mutates nothing.
|
|
186
|
+
|
|
187
|
+
`kits/knowledge/providers/health/health-pass.test.js` covers AC1 (the same
|
|
188
|
+
health command over vault + git-repo yields schema-valid reports) and AC2 (a
|
|
189
|
+
backlog pass over the work-item adapter, driven by a SEEDED fixture, flags a
|
|
190
|
+
duplicate and a broken blocker link — never the real board).
|
|
191
|
+
|
|
192
|
+
## 6. Non-goals
|
|
193
|
+
|
|
194
|
+
Graph-database provider (issue #318 spike; adoption gated on a real query failing
|
|
195
|
+
over files); embeddings; auto-writes to any human-curated store; personal-vault
|
|
196
|
+
feature changes. This contract adds a model + read/propose interface over stores
|
|
197
|
+
operated today; it does not change how those stores are curated.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Planning Contract
|
|
2
2
|
|
|
3
|
+
> Read [`context/contracts/standing-directives.md`](standing-directives.md) — ratified owner directives that override default engineering conservatism.
|
|
4
|
+
|
|
3
5
|
Planning turns a user goal into an executable implementation plan without writing production code.
|
|
4
6
|
|
|
5
7
|
## Required Inputs
|
|
@@ -23,7 +25,7 @@ Also create or update structured sidecars beside the Markdown artifacts:
|
|
|
23
25
|
Use the sidecar writer when available:
|
|
24
26
|
|
|
25
27
|
```bash
|
|
26
|
-
npm run workflow:sidecar -- init-plan .flow-agents/<slug>/<slug>--deliver.md \
|
|
28
|
+
npm run workflow:sidecar -- init-plan .kontourai/flow-agents/<slug>/<slug>--deliver.md \
|
|
27
29
|
--source-request "<original request>" \
|
|
28
30
|
--summary "<planning summary>" \
|
|
29
31
|
--next-action "<next execution step>"
|
|
@@ -79,6 +81,7 @@ The plan body must include:
|
|
|
79
81
|
- Preserve stable requirement and acceptance ids from upstream backlog issues when they exist; otherwise create stable ids in the plan before execution.
|
|
80
82
|
- Every implementation task must map back to the acceptance criteria it supports.
|
|
81
83
|
- Acceptance criteria for implementation behavior must name expected command/test evidence and expected source evidence. Source evidence means structured refs with `kind`, `url`, `file`, `line_start`, `line_end`, and `excerpt` where applicable; use immutable GitHub blob permalinks pinned to a commit SHA when provider URLs are available, and local file/line refs only as pre-publish fallback.
|
|
84
|
+
- A `kind: "command"` evidence ref's `excerpt`/`command` field must be a **literally runnable shell command** (for example `npm test`, `bash evals/run.sh static`, `./scripts/check.sh`), not a prose description of a manual verification step. The goal-fit backstop and the CI reconciler treat this text as a command: a prose "excerpt" is classified `malformed-evidence` (it is never spawned as `bash -lc "<a sentence>"`, and it is not conflated with a caught false-completion — see `scripts/hooks/stop-goal-fit.js`). When a verification is not automatable — a manual review, a provider/CI observation, a document citation — use `kind: "artifact"`/`"external"` (or record the criterion as `not_verified`/`accepted_gap`) instead of fabricating a `kind: "command"` ref. This keeps the contract and the enforcing code in agreement (ADR 0020).
|
|
82
85
|
- Plans should state that provider, PR, issue, closure, and final acceptance comments need an `Acceptance Evidence` table with columns `AC id`, `Status`, `Command/Test Evidence`, `Source Evidence / Permalinks`, and `Gaps`.
|
|
83
86
|
- The Definition Of Done is the stop condition, not a decorative section.
|
|
84
87
|
- If the goal is exploratory or uncertain, define what the user should be able to take away from the work.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Review Contract
|
|
2
2
|
|
|
3
|
+
> Read [`context/contracts/standing-directives.md`](standing-directives.md) — ratified owner directives that override default engineering conservatism.
|
|
4
|
+
|
|
3
5
|
Review is report-only critique. It asks whether the changed code is maintainable, secure, consistent with project standards, and structurally sound before verification proves behavior.
|
|
4
6
|
|
|
5
7
|
## Purpose
|
|
@@ -78,10 +80,12 @@ If a perspective is required but cannot be reviewed, record it as `not_verified`
|
|
|
78
80
|
|
|
79
81
|
When review runs as part of a workflow, write or update the configured critique artifact/sink. For the current local sidecar materialization, write or update `critique.json` beside the workflow artifacts using `schemas/workflow-critique.schema.json`.
|
|
80
82
|
|
|
83
|
+
Reviewers write critique **through** `record-critique` (or `import-critique` for a Markdown report), directly or via the orchestrating skill — never by hand-authoring `critique.json`, `evidence.json`, or `acceptance.json`. Those bespoke sidecars were retired as the source of truth by ADR 0010 Phase 4c; `trust.bundle` is the sole verification artifact and only the sidecar writer performs the evidence classification the CI trust anchor depends on (ADR 0020). `config-protection.js` blocks direct tool writes to these gate files by design.
|
|
84
|
+
|
|
81
85
|
Prefer the sidecar writer when available:
|
|
82
86
|
|
|
83
87
|
```bash
|
|
84
|
-
npm run workflow:sidecar -- record-critique .flow-agents/<slug> \
|
|
88
|
+
npm run workflow:sidecar -- record-critique .kontourai/flow-agents/<slug> \
|
|
85
89
|
--id code-review \
|
|
86
90
|
--reviewer tool-code-reviewer \
|
|
87
91
|
--verdict pass \
|
|
@@ -91,8 +95,8 @@ npm run workflow:sidecar -- record-critique .flow-agents/<slug> \
|
|
|
91
95
|
For Markdown reviewer reports, import them when possible:
|
|
92
96
|
|
|
93
97
|
```bash
|
|
94
|
-
npm run workflow:sidecar -- import-critique .flow-agents/<slug> \
|
|
95
|
-
.flow-agents/<slug>/<slug>--code-review.md \
|
|
98
|
+
npm run workflow:sidecar -- import-critique .kontourai/flow-agents/<slug> \
|
|
99
|
+
.kontourai/flow-agents/<slug>/<slug>--code-review.md \
|
|
96
100
|
--reviewer tool-code-reviewer
|
|
97
101
|
```
|
|
98
102
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Sandbox Policy Contract
|
|
2
2
|
|
|
3
|
+
> Read [`context/contracts/standing-directives.md`](standing-directives.md) — ratified owner directives that override default engineering conservatism.
|
|
4
|
+
|
|
3
5
|
Workflow artifacts must name the execution boundary required for the work. The sandbox mode is a planning and delegation contract, not a substitute for the runtime permission model.
|
|
4
6
|
|
|
5
7
|
## Canonical Modes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Standing Directives Contract
|
|
2
|
+
|
|
3
|
+
Ratified owner directives are corrections and policies the owner has explicitly settled across sessions. They override default engineering conservatism (e.g. "keep the old path working just in case") wherever they apply. Each directive below is a durable, quotable statement — cite the number, not a paraphrase from memory. This file exists so a delegated agent that only sees one task in a plan still receives the same standing policy the orchestrator ratified; correction that lives only in one session's ephemeral context does not reach the agents who need it.
|
|
4
|
+
|
|
5
|
+
Read this file alongside the phase contract for the work you are doing. When a standing directive and a phase contract's default guidance conflict, the standing directive wins; if you believe a directive does not fit the situation, stop and report the conflict rather than silently picking a side.
|
|
6
|
+
|
|
7
|
+
## Directives
|
|
8
|
+
|
|
9
|
+
1. **No legacy fallbacks: migrate hard.** A compatibility path that keeps defective or superseded behavior reachable is prohibited regardless of how short-lived or self-healing it is; the remedy for old artifacts is a loud typed error naming the regeneration command. (Ratified July 2026. Evidence: [datum#3](https://github.com/kontourai/datum/pull/3) hard cutover to `.datum/config.json`; the fallback-removal follow-up to [flow-agents#344](https://github.com/kontourai/flow-agents/pull/344), tracked as [flow-agents#347](https://github.com/kontourai/flow-agents/issues/347).)
|
|
10
|
+
2. **Durable vs runtime paths: never invert them.** `.kontourai/` is gitignored runtime state; `.<product>/` (e.g. `.veritas/`, `.datum/`) is a product's durable, committed directory in consuming repos. (Ratified July 2026. Evidence: `.veritas/` precedent and the `.kontourai/` vs `.veritas/` distinction in [docs/repository-structure.md](../../docs/repository-structure.md); [datum#3](https://github.com/kontourai/datum/pull/3) `.datum/config.json`; [surface#110](https://github.com/kontourai/surface/issues/110), [surface#113](https://github.com/kontourai/surface/pull/113).)
|
|
11
|
+
3. **Evidence must be executable.** Check summaries/excerpts are runnable-from-repo-root commands (`true # ...` for prose that has no command); probe scripts live inside the session dir; reconcilable claims use manifest-exact bare labels. (Ratified July 2026.)
|
|
12
|
+
4. **Standalone-first, then integrate.** Build pieces to provide value alone, then push them through a real product integration to pressure-test the abstractions; file upstream issues for friction found during integration rather than working around it. (Ratified July 2026.)
|
|
13
|
+
5. **Regression rule for cutovers.** Proper before/after tests are required for any cutover; large regressions (e.g. more than 40% record loss, or a whole field-class disappearing) are surfaced as an explicit owner decision with data, never papered over — but a large regression does not block the cutover by default. (Ratified July 2026.)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Verification Contract
|
|
2
2
|
|
|
3
|
+
> Read [`context/contracts/standing-directives.md`](standing-directives.md) — ratified owner directives that override default engineering conservatism.
|
|
4
|
+
|
|
3
5
|
Verification is report-only. It proves whether the implementation satisfies the plan, the Definition Of Done, and the original user outcome.
|
|
4
6
|
|
|
5
7
|
## Required Inputs
|
|
@@ -14,6 +16,14 @@ Verification is report-only. It proves whether the implementation satisfies the
|
|
|
14
16
|
|
|
15
17
|
Verifiers and reviewers do not modify source code. They may run commands, inspect files, take screenshots, and write verification artifacts. They must not apply fixes, formatting, lint autofixes, or patches.
|
|
16
18
|
|
|
19
|
+
## Writing Evidence Through The Sidecar Writer
|
|
20
|
+
|
|
21
|
+
Verifiers write evidence and acceptance status **through** `record-evidence` (directly, or via the orchestrating skill), never by hand-authoring `evidence.json`, `acceptance.json`, or `trust.bundle`. Those bespoke sidecars were retired as the source of truth by ADR 0010 Phase 4c; the `trust.bundle` is the sole verification artifact, and only the sidecar writer performs the evidence classification (`evidenceType`/`method` derivation and manifest reconciliation) the CI trust anchor depends on (ADR 0020). `config-protection.js` blocks direct tool writes to these gate files by design. If the sidecar writer is unavailable, record the exact gap instead of writing the files by hand.
|
|
22
|
+
|
|
23
|
+
## Mutation Testing Runs In A Scratch Copy
|
|
24
|
+
|
|
25
|
+
Mutation-testing tools (Stryker or equivalent) **must** run against a scratch/throwaway copy of the working tree, never the live working tree. They deliberately introduce defects to measure test-suite sensitivity; running them in place risks leaving mutated source, corrupting the checkout, or tripping the gate/anchor on injected failures. Copy the tree to a temporary directory (or a git worktree/clone) and run the mutation tool there; discard it afterward.
|
|
26
|
+
|
|
17
27
|
## Verification Phases
|
|
18
28
|
|
|
19
29
|
Attempt relevant phases and record evidence:
|
|
@@ -77,7 +87,7 @@ When verification runs as part of a workflow, write or update `evidence.json` be
|
|
|
77
87
|
Use the sidecar writer when available:
|
|
78
88
|
|
|
79
89
|
```bash
|
|
80
|
-
npm run workflow:sidecar -- record-evidence .flow-agents/<slug> \
|
|
90
|
+
npm run workflow:sidecar -- record-evidence .kontourai/flow-agents/<slug> \
|
|
81
91
|
--verdict pass \
|
|
82
92
|
--check-json '{"id":"tests","kind":"test","status":"pass","summary":"Relevant checks passed."}'
|
|
83
93
|
```
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Work Item Contract
|
|
2
2
|
|
|
3
|
+
> Read [`context/contracts/standing-directives.md`](standing-directives.md) — ratified owner directives that override default engineering conservatism.
|
|
4
|
+
|
|
3
5
|
This contract defines the provider-neutral vocabulary for selecting, planning, and handing off backlog work. It is the source shape for provider-backed workflows such as `pull-work`; provider-specific adapters map into this model without making GitHub, Jira, Linear, or any other provider the generic language.
|
|
4
6
|
|
|
5
7
|
## Provider Roles
|
|
@@ -176,7 +178,7 @@ GitHub is the first concrete mapping for this contract, not the generic vocabula
|
|
|
176
178
|
| `related_links` | Issue links, closing references, discussions, docs, and cross-references. |
|
|
177
179
|
| `source_provider` | `github`, repository owner/name, issue number, node id, and issue URL. |
|
|
178
180
|
| `pr_links` | Linked pull requests, closing PRs, branches, or manually referenced PR URLs. |
|
|
179
|
-
| `artifact_refs` | `.flow-agents/<slug>/` artifacts, plan/review/evidence links, and promoted docs referenced from the issue or workflow. |
|
|
181
|
+
| `artifact_refs` | `.kontourai/flow-agents/<slug>/` artifacts, plan/review/evidence links, and promoted docs referenced from the issue or workflow. |
|
|
180
182
|
|
|
181
183
|
### GitHub Projects as `BoardProvider`
|
|
182
184
|
|
|
@@ -26,7 +26,7 @@ Every worker delegation must target the exact `tool-worker` role. Omitting the r
|
|
|
26
26
|
3. **Context** — relevant code patterns, conventions, types/interfaces it needs to follow
|
|
27
27
|
4. **Working directory** — if different from current
|
|
28
28
|
|
|
29
|
-
tool-worker manages its own TODO files in `.flow-agents/<slug>/` and tracks `modified_files` to detect conflicts with other parallel workers. It will end its turn immediately if instructions are insufficient rather than guessing.
|
|
29
|
+
tool-worker manages its own TODO files in `.kontourai/flow-agents/<slug>/` and tracks `modified_files` to detect conflicts with other parallel workers. It will end its turn immediately if instructions are insufficient rather than guessing.
|
|
30
30
|
|
|
31
31
|
## Conflict Avoidance
|
|
32
32
|
|
|
@@ -6,7 +6,7 @@ This repo runs three active gates implemented as Claude Code hook scripts. Every
|
|
|
6
6
|
|
|
7
7
|
**goal-fit/Stop** (`scripts/hooks/stop-goal-fit.js`): fires on the agent Stop event (before the agent final-answers as complete). The gate reads `.flow-agents/` to find the most recent active workflow artifact and checks for: an incomplete Definition Of Done section, an incomplete or absent Goal Fit Gate section, open items in Final Acceptance when status is delivered, failing or NOT_VERIFIED checks in `evidence.json`, open sidecar issues (state.json showing non-done status, critique.json with open findings), and evidence cross-reference failures (the capture log in `command-log.jsonl` contradicting a claimed-pass command check in `evidence.json`). In `block` mode the gate exits 2, which prevents the Stop. The canonical engine default is `warn` (exit 0 with guidance on stderr); shipped runtime configs such as Claude Code at L2 set `block` so the installed product enforces. The gate releases automatically after a configurable number of consecutive identical blocks (default 3) to surface the situation to the human rather than looping forever.
|
|
8
8
|
|
|
9
|
-
**evidence-capture** (`scripts/hooks/evidence-capture.js`): fires as a postToolUse hook on every shell or command tool execution. It deterministically records the actual command result — not the model's narration about it — to `.flow-agents/<slug>/command-log.jsonl` as an append-only JSONL log. Each record captures the command string, observed result (pass/fail), exit code when available, and a timestamp. Non-blocking; always exits 0. Fail-open: a capture failure never blocks the agent or corrupts the log.
|
|
9
|
+
**evidence-capture** (`scripts/hooks/evidence-capture.js`): fires as a postToolUse hook on every shell or command tool execution. It deterministically records the actual command result — not the model's narration about it — to `.kontourai/flow-agents/<slug>/command-log.jsonl` as an append-only JSONL log. Each record captures the command string, observed result (pass/fail), exit code when available, and a timestamp. Non-blocking; always exits 0. Fail-open: a capture failure never blocks the agent or corrupts the log.
|
|
10
10
|
|
|
11
11
|
**reground** (`scripts/hooks/workflow-steering.js`): fires on `SessionStart` and `UserPromptSubmit` to re-inject the active workflow phase, goal, and next-step from `state.json` into the agent turn. This is what keeps an in-flight goal alive through context compaction and session resume without requiring the agent to voluntarily re-read sidecars. The hook also fires after subagent calls (use_subagent) to inject phase-transition reminders tailored to the completing subagent (planner, worker, reviewer, verifier). Non-blocking; always exits 0.
|
|
12
12
|
|
|
@@ -28,12 +28,12 @@ Do not conflate "inconvenient" with "false-block." If the gap named by the gate
|
|
|
28
28
|
|
|
29
29
|
## Missed-Block Diagnostic
|
|
30
30
|
|
|
31
|
-
When a gate does not fire and you suspect it should have, the gate is almost never defective. The goal-fit/Stop gate only knows what the flow recorded in `.flow-agents/<slug>/`. It cross-references `evidence.json` command checks against `command-log.jsonl`. A suspected missed block nearly always means the flow did not record the evidence, not that the gate failed to evaluate it.
|
|
31
|
+
When a gate does not fire and you suspect it should have, the gate is almost never defective. The goal-fit/Stop gate only knows what the flow recorded in `.kontourai/flow-agents/<slug>/`. It cross-references `evidence.json` command checks against `command-log.jsonl`. A suspected missed block nearly always means the flow did not record the evidence, not that the gate failed to evaluate it.
|
|
32
32
|
|
|
33
33
|
Start diagnosis here:
|
|
34
34
|
|
|
35
|
-
1. Check `.flow-agents/<slug>/command-log.jsonl` — was the relevant command captured? If the evidence-capture hook was not active when the command ran (for example, the session predated the hook or the artifact directory was not yet resolved), the log will have no entry for that command and the Stop gate will see no contradiction to raise.
|
|
36
|
-
2. Check `.flow-agents/<slug>/evidence.json` — does the relevant check exist with kind `command` and status `pass`? The gate only cross-references checks that are explicitly recorded in `evidence.json` as command-kind claimed passes. If the check was never written there, the gate has nothing to cross-reference.
|
|
35
|
+
1. Check `.kontourai/flow-agents/<slug>/command-log.jsonl` — was the relevant command captured? If the evidence-capture hook was not active when the command ran (for example, the session predated the hook or the artifact directory was not yet resolved), the log will have no entry for that command and the Stop gate will see no contradiction to raise.
|
|
36
|
+
2. Check `.kontourai/flow-agents/<slug>/evidence.json` — does the relevant check exist with kind `command` and status `pass`? The gate only cross-references checks that are explicitly recorded in `evidence.json` as command-kind claimed passes. If the check was never written there, the gate has nothing to cross-reference.
|
|
37
37
|
3. If both files are present and consistent but the block still did not fire, verify that the artifact directory the gate found is the one you expect (`state.json` newest-mtime resolution) and that the workflow artifact has the correct type and status to be treated as active.
|
|
38
38
|
|
|
39
39
|
A gate defect is a last resort diagnosis, not a first assumption.
|
|
@@ -32,11 +32,11 @@ if [ "$WORKTREE_COUNT" -gt 1 ]; then
|
|
|
32
32
|
echo "=== Active Worktrees ($WORKTREE_COUNT) ==="
|
|
33
33
|
git worktree list
|
|
34
34
|
echo ""
|
|
35
|
-
echo "⚠️ Multiple worktrees active — check .flow-agents/ for in-progress tasks before modifying shared files"
|
|
35
|
+
echo "⚠️ Multiple worktrees active — check .kontourai/flow-agents/ for in-progress tasks before modifying shared files"
|
|
36
36
|
fi
|
|
37
37
|
|
|
38
38
|
# List existing TODOs for awareness
|
|
39
|
-
TODO_DIR=".flow-agents"
|
|
39
|
+
TODO_DIR=".kontourai/flow-agents"
|
|
40
40
|
if [ -d "$TODO_DIR" ]; then
|
|
41
41
|
TODO_COUNT=$(find "$TODO_DIR" -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
42
42
|
if [ "$TODO_COUNT" -gt 0 ]; then
|