@jterrats/open-orchestra 1.0.15 → 1.0.17

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 (191) hide show
  1. package/AGENTS.md +3 -3
  2. package/CLAUDE.md +26 -4
  3. package/README.md +32 -9
  4. package/dist/benchmark.js +65 -27
  5. package/dist/benchmark.js.map +1 -1
  6. package/dist/command-manifest.js +6 -1
  7. package/dist/command-manifest.js.map +1 -1
  8. package/dist/command-routes.js +8 -1
  9. package/dist/command-routes.js.map +1 -1
  10. package/dist/commands.d.ts +2 -1
  11. package/dist/commands.js +2 -1
  12. package/dist/commands.js.map +1 -1
  13. package/dist/context-vault-commands.d.ts +5 -0
  14. package/dist/context-vault-commands.js +79 -0
  15. package/dist/context-vault-commands.js.map +1 -0
  16. package/dist/context-vault-file-metadata.d.ts +3 -0
  17. package/dist/context-vault-file-metadata.js +25 -0
  18. package/dist/context-vault-file-metadata.js.map +1 -0
  19. package/dist/context-vault-model.d.ts +79 -0
  20. package/dist/context-vault-model.js +2 -0
  21. package/dist/context-vault-model.js.map +1 -0
  22. package/dist/context-vault-redaction.d.ts +5 -0
  23. package/dist/context-vault-redaction.js +22 -0
  24. package/dist/context-vault-redaction.js.map +1 -0
  25. package/dist/context-vault-renderer.d.ts +3 -0
  26. package/dist/context-vault-renderer.js +30 -0
  27. package/dist/context-vault-renderer.js.map +1 -0
  28. package/dist/context-vault-service.d.ts +17 -0
  29. package/dist/context-vault-service.js +183 -0
  30. package/dist/context-vault-service.js.map +1 -0
  31. package/dist/delivery-commands.d.ts +1 -0
  32. package/dist/delivery-commands.js +19 -1
  33. package/dist/delivery-commands.js.map +1 -1
  34. package/dist/diagram-schema.d.ts +2 -0
  35. package/dist/diagram-schema.js +148 -0
  36. package/dist/diagram-schema.js.map +1 -0
  37. package/dist/diagrams/index.d.ts +2 -0
  38. package/dist/diagrams/index.js +2 -0
  39. package/dist/diagrams/index.js.map +1 -1
  40. package/dist/diagrams/pipeline.js +7 -5
  41. package/dist/diagrams/pipeline.js.map +1 -1
  42. package/dist/evidence-compaction-model.d.ts +62 -0
  43. package/dist/evidence-compaction-model.js +2 -0
  44. package/dist/evidence-compaction-model.js.map +1 -0
  45. package/dist/evidence-compaction-renderer.d.ts +2 -0
  46. package/dist/evidence-compaction-renderer.js +35 -0
  47. package/dist/evidence-compaction-renderer.js.map +1 -0
  48. package/dist/evidence-compaction-service.d.ts +11 -0
  49. package/dist/evidence-compaction-service.js +94 -0
  50. package/dist/evidence-compaction-service.js.map +1 -0
  51. package/dist/evidence-compaction-summary.d.ts +4 -0
  52. package/dist/evidence-compaction-summary.js +160 -0
  53. package/dist/evidence-compaction-summary.js.map +1 -0
  54. package/dist/knowledge-base.js +7 -1
  55. package/dist/knowledge-base.js.map +1 -1
  56. package/dist/metrics-commands.js +3 -0
  57. package/dist/metrics-commands.js.map +1 -1
  58. package/dist/planning-commands.js +23 -1
  59. package/dist/planning-commands.js.map +1 -1
  60. package/dist/quality-contracts.js +12 -6
  61. package/dist/quality-contracts.js.map +1 -1
  62. package/dist/report-index.d.ts +3 -0
  63. package/dist/report-index.js +3 -0
  64. package/dist/report-index.js.map +1 -0
  65. package/dist/report-model.d.ts +22 -0
  66. package/dist/report-model.js +2 -0
  67. package/dist/report-model.js.map +1 -0
  68. package/dist/report-render-markdown.d.ts +1 -0
  69. package/dist/report-render-markdown.js +40 -0
  70. package/dist/report-render-markdown.js.map +1 -0
  71. package/dist/report-schema.d.ts +2 -0
  72. package/dist/report-schema.js +109 -0
  73. package/dist/report-schema.js.map +1 -0
  74. package/dist/rule-catalog.d.ts +33 -0
  75. package/dist/rule-catalog.js +215 -0
  76. package/dist/rule-catalog.js.map +1 -0
  77. package/dist/runtime-bootstrap.js +33 -8
  78. package/dist/runtime-bootstrap.js.map +1 -1
  79. package/dist/runtime-capacity-policy.d.ts +38 -0
  80. package/dist/runtime-capacity-policy.js +117 -0
  81. package/dist/runtime-capacity-policy.js.map +1 -0
  82. package/dist/runtime-capacity-scheduler-helpers.d.ts +40 -0
  83. package/dist/runtime-capacity-scheduler-helpers.js +111 -0
  84. package/dist/runtime-capacity-scheduler-helpers.js.map +1 -0
  85. package/dist/runtime-capacity-scheduler-state.d.ts +44 -0
  86. package/dist/runtime-capacity-scheduler-state.js +128 -0
  87. package/dist/runtime-capacity-scheduler-state.js.map +1 -0
  88. package/dist/runtime-capacity-scheduler.d.ts +34 -0
  89. package/dist/runtime-capacity-scheduler.js +193 -0
  90. package/dist/runtime-capacity-scheduler.js.map +1 -0
  91. package/dist/runtime-capacity-snapshot.d.ts +14 -0
  92. package/dist/runtime-capacity-snapshot.js +87 -0
  93. package/dist/runtime-capacity-snapshot.js.map +1 -0
  94. package/dist/runtime-child-prompt.d.ts +2 -1
  95. package/dist/runtime-child-prompt.js +4 -1
  96. package/dist/runtime-child-prompt.js.map +1 -1
  97. package/dist/runtime-claude-native-bridge.js +2 -1
  98. package/dist/runtime-claude-native-bridge.js.map +1 -1
  99. package/dist/runtime-commands.js +6 -0
  100. package/dist/runtime-commands.js.map +1 -1
  101. package/dist/runtime-context-manifest.js +3 -24
  102. package/dist/runtime-context-manifest.js.map +1 -1
  103. package/dist/runtime-lifecycle-watch.d.ts +5 -2
  104. package/dist/runtime-lifecycle-watch.js +19 -3
  105. package/dist/runtime-lifecycle-watch.js.map +1 -1
  106. package/dist/runtime-load-balancer.d.ts +12 -0
  107. package/dist/runtime-load-balancer.js +106 -0
  108. package/dist/runtime-load-balancer.js.map +1 -0
  109. package/dist/runtime-spawn-bridge.js +23 -0
  110. package/dist/runtime-spawn-bridge.js.map +1 -1
  111. package/dist/runtime-spawn-guidance.js +15 -0
  112. package/dist/runtime-spawn-guidance.js.map +1 -1
  113. package/dist/runtime-worker-registry.d.ts +19 -0
  114. package/dist/runtime-worker-registry.js +84 -0
  115. package/dist/runtime-worker-registry.js.map +1 -0
  116. package/dist/security/content-classifier.d.ts +2 -0
  117. package/dist/security/content-classifier.js +147 -0
  118. package/dist/security/content-classifier.js.map +1 -0
  119. package/dist/security/operation-contract-types.d.ts +28 -0
  120. package/dist/security/operation-contract-types.js +2 -0
  121. package/dist/security/operation-contract-types.js.map +1 -0
  122. package/dist/security/operation-contract.d.ts +2 -0
  123. package/dist/security/operation-contract.js +169 -0
  124. package/dist/security/operation-contract.js.map +1 -0
  125. package/dist/security/policy-engine.d.ts +2 -0
  126. package/dist/security/policy-engine.js +142 -0
  127. package/dist/security/policy-engine.js.map +1 -0
  128. package/dist/security/policy-types.d.ts +79 -0
  129. package/dist/security/policy-types.js +7 -0
  130. package/dist/security/policy-types.js.map +1 -0
  131. package/dist/security/prompt-intake.d.ts +13 -0
  132. package/dist/security/prompt-intake.js +33 -0
  133. package/dist/security/prompt-intake.js.map +1 -0
  134. package/dist/security/redaction.d.ts +3 -0
  135. package/dist/security/redaction.js +64 -0
  136. package/dist/security/redaction.js.map +1 -0
  137. package/dist/security/sink-encoding.d.ts +6 -0
  138. package/dist/security/sink-encoding.js +40 -0
  139. package/dist/security/sink-encoding.js.map +1 -0
  140. package/dist/sprint-commands.js +33 -22
  141. package/dist/sprint-commands.js.map +1 -1
  142. package/dist/structured-output-validation.d.ts +9 -0
  143. package/dist/structured-output-validation.js +20 -0
  144. package/dist/structured-output-validation.js.map +1 -0
  145. package/dist/transcription-failures.d.ts +2 -0
  146. package/dist/transcription-failures.js +4 -0
  147. package/dist/transcription-failures.js.map +1 -0
  148. package/dist/transcription-media-preflight.d.ts +9 -0
  149. package/dist/transcription-media-preflight.js +147 -0
  150. package/dist/transcription-media-preflight.js.map +1 -0
  151. package/dist/transcription-request.d.ts +13 -0
  152. package/dist/transcription-request.js +150 -0
  153. package/dist/transcription-request.js.map +1 -0
  154. package/dist/transcription-source-policy.d.ts +4 -0
  155. package/dist/transcription-source-policy.js +43 -0
  156. package/dist/transcription-source-policy.js.map +1 -0
  157. package/dist/transcription-types.d.ts +161 -0
  158. package/dist/transcription-types.js +2 -0
  159. package/dist/transcription-types.js.map +1 -0
  160. package/dist/types/runtime.d.ts +147 -0
  161. package/dist/types.d.ts +3 -1
  162. package/dist/types.js +1 -0
  163. package/dist/types.js.map +1 -1
  164. package/dist/web-api-read-routes.js +2 -0
  165. package/dist/web-api-read-routes.js.map +1 -1
  166. package/dist/web-console/assets/index-BJuVTqfQ.js +11 -0
  167. package/dist/web-console/index.html +1 -1
  168. package/dist/workflow-evidence-service.js +16 -0
  169. package/dist/workflow-evidence-service.js.map +1 -1
  170. package/dist/workflow-phase-planner.js +5 -3
  171. package/dist/workflow-phase-planner.js.map +1 -1
  172. package/dist/workflow-phases.js +5 -0
  173. package/dist/workflow-phases.js.map +1 -1
  174. package/dist/workflow-run-commands.js +89 -10
  175. package/dist/workflow-run-commands.js.map +1 -1
  176. package/dist/workflow-services.d.ts +1 -0
  177. package/dist/workflow-services.js +8 -1
  178. package/dist/workflow-services.js.map +1 -1
  179. package/docs/audio-video-transcription-skill.md +102 -70
  180. package/docs/autonomous-workflow.md +3 -3
  181. package/docs/context-vault.md +34 -11
  182. package/docs/diagrams/deterministic-pipeline/README.md +35 -1
  183. package/docs/evidence-compaction.md +25 -0
  184. package/docs/rule-loading-strategy.md +37 -0
  185. package/docs/runtime-adapters.md +7 -0
  186. package/docs/runtime-capacity.md +57 -0
  187. package/docs/security-saas-orchestrator.md +368 -0
  188. package/docs/sonar-quality-gates.md +1 -1
  189. package/package.json +1 -1
  190. package/rules/development/semantic-code.md +28 -0
  191. package/dist/web-console/assets/index-Bis4CecA.js +0 -11
