@websitelabs/n8n-nodes-software-teams 0.12.3

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 (176) hide show
  1. package/ARCHITECTURE.md +1232 -0
  2. package/CONTRACT.md +450 -0
  3. package/README.md +491 -0
  4. package/dist/agents/software-teams-architect.md +155 -0
  5. package/dist/agents/software-teams-backend.md +93 -0
  6. package/dist/agents/software-teams-codebase-mapper.md +67 -0
  7. package/dist/agents/software-teams-committer.md +90 -0
  8. package/dist/agents/software-teams-debugger.md +91 -0
  9. package/dist/agents/software-teams-dev-planner.md +175 -0
  10. package/dist/agents/software-teams-devops.md +92 -0
  11. package/dist/agents/software-teams-feedback-learner.md +118 -0
  12. package/dist/agents/software-teams-frontend.md +107 -0
  13. package/dist/agents/software-teams-game-ai-engineer.md +179 -0
  14. package/dist/agents/software-teams-game-art-pipeline.md +180 -0
  15. package/dist/agents/software-teams-game-designer.md +245 -0
  16. package/dist/agents/software-teams-game-devops.md +134 -0
  17. package/dist/agents/software-teams-game-engineer.md +146 -0
  18. package/dist/agents/software-teams-game-producer.md +288 -0
  19. package/dist/agents/software-teams-game-qa.md +297 -0
  20. package/dist/agents/software-teams-game-tech-artist.md +186 -0
  21. package/dist/agents/software-teams-head-engineering.md +37 -0
  22. package/dist/agents/software-teams-perf-analyst.md +124 -0
  23. package/dist/agents/software-teams-phase-researcher.md +75 -0
  24. package/dist/agents/software-teams-plan-checker.md +87 -0
  25. package/dist/agents/software-teams-planner.md +456 -0
  26. package/dist/agents/software-teams-pr-feedback.md +127 -0
  27. package/dist/agents/software-teams-pr-generator.md +107 -0
  28. package/dist/agents/software-teams-producer.md +203 -0
  29. package/dist/agents/software-teams-product-lead.md +51 -0
  30. package/dist/agents/software-teams-programmer.md +126 -0
  31. package/dist/agents/software-teams-qa-tester.md +165 -0
  32. package/dist/agents/software-teams-quality.md +153 -0
  33. package/dist/agents/software-teams-researcher.md +151 -0
  34. package/dist/agents/software-teams-security.md +126 -0
  35. package/dist/agents/software-teams-ux-designer.md +92 -0
  36. package/dist/agents/software-teams-verifier.md +87 -0
  37. package/dist/credentials/SoftwareTeamsApi.credentials.d.ts +18 -0
  38. package/dist/credentials/SoftwareTeamsApi.credentials.d.ts.map +1 -0
  39. package/dist/credentials/SoftwareTeamsApi.credentials.js +110 -0
  40. package/dist/credentials/SoftwareTeamsApi.credentials.js.map +1 -0
  41. package/dist/credentials/softwareTeamsApi.svg +14 -0
  42. package/dist/nodes/SoftwareTeamsAgent/SoftwareTeamsAgent.node.d.ts +23 -0
  43. package/dist/nodes/SoftwareTeamsAgent/SoftwareTeamsAgent.node.d.ts.map +1 -0
  44. package/dist/nodes/SoftwareTeamsAgent/SoftwareTeamsAgent.node.js +308 -0
  45. package/dist/nodes/SoftwareTeamsAgent/SoftwareTeamsAgent.node.js.map +1 -0
  46. package/dist/nodes/SoftwareTeamsAgent/softwareTeamsAgent.svg +18 -0
  47. package/dist/nodes/SoftwareTeamsCleanup/SoftwareTeamsCleanup.node.d.ts +24 -0
  48. package/dist/nodes/SoftwareTeamsCleanup/SoftwareTeamsCleanup.node.d.ts.map +1 -0
  49. package/dist/nodes/SoftwareTeamsCleanup/SoftwareTeamsCleanup.node.js +2635 -0
  50. package/dist/nodes/SoftwareTeamsCleanup/SoftwareTeamsCleanup.node.js.map +1 -0
  51. package/dist/nodes/SoftwareTeamsCleanup/SoftwareTeamsCleanup.svg +6 -0
  52. package/dist/nodes/SoftwareTeamsFinaliser/SoftwareTeamsFinaliser.node.d.ts +6 -0
  53. package/dist/nodes/SoftwareTeamsFinaliser/SoftwareTeamsFinaliser.node.d.ts.map +1 -0
  54. package/dist/nodes/SoftwareTeamsFinaliser/SoftwareTeamsFinaliser.node.js +231 -0
  55. package/dist/nodes/SoftwareTeamsFinaliser/SoftwareTeamsFinaliser.node.js.map +1 -0
  56. package/dist/nodes/SoftwareTeamsFinaliser/softwareTeamsFinaliser.svg +11 -0
  57. package/dist/nodes/SoftwareTeamsHitl/SoftwareTeamsHitl.node.d.ts +25 -0
  58. package/dist/nodes/SoftwareTeamsHitl/SoftwareTeamsHitl.node.d.ts.map +1 -0
  59. package/dist/nodes/SoftwareTeamsHitl/SoftwareTeamsHitl.node.js +366 -0
  60. package/dist/nodes/SoftwareTeamsHitl/SoftwareTeamsHitl.node.js.map +1 -0
  61. package/dist/nodes/SoftwareTeamsHitl/softwareTeamsHitl.svg +11 -0
  62. package/dist/nodes/SoftwareTeamsOrchestrator/SoftwareTeamsOrchestrator.node.d.ts +15 -0
  63. package/dist/nodes/SoftwareTeamsOrchestrator/SoftwareTeamsOrchestrator.node.d.ts.map +1 -0
  64. package/dist/nodes/SoftwareTeamsOrchestrator/SoftwareTeamsOrchestrator.node.js +373 -0
  65. package/dist/nodes/SoftwareTeamsOrchestrator/SoftwareTeamsOrchestrator.node.js.map +1 -0
  66. package/dist/nodes/SoftwareTeamsOrchestrator/softwareTeamsOrchestrator.svg +20 -0
  67. package/dist/nodes/SoftwareTeamsOutput/SoftwareTeamsOutput.node.d.ts +6 -0
  68. package/dist/nodes/SoftwareTeamsOutput/SoftwareTeamsOutput.node.d.ts.map +1 -0
  69. package/dist/nodes/SoftwareTeamsOutput/SoftwareTeamsOutput.node.js +2685 -0
  70. package/dist/nodes/SoftwareTeamsOutput/SoftwareTeamsOutput.node.js.map +1 -0
  71. package/dist/nodes/SoftwareTeamsOutput/SoftwareTeamsOutput.svg +6 -0
  72. package/dist/nodes/SoftwareTeamsPrFeedback/SoftwareTeamsPrFeedback.node.d.ts +22 -0
  73. package/dist/nodes/SoftwareTeamsPrFeedback/SoftwareTeamsPrFeedback.node.d.ts.map +1 -0
  74. package/dist/nodes/SoftwareTeamsPrFeedback/SoftwareTeamsPrFeedback.node.js +2655 -0
  75. package/dist/nodes/SoftwareTeamsPrFeedback/SoftwareTeamsPrFeedback.node.js.map +1 -0
  76. package/dist/nodes/SoftwareTeamsPrFeedback/softwareTeamsPrFeedback.svg +8 -0
  77. package/dist/nodes/SoftwareTeamsSlackHitl/SoftwareTeamsSlackHitl.node.d.ts +19 -0
  78. package/dist/nodes/SoftwareTeamsSlackHitl/SoftwareTeamsSlackHitl.node.d.ts.map +1 -0
  79. package/dist/nodes/SoftwareTeamsSlackHitl/SoftwareTeamsSlackHitl.node.js +198 -0
  80. package/dist/nodes/SoftwareTeamsSlackHitl/SoftwareTeamsSlackHitl.node.js.map +1 -0
  81. package/dist/nodes/SoftwareTeamsSlackHitl/softwareTeamsSlackHitl.svg +10 -0
  82. package/dist/nodes/SoftwareTeamsTrigger/SoftwareTeamsTrigger.node.d.ts +6 -0
  83. package/dist/nodes/SoftwareTeamsTrigger/SoftwareTeamsTrigger.node.d.ts.map +1 -0
  84. package/dist/nodes/SoftwareTeamsTrigger/SoftwareTeamsTrigger.node.js +2601 -0
  85. package/dist/nodes/SoftwareTeamsTrigger/SoftwareTeamsTrigger.node.js.map +1 -0
  86. package/dist/nodes/SoftwareTeamsTrigger/SoftwareTeamsTrigger.node.svg +6 -0
  87. package/dist/nodes/SoftwareTeamsWorkspace/SoftwareTeamsWorkspace.node.d.ts +20 -0
  88. package/dist/nodes/SoftwareTeamsWorkspace/SoftwareTeamsWorkspace.node.d.ts.map +1 -0
  89. package/dist/nodes/SoftwareTeamsWorkspace/SoftwareTeamsWorkspace.node.js +175 -0
  90. package/dist/nodes/SoftwareTeamsWorkspace/SoftwareTeamsWorkspace.node.js.map +1 -0
  91. package/dist/nodes/SoftwareTeamsWorkspace/softwareTeamsWorkspace.svg +13 -0
  92. package/dist/src/execution/single-turn.d.ts +6 -0
  93. package/dist/src/execution/single-turn.d.ts.map +1 -0
  94. package/dist/src/execution/single-turn.js +2662 -0
  95. package/dist/src/execution/single-turn.js.map +1 -0
  96. package/dist/src/hitl/channels.d.ts +48 -0
  97. package/dist/src/hitl/channels.d.ts.map +1 -0
  98. package/dist/src/hitl/channels.js +297 -0
  99. package/dist/src/hitl/channels.js.map +1 -0
  100. package/dist/src/hitl/conversation-state.d.ts +45 -0
  101. package/dist/src/hitl/conversation-state.d.ts.map +1 -0
  102. package/dist/src/hitl/conversation-state.js +69 -0
  103. package/dist/src/hitl/conversation-state.js.map +1 -0
  104. package/dist/src/hitl/slack.d.ts +32 -0
  105. package/dist/src/hitl/slack.d.ts.map +1 -0
  106. package/dist/src/hitl/slack.js +202 -0
  107. package/dist/src/hitl/slack.js.map +1 -0
  108. package/dist/src/ingestion/context.d.ts +38 -0
  109. package/dist/src/ingestion/context.d.ts.map +1 -0
  110. package/dist/src/ingestion/context.js +2501 -0
  111. package/dist/src/ingestion/context.js.map +1 -0
  112. package/dist/src/ingestion/pr-feedback.d.ts +48 -0
  113. package/dist/src/ingestion/pr-feedback.d.ts.map +1 -0
  114. package/dist/src/ingestion/pr-feedback.js +85 -0
  115. package/dist/src/ingestion/pr-feedback.js.map +1 -0
  116. package/dist/src/n8n-cast.d.ts +11 -0
  117. package/dist/src/n8n-cast.d.ts.map +1 -0
  118. package/dist/src/n8n-cast.js +17 -0
  119. package/dist/src/n8n-cast.js.map +1 -0
  120. package/dist/src/orchestration/run-state/global-store.d.ts +7 -0
  121. package/dist/src/orchestration/run-state/global-store.d.ts.map +1 -0
  122. package/dist/src/orchestration/run-state/global-store.js +27 -0
  123. package/dist/src/orchestration/run-state/global-store.js.map +1 -0
  124. package/dist/src/orchestration/run-state/ordering.d.ts +14 -0
  125. package/dist/src/orchestration/run-state/ordering.d.ts.map +1 -0
  126. package/dist/src/orchestration/run-state/ordering.js +59 -0
  127. package/dist/src/orchestration/run-state/ordering.js.map +1 -0
  128. package/dist/src/orchestration/run-state/persistence.d.ts +9 -0
  129. package/dist/src/orchestration/run-state/persistence.d.ts.map +1 -0
  130. package/dist/src/orchestration/run-state/persistence.js +29 -0
  131. package/dist/src/orchestration/run-state/persistence.js.map +1 -0
  132. package/dist/src/orchestration/run-state/planning.d.ts +17 -0
  133. package/dist/src/orchestration/run-state/planning.d.ts.map +1 -0
  134. package/dist/src/orchestration/run-state/planning.js +117 -0
  135. package/dist/src/orchestration/run-state/planning.js.map +1 -0
  136. package/dist/src/orchestration/run-state/readiness.d.ts +20 -0
  137. package/dist/src/orchestration/run-state/readiness.d.ts.map +1 -0
  138. package/dist/src/orchestration/run-state/readiness.js +105 -0
  139. package/dist/src/orchestration/run-state/readiness.js.map +1 -0
  140. package/dist/src/orchestration/run-state/shapes.d.ts +53 -0
  141. package/dist/src/orchestration/run-state/shapes.d.ts.map +1 -0
  142. package/dist/src/orchestration/run-state/shapes.js +3 -0
  143. package/dist/src/orchestration/run-state/shapes.js.map +1 -0
  144. package/dist/src/orchestration/run-state/transitions.d.ts +46 -0
  145. package/dist/src/orchestration/run-state/transitions.d.ts.map +1 -0
  146. package/dist/src/orchestration/run-state/transitions.js +133 -0
  147. package/dist/src/orchestration/run-state/transitions.js.map +1 -0
  148. package/dist/src/orchestration/run-state.d.ts +8 -0
  149. package/dist/src/orchestration/run-state.d.ts.map +1 -0
  150. package/dist/src/orchestration/run-state.js +35 -0
  151. package/dist/src/orchestration/run-state.js.map +1 -0
  152. package/dist/src/output/github.d.ts +39 -0
  153. package/dist/src/output/github.d.ts.map +1 -0
  154. package/dist/src/output/github.js +2492 -0
  155. package/dist/src/output/github.js.map +1 -0
  156. package/dist/src/repo/git.d.ts +71 -0
  157. package/dist/src/repo/git.d.ts.map +1 -0
  158. package/dist/src/repo/git.js +207 -0
  159. package/dist/src/repo/git.js.map +1 -0
  160. package/dist/src/repo/merge.d.ts +36 -0
  161. package/dist/src/repo/merge.d.ts.map +1 -0
  162. package/dist/src/repo/merge.js +133 -0
  163. package/dist/src/repo/merge.js.map +1 -0
  164. package/dist/src/repo/repo-context.d.ts +23 -0
  165. package/dist/src/repo/repo-context.d.ts.map +1 -0
  166. package/dist/src/repo/repo-context.js +10 -0
  167. package/dist/src/repo/repo-context.js.map +1 -0
  168. package/dist/src/repo/teardown.d.ts +38 -0
  169. package/dist/src/repo/teardown.d.ts.map +1 -0
  170. package/dist/src/repo/teardown.js +171 -0
  171. package/dist/src/repo/teardown.js.map +1 -0
  172. package/dist/src/repo/validate.d.ts +4 -0
  173. package/dist/src/repo/validate.d.ts.map +1 -0
  174. package/dist/src/repo/validate.js +42 -0
  175. package/dist/src/repo/validate.js.map +1 -0
  176. package/package.json +73 -0
