Skip to content

Write with an agent

An agent can draft a story (format: deck, report…) or a documentation page from a short brief, check every scene with Récit's deterministic tools, and leave the file for you to inspect. Once you have checked it, recit ai jobs record logs the session in the generation register (.recit/jobs/).

What you need

  • A Récit project (with a recit.config.ts at its root) and @recit/mcp installed next to @recit/cli.
  • Claude Code or opencode connected to the MCP server (claude mcp add recit -- npx recit mcp serve, or an mcp.recit entry in opencode.json).
  • Optionally, the Récit guides exported as Agent Skills with npx recit skills export — or as opencode roles in .opencode/agent/ with recit skills export --target opencode.

One brief for both agents

Give either host the exact same brief. A documentation page of a Récit site is plain Markdown, not a story: there is no format guide for it and recit validate does not read it, so its brief keeps the target and step 4 and drops steps 1 to 3; it is recorded the same way below.

Code
Write stories/lorem.md, a four-scene deck in Lorem ipsum. 1. Call describe_format for "deck" (recit_describe_format in opencode) to read the guide and JSON schema. 2. Draft four scenes in Lorem ipsum (a title slide, two content slides and a closing slide) and check the Markdown with validate_story before saving. 3. Write stories/lorem.md, call validate_story with {"file": "stories/lorem.md"}, then run npx recit validate stories/lorem.md until both pass with zero errors. 4. Do not commit, push, tag, deploy or publish anything.

Run the agent

Récit requires no API key in recit.config and imposes no model: each host uses its own credentials and model selection.

From Claude Code:

TerminalShell
claude -p "<brief>"

From opencode:

TerminalShell
opencode run "<brief>"

Check the file

Verify the written story from the project root before keeping it:

TerminalShell
recit validate stories/lorem.md

recit validate converts the Markdown into its typed JSON twin and checks every scene against the format's schema (add --strict before publishing).

Record the session

recit ai jobs record (experimental) writes one .recit/jobs/<id>.json entry under the project root for the files the agent wrote:

TerminalShell
recit ai jobs record --tool claude --session <id> --model <provider/model> stories/lorem.md recit ai jobs record --tool opencode --session <id> --model <provider/model> stories/lorem.md

What the record stores:

  • --tool (claude or opencode, required) and optional --session <id> identify the agent run.
  • Every file argument must exist inside the project folder; paths are normalized to POSIX paths relative to the recit.config directory and deduplicated in order. Each entry carries provenance: { origin: "ai", tool } — plus model when a single --model was passed.
  • --model <provider/model> is repeatable; models stores the sorted, deduplicated list.
  • --started-at <iso> sets the UTC start timestamp (now - duration by default) and --duration <ms> records the elapsed milliseconds (0 by default).
  • --failed <message> records a failed session (state: "failed" and error), with the files the agent wrote before stopping or with none (recit ai jobs then shows no file).

Example .recit/jobs/20261121T103000Z-1a2b3c4d.json:

JSONJSON
{ "$schema": "https://recit.dev/schema/v1/ai-job.json", "kind": "ai-job", "version": 1, "id": "20261121T103000Z-1a2b3c4d", "tool": "claude", "session": "lorem-42", "models": ["anthropic/lorem-1"], "state": "done", "startedAt": "2026-11-21T10:30:00.000Z", "duration": 90000, "files": [ { "file": "stories/lorem.md", "provenance": { "origin": "ai", "tool": "claude", "model": "anthropic/lorem-1" } } ] }

recit ai jobs lists agent sessions next to plugin runs under the label claude <session> (or opencode <session>):

TerminalShell
recit ai jobs
Code
20261121T103000Z-1a2b3c4d 2026-11-21 10:30 done claude lorem-42 90.0 s - 1 file 1 run (1 done, 0 failed), 90.0 s.

What Récit does not do

  • Never calls a model. @recit/core, @recit/cli and @recit/mcp never call an LLM or hold a key: the agent host talks to the model, and Récit validates the result.
  • Writes nothing without the command. Neither recit mcp serve nor recit validate writes to .recit/jobs/; an agent session is recorded only when you run recit ai jobs record.
  • Never read by recit build. recit build never reads .recit/jobs/. Keep .recit/ in .gitignore so local session logs stay on your machine while the validated story enters version control like any hand-written file.