CLI Reference (ctx)
The ctx CLI serves as the central command-line interface for context security inspection, policy testing, kernel sandboxing, and package management.
Core Command Matrix
| Command | Syntax | Description |
|---|---|---|
init |
ctx init [--template=<name>] |
Initializes repository with ctxsec.yaml and .agents/ hooks. |
hook |
ctx hook --format=<antigravity\|claude> |
StdIn lifecycle hook adapter for AI agent platforms. |
exec |
ctx exec [--role=<role>] -- <command> |
Executes a command wrapped in the OS in-kernel sandbox. |
policy |
ctx policy check --facts=<facts.json> |
Evaluates candidate context facts against local CEL policies. |
registry |
ctx registry <search\|install\|verify> |
Manages Ed25519-signed agent skills and tool manifests. |
sandbox |
ctx sandbox <inspect\|detect\|test> |
Inspects and validates host OS kernel sandboxing primitives. |
version |
ctx version |
Prints binary version, git commit, and compile time. |
Command Details
ctx hook
Reads an agent's tool execution request on stdin (JSON format), evaluates CEL policies and role limits, and emits an allow/deny/ask decision on stdout.
echo '{"toolCall":{"name":"run_command","args":{"CommandLine":"npm test"}}}' | ctx hook --format=antigravity
ctx exec
Executes an arbitrary command wrapped inside Apple Seatbelt or Linux Bubblewrap:
ctx registry install
Downloads an agent skill, verifies the Ed25519 signature against the registry trust root, and places it into .agents/skills/: