CLI Reference

The AgentMD CLI parses, validates, and executes AGENTS.md files from the terminal.

Installation

After building the project:

pnpm run build:core
pnpm run build:cli
pnpm run agentmd -- validate

Commands

validate [path]

Validate AGENTS.md. Exits with code 1 on errors.

agentmd validate
agentmd validate ./packages/core

discover [path]

Find all AGENTS.md files in a directory (including nested). Use --parse to parse each.

agentmd discover .
# Found 3 AGENTS.md file(s):
#   AGENTS.md (root) — 5 commands
#   packages/core/AGENTS.md (depth 1) — 3 commands

parse [path]

Parse AGENTS.md and print sections and extracted commands.

agentmd parse
# AGENTS.md: 42 lines, 4 sections, 5 commands
# Sections:
#   ## Build
#   ## Test
#   ## PR guidelines
# Extracted commands:
#   [build] pnpm run build (Build, line 8)
#   [test] pnpm test (Test, line 12)

compose [path]

Build AGENTS.md from fragments (**/agents-md/**/*.md, **/*.agents.md).

agentmd compose .
# Composed 2 AGENTS.md file(s):
#   AGENTS.md (85 lines)
#   packages/web/AGENTS.md (32 lines)

run [path] [types]

Execute commands from AGENTS.md. Optional types: build, test, lint, format, install, setup, deploy.

agentmd run .           # Run all commands
agentmd run . test      # Run only test commands
agentmd run . build lint

score [path]

Compute agent-readiness score (0–100).

agentmd score
# Agent-readiness score: 85/100
# → AGENTS.md is well-structured for agent use.

Path Defaults

If no path is given, . (current directory) is used. AgentMD looks for AGENTS.md in that path or directory.

→ Execution & Safety