Agent CLI Contract
How to call RAGit safely from AI agents
RAGit now keeps a clearer split between human-readable CLI output and machine-safe command contracts. If you are integrating it into an agent workflow, use these rules first.
Default Rules
- Prefer
--format jsonfor machine consumers. - Use
ragit describe <command> --format jsonbefore integrating a command for the first time. - Prefer
--view minimalforquery,context pack, andmemory recall. - Prefer
--input <path|->for agent calls that carry structured payloads. - Run mutating commands with
--dry-runfirst.
Contract Shape
Most major commands can now return a shared envelope:
{
"command": "query",
"ok": true,
"version": "1.0.1",
"cwd": "/repo/path",
"data": {},
"warnings": []
}That envelope is meant to stay stable even when the human text output changes.
For per-command syntax, payload shapes, and failure notes, use Commands as the detailed reference.
Read Commands
querysupports positional input or--input <path|->JSON payloads.context packsupports positional input or--input <path|->JSON payloads.memory recallaccepts a goal and can shrink output with--view minimal|default|full.
For agents, start small:
ragit query --input query.json --view minimal --format json
ragit context pack --input context-pack.json --view minimal --format json
ragit memory recall "resume auth flow" --view minimal --format jsonMutating Commands
These commands now support --dry-run so an agent can validate intent before writing:
ingesthooks installhooks uninstallmemory wrapmemory promote
Typical pattern:
ragit memory promote --input promote.json --dry-run --format json
ragit memory promote --input promote.json --format jsonMemory Caveat
Do not confuse the two memory surfaces:
.ragit/memory/**is the control plane for working state and session history.docs/memory/**is the searchable corpus that participates in ingest and snapshot retrieval.
That means agents should use memory wrap and memory recall to manage active work, and memory promote only when knowledge is stable enough to become searchable project memory.