@jterrats/open-orchestra 1.0.3 → 1.0.5

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 (86) hide show
  1. package/dist/autonomous-phase-lifecycle.js +19 -0
  2. package/dist/autonomous-phase-lifecycle.js.map +1 -1
  3. package/dist/autonomous-run-store.d.ts +2 -1
  4. package/dist/autonomous-run-store.js +4 -0
  5. package/dist/autonomous-run-store.js.map +1 -1
  6. package/dist/autonomous-workflow-constants.d.ts +1 -6
  7. package/dist/autonomous-workflow-constants.js +1 -33
  8. package/dist/autonomous-workflow-constants.js.map +1 -1
  9. package/dist/command-manifest.js +1 -1
  10. package/dist/command-manifest.js.map +1 -1
  11. package/dist/constants.d.ts +2 -4
  12. package/dist/constants.js +2 -21
  13. package/dist/constants.js.map +1 -1
  14. package/dist/defaults.d.ts +1 -0
  15. package/dist/defaults.js +1 -0
  16. package/dist/defaults.js.map +1 -1
  17. package/dist/delegation-decision.js +4 -5
  18. package/dist/delegation-decision.js.map +1 -1
  19. package/dist/delivery-dashboard.js +2 -1
  20. package/dist/delivery-dashboard.js.map +1 -1
  21. package/dist/phase-playbooks.js +32 -28
  22. package/dist/phase-playbooks.js.map +1 -1
  23. package/dist/qa-readiness.js +2 -2
  24. package/dist/qa-readiness.js.map +1 -1
  25. package/dist/release-readiness.js +3 -6
  26. package/dist/release-readiness.js.map +1 -1
  27. package/dist/runtime-execution.d.ts +10 -1
  28. package/dist/runtime-execution.js +118 -0
  29. package/dist/runtime-execution.js.map +1 -1
  30. package/dist/runtime-guardrails.js +1 -0
  31. package/dist/runtime-guardrails.js.map +1 -1
  32. package/dist/skills-catalog.js +135 -0
  33. package/dist/skills-catalog.js.map +1 -1
  34. package/dist/subagent-protocol.js +2 -1
  35. package/dist/subagent-protocol.js.map +1 -1
  36. package/dist/task-graph-commands.js +3 -12
  37. package/dist/task-graph-commands.js.map +1 -1
  38. package/dist/task-split-assessment.d.ts +19 -0
  39. package/dist/task-split-assessment.js +190 -0
  40. package/dist/task-split-assessment.js.map +1 -0
  41. package/dist/task-status.d.ts +22 -0
  42. package/dist/task-status.js +83 -0
  43. package/dist/task-status.js.map +1 -0
  44. package/dist/telemetry-records.js +2 -1
  45. package/dist/telemetry-records.js.map +1 -1
  46. package/dist/tracker-commands.js +2 -2
  47. package/dist/tracker-commands.js.map +1 -1
  48. package/dist/types/model-config.d.ts +2 -0
  49. package/dist/types/runtime.d.ts +1 -1
  50. package/dist/types/tasks.d.ts +1 -0
  51. package/dist/types/workflow-run.d.ts +15 -0
  52. package/dist/types.d.ts +1 -1
  53. package/dist/web-api.js +3 -2
  54. package/dist/web-api.js.map +1 -1
  55. package/dist/web-roles.js +2 -1
  56. package/dist/web-roles.js.map +1 -1
  57. package/dist/workflow-phase-planner.d.ts +4 -2
  58. package/dist/workflow-phase-planner.js +57 -38
  59. package/dist/workflow-phase-planner.js.map +1 -1
  60. package/dist/workflow-phases.d.ts +15 -0
  61. package/dist/workflow-phases.js +86 -0
  62. package/dist/workflow-phases.js.map +1 -0
  63. package/dist/workflow-run-commands.js +88 -2
  64. package/dist/workflow-run-commands.js.map +1 -1
  65. package/dist/workflow-services.js +4 -2
  66. package/dist/workflow-services.js.map +1 -1
  67. package/dist/workflow-task-service.js +2 -4
  68. package/dist/workflow-task-service.js.map +1 -1
  69. package/docs/autonomous-workflow.md +34 -0
  70. package/docs/backlog/chaos-testing-stack-strategy.md +146 -0
  71. package/docs/backlog/project-persona-registry-epic.md +350 -0
  72. package/docs/duplicate-code-enforcement.md +60 -0
  73. package/docs/release-test-matrix.md +14 -0
  74. package/docs/reports/duplicate-code-baseline-20260518.md +41 -0
  75. package/docs/runtime-adapters.md +44 -0
  76. package/docs/runtime-llm-flow.md +4 -2
  77. package/docs/secret-scanning-gitleaks.md +53 -0
  78. package/docs/site-manifest.json +5 -0
  79. package/docs/sonar-architecture-model.md +178 -0
  80. package/docs/sonar-quality-gates.md +178 -0
  81. package/docs/task-split-assessment.md +34 -0
  82. package/package.json +5 -1
  83. package/skills/chaos-resilience-testing/SKILL.md +127 -0
  84. package/skills/chaos-resilience-testing/manifest.json +61 -0
  85. package/skills/oclif-plugin-development/SKILL.md +118 -0
  86. package/skills/oclif-plugin-development/manifest.json +58 -0