@@ -17,7 +17,9 @@ diagrams:
17
17
  connector endpoints, connector-node overlaps, connector labels covering
18
18
  other lines, and unnecessary bends where the path is already straight.
19
19
  5. `generateDeterministicDiagram()` ties model, layout, rendering, and
20
- validation together for a single pass.
20
+ validation together for a single pass. It first validates the runtime
21
+ payload against the structured diagram schema and fails with field-level
22
+ errors before any layout or SVG rendering occurs.
21
23
  6. `runDeterministicDiagramPipeline()` adds bounded iteration. It renders the
22
24
  first pass, applies deterministic text-fit repair when possible, regenerates
23
25
  the artifact, and retains only the final artifact unless
@@ -28,6 +30,38 @@ this does not widen `command-routes*` or `tool-commands` ownership in the same
28
30
  change. Consumers can call `runDeterministicDiagramPipeline()` directly to get a
29
31
  stable final SVG plus optional retained iteration artifacts.
30
32
 
33
+ ## Structured Output Contracts
34
+
35
+ Agents that generate deterministic artifacts must return structured JSON-like
36
+ payloads, not prose instructions for renderers to interpret.
37
+
38
+ Diagram payloads must satisfy `DiagramModel`:
39
+
40
+ - `id`, `title`, and `direction` are required.
41
+ - `direction` must be `right` or `down`.
42
+ - `nodes` must be a non-empty array. Each node needs `id`, `kind`, and
43
+ `text.label`; `kind` must be one of `actor`, `system`, `service`, `database`,
44
+ `queue`, or `boundary`.
45
+ - `connectors` must be an array. Each connector needs `id`, `from`, `to`, and
46
+ `kind`; `from` and `to` must reference known node ids; `kind` must be one of
47
+ `sync`, `async`, `data`, or `control`.
48
+ - Optional `groups` define labeled containers. Unused groups are allowed so
49
+ generated drafts can keep future grouping intent, but duplicate group ids are
50
+ rejected.
51
+
52
+ Report payloads use `ReportDocument` through `renderReportMarkdown()`:
53
+
54
+ - `id`, `title`, `summary`, and a non-empty `sections` array are required.
55
+ - Section `kind` must be one of `summary`, `findings`, `decisions`, `risks`,
56
+ `evidence`, or `nextSteps`.
57
+ - Section items require `id` and `text`; optional severity must be one of
58
+ `info`, `low`, `medium`, `high`, or `critical`.
59
+
60
+ Validation errors include JSON-path-like locations, for example
61
+ `$.connectors[0].to: references unknown node "api-gateway"`. Agent prompts
62
+ should pass those messages back to the generating role unchanged so the payload
63
+ can be corrected without guessing which field failed.
64
+
31
65
  ## Icon Policy
