Agents · v0.4 · compiler m2.3

Plug Lith into your agent.

An agent should read only the part of the docs it needs. The docs MCP server, the compiler's tools and the AGENTS.md in every new project all return the card once, then just the passages that answer the question.

One command

Connect the docs to Claude Code, nothing to install:

claude mcp add --transport http lith https://lith.codes/mcp

Four ways to give a coding agent Lith, from nothing to install to the full compiler as tools. Each one lets the agent read only the part of the docs it needs.

Docs over MCP, nothing to install

https://lith.codes/mcp is a Model Context Protocol server with one tool, lith_docs. Called with no query it returns the language card (about 2.5k tokens); called with a few words it returns only the passages of the guide and the specification that match, at most about 1.5k tokens.

claude mcp add --transport http lith https://lith.codes/mcp

Other clients that support remote MCP servers take the same URL:

{ "mcpServers": { "lith": { "type": "http", "url": "https://lith.codes/mcp" } } }

The compiler as tools: lith mcp

With the compiler installed, lith mcp runs the same docs search on stdio, plus three tools that act on a project:

  • lith_docs: the card, or the passages that match a query.
  • lith_check: every diagnostic of a project, each with its fix, or ok.
  • lith_fix: the safe rewrites after a language upgrade (a dry run unless apply is true).
  • lith_tokens: the design tokens the compiler enforces.
claude mcp add lith -- node /path/to/lith/compiler/bin/lith.mjs mcp
{ "mcpServers": { "lith": { "command": "node", "args": ["/path/to/lith/compiler/bin/lith.mjs", "mcp"] } } }

lith docs in the terminal

Agents that only have a shell use the same search from the command line:

lith docs                    # the whole language card
lith docs flash redirect     # only the passages about flash messages and redirects
lith docs --list             # every topic of the guide and the specification

When a query word appears nowhere in the docs, lith docs says so and returns one passage for the other words, so the agent stops searching for something Lith does not have.

AGENTS.md in every project

lith new writes this file, and a CLAUDE.md that imports it, so an agent that opens the project learns where the docs are before it writes any code:

# This is a Lith app

Lith is TypeScript + JSX + Prisma-style queries with the declarations `table page api crud layout` (https://lith.codes).
`lith` below means `node "/path/to/lith/compiler/bin/lith.mjs"`.

- `lith docs` prints the whole language card (about 2.7k tokens). Read it once before writing code.
- `lith docs <words>` prints only the docs passages about a topic, for example `lith docs flash redirect`.
- `lith check` after every edit: each error says how to fix it. `lith dev` runs the app and reloads on save.

All `.lith` files share one namespace: never import your own files. Style with the design tokens, never raw colours
or sizes (`lith tokens --summary` lists them).

Add the same file to an existing project by hand; the compiler path is the only line to change.

Plain text files

Every agent can fetch these, and they are the source for all of the above:

  • /llms.txt: the language card, read first (about 2.7k tokens).
  • /llms-guide.txt: recipes for the tasks the card leaves out (about 7k tokens).
  • /llms-full.txt: the full specification, with a contents line that gives each section's start line (about 60k tokens).