Skip to Content

Extending: MCP, hooks, commands, project tools

Automation flags, MCP servers, hooks, custom commands and project tools.

  • Automation: --json "..." prints agent events as JSON lines for CI and scripts; --rpc reads JSON commands (prompt, steer, abort, get_state) on stdin and streams events on stdout, for editors. --report <file> writes run metrics.

  • MCP: stdio and streamable HTTP servers; their tools appear beside the built-ins, in every mode. Gated by project trust. With more than 15 MCP tools connected (mcp_defer_above), only their names are sent and the model loads the ones it needs with tool_search, so three big servers do not add 80 schemas to every request.

  • Hooks: before_agent, after_agent, before_tool, after_tool, on_error, pre_compact, post_compact, session_start, stop (exit 2 sends stderr back and keeps the agent working), subagent_stop. Gated by project trust. Whatever a before_agent hook prints is handed to the model with your request (the current branch, a ticket looked up from it, today's deploy notes).

  • Your own system prompt: .zerd/APPEND_SYSTEM.md (or ~/.zerd/APPEND_SYSTEM.md) is added to zerd's prompt; SYSTEM.md in the same places replaces it. Useful for trying different wording on one model without rebuilding.

  • Custom slash commands: markdown files in .claude/commands and .zerd/commands (repo and home); folders become name:sub, descriptions come from front matter and show in tab completion. Prompt templates support $1, $@, ${1:-default}.

  • Project tools: each .zerd/tools/*.toml becomes a tool that runs a shell command. Arguments arrive as JSON on stdin and as ZERD_ARG_<NAME> environment variables. Example .zerd/tools/lint.toml:

    name = "lint"
    description = "Run the linter on one file"
    command = "ruff check \"$ZERD_ARG_PATH\""
    kind = "read"                             # or "shell" to ask for approval first
    [parameters.path]
    type = "string"
    description = "File to check"

    The full format is in src/tools/discovery.rs.

  • Built-in tools: read_file, write_file, edit (multi-edit, fuzzy match, CRLF- and BOM-preserving, line-number prefixes stripped), list_dir, glob, grep, search, outline, git, graph, shell, web_search, web_fetch, memory, notes, todos, ask_user, advisor, recall_result, use_skill, parallel_tasks.