opencastle 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  description: 'Release manager for pre-release verification, changelog generation, version management, regression checks, and release coordination.'
3
3
  name: 'Release Manager'
4
4
  model: GPT-5.3-Codex
5
- tools: ['search/changes', 'search/codebase', 'edit/editFiles', 'web/fetch', 'read/problems', 'execute/getTerminalOutput', 'execute/runInTerminal', 'read/terminalLastCommand', 'read/terminalSelection', 'search', 'execute/testFailure', 'search/usages', 'vercel/get_deployment', 'vercel/get_deployment_build_logs', 'vercel/get_runtime_logs', 'vercel/list_deployments', 'vercel/list_projects', 'nx-mcp-server/nx_project_details', 'nx-mcp-server/nx_workspace', 'nx-mcp-server/nx_workspace_path']
5
+ tools: ['search/changes', 'search/codebase', 'edit/editFiles', 'web/fetch', 'read/problems', 'execute/getTerminalOutput', 'execute/runInTerminal', 'read/terminalLastCommand', 'read/terminalSelection', 'search', 'execute/testFailure', 'search/usages', 'vercel/get_deployment', 'vercel/get_deployment_build_logs', 'vercel/get_runtime_logs', 'vercel/list_deployments', 'vercel/list_projects', 'nx-mcp-server/nx_project_details', 'nx-mcp-server/nx_workspace', 'nx-mcp-server/nx_workspace_path', 'slack/*']
6
6
  ---
7
7
 
8
8
  <!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the customizations/ directory instead. -->
@@ -2,7 +2,7 @@
2
2
  description: 'Task orchestrator that analyzes work, decomposes it into subtasks, and delegates to specialized agents via sub-agents (inline) or background sessions (parallel worktrees).'
3
3
  name: 'Team Lead'
4
4
  model: Claude Opus 4.6
