@kontourai/flow-agents 3.2.0 → 3.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/workflows/add-to-project.yml +15 -0
- package/.github/workflows/ci.yml +173 -0
- package/CHANGELOG.md +54 -0
- package/CONTEXT.md +5 -1
- package/README.md +19 -8
- package/build/src/builder-flow-run-adapter.d.ts +80 -0
- package/build/src/builder-flow-run-adapter.js +241 -0
- package/build/src/builder-flow-runtime.d.ts +16 -0
- package/build/src/builder-flow-runtime.js +290 -0
- package/build/src/cli/assignment-provider.js +10 -1
- package/build/src/cli/builder-run.d.ts +1 -0
- package/build/src/cli/builder-run.js +27 -0
- package/build/src/cli/effective-backlog-settings.js +70 -2
- package/build/src/cli/init.d.ts +34 -0
- package/build/src/cli/init.js +341 -61
- package/build/src/cli/kit.js +55 -12
- package/build/src/cli/pull-work-provider.js +346 -5
- package/build/src/cli/skill-drift-check.d.ts +1 -0
- package/build/src/cli/skill-drift-check.js +165 -0
- package/build/src/cli/telemetry-doctor.d.ts +37 -0
- package/build/src/cli/telemetry-doctor.js +53 -6
- package/build/src/cli/validate-hook-influence.js +37 -7
- package/build/src/cli/workflow-artifact-cleanup-audit.js +418 -11
- package/build/src/cli/workflow-sidecar.d.ts +310 -1
- package/build/src/cli/workflow-sidecar.js +1914 -126
- package/build/src/cli.js +5 -0
- package/build/src/flow-kit/validate.d.ts +54 -34
- package/build/src/flow-kit/validate.js +237 -26
- package/build/src/index.d.ts +2 -0
- package/build/src/index.js +1 -0
- package/build/src/lib/console-connect-options.d.ts +97 -0
- package/build/src/lib/console-connect-options.js +199 -0
- package/build/src/lib/console-telemetry-validate.d.ts +49 -0
- package/build/src/lib/console-telemetry-validate.js +91 -0
- package/build/src/lib/flow-resolver.d.ts +54 -1
- package/build/src/lib/flow-resolver.js +112 -5
- package/build/src/lib/fs.d.ts +17 -0
- package/build/src/lib/fs.js +172 -0
- package/build/src/lib/local-artifact-root.d.ts +44 -1
- package/build/src/lib/local-artifact-root.js +131 -3
- package/build/src/runtime-adapters.d.ts +39 -3
- package/build/src/runtime-adapters.js +77 -31
- package/build/src/tools/build-universal-bundles.js +40 -2
- package/build/src/tools/codex-agent-routing.d.ts +2 -0
- package/build/src/tools/codex-agent-routing.js +49 -0
- package/build/src/tools/generate-context-map.js +1 -0
- package/build/src/tools/validate-source-tree.js +30 -3
- package/context/contracts/artifact-contract.md +16 -2
- package/context/scripts/hooks/lib/kit-catalog.js +235 -0
- package/context/scripts/hooks/lib/runnable-command.js +177 -0
- package/context/scripts/hooks/stop-goal-fit.js +278 -48
- package/context/scripts/hooks/workflow-steering.js +194 -22
- package/context/scripts/package.json +3 -0
- package/context/scripts/telemetry/install-console-config.sh +25 -4
- package/context/scripts/telemetry/lib/config.sh +102 -12
- package/context/scripts/telemetry/lib/pricing.sh +50 -0
- package/context/scripts/telemetry/lib/session.sh +3 -0
- package/context/scripts/telemetry/lib/transport.sh +87 -0
- package/context/scripts/telemetry/lib/usage.sh +205 -4
- package/context/scripts/telemetry/telemetry.conf +6 -0
- package/context/scripts/telemetry/telemetry.sh +48 -0
- package/context/settings/workspace-backlog-provider-settings.example.json +48 -0
- package/docs/agent-usage-feedback-loop.md +35 -0
- package/docs/architecture-engine-and-kits.md +110 -0
- package/docs/context-map.md +2 -0
- package/docs/coordination-guide.md +370 -0
- package/docs/decisions/agent-coordination.md +26 -9
- package/docs/decisions/embeddable-engine.md +152 -0
- package/docs/decisions/index.md +5 -3
- package/docs/decisions/trust-ledger-retention.md +88 -0
- package/docs/decisions/trust-reconcile.md +42 -9
- package/docs/decisions/workflow-enforcement.md +31 -9
- package/docs/fixture-ownership.md +6 -2
- package/docs/implementing-trust-reconciliation.md +129 -0
- package/docs/index.md +23 -9
- package/docs/integrations/flow-agents-console.md +275 -0
- package/docs/integrations/index.md +4 -0
- package/docs/kit-authoring-guide.md +52 -21
- package/docs/spec/builder-flow-runtime.md +80 -0
- package/docs/spec/runtime-hook-surface.md +45 -1
- package/docs/specs/economics-record-contract.md +270 -0
- package/docs/specs/harness-capability-matrix.md +74 -0
- package/docs/specs/learning-review-proposals-contract.md +340 -0
- package/docs/specs/routing-efficiency-review.md +59 -0
- package/docs/verifiable-trust.md +74 -25
- package/docs/workflow-artifact-lifecycle.md +38 -1
- package/docs/workflow-usage-guide.md +10 -0
- package/evals/acceptance/prove-capture-teeth.sh +132 -0
- package/evals/ci/antigaming-suite.sh +2 -0
- package/evals/ci/run-baseline.sh +78 -4
- package/evals/fixtures/economics/acceptance.json +12 -0
- package/evals/fixtures/economics/agents/tool-worker-1/events.jsonl +2 -0
- package/evals/fixtures/economics/agents/tool-worker-2/events.jsonl +2 -0
- package/evals/fixtures/economics/agents/tool-worker-3/events.jsonl +2 -0
- package/evals/fixtures/economics/agents/tool-worker-4/events.jsonl +1 -0
- package/evals/fixtures/economics/agents/tool-worker-5/events.jsonl +2 -0
- package/evals/fixtures/economics/critique.json +22 -0
- package/evals/fixtures/economics/expected-record.json +71 -0
- package/evals/fixtures/economics/session-usage-event.json +1 -0
- package/evals/fixtures/economics/state.json +11 -0
- package/evals/fixtures/economics/transcript.jsonl +3 -0
- package/evals/fixtures/hook-influence/cases.json +7 -7
- package/evals/fixtures/learning-review-proposals/balanced/economics.jsonl +6 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/economics.jsonl +5 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-1/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-2/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-3/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-4/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/effect-follow-up/sessions/task-lr-ef-5/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/economics.jsonl +6 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.json +30 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/expected-aggregates.md +66 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-1/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-2/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-3/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/gate-review.inquiries.json +26 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-4/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-5/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/pattern-present/sessions/task-lr-pp-6/trust.bundle +21 -0
- package/evals/fixtures/learning-review-proposals/repeat-window/economics.jsonl +6 -0
- package/evals/fixtures/learning-review-proposals/under-threshold/economics.jsonl +3 -0
- package/evals/fixtures/reconcile-preflight/disputed-critique-unsuperseded.json +48 -0
- package/evals/fixtures/reconcile-preflight/standalone-disputed-session-local.json +59 -0
- package/evals/fixtures/telemetry/usage-transcript-sample.jsonl +4 -0
- package/evals/fixtures/trust-reconcile-exploits/mcp-degrade.json +42 -0
- package/evals/integration/test_builder_entry_enforcement.sh +241 -0
- package/evals/integration/test_builder_step_producers.sh +18 -10
- package/evals/integration/test_bundle_install.sh +172 -0
- package/evals/integration/test_checkpoint_signing.sh +10 -2
- package/evals/integration/test_ci_actor_identity.sh +221 -0
- package/evals/integration/test_console_tenant_isolation.sh +167 -0
- package/evals/integration/test_critique_supersession_roundtrip.sh +4 -1
- package/evals/integration/test_dual_emit_flow_step.sh +10 -4
- package/evals/integration/test_economics_record.sh +674 -0
- package/evals/integration/test_effective_backlog_settings.sh +1 -1
- package/evals/integration/test_evidence_capture_hook.sh +17 -2
- package/evals/integration/test_exemption_usage_review.sh +198 -0
- package/evals/integration/test_fixture_retirement_audit.sh +2 -2
- package/evals/integration/test_flow_kit_install_git.sh +83 -0
- package/evals/integration/test_flowdef_session_activation.sh +0 -1
- package/evals/integration/test_flowdef_session_history_preservation.sh +13 -3
- package/evals/integration/test_gate_lockdown.sh +7 -0
- package/evals/integration/test_gate_review_inquiry_records.sh +9 -1
- package/evals/integration/test_goal_fit_hook.sh +2031 -0
- package/evals/integration/test_hook_category_behaviors.sh +8 -1
- package/evals/integration/test_hook_influence_cases.sh +25 -1
- package/evals/integration/test_install_merge.sh +227 -2
- package/evals/integration/test_kit_conformance_levels.sh +6 -6
- package/evals/integration/test_learning_review_proposals.sh +329 -0
- package/evals/integration/test_liveness_conflict_injection.sh +26 -22
- package/evals/integration/test_liveness_console_relay.sh +166 -0
- package/evals/integration/test_liveness_heartbeat.sh +17 -17
- package/evals/integration/test_liveness_worktree_root.sh +575 -0
- package/evals/integration/test_phase_map_and_gate_claim.sh +6 -1
- package/evals/integration/test_publish_delivery.sh +389 -2
- package/evals/integration/test_pull_work_board.sh +200 -0
- package/evals/integration/test_pull_work_provider.sh +1 -1
- package/evals/integration/test_reconcile_preflight.sh +304 -0
- package/evals/integration/test_record_check.sh +378 -0
- package/evals/integration/test_routing_efficiency.sh +71 -0
- package/evals/integration/test_runtime_adapter_activation.sh +28 -0
- package/evals/integration/test_session_resume_roundtrip.sh +16 -19
- package/evals/integration/test_skill_drift_check.sh +870 -0
- package/evals/integration/test_takeover_protocol.sh +340 -0
- package/evals/integration/test_telemetry.sh +445 -0
- package/evals/integration/test_telemetry_doctor.sh +66 -0
- package/evals/integration/test_telemetry_usage_pipeline.sh +228 -0
- package/evals/integration/test_trust_reconcile_negatives.sh +121 -13
- package/evals/integration/test_trust_reconcile_trailer_diagnostic.sh +247 -0
- package/evals/integration/test_usage_cost.sh +61 -0
- package/evals/integration/test_verify_hold.sh +910 -0
- package/evals/integration/test_veritas_governance_kit.sh +257 -0
- package/evals/integration/test_workflow_artifact_cleanup_audit.sh +575 -3
- package/evals/integration/test_workflow_sidecar_writer.sh +1395 -0
- package/evals/integration/test_workflow_steering_hook.sh +157 -16
- package/evals/integration/test_workspace_settings.sh +176 -0
- package/evals/lib/env.sh +26 -0
- package/evals/lib/node.sh +8 -0
- package/evals/run.sh +37 -0
- package/evals/static/test_ci_integration_coverage.sh +115 -0
- package/evals/static/test_declared_scope_forms_documented.sh +114 -0
- package/evals/static/test_universal_bundles.sh +34 -0
- package/evals/static/test_validate_source_kit_asset_scope.sh +259 -0
- package/evals/static/test_workflow_skills.sh +1 -1
- package/kits/builder/flows/build.flow.json +9 -18
- package/kits/builder/flows/publish-learn.flow.json +5 -1
- package/kits/builder/kit.json +120 -0
- package/kits/builder/skills/continue-work/SKILL.md +2 -0
- package/kits/builder/skills/deliver/SKILL.md +115 -0
- package/kits/builder/skills/evidence-gate/SKILL.md +12 -0
- package/kits/builder/skills/execute-plan/SKILL.md +9 -0
- package/kits/builder/skills/learning-review/SKILL.md +51 -0
- package/kits/builder/skills/plan-work/SKILL.md +17 -20
- package/kits/builder/skills/pull-work/SKILL.md +33 -2
- package/kits/builder/skills/release-readiness/SKILL.md +12 -0
- package/kits/knowledge/kit.json +9 -0
- package/kits/veritas-governance/docs/README.md +113 -7
- package/kits/veritas-governance/fixtures/exemption/approved.trust-bundle.json +74 -0
- package/kits/veritas-governance/fixtures/exemption/not-approved.trust-bundle.json +74 -0
- package/kits/veritas-governance/fixtures/exemption-review/mixed-fresh-stale.DECLARED.json +14 -0
- package/kits/veritas-governance/flows/exemption-issuance.flow.json +35 -0
- package/kits/veritas-governance/kit.json +19 -0
- package/kits/veritas-governance/skills/exemption-usage-review/SKILL.md +128 -0
- package/kits/veritas-governance/skills/exemption-usage-review/review-exemptions.mjs +231 -0
- package/package.json +2 -2
- package/packaging/manifest.json +29 -0
- package/schemas/backlog-provider-settings.schema.json +13 -0
- package/schemas/workflow-state.schema.json +44 -0
- package/scripts/README.md +4 -0
- package/scripts/check-content-boundary.cjs +8 -1
- package/scripts/ci/trust-reconcile.js +214 -253
- package/scripts/hooks/codex-hook-adapter.js +77 -2
- package/scripts/hooks/evidence-capture.js +38 -5
- package/scripts/hooks/lib/actor-identity.js +82 -0
- package/scripts/hooks/lib/codex-exit-code.js +316 -0
- package/scripts/hooks/lib/kit-catalog.js +235 -0
- package/scripts/hooks/lib/liveness-write.js +28 -1
- package/scripts/hooks/lib/local-artifact-paths.js +97 -1
- package/scripts/hooks/lib/runnable-command.js +177 -0
- package/scripts/hooks/lib/skill-drift.js +350 -0
- package/scripts/hooks/stop-goal-fit.js +278 -48
- package/scripts/hooks/workflow-steering.js +194 -22
- package/scripts/install-codex-home.sh +97 -47
- package/scripts/install-merge.js +72 -14
- package/scripts/install-owned-files.js +178 -0
- package/scripts/lib/reconcile-shape.js +381 -0
- package/scripts/liveness/relay.sh +84 -0
- package/scripts/telemetry/economics-record.schema.json +145 -0
- package/scripts/telemetry/economics-record.sh +331 -0
- package/scripts/telemetry/install-console-config.sh +25 -4
- package/scripts/telemetry/learning-review-decide.sh +124 -0
- package/scripts/telemetry/learning-review-proposals.schema.json +161 -0
- package/scripts/telemetry/learning-review-proposals.sh +484 -0
- package/scripts/telemetry/lib/config.sh +102 -12
- package/scripts/telemetry/lib/pricing.sh +14 -6
- package/scripts/telemetry/lib/session.sh +3 -0
- package/scripts/telemetry/lib/transport.sh +133 -15
- package/scripts/telemetry/lib/usage.sh +121 -28
- package/scripts/telemetry/routing-efficiency.sh +0 -0
- package/scripts/telemetry/telemetry.conf +6 -0
- package/scripts/telemetry/telemetry.sh +48 -0
- package/src/builder-flow-run-adapter.ts +357 -0
- package/src/builder-flow-runtime.ts +348 -0
- package/src/cli/assignment-provider.ts +12 -1
- package/src/cli/builder-flow-run-adapter.test.mjs +495 -0
- package/src/cli/builder-flow-runtime.test.mjs +213 -0
- package/src/cli/builder-run.ts +28 -0
- package/src/cli/codex-agent-routing.test.mjs +44 -0
- package/src/cli/codex-exit-code.test.mjs +207 -0
- package/src/cli/console-connect-options.test.mjs +329 -0
- package/src/cli/console-telemetry-validate.test.mjs +157 -0
- package/src/cli/effective-backlog-settings.ts +68 -2
- package/src/cli/flow-resolver-composition.test.mjs +72 -0
- package/src/cli/init.test.mjs +161 -0
- package/src/cli/init.ts +407 -62
- package/src/cli/kit-metadata-security.test.mjs +443 -0
- package/src/cli/kit.ts +50 -12
- package/src/cli/pull-work-provider.ts +377 -3
- package/src/cli/sidecar-pure-helpers.test.mjs +64 -0
- package/src/cli/skill-drift-check.ts +196 -0
- package/src/cli/telemetry-doctor.test.mjs +53 -0
- package/src/cli/telemetry-doctor.ts +50 -7
- package/src/cli/validate-hook-influence.ts +37 -6
- package/src/cli/workflow-artifact-cleanup-audit.ts +483 -10
- package/src/cli/workflow-sidecar.ts +1980 -119
- package/src/cli.ts +5 -0
- package/src/flow-kit/validate.ts +277 -38
- package/src/index.ts +19 -0
- package/src/lib/console-connect-options.ts +261 -0
- package/src/lib/console-telemetry-validate.ts +88 -0
- package/src/lib/flow-resolver.ts +117 -4
- package/src/lib/fs.ts +160 -0
- package/src/lib/local-artifact-root.ts +129 -3
- package/src/runtime-adapters.ts +113 -33
- package/src/tools/build-universal-bundles.ts +36 -2
- package/src/tools/codex-agent-routing.ts +48 -0
- package/src/tools/generate-context-map.ts +1 -0
- package/src/tools/validate-source-tree.ts +29 -3
package/kits/builder/kit.json
CHANGED
|
@@ -27,6 +27,126 @@
|
|
|
27
27
|
"reason": "learning-review invokes knowledge-capture (kits/knowledge/skills/knowledge-capture/SKILL.md) for durable knowledge storage"
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
|
+
"first_party": true,
|
|
31
|
+
"workflow_triggers": [
|
|
32
|
+
{
|
|
33
|
+
"id": "builder-build-work",
|
|
34
|
+
"when": "implementation-work-detected",
|
|
35
|
+
"target_flow_id": "builder.build",
|
|
36
|
+
"default_skill": "deliver",
|
|
37
|
+
"conditional_skills": [
|
|
38
|
+
{
|
|
39
|
+
"when": "user-requested-tdd",
|
|
40
|
+
"skill": "tdd-workflow"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"required_sequence": ["plan-work", "execute-plan", "review-work", "verify-work"],
|
|
44
|
+
"post_verify_targets": ["release-readiness", "learning-review"]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"flow_step_actions": [
|
|
48
|
+
{
|
|
49
|
+
"flow_id": "builder.build",
|
|
50
|
+
"step_id": "pull-work",
|
|
51
|
+
"skills": ["pull-work"]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"flow_id": "builder.build",
|
|
55
|
+
"step_id": "design-probe",
|
|
56
|
+
"skills": ["pickup-probe"]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"flow_id": "builder.build",
|
|
60
|
+
"step_id": "plan",
|
|
61
|
+
"skills": ["plan-work"]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"flow_id": "builder.build",
|
|
65
|
+
"step_id": "execute",
|
|
66
|
+
"skills": ["execute-plan"]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"flow_id": "builder.build",
|
|
70
|
+
"step_id": "verify",
|
|
71
|
+
"skills": ["review-work", "verify-work"]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"flow_id": "builder.build",
|
|
75
|
+
"step_id": "merge-ready",
|
|
76
|
+
"skills": ["evidence-gate"]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"flow_id": "builder.build",
|
|
80
|
+
"step_id": "pr-open",
|
|
81
|
+
"skills": [],
|
|
82
|
+
"operations": ["publish-change"]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"flow_id": "builder.build",
|
|
86
|
+
"step_id": "merge-ready-ci",
|
|
87
|
+
"skills": ["release-readiness"]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"flow_id": "builder.build",
|
|
91
|
+
"step_id": "learn",
|
|
92
|
+
"skills": ["learning-review"]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"flow_id": "builder.build",
|
|
96
|
+
"step_id": "done",
|
|
97
|
+
"skills": []
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"hook_influence_expectations": [
|
|
101
|
+
{
|
|
102
|
+
"id": "dev-builder-build-requires-pickup-probe-before-plan",
|
|
103
|
+
"description": "missing pickup Probe before plan",
|
|
104
|
+
"tier": "design-target",
|
|
105
|
+
"must_include_guidance": [
|
|
106
|
+
"design-probe",
|
|
107
|
+
"accepted gaps",
|
|
108
|
+
"provider_state",
|
|
109
|
+
"conflict_risks"
|
|
110
|
+
],
|
|
111
|
+
"must_include_actions": [
|
|
112
|
+
"route decision_gap back to design-probe/pickup Probe"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "dev-builder-review-before-verify-after-execute",
|
|
117
|
+
"description": "review-before-verify after execute",
|
|
118
|
+
"tier": "adapter",
|
|
119
|
+
"event": "PostToolUse",
|
|
120
|
+
"must_include_guidance": [
|
|
121
|
+
"Next: review",
|
|
122
|
+
"then verify",
|
|
123
|
+
"report only"
|
|
124
|
+
],
|
|
125
|
+
"must_include_actions": [
|
|
126
|
+
"review-work for report-only critique before verify-work",
|
|
127
|
+
"not count critique.json as verification evidence"
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "dev-builder-route-fresh-coding-prompt",
|
|
132
|
+
"description": "fresh coding prompt routes into Builder workflow",
|
|
133
|
+
"tier": "adapter",
|
|
134
|
+
"event": "UserPromptSubmit",
|
|
135
|
+
"must_include_guidance": [
|
|
136
|
+
"KIT WORKFLOW ROUTE",
|
|
137
|
+
"activate `deliver`",
|
|
138
|
+
"--flow-id builder.build",
|
|
139
|
+
"plan-work -> execute-plan -> review-work -> verify-work",
|
|
140
|
+
"release-readiness and learning-review"
|
|
141
|
+
],
|
|
142
|
+
"must_include_actions": [
|
|
143
|
+
"use the `builder` kit's `builder.build` workflow before source edits",
|
|
144
|
+
"use deliver by default for coding/build work",
|
|
145
|
+
"do not bypass plan-work -> execute-plan -> review-work -> verify-work",
|
|
146
|
+
"publish, release readiness, and learning feedback"
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
],
|
|
30
150
|
"skills": [
|
|
31
151
|
{
|
|
32
152
|
"id": "builder.builder-shape",
|
|
@@ -49,6 +49,8 @@ Before doing anything else, restore the item's durable record into context throu
|
|
|
49
49
|
|
|
50
50
|
If no durable record exists for the item, record that gap and rely on the issue body plus merged PRs/commits as the authoritative history.
|
|
51
51
|
|
|
52
|
+
If the item was taken over from a stale incumbent (a `reclaimable` selection resumed via pull-work's **Takeover Protocol**, #294 / ADR 0021 §5), restoring the durable record IS the resumption: the deterministic slug points at the incumbent's existing `.kontourai/flow-agents/<slug>/`, and you continue the incumbent's branch (the `resume_branch` from `takeover-preflight`/the supersede output) — never a new branch, never a restarted plan. Takeover is resumption, not restart.
|
|
53
|
+
|
|
52
54
|
### 2. Determine the next undone slice
|
|
53
55
|
|
|
54
56
|
From the issue body plus the merged PRs and commits referencing the issue, determine which slices have **landed** and which is the **next undone slice**.
|
|
@@ -247,6 +247,67 @@ After review, verification, evidence, and Goal Fit are clean for the same diff:
|
|
|
247
247
|
npm run workflow:sidecar -- publish-delivery .kontourai/flow-agents/<slug>
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
+
**#356 — local reconcile-shape preflight.** `publish-delivery`/`record-release` now run a
|
|
251
|
+
local, pre-push **reconcile-shape preflight** on the session's `trust.bundle` before
|
|
252
|
+
copying anything into `delivery/`. It reuses the exact same claim-shape classification
|
|
253
|
+
`scripts/ci/trust-reconcile.js` enforces in CI (`scripts/lib/reconcile-shape.js`), so it
|
|
254
|
+
can never silently drift from what the required Trust Reconcile check actually does. If
|
|
255
|
+
the bundle is ADR-0020-invalid (e.g. a command-backed claim whose command isn't in the
|
|
256
|
+
reconcile manifest, an unwaived `assumed` claim, or an un-superseded disputed critique),
|
|
257
|
+
publish is **refused, fail-closed** — non-zero exit, a loud `REFUSING to publish` message
|
|
258
|
+
naming each invalid claim and its fix, and nothing is written to `delivery/`. This is
|
|
259
|
+
distinct from the existing fail-**soft** behavior when no `trust.bundle` exists yet at all
|
|
260
|
+
(still a silent no-op). When refused: fix the named claim (re-record evidence, add a
|
|
261
|
+
missing waiver, or supersede the disputed critique), then retry — do not attempt to push
|
|
262
|
+
past the refusal. You can also run the same check manually, any time before publish, to
|
|
263
|
+
catch a shape issue locally instead of discovering it minutes later in CI:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
npm run workflow:sidecar -- reconcile-preflight .kontourai/flow-agents/<slug>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**#381 — manifest-lane constraint: which commands may be `kind:"command"` checks.** A check/claim
|
|
270
|
+
is only CI-reconcilable as `kind:"command"` (Surface's `test_output` evidence type) if its
|
|
271
|
+
command is a registered entry in the **trust-reconcile manifest** — the same
|
|
272
|
+
`{"id":..,"command":..,"lanes":[..]}` list `evals/ci/run-baseline.sh --manifest-json` emits
|
|
273
|
+
from its `CHECKS` array (source of truth: `evals/ci/run-baseline.sh` lines 12-67 for the
|
|
274
|
+
array, 166-182 for `emit_manifest_json`). `scripts/ci/trust-reconcile.js` resolves this same
|
|
275
|
+
manifest (`resolveManifest`/`manifestByCmd`, lines 292-370, 1101-1104) and reconciles a
|
|
276
|
+
`kind:"command"` claim's `execution.label` ONLY against it — a command not in the manifest
|
|
277
|
+
can never reconcile, and CI's reconciler names it exactly this way: `trust divergence: agent
|
|
278
|
+
claimed '<cmd>' passed; command is not in the reconcile manifest — a test_output claim must
|
|
279
|
+
name a manifest/required-lane command (CI cannot self-declare an arbitrary command)`. An
|
|
280
|
+
honest capture-backed check recorded against a real, passing, non-manifest command still
|
|
281
|
+
becomes this `not-run` divergence at CI reconcile time — it is not a shape bug to route
|
|
282
|
+
around, it is the manifest boundary working as designed. Anything that is not a registered
|
|
283
|
+
manifest command records as `kind:"external"` (a session-local attestation — e.g. a manual
|
|
284
|
+
code-review judgment) or `kind:"policy"` (a policy/compliance attestation — e.g. `promote`'s
|
|
285
|
+
claim, which carries no `command`/`execution.label` and therefore can never require a
|
|
286
|
+
manifest entry). This matters at every writer call that can produce a `kind:"command"`
|
|
287
|
+
check — `record-evidence`, `record-gate-claim --command`, and `record-check` — and again at
|
|
288
|
+
the `publish-delivery`/`reconcile-preflight` step above, which is where a non-manifest
|
|
289
|
+
command surfaces as a refusal before CI ever sees it. Gate claims recorded earlier in a
|
|
290
|
+
session are not special-cased here: the compose-safe writer path keeps every prior gate
|
|
291
|
+
claim's declared claim type intact across later `record-evidence`/`record-critique`/
|
|
292
|
+
`record-learning` calls, so a gate claim never needs to be the last write of a session to
|
|
293
|
+
survive.
|
|
294
|
+
|
|
295
|
+
- `kind:"command"` (manifest-backed) example — a real, currently-registered manifest entry
|
|
296
|
+
("Source tree validation" → `npm run validate:source --`):
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
npm run workflow:sidecar -- record-check .kontourai/flow-agents/<slug> -- npm run validate:source --
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
- `kind:"external"` (non-manifest attestation) example — no `--command`, so nothing is
|
|
303
|
+
ever executed; the prose lives in `--summary`:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
|
|
307
|
+
--status pass \
|
|
308
|
+
--summary "Manual code review confirmed no regressions in the affected module."
|
|
309
|
+
```
|
|
310
|
+
|
|
250
311
|
**#379 — per-session delivery paths.** `publishDelivery()` writes to a PER-SESSION path
|
|
251
312
|
`delivery/<slug>/trust.bundle` (+ `trust.checkpoint.json` companions), where `<slug>` is
|
|
252
313
|
your session artifact dir's basename — NOT the old shared flat `delivery/trust.bundle`.
|
|
@@ -274,6 +335,60 @@ After review, verification, evidence, and Goal Fit are clean for the same diff:
|
|
|
274
335
|
too — `git add -A delivery/` after the force-add. Do NOT hand-delete the flat
|
|
275
336
|
`delivery/trust.bundle` in a delivery PR while other PRs may still seal to it.)
|
|
276
337
|
|
|
338
|
+
**#293 — verify-hold gate. HARD STOP.** Before committing/pushing/opening a PR/merging,
|
|
339
|
+
run the verify-hold check (it also runs automatically inside `publish-delivery` /
|
|
340
|
+
`record-release` / `advance-state --status delivered`, but run it explicitly here BEFORE
|
|
341
|
+
committing/pushing, since by the time `record-release` runs the branch may already be
|
|
342
|
+
pushed). **The command differs by this repo's configured assignment provider kind — a bare
|
|
343
|
+
`verify-hold <slug>` with no provider flag always defaults to `--assignment-provider
|
|
344
|
+
local-file` (`runVerifyHold`'s documented default), so on a `github`-provider repo it reads
|
|
345
|
+
no local claim record and silently resolves `free`/PASS regardless of the real GitHub hold
|
|
346
|
+
state. The local-file-only invocation below is NOT sufficient for a `github`-provider repo —
|
|
347
|
+
the github branch is MANDATORY for that provider kind:**
|
|
348
|
+
|
|
349
|
+
- **local-file provider** (this repo's configured assignment provider, from
|
|
350
|
+
`effective-assignment-provider-settings`, is `local-file`):
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
npm run workflow:sidecar -- verify-hold .kontourai/flow-agents/<slug>
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
- **github provider**: render-then-execute, mirroring `pull-work`'s SKILL.md claim-side
|
|
357
|
+
pattern for the same ADR 0021 §1 join — first read the effective state (no live `gh` call
|
|
358
|
+
happens inside `workflow-sidecar.ts`; the skill renders it here), then pass the rendered
|
|
359
|
+
`.effective` JSON into `verify-hold` via `--effective-state-json`:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
gh issue view <issue-number> --json assignees,labels,comments > /tmp/issue.json
|
|
363
|
+
npm run assignment-provider -- status \
|
|
364
|
+
--provider github \
|
|
365
|
+
--subject-id <slug> \
|
|
366
|
+
--issue-json /tmp/issue.json \
|
|
367
|
+
--liveness-stream <path-to-events.jsonl> \
|
|
368
|
+
--self-actor <actor> \
|
|
369
|
+
> /tmp/assignment-status.json
|
|
370
|
+
npm run workflow:sidecar -- verify-hold .kontourai/flow-agents/<slug> \
|
|
371
|
+
--assignment-provider github \
|
|
372
|
+
--effective-state-json /tmp/assignment-status.json
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
(`/tmp/assignment-status.json`'s top-level shape is `{ role, provider, assignment,
|
|
376
|
+
effective }`; `verify-hold --effective-state-json` reads the `.effective` field, matching
|
|
377
|
+
`assignment-provider status`'s own output shape directly — no reshaping needed.)
|
|
378
|
+
|
|
379
|
+
This is the ONE point in the whole workflow that BLOCKS instead of warns (ADR 0021 §3). It
|
|
380
|
+
asks exactly one question: is this actor still the fresh, non-superseded holder of this
|
|
381
|
+
subject (or is the subject free/self-held)? **If the check reports not-fresh-holder (exit
|
|
382
|
+
non-zero, `ok:false` in the JSON result): DO NOT commit, push, open a PR, or merge.** This
|
|
383
|
+
is a different failure mode from the `publish-delivery`/reconcile-shape preflight paragraph
|
|
384
|
+
above — that one is about the trust *bundle's shape* being invalid; this one is about
|
|
385
|
+
*actor hold* — another actor holds a fresh claim on this subject, your own claim has gone
|
|
386
|
+
stale, or the subject is assigned to a human. Do not conflate the two "REFUSING to publish"
|
|
387
|
+
messages. When refused, follow the reconcile guidance (the CLI's own `guidance` field, or
|
|
388
|
+
verbatim): re-run `pull-work`/`pickup-probe` to discover the current holder and hand off
|
|
389
|
+
cleanly (`learning-review`/handoff), or, if a human confirms this session should resume
|
|
390
|
+
ownership, run `ensure-session --supersede-stale` before retrying.
|
|
391
|
+
|
|
277
392
|
3. Commit the verified diff, including the force-added `delivery/<slug>/` trust artifacts.
|
|
278
393
|
4. Push the branch.
|
|
279
394
|
|
|
@@ -208,4 +208,16 @@ explicitly accepts them as unrelated residual risk.
|
|
|
208
208
|
|
|
209
209
|
Evidence passes only when acceptance criteria, scope integrity, CI/runtime evidence, and residual risk are sufficient for the risk class.
|
|
210
210
|
|
|
211
|
+
For an active Builder Flow run, record merge readiness only after this skill reaches `PASS`:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
|
|
215
|
+
--expectation merge-readiness \
|
|
216
|
+
--status pass \
|
|
217
|
+
--summary "Evidence gate passed: verified scope, acceptance evidence, review findings, and unresolved risks support provider review." \
|
|
218
|
+
--evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/evidence.json","summary":"Structured evidence verdict and acceptance coverage."}'
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Record `fail` or `not_verified` when the verdict is not `PASS`. The resulting trust bundle is evaluated by Flow and may route back to verification, execution, planning, or Probe according to the canonical definition.
|
|
222
|
+
|
|
211
223
|
After `PASS`, hand off to `publish-change` when the work is still local, or to `release-readiness` when the verified commit, pushed branch, provider change record or no-provider-change reason, provider checks, closing refs, structured evidence refs, and `Acceptance Evidence` table are available. After `FAIL` or `NOT_VERIFIED`, stop and name the missing work or evidence.
|
|
@@ -79,6 +79,15 @@ This skill owns orchestration between waves. The contracts own artifact continui
|
|
|
79
79
|
- **Checkpoint**: update session file with completed tasks and next wave
|
|
80
80
|
- Record worker progress with `npm run workflow:sidecar -- record-agent-event --artifact-dir <artifact-dir> --agent-id <worker-id> --kind evidence --status active|done --summary ...`
|
|
81
81
|
9. After all waves: set session file `status: executed` and update `state.json` / `handoff.json` with `advance-state`
|
|
82
|
+
10. For an active Builder Flow run, record the `implementation-scope` gate claim only after the changed-file scope and acceptance mapping are complete:
|
|
83
|
+
```bash
|
|
84
|
+
npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
|
|
85
|
+
--expectation implementation-scope \
|
|
86
|
+
--status pass \
|
|
87
|
+
--summary "Implementation completed within the planned scope; changed files and supported acceptance criteria are recorded." \
|
|
88
|
+
--evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<slug>--execute-plan.md","summary":"Execution record with changed files, acceptance mapping, and worker evidence."}'
|
|
89
|
+
```
|
|
90
|
+
Use `fail` or `not_verified` when scope integrity is unresolved. The sidecar writer synchronizes Flow; it does not declare the execute gate passed itself.
|
|
82
91
|
|
|
83
92
|
The orchestrator is responsible for keeping root `state.json` current, and performs that update **exclusively** through `npm run workflow:sidecar -- advance-state` — never through a direct Write/Edit tool call against the sidecar path. `config-protection.js` blocks direct tool-mediated writes to `state.json` by design; that block is expected and correct, not a bug to route around. Workers should receive the workflow artifact root explicitly and append agent events under that root instead of inferring the slug or rewriting shared sidecars.
|
|
84
93
|
|
|
@@ -20,6 +20,8 @@ Turn delivery outcomes into durable learning and follow-up work.
|
|
|
20
20
|
## Inputs
|
|
21
21
|
|
|
22
22
|
- Release-readiness artifact, evidence-gate artifact, PR/issue links, deploy notes, incidents, telemetry, user feedback, and reviewer/verifier notes.
|
|
23
|
+
- **Delegation routing telemetry** — the per-run economics records (`.kontourai/telemetry/economics.jsonl`) carry `delegations[]` with each sub-agent's `(role, resolved_model, outcome)`. Feed them to the routing-efficiency review (step 2a) to judge whether the model each role routes to is actually efficient.
|
|
24
|
+
- **Kit/gate economics proposal ledger** — the same economics records, turned into a durable, idempotent per-kit/per-gate proposal ledger (`.kontourai/telemetry/learning-review-proposals.jsonl`) by `scripts/telemetry/learning-review-proposals.sh`. Feed it to the kit/gate economics review (step 2b).
|
|
23
25
|
|
|
24
26
|
## Artifact Contract
|
|
25
27
|
|
|
@@ -89,6 +91,55 @@ Before identifying durable learnings, write down the intended behavior, observed
|
|
|
89
91
|
|
|
90
92
|
Classify learnings as product, technical, operational, workflow, test, documentation, eval, or agent-behavior learning.
|
|
91
93
|
|
|
94
|
+
### 2a. Review Delegation Routing Efficiency
|
|
95
|
+
|
|
96
|
+
Run the routing-efficiency analyzer over the run's economics records and review its proposals — the
|
|
97
|
+
internal mirror of the #409 small-model value proof, applied to our own agent fan-out:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
bash scripts/telemetry/routing-efficiency.sh .kontourai/telemetry/economics.jsonl
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
It emits ADVISORY per-`(role, model)` proposals (`escalate-minimum-tier`, `keep-tier`, `monitor`,
|
|
104
|
+
`insufficient-signal`) with rationales, computed only from **measurable** outcomes — `unavailable`
|
|
105
|
+
outcomes are excluded (a missing verdict is neither success nor failure; see
|
|
106
|
+
`docs/specs/harness-capability-matrix.md`). Fold any actionable proposal into `learning.json`:
|
|
107
|
+
|
|
108
|
+
- an `escalate-minimum-tier` / demote proposal → a `routing` entry (`target: "rule"`, naming the
|
|
109
|
+
`.datum/config.json` role→model change to consider) or `correction` with `type: "agent"`.
|
|
110
|
+
- **These are proposals, never auto-applied.** A human ratifies the `.datum/config.json` change, which
|
|
111
|
+
then travels the normal deliver loop (ADR 0003 call 5). `insufficient-signal` proposals are recorded
|
|
112
|
+
as coverage notes, not routing changes.
|
|
113
|
+
|
|
114
|
+
### 2b. Review Kit/Gate Economics Proposals
|
|
115
|
+
|
|
116
|
+
Run the kit/gate economics analyzer over a window of economics records whenever enough new
|
|
117
|
+
records have piled up since the last ledger entry — cadenced during a learning-review pass, not
|
|
118
|
+
on a scheduler (see `--help` for the full flag set):
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
bash scripts/telemetry/learning-review-proposals.sh --since <last-run-until> --until <now>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
It emits ADVISORY per-kit (`kit-review-cost-inflation`) and per-gate (`gate-false-block-review`,
|
|
125
|
+
`gate-well-calibrated`) proposals, each citing paired `evidence.cost` + `evidence.defect` — never
|
|
126
|
+
cost alone. `insufficient-data` is a valid, reportable outcome, not a bar to lower; never propose
|
|
127
|
+
from noise. Surface every new (non-`already_proposed`) proposal to the human with its evidence,
|
|
128
|
+
then record the ratify/reject/defer decision BEFORE any follow-on work exists:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
bash scripts/telemetry/learning-review-decide.sh <ledger> <proposal-id> \
|
|
132
|
+
--ratify|--reject|--defer --decided-by <name> --rationale "<why>"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
- **These are proposals, never auto-applied.** Nothing here writes to `kits/**`,
|
|
136
|
+
`.datum/config.json`, or any gate/flow config file.
|
|
137
|
+
- Only on `--ratify`, create the ordinary follow-on backlog item and record it back onto the
|
|
138
|
+
proposal with `--follow-on-ref <ref>` — a follow-on may never cite an unratified proposal. A
|
|
139
|
+
later pass's effect-fill shows whether the ratified change actually moved the numbers.
|
|
140
|
+
|
|
141
|
+
See `docs/specs/learning-review-proposals-contract.md` for the full contract.
|
|
142
|
+
|
|
92
143
|
### 3. Route Follow-Up
|
|
93
144
|
|
|
94
145
|
Route raw ideas or ambiguous improvements to `idea-to-backlog`. Create GitHub issues only for executable follow-up. Use `evidence-gate` again when unresolved trust questions remain.
|
|
@@ -137,8 +137,17 @@ The `tool-planner` prompt context must include the latest-base confirmation and
|
|
|
137
137
|
4. Read the plan artifact
|
|
138
138
|
5. Update session file: paste plan summary into `## Plan`, set `status: planned`
|
|
139
139
|
6. Update `state.json` (`status: planned`, phase `planning`, next action) via `npm run workflow:sidecar -- advance-state` — never through a direct Write/Edit tool call (`config-protection.js` blocks that by design)
|
|
140
|
-
7.
|
|
141
|
-
|
|
140
|
+
7. For an active Builder Flow run, record the `implementation-plan` gate claim after the plan and structured sidecars are complete:
|
|
141
|
+
```bash
|
|
142
|
+
npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
|
|
143
|
+
--expectation implementation-plan \
|
|
144
|
+
--status pass \
|
|
145
|
+
--summary "Implementation plan records files, sequencing, acceptance criteria, and required evidence." \
|
|
146
|
+
--evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<session-basename>-plan.md","summary":"Structured implementation plan with acceptance and evidence traceability."}'
|
|
147
|
+
```
|
|
148
|
+
Use `fail` or `not_verified` instead of `pass` when the plan contract is not satisfied. The sidecar writer synchronizes Flow; Flow, not this skill, decides whether execution is now active.
|
|
149
|
+
8. Present the plan to the user
|
|
150
|
+
9. If the user wants changes, re-delegate to tool-planner with feedback
|
|
142
151
|
|
|
143
152
|
Never rely on conversational memory for the slug. Resolve the active artifact with `npm run workflow:sidecar -- current --format path` and pass that path to delegated agents.
|
|
144
153
|
|
|
@@ -198,22 +207,10 @@ Copied from the plan artifact. This is the stop condition for delivery.
|
|
|
198
207
|
|
|
199
208
|
{context?}
|
|
200
209
|
|
|
201
|
-
##
|
|
202
|
-
|
|
203
|
-
`ensure-session --flow-id <id>` without `--step-id` defaults `active_step_id` to the
|
|
204
|
-
flow's FIRST step (`pull-work` for `builder.build`). For a session that legitimately
|
|
205
|
-
enters mid-flow — e.g. planning directly from a portfolio work item without a
|
|
206
|
-
`pull-work`/pickup artifact — pass the sanctioned override:
|
|
207
|
-
|
|
208
|
-
```
|
|
209
|
-
npm run workflow:sidecar -- ensure-session \
|
|
210
|
-
--flow-id builder.build --task-slug <slug> --step-id plan \
|
|
211
|
-
[--ad-hoc-reason "planning a directly-issued work item; no pull-work artifact"]
|
|
212
|
-
```
|
|
210
|
+
## Workflow Entry
|
|
213
211
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
start.
|
|
212
|
+
Do not create or restamp a `builder.build` run from this planning primitive. A Builder
|
|
213
|
+
run enters through `pull-work`, then `design-probe`; Flow advances it to `plan` only after
|
|
214
|
+
the declared upstream gates pass. When `plan-work` is invoked directly outside that
|
|
215
|
+
product workflow, run it as a standalone primitive without `--flow-id builder.build` and
|
|
216
|
+
do not report the omitted Builder prefix as complete.
|
|
@@ -96,6 +96,8 @@ Use `github-cli` / `gh` when available to inspect issues, labels, milestones, pr
|
|
|
96
96
|
|
|
97
97
|
Treat GitHub Issues as a `WorkItemProvider` and GitHub Projects as a `BoardProvider`, mapped through `context/contracts/work-item-contract.md`. Preserve provider-specific values in the artifact when useful, but use the contract's neutral fields for selection, grouping, and handoff.
|
|
98
98
|
|
|
99
|
+
When a `BoardProvider` is configured, read the board Ready queue as the primary cross-repo selection input, ordered by configured priority and board position. Per-repo `WorkItemProvider` issue listing is the intake-gap detector: use it to surface open issues missing from the board, not as a silent fallback when the board has no ready items. If the configured board returns zero ready items, record and surface that warning as a dead readiness source before selecting or asking for alignment.
|
|
100
|
+
|
|
99
101
|
Classify issues:
|
|
100
102
|
|
|
101
103
|
- ready
|
|
@@ -115,6 +117,15 @@ npm run pull-work-provider -- \
|
|
|
115
117
|
|
|
116
118
|
The helper preserves provider refs, project fields, blockers, PR links, and source artifact refs, then emits the work item contract fields plus readiness evidence. Use live provider state for final decisions; fixture output is only test evidence.
|
|
117
119
|
|
|
120
|
+
When board state is available, read the Ready queue and intake gaps through the same helper:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npm run pull-work-provider -- \
|
|
124
|
+
--settings-json context/settings/backlog-provider-settings.json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
For fixture-backed evaluation or cached provider JSON, pass `--items-json /path/to/project-items-and-open-issues.json`. The board output includes `ready_queue`, `intake_gaps`, and `warnings`; select from `ready_queue` first when it is populated.
|
|
128
|
+
|
|
118
129
|
Before classifying provider-backed work as ready for pickup, fetch the latest target ref when network access and provider credentials are available, then compare the current target SHA to the work item's `planned_base_sha`. Record the current target ref/SHA, planned base ref/SHA, `commits-since`, planned age, changed files since the planned base, and changed-file intersections with `planning_scope_refs` in the pull-work artifact or helper output.
|
|
119
130
|
|
|
120
131
|
Classify revision freshness as:
|
|
@@ -167,14 +178,24 @@ Read the returned `.effective.effective_state` and `.effective.reason` and class
|
|
|
167
178
|
|
|
168
179
|
1. `effective_state: "held"` with `reason: "self_is_holder"` ⇒ `mine`: hand to `### 2. Enforce WIP And Shepherding`'s existing personal-WIP logic; do not re-offer as new, do not exclude as held-by-other.
|
|
169
180
|
2. else `effective_state: "held"` (`reason: "fresh_liveness_heartbeat"` or `"liveness_claim_present_assignment_lagging"`) ⇒ excluded from the ready set by default.
|
|
170
|
-
3. else `effective_state: "reclaimable"` ⇒ offered, flagged, with a warning; selecting it requires an explicit recorded opt-in (record in `reclaimable_override`, and/or `alignment_questions`), never a silent normal pick.
|
|
181
|
+
3. else `effective_state: "reclaimable"` ⇒ offered, flagged, with a warning; selecting it requires an explicit recorded opt-in (record in `reclaimable_override`, and/or `alignment_questions`), never a silent normal pick. On selecting a `reclaimable` candidate, run the **Takeover Protocol** (#294, ADR 0021 §5) below — takeover is resumption, not restart: grace-beat, supersede, then continue the incumbent's branch. Never auto-reclaim without the recorded opt-in.
|
|
171
182
|
4. else `effective_state: "human-held"` ⇒ surfaced, never auto-reclaimed (Design Decision 3 / ADR 0021 §6): record the assignee identity and idle duration (`effective.holder.assignee`, `effective.holder.idle_days`) in `alignment_questions` with a recommended answer (e.g. "assigned to `<assignee>`, idle `<idle_days>` days — reclaim?" recommending confirmation before proceeding), and select only on the user's explicit confirmation.
|
|
172
|
-
5. else `effective_state: "free"` ⇒ offered normally —
|
|
183
|
+
5. else `effective_state: "free"` ⇒ offered normally — including a `superseded` liveness row (no active assignment, no fresh liveness): now select-able via the **Takeover Protocol** below once the reclaimable/opt-in gate is satisfied (#294 implements the takeover semantics previously deferred here).
|
|
173
184
|
|
|
174
185
|
An explicit user instruction to proceed despite a `held` or `reclaimable` classification (`--force`, "take it anyway", equivalent) overrides the exclusion/opt-in requirement; the override and its stated reason must be recorded in the artifact (`liveness_preflight`, `reclaimable_override`, and/or `priority_rationale`). A `human-held` classification is never overridden by `--force` alone — only the user's explicit answer to the recorded `alignment_questions` entry authorizes selecting it.
|
|
175
186
|
|
|
176
187
|
This preflight now computes the **full** ADR 0021 §1 `assignment ⋈ liveness` join (previously liveness-only, pending #290): the assignment dimension is `#290`'s `AssignmentProvider` `status()` (`context/contracts/assignment-provider-contract.md`), joined against the same liveness stream this preflight already reads.
|
|
177
188
|
|
|
189
|
+
#### Takeover Protocol (#294, ADR 0021 §5) — resumption, not restart
|
|
190
|
+
|
|
191
|
+
When a `reclaimable` (or `superseded`-liveness) candidate is selected WITH the recorded opt-in, take it over by resuming the incumbent's work — never by starting a parallel branch or replanning. This is render-don't-execute: the CLI computes the decision and emits the exact steps; you run them.
|
|
192
|
+
|
|
193
|
+
1. **Preflight:** `npm run workflow:sidecar -- takeover-preflight .kontourai/flow-agents/<slug>`. It returns `{action, effective_state, holder, resume_branch, grace_seconds, next_steps}`. Only `action: "grace-then-supersede"` proceeds; `back-off` (incumbent live/revived) ⇒ STOP and reselect; `ask-first` (human-held) ⇒ do not proceed without the user's explicit answer.
|
|
194
|
+
2. **Grace beat:** wait `grace_seconds` (one heartbeat interval), then **re-run `takeover-preflight`**. If it now returns `back-off`, the incumbent revived — concede and reselect (this is the AC2 race guard). Proceed only if it is still `grace-then-supersede`.
|
|
195
|
+
3. **Supersede:** `npm run workflow:sidecar -- ensure-session … --supersede-stale`. It re-checks the state and REFUSES if the incumbent revived in the meantime (a live `held` is never superseded), records the audit trail ("superseded actor X, last seen T, resuming from trust bundle"), and prints `resumed_branch`.
|
|
196
|
+
4. **Resume the incumbent's branch — never a new one:** `git fetch origin <resume_branch> && git checkout <resume_branch>` (the `resume_branch` from step 1/3). Re-enter the existing artifact dir (the deterministic slug points at the same `.kontourai/flow-agents/<slug>/`); restore the durable record via the resume surface (#153) and continue from `handoff.json`/plan — do NOT re-plan or restart.
|
|
197
|
+
5. **Record** the takeover (superseded actor, `resume_branch`, grace outcome) in `reclaimable_override`. If the superseded incumbent later wakes, it is blocked at publish by the verify-hold gate (#293) — the takeover is authoritative.
|
|
198
|
+
|
|
178
199
|
`liveness claim`/`status`/`whoami` read/write the local runtime liveness stream, never GitHub issue/label/assignee state — this is not a provider mutation, and the two-provider-writes-only invariant in `## Contract` is unchanged by this slice. `#290` adds the one narrow, audited durable assignment claim that pairs with this liveness emit — see "Assignment Claim On Selection" below.
|
|
179
200
|
|
|
180
201
|
### 2. Enforce WIP And Shepherding
|
|
@@ -448,6 +469,14 @@ After a merge, automatic continuation may inspect the queue and write a new pull
|
|
|
448
469
|
|
|
449
470
|
When the Pickup Gate passes and work is selected (not just a shepherding scan or WIP-only audit), record the gate claim for the Builder Kit `pull-work` step before handing off to `design-probe` or `plan-work`. This satisfies the `builder.pull-work.selected` gate expectation.
|
|
450
471
|
|
|
472
|
+
Start the canonical Flow run before recording the first gate claim. This is idempotent for an existing run and projects Flow's current step and gate requirements into the sidecar:
|
|
473
|
+
|
|
474
|
+
```bash
|
|
475
|
+
flow-agents builder-run start --session-dir .kontourai/flow-agents/<slug>
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
Do not start at a later step. Flow owns advancement from `pull-work` after it evaluates the recorded evidence.
|
|
479
|
+
|
|
451
480
|
Use the `selected_item_ids` as the evidence artifact ref and confirm that scope and acceptance criteria are present in the pull-work artifact:
|
|
452
481
|
|
|
453
482
|
```bash
|
|
@@ -458,6 +487,8 @@ npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
|
|
|
458
487
|
--evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/<slug>--pull-work.md","summary":"Pull-work artifact with selected_item_ids, scope, and acceptance criteria."}'
|
|
459
488
|
```
|
|
460
489
|
|
|
490
|
+
The sidecar writer synchronizes an existing canonical Flow run after writing the trust bundle. If synchronization was interrupted, recover with the exact `next_action.command` from `state.json`; do not edit Flow state or restamp the active step.
|
|
491
|
+
|
|
461
492
|
Use `--status fail` when the gate fails (blocker recorded but no selection made). Use `--status not_verified` only when the session has no active flow step (non-Builder-Kit usage).
|
|
462
493
|
|
|
463
494
|
Record `--status fail` with a summary naming the blocker when stopping before selection. Do not record `pass` until `selected_item_ids` are confirmed and the pickup gate criteria above are met.
|
|
@@ -58,6 +58,18 @@ Use additional `--gate-json` and `--post-deploy-json` values for release, deploy
|
|
|
58
58
|
|
|
59
59
|
After writing `release.json`, run artifact validation when available. If `record-release` is unavailable or blocked, keep the release decision as `HOLD` in the Markdown artifact and record the sidecar-write or validation blocker as a `NOT_VERIFIED` evidence gap until the structured release record can be written or the gap is explicitly accepted.
|
|
60
60
|
|
|
61
|
+
For an active Builder Flow run, record the CI merge-readiness claim only for a `MERGE`, `RELEASE`, or `DEPLOY` decision backed by current provider checks:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm run workflow:sidecar -- record-gate-claim .kontourai/flow-agents/<slug> \
|
|
65
|
+
--expectation ci-merge-readiness \
|
|
66
|
+
--status pass \
|
|
67
|
+
--summary "Provider checks are current and passing; release-readiness decision and residual risks are recorded." \
|
|
68
|
+
--evidence-ref-json '{"kind":"artifact","file":".kontourai/flow-agents/<slug>/release.json","summary":"Release-readiness decision with provider checks, rollback, and observability evidence."}'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Use `fail` or `not_verified` for `HOLD` and unresolved provider evidence. Flow owns the transition to learning after it verifies this claim.
|
|
72
|
+
|
|
61
73
|
## Workflow
|
|
62
74
|
|
|
63
75
|
### 1. Confirm Evidence
|
package/kits/knowledge/kit.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"name": "Knowledge Kit",
|
|
5
5
|
"product_name": "Knowledge Kit",
|
|
6
6
|
"description": "A Flow Kit for durable, gated knowledge storage. Provides a store contract with defined record types, mutation operations, and provenance rules — plus a default adapter backed by markdown files, YAML frontmatter, wikilinks, and a graph index.",
|
|
7
|
+
"first_party": true,
|
|
7
8
|
"flows": [
|
|
8
9
|
{
|
|
9
10
|
"id": "knowledge.store-contract",
|
|
@@ -66,6 +67,14 @@
|
|
|
66
67
|
"description": "Knowledge promote sub-flow (issue #313, the codebase-facing 'flow within a flow'): ingest a delivered session's artifacts -> distill schema-valid DRAFT decision/vocabulary/learning deltas per the decision-registry contract -> link provenance (PR, merge SHA, session archive, touched topics) -> health-check the registry for contradictions (overlapping subject nouns + divergent content) and propose merge-repair. Invokable standalone AND composable from the Builder promote step via uses_flow. PROPOSALS-ONLY: outputs land under <session>/proposals/ for the promote step to apply; the sub-flow never writes docs directly. Executable logic: promote/index.js."
|
|
67
68
|
}
|
|
68
69
|
],
|
|
70
|
+
"workflow_triggers": [
|
|
71
|
+
{
|
|
72
|
+
"id": "knowledge-capture-work",
|
|
73
|
+
"when": "knowledge-capture-detected",
|
|
74
|
+
"target_flow_id": "knowledge.ingest",
|
|
75
|
+
"default_skill": "knowledge.knowledge-capture"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
69
78
|
"docs": [
|
|
70
79
|
{
|
|
71
80
|
"id": "knowledge.readme",
|