CallPact Quick Start¶
Run existing tools through schemas, access rules and audit records. The standard
terminal-agent setup connects a shell or hook so covered
commands enter CallPact 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.
1. Install¶
For releases with callpact-<target>.tar.gz assets, the installer downloads and
verifies the archive, installs into ~/.local/bin without sudo, and runs
callpact setup. If the latest release has no CallPact archive yet, build from
source below.
sh 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 callpact 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/apstack/callpact.git
cd callpact
cargo install --path .
callpact --version
callpact 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.
2. Initialize¶
If the installer ran callpact 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 ~/.callpact/bindings/ and a starter policy at
~/.callpact/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. callpact 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 callpact overlays command.
# Optional source override for this invocation: HTTPS/GitHub or local Git.
callpact init --overlays https://github.com/aiperceivable/cli-permissions
callpact init --overlays /path/to/cli-permissions
# Optional reviewed revision.
callpact init --overlays /path/to/cli-permissions --ref <COMMIT>
# Use cached/local rules without network access.
callpact init --offline
# Inspect a machine-readable report.
callpact init --format json
For a standing mirror or source, configure default_overlay_repository or
CALLPACT_DEFAULT_OVERLAY_REPOSITORY. Normal init reuses the cached commit and
preserves existing bindings. callpact 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.
3. List and review¶
Module IDs normally use the cli.* namespace. callpact scan writes bindings
only — it produces the inventory, not the policy. Inspect them, then write a
starter policy with callpact acl init (or let callpact 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: callpact acl sync refreshes the two denial rules and nothing else. These
are generated suggestions rather than your own review.
4. Execute locally¶
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 callpact exec requires matching reviewed
grammar. Check native_ready in the init report or preview the concrete call.
callpact exec --dry-run -- ls -la
callpact exec -- ls -la
printf 'one\ntwo\n' | callpact exec -- cat | callpact exec -- head -n1
Put CallPact 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 CallPact 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:
callpact list --verbose --format json
# Choose an advertised module ID and match its input_schema.
callpact exec cli.ls --input '{"file":["."]}' --dry-run
callpact exec cli.ls --input '{"file":["."]}'
callpact exec cli.ls --input-file request.json --dry-run
cat request.json | callpact exec cli.ls --input-file - --error-format json
Plain 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.
5. Optionally activate your shell¶
Use this step only when initialization reports native-ready modules. An installation with no eligible native bindings can use module JSON and serve instead.
callpact env --enable
source ~/.callpact/bin/callpact-activate.sh
callpact env --check
printf 'one\ntwo\n' | cat | head -n1
source ~/.callpact/bin/callpact-deactivate.sh
The 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;
callpact env --check reports the affected commands as [WARN] INHERIT.
After refreshing initialized bindings, refresh an active shim installation:
6. Optionally serve protocol clients¶
Use MCP/A2A for protocol clients or HTTP API import. Terminal agents using the Skill and explicit exec do not need a server.
callpact serve --acl ~/.callpact/acl.yaml
# HTTP mode with the browser explorer.
callpact serve --transport http --port 8000 --explorer --acl ~/.callpact/acl.yaml
# A2A uses the same initialized command bindings.
callpact a2a --acl ~/.callpact/acl.yaml
Local 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.
Claude Desktop and Cursor¶
callpact serve --show-config claude-desktop --acl ~/.callpact/acl.yaml
callpact serve --show-config cursor --acl ~/.callpact/acl.yaml
Copy 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.
7. Customize and maintain¶
Routine use after initialization is list, exec, env or serve. Use scan
for commands outside the initialized rules or a targeted rescan:
callpact scan git jq my-tool
callpact scan git --depth 3 --no-cache
# Explicit single-tool overlay, after verifying it applies to this installation.
callpact scan my-tool --overlay ./my-tool.json
# Read uncommitted rule edits during development.
CALLPACT_OVERLAY_DIRS=/path/to/cli-permissions/overlays callpact scan ls --no-cache
Scans 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.
Check source drift and explicit behavior¶
callpact verify --report ./drift-report.json
callpact verify --cases ./readonly-cases.json --record
# Digest-pinned dry-run cases require explicit authorization and working isolation.
callpact 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 --callpact target/debug/callpact
Prepare 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.
Import an existing HTTP API with OpenAPI¶
Supply an OpenAPI 3.0/3.1 JSON or YAML document and a reviewed ACL to either
server. Set CALLPACT_OPENAPI_TOKEN in the launch environment if the upstream API
requires a bearer credential:
callpact serve --openapi ./openapi.yaml \
--openapi-base-url https://api.example.com --acl ./acl.yaml --no-log-arguments
callpact a2a --openapi ./openapi.yaml \
--openapi-base-url https://api.example.com --acl ./acl.yaml --no-log-arguments
Operations 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 --callpact target/debug/callpact
# Also fetch a protected specification with a separate credential:
python3 examples/openapi_import/demo.py --callpact target/debug/callpact --remote-spec
The 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.
Explore more options¶
# Deep scan with 3 levels of subcommands
callpact scan git --depth 3
# HTTP server for remote agents
callpact serve --transport http --port 8000 --acl ~/.callpact/acl.yaml
# SSE transport (deprecated upstream -- prefer --transport http)
callpact serve --transport sse --port 8000 --acl ~/.callpact/acl.yaml
# Also generate Claude Skills (.claude/skills/<id>/SKILL.md) per module
callpact scan git --skills-dir ./out
# Observability: /metrics (Prometheus) + /usage (HTTP/SSE only)
callpact serve --transport http --metrics --acl ~/.callpact/acl.yaml
# Initialize a config file for customization
callpact config --init
# View resolved configuration
callpact config --show
See User Manual for full documentation.