CLI reference
Cortex, memory, and provider commands¶
Ask an AI provider¶
Codex client¶
Uses your installed Codex authentication. Cortex launches an ephemeral, read-only client run.
OpenAI / Codex API¶
export OPENAI_API_KEY="..."
agentdiff cortex agent ask \
--provider openai-api \
--model gpt-5.6-terra \
--task "Review the authentication recovery plan"
Continue a Responses API chain with:
agentdiff cortex agent ask \
--provider openai-api \
--previous-response-id resp_123 \
--task "Now minimize the proposed diff"
Claude Code client¶
Uses your installed Claude Code authentication. Cortex uses non-persistent print mode and plan permissions.
Anthropic API¶
export ANTHROPIC_API_KEY="..."
agentdiff cortex agent ask \
--provider anthropic-api \
--model claude-sonnet-5 \
--task "Review the evidence capsule design"
Ollama API or client¶
The model is always explicit because installed local models differ by machine.
agentdiff cortex agent ask \
--provider ollama-api \
--model qwen3.6 \
--task "Plan the parser repair"
agentdiff cortex agent ask \
--provider ollama-cli \
--model qwen3.6 \
--task "Review the rollback logic"
Use --no-memory for a provider-only request, --max-memories to change the default limit of four evidence cards, and --format json for the normalized provider response and usage fields. --endpoint, --executable, and --api-key-env support self-hosted or non-default configurations without putting a secret value on the command line.
Search trajectory memory¶
agentdiff cortex memory stats
agentdiff cortex memory search "authentication session regression"
agentdiff cortex memory search "src/auth/session.py" --limit 3 --format json
The search command is offline by default. It ranks compressed evidence cards by shared task/path terms, exact paths, recency, and policy risk.
Add local semantic vectors¶
ollama pull embeddinggemma
agentdiff cortex memory index --model embeddinggemma
agentdiff cortex memory search \
"authentication session regression" \
--embedding-model embeddinggemma
memory index sends compressed memory cards to the configured Ollama embedding endpoint and stores the returned vectors locally. Re-run it after adding episodes or changing the embedding model.
To use semantic memory automatically during an AI request:
agentdiff cortex agent ask \
--provider ollama-api \
--model qwen3.6 \
--embedding-model embeddinggemma \
--task "Plan a safe session middleware refactor"
Pack context without calling a provider¶
The output includes matched skills, fragile paths, relevant verified runs, and the rule that rejected runs are warnings rather than successful examples.
Generate a reusable skill card¶
agentdiff cortex skill list
agentdiff cortex skill generate <run-id> --title "Postgres Connection Pooling"
The generated .agentdiff/skills/<skill-slug>.md remains traceable to its source capsule.
Generate remediation advice¶
The payload identifies collateral paths and the conflict-safe rollback command. It does not execute recovery, modify files, or retry an agent.