@jterrats/open-orchestra 0.1.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 (93) hide show
  1. package/AGENTS.md +151 -0
  2. package/CLAUDE.md +157 -0
  3. package/README.md +60 -0
  4. package/bin/orchestra.js +8 -0
  5. package/dist/args.d.ts +3 -0
  6. package/dist/args.js +30 -0
  7. package/dist/args.js.map +1 -0
  8. package/dist/cli.d.ts +2 -0
  9. package/dist/cli.js +190 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/commands.d.ts +44 -0
  12. package/dist/commands.js +883 -0
  13. package/dist/commands.js.map +1 -0
  14. package/dist/constants.d.ts +15 -0
  15. package/dist/constants.js +69 -0
  16. package/dist/constants.js.map +1 -0
  17. package/dist/defaults.d.ts +72 -0
  18. package/dist/defaults.js +694 -0
  19. package/dist/defaults.js.map +1 -0
  20. package/dist/fs-utils.d.ts +8 -0
  21. package/dist/fs-utils.js +35 -0
  22. package/dist/fs-utils.js.map +1 -0
  23. package/dist/model-providers.d.ts +19 -0
  24. package/dist/model-providers.js +78 -0
  25. package/dist/model-providers.js.map +1 -0
  26. package/dist/types.d.ts +550 -0
  27. package/dist/types.js +2 -0
  28. package/dist/types.js.map +1 -0
  29. package/dist/validation.d.ts +10 -0
  30. package/dist/validation.js +163 -0
  31. package/dist/validation.js.map +1 -0
  32. package/dist/web-api.d.ts +16 -0
  33. package/dist/web-api.js +220 -0
  34. package/dist/web-api.js.map +1 -0
  35. package/dist/web-chart-contracts.d.ts +13 -0
  36. package/dist/web-chart-contracts.js +13 -0
  37. package/dist/web-chart-contracts.js.map +1 -0
  38. package/dist/web-console.d.ts +1 -0
  39. package/dist/web-console.js +232 -0
  40. package/dist/web-console.js.map +1 -0
  41. package/dist/web-evidence.d.ts +25 -0
  42. package/dist/web-evidence.js +67 -0
  43. package/dist/web-evidence.js.map +1 -0
  44. package/dist/web-playwright.d.ts +3 -0
  45. package/dist/web-playwright.js +14 -0
  46. package/dist/web-playwright.js.map +1 -0
  47. package/dist/web-roles.d.ts +33 -0
  48. package/dist/web-roles.js +70 -0
  49. package/dist/web-roles.js.map +1 -0
  50. package/dist/workflow-gates.d.ts +7 -0
  51. package/dist/workflow-gates.js +291 -0
  52. package/dist/workflow-gates.js.map +1 -0
  53. package/dist/workflow-services.d.ts +56 -0
  54. package/dist/workflow-services.js +1240 -0
  55. package/dist/workflow-services.js.map +1 -0
  56. package/dist/workspace-validator.d.ts +6 -0
  57. package/dist/workspace-validator.js +189 -0
  58. package/dist/workspace-validator.js.map +1 -0
  59. package/dist/workspace.d.ts +10 -0
  60. package/dist/workspace.js +72 -0
  61. package/dist/workspace.js.map +1 -0
  62. package/docs/multi-agent-orchestrator-backlog.md +445 -0
  63. package/docs/multi-agent-orchestrator-sprint-1.md +433 -0
  64. package/docs/orchestra-mvp.md +176 -0
  65. package/package.json +63 -0
  66. package/rules/agent-collaboration.mdc +58 -0
  67. package/rules/agent-roles.mdc +105 -0
  68. package/rules/ai-assisted-development.mdc +31 -0
  69. package/rules/api-design.mdc +31 -0
  70. package/rules/architecture-decisions.mdc +27 -0
  71. package/rules/code-review-engineering.mdc +34 -0
  72. package/rules/concurrency-async.mdc +32 -0
  73. package/rules/configuration-management.mdc +31 -0
  74. package/rules/data-modeling-domain.mdc +31 -0
  75. package/rules/delivery-quality-gates.mdc +40 -0
  76. package/rules/dependency-management.mdc +31 -0
  77. package/rules/devops-tooling.mdc +55 -0
  78. package/rules/documentation-standards.mdc +26 -0
  79. package/rules/dry-clean-code.mdc +30 -0
  80. package/rules/error-handling.mdc +28 -0
  81. package/rules/frontend-engineering.mdc +32 -0
  82. package/rules/git-discipline.mdc +39 -0
  83. package/rules/infra-data-encryption.mdc +81 -0
  84. package/rules/performance-reliability.mdc +32 -0
  85. package/rules/readiness-done.mdc +32 -0
  86. package/rules/release-rollback.mdc +32 -0
  87. package/rules/rule-composition.mdc +28 -0
  88. package/rules/security-guardrails.mdc +37 -0
  89. package/rules/solid-architecture.mdc +32 -0
  90. package/rules/static-analysis-githooks.mdc +32 -0
  91. package/rules/testing-discipline.mdc +42 -0
  92. package/rules/ux-ui-product-experience.mdc +51 -0
  93. package/rules/work-intake-sequencing.mdc +39 -0
