sanity-copilot-eve-template
AGENTS.md5 starsChanged 22 days agoMITView on GitHub
Guidance for AI coding agents working in this repository. A Slack-based Sanity copilot built on the eve agent framework. Users @mention it in Slack; it manages their Sanity project through the Sanity MCP connection (GROQ queries, schemas, drafts, releases), pulls source material from and drafts into Notion (user-scoped OAuth via Vercel Connect), and stores files in Vercel Blob. Its workflow lives in agent/instructions.md. The whole agent is defined under agent/. eve discovers capabilities from the filesystem. See ARCHITECTURE.md for the…
- Reads credentials
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 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 repository9 other files it gives its agents.
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 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.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
After editing, check LSP diagnostics / pnpm typecheck and fix type errors before moving on.
- Very specific: line 42
Document exported config with TSDoc (@remarks, @param, @returns, @defaultValue, @see).
- Very specific: line 50
If you ever build a RegExp from data, escape it (literal match) and bound the input length.
- Very specific: line 58
No secrets, node_modules, or build output (.eve, .vercel, .output) staged.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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 AI coding agents working in this repository.
Project overview
A Slack-based Sanity copilot built on the eve agent framework. Users @mention it in Slack; it manages their Sanity project through the Sanity MCP connection (GROQ queries, schemas, drafts, releases), pulls source material from and drafts into Notion (user-scoped OAuth via Vercel Connect), and stores files in Vercel Blob. Its workflow lives in agent/instructions.md.
The whole agent is defined under agent/. eve discovers capabilities from the filesystem. See ARCHITECTURE.md for the component map, data flow, and boundaries.
Setup & commands
pnpm install # install dependencies (Node 24.x)
pnpm dev # eve dev — local TUI; run /login once to connect a model provider
pnpm typecheck # tsc (TypeScript, no emit)
pnpm check # ultracite (Biome) lint + format check
pnpm fix # ultracite (Biome) auto-fix
pnpm build # eve build
eve deploy # deploy to Vercel production (use this, not raw `vercel deploy`)
npx eve info # print the discovered surface + discovery diagnostics
pnpm validate # check + typecheck + eve info in one commandThere is no unit-test suite. Verify changes with pnpm validate (lint, typecheck, and discovery diagnostics must all report 0 errors / 0 warnings), then exercise the agent in the pnpm dev TUI.
eve conventions
- Read the relevant guide in
node_modules/eve/docs/before writing code. Don't invent framework APIs; confirm them against the docs. - Identity comes from the filesystem, never a
namefield. A tool atagent/tools/upload_asset.tsis the toolupload_asset; a connection atagent/connections/sanity.tsregisters assanity. - Authored slots:
agent/agent.ts(model),agent/instructions.md(system prompt),agent/tools/*.ts(defineTool, ordefineWorkflowToolfor durable/delegating tools),agent/connections/*.ts,agent/channels/*.ts,agent/skills/<name>/SKILL.md,agent/subagents/<id>/agent.ts(defineAgent),agent/sandbox.ts. This repo also hasagent/subagents/<id>/skills/andagent/subagents/reviewer/sandbox.ts: subagent sandboxes don't inherit from the root, and the reviewer needs one to read its skill's reference files. - Tools run in the app runtime (full
process.env), one default export per file. Gate destructive tools withapprovalfromeve/tools/approval. Connections accept the sameapprovalfield: bothsanity.tsandnotion.tspass a policy that substring-matches the qualified tool name against anAPPROVAL_REQUIRED_TOOLSlist. Sanity gatespatch_documents,publish_documents,unpublish_documents,discard_drafts,version_discard,update_dataset,deploy_schema, anddeploy_studio; Notion gatesupdate-pages,move-pages,update-data-source, andupdate-view(creation is ungated). - Skills are load-on-demand. A packaged skill (
<name>/SKILL.md) requiresdescriptionfrontmatter; that description is the routing hint. Skills here:sanity-best-practices,content-modeling-best-practices,portable-text-conversion,portable-text-serialization,seo-aeo-best-practices,content-experimentation-best-practices, andwriting-quality. - Subagents are declared under
agent/subagents/<id>/agent.ts(defineAgent, requireddescription). The directory name is the identity (no namespace; it must not collide with a tool name, even when the subagent setstool: false).defineAgentno longer takesoutputSchema; structured output is requested per turn withctx.agent(<id>).send(message, { outputSchema })from adefineWorkflowTool. That's why both subagents here settool: falseand the root reaches them throughagent/tools/research.tsandagent/tools/review_draft.ts(shared loop inagent/lib/subagent-task.ts); keep each subagent'sdescriptionin step with its wrapper tool's. A declared subagent runs in a fresh child session and inherits nothing from the root (no skills, connections, tools, or sandbox), so the caller passes everything it needs in themessage. Here:researcherandreviewer. The researcher setsdefaultTools: falseand re-adds onlyweb_searchandweb_fetchunder its owntools/, so it has no sandbox tools. The reviewer carries its own copy of thewriting-qualityskill underagent/subagents/reviewer/skills/plus its ownsandbox.ts. The copy intentionally diverges from the root skill where the root's references other root-only skills (seo-aeo-best-practices); when editing either copy, keep them in step except for that. - After editing, check LSP diagnostics /
pnpm typecheckand fix type errors before moving on.
Code style
- Linting and formatting are handled by Ultracite (a Biome preset). Run
pnpm checkbefore finishing andpnpm fixto auto-fix. Config is inbiome.jsonc; the kebab-case filename rule is disabled there because eve tools use snake_case names. - TypeScript strict; ESM with
NodeNextresolution (relative imports need a.jsextension). Preferconst, arrow functions, optional chaining / nullish coalescing. - Validate tool input/output with
zodschemas. - Document exported config with TSDoc (
@remarks,@param,@returns,@defaultValue,@see). Avoid inline//comments — put rationale in the TSDoc block instead. - Prose in markdown files is not hard-wrapped: write each paragraph or bullet as one line.
- Agent-facing text (instructions, skill bodies, tool and subagent descriptions) follows the "How you write" rules in
agent/instructions.md: no em dashes, no machine-made words, no bold for emphasis. It carries behavior only, never framework plumbing (sign-in flows, how approvals render) or references to tools and skills the reading agent can't access.
Security
- Never ask the user for API keys, client secrets, or any other credentials.
- Never commit secrets.
.env*is gitignored. Connector UIDs are read from env (SLACK_CONNECTOR,SANITY_CONNECTOR,NOTION_CONNECTOR); Sanity and Notion auth is per-user via Vercel Connect and Blob auth is via the project's OIDC token — there are no API keys in code. - If you ever build a
RegExpfrom data, escape it (literal match) and bound the input length. - Gate irreversible or high-impact actions behind
approval: destructive tools (delete_asset,clear_user_preferences) and connection writes (thesanityandnotionconnections gate the write tools listed above). - For per-user storage, derive the key from the resolved principal (
ctx.session.auth.current), never from model input — seeagent/lib/user-preferences.ts. The preference files live under the reserveduser-preferences/Blob prefix, which the general asset tools refuse so they can't read or overwrite another user's file. download_assetonly fetches URLs on*.blob.vercel-storage.com.
Before committing
pnpm validatepasses (Ultracite check,tsc, andeve infowith 0 errors / 0 warnings).- No secrets,
node_modules, or build output (.eve,.vercel,.output) staged.
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.

