@kontourai/flow-agents 2.2.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 +46 -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
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# Decision Registry Contract
|
|
2
|
+
|
|
3
|
+
Normative contract for the topic-keyed decision registry. This is the source of
|
|
4
|
+
truth for how NEW decisions are recorded in a Kontour repository. Numbered ADRs
|
|
5
|
+
under `docs/adr/` are frozen history and are never written for new decisions
|
|
6
|
+
(see [Relationship to ADRs](#relationship-to-adrs-and-grill-with-docs)).
|
|
7
|
+
|
|
8
|
+
Machine-checkable structure lives in `schemas/decision-record.schema.json`; the
|
|
9
|
+
validator/generator is `scripts/check-decisions.cjs`, exposed as
|
|
10
|
+
`npm run check:decisions` and `npm run gen:decisions-index` and wired into the
|
|
11
|
+
required `source-and-static` CI lane.
|
|
12
|
+
|
|
13
|
+
## Why topic-keyed living records
|
|
14
|
+
|
|
15
|
+
Numbered ADRs accumulate three failure modes at multi-contributor, multi-repo
|
|
16
|
+
scale: contradictions (a new ADR appends a conflicting decision instead of
|
|
17
|
+
replacing the old one), bloat (derivation context is inlined alongside the
|
|
18
|
+
decision), and numbering collisions (two contributors both grab `0021-`). The
|
|
19
|
+
registry removes all three by construction:
|
|
20
|
+
|
|
21
|
+
- **One file per decision subject**, keyed by a vocabulary noun, not a number.
|
|
22
|
+
- **Supersession is an edit**, so the current answer is always the only answer.
|
|
23
|
+
- **Derivation context is linked, not inlined**, so files stay lean.
|
|
24
|
+
|
|
25
|
+
## File location and shape
|
|
26
|
+
|
|
27
|
+
- Each decision lives at `docs/decisions/<topic-slug>.md`.
|
|
28
|
+
- Exactly **one file per decision SUBJECT**. If two questions have the same
|
|
29
|
+
subject, they share a file; if a file is answering two subjects, split it.
|
|
30
|
+
- A generated index lives at `docs/decisions/index.md` (see [Index](#index)).
|
|
31
|
+
- The file holds ONLY the current decision plus lean rationale. It does not
|
|
32
|
+
inline transcripts, exploration, meeting notes, or superseded prose.
|
|
33
|
+
|
|
34
|
+
A topic file is YAML frontmatter followed by a short Markdown body:
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
---
|
|
38
|
+
status: current
|
|
39
|
+
subject: Decision records
|
|
40
|
+
decided: 2026-07-03
|
|
41
|
+
evidence:
|
|
42
|
+
- kind: issue
|
|
43
|
+
ref: https://github.com/kontourai/flow-agents/issues/310
|
|
44
|
+
- kind: session-archive
|
|
45
|
+
ref: .kontourai/flow-agents/decision-registry-shape/decision-registry-shape--idea-to-backlog.md
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
# Decision records
|
|
49
|
+
|
|
50
|
+
The current answer, plus lean rationale. Derivation context is linked via
|
|
51
|
+
`evidence[]`, never pasted here.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Slug rules: vocabulary is the namespace
|
|
55
|
+
|
|
56
|
+
- Slugs are **nouns from the repository's CONTEXT.md domain vocabulary**. The
|
|
57
|
+
ubiquitous language is the topic namespace; topic identity is downstream of it.
|
|
58
|
+
- Slugs are lowercase kebab-case: `^[a-z0-9]+(-[a-z0-9]+)*$`, matching a
|
|
59
|
+
glossary term (e.g. the glossary term "Decision Records" ->
|
|
60
|
+
`decision-records.md`).
|
|
61
|
+
- **If the subject term is absent from CONTEXT.md, add it to CONTEXT.md first**,
|
|
62
|
+
then create the topic file. This keeps slugs stable and collision-free: two
|
|
63
|
+
contributors deciding the same subject land on the same slug rather than
|
|
64
|
+
competing for the next number.
|
|
65
|
+
|
|
66
|
+
## Frontmatter fields
|
|
67
|
+
|
|
68
|
+
Validated by `schemas/decision-record.schema.json`:
|
|
69
|
+
|
|
70
|
+
| Field | Required | Meaning |
|
|
71
|
+
| --- | --- | --- |
|
|
72
|
+
| `status` | yes | `current` \| `superseded` \| `merged` \| `needs-decision` (see [Status](#status-values)). |
|
|
73
|
+
| `subject` | yes | The decision subject, a CONTEXT.md vocabulary noun phrase. |
|
|
74
|
+
| `decided` | yes | ISO date `YYYY-MM-DD` the current decision was ratified. |
|
|
75
|
+
| `evidence[]` | yes | `{kind, ref}` links to durable provenance. Never a secret. |
|
|
76
|
+
| `supersedes[]` | no | Topic slugs whose subjects this file absorbed. |
|
|
77
|
+
| `superseded_by` | when superseded | The slug that now carries the answer. |
|
|
78
|
+
| `merged_into` | when merged | The slug this subject was folded into. |
|
|
79
|
+
|
|
80
|
+
### Status values
|
|
81
|
+
|
|
82
|
+
- **`current`** — this file holds the live answer for its subject. Must not
|
|
83
|
+
carry `superseded_by` or `merged_into`.
|
|
84
|
+
- **`superseded`** — a tombstone: the subject moved to a different topic slug
|
|
85
|
+
(renamed or split). Requires `superseded_by`.
|
|
86
|
+
- **`merged`** — a tombstone: the subject was folded into another topic. Requires
|
|
87
|
+
`merged_into`.
|
|
88
|
+
- **`needs-decision`** — a stub that names an open subject with no ratified answer
|
|
89
|
+
yet. It carries provenance `evidence[]` (e.g. the frozen ADR whose subject is
|
|
90
|
+
still open) but no live decision body. This value exists so ADR freeze tooling
|
|
91
|
+
(issue #314) can record that a frozen ADR's subject still needs a living
|
|
92
|
+
decision without inventing an answer. A `needs-decision` stub is not a
|
|
93
|
+
tombstone and must not carry `superseded_by`/`merged_into`.
|
|
94
|
+
|
|
95
|
+
### Evidence refs
|
|
96
|
+
|
|
97
|
+
Derivation context is LINKED, never inlined. Each `evidence[]` entry is
|
|
98
|
+
`{kind, ref}` where `kind` is one of `issue`, `pr`, `commit`, `session-archive`,
|
|
99
|
+
`adr`, `doc`, `url`:
|
|
100
|
+
|
|
101
|
+
- **`session-archive`** — a path to an archived session artifact (under
|
|
102
|
+
`.kontourai/`) promoted at retirement. Grilling/probe transcripts retire into
|
|
103
|
+
the session archive and are linked here as decision provenance.
|
|
104
|
+
- **`adr`** — a frozen numbered ADR under `docs/adr/` that is provenance for this
|
|
105
|
+
decision.
|
|
106
|
+
- **`issue`/`pr`/`commit`** — GitHub references (number, URL, or SHA).
|
|
107
|
+
- **`doc`/`url`** — a repository document path or external permalink.
|
|
108
|
+
|
|
109
|
+
`ref` values must never contain secret-shaped material (AWS access keys, GitHub
|
|
110
|
+
tokens, private-key blocks, JWTs, or `secret:`/`token:`-style literals). The
|
|
111
|
+
validator refuses them; link durable provenance, never a credential.
|
|
112
|
+
|
|
113
|
+
## Supersession by edit
|
|
114
|
+
|
|
115
|
+
The normal way a decision changes is: **edit the topic file in place.** Update
|
|
116
|
+
the body to the new decision, bump `decided`, and add an `evidence[]` ref to the
|
|
117
|
+
PR/issue that changed it. There is no second file, no appendix, and no
|
|
118
|
+
contradiction — the file always states exactly one current answer.
|
|
119
|
+
|
|
120
|
+
Example — the pre-edit file:
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
---
|
|
124
|
+
status: current
|
|
125
|
+
subject: Artifact retention window
|
|
126
|
+
decided: 2026-04-01
|
|
127
|
+
evidence:
|
|
128
|
+
- kind: pr
|
|
129
|
+
ref: https://github.com/kontourai/flow-agents/pull/120
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
# Artifact retention window
|
|
133
|
+
|
|
134
|
+
Runtime artifacts are retained for 30 days, then archived.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
After a later decision to shorten the window, the SAME file becomes:
|
|
138
|
+
|
|
139
|
+
```markdown
|
|
140
|
+
---
|
|
141
|
+
status: current
|
|
142
|
+
subject: Artifact retention window
|
|
143
|
+
decided: 2026-07-01
|
|
144
|
+
evidence:
|
|
145
|
+
- kind: pr
|
|
146
|
+
ref: https://github.com/kontourai/flow-agents/pull/120
|
|
147
|
+
- kind: pr
|
|
148
|
+
ref: https://github.com/kontourai/flow-agents/pull/305
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
# Artifact retention window
|
|
152
|
+
|
|
153
|
+
Runtime artifacts are retained for 14 days, then archived.
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The old answer is gone from the head; its provenance survives in the linked PRs.
|
|
157
|
+
|
|
158
|
+
## Tombstones: when a topic moves or merges
|
|
159
|
+
|
|
160
|
+
Editing covers a decision changing. The rarer case is a SUBJECT moving to a
|
|
161
|
+
different slug. Then the old file becomes a tombstone so inbound links and
|
|
162
|
+
retrieval still resolve.
|
|
163
|
+
|
|
164
|
+
### `superseded_by` — the subject moved to another slug
|
|
165
|
+
|
|
166
|
+
Use when a subject is renamed or split and its answer now lives under a different
|
|
167
|
+
slug. The old file:
|
|
168
|
+
|
|
169
|
+
```markdown
|
|
170
|
+
---
|
|
171
|
+
status: superseded
|
|
172
|
+
subject: Artifact retention window
|
|
173
|
+
decided: 2026-07-02
|
|
174
|
+
superseded_by: artifact-lifecycle
|
|
175
|
+
evidence:
|
|
176
|
+
- kind: pr
|
|
177
|
+
ref: https://github.com/kontourai/flow-agents/pull/330
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
# Artifact retention window
|
|
181
|
+
|
|
182
|
+
Superseded. The current decision for this subject lives in
|
|
183
|
+
[artifact-lifecycle](./artifact-lifecycle.md).
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### `merged_into` — the subject folded into an existing topic
|
|
187
|
+
|
|
188
|
+
Use when a subject is absorbed by another existing topic. The absorbed file:
|
|
189
|
+
|
|
190
|
+
```markdown
|
|
191
|
+
---
|
|
192
|
+
status: merged
|
|
193
|
+
subject: Artifact retention window
|
|
194
|
+
decided: 2026-07-02
|
|
195
|
+
merged_into: artifact-lifecycle
|
|
196
|
+
evidence:
|
|
197
|
+
- kind: pr
|
|
198
|
+
ref: https://github.com/kontourai/flow-agents/pull/330
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
# Artifact retention window
|
|
202
|
+
|
|
203
|
+
Merged into [artifact-lifecycle](./artifact-lifecycle.md).
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The surviving file may record what it absorbed with `supersedes: [artifact-retention-window]`.
|
|
207
|
+
|
|
208
|
+
Both tombstone forms require the target slug to exist (a validator error
|
|
209
|
+
otherwise) and must not point at their own slug.
|
|
210
|
+
|
|
211
|
+
## Retrieval-at-write
|
|
212
|
+
|
|
213
|
+
Before recording a decision, **consult `docs/decisions/index.md`** (the
|
|
214
|
+
always-loaded slug + one-liner index) and decide **revise-vs-create**:
|
|
215
|
+
|
|
216
|
+
1. If an existing topic covers the subject, **revise that file** (edit in place,
|
|
217
|
+
or tombstone + move if the subject itself is changing identity).
|
|
218
|
+
2. If no topic covers it, confirm the subject noun exists in CONTEXT.md (add it
|
|
219
|
+
if absent), then **create** `docs/decisions/<slug>.md`.
|
|
220
|
+
|
|
221
|
+
This retrieval-at-write step, plus a health check at rest (the validator + index
|
|
222
|
+
freshness in CI), is sufficient at this cardinality; no embeddings or semantic
|
|
223
|
+
topic matching are required.
|
|
224
|
+
|
|
225
|
+
## Index
|
|
226
|
+
|
|
227
|
+
`docs/decisions/index.md` is generated by `npm run gen:decisions-index`
|
|
228
|
+
(`scripts/check-decisions.cjs gen-index`). It is deterministic and idempotent: a
|
|
229
|
+
second run with no topic change is diff-clean. It lists each topic slug, its
|
|
230
|
+
status, and a one-line summary (the `subject`, falling back to the first body
|
|
231
|
+
line). Do not edit it by hand. `npm run check:decisions` fails if the index is
|
|
232
|
+
missing or stale, so CI catches an out-of-date index.
|
|
233
|
+
|
|
234
|
+
The index is referenced from `CONTEXT.md` so retrieval-at-write always has a
|
|
235
|
+
cheap, loaded pointer into the registry.
|
|
236
|
+
|
|
237
|
+
## Validation
|
|
238
|
+
|
|
239
|
+
`npm run check:decisions` (wired into the required `source-and-static` CI lane)
|
|
240
|
+
exits nonzero on any of:
|
|
241
|
+
|
|
242
|
+
- invalid frontmatter (missing `status`/`subject`/`decided`/`evidence`);
|
|
243
|
+
- unknown `status`;
|
|
244
|
+
- a secret-shaped `evidence[].ref`;
|
|
245
|
+
- a `superseded_by`/`merged_into`/`supersedes` slug that points at a missing
|
|
246
|
+
topic file;
|
|
247
|
+
- a status/relationship mismatch (e.g. `current` carrying a tombstone field, or
|
|
248
|
+
`superseded` without `superseded_by`);
|
|
249
|
+
- a stale or missing `docs/decisions/index.md`.
|
|
250
|
+
|
|
251
|
+
## Relationship to ADRs and grill-with-docs
|
|
252
|
+
|
|
253
|
+
- **CONTEXT.md is the only external compatibility surface.** Grill-with-docs
|
|
254
|
+
interop reads the domain vocabulary from CONTEXT.md; the registry keys its
|
|
255
|
+
slugs off that same vocabulary. We inherit the grill-with-docs behavior, not
|
|
256
|
+
the numbered-ADR file format.
|
|
257
|
+
- **Numbered ADRs (`docs/adr/NNNN-*.md`) are frozen history.** They are never
|
|
258
|
+
written for new decisions and are never converted into topic files. Existing
|
|
259
|
+
ADRs are frozen-and-indexed by separate tooling (issue #314); a topic file may
|
|
260
|
+
cite a frozen ADR via an `adr` evidence ref as provenance.
|
|
261
|
+
|
|
262
|
+
The pilot record self-hosting this contract is
|
|
263
|
+
[docs/decisions/decision-records.md](../../docs/decisions/decision-records.md).
|
|
@@ -59,7 +59,7 @@ After CI passes and the work is merged, released, or otherwise accepted:
|
|
|
59
59
|
- [ ] working artifacts archived or linked
|
|
60
60
|
- [ ] long-lived docs updated with why and how the feature was built
|
|
61
61
|
- [ ] durable docs link back to the provider record, archived plan, or session artifact when useful
|
|
62
|
-
- [ ] local `.flow-agents/` runtime artifacts remain untracked, and durable outcomes are promoted before merge to `main`
|
|
62
|
+
- [ ] local `.kontourai/flow-agents/` runtime artifacts remain untracked, and durable outcomes are promoted before merge to `main`
|
|
63
63
|
- [ ] follow-up issues or learning-review items created for deferred work
|
|
64
64
|
- [ ] **workspace cleaned up after a confirmed merge**: the merge is verified from the provider's own merge record (a merge commit / `mergedAt`), not a green check or a command exit code; then the isolated worktree is removed and the now-merged branch is deleted locally and on the remote, honoring the `worktree_lifecycle` (`retain_until: pr_merged`) recorded at selection. Never delete a branch or worktree before the merge is confirmed. A delivery is not complete while it leaves a stale worktree or merged branch behind.
|
|
65
65
|
|
|
@@ -23,7 +23,7 @@ Also create or update structured sidecars beside the Markdown artifacts:
|
|
|
23
23
|
Use the sidecar writer when available:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npm run workflow:sidecar -- init-plan .flow-agents/<slug>/<slug>--deliver.md \
|
|
26
|
+
npm run workflow:sidecar -- init-plan .kontourai/flow-agents/<slug>/<slug>--deliver.md \
|
|
27
27
|
--source-request "<original request>" \
|
|
28
28
|
--summary "<planning summary>" \
|
|
29
29
|
--next-action "<next execution step>"
|
|
@@ -79,6 +79,7 @@ The plan body must include:
|
|
|
79
79
|
- Preserve stable requirement and acceptance ids from upstream backlog issues when they exist; otherwise create stable ids in the plan before execution.
|
|
80
80
|
- Every implementation task must map back to the acceptance criteria it supports.
|
|
81
81
|
- 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.
|
|
82
|
+
- 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
83
|
- 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
84
|
- The Definition Of Done is the stop condition, not a decorative section.
|
|
84
85
|
- If the goal is exploratory or uncertain, define what the user should be able to take away from the work.
|
|
@@ -78,10 +78,12 @@ If a perspective is required but cannot be reviewed, record it as `not_verified`
|
|
|
78
78
|
|
|
79
79
|
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
80
|
|
|
81
|
+
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.
|
|
82
|
+
|
|
81
83
|
Prefer the sidecar writer when available:
|
|
82
84
|
|
|
83
85
|
```bash
|
|
84
|
-
npm run workflow:sidecar -- record-critique .flow-agents/<slug> \
|
|
86
|
+
npm run workflow:sidecar -- record-critique .kontourai/flow-agents/<slug> \
|
|
85
87
|
--id code-review \
|
|
86
88
|
--reviewer tool-code-reviewer \
|
|
87
89
|
--verdict pass \
|
|
@@ -91,8 +93,8 @@ npm run workflow:sidecar -- record-critique .flow-agents/<slug> \
|
|
|
91
93
|
For Markdown reviewer reports, import them when possible:
|
|
92
94
|
|
|
93
95
|
```bash
|
|
94
|
-
npm run workflow:sidecar -- import-critique .flow-agents/<slug> \
|
|
95
|
-
.flow-agents/<slug>/<slug>--code-review.md \
|
|
96
|
+
npm run workflow:sidecar -- import-critique .kontourai/flow-agents/<slug> \
|
|
97
|
+
.kontourai/flow-agents/<slug>/<slug>--code-review.md \
|
|
96
98
|
--reviewer tool-code-reviewer
|
|
97
99
|
```
|
|
98
100
|
|
|
@@ -14,6 +14,14 @@ Verification is report-only. It proves whether the implementation satisfies the
|
|
|
14
14
|
|
|
15
15
|
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
16
|
|
|
17
|
+
## Writing Evidence Through The Sidecar Writer
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
## Mutation Testing Runs In A Scratch Copy
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
17
25
|
## Verification Phases
|
|
18
26
|
|
|
19
27
|
Attempt relevant phases and record evidence:
|
|
@@ -77,7 +85,7 @@ When verification runs as part of a workflow, write or update `evidence.json` be
|
|
|
77
85
|
Use the sidecar writer when available:
|
|
78
86
|
|
|
79
87
|
```bash
|
|
80
|
-
npm run workflow:sidecar -- record-evidence .flow-agents/<slug> \
|
|
88
|
+
npm run workflow:sidecar -- record-evidence .kontourai/flow-agents/<slug> \
|
|
81
89
|
--verdict pass \
|
|
82
90
|
--check-json '{"id":"tests","kind":"test","status":"pass","summary":"Relevant checks passed."}'
|
|
83
91
|
```
|
|
@@ -176,7 +176,7 @@ GitHub is the first concrete mapping for this contract, not the generic vocabula
|
|
|
176
176
|
| `related_links` | Issue links, closing references, discussions, docs, and cross-references. |
|
|
177
177
|
| `source_provider` | `github`, repository owner/name, issue number, node id, and issue URL. |
|
|
178
178
|
| `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. |
|
|
179
|
+
| `artifact_refs` | `.kontourai/flow-agents/<slug>/` artifacts, plan/review/evidence links, and promoted docs referenced from the issue or workflow. |
|
|
180
180
|
|
|
181
181
|
### GitHub Projects as `BoardProvider`
|
|
182
182
|
|
|
@@ -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
|