For AI agents · Codex

ClarifyDoc in Codex. One command, then ask.

Give Codex (OpenAI’s coding agent in the terminal) a map of your codebase: which screen calls an endpoint, which tables it touches, what an edit breaks. It asks ClarifyDoc’s MCP server and gets short answers with path:line references instead of reading whole files. Local, read-only, no account.

npm install -g clarifydoc && clarifydoc install . --client codex
# config.toml — what clarifydoc install . --client codex writes
[mcp_servers.clarifydoc]
command = "clarifydoc"
args = ["mcp","/path/to/your/project"]

SET IT UP

From install to the first answer

  1. Install ClarifyDoc and connect Codex

    The CLI is on npm and needs Node.js. From the project root, the second command merges the entry into Codex’s config and keeps everything else in it. Add --print to see what it would write first.

    npm install -g clarifydoc && clarifydoc install . --client codex

    With the VS Code extension instead: VS Code’s ClarifyDoc: Set Up MCP for an AI Agent… → Codex writes this table too, pointed at the extension’s own launcher.

  2. Where the entry goes

    ~/.codex/config.toml

    This file serves every project, so the entry names one by path. Run the command again from another project and it adds a second entry, clarifydoc-<folder>, beside the first. Written by the installer, the entry starts the CLI by its absolute path, since an app started from the dock may not have your shell’s PATH.

    [mcp_servers.clarifydoc]
    command = "clarifydoc"
    args = ["mcp","/path/to/your/project"]
  3. Reload Codex

    Start a new codex session. Servers are read when a session starts.

  4. Ask the first question

    Type this as it is. If the project has no analysis yet, the first call makes one; a large repository can take a few minutes, and every analysis after it reads only the files that changed. To have it ready first, run clarifydoc analyze . from the project root.

    Call clarifydoc_status, then use clarifydoc_routes to pick one API route. Tell me which screen calls it and which tables it reads and writes, with path:line for each.

    Then one about your own change:

    Before I change <a file you know>, what depends on it and which tests should I run?
  5. Check that it worked

    clarifydoc_status answers with the project root, when it was analyzed and how many routes, screens and tables were found. If it says no analysis was found, the server is looking at another folder: start Codex from the project root, or check the path in the entry.

    /mcp in a session lists the server and its tools; codex mcp list in the shell lists what is configured.

  6. Keep it current

    Ask the agent to call clarifydoc_analyze, or run clarifydoc analyze . --incremental: either re-reads only the files that changed. clarifydoc install --git-hooks does it in the background after each commit, merge and branch checkout. To update ClarifyDoc itself, npm install -g clarifydoc@latest (the extension updates itself, and its launcher keeps its path), then reload Codex.

  7. Remove it

    Delete the [mcp_servers.clarifydoc] table (or [mcp_servers.clarifydoc-<folder>]) from ~/.codex/config.toml. If you added it: the block between # clarifydoc:hooks:start and # clarifydoc:hooks:end, or the hook running clarifydoc hook pre-search in ~/.codex/hooks.json. Delete .clarifydoc/ in the project, and npm uninstall -g clarifydoc. If you asked for them, --guidance wrote between <!-- clarifydoc:start --> and <!-- clarifydoc:end --> in AGENTS.md, and --git-hooks between # clarifydoc:start and # clarifydoc:end in the repository’s git hooks. Nothing else is written.

OPTIONAL

More than the server

Each is a flag on the same clarifydoc install command, off unless you ask for it, and --print shows it before anything is written.

Hooks

--client codex --hooks adds a PreToolUse hook on Bash — to ~/.codex/hooks.json when you have one, else as a marked block in config.toml — so a grep or rg the agent runs gets what the map knows about the name. Codex asks you to trust a new hook (/hooks). A hook never blocks a tool call.

A plugin bundle

clarifydoc install --plugin ./clarifydoc-plugin writes an Agent Plugins 1.0 directory (plugin.json, mcp.json, the skills and a read-only explorer subagent) for a host that installs plugins from a directory.

A section in AGENTS.md

--guidance adds a short, marked section to AGENTS.md that tells agents when to ask the map instead of searching text, and what this project’s analysis says to know first. It edits a file your team shares, so --print it first.

WHAT IT ANSWERS

23 tools, all read-only but two

Routes and who calls them, the tables a screen reads and writes, the call path between two functions, what a diff reaches, one function’s source instead of its file. Only clarifydoc_analyze and clarifydoc_diff write, and only to .clarifydoc/. Nothing leaves your machine — every network request any part can make.

OTHER HOSTS

The same server, elsewhere