32
66
 
33
67
  Diagram nodes reference icons by semantic purpose and Iconify id. Rendering
@@ -0,0 +1,25 @@
1
+ # Evidence Compaction
2
+
3
+ Use evidence compaction when a task has enough evidence artifacts to make
4
+ workflow context noisy.
5
+
6
+ ```sh
7
+ orchestra evidence compact --task GH-471 --threshold 20
8
+ ```
9
+
10
+ The command writes Markdown and JSON summaries under
11
+ `.agent-workflow/evidence-summaries/`. Raw evidence files are not modified or
12
+ deleted; summary artifacts keep links to every raw evidence artifact.
13
+
14
+ Compaction groups evidence by task, role, type, and result. It preserves failed
15
+ evidence, unresolved or residual risk lines, and acceptance criteria references
16
+ found through exact criterion text or `AC-<number>` mentions.
17
+
18
+ Task context rendering uses an in-memory evidence summary when the evidence
19
+ count reaches the configured threshold. Override the default threshold with:
20
+
21
+ ```sh
22
+ orchestra context --task GH-471 --evidence-summary-threshold 10
23
+ ```
24
+
25
+ For process-wide defaults, set `ORCHESTRA_EVIDENCE_SUMMARY_THRESHOLD`.
@@ -0,0 +1,37 @@
1
+ # Rule Loading Strategy
2
+
3
+ Open Orchestra treats detailed delivery rules as neutral source material that can
4
+ be rendered or referenced by each runtime. Cursor `.mdc` files are supported
5
+ runtime outputs, but they are not the universal source of truth.
6
+
7
+ ## Source Model
8
+
9
+ - Root files such as `AGENTS.md`, `CLAUDE.md`, and `ORCHESTRA.md` stay compact.
10
+ - `src/rule-catalog.ts` owns rule metadata: id, title, canonical path, roles,
11
+ capabilities, triggers, and risk areas.
12
+ - Detailed rule content lives under `rules/` using the format that best fits the
13
+ rule. Cursor-specific `.mdc` files remain valid rendered or legacy targets.
14
+ - Runtime context manifests and quality contracts resolve rules by id instead of
15
+ hardcoding Cursor paths.
16
+
17
+ ## Runtime Behavior
18
+
19
+ For a task or phase, Orchestra selects rules from:
20
+
21
+ - active role and required roles;
22
+ - capabilities needed by the work;
23
+ - task title, goal, scope, paths, risks, and acceptance criteria;
24
+ - phase-specific evidence and handoff requirements.
25
+
26
+ The selected rules are injected as context references or excerpts for the active
27
+ runtime. A runtime may render the same rule source differently: Codex receives
28
+ compact markdown references, Claude can load markdown files, Cursor can receive
29
+ `.mdc`, and VS Code-style integrations can consume structured JSON.
30
+
31
+ ## Semantic Code Rule
32
+
33
+ Implementation roles should load `semantic-code` when writing or reviewing code,
34
+ automation, scripts, tests, or architecture-sensitive refactors. The rule
35
+ requires code to be readable by intent through domain naming, narrow types,
36
+ focused helpers, and clear boundaries. Comments should explain why, trade-offs,
37
+ or non-obvious constraints, not restate the code.
@@ -519,6 +519,13 @@ workflow after capacity is released. Manual `runtime spawn-request` calls follow
519
519
  the same guardrails: `queue` materializes a queued request artifact and session,