@@ -0,0 +1,146 @@
1
+ # Story: Chaos testing stack strategy and deterministic fault harness
2
+
3
+ Backlog Item ID: CHAOS-TESTING-STACK-STRATEGY-20260517
4
+
5
+ ## User Story
6
+
7
+ As an architect, QA, SRE, security reviewer, or developer, I want a progressive
8
+ chaos testing stack so that Open Orchestra can validate failure behavior locally
9
+ first and adopt heavier tooling only when the runtime or SaaS architecture needs
10
+ it.
11
+
12
+ ## Problem
13
+
14
+ The `chaos-resilience-testing` skill defines how to reason about deterministic
15
+ failure scenarios, but the project also needs a clear tooling strategy. Without
16
+ that strategy, teams may either under-test provider/API failure modes or add
17
+ heavy infrastructure dependencies too early for the npm package.
18
+
19
+ ## Stack Strategy
20
+
21
+ ### Layer 1: MVP Local Deterministic Fault Harness
22
+
23
+ Use this layer first. It must work offline and should not add heavyweight
24
+ runtime dependencies.
25
+
26
+ Recommended tools:
27
+
28
+ - Node test runner for domain, service, CLI, and workflow tests.
29
+ - Fake model providers for timeout, unavailable provider, malformed response,
30
+ fallback, and budget exhaustion.
31
+ - Fake storage/repository adapters for partial writes, corrupted records,
32
+ stale reads, and audit write failures.
33
+ - Controlled timers, `AbortController`, and injected clocks for bounded timeout
34
+ behavior.
35
+ - Local fixtures for malformed imports, stale registry data, missing approvals,
36
+ and policy-denied activation.
37
+ - Orchestra evidence reports for scenario matrix, expected behavior, actual
38
+ behavior, final state, events, and recovery path.
39
+
40
+ Use for:
41
+
42
+ - persona registry and activation;
43
+ - provider routing and model fallbacks;
44
+ - approval and gate behavior;
45
+ - budget envelope enforcement;
46
+ - policy fail-closed behavior;
47
+ - local/offline mode.
48
+
49
+ ### Layer 2: Web/API Resilience
50
+
51
+ Use this when user-facing web or API flows need visible degraded states.
52
+
53
+ Recommended tools:
54
+
55
+ - Playwright route stubs for API timeout, 500, stale response, empty response,
56
+ slow response, and malformed payload.
57
+ - Existing web console E2E patterns for screenshots, traces, and visible state.
58
+ - Optional mock handlers such as MSW only if repeated browser/API mocking
59
+ becomes noisy with native Playwright stubs.
60
+
61
+ Use for:
62
+
63
+ - web console personas;
64
+ - dashboard/runtime status;
65
+ - approval and gate UX;
66
+ - evidence browsing;
67
+ - settings/provider/budget panels.
68
+
69
+ ### Layer 3: Integration And SaaS Simulation
70
+
71
+ Use this when tests need real network behavior or service boundaries.
72
+
73
+ Recommended tools:
74
+
75
+ - Docker Compose profiles for optional integration test stacks.
76
+ - Toxiproxy for latency, disconnects, resets, bandwidth constraints, and
77
+ intermittent network behavior.
78
+ - WireMock or equivalent HTTP stub server for external APIs when receiver-side
79
+ behavior matters.
80
+ - Pact only when consumer/provider contract testing is part of the product
81
+ contract.
82
+ - k6 for API load and resilience checks once SaaS endpoints exist.
83
+ - OpenTelemetry for correlation IDs, spans, metrics, and failure traceability.
84
+
85
+ Use for:
86
+
87
+ - SaaS supervisor or registry APIs;
88
+ - external prompt/persona registry;
89
+ - GitHub worker execution;
90
+ - tenant-scoped APIs;
91
+ - long-running runtime scheduler behavior.
92
+
93
+ ### Layer 4: Production-Grade Infrastructure Chaos
94
+
95
+ Do not include this in the npm package MVP. Use only if Open Orchestra operates
96
+ managed services on orchestration platforms.
97
+
98
+ Recommended tools:
99
+
100
+ - Chaos Mesh or LitmusChaos for Kubernetes.
101
+ - Cloud provider failure testing where permitted.
102
+ - Synthetic monitoring and SLO/error-budget checks.
103
+
104
+ Use for:
105
+
106
+ - SaaS production control plane;
107
+ - multi-tenant worker infrastructure;
108
+ - managed model gateway or registry services.
109
+
110
+ ## First Implementation Slices
111
+
112
+ 1. Provider timeout and fallback harness.
113
+ 2. Registry corruption and import failure harness.
114
+ 3. Approval race and missing approver policy harness.
115
+ 4. Policy engine fail-closed harness.
116
+ 5. Audit/event write failure harness.
117
+ 6. Budget exhaustion harness.
118
+ 7. Offline mode with optional sources unavailable.
119
+ 8. Web console stale/error/timeout state harness.
120
+
121
+ ## Acceptance Criteria
122
+
123
+ - MVP local chaos validation uses deterministic in-process faults and offline
124
+ tests first.
125
+ - Heavy tools such as Toxiproxy, Docker Compose, k6, OpenTelemetry, Chaos Mesh,
126
+ and LitmusChaos are optional progressive layers, not package MVP
127
+ dependencies.
128
+ - Every fault scenario maps to acceptance criteria, expected behavior, final
129
+ state, evidence, and recovery path.
130
+ - Security, compliance, tenant isolation, regulated authority, payment, secrets,
131
+ policy, and approval failures fail closed by default.
132
+ - Optional enrichment and advisory features may degrade only with clear user or
133
+ operator rationale.
134
+
135
+ ## Non-Goals
136
+
137
+ - Adding Toxiproxy, k6, OpenTelemetry, Chaos Mesh, or LitmusChaos dependencies
138
+ in the first implementation.
139
+ - Randomized failure injection in local unit tests.
140
+ - Running production chaos experiments from the npm package.
141
+
142
+ ## Suggested Size
143
+
144
+ S for strategy.
145
+
146
+ Future implementation slices should be estimated independently.
@@ -0,0 +1,350 @@
1
+ # Epic: Project persona registry and generated domain personas
2
+
3
+ Backlog Item ID: PERSONA-REGISTRY-EPIC-20260517
4
+
5
+ ## Epic Story
6
+
7
+ As a project owner, I want Open Orchestra to register, govern, and activate
8
+ project-specific personas through APIs and UI instead of manual markdown edits,
9
+ so that each project can orchestrate the right domain experts, reviewers, and
10
+ delivery roles for its own context.
11
+
12
+ ## Problem
13
+
14
+ Open Orchestra ships with software delivery roles, but real projects may need
15
+ domain personas that do not fit a fixed role catalog. A music production project
16
+ may need producers, mastering QA, and rights reviewers. A neural network project
17
+ may need ML researchers, MLOps, data stewards, and AI safety reviewers. A medical
18
+ project may need clinical SMEs, medical reviewers, privacy, compliance, and
19
+ regulatory reviewers.
20
+
21
+ Those personas should not require users to open or edit markdown files manually.
22
+ They also should not be blindly activated because a generated profile sounds
23
+ plausible. Projects need a registry, generation workflow, governance model, and
24
+ runtime activation rules.
25
+
26
+ ## MVP Outcome
27
+
28
+ - Local persona registry stored in project workflow state and exportable to
29
+ version-controlled artifacts.
30
+ - CLI/API operations to list, show, create, update, generate, approve,
31
+ deactivate, export, and import personas.
32
+ - Generated personas start as drafts and require human approval before runtime
33
+ activation.
34
+ - Runtime activation uses task signals, phase, required roles, risk level, and
35
+ persona triggers.
36
+ - Regulated or high-risk personas can advise and review, but cannot approve
37
+ regulated outcomes unless a human approver is configured.
38
+ - Web console can manage project personas without editing markdown files.
39
+ - Offline-first operation works from packaged baselines and local project
40
+ context; internet or SaaS enrichment is optional.
41
+
42
+ ## To-Be Outcome
43
+
44
+ - SaaS-backed persona registry with tenant isolation, versioning, approval
45
+ workflows, audit trails, quality scores, and reusable persona packs.
46
+ - Domain packs for software, music/audio, ML/AI, healthcare, data, security,
47
+ operations, education, legal/compliance, and other project types.
48
+ - Optional state-of-the-art refresh pipeline that proposes persona updates from
49
+ curated references, prompt bank entries, lessons learned, and approved domain
50
+ packs.
51
+ - Guarded supervisor can detect missing personas from project activity and
52
+ propose draft personas or capability changes.
53
+ - Runtime scheduler and budget policies constrain generation, enrichment, and
54
+ multi-agent activation.
55
+ - Chaos and resilience validation proves persona workflows degrade safely when
56
+ providers, registries, approvals, budgets, or context sources fail.
57
+
58
+ ## Persona Model
59
+
60
+ Minimum fields:
61
+
62
+ - `id`
63
+ - `displayName`
64
+ - `roleFamily`
65
+ - `domain`
66
+ - `purpose`
67
+ - `responsibilities`
68
+ - `activationTriggers`
69
+ - `workflowPhases`
70
+ - `requiredCapabilities`
71
+ - `optionalCapabilities`
72
+ - `requiredSkills`
73
+ - `authorityLevel`: advisory, reviewer, approver, executor
74
+ - `approvalConstraints`
75
+ - `evidenceExpectations`
76
+ - `securityConstraints`
77
+ - `regulatoryScope`
78
+ - `riskLevel`
79
+ - `sourcePolicy`: packaged, project, generated, imported, external
80
+ - `version`
81
+ - `status`: draft, active, deprecated, rejected
82
+ - `createdBy`
83
+ - `approvedBy`
84
+ - `provenance`
85
+
86
+ ## Proposed Child Stories
87
+
88
+ ### Story 1: Local Persona Registry API
89
+
90
+ As a project owner, I want a typed local persona registry API so that personas
91
+ can be managed without editing markdown files manually.
92
+
93
+ Acceptance criteria:
94
+
95
+ - Provides CLI/API operations: list, show, create, update, deactivate, approve,
96
+ reject, export, and import.
97
+ - Persists project personas in workflow state with schema validation and
98
+ deterministic IDs.
99
+ - Supports versioning and immutable approval provenance.
100
+ - Prevents duplicate active personas with the same project ID and role family.
101
+ - Exports approved personas to a portable version-controlled artifact.
102
+ - Rejects malformed, oversized, conflicting, or partially imported persona data
103
+ without corrupting the registry.
104
+ - Includes unit tests for create, update, approval, deactivation, import/export,
105
+ invalid schema, and duplicate prevention.
106
+
107
+ Suggested size: M.
108
+
109
+ Suggested owners: Architect, Developer, QA.
110
+
111
+ ### Story 2: Persona Generation Assistant
112
+
113
+ As a project owner, I want Open Orchestra to generate draft personas from project
114
+ needs and context so that I can define domain roles quickly without starting from
115
+ a blank file.
116
+
117
+ Acceptance criteria:
118
+
119
+ - Generates draft personas from a requested role, domain, task context,
120
+ workflow phase, existing roles, local standards, lessons learned, and approved
121
+ prompt bank entries.
122
+ - Uses offline packaged baselines first and optional external enrichment only
123
+ when enabled.
124
+ - Marks generated personas as draft and inactive by default.
125
+ - Records provenance: prompt id, context sources, model/provider when available,
126
+ generated timestamp, and reviewer requirements.
127
+ - Applies prompt-injection and secret redaction checks to context before
128
+ generation.
129
+ - Includes chaos/resilience tests for provider timeout, provider unavailable,
130
+ unsafe context, prompt registry unavailable, and budget exhaustion.
131
+ - Includes tests for draft status, provenance, source filtering, offline mode,
132
+ and blocked unsafe context.
133
+
134
+ Suggested size: L.
135
+
136
+ Suggested owners: Product Owner, Architect, Security, Developer, QA.
137
+
138
+ ### Story 3: Domain Persona Packs
139
+
140
+ As a project owner, I want reusable domain persona packs so that non-software
141
+ projects can bootstrap relevant expert profiles.
142
+
143
+ Acceptance criteria:
144
+
145
+ - Defines packaged baseline packs for software delivery, music/audio, ML/AI,
146
+ healthcare, data/analytics, security, operations, and compliance.
147
+ - Packs are compact metadata, not long prompt bodies.
148
+ - Each pack declares default personas, capabilities, activation triggers,
149
+ evidence expectations, and risk constraints.
150
+ - Healthcare and other regulated packs mark expert personas as human-approval
151
+ required for regulated decisions.
152
+ - Includes tests for pack loading, filtering by domain, and high-risk activation
153
+ constraints.
154
+
155
+ Suggested size: M.
156
+
157
+ Suggested owners: Product Manager, Architect, Compliance/Privacy, QA.
158
+
159
+ ### Story 4: Runtime Persona Activation
160
+
161
+ As a workflow runtime, I want to activate personas only when a task, phase, risk,
162
+ or required role needs them so that context stays bounded and relevant.
163
+
164
+ Acceptance criteria:
165
+
166
+ - Resolves active personas from task signals, required roles, optional roles,
167
+ phase, paths, domain, risk level, and explicit user request.
168
+ - Does not load every persona for every task.
169
+ - Returns activation rationale and skipped-persona rationale.
170
+ - Integrates with capability and skill resolution without duplicating
171
+ hardcoded role maps.
172
+ - Blocks unapproved, rejected, deprecated, or policy-ineligible personas.
173
+ - Includes chaos/resilience tests for corrupted registry state, missing
174
+ approvals, disabled persona packs, and provider-independent offline
175
+ activation.
176
+ - Includes tests for phase-scoped activation, domain triggers, no-match cases,
177
+ high-risk human approval, and capability resolution.
178
+
179
+ Suggested size: M.
180
+
181
+ Suggested owners: Architect, Developer, QA.
182
+
183
+ ### Story 5: Persona Governance and Safety Gates
184
+
185
+ As a security and compliance reviewer, I want persona creation and activation to
186
+ respect authority boundaries so that generated personas cannot approve unsafe or
187
+ regulated outcomes.
188
+
189
+ Acceptance criteria:
190
+
191
+ - Requires human approval before any generated persona becomes active.
192
+ - Requires explicit human approver mapping for regulated authority levels.
193
+ - Prevents generated medical, legal, financial, privacy, or regulatory personas
194
+ from issuing final approval unless policy allows a configured human approver.
195
+ - Records audit events for generation, approval, rejection, activation, and
196
+ deactivation.
197
+ - Adds security review when personas touch secrets, PII, PHI, financial data,
198
+ regulated decisions, network calls, or external references.
199
+ - Includes chaos/resilience tests for approval race conditions, missing approver
200
+ mappings, policy engine failure, audit write failure, and denied regulated
201
+ authority escalation.
202
+ - Includes tests for approval policy, audit events, blocked activation, and
203
+ unsafe authority escalation.
204
+
205
+ Suggested size: M.
206
+
207
+ Suggested owners: Security, Compliance/Privacy, Architect, QA.
208
+
209
+ ### Story 6: Web Console Persona Management
210
+
211
+ As a human user, I want to manage project personas in the web console so that I
212
+ can review and approve personas without editing local files.
213
+
214
+ Acceptance criteria:
215
+
216
+ - Adds a Personas management page or section with list, detail, create,
217
+ generate, edit draft, approve, reject, deactivate, export, and import flows.
218
+ - Shows persona status, authority level, domain, risk, triggers, capabilities,
219
+ evidence expectations, and approval state.
220
+ - Provides empty, loading, error, success, and recovery states.
221
+ - Uses tooltips for authority level, regulated scope, activation triggers, and
222
+ evidence expectations.
223
+ - Includes resilience coverage for API timeout, failed generation, rejected
224
+ approval, import validation failure, and stale registry data.
225
+ - Includes Playwright coverage for list, create draft, approve, reject, and
226
+ high-risk warning flows.
227
+
228
+ Suggested size: L.
229
+
230
+ Suggested owners: UX/UI Designer, Developer, QA, Technical Writer.
231
+
232
+ ### Story 7: Persona Documentation and User Guide
233
+
234
+ As a user, I want clear persona registry documentation so that I understand how
235
+ to define domain experts, generated personas, and approval constraints.
236
+
237
+ Acceptance criteria:
238
+
239
+ - Documents CLI and API usage for persona registry operations.
240
+ - Explains packaged personas, generated drafts, approval, activation, and
241
+ regulated-domain limits.
242
+ - Includes examples for software, music/audio, ML/AI, and healthcare projects.
243
+ - Documents offline-first behavior and optional SaaS/external enrichment.
244
+ - Updates the public site docs if persona management becomes user-facing.
245
+
246
+ Suggested size: S.
247
+
248
+ Suggested owners: Technical Writer, Product Owner, QA.
249
+
250
+ ## Epic Acceptance Criteria
251
+
252
+ - Persona registry avoids manual markdown editing for normal persona management.
253
+ - Persona generation produces draft, reviewable personas, not automatically
254
+ active authorities.
255
+ - Runtime activation is bounded by task need, phase, role, risk, and project
256
+ domain.
257
+ - Regulated domains require explicit human approval policies.
258
+ - Offline-first mode works without internet access.
259
+ - SaaS/external enrichment is optional and tenant-scoped when enabled.
260
+ - Child stories are independently estimable and testable.
261
+ - Chaos testing validates safe degradation for persona registry, runtime
262
+ activation, generation, governance, and web console flows.
263
+
264
+ ## Non-Goals
265
+
266
+ - Replacing built-in delivery roles in the first release.
267
+ - Building a full SaaS registry in the MVP.
268
+ - Allowing generated personas to approve regulated clinical, legal, financial,
269
+ or compliance outcomes without a configured human approver.
270
+ - Making internet access mandatory for persona generation.
271
+ - Storing raw prompts or sensitive project context by default.
272
+
273
+ ## Risks
274
+
275
+ - Generated personas may sound authoritative without enough domain validation.
276
+ - Prompt injection from lessons learned, issues, docs, or external references.
277
+ - Secret or sensitive data leakage during persona generation.
278
+ - Context bloat if runtime activation loads too many personas.
279
+ - Tenant and regulatory boundary violations in SaaS mode.
280
+ - Duplicate or conflicting personas if registry ownership is unclear.
281
+ - Workflow degradation if multiple agents generate or activate personas while
282
+ providers, approval stores, or prompt/context registries are unavailable.
283
+
284
+ ## Chaos And Resilience Testing
285
+
286
+ Persona features should load the `chaos-resilience-testing` skill for controlled
287
+ failure scenarios where they affect runtime behavior or authority. The goal is
288
+ not random fault injection in the first MVP; it is deterministic chaos-style
289
+ validation that proves the product fails closed, preserves auditability, and
290
+ keeps offline operation usable.
291
+
292
+ Minimum scenarios:
293
+
294
+ - provider timeout or unavailable model during persona generation;
295
+ - prompt bank, lessons, or external enrichment source unavailable;
296
+ - malformed, oversized, or partially imported persona registry data;
297
+ - concurrent approval/update attempts for the same persona;
298
+ - missing human approver mapping for regulated authority;
299
+ - budget envelope exhausted before or during generation;
300
+ - policy engine denies activation or fails closed;
301
+ - audit/event write failure during approval or activation;
302
+ - web console API timeout or stale registry response;
303
+ - offline mode with no external network access.
304
+
305
+ Expected behavior:
306
+
307
+ - generated personas remain `draft` unless approval succeeds;
308
+ - regulated personas cannot approve final outcomes without configured human
309
+ authority;
310
+ - runtime activation skips unsafe personas and records the rationale;
311
+ - unavailable optional sources degrade with explicit evidence instead of
312
+ blocking local workflows;
313
+ - failures produce QA evidence that maps back to the story acceptance criteria.
314
+
315
+ ## Suggested Epic Size
316
+
317
+ XL for full epic.
318
+
319
+ MVP slice: L.
320
+
321
+ Recommended first implementation order:
322
+
323
+ 1. Dynamic UX phase routing for user-facing work
324
+ (`UX-DYNAMIC-PHASE-ROUTING-20260517`) before the persona web console story.
325
+ 2. Local Persona Registry API.
326
+ 3. Runtime Persona Activation.
327
+ 4. Persona Governance and Safety Gates.
328
+ 5. Persona Generation Assistant.
329
+ 6. Web Console Persona Management.
330
+ 7. Domain Persona Packs.
331
+ 8. Documentation and user guide.
332
+
333
+ ## Related Workflow Story
334
+
335
+ `UX-DYNAMIC-PHASE-ROUTING-20260517` should add dynamic UX routing for
336
+ user-facing tasks before persona management UI is implemented. The current
337
+ workflow can recommend `ux_review` after implementation, but it does not yet
338
+ support a pre-architecture `ux_design` phase or BA/PO validation of UX artifacts
339
+ before architecture.
340
+
341
+ Expected target sequence for user-facing work:
342
+
343
+ ```txt
344
+ po/ba -> ux_design -> po_validation -> architect -> developer -> qa -> ux_review -> release
345
+ ```
346
+
347
+ The first implementation may keep this advisory when a task or global
348
+ `workflow.phaseSequence` is manually configured, but the phase planner should
349
+ make the recommendation explicit and explain why UX must provide design inputs
350
+ before architecture for UI-heavy work.
@@ -0,0 +1,60 @@
1
+ # Duplicate-Code Enforcement
2
+
3
+ Open Orchestra uses `jscpd` to make the existing DRY and
4
+ `collection-standards` rules enforceable in CI.
5
+
6
+ ## Command
7
+
8
+ ```bash
9
+ npm run duplicates
10
+ ```
11
+
12
+ The command writes machine-readable reports under
13
+ `.agent-workflow/reports/jscpd/` and prints a console summary.
14
+
15
+ ## Scope
16
+
17
+ The detector scans source, scripts, web clients, extension code, rules, skills,
18
+ and selected docs. It excludes generated output, package locks, workflow runtime
19
+ state, diagrams, historical reports, and large backlog documents that are not
20
+ maintained as product code.
21
+
22
+ The initial threshold is intentionally conservative:
23
+
24
+ - `threshold`: 5%
25
+ - `minLines`: 10
26
+ - `minTokens`: 80
27
+
28
+ This keeps the gate focused on meaningful copy-paste while avoiding noisy
29
+ failures from small examples or test setup.
30
+
31
+ ## Relationship To Collection Standards
32
+
33
+ `jscpd` detects textual duplication. It does not replace semantic review.
34
+
35
+ When the duplicate block is a repeated list, map, command matrix, provider list,
36
+ role/status list, selector set, fixture set, or validator set, remediation must
37
+ load `collection-standards` and move the values into a typed source of truth.
38
+
39
+ Examples:
40
+
41
+ - command lists should derive from the command manifest or a command catalog;
42
+ - workflow phases should derive from the workflow phase registry;
43
+ - task statuses should derive from task status helpers;
44
+ - UI dropdown options should derive from shared metadata or API contracts;
45
+ - test fixtures should use builders/factories when reused across files.
46
+
47
+ ## CI Behavior
48
+
49
+ The CI quality job runs `npm run duplicates` after the normal precommit gate.
50
+ This keeps duplicate detection visible in pull requests and release evidence.
51
+
52
+ If a finding is intentional, prefer one of these responses:
53
+
54
+ 1. Extract a shared source of truth.
55
+ 2. Narrow the scanned scope if the file is generated or historical.
56
+ 3. Add a documented exclusion only when duplication is unavoidable.
57
+ 4. Create a follow-up issue when the remediation is larger than the current
58
+ story.
59
+
60
+ Do not suppress findings silently.
@@ -40,6 +40,10 @@ manual intervention is required.
40
40
  | Flow | Command | Evidence |
