# AI Agents

> Serve Markdown, llms.txt, content signals and agent skills to AI agents.

Every `livemark build` publishes your site in the forms AI agents look for, next to the HTML that browsers get. You don't need to configure anything for this. The two options below only adjust it.

## What the build emits

| File                                   | Purpose                                                                                                                                   |
| -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `<page>/index.md`                      | A Markdown twin of every article and section listing, beside its `index.html`                                                             |
| `/llms.txt`                            | An [llms.txt](https://llmstxt.org/) index linking every twin, grouped by section                                                          |
| `/index.md`                            | The home page's twin, or a copy of `llms.txt` when no article sits at `/`                                                                 |
| `/robots.txt`                          | Gains a `Content-Signal` line stating how automated systems may use your content                                                          |
| `/_headers`                            | A `Link` header on the home page pointing at `llms.txt`, `index.md` and the skills index, and a year-long cache on the hashed `/assets/*` |
| `/.well-known/agent-skills/index.json` | An [Agent Skills](https://agentskills.io/) discovery index, when `skills` is set                                                          |

Each article page also carries `<link rel="alternate" type="text/markdown">` pointing at its twin.

A file you ship under `.livemark/public/` with the same name replaces the generated one. `_headers` is the one exception: your rules are kept and the generated rules are appended after them. The files are written only by `livemark build`, so `livemark start` does not serve them.

## Content signals

`contentSignals` controls the [Content Signals](https://contentsignals.org/) line in `robots.txt`. All three signals default to `true`:

```ts title="livemark.config.ts"
export default defineConfig({
  contentSignals: {
    search: true, // build a search index and show links to your pages
    aiInput: true, // feed pages to a model answering a question in real time
    aiTrain: false, // train or fine-tune models on your content
  },
})
```

The line it produces sits in the `User-agent: *` group: `Content-Signal: search=yes, ai-input=yes, ai-train=no`.

## Agent skills

If your project ships [Agent Skills](https://agentskills.io/specification), point `skills` at their `SKILL.md` files:

```ts title="livemark.config.ts"
export default defineConfig({
  skills: "skills/*/SKILL.md",
})
```

Each matched skill is published at `/.well-known/agent-skills/<name>/SKILL.md` and listed in `index.json` with a `sha256` digest. Its frontmatter needs a `name` (lowercase letters, digits and single hyphens) and a `description`, and the build fails if either is missing.

## Markdown on request

Agents ask for Markdown by sending `Accept: text/markdown` to the page URL. A static host can't answer that on its own, but a rewrite on your CDN can serve `<page>/index.md` for those requests and leave the HTML for everyone else. Every article and section listing has a twin, so the rewrite never points at a missing file. For a ready-made rule, see [Cloudflare → Markdown for agents](/deployment/cloudflare/#markdown-for-agents).

## Driving the CLI

The `livemark` command itself is built for agents and scripts as well as people. `livemark --llms` prints a manifest of every command as [MCP](https://modelcontextprotocol.io/)-style tools, each with a JSON Schema for its input and output. Add `--json` to any command to get its result as JSON on stdout, and pass a value to supply the input as JSON too:

```bash
livemark --llms                                          # every command and its schemas
livemark build --json                                    # → { "outDir": ".../.livemark/build/client" }
livemark escape --json '{"paths":["components/Footer.tsx"]}'
```

Under `--json`, logs go to stderr, so stdout holds only the result. `start` and `preview` print their URLs once the server is listening and keep running. `--config` (`-c`) or the `LIVEMARK_CONFIG` variable points any command at a config other than `./livemark.config.ts`.

## See also

- [Agent Skills](/agent-skills/) — install Livemark's own skills into your coding agent.
- [Config File](/customization/config-file/) — every top-level option.
- [Custom Routes](/customization/custom-routes/) — static files under `.livemark/public/`.