520
520
  while `reject` fails before creating a delegation artifact.
521
521
 
522
+ Default local runtime-native guardrails allow 3 concurrent delegated sessions
523
+ and 3 spawns per task. The separate SaaS-capacity scheduler defaults to 3 active
524
+ runtime leases, 25 queued requests, 2 active requests per provider, and 3 active
525
+ requests per runtime within the evaluated platform, tenant, and workspace
526
+ policies. Hosted deployments should override those thresholds per tenant and
527
+ workspace before enabling runtime-native dispatch.
528
+
522
529
  For multi-squad work, the parent renders one spawn request per independent
523
530
  squad/role/phase. Each detached session is tracked independently by `sessionId`;
524
531
  completion order is intentionally non-deterministic. Release aggregation,
@@ -0,0 +1,57 @@
1
+ # Runtime Capacity Model
2
+
3
+ Open Orchestra runtime capacity is modeled as a deterministic local-first
4
+ contract. Local runs use the implicit `local/local/local-workspace` scope; SaaS
5
+ mode requires every request, queue item, lease, event, and snapshot to carry
6
+ tenant and workspace scope.
7
+
8
+ ## Core Concepts
9
+
10
+ - `RuntimeCapacityScope`: platform, tenant, and workspace identity.
11
+ - `RuntimeWorkloadClass`: interactive, workflow phase, runtime-native spawn,
12
+ provider-backed phase, background maintenance, or evidence processing.
13
+ - `RuntimeCapacityUnit`: weighted runtime demand, currently enforced by
14
+ `concurrencyUnits` with optional budget and resource hints.
15
+ - `RuntimeQuotaPolicy`: platform, tenant, and workspace active/queued limits,
16
+ provider/runtime caps, and queue/reject behavior.
17
+ - `RuntimeWorkerRecord`: registered worker capabilities, tenant affinity,
18
+ regions, supported providers/runtimes/workload classes, health, capacity, and
19
+ isolation metadata.
20
+
21
+ ## Scheduler Decisions
22
+
23
+ `RuntimeCapacityScheduler.schedule()` returns one typed decision:
24
+
25
+ - `admitted`: a `RuntimeLease` was granted for a specific worker.
26
+ - `queued`: quota or worker capacity can recover and the request is accepted
27
+ into a scoped queue.
28
+ - `rejected`: the request is invalid or the configured policy does not allow
29
+ queueing.
30
+ - `deferred`: no eligible worker is available and queueing is disabled.
31
+
32
+ Evaluation is fail-closed: request validation, SaaS scope, platform quota,
33
+ tenant quota, workspace quota, provider/runtime caps, then worker selection.
34
+ Queue limits are enforced at platform, tenant, and workspace levels before a
35
+ queue decision is returned.
36
+
37
+ ## Load Balancing
38
+
39
+ Worker selection is constraint-first and score-second. Eligibility checks tenant
40
+ affinity, denied tenants, workload class, runtime/provider support, region and
41
+ data residency, health, heartbeat freshness, open circuits, and available
42
+ capacity. Scoring is deterministic: available capacity, queue depth, failure
43
+ count, region preference, health, and tenant affinity are sorted with worker id
44
+ as the final tie breaker.
45
+
46
+ ## Isolation
47
+
48
+ SaaS mode rejects missing tenant/workspace scope. Snapshots can be filtered by
49
+ scope so tenant-facing queue evidence does not expose other tenants. Decision
50
+ messages use stable reason codes and user-safe summaries rather than worker
51
+ internals, queue depths from other tenants, paths, or provider details.
52
+
53
+ ## Current Boundary
54
+
55
+ This story intentionally keeps capacity state in memory. Hosted queues,
56
+ transactional worker leases, tenant-secret routing, and data residency
57
+ persistence remain follow-up architecture and security work before SaaS release.
@@ -0,0 +1,368 @@
1
+ # SaaS And Orchestrator Security Definition
2
+
3
+ ## Purpose
4
+
5
+ Open Orchestra is local-first workflow orchestration for humans and agent
6
+ runtimes. The CLI owns the current source of truth in `.agent-workflow/`; the
7
+ web console, runtime adapters, provider-backed phases, tracker integrations, and
8
+ future SaaS surfaces must preserve that local trust model instead of turning
9
+ agent automation into an implicit privileged service.
10
+
11
+ This document defines the baseline security model for the local CLI and the
12
+ future SaaS orchestrator. It intentionally avoids secrets, tenant identifiers,
13
+ private hosts, and production endpoints.
14
+
15
+ ## Security Objectives
16
+
17
+ - Keep local repositories, workflow state, secrets, and evidence under explicit
18
+ user or tenant control.
19
+ - Treat prompts, issues, comments, model output, uploaded artifacts, generated
20
+ plans, tool metadata, and runtime handoffs as untrusted input.
21
+ - Fail closed for cross-tenant access, secret exposure, unsafe writes, shell
22
+ execution, provider policy violations, and evidence integrity failures.
23
+ - Make every privileged action reviewable through role gates, policy decisions,
24
+ and evidence records.
25
+ - Support offline local development without weakening the SaaS security posture.
26
+
27
+ ## System View
28
+
29
+ ```mermaid
30
+ flowchart LR
31
+ human["Human operator"]
32
+ cli["Local CLI"]
33
+ web["Local web console"]
34
+ api["Future SaaS API"]
35
+ workflow["Workflow core"]
36
+ state[".agent-workflow state"]
37
+ workers["SaaS workers"]
38
+ runtimes["Agent runtimes"]
39
+ tools["MCP and local tools"]
40
+ providers["Model providers"]
41
+ trackers["GitHub, Sonar, trackers"]
42
+ storage["Tenant storage and evidence ledger"]
43
+
44
+ human --> cli
45
+ human --> web
46
+ web --> cli
47
+ cli --> workflow
48
+ workflow --> state
49
+ workflow --> runtimes
50
+ workflow --> tools
51
+ workflow --> providers
52
+ workflow --> trackers
53
+ api --> workers
54
+ workers --> storage
55
+ workers --> providers
56
+ workers --> trackers
57
+ workers --> runtimes
58
+ ```
59
+
60
+ The local CLI remains the default control plane. SaaS components may coordinate,
61
+ store sanitized workflow metadata, and run isolated workers, but they must not
62
+ receive raw secrets, raw repository contents, or direct runtime authority unless
63
+ tenant policy and role gates explicitly allow it.
64
+
65
+ ## Trust Boundaries
66
+
67
+ - Human to CLI: trust the installed CLI binary, local config, and explicit
68
+ flags. Treat terminal input, pasted prompts, and shell environment as
69
+ untrusted. Require argument validation, safe defaults, no secret echo, and
70
+ confirmation before writes outside known workflow paths.
71
+ - CLI to workspace: trust the workspace root and allowlisted
72
+ `.agent-workflow/` paths. Treat user files, symlinks, generated paths, and
73
+ imported archives as untrusted. Require root containment, path traversal
74
+ rejection, symlink escape checks, and dry-run before broad writes.
75
+ - Local web console to CLI/API: trust the loopback-only local service and
76
+ command contracts. Treat browser input, request bodies, and local plugins as
77
+ untrusted. Require CSRF-aware mutations, strict JSON validation, no arbitrary
78
+ command endpoint, and sanitized errors.
79
+ - SaaS API to tenant workers: trust authenticated tenant context and policy.
80
+ Treat requests, uploaded artifacts, and webhook payloads as untrusted.
81
+ Require AuthN/AuthZ, tenant scoping, schema validation, rate limits, audit
82
+ logs, malware scanning, and secret scanning.
83
+ - Tenant to tenant: trust only the current tenant partition. Treat other
84
+ tenants, shared queues, and shared caches as untrusted. Require mandatory
85
+ tenant id in every data access path, row or storage isolation, cache key
86
+ partitioning, and per-tenant encryption context.
87
+ - Workflow core to runtimes: trust the rendered task packet and allowed
88
+ commands. Treat runtime instructions, child agent output, and handoff files as
89
+ untrusted. Require prompt-injection checks, ownership path limits, lifecycle
90
+ attestation, and no provider keys in packets.
91
+ - Runtime to tools/MCP: trust tool registry metadata and approved scopes. Treat
92
+ tool descriptions, tool results, and external MCP servers as untrusted.
93
+ Require tool identity pinning, capability allowlists, OAuth token isolation,
94
+ and output sanitization.
95
+ - Provider-backed phases: trust provider adapter policy and redacted context.
96
+ Treat model outputs and provider errors as untrusted. Require explicit opt-in,
97
+ tenant data policy, prompt and output filtering, cost limits, budget limits,
98
+ and redacted error handling.
99
+ - Trackers and scanners: trust stable adapter contracts. Treat issues,
100
+ comments, scan reports, and CI logs as untrusted. Require remote text to be
101
+ handled as data, redact secrets, and verify webhook signatures when
102
+ applicable.
103
+ - Evidence ledger: trust append-only local or tenant evidence records. Treat
104
+ generated evidence, command logs, screenshots, and runtime claims as
105
+ untrusted. Require hashing, provenance, immutable event ids, reviewer
106
+ sign-off, and tamper-evident summaries.
107
+ - Storage and backups: trust tenant storage service and KMS policy. Treat
108
+ object keys, retained artifacts, and backup restore paths as untrusted.
109
+ Require encryption at rest, retention policy, restore testing, access logs,
110
+ and delete workflows.
111
+
112
+ ## Threat Model
113
+
114
+ - Prompt injection: untrusted text asks an agent to ignore gates, reveal
115
+ secrets, or mutate files. Treat instructions from issues, docs, comments,
116
+ tools, and model output as data; enforce system policy outside the prompt.
117
+ - Indirect prompt injection: a retrieved artifact hides malicious instructions
118
+ in evidence, PDFs, websites, or tool results. Scan and label context sources,
119
+ then strip or quarantine high-risk instruction patterns before runtime
120
+ packets.
121
+ - SQL or NoSQL injection: tenant filters or search queries alter data access.
122
+ Use parameterized queries, typed repositories, schema validation, and tenant
123
+ predicates applied server-side.
124
+ - Command injection: user or model text reaches a shell command. Use
125
+ `execFile` or `spawn` with argument arrays; block shell interpolation and
126
+ `shell: true` unless a reviewed exception exists.
127
+ - SSRF: SaaS workers fetch attacker-controlled internal URLs. Allow only
128
+ `https://` URLs, deny private and metadata address ranges, use egress policy,
129
+ and avoid server-side fetches without approval.
130
+ - Path traversal: generated paths escape the workspace or tenant storage
131
+ prefix. Resolve canonical paths, reject `..` and symlink escapes, and require
132
+ approved roots for secure files.
133
+ - Secrets exfiltration: tokens appear in prompts, evidence, logs, provider
134
+ errors, or artifacts. Load secrets from secret managers or approved local
135
+ files, redact before persistence, and never send secrets to model context.
136
+ - Tenant isolation failure: a request, cache, worker, or artifact crosses tenant
137
+ scope. Require tenant-scoped auth, data access, queue names, cache keys,
138
+ storage prefixes, audit events, and encryption context.
139
+ - Unsafe file writes: runtime or SaaS worker writes outside intended docs,
140
+ workflow, or output paths. Require ownership paths, dry-run previews for broad
141
+ changes, path policy checks, and user approval for sensitive writes.
142
+ - Tool impersonation: a malicious tool mimics a trusted MCP server, scanner, or
143
+ runtime adapter. Pin tool identity, origin, executable path, version, and
144
+ capability manifest; reject writable PATH tool discovery for sensitive tools.
145
+ - Evidence tampering: a runtime edits evidence or claims tests passed without
146
+ proof. Require append-only evidence events, command metadata, hashes for large
147
+ artifacts, reviewer gates, and mismatch detection.
148
+ - Cross-site request forgery: a browser triggers local web console mutations.
149
+ Keep local services loopback-only by default, require mutation tokens or
150
+ same-origin controls, and avoid ambient credentials.
151
+ - Dependency compromise: a package or binary changes behavior after install.
152
+ Pin lockfiles, scan dependencies, verify sensitive binaries from trusted
153
+ paths, and keep dependency updates atomic.
154
+ - Denial of wallet or quota: provider-backed phases consume unexpected tokens,
155
+ jobs, or storage. Enforce per-task and per-tenant budgets, rate limits,
156
+ cancellation, cost evidence, and fail-closed budget handling.
157
+
158
+ ## Secure-By-Default Controls
159
+
160
+ ### Deterministic Policy Engine
161
+
162
+ The orchestration policy engine is a typed domain boundary, not prompt text.
163
+ It should expose one deterministic decision contract used by CLI commands,
164
+ runtime packet rendering, provider requests, tool calls, evidence writes,
165
+ tracker/webhook adapters, and future SaaS workers. Every sensitive operation
166
+ must pass a complete policy subject, action, resource, tenant/workspace scope,
167
+ data classification, and sink before side effects begin. Missing, ambiguous, or
168
+ schema-invalid input denies by default and records a sanitized reason.
169
+
170
+ Recommended module boundaries:
171
+
172
+ - `src/security/policy-types.ts`: discriminated unions for policy subjects,
173
+ actions, resources, sinks, decisions, redaction status, and denial reasons.
174
+ - `src/security/policy-engine.ts`: pure decision engine and rule registry. It
175
+ performs no filesystem, network, shell, provider, or persistence I/O.
176
+ - `src/security/prompt-intake.ts`: deserializes prompt/runtime packets into
177
+ typed segments and classifies each segment as instruction, data, tool input,
178
+ tool output, evidence, provider response, or unknown.
179
+ - `src/security/content-classifier.ts`: deterministic detectors for
180
+ query-like and executable-like strings, prompt-injection patterns, path
181
+ traversal, SSRF candidates, shell metacharacters, SQL/NoSQL-like payloads,
182
+ and secret-shaped values.
183
+ - `src/security/redaction.ts`: redacts restricted values, marks quarantined
184
+ segments, and returns a redaction report before persistence or model reuse.
185
+ - `src/security/sink-encoding.ts`: sink-specific escaping and encoding for
186
+ Markdown, JSON, shell arguments, URLs, HTML/text UI, logs, evidence, and
187
+ provider messages.
188
+ - `src/security/path-policy.ts`, `url-policy.ts`, `command-policy.ts`,
189
+ `tenant-policy.ts`, `tool-policy.ts`, `provider-policy.ts`,
190
+ `evidence-policy.ts`, and `runtime-packet-policy.ts`: focused rule modules
191
+ plugged into the pure engine.
192
+ - Existing adapters such as CLI commands, runtime renderers, provider
193
+ adapters, MCP/tool adapters, and workflow evidence services stay thin: build
194
+ typed policy requests, call the engine, then execute or fail closed.
195
+
196
+ Prompt/content intake pipeline:
197
+
198
+ 1. Deserialize all prompt packets, context packs, tool results, provider
199
+ responses, handoffs, issue text, and evidence snippets with strict schemas.
200
+ Unknown fields and malformed envelopes become `unknown` segments and are not
201
+ forwarded to sensitive sinks.
202
+ 2. Split content into typed segments with provenance, tenant/workspace/task
203
+ scope, source artifact, declared sink, and original byte length.
204
+ 3. Detect query-like strings (`SELECT`, GraphQL-like bodies, JSON filters,
205
+ search expressions), executable-like strings (shell fragments, command
206
+ substitutions, shebangs, PowerShell, SQL/NoSQL mutation verbs), and
207
+ instruction-like text asking agents to ignore policy or reveal secrets.
208
+ 4. Classify each segment as data, instruction, tool input, tool output,
209
+ evidence, provider response, or unknown. Remote text is data by default;
210
+ only trusted system-authored templates may become instruction segments.
211
+ 5. Redact restricted values before persistence, provider calls, logs, telemetry,
212
+ and evidence summaries. Quarantine segments when redaction confidence is
213
+ low, executable intent appears in a data segment, or the destination sink
214
+ cannot safely encode it.
215
+ 6. Encode for the exact sink immediately before use: argument arrays for
216
+ commands, canonicalized `https://` URLs for fetches, JSON string escaping
217
+ for packets, Markdown escaping for handoffs, `textContent`/HTML escaping for
218
+ UI, and provider-message wrapping that labels untrusted text as data.
219
+
220
+ Policy decisions should be append-only evidence inputs with request id, task id,
221
+ actor, action, resource summary, decision (`allow`, `deny`, `requiresApproval`,
222
+ `quarantine`), matched rule ids, redaction status, and sanitized reasons. They
223
+ must not include raw secrets, full prompt bodies, bearer headers, or internal
224
+ stack traces.
225
+
226
+ ### Local CLI
227
+
228
+ - Default to local-only operation; network calls require an explicit command,
229
+ configured adapter, or CI-owned workflow.
230
+ - Keep `.agent-workflow/` as the auditable source of task, decision, evidence,
231
+ review, and release state.
232
+ - Validate workspace roots before writes and reject unsafe roots without
233
+ explicit confirmation.
234
+ - Use typed command contracts and JSON schemas for automation surfaces.
235
+ - Never log secret values, bearer headers, raw provider errors, or raw stack
236
+ traces in user-facing output.
237
+ - Preserve dry-run or evaluate modes for commands that alter config, tokens,
238
+ runtime adapters, generated files, or tracker state.
239
+
240
+ ### Future SaaS API And Web Console
241
+
242
+ - Require tenant-authenticated sessions for every SaaS API request.
243
+ - Enforce authorization server-side; UI role visibility is not authorization.
244
+ - Bind every job, artifact, cache entry, evidence event, and storage object to a
245
+ tenant and workspace.
246
+ - Validate request bodies with narrow schemas and reject unknown mutation fields.
247
+ - Use short-lived worker credentials and scoped service identities.
248
+ - Store only sanitized workflow metadata unless the tenant explicitly enables
249
+ managed artifact storage.
250
+ - Apply tenant retention, deletion, export, and audit policies to every stored
251
+ artifact.
252
+
253
+ ### Workers, Runtimes, And Providers
254
+
255
+ - Run workers with least privilege, no shared mutable workspace, and no default
256
+ access to tenant secrets.
257
+ - Require explicit provider opt-in before direct model API calls.
258
+ - Keep runtime-native delegation packets free of provider credentials and raw
259
+ secret material.
260
+ - Pass bounded, redacted context packets to model providers.
261
+ - Enforce allowed commands, ownership paths, and lifecycle recording for child
262
+ runtime work.
263
+ - Treat model output as suggestions until validated by code review, tests, and
264
+ role gates.
265
+
266
+ ### Tools, MCP, And External Integrations
267
+
268
+ - Require `https://` for remote MCP and integration endpoints.
269
+ - Store OAuth and integration tokens only in tenant secret stores or approved
270
+ local secret paths; never in prompt, evidence, or generated runtime files.
271
+ - Pin sensitive executable discovery to trusted paths and reject tools resolved
272
+ from user-writable PATH entries.
273
+ - Redact tool results before persistence or model reuse.
274
+ - Verify webhook signatures and replay windows before accepting remote events.
275
+ - Keep scanner and tracker adapters narrow: one adapter owns I/O, policy checks,
276
+ retries, and sanitized errors for each integration.
277
+
278
+ ### Evidence Integrity
279
+
280
+ - Record command evidence with command name, exit status, summary, and relevant
281
+ artifact paths, not raw secrets or full logs by default.
282
+ - Use append-only event records for workflow lifecycle, runtime spawn state,
283
+ reviews, and evidence.
284
+ - Hash large evidence artifacts and generated reports when they become release
285
+ inputs.
286
+ - Require QA and Architect review when evidence does not map to acceptance
287
+ criteria or when technical contracts changed.
288
+ - Preserve failed evidence and unresolved risk instead of overwriting it with a
289
+ later passing summary.
290
+
291
+ ## Role Gates
292
+
293
+ - Product readiness: Product Owner and Analyst block when acceptance criteria,
294
+ non-goals, priority, or tenant impact are missing.
295
+ - Architecture readiness: Architect and Security block when boundaries, data
296
+ flow, provider policy, storage ownership, or failure modes are unclear.
297
+ - Security review: Security and Compliance/Privacy block sensitive work when
298
+ auth, secrets, PII, file paths, shell execution, network calls, dependencies,
299
+ TLS, cookies, sessions, CORS, webhooks, tenant isolation, or infrastructure
300
+ are touched without controls.
301
+ - Implementation handoff: Developer and Tech Lead block when tests, typed
302
+ contracts, ownership paths, or migration/rollback notes are missing.
303
+ - QA evidence: QA and Analyst block when evidence does not prove acceptance
304
+ criteria, edge cases, regression areas, or security controls.
305
+ - Operational readiness: SRE, DevOps, and Release Manager block when
306
+ monitoring, alerting, rate limits, budgets, rollout, rollback, or incident
307
+ owner is missing for SaaS behavior.
308
+ - Data readiness: DBA and Data Engineer/Analyst block when indexes, migrations,
309
+ retention, lineage, or tenant query patterns are not defined.
310
+ - Release go/no-go: Product Owner, Release Manager, and Security block when
311
+ residual risk remains unresolved and is not explicitly risk-accepted.
312
+
313
+ Security-sensitive tasks must include a threat model note, impacted boundaries,
314
+ controls, validation evidence, residual risks, and a reviewer outcome before
315
+ release.
316
+
317
+ ## Data Classification
318
+
319
+ - Public: published docs and public command manifests. These may be indexed and
320
+ sent to providers when policy allows.
321
+ - Internal: workflow metadata, task summaries, and sanitized evidence. These are
322
+ tenant/workspace scoped and redacted before external provider use unless
323
+ policy allows broader handling.
324
+ - Confidential: private repo content, issue context, generated handoffs, and
325
+ logs. These are local-only or redacted-external by default; retention and
326
+ audit are required.
327
+ - Restricted: secrets, tokens, credentials, regulated PII, and signing material.
328
+ These are never sent to prompts or persisted in evidence; use a secret
329
+ manager, tokenization, or approved local secure files.
330
+
331
+ ## Backlog Candidates
332
+
333
+ 1. Policy engine for tenant data classification, provider routing, network
334
+ access, tool capabilities, and fail-open/fail-closed behavior.
335
+ 2. Prompt-injection scanner for issues, comments, artifacts, tool outputs,
336
+ evidence, model responses, and context packs.
337
+ 3. Tenant isolation test suite covering SaaS API, workers, queues, caches,
338
+ evidence, object storage, and backup restore paths.
339
+ 4. Evidence integrity ledger with append-only events, artifact hashing,
340
+ reviewer attestations, and tamper detection.
341
+ 5. SSRF and URL validation library shared by SaaS workers, web console, MCP
342
+ proxy, and tracker adapters.
343
+ 6. Tool identity registry for MCP servers, local binaries, runtime adapters,
344
+ allowed commands, versions, and trusted executable paths.
345
+ 7. Secret redaction pipeline for runtime packets, provider errors, evidence,
346
+ logs, telemetry, imported artifacts, and generated summaries.
347
+ 8. SaaS audit log schema with tenant id, actor, action, target, policy decision,
348
+ evidence id, request id, and redaction status.
349
+ 9. Worker sandbox profile with filesystem, network, process, timeout, memory,
350
+ and budget limits.
351
+ 10. Release gate automation that blocks security-sensitive SaaS changes without
352
+ Security, QA, SRE, and Compliance/Privacy evidence.
353
+ 11. Tenant retention and deletion workflows with export, legal hold, backup
354
+ tombstone, and restore verification.
355
+ 12. Dependency and binary provenance checks for scanner tools, MCP proxies,
356
+ release automation, and runtime bridge helpers.
357
+
358
+ ## Validation Expectations
359
+
360
+ - Documentation-only changes should run lightweight text checks and the
361
+ Orchestra evidence/review workflow.
362
+ - Security-sensitive code changes should run format, lint, typecheck, unit
363
+ tests, secret scan, security audit, and targeted E2E or contract tests.
364
+ - SaaS implementation stories should add tests for tenant isolation, prompt
365
+ injection handling, URL validation, path traversal, unsafe writes, command
366
+ execution, secret redaction, and evidence tampering.
367
+ - Release evidence must name the acceptance criteria it proves or explicitly
368
+ record the deferred owner and rationale.
@@ -416,7 +416,7 @@ rules, and Orchestra review gates.
416
416
 