41
41
  | ---------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
42
42
  | Source quality gate | `npm run precommit` | lint, typecheck, secret scan, security audit, build, unit tests, workflow validation |
43
+ | Secret scanning gate | `npm run secret-scan` | Gitleaks scan with `.gitleaks.toml` when the binary is installed; lightweight fallback for offline local development |
44
+ | Duplicate-code gate | `npm run duplicates` | jscpd duplicate-code report with generated/runtime outputs excluded and collection-standards follow-up for duplicated domain lists |
45
+ | Task split guard | `node --test test/task-split-assessment.test.js` | PO/BA functional oversize, Architect technical complexity, routine small-task non-blocking behavior, and markdown evidence rendering |
46
+ | Sonar quality gate | GitHub Actions: `Sonar` | conditional quality gate for duplication, bugs, code smells, maintainability, coverage readiness, and security hotspots when `SONAR_TOKEN` is configured |
43
47
  | Browser E2E | `npm run test:e2e` | Playwright checks map scenario acceptance criteria to visible UI state, API persistence, artifact attachment, responsive layout, and recovery behavior |
44
48
  | Installed package init | `npm run test:e2e:init` | Installed CLI checks map scenario acceptance criteria to stdout, stderr, exit code, filesystem state, JSON contracts, evidence records, and release-readiness outcomes |
