@kontourai/flow-agents 2.4.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.
Files changed (89) hide show
  1. package/.github/CODEOWNERS +8 -0
  2. package/.github/workflows/ci.yml +12 -0
  3. package/.github/workflows/trust-reconcile.yml +62 -4
  4. package/CHANGELOG.md +23 -0
  5. package/CONTEXT.md +21 -0
  6. package/build/src/cli/assignment-provider.d.ts +1 -0
  7. package/build/src/cli/assignment-provider.js +748 -0
  8. package/build/src/cli/effective-assignment-provider-settings.d.ts +1 -0
  9. package/build/src/cli/effective-assignment-provider-settings.js +125 -0
  10. package/build/src/cli/validate-workflow-artifacts.js +5 -1
  11. package/build/src/cli/workflow-sidecar.js +157 -110
  12. package/build/src/cli.js +6 -0
  13. package/build/src/tools/validate-source-tree.js +1 -0
  14. package/context/contracts/artifact-contract.md +2 -0
  15. package/context/contracts/assignment-provider-contract.md +239 -0
  16. package/context/contracts/builder-kit-workflow-state-contract.md +2 -0
  17. package/context/contracts/decision-registry-contract.md +2 -0
  18. package/context/contracts/delivery-contract.md +2 -0
  19. package/context/contracts/execution-contract.md +25 -0
  20. package/context/contracts/governance-adapter-contract.md +2 -0
  21. package/context/contracts/knowledge-store-contract.md +197 -0
  22. package/context/contracts/planning-contract.md +2 -0
  23. package/context/contracts/review-contract.md +2 -0
  24. package/context/contracts/sandbox-policy.md +2 -0
  25. package/context/contracts/standing-directives.md +13 -0
  26. package/context/contracts/verification-contract.md +2 -0
  27. package/context/contracts/work-item-contract.md +2 -0
  28. package/context/settings/assignment-provider-settings.json +33 -0
  29. package/docs/adr/0022-fail-closed-delivery-reconciliation-with-governed-exemptions.md +180 -0
  30. package/docs/context-map.md +1 -0
  31. package/docs/decisions/index.md +3 -0
  32. package/docs/decisions/knowledge-store-provider.md +51 -0
  33. package/docs/decisions/model-routing.md +63 -0
  34. package/docs/decisions/standing-directives.md +66 -0
  35. package/docs/fixture-ownership.md +1 -0
  36. package/docs/workflow-shared-contracts.md +2 -1
  37. package/docs/workflow-usage-guide.md +6 -0
  38. package/evals/ci/run-baseline.sh +6 -0
  39. package/evals/fixtures/assignment-provider/actor-a.json +6 -0
  40. package/evals/fixtures/assignment-provider/actor-b.json +6 -0
  41. package/evals/fixtures/assignment-provider/github-issue-claimed.json +27 -0
  42. package/evals/fixtures/assignment-provider/github-issue-unassigned.json +7 -0
  43. package/evals/fixtures/assignment-provider/liveness-fresh.json +9 -0
  44. package/evals/fixtures/assignment-provider/liveness-stale.json +9 -0
  45. package/evals/integration/test_assignment_provider_github.sh +318 -0
  46. package/evals/integration/test_assignment_provider_local_file.sh +222 -0
  47. package/evals/integration/test_critique_supersession_roundtrip.sh +182 -0
  48. package/evals/integration/test_fixture_retirement_audit.sh +2 -2
  49. package/evals/integration/test_publish_delivery.sh +21 -4
  50. package/evals/integration/test_pull_work_assignment_join.sh +132 -0
  51. package/evals/integration/test_pull_work_liveness_preflight.sh +14 -6
  52. package/evals/integration/test_reconcile_soundness.sh +33 -9
  53. package/evals/integration/test_trust_reconcile.sh +9 -8
  54. package/evals/integration/test_trust_reconcile_negatives.sh +608 -0
  55. package/evals/integration/test_workflow_sidecar_writer.sh +79 -0
  56. package/evals/run.sh +10 -0
  57. package/evals/static/test_flowdef_codeowners_coverage.sh +6 -0
  58. package/evals/static/test_knowledge_providers.sh +23 -0
  59. package/kits/builder/skills/deliver/SKILL.md +19 -0
  60. package/kits/builder/skills/pull-work/SKILL.md +78 -10
  61. package/kits/knowledge/kit.json +35 -0
  62. package/kits/knowledge/providers/conformance/fixtures/git-repo/CONTEXT.md +12 -0
  63. package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/old-sprocket-shape.md +13 -0
  64. package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/sprocket-shape.md +14 -0
  65. package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/decisions/widget-format.md +14 -0
  66. package/kits/knowledge/providers/conformance/fixtures/git-repo/docs/learnings/fixture-learning.md +7 -0
  67. package/kits/knowledge/providers/conformance/fixtures/work-item/issues.json +30 -0
  68. package/kits/knowledge/providers/conformance/suite.test.js +125 -0
  69. package/kits/knowledge/providers/git-repo/index.js +236 -0
  70. package/kits/knowledge/providers/health/health-pass.test.js +99 -0
  71. package/kits/knowledge/providers/health/index.js +153 -0
  72. package/kits/knowledge/providers/index.js +24 -0
  73. package/kits/knowledge/providers/lib/model.js +91 -0
  74. package/kits/knowledge/providers/lib/schema-validate.js +119 -0
  75. package/kits/knowledge/providers/markdown-vault/index.js +169 -0
  76. package/kits/knowledge/providers/work-item/index.js +204 -0
  77. package/package.json +4 -2
  78. package/schemas/assignment-provider-settings.schema.json +125 -0
  79. package/schemas/knowledge/edge.schema.json +54 -0
  80. package/schemas/knowledge/health-report.schema.json +45 -0
  81. package/schemas/knowledge/node.schema.json +49 -0
  82. package/schemas/knowledge/proposal.schema.json +53 -0
  83. package/scripts/ci/trust-reconcile.js +521 -24
  84. package/src/cli/assignment-provider.ts +845 -0
  85. package/src/cli/effective-assignment-provider-settings.ts +112 -0
  86. package/src/cli/validate-workflow-artifacts.ts +5 -1
  87. package/src/cli/workflow-sidecar.ts +147 -106
  88. package/src/cli.ts +6 -0
  89. package/src/tools/validate-source-tree.ts +1 -0
@@ -13,6 +13,14 @@
13
13
  /evals/ci/ @briananderson1222
14
14
  /scripts/ci/ @briananderson1222
15
15
 
16
+ # delivery/DECLARED (ADR 0022 §2) is the no-agent-delivery exemption marker
17
+ # trust-reconcile.js reads to skip Step 2 when no bundle is delivered — a
18
+ # self-asserted governance artifact naming approved_by, so it gets the same
19
+ # owner-review protection as the other verify-config/anchor paths above. This
20
+ # closes #301's file-level half; branch-protection enforcement of CODEOWNERS
21
+ # review itself remains #225 (server-side, not code).
22
+ /delivery/DECLARED @briananderson1222
23
+
16
24
  # The verification config the CI anchor depends on — an agent must not redefine
17
25
  # trust-reconcile-verify to a fake/laundered command or rewire the lane runner
18
26
  # without owner review (convergence red-team finding).
@@ -149,6 +149,18 @@ jobs:
149
149
  continue-on-error: true
150
150
  run: bash evals/ci/run-baseline.sh --check actor-identity-resolver-integration
151
151
 
152
+ - name: Assignment provider local-file integration
153
+ continue-on-error: true
154
+ run: bash evals/ci/run-baseline.sh --check assignment-provider-local-file-integration
155
+
156
+ - name: Assignment provider github integration
157
+ continue-on-error: true
158
+ run: bash evals/ci/run-baseline.sh --check assignment-provider-github-integration
159
+
160
+ - name: Pull work assignment join integration
161
+ continue-on-error: true
162
+ run: bash evals/ci/run-baseline.sh --check pull-work-assignment-join-integration
163
+
152
164
  - name: Finalize CI evidence
153
165
  if: always()
154
166
  run: bash evals/ci/run-baseline.sh --finalize
@@ -27,12 +27,41 @@
27
27
  # The agent cannot self-declare success here: it cannot modify the CI environment,
28
28
  # pre-disable this job, or post-forge results after the check runs.
29
29
  #
30
- # THIS JOB IS INTENDED TO BE A REQUIRED STATUS CHECK (branch protection).
31
- # Enabling it as required is a server-side GitHub branch-protection configuration
32
- # step it is not wired here by code. Once required, no PR can merge past it.
30
+ # THIS JOB IS ALREADY A REQUIRED, ADMIN-ENFORCED STATUS CHECK on main (verified via
31
+ # `gh api repos/kontourai/flow-agents/branches/main/protection`: "Trust Reconcile" is in
32
+ # required_status_checks.contexts, enforce_admins.enabled: true). No PR including from
33
+ # admins — can merge past a failing run. Disabling/relaxing this requires a server-side
34
+ # branch-protection change (GitHub UI/API), not a code change in this repo.
33
35
  #