5
- tools: [read/problems, read/readFile, agent/runSubagent, edit/createDirectory, edit/createFile, edit/createJupyterNotebook, edit/editFiles, edit/editNotebook, search/changes, search/codebase, search/fileSearch, search/listDirectory, search/searchResults, search/textSearch, search/usages, web/fetch, agent, execute/runInTerminal, execute/getTerminalOutput, read/terminalLastCommand, read/terminalSelection, linear/create_issue, linear/get_issue, linear/list_issues, linear/list_projects, linear/list_teams, linear/search_issues, linear/update_issue]
5
+ tools: [read/problems, read/readFile, agent/runSubagent, edit/createDirectory, edit/createFile, edit/createJupyterNotebook, edit/editFiles, edit/editNotebook, search/changes, search/codebase, search/fileSearch, search/listDirectory, search/searchResults, search/textSearch, search/usages, web/fetch, agent, execute/runInTerminal, execute/getTerminalOutput, read/terminalLastCommand, read/terminalSelection, linear/create_issue, linear/get_issue, linear/list_issues, linear/list_projects, linear/list_teams, linear/search_issues, linear/update_issue, slack/*]
6
6
  agents: ['*']
7
7
  handoffs:
8
8
  - label: Implement Feature
@@ -594,6 +594,8 @@ When multiple agents complete work simultaneously, batch similar reviews. Load *
594
594
  - [ ] All Linear issues moved to Done
595
595
  - [ ] Lint, test, and build pass for affected projects
596
596
  - [ ] Documentation updated
597
+ - [ ] **Session records logged** to `.github/customizations/logs/sessions.ndjson` — one entry per completed task
598
+ - [ ] **Delegation records logged** to `.github/customizations/logs/delegations.ndjson` — one entry per delegation
597
599
  - [ ] All changes committed to the feature branch with Linear issue IDs in commit messages
598
600
  - [ ] Branch pushed to origin
599
601
  - [ ] PR opened on GitHub (NOT merged)
@@ -618,6 +620,15 @@ Track failed agent delegations in `.github/customizations/AGENT-FAILURES.md` so
618
620
 
619
621
  When automated resolution is exhausted (panel 3x BLOCK, unresolvable conflicts), create a **formal dispute record** in `.github/customizations/DISPUTES.md` instead. Disputes package both perspectives, attempt history, and resolution options — giving humans a clear, actionable decision rather than a raw failure log. See the **team-lead-reference** skill § Dispute Protocol for the full procedure.
620
622
 
623
+ ## Observability Logging
624
+
625
+ **The Team Lead MUST log every session.** No exceptions. See `general.instructions.md` § Observability Logging for the full rules.
626
+
627
+ - After delegations: log a **session record** + a **delegation record**
628
+ - After working directly: log a **session record** (use the matching agent role)
629
+ - Log **per task**, before yielding to the user
630
+ - Multiple tasks in one conversation = multiple records
631
+
621
632
  ## Anti-Patterns
622
633
 
623
634
  - **Never write or delegate code before Linear issues exist** — issues are a blocking gate, not a follow-up task
@@ -644,3 +655,4 @@ When automated resolution is exhausted (panel 3x BLOCK, unresolvable conflicts),
644
655
  - **Never merge a PR yourself** — PRs are opened for human review only
645
656
  - **Never forget to link the PR to Linear** — traceability is mandatory
646
657
  - **Never exceed session budget without checkpointing** — context degrades after 8+ delegations; save state and resume in a fresh session
658
+ - **Never skip observability logging** — every session gets logged. No exceptions. No threshold. No "too small to log"
@@ -0,0 +1,57 @@
1
+ # Notifications Configuration
2
+
3
+ <!-- Populated by the `bootstrap-customizations` prompt based on `.opencastle.json` → `stack.notifications`. -->
4
+
5
+ Project-specific messaging configuration referenced by the `slack-notifications` skill (or Teams equivalent).
6
+
7
+ ## Provider
8
+
9
+ <!-- Which messaging provider is configured: slack, teams, or none -->
10
+
11
+ | Field | Value |
12
+ |-------|-------|
13
+ | **Provider** | <!-- slack / teams / none --> |
14
+ | **MCP Server** | <!-- e.g., @kazuph/mcp-slack --> |
15
+ | **Bot Name** | <!-- e.g., OpenCastle Agents --> |
16
+
17
+ ## Channels
18
+
19
+ Map project channels to their purpose. Agents use this table to determine where to post.
20
+
21
+ | Channel Name | Channel ID | Purpose |
22
+ |-------------|------------|---------|
23
+ | <!-- e.g., #agent-updates --> | <!-- e.g., C0AHAQFJ7C1 --> | <!-- General agent activity feed --> |
24
+ | <!-- e.g., #agent-approvals --> | <!-- e.g., C0BHKL3M2D4 --> | <!-- Approval requests requiring human action --> |
25
+ | <!-- e.g., #agent-errors --> | <!-- e.g., C0CJNM4P5E6 --> | <!-- Error reports and blocked tasks --> |
26
+
27
+ > **Tip:** Use `channels_list` via MCP to discover channel IDs, then populate this table.
28
+
29
+ ## Notification Preferences
30
+
31
+ Configure which events trigger notifications and where they go.
32
+
33
+ | Event | Channel | Enabled |
34
+ |-------|---------|---------|
35
+ | Task started | <!-- #agent-updates --> | <!-- yes/no --> |
36
+ | Task completed | <!-- #agent-updates --> | <!-- yes/no --> |
37
+ | Approval needed | <!-- #agent-approvals --> | <!-- yes/no --> |
38
+ | Error / blocked | <!-- #agent-errors --> | <!-- yes/no --> |
39
+ | Session started | <!-- #agent-updates --> | <!-- yes/no --> |
40
+ | Session ended | <!-- #agent-updates --> | <!-- yes/no --> |
41
+
42
+ ## Users
43
+
44
+ Map team members to their messaging user IDs for mentions.
45
+
46
+ | Name | User ID | Role |
47
+ |------|---------|------|
48
+ | <!-- e.g., Filip --> | <!-- e.g., U0AJ7DL9KS5 --> | <!-- e.g., Project Lead --> |
49
+
50
+ > **Tip:** Use `users_resolve` via MCP to look up user IDs by name or email.
51
+
52
+ ## Environment Variables
53
+
54
+ | Variable | Purpose | Required |
55
+ |----------|---------|----------|
56
+ | `SLACK_MCP_XOXB_TOKEN` | Bot token for Slack MCP server | Yes (if provider is Slack) |
57
+ | `SLACK_MCP_ADD_MESSAGE_TOOL` | Enable message posting (`true` or comma-separated channel IDs) | Yes (if agents should post) |
@@ -153,6 +153,34 @@ If Linear MCP tools are not available in the current session, do NOT block on is
153
153
  4. **Ask the user** to create the issues manually if tracking is critical for the task
154
154
  5. After implementation, update commit messages and PR descriptions when issue IDs become available
155
155
 
156
+ ## Observability Logging (Mandatory)
157
+
158
+ **Every agent MUST log every session to the observability NDJSON files.** No exceptions. No threshold. No "too small to log." The dashboard depends on this data.
159
+
160
+ ### What to log
161
+
162
+ | File | Who appends | When |
163
+ |------|------------|------|
164
+ | `sessions.ndjson` | **All agents** | After every session — always |
165
+ | `delegations.ndjson` | **Team Lead** | After each delegation to a specialist agent |
166
+ | `panels.ndjson` | **Panel runner** | After each majority-vote review |
167
+
168
+ See `.github/customizations/logs/README.md` for the full schema of each record.
169
+
170
+ ### How to log
171
+
172
+ Append one JSON line per task. When the Team Lead works directly, use the agent role that best describes the work (e.g., `"agent": "Developer"`, `"agent": "UI-UX Expert"`). If a single conversation involves multiple distinct tasks, log one record per task.
173
+
174
+ ```bash
175
+ echo '{"timestamp":"2026-03-01T14:00:00Z","agent":"Developer","model":"claude-opus-4-6","task":"Fix login redirect bug","outcome":"success","duration_min":15,"files_changed":3,"retries":0,"lessons_added":[],"discoveries":[]}' >> .github/customizations/logs/sessions.ndjson
176
+ ```
177
+
178
+ ### Rules
179
+
180
+ - **Log before yielding to the user** — logging is the last action before responding.
181
+ - **Log per task**, not per conversation. Multiple tasks = multiple records.
182
+ - **Never batch-log retrospectively** across sessions.
183
+
156
184
  ## Self-Improvement Protocol
157
185
 
158
186
  **Every agent must learn from mistakes and share knowledge.** This prevents the same pitfalls from being repeated across sessions.
@@ -160,7 +188,6 @@ If Linear MCP tools are not available in the current session, do NOT block on is
160
188
  1. **Before starting work:** Read `.github/customizations/LESSONS-LEARNED.md` — apply relevant lessons proactively
161
189
  2. **During execution:** If you retry a command/tool with a different approach and it works, **immediately** add a lesson entry to `.github/customizations/LESSONS-LEARNED.md`
162
190
  3. **Update source files:** If the lesson reveals a gap in instruction/skill files, update those files too
163
- 5. **Log the session:** Append a JSON line to `.github/customizations/logs/sessions.ndjson` when your work is complete — see `.github/customizations/logs/README.md` for the schema
164
191
  4. **Update instructions:** Proactively suggest updates to `.github/instructions/` or `.github/skills/` files when:
165
192
  - The user had to intervene or correct the agent's approach
166
193
  - Multiple back-and-forth attempts were needed to get something right
@@ -183,11 +210,13 @@ These rules apply to ALL specialist agents automatically. **Do not duplicate the
183
210
  1. **Never delegate** — Specialist agents complete their own work and return results. Never invoke the Team Lead or spawn sub-agents. If work requires another domain, document the need in your output contract.
184
211
  2. **Follow the Discovered Issues Policy** — Track any pre-existing bugs found during your work (see § Discovered Issues Policy above).
185
212
  3. **Read and update lessons** — Read `.github/customizations/LESSONS-LEARNED.md` before starting. If you retry anything with a different approach that works, add a lesson immediately.
213
+ 4. **Log every session** — Append to `.github/customizations/logs/sessions.ndjson` after every session. No exceptions. See § Observability Logging above.
186
214
 
187
215
  ## Base Output Contract
188
216
 
189
- Every specialist agent's Output Contract MUST end with these two standard items (in addition to domain-specific items above them):
217
+ Every specialist agent's Output Contract MUST end with these standard items (in addition to domain-specific items above them):
190
218
 
219
+ - **Session Logged** — Confirm that a session record was appended to `.github/customizations/logs/sessions.ndjson` (mandatory per § Observability Logging)
191
220
  - **Discovered Issues** — Pre-existing bugs or anomalies found during work, with tracking action taken per the Discovered Issues Policy
192
221
  - **Lessons Applied** — Lessons from `.github/customizations/LESSONS-LEARNED.md` that influenced this work, and any new lessons added
193
222
 
@@ -34,18 +34,24 @@
34
34
  "Linear": {
35
35
  "type": "stdio",
36
36
  "command": "npx",
37
- "args": ["-y", "@mseep/linear-mcp"],
38
- "env": {
39
- "LINEAR_API_KEY": "${env:LINEAR_API_KEY}"
40
- }
37
+ "args": [
38
+ "-y",
39
+ "@mseep/linear-mcp"
40
+ ],
41
+ "envFile": "${workspaceFolder}/.env"
41
42
  },
42
43
  "Jira": {
43
44
  "url": "https://mcp.atlassian.com/v2/sse",
44
45
  "type": "http"
45
46
  },
46
47
  "Slack": {
47
- "url": "https://mcp.slack.com/mcp",
48
- "type": "http"
48
+ "type": "stdio",
49
+ "command": "npx",
50
+ "args": ["-y", "@kazuph/mcp-slack"],
51
+ "envFile": "${workspaceFolder}/.env",
52
+ "env": {
53
+ "SLACK_MCP_ADD_MESSAGE_TOOL": "true"
54
+ }
49
55
  },
50
56
  "Teams": {
51
57
  "url": "https://mcp.microsoft365.com/mcp",
@@ -30,8 +30,9 @@ Session Lifecycle:
30
30
 
31
31
  1. **Read lessons learned** — Scan `.github/customizations/LESSONS-LEARNED.md` for entries relevant to the current task domain. Apply proactively.
32
32
  2. **Check for checkpoint** — If `docs/SESSION-CHECKPOINT.md` exists, read it. Resume from last known state instead of re-analyzing.
33
- 3. **Check dead letter queue** — Scan `.github/customizations/AGENT-FAILURES.md` for pending failures related to the current scope.
34
- 4. **Load domain skills** — Based on the task description, load the appropriate skills before writing code. Don't start coding without the relevant skill loaded.
33
+ 3. **Check pending approvals** — If the checkpoint has a `## Pending Approvals` section, check for replies using the configured messaging provider's MCP tools (e.g., `conversations_replies` for Slack). Read `.opencastle.json` → `stack.notifications` to determine the provider. If no messaging is configured, skip this step.
34
+ 4. **Check dead letter queue** — Scan `.github/customizations/AGENT-FAILURES.md` for pending failures related to the current scope.
35
+ 5. **Load domain skills** — Based on the task description, load the appropriate skills before writing code. Don't start coding without the relevant skill loaded.
35
36
 
36
37
  ### Template for Delegation Prompts
37
38
 
@@ -39,19 +40,22 @@ Include this reminder in every delegation:
39
40
 
40
41
  ```
41
42
  **Session Start:** Read `.github/customizations/LESSONS-LEARNED.md` before starting.
42
- Check `docs/SESSION-CHECKPOINT.md` for prior state. Load relevant skills
43
- before writing code.
43
+ Check `docs/SESSION-CHECKPOINT.md` for prior state and pending approvals.
44
+ If pending approvals exist, check for replies via the messaging provider.
45
+ Load relevant skills before writing code.
44
46
  ```
45
47
 
46
48
  ---
47
49
 
48
50
  ## Hook: on-session-end
49
51
 
50
- **When:** Before the agent yields control back to the user or completes its task.
52
+ **When:** Before the agent yields control back to the user every time, unconditionally.
53
+
54
+ > **You MUST log every session.** No threshold, no exceptions, no "too small to log."
51
55
 
52
56
  ### Actions
53
57
 
54
- 1. **Log the session** — Append a JSON line to `.github/customizations/logs/sessions.ndjson` with: agent name, task summary, files changed, duration estimate, outcome (success/partial/failed), and lessons count.
58
+ 1. **Log the session (MANDATORY)** — Append a JSON line to `.github/customizations/logs/sessions.ndjson` with: agent name, task summary, files changed, duration estimate, outcome (success/partial/failed), and lessons count. See `general.instructions.md` § Observability Logging for full rules.
55
59
  2. **Save checkpoint** (Team Lead only) — If work is incomplete, write `docs/SESSION-CHECKPOINT.md` with current state so the next session can resume. Load **session-checkpoints** skill for format.
56
60
  3. **Verify lessons captured** — If any retries occurred during the session, confirm that each retry resulted in a lesson entry in `LESSONS-LEARNED.md`.
57
61
  4. **Memory merge check** — If `LESSONS-LEARNED.md` has grown significantly (5+ new entries this session), flag for memory merge consideration.
@@ -143,7 +147,9 @@ Each workflow's **Compound phase** naturally serves as the on-session-end hook f
143
147
  ## Anti-Patterns
144
148
 
145
149
  - **Skipping on-session-start** — Leads to repeated mistakes already documented in lessons learned
146
- - **Forgetting session logging** — Makes performance tracking and agent improvement impossible
150
+ - **Forgetting session logging** — Makes the observability dashboard empty and performance tracking impossible. This is the #1 most common failure.
151
+ - **Treating logging as optional** — Every session gets logged. No threshold, no exceptions.
152
+ - **Batch-logging retrospectively** — Log each task as it completes, not all at once at the end of a long conversation.
147
153
  - **Partial post-delegate checks** — "It compiled, ship it" without checking acceptance criteria
148
154
  - **No cleanup** — Temp files accumulate and confuse future sessions
149
155
  - **Hooks as blockers** — Hooks should add ~2 minutes overhead, not 20. If a hook takes too long, skip the optional parts
@@ -54,6 +54,18 @@ Phase N of M — Brief description of what this phase does
54
54
  |------|--------|-------|-------------|-------|
55
55
  | Description | TAS-AA | Agent Name | TAS-ZZ | file4.ts, file5.ts |
56
56
 
57
+ ## Pending Approvals
58
+
59
+ Approval requests posted to the messaging provider that haven't been answered yet.
60
+ The `on-session-start` hook checks for replies when a new session begins.
61
+
62
+ | Provider | Channel | Thread ID | Question | Posted At |
63
+ |----------|---------|-----------|----------|-----------|
64
+ | slack | C0AHAQFJ7C1 | 1772393542.345149 | Run migration on production? | 2026-03-01 14:30 |
65
+
66
+ If the user answered in the VS Code chat during the previous session, remove
67
+ the row from this table — the approval was already resolved.
68
+
57
69
  ## Key Decisions Made
58
70
 
59
71
  - Decision 1: Why this approach was chosen
@@ -13,37 +13,90 @@ Agent communication patterns via the Slack MCP server. Enables agents to post pr
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | **URL** | `https://mcp.slack.com/mcp` |
17
- | **Type** | Streamable HTTP (JSON-RPC 2.0) |
18
- | **Auth** | OAuth 2.0 via registered Slack app (`client_id` + `client_secret`) |
19
- | **Supported clients** | Claude.ai, Claude Code, Cursor, Perplexity |
16
+ | **Package** | [`@kazuph/mcp-slack`](https://www.npmjs.com/package/@kazuph/mcp-slack) |
17
+ | **Type** | stdio (spawned via `npx -y @kazuph/mcp-slack`) |
18
+ | **Auth** | Bot token (`xoxb-…`) via `SLACK_MCP_XOXB_TOKEN` env var (loaded from `.env` or `envFile`) |
19
+ | **Extra env** | `SLACK_MCP_ADD_MESSAGE_TOOL=true` enables the `conversations_add_message` tool |
20
+ | **Supported clients** | VS Code, Claude Code, Cursor, any MCP-compatible client with stdio support |
20
21
 
21
- ### Required OAuth Scopes
22
+ ### Authentication
22
23
 
23
- The Slack app must be granted scopes for the operations agents will perform:
24
+ The `@kazuph/mcp-slack` server supports multiple token types (only one is needed):
25
+
26
+ | Env Variable | Token Type | Notes |
27
+ |-------------|------------|-------|
28
+ | `SLACK_MCP_XOXB_TOKEN` | Bot token (`xoxb-…`) | Limited to invited channels only, no search |
29
+ | `SLACK_MCP_XOXP_TOKEN` | User OAuth token (`xoxp-…`) | Full access, requires OAuth app setup |
30
+ | `SLACK_MCP_XOXC_TOKEN` + `SLACK_MCP_XOXD_TOKEN` | Browser tokens | "Stealth mode" — no app install needed |
31
+
32
+ This project uses a **bot token** (`SLACK_MCP_XOXB_TOKEN`). Add these under **Bot Token Scopes** in the Slack app configuration:
24
33
 
25
34
  | Scope | Purpose |
26
35
  |-------|---------|
27
- | `channels:read` | List and search public channels |
28
- | `channels:history` | Read messages in public channels |
29
36
  | `chat:write` | Post messages and replies |
30
- | `users:read` | Look up user profiles for mentions |
31
- | `reactions:read` | Read emoji reactions (approval signals) |
32
- | `reactions:write` | Add emoji reactions (acknowledgments) |
33
- | `search:read` | Search messages and files |
37
+ | `channels:read` | List public channels and their metadata |
38
+ | `channels:history` | Read messages in public channels |
39
+ | `channels:manage` | Create/rename channels, set topics (optional) |
40
+ | `groups:read` | List private channels |
41
+ | `groups:history` | Read messages in private channels |
42
+ | `im:read` | List direct message conversations |
43
+ | `im:history` | Read direct messages |
44
+ | `mpim:read` | List group DM conversations |
45
+ | `mpim:history` | Read group DMs |
46
+ | `users:read` | Look up user profiles |
47
+ | `users:read.email` | Look up user emails |
48
+
49
+ > **Note:** `channels:manage` is optional — only needed if agents should create channels or rename them. Without it, `conversations_create` and `conversations_rename` will return `missing_scope`.
50
+ >
51
+ > **Note:** Bot tokens cannot search messages. If search is needed, use a user token (`xoxp-…`) instead.
34
52
 
35
53
  Admin approval is required. Work with the workspace admin to install the app.
36
54
 
37
55
  ## Available MCP Tools
38
56
 
39
- The Slack MCP server exposes tools for:
57
+ The Slack MCP server exposes the following tools (prefixed with `mcp_slack_` in VS Code / Copilot):
58
+
59
+ ### Channel Management
60
+
61
+ | Tool | Description | Key Parameters |
62
+ |------|-------------|----------------|
63
+ | `channels_list` | List workspace channels | `channel_types` (public/private), `limit`, `cursor` |
64
+ | `conversations_create` | Create a new channel | `name` (required). Needs `channels:manage` scope |
65
+ | `conversations_rename` | Rename a channel | `channel_id`, `name`. Needs `channels:manage` scope |
66
+ | `conversations_set_topic` | Set a channel's topic | `channel_id`, `topic` |
67
+ | `conversations_invite` | Invite user(s) to a channel | `channel_id`, `users` (comma-separated user IDs) |
68
+
69
+ ### Messaging
70
+
71
+ | Tool | Description | Key Parameters |
72
+ |------|-------------|----------------|
73
+ | `conversations_add_message` | Post a message to a channel or thread | `channel_id` (ID or name), `payload` (message text), `content_type` (`text/markdown` or `text/plain`, default: `text/markdown`), `thread_ts` (optional, for threading) |
74
+ | `conversations_history` | Read recent messages from a channel | `channel_id`, `limit` (time range like `1d`/`7d`/`30d` or message count like `50`), `cursor` |
75
+ | `conversations_replies` | Get replies in a thread | `channel_id`, `thread_ts`, `limit`, `cursor` |
76
+ | `conversations_search_messages` | Search messages across channels | `search_query`, `filter_in_channel`, `filter_users_from`, `filter_date_before`/`after`/`on`/`during`, `limit` (1-100) |
40
77
 
41
- - **Search** — `slack_search_messages`, `slack_search_channels`, `slack_search_users`
42
- - **Read** — `slack_get_channel_history`, `slack_get_thread_replies`, `slack_get_channel_info`
43
- - **Write** — `slack_post_message`, `slack_reply_to_thread`, `slack_add_reaction`
44
- - **Canvases** — `slack_create_canvas`, `slack_update_canvas`
78
+ ### Users
45
79
 
46
- Tool names may vary by MCP server version. Use tool discovery to list available tools at runtime.
80
+ | Tool | Description | Key Parameters |
81
+ |------|-------------|----------------|
82
+ | `users_resolve` | Look up a user by name or email | Returns user ID for mentions |
83
+
84
+ ### Channel ID Resolution
85
+
86
+ The `channel_id` parameter in messaging tools accepts:
87
+ - **Channel ID** — e.g., `C0AHAQFJ7C1` (most reliable)
88
+ - **Channel name** — e.g., `new-channel` (without `#` prefix)
89
+
90
+ When a channel name is ambiguous or not found, use `channels_list` first to get the correct ID.
91
+
92
+ ### Key Differences from Documented Slack Web API
93
+
94
+ - Tool names use `conversations_*` pattern, not `chat.postMessage` etc.
95
+ - Message body is sent via `payload` parameter, not `text`
96
+ - Message posting is **disabled by default** — requires `SLACK_MCP_ADD_MESSAGE_TOOL=true` env var
97
+ - `limit` on history/replies accepts time ranges (`1d`, `7d`, `30d`) or message counts (`50`)
98
+ - No reaction tools — reactions are not available via this MCP server
99
+ - No canvas tools — canvases are not exposed
47
100
 
48
101
  ## Agent Notification Patterns
49
102
 
@@ -80,46 +133,93 @@ Format:
80
133
 
81
134
  ## Bi-Directional Communication
82
135
 
83
- ### Human-in-the-Loop Approval
136
+ ### Dual-Channel Approval Pattern
84
137
 
85
- When an agent needs approval before proceeding (destructive operations, production deployments, large refactors):
138
+ Approval requests are always **dual-channel** posted to Slack AND asked in the chat window. The first response (from either channel) wins.
86
139
 
87
- 1. **Post approval request** to the channel with clear options:
140
+ ```
141
+ Agent needs approval
142
+ ├─→ Posts to Slack channel/thread
143
+ │ → User replies in Slack
144
+ │ → Agent polls & picks it up ──────┐
145
+ │ ▼
146
+ │ Agent acts
147
+ │ ▲
148
+ └─→ Asks in VS Code chat │
149
+ → User replies here ──────────────┘
150
+ (immediate, no polling needed)
151
+ ```
152
+
153
+ **Why dual-channel:** The chat path is instant (user's next message is the answer). The Slack path covers the case where the user is away from VS Code (mobile, another machine) and wants to unblock the agent remotely.
154
+
155
+ ### Approval Flow
156
+
157
+ 1. **Post to Slack** with a structured approval request:
88
158
  ```
89
159
  ⏳ **Approval Required**
90
160
  Task: TAS-42 — Database migration adds `price_range` column
91
161
  Action: Run migration on production database
92
-
93
- React with:
94
- ✅ — Approve and proceed
95
- ❌ — Reject and stop
96
- 💬 Reply in thread with questions
162
+
163
+ Reply in this thread with:
164
+ "approved" — Approve and proceed
165
+ "rejected" — Reject and stop
166
+ 💬 Or reply with questions
167
+ ```
168
+
169
+ 2. **Ask in chat** — Yield to the user with the same question so they can respond directly in the chat window.
170
+
171
+ 3. **If the user responds in chat** — The agent receives the answer immediately. Post confirmation to the Slack thread:
172
+ ```
173
+ ✅ Approved via VS Code chat. Proceeding.
97
174
  ```
98
175
 
99
- 2. **Poll for response** — Read reactions or thread replies to determine the decision
100
- 3. **Acknowledge** Post confirmation of the action taken
176
+ 4. **If waiting for Slack reply** — While the agent has non-blocked work, poll every 30 seconds:
177
+ - Use `conversations_replies` with the message's `thread_ts`
178
+ - Continue with independent subtasks between polls
179
+ - When a reply arrives, parse it and proceed
180
+
181
+ 5. **If session ends before reply** — Save to checkpoint (see session-checkpoints skill):
182
+ ```markdown
183
+ ## Pending Approvals
184
+ | Provider | Channel | Thread ID | Question | Posted At |
185
+ |----------|---------|-----------|----------|-----------|
186
+ | slack | C0AHAQFJ7C1 | 1772393542.345149 | Run migration on production? | 2026-03-01 14:30 |
187
+ ```
188
+ The next session's `on-session-start` hook checks for replies.
101
189
 
102
190
  ### Reading User Responses
103
191
 
104
192
  To check for approvals or instructions:
105
193
 
106
- 1. Use `slack_get_thread_replies` to read replies to the approval message
107
- 2. Use `slack_get_channel_history` with a time range to find recent directives
108
- 3. Parse reactions on messages for quick yes/no signals
194
+ 1. Use `conversations_replies` with the `thread_ts` of the approval message to read replies
195
+ 2. Use `conversations_history` with `oldest`/`latest` time range to find recent directives
196
+ 3. Thread replies are the primary mechanism — reactions are not available via MCP
197
+
198
+ ### Resolution Rule
199
+
200
+ - **First response wins** — whether from chat or Slack
201
+ - **Cross-post confirmation** — when answered in one channel, post confirmation to the other
202
+ - **Conflicting responses** — if both arrive simultaneously, prefer the chat response (it's more intentional)
109
203
 
110
204
  ### Parsing Conventions
111
205
 
112
206
  | Signal | Meaning |
113
207
  |--------|---------|
114
- | reaction | Approved — proceed |
115
- | reaction | Rejected — stop and report |
116
- | 👀 reaction | Acknowledged — user is reviewing |
117
- | Thread reply | Detailed instructions or questions |
208
+ | Thread reply with "approved" / "yes" / "go" | Approved — proceed |
209
+ | Thread reply with "rejected" / "no" / "stop" | Rejected — stop and report |
210
+ | Thread reply with "reviewing" / "looking" | Acknowledged — user is reviewing |
211
+ | Thread reply with detailed text | Instructions or questions |
118
212
  | `@agent` mention | Direct command or question for the agent |
119
213
 
214
+ > **Note:** Reactions (emoji responses) are not available via the Slack MCP server. Use thread replies for all approval workflows.
215
+
120
216
  ## Channel & Thread Conventions
121
217
 
122
- ### Channel Structure
218
+ ### Channel Configuration
219
+
220
+ Project-specific channel mappings are defined in `.github/customizations/stack/notifications-config.md`. Agents read that file to determine which channel to post to for each event type. Always prefer channel IDs from the config over hardcoded names.
221
+
222
+ ### Default Channel Structure
123
223
 
124
224
  | Channel | Purpose |
125
225
  |---------|---------|
@@ -170,9 +270,9 @@ Slack uses a markdown-like syntax with some differences:
170
270
 
171
271
  ## Security Considerations
172
272
 
173
- - **OAuth tokens** are managed by the MCP serveragents never see raw tokens
174
- - **Scope minimization** — request only the scopes agents actually need
175
- - **Channel restrictions** — limit the app to specific channels rather than granting workspace-wide access
273
+ - **Bot tokens** are passed via `SLACK_MCP_XOXB_TOKEN` env var (in `.env` file) — never hardcode in config files or commit to git
274
+ - **Scope minimization** — request only the scopes agents actually need (omit `channels:manage` if agents shouldn't create channels)
275
+ - **Channel restrictions** — limit the bot to specific channels rather than granting workspace-wide access
176
276
  - **Audit logging** — Slack Enterprise Grid provides audit logs for all API activity
177
277
  - **No secrets in messages** — never post tokens, passwords, or credentials in Slack messages (per Constitution #1)
178
278