45
49
  | Public site build | `npm run site:build` | production site build |
@@ -52,3 +56,13 @@ manual intervention is required.
52
56
  The default release matrix is offline-friendly. Provider and tracker tests that
53
57
  need network access must honor `SKIP_NETWORK_TESTS` and report skipped status
54
58
  instead of failing offline CI.
59
+
60
+ Sonar is conditional because it requires `SONAR_TOKEN`. When configured, a
61
+ failing Sonar quality gate blocks release on new-code quality. When unavailable
62
+ or offline, release evidence must state that Sonar was skipped and attach the
63
+ local quality gates that ran instead.
64
+
65
+ The duplicate-code gate is local and CI-friendly after dependencies are
66
+ installed. When it reports copied domain lists, command matrices, providers,
67
+ roles, statuses, fixtures, selectors, or validators, remediation should use the
68
+ `collection-standards` skill and extract a typed source of truth.
@@ -0,0 +1,41 @@
1
+ # Duplicate-Code Baseline 2026-05-18
2
+
3
+ Task: `DUPLICATE-CODE-ENFORCEMENT-20260518`
4
+
5
+ Command:
6
+
7
+ ```bash
8
+ npm run duplicates
9
+ ```
10
+
11
+ Result: pass. The configured threshold is 5%; current total duplicated lines
12
+ are 0.24%.
13
+
14
+ ## Summary
15
+
16
+ | Format | Files analyzed | Clones | Duplicated lines |
17
+ | ------ | -------------- | ------ | ---------------- |
18
+ | TypeScript | 160 | 8 | 119 (0.34%) |
19
+ | Total | 275 | 8 | 119 (0.24%) |
20
+
21
+ ## Findings
22
+
23
+ - `src/workflow-task-service.ts`: repeated mutation/event shape for task removal
24
+ paths.
25
+ - `src/workflow-approval-service.ts`: repeated approval record construction.
26
+ - `src/telemetry-export.ts`: repeated telemetry export handling.
27
+ - `src/skills-planning.ts`: repeated skill-source grouping logic.
28
+ - `src/phase-executor.ts` and `src/qa-coverage.ts`: repeated text/classification
29
+ helpers.
30
+ - `src/phase-executor.ts` and `src/planning-commands.ts`: repeated rendering or
31
+ summary logic.
32
+ - `src/cli.ts` and `src/upgrade-commands.ts`: repeated command/option parsing
33
+ shape.
34
+ - `src/autonomous-run-state.ts`: repeated phase status transition shape.
35
+
36
+ ## Decision
37
+
38
+ The baseline is accepted for this enforcement task because the duplication is
39
+ below threshold and no finding blocks CI. Future work should address repeated
40
+ domain lists or command matrices using `collection-standards`; repeated control
41
+ flow should be refactored only when it reduces meaningful complexity.
@@ -151,6 +151,50 @@ external provider processes directly; they record auditable suspend, resume,
151
151
  cancel, or close events so the parent runtime can reconcile claimed work,
