Skip to content
CallPact logo

CallPact

Run your tools. Enforce your rules.

Governed execution for CLI tools and HTTP APIs. Run CLI commands locally and expose CLI and OpenAPI operations to AI agents through MCP and A2A.

The Cargo package, Rust library and executable are named callpact. Use CALLPACT_* for settings. The old APEXE_* names still work when the new setting is unset. Fresh installations use ~/.callpact and callpact-sh; existing ~/.apexe state and the old shell helper names remain usable.

License Rust

Contents: What is CallPact? · Installation · Quick Start · Integrations · Key capabilities · Commands · How It Works · Configuration · File Locations · Examples · Developer Guide · Documentation

What is CallPact?

CallPact gives humans and AI agents a shared execution layer for existing tools. It discovers supported CLI commands, turns their arguments into JSON Schema, and applies configured access rules and approval checks before execution. Calls leave audit records. Your CLI binaries keep working as they are; scanning requires no LLM or changes to their source code.

For terminal-capable AI agents, configure the host as described in Integrations — shell or hook first, the shared Agent Skill only as a fallback. MCP/A2A clients use CLI modules and OpenAPI operations through the same executor for schema validation, configured ACLs and auditing.

Choose your entry point

Goal Entry point What you get
Install and prepare this machine in one step scripts/install.sh, callpact setup Release binary, verified checksum, rules, shims, and configured agent hosts
Prepare installed CLI coverage callpact init, callpact list --verbose Matching reviewed rules, typed bindings and a starter ACL to inspect
Run a CLI command locally callpact exec Module JSON with captured output, or reviewed native argv with passthrough streams
Keep native command names in your shell callpact env PATH shims for eligible external commands, activation helpers and installation checks
Configure a terminal agent's shell or hook Shell Integration, callpact agent callpact-sh for OpenCode/pi, login-shell PATH for Codex, PreToolUse hook for Claude Code and Antigravity
Route CLI commands when the host cannot be configured Agent Skill + callpact exec -- ... Fallback native execution routing for Claude Code, Antigravity, Codex, pi and OpenCode
Connect a protocol client or import an HTTP API callpact serve, callpact a2a CLI modules and optional imported OpenAPI operations over MCP or A2A
Check a CLI contract after changes callpact verify Source drift reports and optional digest-bound evidence from explicit behavioral cases
Write or explain the access policy callpact acl Starter policy, refreshed denials, and the rule that decided one module
Inspect sandbox delegation callpact sandbox check Selected backend, enforcement level, capabilities and selected modules
Cover a custom CLI callpact scan Deterministic discovery, YAML bindings and optional Claude Skills; policy authorship stays with callpact acl

Installation

One command

If the latest release has no callpact-<target>.tar.gz asset yet, use the source installation below.

curl -fsSL https://raw.githubusercontent.com/apstack/callpact/main/scripts/install.sh | sh

Downloads the release for this platform, verifies its checksum, installs into ~/.local/bin without sudo, then runs callpact setup to prepare rules, shims and any agent host it detects. --dry-run prints the plan and --no-setup stops after the binary.

Prebuilt binary

No Rust toolchain required. Download the archive for your platform from the Releases page, verify the checksum, and put the callpact binary on your PATH:

tar -xzf callpact-<target>.tar.gz
shasum -a 256 -c callpact-<target>.tar.gz.sha256
sudo mv callpact-<target>/callpact /usr/local/bin/
callpact --version

Available targets: x86_64-apple-darwin, aarch64-apple-darwin, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu.

From source

Use the current stable Rust toolchain and Cargo. CI tests stable Rust; the project does not declare or test an older minimum supported Rust version.

git clone https://github.com/apstack/callpact.git
cd callpact
cargo install --path .
callpact --version

Platform support

CallPact scans Unix CLIs. What you get depends on the host:

Host Scanning Curated overlays
macOS Help, man pages, completions and matching overlays Matching bsd / apple rules from the external corpus
Linux Help, man pages, completions and matching overlays; install man-db for tier 2 Matching gnu rules from the external corpus
FreeBSD Full bsd overlays apply
OpenBSD / NetBSD / DragonFly Full none — falls back to scanning
Other Unix (Solaris, illumos, AIX) Tiers 1–2 none
Windows Not supported none

The GNU overlays carry no platform condition — they are selected by probing the binary — so they apply anywhere GNU tools are installed, including WSL and a macOS box with Homebrew coreutils. The BSD overlays declare macos and freebsd, which is why the other BSDs fall back to scanning: their tools are separately evolved code, not the same source, so claiming otherwise would be a guess.

On Windows CallPact runs but produces little. Tier 2 shells out to man and tier 3 to zsh; both are absent, so both return nothing rather than failing loudly. Tier 1 still runs --help, but the parsers target Unix conventions while Windows help is /? output with /X switches. Expect near-empty results, not an error message. Native Windows support means a PowerShell reflection path and a /? parser, and is not implemented.


