Skip to content

CLI

The agentdoc CLI lets you create, edit, and publish docs from your terminal. Requires Node 20+.

Install

npm install -g @agentdoc/cli

Sign in

Opens your browser to authorize the device. No API key required.

agentdoc login

Everyday commands

A handful you'll reach for most often.

Create a new doc by title.

agentdoc create "Deploy Checklist"

Create a doc from a local .mdfile. Title is auto-derived from the file's first H1 if you omit it.

agentdoc create --file deploy-checklist.md
agentdoc create "Deploy Checklist" --file deploy-checklist.md
agentdoc create --file deploy-checklist.md --project engineering -t runbook -t deploy

Push a local .md file into an existing doc.

agentdoc push README.md deploy-checklist

List your docs.

agentdoc list

Publish a doc so it's public at /@you/slug.

agentdoc publish my-slug

Open a doc in your browser.

agentdoc open my-slug

Append + find

Two atomic primitives so you don't have to read-then-edit for runlogs and don't have to paginate big docs to find a spot.

Append — adds to the end (default), the start, or the bottom of a named section. Concurrency-safe: two appends from different agents both land.

agentdoc append my-runlog "- 2026-05-09: deploy succeeded"
agentdoc append my-runlog --file entry.md
agentdoc append my-runlog --position after_heading --heading "## Log" --file entry.md

Find — locate matches inside one doc. Returns line/column/offset plus a snippet of context. Use it to jump to the right spot in a long doc instead of paginating through.

agentdoc find my-doc "TODO" --limit 50

Focused edits

Change a doc without re-uploading the whole file. Two edit shapes, mix in one call:

String replace like sed. Repeat the pair to batch.

agentdoc edit deploy-checklist \
  --replace "- [ ] Run tests" --with "- [x] Run tests" \
  -m "tests passed"

Section replace — swap an entire markdown section by heading. The hash count bounds it: ## Foo stops at the next ## or #. Read the new body from a file with @path.

agentdoc edit deploy-checklist \
  --section "## Rollback" --with-section @rollback.md \
  -m "rewrite rollback steps"

Pass --expected-sha (from agentdoc info's contentSha) for optimistic concurrency — the edit is rejected with HTTP 409 if someone else changed the doc first.

Projects and tags

Put docs in the right project and add useful tags when you create or track them. This keeps agent-created docs from turning into an orphaned list.

agentdoc project create "Engineering"
agentdoc create --file deploy-checklist.md --project engineering -t runbook -t deploy
agentdoc config set project engineering
agentdoc config set tags engineering,runbook
agentdoc track docs/api.md

Uploading markdown from disk

If the markdown is already a file on disk, don't read it into the conversation and paste it into a flag. Hand the server the path instead — it opens the file directly, which saves tokens and avoids truncation for larger files. Three surfaces, same rule:

  • CLI: agentdoc create --file <file> to create a new doc from a file, agentdoc push <file> <slug> to push into an existing one, or agentdoc track <file> plus repeated agentdoc push for a Git-like workflow.
  • MCP (local stdio): pass file_path to create_doc or update_doc — this is the default calling pattern whenever a local .md exists. Fall back to content only for text generated in-conversation. The remote MCP at mcp.agentdoc.com doesn't expose file_path (it runs on our infra, not your machine) — use the CLI or REST upload below from there.
  • REST: curl --data-binary @file.md with Content-Type: text/markdown. Skips JSON-escape overhead. See the API reference.

Track local files

Like git for markdown — link a local .md file to a remote agentdoc, then push and pull.

Initialize tracking in the current directory.

agentdoc init

Link a local file to a remote doc.

agentdoc track README.md

See what's out of sync, then push or pull.

agentdoc status
agentdoc push
agentdoc pull

Full command list

Every command supports --help with flags, arguments, and examples.

agentdoc --help
agentdoc <command> --help

Looking for the HTTP API instead? See the REST API docs →