417
417
  Until Sonar directives are adopted, architecture violations are enforced through:
418
418
 
419
- - repo standards in `AGENTS.md` and `rules/*.mdc`;
419
+ - repo standards in `AGENTS.md` and neutral rule sources selected by Orchestra;
420
420
  - architecture gate decisions and ADR-style records;
421
421
  - code review against domain boundaries;
422
422
  - tests that protect command contracts, workflow behavior, and generated
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jterrats/open-orchestra",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  "extensions/vscode-open-orchestra",
@@ -0,0 +1,28 @@
1
+ # Semantic Code
2
+
3
+ Code must be readable by intent before it is explained by comments.
4
+
5
+ ## Naming
6
+
7
+ - Use domain language for modules, functions, variables, types, and test names.
8
+ - Prefer names that reveal purpose and observable behavior, such as `validateReleaseGateEvidence`, not vague names such as `processData`.
9
+ - Boolean names must make the predicate clear: `isReady`, `hasEvidence`, `canRetry`, `shouldBlockRelease`.
10
+
11
+ ## Structure
12
+
13
+ - Keep entry points thin. Move decisions and business rules into focused domain, service, or policy modules.
14
+ - Extract helpers when a reader needs comments to understand a block of code.
15
+ - Avoid generic containers in public APIs when narrow types or explicit models can describe the contract.
16
+ - Avoid hardcoded command lists, statuses, roles, labels, or fixture values when a typed registry or catalog can be the source of truth.
17
+
18
+ ## Comments
19
+
20
+ - Comments explain why, trade-offs, invariants, or external constraints.
21
+ - Do not add comments that restate what the code already says.
22
+ - If a function needs line-by-line comments to be understandable, refactor the names, types, or helper boundaries.
23
+
24
+ ## Review Checklist
25
+
26
+ - A reviewer can identify the domain intent from names and file boundaries without tracing every line.
27
+ - New code follows the existing project vocabulary and layering.
28
+ - Tests read like behavior specifications and use meaningful scenario names.