Quick Start

Initialize once and review the generated policy, then run commands through native argv or module JSON:

# Fetch cli-permissions and prepare bindings for matching tools on this machine.
callpact init
# Inspect module IDs, annotations and the generated ACL decisions.
callpact list --verbose
# Review ~/.callpact/acl.yaml before executing or serving commands.
# Default native argv: only for modules reported under native_ready.
callpact exec --dry-run -- ls -la
callpact exec -- ls -la

# JSON alternative when native grammar is unavailable and policy permits.
callpact exec cli.ls

# Optional shell shims: require matching reviewed native grammar.
callpact env --enable
source ~/.callpact/bin/callpact-activate.sh
callpact env --check

# Optional: expose initialized commands to an MCP client with the reviewed ACL.
callpact serve --acl ~/.callpact/acl.yaml

init uses the configured default_overlay_repository, normally cli-permissions. It discovers commands declared by the loaded rules, checks the installed binaries and their variants, and generates local bindings and a starter ACL. It does not install CLI binaries, activate your shell or start a server. Native exec and shims require reviewed native grammar; initialized modules without it remain usable through module JSON when their ACL and approval checks permit.

Repeat callpact init to discover newly installed covered tools while preserving existing bindings. Use callpact init --refresh to update the selected rules and regenerate unchanged bindings owned by init. The report identifies skipped commands, fallback coverage, preserved bindings and resolved Git commits. config --show displays configured values; a repository URL there does not mean initialization has completed.

init writes its starter policy with the developer profile: readonly modules are allowed to every caller, destructive and network-reaching modules are denied to every caller, and the local caller may additionally run cli.* above those denials. Anything else falls through to default_effect: deny. Run callpact acl init --profile strict when nothing should be granted implicitly. Existing manual rules and policy defaults are preserved. The current native pilot covers BSD cat/head/ls: GNU scanning support does not imply native eligibility, and initialized modules without matching grammar stay usable through module JSON when their checks permit. See the Quick Start guide for the full workflow.


Integrations

Agent hosts: shell/hook first, Skill fallback

callpact setup installs shims and offers to configure detected hosts. OpenCode and pi can use callpact-sh directly, Codex uses login-shell PATH shims, and Claude Code uses a PreToolUse hook. Follow Shell Integration to configure the host and verify an ordinary command in a fresh agent session.

For hosts without shell or hook integration, follow the Agent Skill fallback. The project selects the bindings and ACL, and the Skill routes external commands through explicit callpact exec. Contributors can use the maintainer verification procedure for controlled three-scenario tests. Generated per-module Skills complement this shared route.

MCP client snippets

Print a client configuration with callpact serve --show-config. The snippet carries the rest of the command line (--bindings-dir, --prefix, --tags, --acl, --name, the governance toggles), so pass the flags you intend to serve with. --auth-token / --jwt-secret are deliberately never included.

callpact serve --show-config claude-desktop --acl ~/.callpact/acl.yaml
# Copy output to ~/Library/Application Support/Claude/claude_desktop_config.json
# Restart Claude Desktop — initialized commands appear as MCP tools

callpact serve --show-config cursor --acl ~/.callpact/acl.yaml
# Add to Cursor's MCP settings

Key capabilities

  • Discover and describe CLI commands — Read --help, man pages and shell completions with 6 built-in parsers (Man, BSD Usage, GNU, Click, Cobra, Clap). Detect the installed variant and apply matching reviewed overlays as a fourth tier. Generate schemas with types, defaults, enums, required fields and argument placement.
  • Initialize from reviewed rules — Acquire and cache external rules from cli-permissions or your own Git source. Pin a revision, work offline, refresh init-owned bindings and preserve custom bindings and existing policy.
  • Execute locally — Use module JSON or eligible native argv, inspect checks with --dry-run, and preserve native streams and child status. PATH shims reuse the local governance path; native eligibility requires explicit reviewed grammar and capabilities.
  • Serve through MCP and A2A — Share the executor across both protocols. MCP offers stdio, streamable HTTP, legacy SSE, structured results, an Explorer UI, client configuration snippets and optional metrics. HTTP-family transports require token authentication by default; JWT supports caller identities and roles.
  • Import HTTP APIs — Load OpenAPI 3.0/3.1 JSON or YAML from a file or URL at server startup. CLI and API modules share validation, filters, configured ACLs and audit records. Specification-fetch, upstream API and client credentials stay separate. See supported proxy operations.
  • Apply policy and record decisions — Generate a default-deny starter ACL, classify readonly/destructive/idempotent/network-reaching behavior, and gate calls on their actual escalating arguments when approval is enabled. Audit executions, refusals and ACL decisions without recording input values.
  • Check paths and bound subprocesses — Always check schema-typed filesystem paths against system and credential boundaries. Execute CLI argv without a shell, scrub captured/server child environments, inherit the caller's environment for local shell execution, enforce timeouts and cap captured output. Servers also offer retry and circuit breaking; local execution disables both.
  • Verify CLI contracts — Detect source drift against the pre-overlay baseline. Optional readonly, isolated and explicitly authorized dry-run cases test concrete invocations; recorded evidence is invalidated by changed bindings, binaries or case files. Verification does not certify every invocation.
  • Support integrations — Configure host shell/hook integration with callpact agent; install the shared Agent Skill as a fallback for hosts that cannot be configured; export YAML bindings and optional per-module Claude Skills, embed the Rust library, and export OpenAI tool definitions programmatically. Structured CLI errors and module guidance help callers inspect and correct failures.

