Adding a Feature
The rules that keep a new Teak feature consistent across the API, MCP, SDK, CLI, search, deletion and deploys
Read this before adding a field, a table, an index, an API operation or a background step. Architecture and the generated Convex guidelines (packages/convex/_generated/ai/guidelines.md) apply on top of it.

One feature, every surface
A feature in the public API ships on MCP, the SDK and the CLI in the same pull request, in this order:
- Internal function in
packages/convex/publicApi*.ts. - The operation in
PUBLIC_API_OPERATIONS(packages/convex/shared/publicApiContract.ts): itsoperationId, method, path and whether it reads a JSON body. The Convex routes,GET /v1, the 404 and 405 answers and the OpenAPI paths come from it. - Its handler in
publicApi/http/*.ts, added toHANDLERSinpublicApi/http/router.ts. The router has already checked the credential and parsed the body; TypeScript fails until every operation has a handler. - Its OpenAPI description in
publicApi/openApi/, keyed byoperationId; TypeScript fails until every operation has one. - The tool in
mcp/catalog.ts: its Zod arguments (the JSON Schema clients see is generated from them), the operation it calls and its summary. - The method in
packages/sdk/src/index.ts, which calls the operation byoperationId. - The command in
apps/cli/src/index.tsandlibrary.ts. - The row in
scripts/repo/public-parity.ts: the Raycast AI tool that uses the operation, or the reason a surface leaves it out. The MCP column is read from the catalog, and the SDK and CLI columns from the operations each SDK member and CLI command declares (packages/sdk/src/operations.ts,apps/cli/src/operations.ts).
Enum values, limits and error codes the surfaces share live in publicApiContract.ts too, and the SDK, CLI, Raycast and MCP App read them from there. scripts/repo/public-parity.test.ts calls every MCP tool and SDK method, walks the CLI command tree and checks the card list parameters (CARD_LIST_PARAMS) on the API, MCP, SDK and CLI, so a missed step fails the root bun run test. A new error code goes in PUBLIC_API_ERROR_CODES; the SDK’s ERROR_CODES include it.
Update the API, MCP, SDK and CLI docs with it (Docs maps each source to its page).
Convex data
- Every card write goes through
insertCardorpatchCard(card/cardWrites.ts). They set the fields derived from the rest of the card (urlHost,urlKey,isHidden,aiPending, incard/derivedFields.ts),savedAtandshuffleKey, keep the free plan’s count, and run the change hook (card/onCardChanged.ts) that keeps search, tag, folder, link and embedding rows in step. A new field the hook reads goes in itsCARD_CHANGE_FIELDS. - A new boolean flag is
v.optional(v.literal(true)), nevertrue | false, sofalseand missing can’t disagree in an index. - Stay backward compatible: new arguments are optional, and every client tolerates enum values it doesn’t know, because the native apps update on their own schedule. Code kept only for old clients or old data gets an entry in
.agents/records/sunset.mdsaying when it can go. - A new user table, per-card row or R2 key is removed by account deletion: list every table with a user key in
accountDeletion/tables.ts, as swept byancillaryPage, deleted by another step, or kept with the reason (__tests__/accountDeletion/tables.test.tsfails otherwise); per-card rows go inaccountDeletion.tsdeleteAccountDataHandler. It is also removed by card hard delete (card/deleteCard.ts,card/trashCleanup.ts) and bycardStorageObjectKeys(storage/cardObjectKeys.ts). Seed it in the “complete stages” test inedge/accountDeletion/workflowRun.test.ts, which runs the Core Worker’s account deletion workflow against the test database. - Card processing runs in the Core Worker (
apps/core-worker/src/workflows/cardProcessing/run.ts). Add new steps after the existing ones and never rename one (Rules every change keeps). Every Convex write a step makes passes the run’sguard: { cardId, rev }, and every function it calls is listed inpackages/convex/workflows/rpcAllowlist.ts(__tests__/workflows/rpcAllowlist.test.tschecks the list against the Worker’sinternal.*calls). Calls Convex bills one by one, so a step reads the card and marks its stage in one call (loadAndMark) and puts writes that go together in oneconvex.batch;run.test.tskeeps a budget of calls per card type. - Analytics events go in
shared/analytics.tsfirst, with low-cardinality properties and never card content, URLs, file names, prompts or outputs. - Values that are the same in every deployment are typed code with an optional environment override, not new configuration (see
scripts/release/build-metadata.ts).
Indexes and reads
- Add a new index beside the one it replaces, move every reader to it, and drop the old one in a separate pull request once the new code has run in production for a day.
- When a scan budget bounds a read, count every row the read touches. A
.filter()on the query skips rows the loop never sees, so the budget stops capping the work. Check the field in the loop after charging the budget. - Paginated public reads pass
maximumRowsReadso a sparse filter can’t read without limit.
Backfills
A backfill is a self-scheduling, paged internal mutation in packages/convex/migration/ built on runBackfillPage (migration/runner.ts), whose dryRun defaults to true (see backfillUrlHost.ts): the backfill names its table and what it does with one page, and the runner pages, adds up the counts and logs them at the end. Every migration or backfill needs the owner’s explicit approval, and production runs are the owner’s. Run the dry run, read its counts, then run the pages. Once the production run finishes, delete the backfill and its tests in the next pull request.
Deploys
- Core Worker changes deploy before the Convex and web changes that use them.
Backend Deploydeploys Convex whenmainchanges a backend path, after it waits for a compatible Core Worker. Vercel deploys the web app and the docs frommain.
Plans and limits
Every feature is free on every plan. The free plan’s 200-card cap is the only limit; saving past it returns 400 CARD_LIMIT_REACHED.
UI
Use the shadcn new-york primitives in apps/web/src/components/ui and Vadivam icons from vadivam-react. Vadivam keeps Lucide’s icon names, so when the shadcn CLI adds a component with lucide-react imports, switch them to vadivam-react. One primary action per surface; secondary actions go in menus. Use skeletons for loading lists, sentence-case copy, and undo toasts for destructive or bulk actions. Check every state (empty, loading, one item, many, very long names, error) in light and dark at 390, 768 and 1440 px.
Text people read in the web app and browser extension comes from the message catalogs, in every language in the same pull request (Translating).
Docs
A feature people can use updates its page in these docs and, once it ships, its month’s changelog entry, in the same pull request as the change:
| When you change | Update |
|---|---|
The public API (packages/convex/http.ts, shared/publicApiContract.ts, publicApi/http/*.ts, publicApi/openApi/*.ts) |
content/docs/(developers)/api.mdx |
MCP (packages/convex/mcp) |
content/docs/(developers)/mcp.mdx |
The SDK (packages/sdk/src) |
content/docs/(developers)/sdk.mdx |
| The Apple app | content/docs/(apps)/mac.mdx and content/docs/(apps)/mobile.mdx |
The Android app (apps/android) |
content/docs/(apps)/android.mdx |
| Raycast commands or sign-in | content/docs/(apps)/raycast.mdx |
The CLI (apps/cli) |
content/docs/(apps)/cli.mdx |
Public skills (.agents/skills/teak) |
content/docs/(developers)/ai-agents.mdx and pages/apps.astro |
| How Teak is built, run, tested, translated or deployed | The page in this Open Source group that covers it |
Paths are relative to apps/docs. Write the Open Source pages for contributors and self-hosters; put notes only agents need inside <Visibility for="agents">, which keeps them off the website but in the .md mirrors and llms.txt. Teak’s own deployments, credentials and runbooks stay in .agents.
Describe the product as it is now. Don’t write how something used to work, what changed, or steps for data from before a change; that belongs in the changelog or the pull request. Give each fact one home and link to it from other pages.
- Changelog: one file per month with notable shipped changes,
content/changelog/<month>-<yyyy>.mdx, withdateset to the latest included ship date. Write for Teak users: lead with the outcome in plain words, group related changes under short headings, and for a breaking change say who is affected and what to do. Leave out code, field and endpoint names unless developers need them, and leave out marketing pages, refactors, tests, CI, schemas, migrations, backfills, dependencies and release mechanics. - Images: every docs page shows at least one image, and every image comes from
scripts/docs-assets(its README has the steps): add a shot toscripts/docs-assets/shots.ts, render it, and use its alt text.scripts/docs-assets/shots.test.tsfails on a page without an image or a drifted one, and names the exceptions. - Blog posts live in
content/blog(type: blog,mode: center, adateandauthors) and open with a cover shot named after the post’s file. - Evals:
apps/docs/evals.yamlholds questions Teak users and their agents ask;bun run evalinapps/docsanswers each from these docs alone and a judge checks the expected facts. Keep every fact true to the shipped product, and never weaken one to pass.