Run existing tools through schemas, access rules and audit records. The standard
terminal-agent setup connects a shell or hook so covered
commands enter apexe with their ordinary syntax. Use the Agent Skill
for explicit exec routing when the host cannot use that integration. Use
OpenAPI import to expose HTTP operations over MCP or A2A.
One command downloads the release for this platform, verifies its checksum,
installs into ~/.local/bin (no sudo), and runs apexe setup:
curl -fsSL https://raw.githubusercontent.com/aiperceivable/apexe/main/scripts/install.sh | shsh scripts/install.sh --dry-run prints the resolved download and install plan
without changing anything, and --no-setup stops after the binary. The script
only places the binary; preparation belongs to apexe setup, so it does not
freeze at the version of the script you happened to download.
Prefer a manual install? Use a prebuilt release, or build from source with Rust and Cargo:
git clone https://github.com/aiperceivable/apexe.git
cd apexe
cargo install --path .
apexe --versionapexe init reads the default rules from a release archive, so Git is only
needed when you point at a Git source (--overlays <repository>, or
--ref <branch|commit>). Command binaries must already be installed on this
machine.
apexe initIf the installer ran apexe setup successfully, initialization and shim
installation are complete. Fresh setup creates a strict starter ACL and
records its path in the shim manifest. Read the setup summary for host configuration
results. Setup can configure detected OpenCode, pi and Claude Code hosts with
operator consent. Codex uses a separate login-shell step. Run init directly
to prepare or refresh rules and bindings on their own.
This obtains the configured rules source, normally
cli-permissions, and discovers
commands declared by the loaded rules. For installed tools it uses the existing
scanner to resolve binaries, detect variants and match platform/version/probe
conditions. It writes bindings under ~/.apexe/bindings/ and a starter policy at
~/.apexe/acl.yaml. Missing tools and unmatched variants are reported and skipped.
It does not scan every executable on PATH, install programs, activate shims or
start a server.
Read the report for initialized and preserved bindings, skipped tools, warnings, native-ready module IDs
and rules commits. apexe config --show displays configured values; its
default_overlay_repository URL alone does not prove a snapshot or bindings
exist. overlay_dirs: [] still permits managed rules snapshots. There is no
separate apexe overlays command.
# Optional source override for this invocation: HTTPS/GitHub or local Git.
apexe init --overlays https://github.com/aiperceivable/cli-permissions
apexe init --overlays /path/to/cli-permissions
# Optional reviewed revision.
apexe init --overlays /path/to/cli-permissions --ref <COMMIT>
# Use cached/local rules without network access.
apexe init --offline
# Inspect a machine-readable report.
apexe init --format jsonFor a standing mirror or source, configure default_overlay_repository or
APEXE_DEFAULT_OVERLAY_REPOSITORY. Normal init reuses the cached commit and
preserves existing bindings. apexe init --refresh updates the selected source
and regenerates unchanged bindings created by init. Custom and edited bindings
are preserved. A pinned commit stays pinned until you select another --ref.
Any explicit-source acquisition or validation failure, or a failed refresh,
exits nonzero even when other local rules are available.
If the default source cannot be acquired and no local rules are usable, init
reports degraded coverage and scans only the fallback core (cat, head, ls,
wc) with built-in classification. Unknown modules remain denied in a new ACL.
Fallback bindings lack reviewed native grammar, so use their JSON module mode
when permitted; native exec/env may remain unavailable until matching rules are
installed. A run with scan failures or no initialized/preserved modules exits
nonzero after reporting its outcome.
If apcore configuration sets a custom bindings.pattern, it must include the
canonical *.binding.yaml files init generates. Excluded existing bindings are
preserved with a report warning; excluded new filenames are refused before
bindings and ACL are written.
apexe list
apexe list --verbose
apexe list --format jsonModule IDs normally use the cli.* namespace. apexe scan writes bindings
only — it produces the inventory, not the policy. Inspect them, then write a
starter policy with apexe acl init (or let apexe init do it once). The
policy defaults to deny: destructive and network-reaching modules are refused to
every caller, readonly ones are allowed to every caller, and --profile developer grants the local shell (cli.*) everything above the denials while
--profile strict grants nothing implicitly. A later scan never changes an
allow: apexe acl sync refreshes the two denial rules and nothing else. These
are generated suggestions rather than your own review.
For Claude Code, Codex, pi or OpenCode, follow the
host setup and verification steps. Once the host and shim
route are verified, ask the agent to run the ordinary command, for example
ls -la. If your host cannot use the shell or hook integration, follow the
Agent Skill fallback.
For a direct invocation, native apexe exec requires matching reviewed
grammar. Check native_ready in the init report or preview the concrete call.
apexe exec --dry-run -- ls -la
apexe exec -- ls -la
printf 'one\ntwo\n' | apexe exec -- cat | apexe exec -- head -n1Put apexe options before --, then the command and its arguments. Native calls
preserve child streams and exit status. The shell owns pipelines and
redirections; each external stage above enters apexe independently. stdin is
inherited only with an explicit reviewed capability. Local execution loads the
default ACL when present and uses caller local. Native local calls that need
approval prompt on the controlling terminal; a non-interactive process is
refused with a remedy. See the exec reference.
When native grammar alone is unavailable, module JSON works with initialized bindings if its normal checks permit the operation. Discover the actual schema before constructing JSON:
apexe list --verbose --format json
# Choose an advertised module ID and match its input_schema.
apexe exec cli.ls --input '{"file":["."]}' --dry-run
apexe exec cli.ls --input '{"file":["."]}'
apexe exec cli.ls --input-file request.json --dry-run
cat request.json | apexe exec cli.ls --input-file - --error-format jsonPlain list --format json returns a summary array, including [] on an empty
machine. Verbose JSON adds schemas and ACL context in a modules envelope.
Both are discovery reports; preflight evaluates a concrete invocation.
File/stdin input accepts one JSON object up to 1 MiB. --error-format json
adds a versioned error envelope on stderr while retaining existing stdout and
exit status behavior. Inline --input remains available.
--as changes only a dry-run simulation, and cannot impersonate a caller during
execution. Captured module execution has no interactive approval path, so a
call that still requires approval is refused; use native local execution or an
MCP client connected to a server started with --enable-approval when a human
decision is needed.
Use this step only when initialization reports native-ready modules. An installation with no eligible native bindings can use module JSON and serve instead.
apexe env --enable
source ~/.apexe/bin/apexe-activate.sh
apexe env --check
printf 'one\ntwo\n' | cat | head -n1
source ~/.apexe/bin/apexe-deactivate.shThe installed helpers require no repository checkout. Activation automatically
enables or reloads eligible shims, updates the current shell and clears its
command cache; no additional eval or rehash is needed. POSIX sh uses . rather
than source. Deactivation removes the shim directory from the current PATH and
leaves the installation — and any PATH entries added after activation — alone;
the helpers remain available for reactivation. Other commands,
builtins, aliases and absolute paths remain outside shim coverage. See the
env reference for supported shells and checks.
Applications started from that shell inherit the shim PATH too. If an editor
opened with code . loses its Git/GitHub integration, see
Applications launched from a governed shell;
apexe env --check reports the affected commands as [WARN] INHERIT.
After refreshing initialized bindings, refresh an active shim installation:
apexe init --refresh
apexe env --reloadUse MCP/A2A for protocol clients or HTTP API import. Terminal agents using the Skill and explicit exec do not need a server.
apexe serve --acl ~/.apexe/acl.yaml
# HTTP mode with the browser explorer.
apexe serve --transport http --port 8000 --explorer --acl ~/.apexe/acl.yaml
# A2A uses the same initialized command bindings.
apexe a2a --acl ~/.apexe/acl.yamlLocal exec/env load the default ACL automatically when present. MCP/A2A servers
currently require the explicit --acl flag; initialization does not enable
server enforcement. HTTP-family transports require authentication by default.
See the threat model before exposing tools to agents.
apexe serve --show-config claude-desktop --acl ~/.apexe/acl.yaml
apexe serve --show-config cursor --acl ~/.apexe/acl.yamlCopy the relevant output to your client's MCP configuration, then restart it.
If bindings are elsewhere, include --bindings-dir when generating the snippet.
Transport credentials are never included. MCP approval prompting requires an
elicitation-capable client and --enable-approval; A2A has no interactive
elicitation transport.
Routine use after initialization is list, exec, env or serve. Use scan
for commands outside the initialized rules or a targeted rescan:
apexe scan git jq my-tool
apexe scan git --depth 3 --no-cache
# Explicit single-tool overlay, after verifying it applies to this installation.
apexe scan my-tool --overlay ./my-tool.json
# Read uncommitted rule edits during development.
APEXE_OVERLAY_DIRS=/path/to/cli-permissions/overlays apexe scan ls --no-cacheScans write bindings and preserve unrelated bindings; they never rewrite the
access policy. A custom scan is an explicit request to regenerate that tool's
bindings, including ones init would otherwise preserve. The first online scan
can also acquire the default corpus automatically; scan --offline prevents
that download. Refresh enabled
shims after binding changes. config --init only writes a configuration template;
it does not initialize command coverage.
apexe verify --report ./drift-report.json
apexe verify --cases ./readonly-cases.json --record
# Digest-pinned dry-run cases require explicit authorization and working isolation.
apexe verify --cases ./dry-run-cases.json --allow-dry-run --isolation required --record
# Run a disposable demo with no external corpus or destructive commands.
python3 examples/verification/demo.py --apexe target/debug/apexePrepare cases against the actual scanned input schema. --record stores
case-scoped evidence; binding, executable or case-file changes invalidate it.
The case modes are readonly, dry_run and isolated. Isolation uses macOS
sandbox-exec or Linux bwrap with unprivileged namespaces. Unavailable required
isolation reports unverifiable and runs no case. See
verification and the demo.
Supply an OpenAPI 3.0/3.1 JSON or YAML document and a reviewed ACL to either
server. Set APEXE_OPENAPI_TOKEN in the launch environment if the upstream API
requires a bearer credential:
apexe serve --openapi ./openapi.yaml \
--openapi-base-url https://api.example.com --acl ./acl.yaml --no-log-arguments
apexe a2a --openapi ./openapi.yaml \
--openapi-base-url https://api.example.com --acl ./acl.yaml --no-log-argumentsOperations use the api.* namespace by default. They share schema validation,
ACL and auditing with CLI modules. A2A transport authentication is separate
from the upstream API credential. --openapi-header authenticates specification
fetching only. See the OpenAPI guide for supported request formats
and proxy limits.
Try both MCP and A2A against a temporary local API from the repository root:
cargo build --all-features
python3 examples/openapi_import/demo.py --apexe target/debug/apexe
# Also fetch a protected specification with a separate credential:
python3 examples/openapi_import/demo.py --apexe target/debug/apexe --remote-specThe OpenAPI import demo checks GET path and query parameters, POST JSON bodies, ACL-denied DELETE and credential separation. It requires Python 3 and creates its own local API and credentials.
# Deep scan with 3 levels of subcommands
apexe scan git --depth 3
# HTTP server for remote agents
apexe serve --transport http --port 8000 --acl ~/.apexe/acl.yaml
# SSE transport (deprecated upstream -- prefer --transport http)
apexe serve --transport sse --port 8000 --acl ~/.apexe/acl.yaml
# Also generate Claude Skills (.claude/skills/<id>/SKILL.md) per module
apexe scan git --skills-dir ./out
# Observability: /metrics (Prometheus) + /usage (HTTP/SSE only)
apexe serve --transport http --metrics --acl ~/.apexe/acl.yaml
# Initialize a config file for customization
apexe config --init
# View resolved configuration
apexe config --showSee User Manual for full documentation.