Commands

callpact init

Prepare this machine's bindings and starter ACL from reviewed rules:

callpact init
callpact init --overlays https://github.com/aiperceivable/cli-permissions
callpact init --overlays ../cli-permissions --ref <COMMIT>
callpact init --offline
callpact init --refresh

The default table output shows initialization stages and the tool being scanned as work proceeds, independently of the log level. --format json outputs only the final report.

The former overlays command has been removed. Rules installation, pinning and refresh are part of initialization. config --init only creates a configuration template; it does not prepare command bindings.

callpact list

List registered modules.

callpact list                     # Table format
callpact list --format json       # JSON format
callpact list --available-only    # Only binaries reachable on this machine
callpact list --verbose --format json  # Schemas, annotations and ACL context for agents

callpact exec

Execute reviewed native argv without activation, or a module with JSON input:

callpact exec -- ls -la
callpact exec --dry-run -- ls -la
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

Native mode preserves streams and child status. The JSON property names depend on the binding. Unknown commands default to refusal; --unmanaged allow|approval opts in without overriding the ACL, and unmanaged argv gets no schema-based path checks and a null stdin. Local execution defaults to the local caller and loads ~/.callpact/acl.yaml when present; a malformed policy fails closed. run has been replaced by exec, with no alias, and --as is available only for --dry-run. See the exec reference.

callpact env

Install and activate eligible external-command shims, optionally widening them to scanned routes:

callpact env --enable
callpact env --enable --scanned readonly
callpact env --enable --replace-unowned
source ~/.callpact/bin/callpact-activate.sh
callpact env --check
source ~/.callpact/bin/callpact-deactivate.sh

--scanned off|readonly|all admits bindings without a reviewed overlay; a scanned route replays the validated original argv. --replace-unowned regenerates the reserved callpact-sh and activation helpers after a lost ownership record. --shim-dir selects a custom installation directory.

--enable installs shims and configures startup in one step, detecting the shell from SHELL; use --shell and --rc-file for a custom startup layout. bash, zsh and fish load shims in new interactive terminals; bash and zsh also activate in noninteractive login shells, including Codex terminal calls, and POSIX sh uses . instead of source. No separate eval or rehash is needed. --reload refreshes the command set while retaining the installed binding directory, ACL and filters; with no installation it enables shims using the current settings. Deactivation removes the shim directory from the current PATH and restores CALLPACT_SHIM_DIR without uninstalling anything, and the namespaced helpers stay installed. Unlike a Python venv, sourcing selects governed external commands but adds no prompt prefix: activate the venv first, then CallPact, and deactivate in the reverse order. --check prints PASS, FAIL, WARN and SKIP results plus a summary without executing wrapped commands; failures, including a missing ACL, return status 1, warnings 0.

Shims inherit output streams, preserve exit status and use the same local policy. Only matching authoritative overlays that declare order-independent accepted invocations are eligible; stdin and short bundles require explicit capabilities, and the verified BSD corpus pilot enables cat, head and ls. Builtins, aliases and absolute paths bypass PATH shims. The namespaced helpers are installed with CallPact, so no source checkout is needed. See F8 and the env reference for shell support and activation boundaries.

callpact sh

Run a real shell with the installed shim environment, or diagnose launcher readiness:

callpact sh --check
callpact sh --check --format json
callpact sh -c 'ls -la'
callpact sh --locked --allow-path /usr/bin -c 'ls'

callpact-sh is the stable entry point installed by callpact env --enable for hosts that select a shell by path. --locked restricts command lookup to the shim directory plus explicit --allow-path entries; it is not a sandbox. See the sh reference.

callpact hook

Translate a host pre-tool hook event into a governed execution request:

callpact hook claude
callpact hook claude --persistent

Claude Code PreToolUse Bash calls are rewritten through updatedInput; stateful builtins, pipelines and compound commands rely on PATH shims. --persistent keeps cwd, variables, functions and aliases across calls and is experimental. See the hook reference.

callpact agent

Print or write host configuration for OpenCode, pi, Codex, Claude Code or Antigravity:

callpact agent opencode
callpact agent antigravity --write
callpact agent --check pi --format json
callpact agent opencode --write
callpact agent claude --mcp-only --write
callpact agent antigravity --mcp-only --write --scope user

--write merges into the host's JSON atomically and refuses invalid files; OpenCode and pi also refuse when callpact-sh is not installed. See the agent reference.

callpact serve

Serve CLI modules and optional imported OpenAPI operations through MCP.

callpact serve --acl ~/.callpact/acl.yaml # stdio (default)
callpact serve --transport http --port 8000 --acl ~/.callpact/acl.yaml # HTTP
callpact serve --transport http --port 8000 --explorer --acl ~/.callpact/acl.yaml # HTTP + browser UI
callpact serve --transport sse --port 8000 --acl ~/.callpact/acl.yaml # Server-Sent Events (deprecated upstream; prefer http)
callpact serve --show-config claude-desktop --acl ~/.callpact/acl.yaml # Print integration config (carries the other flags; never a credential)
callpact serve --name my-tools --acl ~/.callpact/acl.yaml # Custom server name
callpact serve --transport http --metrics --acl ~/.callpact/acl.yaml # + /metrics (Prometheus) and /usage
callpact serve --no-circuit-breaker --no-retry --acl ~/.callpact/acl.yaml # Disable resilience middleware
callpact serve --transport http --auth-token "$TOKEN" --acl ~/.callpact/acl.yaml # Pin the bearer token (else one is generated)
callpact serve --prefix cli.git --acl ~/.callpact/acl.yaml # Serve only git tools (not listed AND not callable)
callpact serve --no-log-arguments --acl ~/.callpact/acl.yaml # Drop argument payloads from every log event, errors included

HTTP/SSE transports require a bearer token by default; a token is generated and written to stderr at startup on a loopback bind (not through the log pipeline, so --log-level warn still shows it). --auth none on a non-loopback bind refuses to start without --allow-unauthenticated-bind. stdio is unaffected. See docs/user-manual.md.

Import an OpenAPI document alongside scanned CLI tools:

callpact serve --openapi ./openapi.yaml --openapi-base-url https://api.example.com --acl ./acl.yaml
callpact a2a --openapi ./openapi.yaml --openapi-base-url https://api.example.com --acl ./acl.yaml

OpenAPI 3.0/3.1 JSON or YAML sources may be local files or HTTP(S) URLs. Operations default to the api.* namespace and share schema validation, ACL checks and audit records with CLI modules. Set CALLPACT_OPENAPI_TOKEN for the upstream API credential; --openapi-header is only for fetching the specification. See the OpenAPI guide and runnable API example for flags, proxy limits and tested setup.

callpact a2a

Serve CLI modules and optional imported OpenAPI operations through A2A. Shares configured governance (ACL, logging, audit) with callpact serve via the same Executor. The current SDK advertises A2A 1.0 but has incomplete wire support. Use the authenticated legacy flow.

callpact a2a --acl ~/.callpact/acl.yaml # http://127.0.0.1:8000 (default)
callpact a2a --url http://127.0.0.1:9000 --explorer --acl ~/.callpact/acl.yaml # Custom port + browser UI
callpact a2a --acl ~/.callpact/acl.yaml               # Governed by an ACL policy
callpact a2a --cors-origin https://example.com --acl ~/.callpact/acl.yaml # Allow a browser origin

A2A requires bearer authentication by default. apcore-a2a provides an Authenticator; CallPact wires it through token/JWT modes. Use CALLPACT_AUTH_TOKEN or the generated startup token. --auth none off loopback requires --allow-unauthenticated-bind. JWT subjects and roles reach ACL and audit.