152
152
  stale sessions, and handoff state without inventing a second source of truth.
153
153
 
154
+ ## Workflow Phase Executors
155
+
156
+ `workflow run` can plan how each phase should be executed without confusing the
157
+ role/profile with the runtime executor:
158
+
159
+ - **Role/profile**: PM, PO, Architect, Developer, QA, Release, or another phase
160
+ owner. This controls responsibilities, playbooks, expected evidence, and gate
161
+ authority.
162
+ - **Runtime executor**: `codex-cli`, `claude-cli`, `cursor-cli`,
163
+ `opencode-cli`, `vscode-agent`, `windsurf-agent`, or `generic-runtime`.
164
+ This controls where the brief or delegation packet is intended to run.
165
+ - **Subagent**: a runtime-native role-scoped execution unit, only available
166
+ when the selected runtime adapter declares `subagents.runtimeNative: true`.
167
+ - **Provider**: a direct model/provider route used by provider-backed phase
168
+ prompts. Provider APIs are separate from runtime-native subagents and are
169
+ never used as a silent fallback for runtime delegation.
170
+
171
+ The workflow phase execution mode can be selected per run:
172
+
173
+ ```bash
174
+ orchestra workflow run --task STORY-001 --phase-execution auto
175
+ orchestra workflow run --task STORY-001 --phase-execution subagents
176
+ orchestra workflow run --task STORY-001 --phase-execution single-agent
177
+ ```
178
+
179
+ `auto` uses runtime-native subagent packets when the selected runtime supports
180
+ them and delegation guardrails allow the spawn; otherwise it records a
181
+ parent-agent fallback reason. `subagents` requires runtime-native support and
182
+ fails fast if the runtime cannot satisfy it. `single-agent` forces the parent
183
+ agent path and records that choice in phase provenance.
184
+
185
+ Subagent spawning is bounded by `runtimePolicy.delegation.guardrails`.
186
+ `maxConcurrentDelegates` is the threshold for simultaneously running delegated
187
+ sessions, `maxSpawnsPerTask` limits fan-out for one task, and `limitAction`
188
+ controls whether pressure should `queue` or `reject`. With the default `queue`
189
+ policy, a phase that cannot acquire capacity is paused as a queued runtime
190
+ subagent instead of silently falling back to the parent agent. Resume the
191
+ workflow after capacity is released.
192
+
193
+ Each phase stores executor provenance in the workflow run and handoff:
194
+ execution mode, executor type, phase, role, runtime id, delegation packet path
195
+ when one was rendered, session id when available, fallback reason, and
196
+ `directProviderApiAllowed=false`.
197
+
154
198
  Cursor canvas sync is intentionally runtime-specific:
155
199
 
156
200
  ```bash
@@ -223,8 +223,10 @@ budget fallback.
223
223
  approval.
224
224
  - Runtime execution adapters render briefs and delegation packets, but they do
225
225
  not yet launch external CLI/IDE processes non-interactively.
226
- - It records delegation decisions, but it does not automatically spawn
227
- subagents yet.
226
+ - `workflow run --phase-execution auto|subagents|single-agent` records phase
227
+ executor provenance and can render role-scoped runtime-native delegation
228
+ packets, but the parent runtime still owns any real spawn/interaction with
229
+ external CLI or IDE subagents.
228
230
  - Parallel independent CLI commands are expected to work, but dependent commands
229
231
  still need parent-agent ordering or future DAG semantics.
230
232
  - Workflow files are local state. Promote durable lessons into docs, skills, or