Skip to content
This repository was archived by the owner on Jul 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
255 commits
Select commit Hold shift + click to select a range
7c53ffe
fix: trim reasoning output once on finish instead of per delta
techwithanirudh Jun 1, 2026
3c26e1c
fix: revert reasoning output duplication from finishTask
techwithanirudh Jun 1, 2026
814c48b
feat: show MCP tools in task UI
techwithanirudh Jun 1, 2026
0183df4
docs: track provider fallback issues
techwithanirudh Jun 1, 2026
9f32bf1
fix: bound fallback retry attempts
techwithanirudh Jun 1, 2026
af2330d
fix: show MCP tool input in tasks
techwithanirudh Jun 1, 2026
48f6575
fix: label MCP task output
techwithanirudh Jun 1, 2026
b4393b1
style: polish MCP OAuth callback page
techwithanirudh Jun 1, 2026
5ae3e03
fix: fail open when MCP setup fails
techwithanirudh Jun 1, 2026
7ccd703
refactor: simplify MCP toolset naming
techwithanirudh Jun 1, 2026
c2e2b3d
fix: repair bearer MCP connect flow
techwithanirudh Jun 1, 2026
f84beb6
feat: polish MCP App Home UI and OAuth callback page
techwithanirudh Jun 1, 2026
d6d46c0
style: remove example server name from client ID hint
techwithanirudh Jun 1, 2026
315d195
style: rename bearer token label to token
techwithanirudh Jun 1, 2026
d2b9788
style: tighten MCP empty state gap and add dividers between items
techwithanirudh Jun 1, 2026
57731d3
style: simplify MCP UI copy and modal text
techwithanirudh Jun 1, 2026
b0e4dc9
feat: add MCP tool approvals
techwithanirudh Jun 1, 2026
4256184
feat: harden MCP credential storage
techwithanirudh Jun 1, 2026
8d26298
chore: cleanup
techwithanirudh Jun 1, 2026
f94ee33
Move orchestrator types into shared bot types
techwithanirudh Jun 1, 2026
a3e4d4b
refactor: clean up mcp credential handling
techwithanirudh Jun 1, 2026
db87822
refactor: keep app home branch mcp focused
techwithanirudh Jun 2, 2026
c63dc3d
refactor: address mcp review cleanup
techwithanirudh Jun 2, 2026
5825605
refactor: inline guarded fetch cleanup
techwithanirudh Jun 2, 2026
d5b482b
refactor: clean up mcp validation boundaries
techwithanirudh Jun 2, 2026
c5e1de6
refactor: simplify mcp oauth callback route
techwithanirudh Jun 2, 2026
abab88c
fix: fail open when mcp setup errors
techwithanirudh Jun 2, 2026
b105b6d
refactor: clean up mcp code, move oauth page to nitro renderer
techwithanirudh Jun 2, 2026
c4e9b48
refactor: scope mcp queries by teamId and clean up response functions
techwithanirudh Jun 2, 2026
744e62a
refactor: deduplicate parseEncryptedMcpJson into @repo/utils
techwithanirudh Jun 2, 2026
b15ec92
refactor: move user-facing MCP strings to config, extract result text…
techwithanirudh Jun 2, 2026
5dd5ba8
refactor: fix prompts view — schema parse instead of cast, dict params
techwithanirudh Jun 2, 2026
62981a4
chore: fix
techwithanirudh Jun 2, 2026
3ef55c7
chore: imprv logic
techwithanirudh Jun 2, 2026
e737f5a
refactor: clean up customization handler wrappers
techwithanirudh Jun 2, 2026
663878b
refactor: remove more cleanup wrappers
techwithanirudh Jun 2, 2026
76fc08d
refactor: address mcp review cleanup
techwithanirudh Jun 2, 2026
a013637
fix: harden mcp approval and connection state
techwithanirudh Jun 2, 2026
a5c0c7c
refactor: clean up customization home rendering
techwithanirudh Jun 2, 2026
e8b504b
chore: fix
techwithanirudh Jun 2, 2026
a67cb07
chore: shorten slack markdown helper name
techwithanirudh Jun 2, 2026
29bfca1
refactor: simplify mcp tool handling
techwithanirudh Jun 2, 2026
c7a9f95
fix: bind mcp oauth credentials to server url
techwithanirudh Jun 2, 2026
425ac96
fix: update mcp approval card immediately
techwithanirudh Jun 2, 2026
e5d2ecf
fix: preserve custom instruction empty state markdown
techwithanirudh Jun 2, 2026
a30e39a
fix: show mcp discovery failures clearly
techwithanirudh Jun 2, 2026
49562b6
fix: keep mcp clients open during discovery
techwithanirudh Jun 2, 2026
4c0b6a8
fix: clean up mcp app home states
techwithanirudh Jun 2, 2026
370dcfa
fix: tighten mcp slack boundaries
techwithanirudh Jun 2, 2026
1d965c5
fix: avoid duplicate mcp cleanup
techwithanirudh Jun 2, 2026
a5043d4
fix: remove mcp server listing cap
techwithanirudh Jun 2, 2026
a2e15a6
fix: polish mcp approval flow
techwithanirudh Jun 3, 2026
c7eec2d
fix: render mcp approval tool names cleanly
techwithanirudh Jun 3, 2026
0587a9e
fix: expire superseded approval cards
techwithanirudh Jun 3, 2026
3ef224c
fix: add mcp tool reset button
techwithanirudh Jun 3, 2026
9abd7a3
fix: move mcp reset into modal header
techwithanirudh Jun 3, 2026
1ef8bda
chore: fix
techwithanirudh Jun 3, 2026
69e16f1
fix: clarify mcp approval card titles
techwithanirudh Jun 3, 2026
0dce320
chore: thing
techwithanirudh Jun 3, 2026
90795b9
chore: logic
techwithanirudh Jun 3, 2026
6044c0d
chore: upd error handling
techwithanirudh Jun 3, 2026
b79f24a
chore: sss
techwithanirudh Jun 3, 2026
4bd8c27
chore: upd mcp
techwithanirudh Jun 3, 2026
8b9a701
refactor: clean up MCP connection, secret, and approval plumbing
techwithanirudh Jun 3, 2026
89f0042
refactor: model MCP approval as a single reply value
techwithanirudh Jun 3, 2026
666d681
refactor: move MCP approval/resume logic out of respond.ts
techwithanirudh Jun 5, 2026
486f240
feat: resume MCP tool batches once every approval is answered
techwithanirudh Jun 5, 2026
2708320
chore: upd comments
techwithanirudh Jun 5, 2026
bf2ab98
chore: codex the goat
techwithanirudh Jun 5, 2026
7e43611
chore: codex the goat...
techwithanirudh Jun 5, 2026
f7fd8f2
chore: thing
techwithanirudh Jun 5, 2026
edb15c3
chore: codex refactor
techwithanirudh Jun 5, 2026
6493d82
chore: rename MCP configure button
techwithanirudh Jun 5, 2026
a511a75
docs: add follow-up task notes
techwithanirudh Jun 5, 2026
850258f
chore: log MCP tool calls
techwithanirudh Jun 5, 2026
0c2d5f6
chore: centralize MCP modal field reads
techwithanirudh Jun 5, 2026
292bfbb
fix: buffer orchestrator reasoning updates
techwithanirudh Jun 6, 2026
b6dee8a
fix: stabilize prompt customization modals
techwithanirudh Jun 6, 2026
031b1a3
fix: log MCP modal transition failures
techwithanirudh Jun 6, 2026
6532845
fix: log stale scheduled task cancels
techwithanirudh Jun 6, 2026
d82e2b4
docs: update reasoning stream follow-up
techwithanirudh Jun 6, 2026
28f904e
refactor: build MCP tool modals with builder
techwithanirudh Jun 6, 2026
ce53041
refactor: move MCP schemas to validators
techwithanirudh Jun 6, 2026
df8b2cb
docs: remove stale MCP review notes
techwithanirudh Jun 6, 2026
30999ef
fix: restore MCP approval cards
techwithanirudh Jun 6, 2026
ebec5c7
chore: default server start to port 8000
techwithanirudh Jun 6, 2026
709a668
refactor: hide reasoning stream, only show Thought for Xs summary
techwithanirudh Jun 6, 2026
819238a
fix: global block mode overrides thread always-allow for MCP tools
techwithanirudh Jun 6, 2026
d7bf86f
fix: mcp permission edge cases — cleanup, mode precedence, batch dead…
techwithanirudh Jun 7, 2026
6a361a8
refactor: simplify ensureMCPToolModes to always rebuild from current …
techwithanirudh Jun 7, 2026
7a678b8
refactor: simplify mcp permission and approval plumbing
techwithanirudh Jun 7, 2026
bcefbf0
refactor: inline and delete formatToolInput wrapper
techwithanirudh Jun 7, 2026
2759cdd
fix: use consistent deny wording in configure ui and task titles
techwithanirudh Jun 7, 2026
1c380e4
fix: image size cap, queue depth limit, approval status userId filter
techwithanirudh Jun 7, 2026
66930b2
fix: approval permissions, ui polish, normalize tool names
techwithanirudh Jun 7, 2026
d8c339b
chore: move regex to module scope in format-tool-name
techwithanirudh Jun 7, 2026
5809bd5
chore: disable useTopLevelRegex lint rule
techwithanirudh Jun 7, 2026
aed17fc
fix: switch db client from pg-pool to neon serverless driver
techwithanirudh Jun 7, 2026
6360301
chore: fix up stuffs
techwithanirudh Jun 7, 2026
0dbb04c
chore: again
techwithanirudh Jun 7, 2026
bcbbbab
refactor: extract mcp tool wrapper, add coding-best-practices skill
techwithanirudh Jun 7, 2026
46935e8
Merge remote-tracking branch 'origin/main' into t3code/mcp-app-home-c…
techwithanirudh Jun 7, 2026
0c5ed42
feat: add tool search + fix stale main-merge files
techwithanirudh Jun 7, 2026
abd3a66
feat: auto-save tool modes, pagination, Done button
techwithanirudh Jun 7, 2026
6f1cdf7
fix: rename token_hash column back to token, rename MCP URL label
techwithanirudh Jun 7, 2026
c1651b6
feat: fuzzy search, auto-search on keypress, loading state, knip cleanup
techwithanirudh Jun 8, 2026
1482339
fix: views.update hash chaining, centralize GroupSlug/ToolMode discri…
techwithanirudh Jun 8, 2026
6fa2b1b
refactor: code quality sweep on mcp feature folder
techwithanirudh Jun 8, 2026
d3beb9e
feat: accordion groups, optional search, system prompt context
techwithanirudh Jun 8, 2026
b3f5d12
refactor: rename groupLabels to groupNames
techwithanirudh Jun 8, 2026
807eab3
feat: all accordion groups can be closed, no default-open group
techwithanirudh Jun 9, 2026
a305ed7
revert: restore default-open first group on modal open
techwithanirudh Jun 9, 2026
7e2862a
feat: flat list below 40 tools, accordion above
techwithanirudh Jun 9, 2026
e8197bc
chore: guess we're doing agentic ai now
techwithanirudh Jun 12, 2026
6da8d18
chore: idk anymore
techwithanirudh Jun 12, 2026
7c307c8
fix: reclaim scheduled tasks orphaned by a crashed run
techwithanirudh Jun 12, 2026
8e9ae8c
fix: make MCP server url/transport/authType immutable after creation
techwithanirudh Jun 12, 2026
4c56826
fix: enforce response size cap in guarded MCP fetch
techwithanirudh Jun 12, 2026
9097a7a
chore: drop unused pino/pino-pretty (bot) and pg catalog entries
techwithanirudh Jun 12, 2026
a2778a4
chore: lint staged files pre-commit via lefthook
techwithanirudh Jun 12, 2026
36d59dc
chore: remove unused db:migrate path, document push-only workflow
techwithanirudh Jun 12, 2026
3f5f675
docs: mark resolved MCP improvement items, fix stale paths
techwithanirudh Jun 12, 2026
ca6ac17
fix: reopen approval batch when post-approval resume fails
techwithanirudh Jun 12, 2026
352874f
perf: parallelize MCP server setup and skip redundant mode writes
techwithanirudh Jun 12, 2026
aa1520e
feat: log MCP connection lifecycle and propagate ctxId via AsyncLocal…
techwithanirudh Jun 13, 2026
2db7fb7
refactor: single render flow for the MCP tools modal
techwithanirudh Jun 13, 2026
b1f4da0
refactor: single bearer connect flow for create and reconnect
techwithanirudh Jun 13, 2026
8e18132
refactor!: approval "Always" grants global allow; drop thread-scope r…
techwithanirudh Jun 13, 2026
8283550
docs: spike findings for pre-OAuth MCP tool discovery
techwithanirudh Jun 13, 2026
14512fb
docs: update plans status — 002-011 + 008 done, 001/012/013 rejected
techwithanirudh Jun 13, 2026
9f638f8
chore: cleanup stuff
techwithanirudh Jun 13, 2026
8132307
chore: idk
techwithanirudh Jun 13, 2026
3bb8b22
feat: refine harness prompt and supabase db client
techwithanirudh Jun 13, 2026
996f013
fix: simplify database client url handling
techwithanirudh Jun 13, 2026
e2a8c01
fix: require ssl for supabase database
techwithanirudh Jun 13, 2026
0c7d067
docs: use supabase pooler database urls
techwithanirudh Jun 13, 2026
fbee309
chore: clp
techwithanirudh Jun 13, 2026
a63f3d2
chore: idk
techwithanirudh Jun 13, 2026
55dd50c
chore: idk
techwithanirudh Jun 13, 2026
c98d998
fix: keep model fallback on ai sdk 7
techwithanirudh Jun 13, 2026
5518f3e
fix: patch ai-retry for ai sdk 7
techwithanirudh Jun 13, 2026
7611ee4
refactor: split e2b sandbox provider
techwithanirudh Jun 13, 2026
507a0b5
fix: normalize slack image parts
techwithanirudh Jun 13, 2026
c293428
fix: keep harness sandbox workspace alive
techwithanirudh Jun 14, 2026
1274d8a
refactor: simplify sandbox file upload paths
techwithanirudh Jun 14, 2026
bb98bf3
fix: observe sandbox harness result promises
techwithanirudh Jun 14, 2026
d7ce686
fix: write bot logs in development
techwithanirudh Jun 14, 2026
31f8899
chore: gut the codebase
techwithanirudh Jun 14, 2026
773d13c
docs: detail core mechanics in rewrite plan; expand agents config
techwithanirudh Jun 14, 2026
df36f25
chore: trim db + utils to core; clarify reference location
techwithanirudh Jun 14, 2026
4d03176
docs: mark plan as a reference map; add §13 references & docs
techwithanirudh Jun 14, 2026
39179b6
docs: correct resumeState/persistence + steering in plan (source-veri…
techwithanirudh Jun 14, 2026
d3c0e57
docs: log deferred in-phase decisions D8–D10 (e2b template, part-1 mo…
techwithanirudh Jun 14, 2026
dfe70c9
chore: scaffold phase 0 — @repo/ai + @repo/sandbox, part-1 env, deps
techwithanirudh Jun 14, 2026
7f812bc
feat(bot): phase 1 — vercel/chat slack platform layer (socket mode)
techwithanirudh Jun 14, 2026
324aee3
feat(sandbox): e2b HarnessV1SandboxProvider (phase 2a)
techwithanirudh Jun 14, 2026
ca61622
feat(ai): wire harness(pi) brain into the bot (phase 2b/2c)
techwithanirudh Jun 15, 2026
f32dd3a
feat(bot): live task UI + turn logging for harness replies
techwithanirudh Jun 15, 2026
97a8815
style: drop useless undefined in render-stream
techwithanirudh Jun 15, 2026
c630074
fix(bot): stream pi text as plain strings, not markdown_text chunks
techwithanirudh Jun 15, 2026
675e562
fix(ai): replace pi system prompt via .pi/SYSTEM.md; pause sandbox pe…
techwithanirudh Jun 15, 2026
05b69ae
chore: idk
techwithanirudh Jun 15, 2026
a67f99c
chore: idk anymore
techwithanirudh Jun 15, 2026
5829e60
chore: idk
techwithanirudh Jun 15, 2026
7c53f3a
feat(ai): host tools (slack/web/image), prompt split, concurrency
techwithanirudh Jun 15, 2026
15d3e97
feat(persistence): mirror pi transcript to postgres, survive sandbox …
techwithanirudh Jun 15, 2026
f72c64e
fix(bot): stop truncating reasoning cards at 280 chars
techwithanirudh Jun 15, 2026
a8e3bac
chore: slop
techwithanirudh Jun 15, 2026
7913e77
ok
techwithanirudh Jun 15, 2026
03d3dd1
refactor(ai): drop createTools wrapper, export tool factories directly
techwithanirudh Jun 16, 2026
c817f77
refactor(agent): steer by graceful abort + restart, drop harness patch
techwithanirudh Jun 16, 2026
422b5ec
chore: cleanup
techwithanirudh Jun 16, 2026
00aa276
chore: streamline codebase
techwithanirudh Jun 16, 2026
e4f6629
refactor: agents
techwithanirudh Jun 16, 2026
1eee372
refactor(ai): clean up session file helpers
techwithanirudh Jun 16, 2026
7f92ea3
chore: retries
techwithanirudh Jun 16, 2026
7de53e8
chore: clod pro ultra max
techwithanirudh Jun 16, 2026
03d412f
chore: cleanup code
techwithanirudh Jun 16, 2026
7560b8b
chore: cleanup code
techwithanirudh Jun 16, 2026
f3bc696
chore: clarify chat tool ids
techwithanirudh Jun 16, 2026
3bad74e
fix: remove broken openai pi fallback
techwithanirudh Jun 16, 2026
5fa18d2
fix: force openai pi fallback
techwithanirudh Jun 16, 2026
f870241
Revert "fix: force openai pi fallback"
techwithanirudh Jun 16, 2026
d3ba2f7
chore: cleanup sandbox
techwithanirudh Jun 16, 2026
5c0385d
chore: agentic slop
techwithanirudh Jun 16, 2026
a8c4e14
chore: more agentic slop
techwithanirudh Jun 16, 2026
4acf82d
chore: agi
techwithanirudh Jun 16, 2026
a483d6d
chore: tool viz
techwithanirudh Jun 17, 2026
b1f5618
feat: schedule reminder and mermaid
techwithanirudh Jun 17, 2026
99acadd
feat: tag
techwithanirudh Jun 17, 2026
4d49add
chore: improve startup logs
techwithanirudh Jun 17, 2026
8c6ac98
chore: cleanup
techwithanirudh Jun 17, 2026
506a082
fix: harden slack turn handling
techwithanirudh Jun 18, 2026
b62ed13
Revert "fix: harden slack turn handling"
techwithanirudh Jun 18, 2026
033b997
fix: handle slack thread summaries
techwithanirudh Jun 18, 2026
f1550de
fix: clean stale harness continuation state
techwithanirudh Jun 18, 2026
518e695
chore: refactor more code!!
techwithanirudh Jun 18, 2026
75217d4
chore: rewrite begins
techwithanirudh Jun 18, 2026
c862989
refactor: stuff
techwithanirudh Jun 18, 2026
755d73e
chore: cleanup
techwithanirudh Jun 18, 2026
54f81d4
chore: idk how many refactors we doing
techwithanirudh Jun 18, 2026
f5798d0
chore: nuke
techwithanirudh Jun 18, 2026
e7099c3
feat: docs
techwithanirudh Jun 19, 2026
7fbfa6c
chore: doc
techwithanirudh Jun 19, 2026
2144530
chore: cleanup
techwithanirudh Jun 19, 2026
4712430
refactor: sandbox skills
techwithanirudh Jun 19, 2026
e261b83
feat: enhance Slack integration with new tools and improved message h…
techwithanirudh Jun 19, 2026
e5ed6ea
refactor: simplify toolset by removing unused guardConversationRead f…
techwithanirudh Jun 19, 2026
b1925a3
refactor: update project configuration and dependencies, remove unuse…
techwithanirudh Jun 19, 2026
eec3bf7
chore: testing
techwithanirudh Jun 20, 2026
a86bd7d
refactor: lean on sdk abstractions, delete dead code, cut duplication
techwithanirudh Jun 20, 2026
9387693
feat: interrupt-style steering, skip tool, opt-in allowlist, fallback…
techwithanirudh Jun 20, 2026
90321b2
fix: show tool result errors in task output
techwithanirudh Jun 20, 2026
7c6c3eb
Merge branch 'codex/rewrite-from-scratch' of https://github.com/imdev…
techwithanirudh Jun 20, 2026
6a498a2
docs: replace docs app with markdown docs
techwithanirudh Jun 20, 2026
3b6b637
refactor: core documentation
techwithanirudh Jun 20, 2026
2844b77
refactor: docs
techwithanirudh Jun 20, 2026
f2f477f
chore: cleanup more stuff
techwithanirudh Jun 20, 2026
3079823
docs: use plain markdown components
techwithanirudh Jun 20, 2026
c487e50
refactor: clean up documentation and improve coding guidelines
techwithanirudh Jun 20, 2026
586b3b0
chore: we are launching a subagent armyyy
techwithanirudh Jun 21, 2026
5688931
refactor: replace raw Slack APIs with Chat SDK primitives
techwithanirudh Jun 21, 2026
045a3ef
docs: enhance access control documentation for opt-in channel feature
techwithanirudh Jun 21, 2026
5d9e7e2
refactor: remove unused getThread function and simplify channel ID re…
techwithanirudh Jun 21, 2026
0826068
refactor: narrow Slack search tool output
techwithanirudh Jun 21, 2026
aff5e58
fix: preserve harness resume continuations
techwithanirudh Jun 21, 2026
23b06c7
refactor: streamline Slack integration and enhance prompt handling
techwithanirudh Jun 21, 2026
2c8f854
feat: add optional AGENTMAIL_API_KEY and enhance sandbox provider env…
techwithanirudh Jun 21, 2026
c8fcd87
refactor: enhance response handling in defaultTool and improve modal …
techwithanirudh Jun 21, 2026
903563e
refactor: update postTurnControls to include fallback text and improv…
techwithanirudh Jun 21, 2026
df683fd
refactor: remove unused error handling logic and clean up sandbox que…
techwithanirudh Jun 21, 2026
97c2479
feat: implement getFile tool for downloading Slack files and update a…
techwithanirudh Jun 21, 2026
731456e
refactor: replace postEphemeral with addReaction in runTurn function
techwithanirudh Jun 21, 2026
bbc8548
refactor: update max post size and improve line-reply handling for Sl…
techwithanirudh Jun 21, 2026
40414c7
refactor: remove outdated tasks from REWRITE_TODO and streamline focu…
techwithanirudh Jun 21, 2026
0b4a3e0
refactor: add task to refactor error message rendering in REWRITE_TODO
techwithanirudh Jun 21, 2026
febd8fe
refactor: enhance bot message filtering to include Slackbot messages
techwithanirudh Jun 22, 2026
929ecf7
feat(thing): this is agi guys
techwithanirudh Jun 22, 2026
ebced7f
refactor: clarify channel ID comparison in member join event
techwithanirudh Jun 22, 2026
397b1f2
refactor: simplify bot message filtering logic in shouldIgnore function
techwithanirudh Jun 22, 2026
e9f3011
feat: add glossary for Gorkie domain language and agent behavior
techwithanirudh Jun 22, 2026
08012cc
refactor: expand glossary with new terms for agent behavior and context
techwithanirudh Jun 22, 2026
5f6cb3e
feat: add customizations feature for Slack bot
techwithanirudh Jun 22, 2026
46fe3e5
refactor: remove @repo/utils dependency and update error imports
techwithanirudh Jun 22, 2026
3b80c1c
refactor: remove normalizeMentions function and update message format…
techwithanirudh Jun 22, 2026
ef69c26
refactor: clarify user profile lookup in Slack prompts
techwithanirudh Jun 22, 2026
f178c5e
refactor: enhance user profile handling and message formatting in Sla…
techwithanirudh Jun 22, 2026
a7fcf3b
refactor: streamline Slack integration by
techwithanirudh Jun 22, 2026
44ed476
refactor: update user mention handling and improve allowlist logic in…
techwithanirudh Jun 23, 2026
7aee427
Merge main into codex/thermo-cleanup (supersede v1 with v2)
techwithanirudh Jun 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
204 changes: 204 additions & 0 deletions .agents/skills/chat-sdk/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
---
name: chat-sdk
description: Build multi-platform chat bots with Chat SDK (`chat` npm package). Use when developers want to build a Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, or WhatsApp bot, handle mentions, direct messages, subscribed threads, reactions, slash commands, cards, modals, files, or AI streaming, set up webhook routes or multi-adapter bots, send rich cards or streamed AI responses to chat platforms, or build a custom adapter or state adapter.
---

# Chat SDK

Unified TypeScript SDK for building chat bots across Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, and WhatsApp. Write bot logic once, deploy everywhere.

## Start with published sources

When Chat SDK is installed in a user project, inspect the published files that ship in `node_modules`:

```
node_modules/chat/docs/ # bundled docs
node_modules/chat/dist/index.d.ts # core API types
node_modules/chat/dist/adapters/index.d.ts # static adapter catalog types
node_modules/chat/dist/jsx-runtime.d.ts # JSX runtime types
node_modules/chat/docs/contributing/ # adapter-authoring docs
node_modules/chat/resources/guides/ # framework/platform guides (markdown)
node_modules/chat/resources/templates.json # starter templates (title, description, href)
```

If one of the paths below does not exist, that package is not installed in the project yet.

Read these before writing code:
- `node_modules/chat/docs/getting-started.mdx` — install and setup
- `node_modules/chat/docs/usage.mdx` — `Chat` config and lifecycle
- `node_modules/chat/docs/handling-events.mdx` — event routing and handlers
- `node_modules/chat/docs/threads-messages-channels.mdx` — thread/channel/message model
- `node_modules/chat/docs/posting-messages.mdx` — post, edit, delete, schedule
- `node_modules/chat/docs/streaming.mdx` — AI SDK integration and streaming semantics
- `node_modules/chat/docs/cards.mdx` — JSX cards
- `node_modules/chat/docs/actions.mdx` — button/select interactions
- `node_modules/chat/docs/modals.mdx` — modal submit/close flows
- `node_modules/chat/docs/slash-commands.mdx` — slash command routing
- `node_modules/chat/docs/direct-messages.mdx` — DM behavior and `openDM()`
- `node_modules/chat/docs/files.mdx` — attachments/uploads
- `node_modules/chat/docs/state-adapters.mdx` — persistence, locking, dedupe
- `node_modules/chat/docs/adapters.mdx` — cross-platform feature matrix
- `node_modules/chat/docs/api/chat.mdx` — exact `Chat` API
- `node_modules/chat/docs/api/thread.mdx` — exact `Thread` API
- `node_modules/chat/docs/api/message.mdx` — exact `Message` API
- `node_modules/chat/docs/api/modals.mdx` — modal element and event details

For the specific adapter or state package you are using, inspect that installed package's `dist/index.d.ts` export surface in `node_modules`.

## Adapter catalog subpath

Chat SDK exposes a zero-dependency static catalog at `chat/adapters`. Agents can import `ADAPTERS`, `ADAPTER_NAMES`, `getAdapter`, `isAdapterSlug`, `listEnvVars`, `getSecretEnvVars`, and metadata types like `CatalogAdapter` and `AdapterSlug` from this subpath without importing any adapter implementation package.

Use it for:
- Listing official and vendor-official adapter slugs, names, npm packages, groups, and platform vs state types.
- Building setup or onboarding flows that need package names, peer dependencies, and install guidance before any adapter is installed.
- Discovering required, optional, and credential-mode environment variables for an adapter, including which variables are secrets.
- Keeping vendor-official adapter docs and metadata aligned with the catalog when adding or updating a listed adapter.

## Available resources

<!-- RESOURCES:START -->

### Guides

- `node_modules/chat/resources/guides/how-to-build-an-ai-agent-for-slack-with-chat-sdk-and-ai-sdk.md` — Build a Slack AI agent using Chat SDK, AI SDK's ToolLoopAgent, and Vercel AI Gateway. Covers project setup, tool definitions, streaming responses, deployment to Vercel, and scaling tool selection with toolpick.
- `node_modules/chat/resources/guides/human-in-the-loop-with-chat-sdk-and-workflow-sdk.md` — Pause durable workflows on Slack approval cards using Chat SDK and Workflow SDK. Uses createWebhook to suspend workflows until a button click, with patterns for multi-stage approvals, timeouts via durable sleep, and approver validation.
- `node_modules/chat/resources/guides/liveblocks-chat-sdk-ai-sdk.md` — Build an AI agent that replies to @-mentions in Liveblocks comment threads with streamed responses and tool calling. Uses Chat SDK, the Liveblocks adapter, AI SDK's ToolLoopAgent, and Redis for thread subscriptions and distributed locking.
- `node_modules/chat/resources/guides/slack-bot-vercel-blob.md` — Build a Slack bot that lists, reads, uploads, and deletes files in Vercel Blob through tool calls. Uses Chat SDK, AI SDK's ToolLoopAgent, and Files SDK's createFileTools factory with approval-gated write tools and a read-only mode.
- `node_modules/chat/resources/guides/run-and-track-deploys-from-slack.md` — Build a Slack deploy bot with Chat SDK and Vercel Workflow. Dispatch GitHub Actions from a slash command, gate production behind approval, poll for completion, and notify Linear and GitHub when the run finishes.
- `node_modules/chat/resources/guides/triage-form-submissions-with-chat-sdk.md` — Build a Slack bot that triages form submissions with interactive cards. Forward, edit, or mark as spam without leaving Slack. Built with Chat SDK, Hono, and Resend.
- `node_modules/chat/resources/guides/how-to-build-a-slack-bot-with-next-js-and-redis.md` — This guide walks through building a Slack bot with Next.js, covering project setup, Slack app configuration, event handling, interactive features, and deployment.
- `node_modules/chat/resources/guides/create-a-discord-support-bot-with-nuxt-and-redis.md` — This guide walks through building a Discord support bot with Nuxt, covering project setup, Discord app configuration, Gateway forwarding, AI-powered responses, and deployment.
- `node_modules/chat/resources/guides/ship-a-github-code-review-bot-with-hono-and-redis.md` — This guide walks through building a GitHub bot that reviews pull requests on demand. When a user @mentions the bot on a PR, Chat SDK picks up the mention, spins up a Vercel Sandbox with the repo cloned, and uses AI SDK to analyze the diff.

### Templates

Listed in `node_modules/chat/resources/templates.json`:

- **Chat SDK Liveblocks Bot** — Build a bot that you can engage with inside Liveblocks. (https://vercel.com/templates/next.js/chat-sdk-liveblocks-bot)
- **Durable iMessage Agent** — Durable iMessage agent powered by the Sendblue adapter. (https://vercel.com/templates/nitro/durable-imessage-ai-agent)
- **Knowledge Agent** — Open source file-system and knowledge based agent template. Build AI agents that stay up to date with your knowledge base. (https://vercel.com/templates/nuxt/chat-sdk-knowledge-agent)
- **Community Agent** — Open source AI-powered Slack community management bot with a built-in Next.js admin panel. Uses Chat SDK, AI SDK, and Vercel Workflow. (https://vercel.com/templates/next.js/chat-sdk-community-agent)

<!-- RESOURCES:END -->

## Quick start

```typescript
import { Chat } from "chat";
import { createSlackAdapter } from "@chat-adapter/slack";
import { createRedisState } from "@chat-adapter/state-redis";

const bot = new Chat({
userName: "mybot",
adapters: {
slack: createSlackAdapter(),
},
state: createRedisState(),
dedupeTtlMs: 600_000,
});

bot.onNewMention(async (thread) => {
await thread.subscribe();
await thread.post("Hello! I'm listening to this thread.");
});

bot.onSubscribedMessage(async (thread, message) => {
await thread.post(`You said: ${message.text}`);
});
```

## Core concepts

- **Chat** — main entry point; coordinates adapters, routing, locks, and state
- **Adapters** — platform-specific integrations for Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, and WhatsApp
- **State adapters** — persistence for subscriptions, locks, dedupe, and thread state
- **Thread** — conversation context with `post()`, `stream()`, `subscribe()`, `setState()`, `startTyping()`
- **Message** — normalized content with `text`, `formatted`, attachments, author info, and platform `raw`
- **Channel** — container for threads and top-level posts

## Event handlers

| Handler | Trigger |
|---------|---------|
| `onNewMention` | Bot @-mentioned in an unsubscribed thread |
| `onDirectMessage` | New DM in an unsubscribed DM thread |
| `onSubscribedMessage` | Any message in a subscribed thread |
| `onNewMessage(regex)` | Regex match in an unsubscribed thread |
| `onReaction(emojis?)` | Emoji added or removed |
| `onAction(actionIds?)` | Button clicks and select/radio interactions |
| `onModalSubmit(callbackId?)` | Modal form submitted |
| `onModalClose(callbackId?)` | Modal dismissed/cancelled |
| `onSlashCommand(commands?)` | Slash command invocation |
| `onAssistantThreadStarted` | Slack assistant thread opened |
| `onAssistantContextChanged` | Slack assistant context changed |
| `onAppHomeOpened` | Slack App Home opened |
| `onMemberJoinedChannel` | Slack member joined channel event |

Read `node_modules/chat/docs/handling-events.mdx`, `node_modules/chat/docs/actions.mdx`, `node_modules/chat/docs/modals.mdx`, and `node_modules/chat/docs/slash-commands.mdx` before wiring handlers. `onDirectMessage` behavior is documented in `node_modules/chat/docs/direct-messages.mdx`.

## Streaming

Pass any `AsyncIterable<string>` to `thread.post()`. For AI SDK, prefer `result.fullStream` over `result.textStream` when available so step boundaries are preserved.

```typescript
import { ToolLoopAgent } from "ai";

const agent = new ToolLoopAgent({ model: "anthropic/claude-4.5-sonnet" });

bot.onNewMention(async (thread, message) => {
const result = await agent.stream({ prompt: message.text });
await thread.post(result.fullStream);
});
```

Key details:
- `streamingUpdateIntervalMs` controls post+edit fallback cadence
- `fallbackStreamingPlaceholderText` defaults to `"..."`; set `null` to disable
- Structured `StreamChunk` support is Slack-only; other adapters ignore non-text chunks

## Cards and modals (JSX)

Set `jsxImportSource: "chat"` in `tsconfig.json`.

Card components:
- `Card`, `CardText`, `Section`, `Fields`, `Field`, `Button`, `CardLink`, `LinkButton`, `Actions`, `Select`, `SelectOption`, `RadioSelect`, `Table`, `Image`, `Divider`

Modal components:
- `Modal`, `TextInput`, `Select`, `SelectOption`, `RadioSelect`

`Button` and `Modal` accept a `callbackUrl` prop — when triggered, the SDK POSTs the action payload to that URL in addition to firing any `onAction` / `onModalSubmit` handler. Use this for webhook-based workflow flows. See `node_modules/chat/docs/actions.mdx` and `node_modules/chat/docs/modals.mdx`.

```tsx
await thread.post(
<Card title="Order #1234">
<CardText>Your order has been received.</CardText>
<Actions>
<Button id="approve" style="primary">Approve</Button>
<Button id="reject" style="danger">Reject</Button>
</Actions>
</Card>
);
```

## Adapter inventory

See [chat-sdk.dev/adapters](https://chat-sdk.dev/adapters) for the current list of official, vendor-official, and community adapters, including package names and authors. For the exact factory function and config types of an installed adapter, inspect its `dist/index.d.ts` in `node_modules`.

## Building a custom adapter

Read these published docs first:
- `node_modules/chat/docs/contributing/building.mdx`
- `node_modules/chat/docs/contributing/testing.mdx`
- `node_modules/chat/docs/contributing/publishing.mdx`

Also inspect:
- `node_modules/chat/dist/index.d.ts` — `Adapter` and related interfaces
- `node_modules/@chat-adapter/shared/dist/index.d.ts` — shared errors and utilities
- Installed official adapter `dist/index.d.ts` files — reference implementations for config and APIs

A custom adapter needs request verification, webhook parsing, message/thread/channel operations, ID encoding/decoding, and a format converter. Use `BaseFormatConverter` from `chat` and shared utilities from `@chat-adapter/shared`.

## Webhook setup

Each registered adapter exposes `bot.webhooks.<name>`. Wire those directly to your HTTP framework routes. See `node_modules/chat/resources/guides/how-to-build-a-slack-bot-with-next-js-and-redis.md` and `node_modules/chat/resources/guides/create-a-discord-support-bot-with-nuxt-and-redis.md` for framework-specific route patterns.
106 changes: 106 additions & 0 deletions .agents/skills/coding-best-practices/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
name: coding-best-practices
description: >
Code quality rules for the Gorkie Slack bot. Use when reviewing files for
violations, auditing PRs, or deciding how to structure new code. Covers
TypeScript patterns, Slack modal conventions, and architecture rules specific
to this repo.
---

## How to use this skill

Read the rules below, then read the target files and report every violation with:
- File path and line numbers
- Which rule is violated
- Concrete suggested fix

Only report real issues. If a file is clean, say so in one line.

---

## Rules

### 1. Minimal interfaces
Accept only what the callee uses. When an SDK type carries more than needed, export a smaller internal type and convert at the boundary.

```ts
// bad — callee must fabricate fake SDK objects
toolsModal({ tools: ListToolsResult['tools'] })

// good
export type ToolEntry = { name: string; group: GroupSlug };
toolsModal({ tools: ToolEntry[] })
```

### 2. No fabricated data
Never construct fake objects (empty descriptions, synthetic annotations, placeholder schemas) to satisfy a type. The type is wrong — narrow it.

### 3. Export shared type discriminants
When multiple files check the same string literals (`'ro' | 'dt' | 'gn'`, `'allow' | 'ask' | 'block'`), export a named union from one canonical location. Never re-validate the same literals with inline comparisons across files.

### 4. No large inline closures
Async closures longer than ~20 lines inside object literals belong in named functions at module scope with explicit parameter types.

```ts
// bad
tools[name] = { execute: async (input, opts) => { /* 100 lines */ } }

// good
tools[name] = { execute: wrapMCPToolExecute({ ctxId, server, stream, ... }) }
```

### 5. Nested metadata over flat parallel fields
Fields that always move together should be nested.

```ts
// bad
{ serverId: server.id, serverName: server.name, toolName }

// good
{ server: { id: server.id, name: server.name }, tool: { name: toolName } }
```

### 6. Slack private_metadata: minimal and Zod-parsed
Only persist what cannot be re-derived from view state or a DB lookup. Always parse with Zod — never cast with `as`.

```ts
// bad
const meta = JSON.parse(view.private_metadata || '{}') as SomeMeta;

// good
const meta = someMetaSchema.parse(JSON.parse(view.private_metadata || '{}'));
```

### 7. Don't scrape view state to reconstruct stored data
If a handler reads `body.view.state.values` for every element just to rebuild a structure for re-rendering, that structure should have been in `private_metadata`. Only scrape view state for values the user actively changed in this action.

### 8. Always pass `hash` on mid-session `views.update`
`block_actions` handlers must pass `hash: view.hash` to `client.views.update`. This prevents overwriting a view that a concurrent action already updated.

### 9. Dict params
Functions with more than one parameter take a single options object.

```ts
// bad
logReply(ctxId, author, result, reason);
// good
logReply({ ctxId, author, result, reason });
```

### 10. Inline over extract (single-use)
Only extract to a named function when called in multiple places or genuinely complex. A helper called once is worse than the inline code.

### 11. No type casts
Prefer schema parsing or narrower signatures over `as`. A cast is acceptable only at a real validated external boundary.

### 12. Config for tuneable values
Magic numbers and strings that could change per deployment belong in `apps/bot/src/config.ts`.

---

## Also check

- Missing `await` on promises (fire-and-forget is only acceptable for intentional background work)
- Empty or swallowed `catch` blocks
- Ownership checks before DB mutations (user should only affect their own resources)
- `views.update` without `hash` in action handlers (race condition)
47 changes: 47 additions & 0 deletions .agents/skills/grill-with-docs/ADR-FORMAT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# ADR Format

ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.

Create the `docs/adr/` directory lazily — only when the first ADR is needed.

## Template

```md
# {Short title of the decision}

{1-3 sentences: what's the context, what did we decide, and why.}
```

That's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why* — not in filling out sections.

## Optional sections

Only include these when they add genuine value. Most ADRs won't need them.

- **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`) — useful when decisions are revisited
- **Considered Options** — only when the rejected alternatives are worth remembering
- **Consequences** — only when non-obvious downstream effects need to be called out

## Numbering

Scan `docs/adr/` for the highest existing number and increment by one.

## When to offer an ADR

All three of these must be true:

1. **Hard to reverse** — the cost of changing your mind later is meaningful
2. **Surprising without context** — a future reader will look at the code and wonder "why on earth did they do it this way?"
3. **The result of a real trade-off** — there were genuine alternatives and you picked one for specific reasons

If a decision is easy to reverse, skip it — you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."

### What qualifies

- **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
- **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
- **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library — just the ones that would take a quarter to swap out.
- **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
- **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
- **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
- **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it — otherwise someone will suggest GraphQL again in six months.
Loading
Loading