@@ -0,0 +1,445 @@
1
+ # Multi-Agent Orchestrator Backlog
2
+
3
+ ## Product Goal
4
+
5
+ Build a provider-agnostic middleware that lets a parent agent orchestrate specialized subagents through explicit roles, task graphs, handoffs, evidence, review gates, and shared artifacts even when the underlying LLM platform does not support native agent-to-agent collaboration.
6
+
7
+ ## Epic 1: Central Orchestration
8
+
9
+ ### Story ORCH-001: Create Structured Task Brief
10
+ As a user, I want the parent agent to convert my request into a structured brief so that goals, scope, risks, assumptions, and Definition of Done are clear before work starts.
11
+
12
+ Acceptance criteria:
13
+ - Captures goal, backlog item, user value, scope, non-goals, assumptions, risks, constraints, and Definition of Done.
14
+ - Identifies missing readiness information.
15
+ - Blocks implementation when critical readiness fields are missing.
16
+
17
+ ### Story ORCH-002: Select Required Roles
18
+ As a parent agent, I want to select only the roles required for the task so that work is complete without activating unnecessary agents.
19
+
20
+ Acceptance criteria:
21
+ - Maps task impact areas to roles.
22
+ - Records selected roles and skipped roles with rationale.
23
+ - Supports role combinations for cross-cutting work.
24
+
25
+ ### Story ORCH-003: Build Task Graph
26
+ As a parent agent, I want to create a task graph with dependencies so that sequential and parallel work can be coordinated safely.
27
+
28
+ Acceptance criteria:
29
+ - Creates tasks with ID, owner role, status, dependencies, inputs, outputs, and exit criteria.
30
+ - Detects blocked tasks.
31
+ - Prevents downstream tasks from starting before required upstream outputs exist.
32
+
33
+ ### Story ORCH-004: Require User Alignment Gate
34
+ As a user, I want to approve the proposed solution and architecture before implementation so that scope and design stay under control.
35
+
36
+ Acceptance criteria:
37
+ - Presents proposed approach, modules, data flow, trade-offs, risks, test strategy, and evidence plan.
38
+ - Records user approval or requested changes.
39
+ - Blocks non-trivial implementation until approval is recorded.
40
+
41
+ ### Story ORCH-005: Resume Interrupted Work
42
+ As a parent agent, I want to rebuild workflow state from saved artifacts and events so that interrupted work can continue without starting over.
43
+
44
+ Acceptance criteria:
45
+ - Loads tasks, events, locks, decisions, handoffs, and evidence.
46
+ - Reconstructs current status and next actions.
47
+ - Flags inconsistent or missing workflow files.
48
+
49
+ ## Epic 2: Role Registry and Capabilities
50
+
51
+ ### Story ROLE-001: Define Role Catalog
52
+ As an administrator, I want to define roles and responsibilities so that each agent knows its ownership, authority, and handoff expectations.
53
+
54
+ Acceptance criteria:
55
+ - Supports roles such as Product Owner, Architect, Developer, QA, Security, DevOps, SRE, DBA, UX/UI Designer, Release Manager, Compliance/Privacy, Technical Writer, and Game Designer.
56
+ - Stores role purpose, responsibilities, required inputs, outputs, and blockers.
57
+ - Allows project-specific role overrides.
58
+
59
+ ### Story ROLE-002: Map Capabilities to Roles
60
+ As a parent agent, I want to query role capabilities so that tasks are assigned to the right agent.
61
+
62
+ Acceptance criteria:
63
+ - Supports capabilities such as coding, test planning, Playwright automation, threat review, infra review, docs, and release review.
64
+ - Resolves the best role for each task impact area.
65
+ - Reports when no configured role can own a needed capability.
66
+
67
+ ### Story ROLE-003: Enforce Role Authority
68
+ As a reviewer, I want each role to have explicit approval and blocking authority so that release decisions are auditable.
69
+
70
+ Acceptance criteria:
71
+ - Supports approve, block, request changes, and risk accepted states.
72
+ - Records role, rationale, severity, and affected artifact.
73
+ - Prevents release when required role approval is missing.
74
+
75
+ ## Epic 3: Multi-Model Provider Layer
76
+
77
+ ### Story MODEL-001: Define Provider Interface
78
+ As a developer, I want a common provider interface so that the orchestrator can call different LLM providers without coupling to their SDKs.
79
+
80
+ Acceptance criteria:
81
+ - Defines request, response, streaming, tool support, vision support, JSON mode, context length, timeout, and error contract.
82
+ - Hides provider-specific SDK details behind adapters.
83
+ - Includes test doubles for provider behavior.
84
+
85
+ ### Story MODEL-002: Configure Models by Role
86
+ As an administrator, I want to assign provider and model preferences per role so that each role can use the right cost, quality, and capability profile.
87
+
88
+ Acceptance criteria:
89
+ - Supports provider, model, fallbacks, max tokens, max cost, timeout, and retry settings per role.
90
+ - Allows project-level defaults.
91
+ - Validates unknown providers or unsupported capabilities.
92
+
93
+ ### Story MODEL-003: Record Model Provenance
94
+ As an auditor, I want every agent output to record provider, model, version, and cost metadata so that decisions are traceable.
95
+
96
+ Acceptance criteria:
97
+ - Logs provider, model, request ID, token usage, latency, estimated cost, and timestamp.
98
+ - Links model metadata to generated artifacts and decisions.
99
+ - Redacts sensitive content according to retention policy.
100
+
101
+ ### Story MODEL-004: Support Provider Fallback
102
+ As a parent agent, I want fallback providers for non-critical tasks so that workflow can continue when one provider fails.
103
+
104
+ Acceptance criteria:
105
+ - Uses configured fallback order.
106
+ - Records fallback reason.
107
+ - Blocks fallback for tasks marked reproducibility-sensitive unless user approval is recorded.
108
+
109
+ ### Story MODEL-005: Compare Model Outputs
110
+ As a reviewer, I want to run multiple models on critical analysis tasks so that high-risk decisions can be cross-checked.
111
+
112
+ Acceptance criteria:
113
+ - Runs configured comparison models.
114
+ - Produces a structured agreement/disagreement summary.
115
+ - Requires human or parent-agent resolution for material disagreement.
116
+
117
+ ## Epic 4: Task Graph and State Management
118
+
119
+ ### Story TASK-001: Persist Task State
120
+ As a parent agent, I want task state persisted to disk so that workflow status survives process restarts.
121
+
122
+ Acceptance criteria:
123
+ - Stores tasks in a structured file.
124
+ - Supports statuses: pending, ready, in_progress, blocked, review, approved, rejected, done, canceled.
125
+ - Validates task references and dependencies.
126
+
127
+ ### Story TASK-002: Show Workflow Status
128
+ As a user, I want to see all tasks and blockers so that I understand progress.
129
+
130
+ Acceptance criteria:
131
+ - Shows tasks grouped by status and role.
132
+ - Highlights blockers, missing evidence, failed gates, and active locks.
133
+ - Provides next recommended action.
134
+
135
+ ### Story TASK-003: Detect Dependency Violations
136
+ As a parent agent, I want to prevent tasks from running before dependencies are complete so that agents do not work from stale or missing inputs.
137
+
138
+ Acceptance criteria:
139
+ - Blocks task start when required dependencies are incomplete.
140
+ - Explains which dependency is missing.
141
+ - Allows explicit override only with recorded rationale.
142
+
143
+ ## Epic 5: Handoffs Between Agents
144
+
145
+ ### Story HAND-001: Generate Developer-to-QA Handoff
146
+ As a Developer, I want a structured handoff to QA so that QA can test with full context.
147
+
148
+ Acceptance criteria:
149
+ - Includes changed files/components, behavior changed, unit tests, commands run, known gaps, risks, and recommended Playwright coverage.
150
+ - Validates required fields before handoff is accepted.
151
+ - Links evidence artifacts.
152
+
153
+ ### Story HAND-002: Generate Review Handoff
154
+ As a parent agent, I want role-specific handoff templates so that Security, SRE, DBA, UX, and Release Manager receive relevant context.
155
+
156
+ Acceptance criteria:
157
+ - Selects template by target role.
158
+ - Includes role-specific required fields.
159
+ - Links decisions, task context, and evidence.
160
+
161
+ ### Story HAND-003: Reject Incomplete Handoffs
162
+ As a reviewer, I want incomplete handoffs to be rejected automatically so that reviews do not start with missing context.
163
+
164
+ Acceptance criteria:
165
+ - Validates required fields.
166
+ - Reports missing fields and owner.
167
+ - Keeps target task blocked until corrected.
168
+
169
+ ## Epic 6: Shared Memory and Event Log
170
+
171
+ ### Story MEM-001: Append Workflow Events
172
+ As a system, I want all workflow events stored in an append-only log so that collaboration is auditable.
173
+
174
+ Acceptance criteria:
175
+ - Records event type, task ID, actor, timestamp, summary, artifact links, and metadata.
176
+ - Supports events such as TASK_ASSIGNED, HANDOFF_READY, REVIEW_BLOCKED, QA_FAILED, APPROVED, RISK_ACCEPTED, and RELEASE_READY.
177
+ - Does not overwrite historical events.
178
+
179
+ ### Story MEM-002: Store Decision Log
180
+ As an Architect, I want decisions stored separately from chat so that important trade-offs remain visible.
181
+
182
+ Acceptance criteria:
183
+ - Stores decision title, context, decision, alternatives, consequences, owner, and status.
184
+ - Links decisions to tasks and reviews.
185
+ - Supports superseded decisions.
186
+
187
+ ### Story MEM-003: Query Shared Context
188
+ As an agent, I want to query current assumptions, decisions, risks, and evidence so that I do not work in isolation.
189
+
190
+ Acceptance criteria:
191
+ - Returns relevant task context by task ID.
192
+ - Includes upstream handoffs, active decisions, blockers, and evidence.
193
+ - Flags stale or superseded context.
194
+
195
+ ## Epic 7: Artifact Store and Evidence
196
+
197
+ ### Story ART-001: Store Test Evidence
198
+ As QA, I want to store test plans, results, screenshots, logs, videos, and traces so that release decisions are evidence-based.
199
+
200
+ Acceptance criteria:
201
+ - Stores artifacts under predictable paths.
202
+ - Links artifacts to task, role, and event.
203
+ - Supports pass, fail, blocked, and deferred outcomes.
204
+
205
+ ### Story ART-002: Store Command Evidence
206
+ As a Developer, I want commands and results captured so that reviewers know exactly what was verified.
207
+
208
+ Acceptance criteria:
209
+ - Records command, working directory, exit code, timestamp, and summarized output.
210
+ - Marks failed commands as blockers unless explicitly deferred.
211
+ - Links command evidence to handoff and final summary.
212
+
213
+ ### Story ART-003: Generate Final Evidence Summary
214
+ As a user, I want a final evidence summary so that I can understand what was changed, tested, and left risky.
215
+
216
+ Acceptance criteria:
217
+ - Summarizes tasks, tests, reviews, approvals, blockers, risk acceptances, and artifacts.
218
+ - Highlights unresolved risks and follow-up items.
219
+ - Can be used as PR body input.
220
+
221
+ ## Epic 8: File Ownership and Locking
222
+
223
+ ### Story LOCK-001: Assign File Ownership
224
+ As a parent agent, I want to assign files or modules to a task owner so that parallel agents do not overwrite each other.
225
+
226
+ Acceptance criteria:
227
+ - Records owner, task ID, path pattern, reason, and expiration.
228
+ - Prevents another task from claiming overlapping paths without integration owner.
229
+ - Supports module-level and file-level locks.
230
+
231
+ ### Story LOCK-002: Detect Lock Conflicts
232
+ As an integrator, I want lock conflicts detected before edits so that merge conflicts are avoided.
233
+
234
+ Acceptance criteria:
235
+ - Detects overlapping path claims.
236
+ - Reports owners and impacted tasks.
237
+ - Requires integration owner assignment to continue.
238
+
239
+ ### Story LOCK-003: Release Locks
240
+ As an agent, I want locks released when work completes or is canceled so that future tasks can proceed.
241
+
242
+ Acceptance criteria:
243
+ - Releases locks on task done or canceled.
244
+ - Supports manual release with rationale.
245
+ - Reports stale locks.
246
+
247
+ ## Epic 9: Quality Gates
248
+
249
+ ### Story GATE-001: Enforce Definition of Ready
250
+ As a parent agent, I want readiness validated before implementation so that work does not start with hidden ambiguity.
251
+
252
+ Acceptance criteria:
253
+ - Checks backlog item, goal, scope, acceptance criteria, non-goals, risks, user alignment, roles, and test strategy.
254
+ - Blocks implementation when required fields are missing.
255
+ - Produces a readiness report.
256
+
257
+ ### Story GATE-002: Enforce Architecture Approval
258
+ As an Architect, I want non-trivial implementation blocked until architecture is approved so that design risk is handled early.
259
+
260
+ Acceptance criteria:
261
+ - Detects non-trivial work.
262
+ - Requires solution proposal and user approval.
263
+ - Records approval event.
264
+
265
+ ### Story GATE-003: Enforce QA Gate
266
+ As QA, I want release blocked without a test plan and execution evidence so that unverified changes do not ship.
267
+
268
+ Acceptance criteria:
269
+ - Requires QA plan, execution status, and evidence.
270
+ - Supports deferred test cases only with rationale and follow-up owner.
271
+ - Blocks release on unresolved critical QA findings.
272
+
273
+ ### Story GATE-004: Enforce Security/SRE/DBA Gates
274
+ As a risk owner, I want required reviews enforced when a change touches my area so that material risk is not bypassed.
275
+
276
+ Acceptance criteria:
277
+ - Maps change impact to required reviewers.
278
+ - Blocks release for missing or blocking reviews.
279
+ - Supports explicit risk acceptance by authorized role.
280
+
281
+ ## Epic 10: CLI / Operator Interface
282
+
283
+ ### Story CLI-001: Initialize Workflow
284
+ As a user, I want `orchestra init` to create workflow files so that a repo can opt into orchestrated agent work.
285
+
286
+ Acceptance criteria:
287
+ - Creates `.agent-workflow/` with tasks, roles, locks, events, decisions, handoffs, evidence, and reviews directories/files.
288
+ - Does not overwrite existing files without confirmation.
289
+ - Validates generated structure.
290
+
291
+ ### Story CLI-002: Show Status
292
+ As a user, I want `orchestra status` to show workflow progress so that I can inspect current state quickly.
293
+
294
+ Acceptance criteria:
295
+ - Shows tasks, blockers, locks, pending reviews, missing evidence, and next action.
296
+ - Returns non-zero when critical blockers exist if configured for CI.
297
+ - Supports human-readable and JSON output.
298
+
299
+ ### Story CLI-003: Create Handoff
300
+ As an agent, I want `orchestra handoff` to generate and validate a handoff so that downstream agents get complete context.
301
+
302
+ Acceptance criteria:
303
+ - Accepts from role, to role, task ID, and artifact links.
304
+ - Generates role-specific template.
305
+ - Validates required fields.
306
+
307
+ ### Story CLI-004: Record Review
308
+ As a reviewer, I want `orchestra review` to approve, block, or request changes so that gate status is auditable.
309
+
310
+ Acceptance criteria:
311
+ - Records reviewer role, result, severity, findings, and artifact links.
312
+ - Updates task and gate status.
313
+ - Appends event log entry.
314
+
315
+ ### Story CLI-005: Add Evidence
316
+ As an agent, I want `orchestra evidence add` to register evidence artifacts so that tests and reviews are traceable.
317
+
318
+ Acceptance criteria:
319
+ - Supports command, file, screenshot, trace, video, log, and report evidence types.
320
+ - Links evidence to task and role.
321
+ - Validates referenced files exist when applicable.
322
+
323
+ ## Epic 11: Final Integration
324
+
325
+ ### Story INT-001: Validate Ready for Final Response
326
+ As an integrator, I want to verify all gates before final response so that the user receives a coherent and complete result.
327
+
328
+ Acceptance criteria:
329
+ - Checks tasks, blockers, locks, handoffs, reviews, evidence, and risks.
330
+ - Reports anything incomplete.
331
+ - Blocks final "done" status when required gates fail.
332
+
333
+ ### Story INT-002: Generate Final Summary
334
+ As a user, I want a final summary with changes, tests, evidence, risks, and follow-ups so that I can make a release or review decision.
335
+
336
+ Acceptance criteria:
337
+ - Summarizes completed tasks by role.
338
+ - Includes evidence links and commands run.
339
+ - Lists unresolved risks and risk acceptances.
340
+
341
+ ### Story INT-003: Generate PR Body
342
+ As a contributor, I want a PR body generated from workflow artifacts so that review context is complete.
343
+
344
+ Acceptance criteria:
345
+ - Produces summary, test plan, evidence, risks, screenshots, migrations, rollout, and rollback sections.
346
+ - Links backlog item and relevant decisions.
347
+ - Flags missing required PR sections.
348
+
349
+ ## Epic 12: QA Automation
350
+
351
+ ### Story QA-001: Identify Automation Candidates
352
+ As QA, I want manual checks classified for automation so that critical flows become repeatable.
353
+
354
+ Acceptance criteria:
355
+ - Identifies smoke, regression, high-risk, and low-value manual checks.
356
+ - Recommends Playwright for browser flows.
357
+ - Records automation owner and follow-up item.
358
+
359
+ ### Story QA-002: Generate Playwright Test Plan
360
+ As QA, I want Playwright automation planned from acceptance criteria so that E2E coverage targets user value.
361
+
362
+ Acceptance criteria:
363
+ - Defines scenarios, fixtures, page objects, selectors, assertions, and evidence settings.
364
+ - Covers happy path and critical failure paths.
365
+ - Avoids brittle selectors.
366
+
367
+ ### Story QA-003: Attach Playwright Evidence
368
+ As QA, I want screenshots, videos, and traces linked to E2E runs so that failures are diagnosable.
369
+
370
+ Acceptance criteria:
371
+ - Stores Playwright artifacts by task and test run.
372
+ - Links failed tests to traces/screenshots/videos.
373
+ - Includes artifact links in QA handoff.
374
+
375
+ ## Epic 13: Configuration and Extensibility
376
+
377
+ ### Story CFG-001: Configure Project Workflow
378
+ As an administrator, I want project-specific workflow configuration so that different repos can customize roles, gates, and templates.
379
+
380
+ Acceptance criteria:
381
+ - Supports config for roles, gates, templates, provider routing, evidence requirements, and severity thresholds.
382
+ - Validates config schema.
383
+ - Provides sensible defaults.
384
+
385
+ ### Story CFG-002: Add Custom Templates
386
+ As a team, I want custom templates for handoffs, reviews, and evidence so that workflow matches local process.
387
+
388
+ Acceptance criteria:
389
+ - Loads templates from project config.
390
+ - Falls back to default templates.
391
+ - Validates required placeholders.
392
+
393
+ ### Story CFG-003: Support Provider-Agnostic Tools
394
+ As a developer, I want tool availability configured separately from models so that agents can use shell, git, tests, Playwright, CI, and cloud tools safely.
395
+
396
+ Acceptance criteria:
397
+ - Defines tool name, permission level, allowed roles, and risk level.
398
+ - Blocks tool use when role is unauthorized.
399
+ - Logs tool use events.
400
+
401
+ ### Story CFG-004: Support Hybrid Tool Runtimes
402
+ As a developer, I want Node, Playwright, and optional Python tool runtimes configured through explicit contracts so that the orchestrator can prioritize web automation while still supporting Python-specialized work.
403
+
404
+ Acceptance criteria:
405
+ - TypeScript/Node is the default runtime for the CLI and workflow engine.
406
+ - Playwright is a first-class tool runtime for browser automation and evidence.
407
+ - Python workers are opt-in and invoked only through configured command contracts.
408
+ - Tool runtime config defines command, args, working directory, allowed roles, timeout, evidence behavior, and risk level.
409
+ - Runtime configuration is validated before any tool is executed.
410
+
411
+ ### Story CFG-005: Enforce Static Analysis Git Hooks
412
+ As a maintainer, I want version-controlled git hooks to run static analysis before commits so that low-quality or unsafe changes are blocked early.
413
+
414
+ Acceptance criteria:
415
+ - Pre-commit hook runs formatting check, lint, typecheck, secret scan, and staged-file validation.
416
+ - Hook fails closed and blocks commit on failure.
417
+ - `--no-verify` bypass is disallowed unless explicitly approved and recorded as a follow-up risk.
418
+ - CI runs the same checks plus deeper project-wide SAST, dependency, container, IaC, and E2E checks when applicable.
419
+ - Hook commands are configured through tool runtime contracts.
420
+
421
+ ## Epic 14: Governance, Privacy, and Cost
422
+
423
+ ### Story GOV-001: Enforce Retention Policy
424
+ As Compliance/Privacy, I want prompt, response, and artifact retention controlled so that sensitive information is not stored unnecessarily.
425
+
426
+ Acceptance criteria:
427
+ - Supports retention periods by artifact type.
428
+ - Supports redaction rules for secrets and PII.
429
+ - Records deletion events.
430
+
431
+ ### Story GOV-002: Track Cost and Usage
432
+ As an administrator, I want model and tool usage tracked so that agent workflows stay within budget.
433
+
434
+ Acceptance criteria:
435
+ - Tracks tokens, cost, provider, role, task, and duration.
436
+ - Enforces max cost per task or workflow when configured.
437
+ - Reports cost by role and provider.
438
+
439
+ ### Story GOV-003: Audit Risk Acceptance
440
+ As an auditor, I want risk acceptances recorded with owner and rationale so that exceptions are traceable.
441
+
442
+ Acceptance criteria:
443
+ - Records risk, severity, owner, expiration, compensating controls, and approval.
444
+ - Links risk acceptance to release decision.
445
+ - Flags expired risk acceptances.