agentleFS
VercelKnown publishervercel/chat/AGENTS.md

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

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 1 mentionMar 2026: 4 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the vercel/chat repository that our weekly crawl found: only 5 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

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
  1. Very specific:

    When editing a specific package, read its AGENTS.md if present (most adapters, state packages, create-chat-sdk, and …

    line 44
  2. Very specific:

    Run pnpm konsistent after changing public exports.

    line 77
  3. Very specific:

    Always use the technical-writer skill (.agents/skills/technical-writer/SKILL.md) when you write or edit prose for this repo, including docs …

    line 91

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 locally

Install 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.

PathRole
packages/chatCore 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-sharedShared adapter utilities
packages/state-*State adapters (memory, redis, ioredis, pg)
packages/create-chat-sdkcreate-chat-sdk CLI scaffold
packages/tests@chat-adapter/tests — Vitest factories/matchers for adapter tests
packages/integration-testsReplay + emulator tests; needs credentials for live API tests
apps/docsfumadocs 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

  1. Chat (packages/chat/src/chat.ts) — coordinates adapters and handlers.
  2. Adapter — webhook verification, parsing, and a FormatConverter for markdown ↔ platform format.
  3. StateAdapter — subscriptions, distributed locks, key/value cache, lists, queues.
  4. Thread — conversation handle: post(), subscribe(), startTyping(), setState(), etc.
  5. 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

  1. Platform → /api/webhooks/{platform}
  2. Adapter verifies and parses; calls chat.handleIncomingMessage()
  3. Chat acquires a thread lock, then routes to onSubscribedMessage, onNewMention, or onNewMessage
  4. Handler receives Thread and Message

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 konsistent after changing public exports; conventions are documented in .github/CONTRIBUTING.md.
  • sample-messages.md in 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 for gchat → GoogleChat etc.).

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-writer skill (.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, and examples/* 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.