Agent context

Generate small markdown handoff files that tell coding agents how this project uses cms-lab before they try to fix CMS diagnostics.

Generate files

Run the command from the Next.js project that has a cms-lab.config.ts file.

npx @cms-lab/cli agent-context

Use flags when you need a custom config path or an intentional rewrite.

npx @cms-lab/cli agent-context --config ./cms-lab.config.ts
npx @cms-lab/cli agent-context --mode cms-only
npx @cms-lab/cli agent-context --preset all
npx @cms-lab/cli agent-context --preset claude
npx @cms-lab/cli agent-context --preset gemini
npx @cms-lab/cli agent-context --preset copilot
npx @cms-lab/cli agent-context --force
npx @cms-lab/cli agent-context --no-agents-md
npx @cms-lab/cli agent-context --out .cms-lab

CMS-only projects

agent-context can run before a frontend exists. If the command does not detect a Next.js app, it still writes safe context from the cms-lab config and marks the frontend as not detected.

npx @cms-lab/cli agent-context --mode cms-only --preset all

CMS-only context is useful for backend-heavy Directus, Strapi, or catalog projects that need an agent handoff for collections, route planning, and required fields. Route scans still require a running frontend; add route mappings and run scan once the frontend exists.

Presets

The default preset is intentionally plain. Use a tool-specific preset when the repository needs files that a coding assistant reads automatically.

PresetWrites
genericAGENTS.md and shared files in .cms-lab/.
codexSame as generic, tuned for repositories that use agent instruction files.
claudeCLAUDE.md plus shared cms-lab context and prompt files.
geminiGEMINI.md plus shared cms-lab context and prompt files.
copilot.github/copilot-instructions.md, a Copilot prompt, and shared cms-lab files.
allAll supported agent files.

Generated files

FileUse
AGENTS.mdRoot handoff file for agents that read repository instructions.
.cms-lab/agent-context.mdSafe project scan facts: framework, CMS provider, route patterns, check groups, and cms-lab reference links.
.cms-lab/agent-prompt.mdA starter prompt for asking an agent to reproduce and investigate cms-lab diagnostics.

Some presets add CLAUDE.md, GEMINI.md, or Copilot files that point back to the same shared context instead of copying project details into several places.

Agent usage

The generated files are plain markdown, so they work as shared context for tools such as Codex, Claude Code, Gemini CLI, Antigravity, OpenCode, and similar coding agents. If a tool prefers a different project memory filename, copy or import the generated content instead of duplicating it by hand.

Safety defaults

Existing files are not overwritten unless --force is passed. Generated content avoids CMS tokens, raw CMS payloads, private URLs, webhook URLs, and local absolute paths.