A2A has no interactive elicitation transport, so there is no --enable-approval flag on callpact a2a (it's available on callpact serve, and on A2A only via the library ApprovalStore API). See docs/user-manual.md.

callpact verify

Compare fresh CLI source contracts with the recorded pre-overlay baseline, without replacing bindings. Breaking drift, unclassified changes and missing baselines fail the command. Optional cases test concrete readonly, isolated or explicitly authorized dry-run invocations. Recorded evidence binds outcomes to binding, binary and case digests; overlay provenance remains a separate author claim.

callpact verify --report verification.json
callpact verify --cases readonly-cases.json --record --report verification.json

The ordinary readonly allowlist covers reviewed system cat/head/ls binaries. Other isolated and dry-run cases require executable digest pinning and working OS isolation. See the verification guide for admission rules, evidence scope and invalidation.

callpact config

Show, initialize or update configuration.

callpact config --show     # Print resolved config (YAML)
callpact config            # Same as --show
callpact config --init     # Create ~/.callpact/config.yaml
callpact config set log.level debug  # Update the saved diagnostic log level

callpact paths

Show the filesystem boundary every wrapped tool is checked against, or check one path against it. The summary is read off the installed guard rather than re-derived from config, so it always describes the policy actually in force.

callpact paths                                    # The whole boundary
callpact paths --format json                     # Machine-readable
callpact paths --path /etc/passwd                # Refused to a writer
callpact paths --path /etc/passwd --mode read    # Allowed to a readonly module
callpact paths --path ~/.ssh/id_rsa --mode read  # Refused: credentials bind readers

--path calls the guard's own check — the same call a wrapped tool's argument goes through — so its verdict cannot drift from a real invocation's. See user manual §4.6 and §9.7.

callpact acl

Write, refresh or explain the caller-permission policy. callpact scan produces an inventory of what a command does; this is the only command that turns it into a permission decision.

callpact acl init                     # Starter policy; refuses to overwrite
callpact acl init --profile strict    # Nothing granted implicitly
callpact acl sync --dry-run           # Drift check for CI
callpact acl explain cli.git.status --caller @external

init writes a starter policy once, sync refreshes only the destructive and open-world denials, and explain names the rule that decided a module. See the acl reference.

callpact sandbox

Report the sandbox backend selected for this installation. Delegation is opt-in per module through sandbox.modules; normal execution is unchanged.

callpact sandbox check
callpact sandbox check --format json
callpact exec --dry-run -- find . -name '*.txt'   # Includes the translated plan

check is static: it reports the backend, enforcement level, capabilities, mode, selected modules and reason without running the A/B/C probes. See docs/sandbox.md.


callpact scan <TOOLS>...

Scan CLI tools and generate binding files. Scanning is an inventory step: it does not write the ACL policy.

callpact scan ls jq curl                   # Scan multiple tools
callpact scan git --depth 3               # 3 levels of subcommands (default: 2, max: 5)
callpact scan git --no-cache              # Force re-scan
callpact scan git --format json           # Output as JSON (also: yaml, table)
callpact scan git --output-dir ./out      # Custom output directory
callpact scan git --skills-dir ./out      # Also write .claude/skills/<id>/SKILL.md per module
callpact scan ls --overlay ./ls.json      # Apply a curated overlay instead of trusting the scan

Verify source drift and explicit cases

callpact verify --report ./drift-report.json
callpact verify --cases ./readonly-cases.json --record --report ./verification.json
# Explicitly reviewed and digest-pinned dry-run cases require working OS isolation.
callpact verify --cases ./dry-run-cases.json --allow-dry-run --isolation required --record
# Self-contained temporary CLI demo: dry-run, fixture effects and evidence invalidation.
python3 examples/verification/demo.py --callpact target/debug/callpact

Case modes are readonly, dry_run and isolated. macOS uses sandbox-exec; Linux uses optional bwrap and unprivileged namespaces. Required isolation failures are reported as unverifiable without executing the case. See the verification guide and runnable example.

Tool variants and overlays

A command name does not identify a program: macOS /bin/ls is BSD, Linux /usr/bin/ls is GNU coreutils, Alpine is BusyBox, and Homebrew coreutils puts GNU ls on a macOS box. Every scan probes the binary (<binary> --version) and records the result as variant, then looks for a curated overlay matching (command, variant, version_range).

The vocabulary is bsd, gnu, apple, busybox, unknown. gnu is the whole GNU family, not just coreutils — diffutils, tar, sed and bash are separate projects, and the specific package is recorded in provenance.package and pinned, where it matters, in match.probe.output_contains. apple covers Apple's own ports, whose banner names Apple rather than BSD (macOS sort reports 2.3-Apple (197), git reports (Apple Git-155)).

match.platform, by contrast, is an open string taken verbatim from Rust's std::env::consts::OS — macos, linux, freebsd, openbsd, netbsd, dragonfly, solaris and anything else a host reports. Operating systems are not an enumerable set, so naming a new one needs no CallPact change. There is deliberately no Linux distribution dimension: GNU coreutils ls has the same 83 flags on Debian, Ubuntu and Fedora across three different releases, while BusyBox ls has 21 — divergence tracks the implementation, which variant already captures.

The classification order is load bearing: BSD is tested before GNU, because macOS grep reports grep (BSD grep, GNU compatible) 2.6.0-FreeBSD and is a BSD tool advertising GNU compatibility rather than a GNU tool. Apple is tested only after <arch>-apple-<os> target triples are stripped, because curl 8.7.1 (x86_64-apple-darwin25.0) is not an Apple port. See Authoring Tool Overlays.

An overlay is a reviewed description of one variant of one command. In authoritative mode it replaces the scan's flags, positional args and subcommands entirely; in merge mode it overrides matching flags and adds missing ones. Overlays are the only source that can state conflicts_with, because no help or man page format expresses mutual exclusion machine-readably.

Initialize command coverage with callpact init. Reviewed facts come from cli-permissions; CallPact does not embed a second copy. Validated Git snapshots are cached under ~/.callpact/corpora/. Normal initialization reuses the recorded commit. Selection checks the actual tool variant, platform, version constraints and probes.

callpact init
callpact init --format json
# Refresh rules and bindings originally generated by init.
callpact init --refresh
# Refresh an active shim installation after binding changes.
callpact env --reload

Use init --overlays <SOURCE> to select an HTTPS/GitHub source or local Git repository for that invocation; use init --ref <REF> to pin a revision. For a standing mirror, set default_overlay_repository in config.yaml or CALLPACT_DEFAULT_OVERLAY_REPOSITORY. init --offline uses cached or local rules without network access. An unavailable default source reports degraded fallback coverage; an explicit source or refresh failure exits nonzero.

scan remains available for custom tools and targeted rescans. Its first online use can also obtain the default corpus automatically, and scan --offline prevents that download. Automatic scan acquisition is limited to 10 seconds or the shorter global timeout. Initialization uses the configured Git timeout. See the init reference for preservation, source selection and fallback behavior. Git and CLI binaries are separate prerequisites. An optional corpus manifest.json defines its name, release and overlay directory; legacy repositories use an overlays directory.

For local overlay development, read the working directory directly:

# From the CallPact checkout, with cli-permissions checked out alongside it.
CALLPACT_OVERLAY_DIRS=../cli-permissions/overlays callpact scan ls --no-cache

This includes uncommitted edits without installing a new corpus snapshot. The variable applies only to this scan. Rescan after editing overlays; use callpact env --reload afterward if the eligible native command set changes. For a managed installation from a local Git repository instead, use callpact init --overlays ../cli-permissions: it initializes from committed Git content.

For equally strong matches, overlays are loaded in increasing precedence: a packaged corpus in a well-known location ($XDG_DATA_HOME/cli-permissions/overlays, /usr/local/share/…, /usr/share/…, and Homebrew's prefix on macOS), the managed default corpus, other installed corpora in installation order, each directory listed in overlay_dirs in the order given, ~/.callpact/overlays/*.{json,yaml}, and --overlay <PATH>. overlay_dirs is how a corpus someone else maintains — a team policy repository, a plugin that ships overlays — is consumed without copying files into the operator's own directory; that directory is still read last, so a hand-written local file wins the tie. The format is defined by tool-overlay.schema.json, which lives with the corpus rather than here — CallPact is one consumer of it, not its owner. It describes the command rather than CallPact, so a second implementation can read the same files — see Reading Overlays Without CallPact.

Every emitted flag carries sources and source-derived confidence: high (author-reviewed overlay or completion spec) > medium (two independent heuristic sources agree) > low (a single unconfirmed source). The corpus's legacy verified declaration remains an author claim; it cannot alone earn runtime confidence. callpact verify --cases <PATH> --record earns module metadata.confidence: verified only for passed explicit cases with matching binding, executable and case-file digests. Changes invalidate that evidence. See contract verification for its scope and case modes.

An overlay flag may also declare long_running: true — "this option may make the command never terminate on its own", which is why tail -f hangs an agent until the harness timeout. It reaches the emitted contract as the JSON Schema extension keyword x-apexe-long-running, so an executor can bound the timeout or refuse instead of blocking. The claim is possibility, not certainty: BSD tail -f returns immediately when its input is a pipe.

Writing one. An overlay claiming confidence: verified must carry a provenance block recording how it was checked — which build was consulted, which document was read (man-page / help / vendor-docs), and when. The schema rejects a verified overlay without it, because a verified + authoritative overlay replaces the entire scan result with an assertion nobody can re-check.

Read the flag list off the tool itself, never from memory:

man -P cat ls | col -b                          # BSD / macOS (strips overstrike)
docker run --rm debian:stable-slim ls --help    # GNU coreutils
docker run --rm alpine ls --help                # BusyBox

There is deliberately no callpact overlay verify command. A tool can compare flag names, but not descriptions, conflicts_with, types or enum values — and those are the reason overlays exist. A green check covering only the mechanical half would read as "this overlay is correct".

See Authoring Tool Overlays for the full procedure, including how to cross-check a draft against a reference installation and the traps already hit in practice (of the 38 flags ls shares between its BSD and GNU variants, zero have identical descriptions — never copy one across).


How It Works

CLI binaries
     |
     v
Help / man / completions + matching reviewed overlays
     |
     v
Typed CLI modules --> YAML bindings + starter ACL + optional Claude Skills
                           |
             +-------------+-------------------+
             |                                 |
       exec / PATH shims                   MCP / A2A <--- OpenAPI document
             |                                 |            |
             |                                 |       HTTP modules
             +----------------+----------------+
                              |
                       Shared executor
              schema validation / configured ACL
                approval configuration / audit
                              |
                 +------------+------------+
                 |                         |
          CLI subprocess                HTTP API
       path checks, clean env       imported proxy operation
       direct argv, timeout        upstream call timeout

verify checks stored CLI contracts against fresh source observations and can record evidence for explicit cases. HTTP modules are imported at server startup and are not persisted as CLI bindings. CLI path checks and subprocess controls apply to the CLI branch; remote API data needs its own authorization boundary. See the feature manifest for the implementation map.

Behavioral annotations

Signal Inference
Command list, show, status, get readonly: true, cacheable: true
Command delete, rm, kill, destroy destructive: true, requires_approval: true — needs approval when the gate is enabled
Tool env, xargs, sudo, timeout, nice destructive: true, whatever the name suggests: their arguments are another command
Tool curl, wget, ssh, or subcommand push, clone, login open_world: true
Command accepts --force, -f, --hard, … Marked requires_approval as a ceiling, with the escalating properties recorded — the gate then prompts only for a call that actually sends one
Overlay risk: escalates / executes / benign Human assertion about one flag: goes to the gate when sent / refused outright / exempted from the name list

A scan sees the flags a command accepts; a call carries the flags a caller sent. When the approval gate is enabled, only a call that sends an escalating argument prompts: git log needs no prompt while git log --all does, provided the ACL permits the operation. See user manual §8.

Schema generation

CLI Type JSON Schema
--message "hello" "type": "string"
--count 5 "type": "integer"
--config /path "type": "string", "format": "path"
--url https://... "type": "string", "format": "uri"
--format json\|yaml "type": "string", "enum": ["json","yaml"]
--include a --include b "type": "array", "items": {"type":"string"}

Coverage and limits

Coverage depends on the installed CLI, its discoverable grammar and matching rules. Local exec and shims use the default ACL when present; serve and a2a require an explicit --acl to enforce access control. MCP interactive approval is opt-in with --enable-approval; A2A approval stores are a library integration. OpenAPI import is a server feature; local exec and shims execute CLI commands.

CallPact is not a sandbox. Normal execution runs with the host process's privileges. PATH shims cover eligible external commands and can be bypassed by builtins, aliases or absolute paths. OS isolation for explicit verification cases does not sandbox normal execution. A separate specification, docs/sandbox.md, defines opt-in per-module delegation to an OS/backend sandbox; 0.15.0 implements it for modules listed in sandbox.modules. Its default pair is macOS sandbox-exec (OS, deprecated, canonical paths) and Linux bwrap (the bubblewrap package); systemd-run is system/root only, because its user manager ignores path properties. See the threat model for the boundary and deployment requirements.


Configuration

Resolved in 4 tiers (highest wins): CLI flags > env vars > config file > defaults

callpact config --init    # Creates ~/.callpact/config.yaml
Env Variable Default Description
CALLPACT_BINDINGS_DIR ~/.callpact/bindings Binding file storage
CALLPACT_CACHE_DIR ~/.callpact/cache Scan cache
CALLPACT_LOG_LEVEL warn Diagnostic file log level
CALLPACT_TIMEOUT 30 Captured-execution timeout (seconds)
CALLPACT_LOCAL_TIMEOUT 0 Local passthrough timeout (seconds); 0 means no bound
CALLPACT_SCAN_DEPTH 2 Subcommand recursion depth
CALLPACT_OVERLAY_DIRS unset :-separated extra overlay directories, read before ~/.callpact/overlays
CALLPACT_DEFAULT_OVERLAY_REPOSITORY cli-permissions GitHub URL Rules source for init and automatic scan acquisition
CALLPACT_OFFLINE unset Disable corpus downloads, as --offline

File Locations

Path Purpose
~/.callpact/config.yaml Configuration
~/.callpact/bindings/*.binding.yaml Generated tool bindings
~/.callpact/cache/ Scan result cache
~/.callpact/acl.yaml Access control rules
~/.callpact/corpora/ Validated rules snapshots and ownership catalog
~/.callpact/audit.jsonl Audit trail
~/.callpact/log/callpact.log.YYYY-MM-DD Daily diagnostic logs (UTC; latest 14 files retained)

Examples

See examples/README.md for full details.

Example Description Run
basic Shell script: scan → list → serve ./examples/basic/run.sh
programmatic Rust library: scan → convert → export OpenAI tools → build MCP server cargo run --example programmatic
acl_demo Rust library: role-based ACL rules on CliModule calls via Executor cargo run --example acl_demo
path_guard Rust library: the always-on path boundary — which directories a call may touch cargo run --example path_guard
cli_permissions Scan with the external reviewed command corpus ./examples/cli_permissions/run.sh
local_execution Local execution and optional native PATH shims in a temporary home python3 examples/local_execution/demo.py
verification Isolated case verification and evidence invalidation python3 examples/verification/demo.py
openapi_import HTTP API import through MCP/A2A with ACL enforcement python3 examples/openapi_import/demo.py

Run the self-contained examples from the repository root with Python 3:

cargo build --all-features
python3 examples/local_execution/demo.py --callpact target/debug/callpact
# On macOS, with the reviewed companion corpus available:
python3 examples/local_execution/demo.py --callpact target/debug/callpact \
  --corpus ../cli-permissions/overlays --shims
python3 examples/openapi_import/demo.py --callpact target/debug/callpact
python3 examples/openapi_import/demo.py --callpact target/debug/callpact --remote-spec

The local demo checks preflight, execution, ACL denial and audit in a temporary HOME; --shims also checks a native pipeline and owned uninstall. The OpenAPI demo starts its own local HTTP API and exercises both MCP and A2A, including JSON requests, ACL denial and separate specification/API credentials. See the Quick Start for the walkthrough.


Developer Guide

Build & Test

cargo build                                             # Build
cargo test --all-features --locked                      # Full suite and real CLI parameter gate
cargo test --all-features --examples --locked            # Rust example tests
make check CORPUS=../cli-permissions/overlays             # All quality gates and runnable examples
make test-scripts                                      # Runtime-validator regression tests
cargo clippy --all-targets --all-features -- -D warnings  # Lint
cargo fmt --all -- --check                              # Format check
cargo run --example programmatic                        # Run example

Runtime checks require Python 3.9+, Git and working OS isolation (sandbox-exec on macOS; bwrap and unprivileged user namespaces on Linux). The full example gate requires jq, curl and the reviewed cli-permissions corpus. CI runs the full gates on Linux and macOS and uploads JSON receipts. See the Developer Guide for coverage rules and platform scope.

Ecosystem crates

Built on the apcore ecosystem:

Crate Role
apcore 0.34.1 Module trait, Registry, ACL, ModuleError, Context
apcore-surfaces 0.1.1 Toolkit scanning and writers, HTTP proxying, MCP and A2A servers, man pages and module detail formatting

Adding a Custom Parser

Implement the CliParser trait in src/scanner/protocol.rs:

pub trait CliParser: Send + Sync {
    fn name(&self) -> &str;
    fn priority(&self) -> u32; // lower = tried first
    fn can_parse(&self, help_text: &str, tool_name: &str) -> bool;
    fn parse(&self, help_text: &str, tool_name: &str) -> anyhow::Result<ParsedHelp>;
}

Logging

All commands and governed shims write diagnostics to ~/.callpact/log/, with a warn default and no diagnostic logs on the terminal. Files rotate daily in UTC; the latest 14 files are retained. Command results, errors and necessary operator notices remain visible. Logging does not change the governance audit trail. On Unix, the log directory is private to its owner (mode 0700).

callpact config set log.level info          # Persist the level in config.yaml
callpact --log-level debug scan git         # Override for this invocation
callpact --log-level debug --log-stderr scan git  # Also mirror logs to stderr

Level precedence: --log-level > RUST_LOG > CALLPACT_LOG_LEVEL > config.yaml (log_level) > warn. off disables diagnostic records. Existing configurations keep their saved level until explicitly changed.

Releasing

apdev-rs release handles tagging, the GitHub Release, and publishing to crates.io; pushing the rust/vX.Y.Z tag it creates automatically triggers .github/workflows/release.yml, which builds the prebuilt binaries described in Installation and attaches them to that release. No separate step is needed for a normal release.

To backfill binaries onto a release that's missing them (e.g. one published before this workflow existed), dispatch it manually against the existing tag:

gh workflow run release.yml -f tag=rust/vX.Y.Z

Documentation

Document Description
Documentation hub Choose the user or developer documentation path
Quick Start Initialize command coverage, review the ACL, and connect an agent
User Manual Operator reference — commands, configuration, governance, transports, and troubleshooting
Threat Model What CallPact enforces and what still requires sandboxing or host policy
Security Policy How to report a vulnerability privately, and what counts as one
Basic example Runnable terminal walkthrough with ACL enforcement
cli-permissions example Scan verified POSIX command facts from the external corpus
Changelog Release history and migration notes

Developer and contributor references

Document Description
Developer Guide Library embedding, extension points, and contributor navigation
Programmatic example Rust library API usage
ACL library example Role-based ACL with an explicit apcore context
Authoring Tool Overlays Write and verify a curated overlay
Technical Design v0.1.0 architecture with apcore ecosystem integration
Feature Manifest Module map, crate dependencies, project status
Feature Specs Detailed specifications for features F1-F9

Feature specs

Spec Description
F1: Scanner Adapter ScannedCLITool → ScannedModule conversion
F2: Module Executor apcore Module trait for CLI subprocess execution
F3: Binding Output apcore-toolkit YAMLWriter integration
F4: MCP Server apcore-mcp server builder
F5: Governance apcore ACL wrapper + CallPact's own audit trail
F6: Error Migration CallPactError → ModuleError conversion
F7: Config Integration apcore Config integration
F8: Local Execution Local module JSON, native argv and PATH shims
F9: Sandbox Delegation Opt-in per-module OS/backend confinement in 0.15.0

License

Apache-2.0