package/README.md ADDED
@@ -0,0 +1,491 @@
1
+ # @websitelabs/n8n-nodes-software-teams
2
+
3
+ Software Teams specialist agents as first-class n8n community nodes.
4
+ Runs one Claude specialist per node, hands off via the canvas, and pauses for human review in Slack — no separate server required.
5
+
6
+ ---
7
+
8
+ ## ⚠️ Self-hosted n8n — required
9
+
10
+ This package **only works on self-hosted n8n**. It executes the `claude` binary inline on the n8n worker process; n8n Cloud forbids arbitrary binary execution and is not supported.
11
+
12
+ **Every n8n worker that will run these nodes must have:**
13
+
14
+ | Requirement | How to satisfy |
15
+ |-------------|----------------|
16
+ | `claude` binary on `PATH` | `npm install -g @anthropic-ai/claude-code` (or your platform's package manager) |
17
+ | `ANTHROPIC_API_KEY` available to the worker | Set in the **Software Teams API** credential (see below) |
18
+
19
+ If the `claude` binary is missing at execution time the node fails fast with a descriptive error message — it will never silently degrade.
20
+
21
+ > **Cost / latency note (R-03):** Each Agent node makes one full `claude -p` invocation against the Anthropic API. A multi-agent workflow (Orchestrator → 2 agents → HITL) can make 3–5 API calls, each potentially consuming hundreds of tokens. Model selection per node lets you trade quality for cost — use `claude-haiku-3-5` for cheap triage passes and `claude-sonnet-4-5` (default) or `claude-opus-4` for substantive work. Review Anthropic's pricing before deploying high-volume workflows.
22
+
23
+ ---
24
+
25
+ ## Install
26
+
27
+ In your self-hosted n8n instance:
28
+
29
+ 1. Go to **Settings → Community Nodes → Install**.
30
+ 2. Enter the package name:
31
+
32
+ ```
33
+ @websitelabs/n8n-nodes-software-teams
34
+ ```
35
+
36
+ 3. Accept the security prompt and wait for the install to complete.
37
+ 4. The ten nodes (Agent, Trigger Ingestion, Orchestrator, Slack HITL, HITL, PR Feedback, Output, Workspace, Finaliser, Cleanup) appear in the **Software Teams** section of the node palette.
38
+ 5. Create and configure the **Software Teams API** credential (see below).
39
+
40
+ > **CLI alternative:** on the worker host run `npm install @websitelabs/n8n-nodes-software-teams` in n8n's `~/.n8n/nodes/` custom-nodes directory, then restart n8n.
41
+
42
+ ---
43
+
44
+ ## Software Teams API credential
45
+
46
+ All secrets are stored in n8n's encrypted credential store and injected into the `claude` child process at runtime. **Secrets are never accepted as node parameters** and are never written to node output, execution logs, or the data envelope (R-02).
47
+
48
+ Create the credential at **Credentials → New → Software Teams API**.
49
+
50
+ | Field | Required | Description |
51
+ |-------|----------|-------------|
52
+ | **Anthropic API Key** | **yes** | Your Anthropic API key from [console.anthropic.com](https://console.anthropic.com/). Injected as `ANTHROPIC_API_KEY` into the `claude` subprocess. |
53
+ | **ClickUp API Token** | for ClickUp triggers | ClickUp personal API token. Used by the Trigger Ingestion node to fetch ticket context. |
54
+ | **Datadog API Key** | for Datadog triggers | Datadog API key for issue context fetch. |
55
+ | **Datadog Application Key** | for Datadog triggers | Required alongside the API key for certain Datadog endpoints. |
56
+ | **GitHub Token** | for GitHub output + PR feedback + cleanup | Personal access token (or fine-grained PAT) with `repo` + PR write scopes. Used by the Output node to open PRs, the PR Feedback node to fetch review comments, and the Cleanup node to verify merge status. |
57
+ | **Slack Bot Token** | for Slack HITL | Bot OAuth token (`xoxb-…`). Required by the Slack HITL and legacy Slack HITL nodes when the `slack` channel is selected. |
58
+ | **Discord Bot Token** | for Discord HITL | Discord bot token (`Bot …`). Required by the HITL node when the `discord` channel is selected (the priority channel for the first live test). Injected as `DISCORD_BOT_TOKEN` — never on the envelope or in logs (AC8). |
59
+ | **SMTP URL** | for Email HITL | SMTP connection string (e.g. `smtps://user:pass@smtp.example.com`). Required by the HITL node when the `email` channel is selected. Injected as `SMTP_URL` — never on the envelope or in logs (AC8). |
60
+
61
+ After saving, n8n will test the Anthropic key by listing available models. A ✓ confirms connectivity.
62
+
63
+ ---
64
+
65
+ ## Nodes
66
+
67
+ All ten nodes share the **Software Teams API** credential and pass a single typed `NodeEnvelope` object between them. See [`CONTRACT.md`](./CONTRACT.md) for the full inter-node data contract.
68
+
69
+ ### Software Teams Trigger Ingestion
70
+
71
+ **Purpose:** Fetches context from a ClickUp ticket, Datadog issue, or a **plain free-text prompt** (AC6) and emits an initial `NodeEnvelope` — the starting point of every Software Teams workflow.
72
+
73
+ Place this node **after** a native n8n ClickUp, Datadog, Schedule, or Form trigger; it enriches the upstream data with PII-scrubbed ticket/issue context, or passes through the raw prompt directly when using the `prompt` source.
74
+
75
+ | Port | Direction | Type | Notes |
76
+ |------|-----------|------|-------|
77
+ | (none) | Input | — | No input port; receives data from n8n trigger node before it |
78
+ | Main | Output | `NodeEnvelope` | Fresh envelope with `correlationId`, `status: 'ok'`, and `input.context` populated from the fetched ticket/issue or the raw prompt |
79
+
80
+ **Parameters:**
81
+
82
+ | Parameter | Description |
83
+ |-----------|-------------|
84
+ | Source | `ClickUp`, `Datadog`, or **`Prompt`** (AC6 — a plain free-text prompt as a first-class trigger source) |
85
+ | Prompt | Free-text task prompt (used when `Source = Prompt`; supports n8n expressions for Form Trigger integration) |
86
+ | ClickUp Task Ref | Task URL or bare task ID (supports n8n expressions) |
87
+ | Datadog Issue URL | Issue URL with `issueId` param (supports n8n expressions) |
88
+ | Workflow Prompt | Initial task instruction for the first downstream Agent node |
89
+ | First Agent ID | Specialist hint for the first downstream node (e.g. `software-teams-researcher`) |
90
+
91
+ If the credential keys are missing or the ref is unreachable the node proceeds with `context: null` and logs a diagnostic — it does not block the workflow.
92
+
93
+ **Prompt source (AC6):** when `Source = Prompt`, the node uses the literal `Prompt` parameter value as the task context — no external API call is made. This makes a plain free-text prompt a first-class trigger alongside ClickUp and Datadog, enabling simple Form Trigger → Trigger Ingestion → Orchestrator flows without any external ticket system.
94
+
95
+ ---
96
+
97
+ ### Software Teams Agent
98
+
99
+ **Purpose:** Runs exactly **one** Software Teams specialist for **one** turn via the `claude` CLI (Task tool disabled — AC2). Wire multiple Agent nodes A → B for multi-agent handoff; each hop passes the upstream result in `input.context`.
100
+
101
+ | Port | Direction | Type | Notes |
102
+ |------|-----------|------|-------|
103
+ | Main | Input | `NodeEnvelope` or any | When the input carries a valid envelope (has `correlationId` + `agentId` + `status`), the node folds the upstream `result`/`artifacts` into `input.context`. First-node mode uses the optional Context parameter. |
104
+ | Main | Output | `NodeEnvelope` | Completed envelope; `status` is `ok`, `error`, or `needs-input`. Route on `{{ $json.status === 'needs-input' }}` to feed the Slack HITL node. |
105
+
106
+ **Parameters:**
107
+
108
+ | Parameter | Description |
109
+ |-----------|-------------|
110
+ | Specialist | Which Software Teams specialist to invoke (dropdown — 33 options including Frontend Engineer, Researcher, Programmer, UX Designer, QA Tester, …) |
111
+ | Prompt | Task instruction for this turn. Supports n8n expressions. |
112
+ | Context (JSON) | Optional JSON context for the first node in a chain; ignored when an upstream envelope is present |
113
+ | Model | `claude-sonnet-4-5` (default), `claude-opus-4`, or `claude-haiku-3-5` |
114
+
115
+ ---
116
+
117
+ ### Software Teams Orchestrator
118
+
119
+ **Purpose:** Accepts an epic/sprint goal, runs a planning turn as `software-teams-planner`, and **emits one `NodeEnvelope` per wave-task** in dependency order — the canvas delegation mechanism. Downstream Agent nodes consume these items (static wiring or a Switch keyed on `agentId`). Also bubbles `needs-input` and `error` envelopes from sub-agents up to the HITL / error branch.
120
+
121
+ Supports three operations selectable via the `Operation` parameter:
122
+
123
+ | Operation | Description |
124
+ |-----------|-------------|
125
+ | `plan` (default) | Runs a planning turn and fans out one envelope per wave-task |
126
+ | `review` | **Readiness gate (AC1):** runs a single-turn, Task-disabled `software-teams-quality` pass that validates the generated plan for one-shot readiness (clear briefs, deps, agent pins, acceptance criteria) BEFORE fan-out. On pass it allows fan-out; on fail it surfaces blocking gaps and either auto-refines within ≤2 attempts or parks via the HITL path. `planEpic()` behaviour is unchanged. |
127
+ | `summary` | Reads aggregated run-state and emits a human-facing run summary (per-agent results + overall outcome) |
128
+
129
+ | Port | Direction | Type | Notes |
130
+ |------|-----------|------|-------|
131
+ | Main | Input | `NodeEnvelope` or plain | Upstream trigger/ingestion output. A `needs-input` or `error` envelope is passed through unchanged for HITL/error routing. |
132
+ | Main | Output | `NodeEnvelope[]` | `plan`/`review` operations: one item per wave-task with `agentId` preset. `summary` operation: one summary envelope. |
133
+
134
+ **Parameters:**
135
+
136
+ | Parameter | Description |
137
+ |-----------|-------------|
138
+ | Operation | `plan`, `review`, or `summary` |
139
+ | Epic / Sprint Goal | The epic, user story, or project goal to plan. Supports n8n expressions. |
140
+ | Correlation ID | Leave blank to auto-generate. Reuse an upstream envelope's `correlationId` to continue an existing run. |
141
+ | Planner Model | Claude model for the planning turn |
142
+
143
+ Run state (waves, task statuses) is persisted to workflow global static data keyed by `correlationId` so partial failures are resumable (R-05).
144
+
145
+ ---
146
+
147
+ ### Software Teams Slack HITL
148
+
149
+ **Purpose:** Implements the ask → wait → resume state machine (AC7). When an upstream Agent emits `status: 'needs-input'`, this node posts the question to Slack (Block Kit, threaded, with the `correlationId`), pauses the n8n workflow execution, and on resume re-runs the same agent with the human's Slack reply folded into context.
150
+
151
+ Three execution modes determined at runtime:
152
+
153
+ | Mode | Trigger | What happens |
154
+ |------|---------|--------------|
155
+ | **Ask** | Input envelope `status === 'needs-input'` | Posts question to Slack, persists state, calls `putExecutionToWait()` |
156
+ | **Resume** | Input has `hitlAnswer` + `correlationId` fields (from Slack interactivity webhook) | Loads stored state, re-invokes `runAgentTurn`, emits continued envelope |
157
+ | **Pass-through** | `status === 'ok'` or `'error'` | Passes envelope unchanged |
158
+
159
+ | Port | Direction | Type | Notes |
160
+ |------|-----------|------|-------|
161
+ | Main | Input | `NodeEnvelope` | See modes above |
162
+ | Main | Output | `NodeEnvelope` | Ask mode: waiting envelope with `hitl` state block. Resume mode: continued agent envelope. |
163
+
164
+ **Parameters:**
165
+
166
+ | Parameter | Description |
167
+ |-----------|-------------|
168
+ | Slack Channel | Channel ID (`C0123456`) or name (`#ai-questions`) |
169
+ | Wait Timeout (Hours) | Max hours to wait before execution times out (default 24) |
170
+
171
+ > **Self-hosted requirement:** set `WEBHOOK_URL=https://n8n.yourdomain.com` on the n8n worker so the signed resume URL is reachable from Slack's servers. `localhost:5678` will not work.
172
+
173
+ ---
174
+
175
+ ### Software Teams Output
176
+
177
+ **Purpose:** Terminal node — reads the final `NodeEnvelope` and opens a **GitHub PR** (default) or **GitHub issue** with the agents' result. Appends the created URL to `artifacts` and passes the envelope downstream for further processing or logging.
178
+
179
+ | Port | Direction | Type | Notes |
180
+ |------|-----------|------|-------|
181
+ | Main | Input | `NodeEnvelope` | Must carry a valid envelope (`correlationId` required). PR mode also needs a `branch` artifact from an upstream agent; falls back to an issue if absent. |
182
+ | Main | Output | `NodeEnvelope` | Envelope with the PR/issue URL appended to `artifacts`. `status: 'error'` if GitHub rejects the PR. |
183
+
184
+ **Parameters:**
185
+
186
+ | Parameter | Description |
187
+ |-----------|-------------|
188
+ | Output Mode | `Pull Request (Default)` or `Issue` |
189
+ | Target Repository | `owner/repo` format, e.g. `acme/myapp` |
190
+ | Base Branch | Branch the PR merges into (default `main`; PR mode only) |
191
+ | Title | PR/issue title. Defaults to `[Software Teams] {correlationId}` when blank. |
192
+ | Issue Labels | Comma-separated labels (Issue mode only; must already exist in the repo) |
193
+
194
+ ---
195
+
196
+ ### Software Teams Workspace
197
+
198
+ **Purpose:** Establishes the run's repository checkout and seeds the repo descriptor onto the
199
+ `NodeEnvelope`, enabling downstream Agent nodes to make real file changes inside isolated git
200
+ worktrees. Required as the first node in any repo-scoped execution flow.
201
+
202
+ | Port | Direction | Type | Notes |
203
+ |------|-----------|------|-------|
204
+ | Main | Input | `NodeEnvelope` or plain | Inbound trigger or manual start |
205
+ | Main | Output | `NodeEnvelope` | Envelope with additive `repo` descriptor (`cloneUrl`, `ownerRepo`, `baseBranch`) |
206
+
207
+ **Parameters:**
208
+
209
+ | Parameter | Description |
210
+ |-----------|-------------|
211
+ | Target Repository | `owner/repo` (e.g. `acme/myapp`) or a full HTTPS/SSH clone URL |
212
+ | Base Branch | Branch all agent worktrees fork from (default `main`) |
213
+ | Correlation ID | Leave blank to auto-generate; reuse an upstream `correlationId` to continue an existing run |
214
+
215
+ > **Self-hosted requirement:** the n8n worker must have `git` and `claude` on `PATH`. The node
216
+ > fails fast with a clear error if either binary is absent. `gh` is required by the Finaliser node.
217
+
218
+ ---
219
+
220
+ ### Software Teams Finaliser
221
+
222
+ **Purpose:** Terminal merge node for repo-scoped runs. Reads all agents' changes from workflow
223
+ run-state, applies them onto a feature branch with a **bounded conflict-resolver** (≤3 claude
224
+ turns), commits, pushes, and emits a `branch` artifact so the Output node opens a PR.
225
+
226
+ | Port | Direction | Type | Notes |
227
+ |------|-----------|------|-------|
228
+ | Main | Input | `NodeEnvelope` | Must carry a `correlationId` matching agents that have written to run-state |
229
+ | Main | Output | `NodeEnvelope` | Envelope with `branch` artifact + run summary in `result.text` |
230
+
231
+ **Parameters:**
232
+
233
+ | Parameter | Description |
234
+ |-----------|-------------|
235
+ | Correlation ID | The run's `correlationId` (expression: `{{ $json.correlationId }}`). Used to read aggregated agent results from run-state. |
236
+
237
+ **Conflict-resolution guarantee:** if git's automatic merge cannot resolve a conflict, a claude
238
+ resolver turn runs — up to a maximum of 3 turns. Within the bound the merged branch is always
239
+ marker-free before push. If the bound is exceeded the node fails cleanly with a structured error
240
+ that includes the conflicting file list; no branch is pushed and no infinite loop runs.
241
+
242
+ > **Self-hosted requirement:** the n8n worker must have `gh` on `PATH`. The node fails fast with
243
+ > a clear error if the binary is absent.
244
+
245
+ ---
246
+
247
+ ### Software Teams PR Feedback
248
+
249
+ **Purpose:** Ingests GitHub PR review comments back into a running Software Teams workflow. Triggered by a GitHub webhook (PR review or review-comment event), it fetches and categorises the review comments (reusing the `feedback --json` CLI), extracts the originating run's `correlationId` from the machine-parseable tag the Output node stamped into the PR body, and emits a continue-run `NodeEnvelope` that re-enters the Orchestrator's existing continue path (AC2).
250
+
251
+ The tag in the PR body has the form:
252
+
253
+ ```
254
+ <!-- software-teams:correlationId=run-2026-06-03-CU-4821 -->
255
+ ```
256
+
257
+ The `parseCorrelationTag` helper (shared contract, `packages/cli/src/contract/envelope.ts`) extracts the id; the `buildCorrelationTag` helper (Output node, T11) writes it. The round-trip invariant `parseCorrelationTag(buildCorrelationTag(id)) === id` is asserted in the contract tests.
258
+
259
+ | Port | Direction | Type | Notes |
260
+ |------|-----------|------|-------|
261
+ | Main | Input | any | Receives the GitHub webhook payload |
262
+ | Main | Output | `NodeEnvelope` | Continue-run envelope carrying the original `correlationId` and categorised `feedback.comments` |
263
+
264
+ **Parameters:**
265
+
266
+ | Parameter | Description |
267
+ |-----------|-------------|
268
+ | PR Number | The PR number to fetch review comments from (supports n8n expressions from the webhook payload) |
269
+ | Repository | `owner/repo` of the target repository |
270
+
271
+ **Secrets:** uses the `GitHub Token` from the `SoftwareTeamsApi` credential. The token is injected into the child process env — never in node output, the envelope, or logs (AC8).
272
+
273
+ ---
274
+
275
+ ### Software Teams HITL
276
+
277
+ **Purpose:** Multi-channel, multi-round Human-in-the-Loop node. Extends the original `SlackHitl` with support for four channels — **Slack, Email, n8n-notification, and Discord** (Discord is the priority channel for the first live test). Unlike the legacy Slack HITL node, it re-parks state on each resume for genuine multi-round back-and-forth: on resume it re-saves conversation state so a follow-up question can be posed without starting a new run.
278
+
279
+ Three execution modes determined at runtime:
280
+
281
+ | Mode | Trigger | What happens |
282
+ |------|---------|--------------|
283
+ | **Ask** | Input envelope `status === 'needs-input'` | Posts the question on the selected channel, persists multi-round conversation state keyed by `correlationId`, calls `putExecutionToWait()` |
284
+ | **Resume** | Inbound resume payload with `hitlAnswer` + `correlationId` | Loads state, re-invokes `runAgentTurn`, re-parks for the next round or emits a terminal envelope |
285
+ | **Pass-through** | `status === 'ok'` or `'error'` | Passes envelope unchanged |
286
+
287
+ **Channel selection order:**
288
+
289
+ 1. The `Channel` node parameter (explicit override wins).
290
+ 2. The optional `hitlChannel` field on the inbound envelope (hint from an upstream node).
291
+ 3. Default: `discord`.
292
+
293
+ | Port | Direction | Type | Notes |
294
+ |------|-----------|------|-------|
295
+ | Main | Input | `NodeEnvelope` | See modes above |
296
+ | Main | Output | `NodeEnvelope` | Ask mode: waiting envelope. Resume mode: continued agent envelope, possibly re-parked. |
297
+
298
+ **Parameters:**
299
+
300
+ | Parameter | Description |
301
+ |-----------|-------------|
302
+ | Channel | `auto` (use envelope hint or default), `slack`, `discord`, `email`, or `notify` |
303
+ | Wait Timeout (Hours) | Max hours to wait before execution times out (default 24) |
304
+
305
+ **Secrets:** the channel tokens (`discordBotToken`, `smtpUrl`, `slackBotToken`) are read from the `SoftwareTeamsApi` credential and injected into the channel delivery function. They are never written to the envelope, node output, or logs (AC8).
306
+
307
+ > **Self-hosted requirement:** set `WEBHOOK_URL=https://n8n.yourdomain.com` on the n8n worker so the signed resume URL is reachable from your HITL channel's servers.
308
+
309
+ ---
310
+
311
+ ### Software Teams Cleanup
312
+
313
+ **Purpose:** Post-merge teardown node. Triggered by a GitHub PR MERGE webhook, it idempotently and safely removes all state associated with a completed run — run-state, conversation state, git worktrees, repo clones, agent memories, and `.software-teams/` plan artefacts — so the workflow is immediately reusable for a new task (AC5).
314
+
315
+ **Idempotency:** running the Cleanup node twice for the same `correlationId` is a no-op the second time. Each cleanup operation checks whether the resource exists before attempting removal.
316
+
317
+ | Port | Direction | Type | Notes |
318
+ |------|-----------|------|-------|
319
+ | Main | Input | any | Receives the GitHub merge webhook payload |
320
+ | Main | Output | `NodeEnvelope` | Cleanup result envelope with `status: 'ok'` + summary in `result.text` |
321
+
322
+ **What gets cleaned up (in order):**
323
+
324
+ | Resource | How |
325
+ |----------|-----|
326
+ | Run-state (`runs[correlationId]`) | `deleteRunState` — removes the entry from workflow global static data |
327
+ | Conversation state | `deleteState` — removes the HITL resume record keyed by `correlationId` |
328
+ | Git worktrees | Calls the `worktree-remove` CLI primitive for each registered worktree |
329
+ | Repo clones | Removes the run-scoped clone directory |
330
+ | Agent memories | Clears per-agent memory files scoped to the `correlationId` |
331
+ | Plan / task artefacts | Removes `.software-teams/` plan and task files for the run |
332
+
333
+ **Parameters:**
334
+
335
+ | Parameter | Description |
336
+ |-----------|-------------|
337
+ | Correlation ID | The run's `correlationId` — parse from the merged PR body using `parseCorrelationTag` |
338
+ | Repository | `owner/repo` used to verify the PR was actually merged before cleanup |
339
+
340
+ **Secrets:** uses the `GitHub Token` from the `SoftwareTeamsApi` credential for merge verification. Never written to node output or the envelope (AC8).
341
+
342
+ ---
343
+
344
+ ## Inter-node data contract
345
+
346
+ Every node emits and accepts a single `NodeEnvelope` JSON object:
347
+
348
+ ```ts
349
+ interface NodeEnvelope {
350
+ correlationId: string; // Stable run ID — carried unchanged node-to-node
351
+ agentId: string; // e.g. "software-teams-frontend"
352
+ status: 'ok' | 'error' | 'needs-input';
353
+ input: { prompt: string; context: unknown };
354
+ result: { text: string };
355
+ artifacts: Array<{ type: string; url?: string }>;
356
+ }
357
+ ```
358
+
359
+ See **[`CONTRACT.md`](./CONTRACT.md)** for the full normative contract, field invariants, producer/consumer rules, the upstream-context merge strategy, and worked examples of A→B handoff.
360
+
361
+ ---
362
+
363
+ ## Node-load gate and CJS resolution boundary
364
+
365
+ The package builds and loads under **Node.js** (not just Bun). A post-build verification gate runs every CI build to guard against regressions to the original mixed-format failure.
366
+
367
+ ### What the gate does
368
+
369
+ After `bun run build`, the gate runs every entry in `n8n.nodes[]` and `n8n.credentials[]` through `node -e "require('<path>')"` with **CWD = `packages/n8n/`**. Any load failure (`ERR_MODULE_NOT_FOUND`, "require is not defined in ES module scope", "exports is not defined", or any throw) causes the gate to exit non-zero.
370
+
371
+ Run it locally with the root alias:
372
+
373
+ ```sh
374
+ bun run verify:node-load
375
+ ```
376
+
377
+ Or from the package directory:
378
+
379
+ ```sh
380
+ bun run --cwd packages/n8n verify:node-load
381
+ ```
382
+
383
+ The gate builds first (`n8n-node build`), then loads all 11 entries (10 nodes + 1 credential) under Node.
384
+
385
+ ### Why it runs as a distinct CI step (not inside the Bun test run)
386
+
387
+ The original failure mode — emitting mixed ESM `import`/`export` + CJS `require(...)` — passed the Bun test suite green because Bun tolerates mixed module format. Node does not. Running the gate as a **separate CI step after build** ensures that a future regression to the mixed-format problem is caught by the gate before it ships, regardless of the Bun test result.
388
+
389
+ ### CJS resolution boundary
390
+
391
+ The gate runs with **CWD = `packages/n8n/`**. From that directory the workspace `node_modules` resolves:
392
+
393
+ | Dependency | Resolved to | Why |
394
+ |---|---|---|
395
+ | `n8n-workflow` | `dist/cjs/index.js` | No `"type"` in `n8n-workflow/package.json`; `main` is CJS under Node. This is the same path a real n8n host uses. |
396
+ | `@websitelabs/software-teams` | `lib/n8n-api.js` | The shared lib is `"type": "module"`. A CJS caller selects its `exports.require` condition → `./lib/n8n-api.js` (a real CJS build, `"use strict";`). The `import` condition (`./src/n8n-api.ts`) is TS source Node cannot execute — it is never selected. |
397
+
398
+ This is the **host-equivalent CJS resolution boundary** — it reproduces locally how a real n8n host resolves both peers from its own Node-resolved `node_modules`. It is explicitly **not** the Bun-install ESM path (`.bun/.../dist/esm/index.js`) that was the original failure.
399
+
400
+ The n8n package itself has no `"type"` key in its `package.json`, so every emitted `.js` in `dist/` is treated as CommonJS by Node. The `tsconfig.json` uses `module: "commonjs"` + `moduleResolution: "node"` — consistent with the official `@n8n/node-cli` template.
401
+
402
+ ---
403
+
404
+ ## Specialist routing and Orchestrator summary
405
+
406
+ ### Routing by `agentId` — no per-node Switch required
407
+
408
+ The Orchestrator fans out one `NodeEnvelope` per planned task, each with `agentId` preset to the planned specialist (e.g. `"software-teams-backend"`). Each Agent node is configured with a `specialist` value (e.g. `software-teams-backend`).
409
+
410
+ **When the inbound envelope's `agentId` matches the node's configured `specialist`**, the Agent node processes the item and emits its result. **When `agentId` does not match**, the item is not processed and is not emitted as work output from that node.
411
+
412
+ This means you can **wire every specialist Agent node directly off the single Orchestrator output** — no Switch node in front of each agent. Each Agent node picks up only the fan-out items addressed to its configured specialist. Items with no `agentId` (e.g. first-node or single-agent flows) are processed exactly as before — the routing is a no-op when no `agentId` is present (behaviour-preserving).
413
+
414
+ Example wiring on the canvas:
415
+
416
+ ```
417
+ Orchestrator ──▶ Agent: Backend (specialist = software-teams-backend)
418
+ └──▶ Agent: Frontend (specialist = software-teams-frontend)
419
+ └──▶ Agent: Programmer (specialist = software-teams-programmer)
420
+ ```
421
+
422
+ All three agent nodes are wired off the same Orchestrator output. Each node processes only the envelopes addressed to it.
423
+
424
+ ### Orchestrator `summary` mode
425
+
426
+ The Orchestrator node supports an `operation: summary` mode. When triggered after agents have completed their turns, the Orchestrator reads the aggregated run-state (via `enumerateAgentResults`) and emits a single human-facing summary envelope — describing what each specialist did and the overall outcome — surfaced from the node that started the run.
427
+
428
+ **This mode is purely additive and the DAG contract is intact:**
429
+
430
+ - The Orchestrator's existing `plan-and-fan-out` behaviour is unchanged.
431
+ - No return edge is introduced from an Agent node back to the Orchestrator — the forward-only aggregation topology of ADR-002 Decision F is preserved.
432
+ - The Finaliser still owns the forward run summary (per-agent result + conflict resolution outcome) and the PR. The Orchestrator `summary` is an additional, Orchestrator-centric view of the run — not a replacement.
433
+
434
+ ---
435
+
436
+ ## Architecture
437
+
438
+ See [`ARCHITECTURE.md`](./ARCHITECTURE.md) for the full design decision record covering node style, the single-turn execution model, and canvas handoff.
439
+
440
+ ---
441
+
442
+ ## Risks
443
+
444
+ | ID | Risk | Mitigation |
445
+ |----|------|------------|
446
+ | R-01 | Inline `claude` execution requires the binary on the self-hosted worker | Documented above; node fails fast with a clear error on missing binary |
447
+ | R-02 | API keys must not leak into node output/logs | All tokens stored in the `SoftwareTeamsApi` credential; never in node parameters or the envelope |
448
+ | R-03 | One `claude` call per agent node → cost & latency per workflow run | Single-turn execution caps per-node work; per-node model selection; see cost/latency note above |
449
+
450
+ ---
451
+
452
+ ## Example workflows
453
+
454
+ ### IT-support ticket → GitHub PR (five-node canvas)
455
+
456
+ See [`docs/example-workflow.md`](./docs/example-workflow.md) for a step-by-step walkthrough of
457
+ the ClickUp label → Orchestrator → two agents → Slack HITL → GitHub PR end-to-end loop.
458
+
459
+ Import the ready-made workflow from [`examples/it-support-pr.workflow.json`](./examples/it-support-pr.workflow.json).
460
+
461
+ ### Repo execution: repo + prompt → real code changes → PR (full canvas)
462
+
463
+ For workflows that make real file changes against a target repository, use the two new nodes
464
+ (**Workspace** and **Finaliser**) alongside the existing five.
465
+
466
+ See [`docs/repo-execution.md`](./docs/repo-execution.md) for the full flow documentation,
467
+ including:
468
+ - Node-by-node parameter reference (Workspace and Finaliser)
469
+ - The on-envelope `repo` descriptor handoff and `RepoContext` lifecycle
470
+ - Queue-mode safety: portable `changeRef` patches (base64 `git format-patch`) with no shared volume required
471
+ - Bounded conflict-resolution guarantee (≤3 resolver turns, or structured failure with conflicting file list)
472
+ - Self-hosted prerequisites (`claude` + `git` + `gh` on the worker, fail-fast)
473
+ - Cost and latency breakdown (clone + per-agent turns + optional resolver turns)
474
+
475
+ Import the ready-made workflow from [`examples/repo-pr.workflow.json`](./examples/repo-pr.workflow.json).
476
+
477
+ ---
478
+
479
+ ## No-Install Alternative (Manual / CLI Recipe)
480
+
481
+ If you **cannot install the community-node package** (n8n Cloud, locked worker node directory,
482
+ or simply want to try Software Teams before committing to an install), use the
483
+ **manual CLI recipe** instead:
484
+
485
+ - **Docs:** [`n8n/MANUAL-RECIPE.md`](./MANUAL-RECIPE.md) — Execute Command command strings,
486
+ secrets-via-env, security notes, self-hosted constraint.
487
+ - **Example workflow:** [`n8n/examples/manual-recipe.workflow.json`](./examples/manual-recipe.workflow.json)
488
+ — importable built-in-node-only workflow (Execute Command + Code + IF), no package required.
489
+
490
+ The same underlying engine powers both modes; the manual recipe is a thin CLI surface
491
+ (`software-teams ingest | agent-turn | orchestrator-turn | output`) over it.
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: software-teams-architect
3
+ description: Designs system architecture with focus on maintainability and scalability
4
+ model: opus
5
+ tools:
6
+ - Bash
7
+ - Edit
8
+ - Glob
9
+ - Grep
10
+ - LSP
11
+ - Read
12
+ - Write
13
+ ---
14
+
15
+ <!-- canonical frontmatter — converted to .claude/agents/{name}.md by software-teams sync-agents -->
16
+
17
+
18
+ # Software Teams Architect Agent
19
+
20
+ > **Decision (plan 03-02):** technical-director pattern lives here — no separate software-teams-tech-director agent. See plan 03-02 merge register for rationale.
21
+
22
+ You design and review system architecture with focus on maintainability, scalability, and long-term technical decisions.
23
+
24
+ ## Key Actions
25
+
26
+ ### Analyse Existing Architecture
27
+
28
+ <!-- T11: removed broken Architect:Analyse reference -->
29
+
30
+ 1. Map current system structure
31
+ 2. Identify architectural patterns in use
32
+ 3. Document component relationships
33
+ 4. Surface technical debt
34
+ 5. Note scaling limitations
35
+
36
+ ### Design New Architecture
37
+
38
+ <!-- T11: removed broken Architect:Design reference -->
39
+
40
+ 1. Define system boundaries
41
+ 2. Design component interfaces
42
+ 3. Specify data flow patterns
43
+ 4. Document integration points
44
+ 5. Plan for failure modes
45
+
46
+ ### Review Architecture Decisions
47
+
48
+ <!-- T11: removed broken Architect:Review reference -->
49
+
50
+ 1. Evaluate against requirements
51
+ 2. Assess trade-offs
52
+ 3. Check for anti-patterns
53
+ 4. Verify scalability assumptions
54
+ 5. Confirm maintainability
55
+
56
+ ### Technical Risk Register
57
+
58
+ Maintain an ongoing register of technical risks that could threaten delivery, performance, or maintainability. Each entry captures the risk, its likelihood, impact, owner, and mitigation. Review the register at every milestone gate and surface unresolved high-severity items to the user.
59
+
60
+ ```yaml
61
+ risk_id: R-{number}
62
+ title: {short description}
63
+ category: performance | security | scalability | integration | dependency | debt
64
+ likelihood: low | medium | high
65
+ impact: low | medium | high
66
+ owner: {agent or role}
67
+ mitigation: {action being taken}
68
+ status: open | mitigating | accepted | resolved
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Decision Framework
74
+
75
+ | Dimension | Question |
76
+ |-----------|----------|
77
+ | Fit | Does it solve the actual problem? |
78
+ | Simplicity | Is this the simplest solution? |
79
+ | Scalability | Will it scale with growth? |
80
+ | Maintainability | Can future devs understand it? |
81
+ | Reversibility | How costly to change later? |
82
+ | Risk | What could go wrong? |
83
+
84
+ ---
85
+
86
+ ## Strategic Decision Workflow
87
+
88
+ When asked to make a high-level decision or resolve a cross-system conflict, work the steps in order. You present analysis and a recommendation; the user makes the final call.
89
+
90
+ 1. **Understand** — Gather full context. Read relevant ADRs, constraints, and prior decisions. Ask clarifying questions until you can name what is truly at stake (often deeper than the surface question).
91
+ 2. **Frame** — State the core question in one sentence. Explain why it matters and what it affects downstream. List the evaluation criteria (budget, quality, scope, reversibility, risk).
92
+ 3. **Options** — Present 2-3 viable strategic options. For each: what it means concretely, which goals it serves vs. sacrifices, downstream consequences (technical, schedule, scope), risks and mitigations.
93
+ 4. **Recommendation** — State your preferred option and why, using theory, precedent, and project context. Acknowledge the trade-offs you accept. Make it explicit that the final call is the user's.
94
+ 5. **Support** — Once the user decides, document the decision (ADR or risk register entry), cascade it to affected agents, and define validation criteria ("we'll know this was right if...").
95
+
96
+ ---
97
+
98
+ ## Outputs
99
+
100
+ | Output | Purpose |
101
+ |--------|---------|
102
+ | Architecture Decision Record (ADR) | Document decisions and rationale |
103
+ | Component Diagram | Visualise system structure |
104
+ | Data Flow Diagram | Show information movement |
105
+ | Integration Map | Document external dependencies |
106
+ | Technical Debt Register | Track architectural issues |
107
+
108
+ ### ADR Template
109
+
110
+ ```markdown
111
+ # ADR-{number}: {title}
112
+
113
+ ## Status
114
+ Proposed | Accepted | Deprecated | Superseded
115
+
116
+ ## Context
117
+ {What is the issue motivating this decision?}
118
+
119
+ ## Decision
120
+ {What is the change being proposed?}
121
+
122
+ ## Consequences
123
+ ### Positive
124
+ - {benefit}
125
+
126
+ ### Negative
127
+ - {drawback}
128
+
129
+ ### Neutral
130
+ - {implication}
131
+
132
+ ## Alternatives Considered
133
+ | Option | Pros | Cons | Rejected Because |
134
+ |--------|------|------|------------------|
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Structured Returns
140
+
141
+ ```yaml
142
+ status: complete | needs_decision | blocked
143
+ analysis_type: new_design | review | assessment
144
+ components_identified: {n}
145
+ decisions_needed: [...]
146
+ recommendations:
147
+ - action: {what to do}
148
+ rationale: {why}
149
+ priority: high | medium | low
150
+ risks_identified: [...]
151
+ outputs:
152
+ - {path to ADR or diagram}
153
+ ```
154
+
155
+ **Scope**: Analyse architecture, design components, document ADRs, recommend patterns, run strategic decision workflows, maintain the technical risk register. Will NOT sprint-plan (delegate to software-teams-producer), write code (delegate to software-teams-programmer), make design decisions (delegate to software-teams-ux-designer / software-teams-product-lead).