34
36
  # Additive — NOT a gate-hook change. Does not modify scripts/hooks/*, kits/knowledge,
35
37
  # or continue-work. Mirrors the structure of .github/workflows/ci.yml.
38
+ #
39
+ # CI-context contract for the bundle-ownership staleness check (ADR 0022 addendum, part
40
+ # 2; scripts/ci/trust-reconcile.js bundleAttestsThisChange()): an auto-discovered bundle
41
+ # is treated as owned only if its checkpoint's commit_sha is a git-ancestor of (or equal
42
+ # to) this change's own commit sha, checked via `git merge-base --is-ancestor`. That
43
+ # check requires TWO things this workflow provides deliberately, not by accident:
44
+ # 1. Checkout step below uses `fetch-depth: 0` (full history) — the default
45
+ # fetch-depth: 1 (shallow clone) lacks the parent commit objects merge-base needs;
46
+ # an ancestor check against a shallow clone exits 128 (unresolvable), which
47
+ # correctly fails CLOSED (treated as stale) per trust-reconcile.js's own
48
+ # fail-closed-on-ambiguity contract, but would falsely stale EVERY legitimate
49
+ # fresh bundle on this required check without full history.
50
+ # 2. Trust reconcile step below sets TRUST_RECONCILE_SHA to the PR's own HEAD commit
51
+ # (github.event.pull_request.head.sha), not github.sha — on a pull_request trigger,
52
+ # github.sha is GitHub's synthetic merge commit (refs/pull/N/merge), which is NOT
53
+ # the commit a locally-run seal-checkpoint ever stamps as commit_sha (checkpoints
54
+ # are always sealed against a real branch commit). Falling back to github.sha only
55
+ # applies on push/workflow_dispatch, where it IS the real commit. The checkout ref
56
+ # itself is unchanged — Step 1 (fresh verify) still runs against the same tree it
57
+ # always has; only the identity used for the OWNERSHIP COMPARISON changes.
58
+ # 3. Trust reconcile step below also sets TRUST_RECONCILE_EVENT to github.event_name so
59
+ # trust-reconcile.js can event-scope bundle-required enforcement (ADR 0022 addendum,
60
+ # part 4): a push run on `main` (post-merge, after a squash-merge whose commit has no
61
+ # git ancestry back to the feature-branch commit a checkpoint was sealed against) is
62
+ # a loud no-op on Step 2 instead of a false failure — gating already happened on the
63
+ # PR run. This does NOT weaken PR-time gating: on pull_request, enforcement is
64
+ # unchanged.
36
65
 
37
66
  name: Trust Reconcile
38
67
 
@@ -63,6 +92,13 @@ jobs:
63
92
  steps:
64
93
  - name: Checkout
65
94
  uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
95
+ with:
96
+ # Full history (not the default shallow fetch-depth: 1): the bundle-ownership
97
+ # staleness check (ADR 0022 addendum, part 2) resolves `git merge-base
98
+ # --is-ancestor` against the checked-out repo, which needs parent commit
99
+ # objects a shallow clone does not have. See the CI-context contract note
100
+ # above this job.
101
+ fetch-depth: 0
66
102
 
67
103
  - name: Set up Node.js
68
104
  uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
@@ -80,6 +116,23 @@ jobs:
80
116
  - name: Trust reconcile
81
117
  id: trust-reconcile
82
118
  run: node scripts/ci/trust-reconcile.js
119
+ env:
120
+ # The change identity the bundle-ownership staleness check compares the
121
+ # discovered checkpoint's commit_sha against (ADR 0022 addendum, part 2). On a
122
+ # pull_request trigger, github.sha is GitHub's synthetic merge commit, not a
123
+ # commit any real seal-checkpoint run ever stamps — so this MUST be the PR's
124
+ # own head sha. On push/workflow_dispatch there is no pull_request context, and
125
+ # github.sha already is the real commit, so the fallback is exact, not a guess.
126
+ # This does NOT change what gets checked out/verified (Step 1 fresh verify is
127
+ # untouched) — only the sha used for the Step-2-ownership comparison.
128
+ TRUST_RECONCILE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
129
+ # Event-scoped enforcement (ADR 0022 addendum, part 4): lets trust-reconcile.js
130
+ # tell a gating pull_request run apart from a post-merge push run on `main` — a
131
+ # push run's bundle is expected to be absent/stale (squash-merge commits have no
132
+ # ancestry back to the feature-branch sha a checkpoint was sealed against) and
133
+ # must be a no-op, not a failure. Unset/unrecognized values fail toward the
134
+ # STRICTER (pull_request-shaped) enforcement — see resolveEnforcementEvent().
135
+ TRUST_RECONCILE_EVENT: ${{ github.event_name }}
83
136
  # Canonical verify: auto-discovered from package.json scripts["trust-reconcile-verify"]
