chat
AGENTS.md2.4k starsChanged 59 days agoMITView on GitHub
Guidance for coding agents working in this repository. For PR workflow, signed commits, and changeset rules, see .github/CONTRIBUTING.md. Install dependencies with pnpm add, not by editing package.json by hand. pnpm + Turborepo monorepo. Packages are ESM ("type": "module"), TypeScript, bundled with tsup. When editing a specific package, read its AGENTS.md if present (most adapters, state packages, create-chat-sdk, and packages/chat/src/adapters/ have one). {adapter}:{channel}:{thread} — e.g. slack:C123ABC:1234567890.123456. Some adapters base64-encode IDs that contain delimiters (Teams, Google Chat). mdast is the canonical message…
- Installs packages
Trending
Quiet since March.thin dataabout the whole repository
Who's talking about vercel/chat
- @camilleroux.com“Un SDK TypeScript unifié pour créer des chatbots qui fonctionnent sur Slack, Teams, Google Chat, Discord, …”Bluesky · Mar 3, 2026 · 3 likes
- @technews4869.bsky.social“github.com/vercel/chat GitHub - vercel/chat: A unified TypeScript SDK for building chat bots across Slack, …”Bluesky · Mar 7, 2026 · 1 likes
- @yug1224.com“チャットアプリ開発に使える統一SDKを提供するツールらしい 様々なプラットフォーム対応で便利そうだな yug1224 starred vercel/chat https://github.com/vercel/chat”Bluesky · Mar 7, 2026 · 1 likes
- @news.humancoders.com“Vercel lance Chat SDK : un SDK TypeScript unifié pour créer des bots multi-plateformes”Bluesky · Mar 5, 2026 · 1 likes
- @github-trending-js.bsky.social“🔥 Hot Repo! 🔥 (100+ new stars) 📦 vercel / chat ⭐ 871 (+121) 🗒 TypeScript A unified TypeScript SDK for …”Bluesky · Feb 27, 2026 · 1 likes
The biggest 5 of 5 mentions linking to the repository that our crawl found. Each line is their own headline.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository44 other files it gives its agents.
- apps/docs/AGENTS.mdAGENTS.md
- chat-sdkAGENTS.md
- packages/adapter-discord/AGENTS.mdAGENTS.md
- packages/adapter-gchat/AGENTS.mdAGENTS.md
- packages/adapter-github/AGENTS.mdAGENTS.md
- packages/adapter-instagram/AGENTS.mdAGENTS.md
- packages/adapter-linear/AGENTS.mdAGENTS.md
- packages/adapter-messenger/AGENTS.mdAGENTS.md
- packages/adapter-notion/AGENTS.mdAGENTS.md
- packages/adapter-slack/AGENTS.mdAGENTS.md
- packages/adapter-teams/AGENTS.mdAGENTS.md
- packages/adapter-telegram/AGENTS.mdAGENTS.md
- packages/adapter-web/AGENTS.mdAGENTS.md
- packages/adapter-whatsapp/AGENTS.mdAGENTS.md
- packages/chat/src/adapters/AGENTS.mdAGENTS.md
- packages/create-chat-sdk/AGENTS.mdAGENTS.md
- packages/create-chat-sdk/_template/AGENTS.mdAGENTS.md
- packages/state-ioredis/AGENTS.mdAGENTS.md
- packages/state-memory/AGENTS.mdAGENTS.md
- packages/state-pg/AGENTS.mdAGENTS.md
- packages/state-redis/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- packages/adapter-discord/CLAUDE.mdCLAUDE.md
- packages/adapter-gchat/CLAUDE.mdCLAUDE.md
- packages/adapter-github/CLAUDE.mdCLAUDE.md
- packages/adapter-linear/CLAUDE.mdCLAUDE.md
- packages/adapter-messenger/CLAUDE.mdCLAUDE.md
- packages/adapter-slack/CLAUDE.mdCLAUDE.md
- packages/adapter-teams/CLAUDE.mdCLAUDE.md
- packages/adapter-telegram/CLAUDE.mdCLAUDE.md
- packages/adapter-web/CLAUDE.mdCLAUDE.md
- packages/adapter-whatsapp/CLAUDE.mdCLAUDE.md
- packages/create-chat-sdk/CLAUDE.mdCLAUDE.md
- packages/create-chat-sdk/_template/CLAUDE.mdCLAUDE.md
- packages/state-ioredis/CLAUDE.mdCLAUDE.md
- packages/state-memory/CLAUDE.mdCLAUDE.md
- packages/state-pg/CLAUDE.mdCLAUDE.md
- packages/state-redis/CLAUDE.mdCLAUDE.md
- add-adapterSkill
- technical-writerSkill
- chat-sdkSkill
- chat-sdkSkill
- chat-sdkSkill
- chat-sdkSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
When editing a specific package, read its AGENTS.md if present (most adapters, state packages, create-chat-sdk, and …
- Very specific: line 77
Run pnpm konsistent after changing public exports.
- Very specific: line 91
Always use the technical-writer skill (.agents/skills/technical-writer/SKILL.md) when you write or edit prose for this repo, including docs …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Guidance for coding agents working in this repository. For PR workflow, signed commits, and changeset rules, see .github/CONTRIBUTING.md.
Commands
pnpm install
pnpm validate # knip + check + typecheck + test + build — run before declaring work done
pnpm check # lint/format (Ultracite/Biome)
pnpm fix # auto-fix lint/format issues
pnpm typecheck
pnpm test # all package tests via Turborepo (includes integration-tests)
pnpm test:workspace # single Vitest run across unit-test packages only
pnpm build
pnpm dev # watch mode
pnpm knip # unused exports/dependencies
pnpm konsistent # adapter/state package shape (see .github/konsistent.json)
# Per-package
pnpm --filter chat test
pnpm --filter @chat-adapter/slack build
pnpm --filter docs dev # preview chat-sdk.dev locallyInstall dependencies with pnpm add, not by editing package.json by hand.
Monorepo layout
pnpm + Turborepo monorepo. Packages are ESM ("type": "module"), TypeScript, bundled with tsup.
| Path | Role |
packages/chat | Core SDK (chat): Chat, types, mdast markdown, chat/adapters catalog |
packages/adapter-* | Platform adapters (slack, teams, gchat, discord, telegram, whatsapp, github, linear, web, messenger, twilio, …) |
packages/adapter-shared | Shared adapter utilities |
packages/state-* | State adapters (memory, redis, ioredis, pg) |
packages/create-chat-sdk | create-chat-sdk CLI scaffold |
packages/tests | @chat-adapter/tests — Vitest factories/matchers for adapter tests |
packages/integration-tests | Replay + emulator tests; needs credentials for live API tests |
apps/docs | fumadocs site (chat-sdk.dev) |
examples/* | Example bots; package.json name must be example-* (private, no changeset) |
When editing a specific package, read its AGENTS.md if present (most adapters, state packages, create-chat-sdk, and packages/chat/src/adapters/ have one).
Architecture
Core concepts
- Chat (
packages/chat/src/chat.ts) — coordinates adapters and handlers. - Adapter — webhook verification, parsing, and a
FormatConverterfor markdown ↔ platform format. - StateAdapter — subscriptions, distributed locks, key/value cache, lists, queues.
- Thread — conversation handle:
post(),subscribe(),startTyping(),setState(), etc. - Message — normalized message:
text,formatted(mdast AST),raw(platform-specific).
Thread IDs
{adapter}:{channel}:{thread} — e.g. slack:C123ABC:1234567890.123456. Some adapters base64-encode IDs that contain delimiters (Teams, Google Chat).
Webhook flow
- Platform →
/api/webhooks/{platform} - Adapter verifies and parses; calls
chat.handleIncomingMessage() Chatacquires a thread lock, then routes toonSubscribedMessage,onNewMention, oronNewMessage- Handler receives
ThreadandMessage
Formatting
mdast is the canonical message format. Each adapter's FormatConverter implements toAst, fromAst, and renderPostable.
Adapter catalog
packages/chat/src/adapters/index.ts powers the zero-dependency chat/adapters subpath. See packages/chat/src/adapters/AGENTS.md when adding or changing catalog entries — keep it in sync with apps/docs/adapters.json.
Working on adapters and state packages
- Run
pnpm konsistentafter changing public exports; conventions are documented in .github/CONTRIBUTING.md. sample-messages.mdin adapter packages holds real webhook payloads — extend it when fixing parsers or adding event support.- Adapter factory/config naming:
create${Name}Adapter,${Name}Adapter,${Name}AdapterConfig(see konsistent config forgchat→GoogleChatetc.).
Testing
packages/chat/src/mock-adapter.ts:
createMockAdapter(name),createMockState(),createTestMessage(),mockLogger
For production-traffic replay tests, see packages/integration-tests/fixtures/replay/README.md. Recordings export via pnpm recording:list / pnpm recording:export <session-id> from examples/nextjs-chat.
Docs and releases
- Always use the
technical-writerskill (.agents/skills/technical-writer/SKILL.md) when you write or edit prose for this repo, including docs pages, READMEs, changesets, commit messages, PR descriptions, and issues. - User-facing docs:
apps/docs/content/→ chat-sdk.dev/docs. Update relevant pages when behavior, public APIs, or env vars change. - Behavioral package changes need a changeset (
pnpm changeset). Docs-only, tests-only, CI, andexamples/*changes do not.
Code style
Ultracite (Biome) via pnpm check / pnpm fix. Most issues auto-fix.
Beyond Biome: prefer unknown over any; top-level regex literals; for...of over .forEach; always await returned promises; no console.log / debugger in shipped code; throw descriptive Error objects. React (docs/examples): function components, stable keys, semantic HTML/ARIA.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

