langgraph-app
CLAUDE.md8 starsChanged 5 months agoMITView on GitHub
Guidance for Claude Code in this repo. Features, layout, env vars, tech stack → README.md. Design notes → docs/. API changes update docs/APIS.md in the same commit (rule 1). Tool changes update docs/TOOLS.md (rule 10). Non-negotiable. Every change.
- Reads credentials
In this repository16 other files it gives its agents.
- public/llms-full.txtllms.txt
- public/llms.txtllms.txt
- assistant-uiSkill
- cloudSkill
- copilotsSkill
- markdownSkill
- observabilitySkill
- primitivesSkill
- react-mcpSkill
- runtimeSkill
- setupSkill
- speckit-agent-context-updateSkill
- streamingSkill
- thread-listSkill
- toolsSkill
- updateSkill
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 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.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 46
Best practices over middle-ground: Use the canonical approach first (@next/env, drizzle-kit, RemoteThreadListAdapter from …
- Very specific: line 50
Tool-UI buttons are text-only: No lucide icon prefix even with gap-2.
- Very specific: line 51
Never kill or restart a dev server: Check ports first (lsof -i :3000 for Next.js, :2024 for LangGraph).
- Very specific: line 60
Test mock: next/headers + @/lib/auth/config.
- Very specific: line 72
Back up DB before out-of-app mutations: Run scripts/db-snapshot.sh (refuses non-localhost.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.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
CLAUDE.md
Guidance for Claude Code in this repo. Features, layout, env vars, tech stack → README.md. Design notes → docs/.
Docs index
| Topic | File |
| Features, quick-start, layout, env vars, deps | README.md |
| Marketing landing page sections + assets | docs/LANDING.md |
Every HTTP endpoint under app/api/ | docs/APIS.md |
| Memory + thread-summarize design | docs/MEMORY.md |
| Knowledge base, ingestion, hybrid search, Rerank | docs/KNOWLEDGE_BASE.md |
| Observability panel design + retention | docs/OBSERVABILITY.md |
| LangGraph tool inventory + frontend card wiring | docs/TOOLS.md |
| Tiered router (rule / keyword / LLM) + decisions | docs/ROUTING.md |
| Interrupt-driven tool flow contract | docs/INTERRUPT.md |
| Attachments backing (R2 + presign) design | docs/ATTACHMENTS.md |
| Auth setup, OAuth, troubleshooting | docs/AUTH.md |
| DB schema, ownership, indexes | docs/DB.md |
| Provider registry (round-robin + withFallbacks) | docs/PROVIDERS.md |
| Credit / LLM-call quota system | docs/CREDIT.md |
| Admin UI + endpoints for providers/users/roles | docs/ADMIN.md |
| Production deploys (Docker, env, Caddy) | docs/DEPLOY.md |
| VPS daily backup (sidecar cron + rclone to Drive) | docs/BACKUP.md |
| CI/CD, Docker, deploys | docs/CI.md |
API changes update docs/APIS.md in the same commit (rule 1). Tool changes update docs/TOOLS.md (rule 10).
Project-specific
- assistant-ui:
useLangGraphRuntimefrom@assistant-ui/react-langgraph(NOTuseChatRuntime). Full-page<Thread>, not<AssistantModal>. Seeassistant-uiskill. - Env specifics (full table in
README.md): chat models inbackend/model.tscarrymodelKwargs: { reasoning_split: true }— strip when switching providers.DENO_DEPLOY_TOKENpersonal tokens (prefixddp_) needDENO_DEPLOY_ORG; without it,execute_codeis unregistered andwrite_codeis the fallback. - Backend graph: two compiled graphs —
agent(backend/agent.ts) andbackgroundAgent(backend/background-agent.ts). Adding a sub-agent: update the enum instate.tsANDrouter-agent-node.tsANDagent.tsrouteToSubAgent union (or parsing throws — see [[router-decision-schema-duplicated]]). - State persistence: checkpointer is runner-chosen —
langgraphjs devusesInMemorySaver,langgraphjs startusesPostgresSaver(backend/checkpointer.ts).POST /api/threadscallslangGraphClient.threads.create(...)to register the new id with the dev server's in-process store (no-op in prod). - Web3: trade flow is fully SIMULATED regardless of wallet connectivity —
place_crypto_orderauto-funds Mock Coin on first trade. - Observability: see
docs/OBSERVABILITY.md. Gotchas:parent_message_idbackfill window;FORBIDDENregex inbulkInsertSpans(fail-closed); FK cascade fromthreads; retention viaOBSERVABILITY_RETENTION_DAYS(default 30) +scripts/cleanup-observability.ts. - Styling: Tailwind v4 via
@tailwindcss/postcss(notailwind.config.js). Stylesheet:app/globals.css.cn()fromlib/utils.tsis the only util. Path alias@/*→ repo root.
Engineering rules
Non-negotiable. Every change.
- API docs in sync. Any change to
app/api/**/route.ts(request/response/status/semantics) updatesdocs/APIS.mdin the same commit. - TDD for new code. Failing test first → minimal impl → refactor. Skip only for declarative changes (types, config, prose). ≥90% on
lib/<module>/queries.ts+validators.ts; every status code path onapp/api/**/route.ts. - Best practices over middle-ground. Use the canonical approach first (
@next/env,drizzle-kit,RemoteThreadListAdapterfrom@assistant-ui/react). Surface trade-offs when the canonical has friction; let the user decide. - Visually verify frontend changes. Order: Chrome DevTools MCP → Playwright (under
tests/e2e/) → user manual confirmation. Backend/DB/pure-logic:pnpm test+ typecheck. - Comments explain why, not what. Sparse, short. Default to no comment. Delete comments that restate code or narrate sequences.
- Tool-UI cards stay flush with container. No
mx-*, noshadow-*. Verticalmy-*is fine for stacking. Usecomponents/tool-ui/primitives/(CardShell,CardHeader,ErrorBanner,SuccessBanner,JsonBlock). - Tool-UI buttons are text-only. No lucide icon prefix even with
gap-2.size="icon"is fine for icon-only controls (e.g. submit magnifier). - Never kill or restart a dev server. Check ports first (
lsof -i :3000for Next.js,:2024for LangGraph). Reuse via Chrome DevTools MCP. If stale/stuck, surface the observation and ask. Don't act unilaterally. app/api/**/route.tsiswithAuth-wrapped. Fromlib/auth/with-auth.ts. Exceptions: Better Auth catch-allapp/api/auth/[...all]/route.tsandOPTIONSpreflight in proxy routes. Runtime staysnodejs(edge throws onwithAuth→ Postgres). Pattern:import { withAuth } from "@/lib/auth/with-auth"; export const GET = withAuth(async (_req, { user }) => NextResponse.json({ ... })); export const GET = withAuth<{ id: string }>(async (req, { user, params }) => { ... });Test mock:
next/headers+@/lib/auth/config; defaultgetSessionto a logged-in user inbeforeEach; 401 path usesgetSession.mockResolvedValueOnce(null). Seetests/api/alchemy/status.test.tsfor the env pattern.Third-party-key tools lazy-register.
StructuredTool | nullgated onprocess.env.<KEY>at module load; spread with...(tool ? [tool] : []). Update.env.exampleand the "Tool ↔ API key" table indocs/TOOLS.mdwhen adding one. Pattern:export const getNftHoldingsTool: StructuredTool | null = process.env.ALCHEMY_API_KEY ? tool(impl, { name: "get_NFT_holdings", ... }) : null;fetch_urlis exempt (r.jina.ai accepts unauthenticated requests on the free tier).- Back up DB before out-of-app mutations. Run
scripts/db-snapshot.sh(refuses non-localhost; custom-format dump) before any rawpsql, ad-hoctsxscript withDELETE/TRUNCATE/DROP, or manualALTER TABLEoutside the migration runner. Migration runner (pnpm db:migrate) and API routes are exempt. Env var maintenance contract. Default: never add
NEXT_PUBLIC_*. Client-visible values surface viawindow.__CONFIG__, injected byapp/layout.tsxfrom server-only env. Server-only vars (process.env.Xin app code) need only an.env.exampleentry —docker-compose.ymlreads them viaenv_file: .env. Adding a new client-visible value is one line in each ofapp/layout.tsx,.env.example, andlib/window-config.d.ts. The ONLY remaining build-arg isDATABASE_URL(Better Auth runs migrations at module load).SSR gotcha: client-visible values are also evaluated during server-side rendering of any module that imports them (e.g.
lib/wagmi.tsis pulled in byapp/web3-providers.tsx, whichRootLayoutimports). Read them with theisBrowser ? window.__CONFIG__?.X : process.env.Xternary + a non-empty fallback (e.g."ssr-placeholder") —window.__CONFIG__isundefinedon the server and RainbowKit / similar constructors throw on empty. The placeholder never reaches the network because no client-side call happens during SSR.- No ad-hoc test scripts in
scripts/.scripts/is for production tooling (migrations, snapshots, start, retention). Ad-hoc verification / seed / smoke scripts go in/tmp/<name>.ts(or anywhere outside the repo) — not alongside the real ones, so they can't get committed by accident. withStructuredOutputzod schemas must use required fields, never.optional()/ defaultless.default([]). OpenAI's jsonSchema strict mode and most structured-output providers reject optional arrays / nullable object types. If the LLM may legitimately emit an empty result, type the field asz.array(...)(empty array is fine) — don't weaken with.optional()to paper over missing fields. Tests must always supply every field the schema declares.
Things to know before editing
- Graph id
agentis inlanggraph.json,LANGGRAPH_ASSISTANT_ID(.env.example, surfaced to client viawindow.__CONFIG__— see rule #12), andunstable_createLangGraphStream({ assistantId }). Keep aligned. ThekbAgentassistant id (KB ingestion,langgraph.json+lib/kb/ingest.ts:fireIngestionRundispatch) follows the same sync rule — there is no env-driven alias for it, but renaming it requires updatinglanggraph.jsonANDfireIngestionRuntogether. app/api/[..._path]/route.tsproxy usesruntime = "nodejs"(was edge) —withAuthneeds Nodenetfor Postgres session reads.components.jsondeclares a@assistant-uiregistry athttps://r.assistant-ui.com/{name}.jsonforshadcn-style component adds.feat/*branches:git fetch origin mainand merge if main moved before committing — see [[feature-branch-tracks-main]].- Issue titles use
[Type]:prefix matching theghlabel ([Bug]:,[Feat]:,[Docs]:,[Chore]:,[Perf]:,[Refactor]:,[Test]:,[Question]:). pnpm-workspace.yamlkeeps apatchedDependencies:placeholder. Re-check on every bump; drop when upstream ships the fix.
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.