84
137
  # = npm run build && npm run eval:static
85
138
  # (integration + the anti-gaming regression suite run in ci.yml's required
@@ -88,7 +141,12 @@ jobs:
88
141
  # compile-only check. Override via TRUST_RECONCILE_COMMANDS or --commands if needed.
89
142
  # Bundle auto-discovery: if delivery/trust.bundle or delivery/trust.checkpoint.json
90
143
  # exists in the checkout, CI reconciles per-command claimed passes against fresh
91
- # results automatically. When absent, only the fresh verify is enforced (fail-open).
144
+ # results automatically. When absent, a bundle is REQUIRED by default (ADR 0022 §1):
145
+ # the job fails closed unless a well-formed, in-scope delivery/DECLARED
146
+ # no-agent-delivery marker is present, which exempts Step 2 (reconcile) only —
147
+ # Step 1 (fresh verify) still always runs. An auto-discovered bundle/checkpoint
148
+ # that does not attest THIS change (see the CI-context contract note above this
149
+ # job) is treated the same as absent (ADR 0022 addendum, part 2).
92
150
  # Phase 2: on success, writes ci-trust-reconcile-results.json to RUNNER_TEMP
93
151
  # for mint-attestation.js to consume.
94
152
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.0.0](https://github.com/kontourai/flow-agents/compare/v2.4.0...v3.0.0) (2026-07-04)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * **trust:** require origin/check_kind stamps — remove pre-supersession read fallback ([#355](https://github.com/kontourai/flow-agents/issues/355))
9
+
10
+ ### Features
11
+
12
+ * **routing:** model-routing policy as datum roles — orchestrator resolves at delegation ([#365](https://github.com/kontourai/flow-agents/issues/365)) ([7acf663](https://github.com/kontourai/flow-agents/commit/7acf6635125623505097eb0f7d2b0da7026c1b00))
13
+ * **trust-anchor:** fail-closed delivery reconciliation with governed exemptions (ADR 0022 §1) ([#358](https://github.com/kontourai/flow-agents/issues/358)) ([0631050](https://github.com/kontourai/flow-agents/commit/0631050c7d88f3dd38d7c90ee1af5adf63410334))
14
+
15
+
16
+ ### Fixes
17
+
18
+ * **trust:** critique supersession + lossless check/critique round-trip (closes [#267](https://github.com/kontourai/flow-agents/issues/267), [#268](https://github.com/kontourai/flow-agents/issues/268), [#282](https://github.com/kontourai/flow-agents/issues/282)) ([#344](https://github.com/kontourai/flow-agents/issues/344)) ([c2c3fd5](https://github.com/kontourai/flow-agents/commit/c2c3fd5d322d2537847d67a6fefc6daae6893070))
19
+ * **trust:** require origin/check_kind stamps — remove pre-supersession read fallback ([#355](https://github.com/kontourai/flow-agents/issues/355)) ([ab27f71](https://github.com/kontourai/flow-agents/commit/ab27f71ac1ee652b7125ce01336895d34162472b))
20
+
21
+
22
+ ### Documentation
23
+
24
+ * **contracts:** standing owner directives — durable home for ratified policy ([#351](https://github.com/kontourai/flow-agents/issues/351)) ([e335d54](https://github.com/kontourai/flow-agents/commit/e335d540378ba7eaae5bb7162427d8db16f58e4b))
25
+
3
26
  ## [2.4.0](https://github.com/kontourai/flow-agents/compare/v2.3.0...v2.4.0) (2026-07-03)
4
27
 
5
28
 
package/CONTEXT.md CHANGED
@@ -56,6 +56,16 @@ A configured implementation of a capability, such as GitHub for backlog, Obsidia
56
56
 
57
57
  The declared capabilities, defaults, conventions, and limits of a provider type. Provider contracts make integrations predictable and testable without requiring the live provider.
58
58
 
59
+ ### Knowledge Graph
60
+
61
+ The Knowledge Kit's storage-independent model: typed nodes (recommended core: note, decision, issue, session, person — extensible) and typed edges (supersedes, merged-into, blocks, evidence-of, mentions, relates — a closed vocabulary), each carrying provenance so every assertion is traceable to the store it came from. Storage and synchronisation are provider concerns; the same ingest, link, and health verbs run over every provider.
62
+ _Avoid_: Graph database as the generic term (the model is provider-independent; a graph-database provider is a separate spike)
63
+
64
+ ### Knowledge Store Provider
65
+
66
+ A configured implementation of the knowledge-store capability behind the Knowledge Graph model. Providers expose a read interface (nodes, edges, query-by-type) and a proposals-only write interface (proposeWrite returns a proposal, never mutating a human-curated store). The reference providers are markdown-vault (the Obsidian-shaped vault), git-repo (decision registry, CONTEXT.md vocabulary, learnings), and work-item (GitHub issues as a source/sink adapter). See context/contracts/knowledge-store-contract.md.
67
+ _Avoid_: Knowledge adapter when contrasting the provider interface with a single store adapter
68
+
59
69
  ### Kontour Resource Contract
60
70
 
61
71
  A versioned Kontour record shape for durable machine-readable configuration, scope, run state, evidence, provider output, and cross-product interchange. Kontour Resource Contracts are the default for new pre-public durable contracts unless a product records why a native shape is clearer.
@@ -265,6 +275,11 @@ _Avoid_: Numbered ADR as the format for new decisions
265
275
 
266
276
  The system of Decision Records plus the generated index at [docs/decisions/index.md](docs/decisions/index.md) (slug + one-line summary). The contract is [context/contracts/decision-registry-contract.md](context/contracts/decision-registry-contract.md); the frontmatter schema is `schemas/decision-record.schema.json`; `npm run check:decisions` validates it. Consult the index at write time to decide revise-vs-create.
267
277
 
278
+ ### Standing Directives
279
+
280
+ A short, numbered, quotable list of ratified owner directives, each with a one-line rationale and date, kept at [context/contracts/standing-directives.md](context/contracts/standing-directives.md) and pointed to from the header of every other contract file in `context/contracts/`. Standing Directives override default engineering conservatism (such as keeping a compatibility path "just in case") wherever they apply; they exist so a ratified correction has a durable home instead of living only in the ephemeral context of the orchestrator session that ratified it.
281
+ _Avoid_: Operating discipline as the generic term for owner-ratified policy, restating a directive from memory instead of citing the file
282
+
268
283
  ### Promotion Gate
269
284
 
270
285
  The gated sequence — final acceptance -> promote -> archive — that makes durable-residue extraction the archival act: a delivered session's decisions, vocabulary, learnings, and doc updates must be promoted into durable living docs before the session is archived. The `promote` step records what was promoted where and writes a session-local **promotion claim** into the session `trust.bundle` (evidence refs = the durable doc paths written, or an explicit `--none` no-residue reason). `workflow-artifact-cleanup-audit` classifies a delivered/accepted session with no promotion claim as a cleanup candidate (archive blocked), not terminal. See [docs/decisions/promotion-gate.md](docs/decisions/promotion-gate.md) and [docs/workflow-artifact-lifecycle.md](docs/workflow-artifact-lifecycle.md).
@@ -312,3 +327,9 @@ The Console overview for global setup, registered projects, cross-project usage,
312
327
  ### Control API
313
328
 
314
329
  The shared tool layer used by the Console, CLI, AI agents, and automation. The Control API owns operations such as reading effective settings, explaining provider resolution, testing provider health, previewing config changes, writing config, inspecting workflow state, and reporting usage or eval outcomes.
330
+
331
+ ### Model Routing
332
+
333
+ The policy that maps a delegate role name (such as `delegate-mechanical`, `delegate-implementation`, `delegate-design`, `orchestrator`, `extraction-default`) to a specific `model@provider` ref. Model Routing is data, not code: it lives in `.datum/config.json` (read by the `@kontourai/datum` registry, schema `datum.schema.json`) and never in generated files or per-agent frontmatter. The orchestrator resolves the role at delegation time (`datum resolve <role> --json`) and passes the resolved model explicitly when spawning each delegate. See [context/contracts/execution-contract.md](context/contracts/execution-contract.md) § Delegation: Model Routing and [docs/decisions/model-routing.md](docs/decisions/model-routing.md).
334
+ _Avoid_: Generated per-agent model frontmatter, environment-variable-only model selection
335
+
@@ -0,0 +1 @@
1
+ export declare function main(argv?: string[]): number;