Skip to content

CallPact User Manual

Audience: This manual is for people operating callpact from the terminal: initializing CLI coverage, executing commands locally, reviewing policy, exposing CLI and HTTP operations to AI clients, and troubleshooting a deployment. For Rust embedding, parser extensions, overlays, and architecture records, see the Developer Guide.

Field Value
Version 0.17.0
Date 2026-11-15
Platform macOS / Linux

Table of Contents

  1. Introduction
  2. Installation
  3. Quick Start
  4. Commands Reference
  5. Configuration
  6. How CallPact reads a CLI
  7. What agents receive
  8. How CallPact classifies risk
  9. Governance
  10. MCP Server
  11. A2A Server
  12. Integrating with AI Agents
  13. Error Handling and AI Guidance
  14. File Locations
  15. Global Flags, Logging and Debugging
  16. Troubleshooting

1. Introduction

CallPact is a governed execution layer for CLI tools and HTTP APIs, for humans and AI agents. It discovers supported CLI commands, describes their inputs with JSON Schema, and runs them through configured access rules, approval checks and audit records. The same executor serves CLI modules and HTTP operations imported from OpenAPI through MCP or A2A.

Choose a surface according to the work:

Work Surface
Prepare and inspect installed CLI coverage init, list --verbose; scan for custom tools
Run CLI tools from Claude Code, Codex, pi or OpenCode Shell or hook integration, with the Agent Skill as an explicit exec fallback
Execute locally with structured input/output exec <MODULE_ID> with inline, file or stdin JSON
Activate eligible external-command PATH shims env --enable; diagnose with env --check
Expose CLI modules and optional HTTP operations serve for MCP; a2a for A2A; add --openapi for HTTP import
Check CLI source drift and explicit case outcomes verify; add --cases and --record for persisted evidence
Inspect the filesystem boundary or configuration policy, config

The normal CLI workflow is initialize → review → execute or serve. Coverage depends on the installed tool, discoverable grammar and matching reviewed rules. Native exec requires reviewed capabilities. Shims can also use eligible scanned routes selected by the operator. HTTP operations are imported at server startup for MCP or A2A.

Local exec/shims load the default ACL when present. Servers need --acl to apply access control; MCP interactive approval is enabled separately with --enable-approval. Verification evidence covers explicit cases and does not certify all invocations. Normal execution uses the host process's privileges; CallPact does not replace a sandbox. The opt-in sandbox delegation introduced in 0.15.0 confines only the modules listed in sandbox.modules; unselected modules still run with the host process's privileges. See sandbox.md.

CallPact uses apcore for the shared executor and APCore Surfaces for binding and OpenAPI helpers, the MCP and A2A adapters, and --man pages and module detail formatting. See §9.2 for the CallPact audit trail. APCore · APCore Surfaces


2. Installation

Prerequisites

  • Current stable Rust toolchain; CI tests stable, and no older MSRV is declared or tested
  • Cargo (included with Rust)
  • macOS or Linux

Install from source

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

3. Quick Start

See Quick Start Guide for the fastest path to a working setup. If the latest release has no CallPact archive yet, install from source above and start with callpact setup.

curl -fsSL https://raw.githubusercontent.com/apstack/callpact/main/scripts/install.sh | sh
# Installs the binary, prepares rules, installs shims without editing shell
# startup, and offers to configure the agent hosts it finds on PATH.

callpact setup                        # the same preparation without reinstalling
callpact list --verbose               # inspect modules and generated policy
callpact exec cli.ls                  # execute the module with JSON input defaults
callpact serve --acl ~/.callpact/acl.yaml # optionally serve with the reviewed ACL

callpact setup is a convenience, not a second configuration path: it calls init, then env --enable --no-rc, then agent <host> --write for detected hosts. Each of those remains the command that owns its decision, and running it afterwards is how you change just one part.


4. Commands Reference

4.1 callpact scan

Scans one or more CLI tools and generates .binding.yaml files. A scan is an inventory step: it never writes the access policy, which belongs to callpact acl (§4.13).

callpact scan <TOOLS>... [OPTIONS]
Argument / Option Default Description
<TOOLS>... (required) CLI tool names to scan (must be on $PATH)
--output-dir <DIR> ~/.callpact/bindings/ Directory to write binding files
--depth <N> configured scan_depth (normally 2) Subcommand recursion depth (1-5). Explicit flags override configuration; git remote add = depth 2
--no-cache off Force fresh tool scan; does not update the cached overlay corpus
--offline off Skip automatic corpus download; use installed/local overlays and built-in classification. Also settable with CALLPACT_OFFLINE=true
--format <FMT> table Output format: json, yaml, or table
--skills-dir <DIR> - Also write a Claude Skill (SKILL.md) per module under <DIR>/.claude/skills/<module_id>/
--overlay <PATH> - Load one explicit curated overlay file (JSON/YAML). See §6.5 Tool Overlays
--prune off Delete scan-generated bindings for the scanned tools that this run did not write. Only files with the existing apexe prefix in metadata.generated_by are considered
--write-acl off Deprecated. Refresh the policy's destructive and open-world denials after scanning, writing a starter policy only when none exists. scan writes bindings, not policy: use callpact acl init and callpact acl sync
--verify off Fail the command when a written binding does not verify. The YAML verifier runs either way; without this a failure is a warning and the scan still exits 0
--dry-run off Report what would be written — bindings and skills, plus the policy only with the deprecated --write-acl — without creating or overwriting anything

The first online scan automatically installs a validated snapshot of cli-permissions under <config_dir>/corpora, unless local overlay_dirs or an explicit --overlay were configured. Subsequent scans reuse the recorded commit without contacting the network. Matching uses the actual tool variant, platform, declared version constraints and probes; macOS alone does not imply BSD tools.

Failed acquisition, including unavailable Git, produces a warning and falls back to local overlays and built-in classification. With --offline, no automatic installation is attempted; available snapshots are still used. --dry-run never installs a corpus. Automatic Git operations use the shorter of 10 seconds and the global timeout; use callpact init for normal setup under the configured timeout. Use callpact init --format json to inspect sources and identities, and callpact init --refresh to update rules and bindings owned by initialization. Rescan custom tools explicitly to adopt those new facts. --no-cache refreshes tool discovery rather than updating the corpus.

callpact scan git                         # basic scan
callpact scan ls jq curl                  # multiple tools
callpact scan git --depth 3               # deeper subcommand discovery
callpact scan git --no-cache              # force re-scan
callpact scan git --format json           # JSON output
callpact scan git --skills-dir ./out      # also write .claude/skills/cli.git.*/SKILL.md
callpact scan ls --overlay ~/.callpact/overlays/ls-gnu.json  # apply a curated overlay

Scanning writes bindings only. The access policy is a separate document: callpact acl init (§4.13) writes a starter policy once and callpact acl sync refreshes the destructive and open-world denials without touching allow rules. callpact init (and the deprecated scan --write-acl) merges a fresh scan into an existing policy: modules and hand-authored rules from earlier scans are preserved, while a grant whose route the rescanned tool no longer produces is retired. That retirement is what keeps the policy in step with a curated overlay that narrows its declared surface; a plain scan never touches acl.yaml. callpact list --diagnostics reports any grant left without a module.

4.2 callpact serve

Starts an MCP server exposing scanned tools to AI agents.

callpact serve [OPTIONS]
Option Default Description
--transport <TYPE> stdio Transport: stdio, http, or sse (sse is deprecated upstream — see §10)
--host <HOST> 127.0.0.1 Host for HTTP/SSE transports
--port <PORT> 8000 Port for HTTP/SSE transports (1-65535)
--explorer off Enable the browser-based Tool Explorer UI. HTTP/SSE only — on stdio it warns and mounts nothing, since there is no HTTP surface to serve it on
--bindings-dir <DIR> ~/.callpact/bindings/ Directory containing binding files
--name <NAME> callpact MCP server name
--show-config <TARGET> - Print an integration snippet for claude-desktop or cursor and exit — see §12. Any other value is an error on stderr with a non-zero exit
--prefix <PREFIX> - Serve only modules whose id starts with <PREFIX> — excluded modules are not callable either
--tags <TAGS> - Serve only modules carrying every listed tag (comma-separated, AND)
--acl <PATH> - Path to ACL policy YAML file (the per-caller boundary)
--auth <MODE> per-transport token (default for HTTP/SSE), jwt, or none. Ignored for stdio
--auth-token <VALUE> CALLPACT_AUTH_TOKEN Bearer token for --auth token; one is generated and written to stderr at startup if unset
--jwt-secret <VALUE> CALLPACT_JWT_SECRET Signing secret for --auth jwt
--allow-unauthenticated-bind off Acknowledge --auth none on a non-loopback bind (otherwise refused)
--allow-deprecated-sse off Accepted and ignored; the defect it acknowledged was fixed in apcore-mcp 0.18. Hidden from --help, removal planned
--enable-approval off Prompt the connected MCP client for a human decision on every requires_approval module; a client that cannot be prompted is refused — see §9.6
--no-logging off Disable structured logging middleware entirely
--no-log-arguments off Drop inputs/output from every log event, error records included; failures keep a payload-free record
--no-circuit-breaker off Disable CircuitBreakerMiddleware (on by default)
--no-retry off Disable RetryMiddleware (on by default; only ever retries idempotent timeouts)
--metrics off Enable /metrics (Prometheus) + /usage (JSON) — HTTP/SSE only
callpact serve                                        # stdio (Claude Desktop/Cursor)
callpact serve --transport http --port 8000            # HTTP server
callpact serve --transport http --explorer             # HTTP + browser UI
callpact serve --show-config claude-desktop            # print integration config
callpact serve --transport http --metrics               # + /metrics and /usage
callpact serve --no-circuit-breaker --no-retry           # disable resilience middleware

4.3 callpact a2a

Starts an A2A agent server exposing scanned tools, sharing governance (ACL, logging, approval) with callpact serve via the same Executor.

callpact a2a [OPTIONS]
Option Default Description
--url <URL> http://127.0.0.1:8000 Base URL to bind the A2A server to
--bindings-dir <DIR> ~/.callpact/bindings/ Directory containing binding files
--name <NAME> callpact A2A agent name
--explorer off Enable browser-based Explorer UI
--acl <PATH> - Path to ACL policy YAML file
--tags <T1,T2> - Serve only modules carrying every listed tag. Excluded modules are neither advertised nor callable
--prefix <PREFIX> - Serve only modules whose ID starts with this prefix. Excluded modules are neither advertised nor callable
--no-logging off Disable structured logging middleware entirely
--no-log-arguments off Drop inputs/output from every log event, error records included; failures keep a payload-free record
--no-circuit-breaker off Disable CircuitBreakerMiddleware (on by default)
--no-retry off Disable RetryMiddleware (on by default; only ever retries idempotent timeouts)
--execution-timeout <SECS> 300 Per-task execution timeout in seconds
--cors-origin <ORIGIN> - Allowed CORS origin (repeatable)
--auth <MODE> token A2A transport authentication: token, jwt, none
--auth-token <TOKEN> generated Shared bearer credential, or CALLPACT_AUTH_TOKEN
--jwt-secret <SECRET> absent JWT signing secret, or CALLPACT_JWT_SECRET
--allow-unauthenticated-bind off Acknowledge --auth none on a non-loopback URL

No --enable-approval on callpact a2a. A2A has no interactive elicitation transport, so an approval prompt can never be resolved over it; the flag would only ever error. Approval on A2A is a library-only feature — construct A2aServerBuilder with an ApprovalStore. callpact serve keeps --enable-approval, which prompts the connected MCP client for a human decision — see §9.6.

A2A requires bearer authentication by default. apcore-a2a provides an Authenticator, and CallPact now wires token/JWT modes. --auth token generates a startup token when none is supplied. --auth none on a non-loopback bind requires --allow-unauthenticated-bind. The shared token authenticates as apexe-token; JWT preserves its subject and roles for ACL and audit.

callpact a2a                                       # http://127.0.0.1:8000
callpact a2a --url http://127.0.0.1:9000 --explorer  # custom port + browser UI
# A public unauthenticated bind requires both explicit opt-outs:
callpact a2a --url http://0.0.0.0:9000 --auth none --allow-unauthenticated-bind
callpact a2a --acl ~/.callpact/acl.yaml               # governed by an ACL policy
callpact a2a --prefix cli.git.                     # serve only the git modules
callpact a2a --tags readonly                       # serve only readonly modules

4.4 callpact list

Lists all registered modules from binding files.

callpact list [OPTIONS]
Option Default Description
--format <FMT> table Output format: table or json
--bindings-dir <DIR> ~/.callpact/bindings/ Directory to read binding files from
--verbose off Print each module's behavioral annotations and, with --acl, the ACL decision for the --caller identity
--acl <PATH> <config_dir>/acl.yaml if present ACL policy file to evaluate against in --verbose output, and to check for targets that match no loaded module in --diagnostics. Read-only report — does not enable enforcement anywhere
--caller <ID> local Caller identity the --verbose ACL decision is evaluated as. local is what a shim and callpact exec run as on this machine; pass @external for the server-facing answer an unauthenticated callpact serve / callpact a2a client would get. The result is echoed as x-acl-caller, so a report always states which surface it describes
--path-census off Three states for the commands on this machine: granted (bound and allowed for --caller), denied (bound and refused by the policy), unscanned (on PATH with no binding). Reads directory entries and the policy only — it never scans or executes
--diagnostics off Show the scan inventory — routes a curated overlay left out of the declared surface — and, when a policy is loaded, the ACL targets that match no module on disk. See Coverage, policy and access are three gates
--available-only off Only list modules whose binary is reachable on this machine right now. callpact serve/callpact a2a apply this check unconditionally; here it is opt-in so the plain listing still shows everything ever scanned — see Availability Filtering

For terminal agents and CI, callpact list --verbose --format json returns an object with acl_policy and modules. Each module includes id, input_schema, output_schema, available annotations, optional x-confidence / x-verification extensions for validated runtime evidence, and — when a policy is loaded — x-acl-caller, x-acl-effect and x-acl-rule. The decision is evaluated as --caller (local by default), so it agrees with exec --dry-run and env --check on the same machine. This is discovery information; use exec --dry-run to validate a concrete call with its caller. Plain list --format json returns an array of module IDs and descriptions. Successful JSON listings keep these shapes when empty: [], or an envelope whose modules array is empty. Human onboarding messages are emitted only in table mode. --available-only follows the same rule when it filters everything.

Coverage, policy and access are three gates

A route executes only when all three gates admit it, and they are evaluated in this order:

  1. Coverage — is the route part of the declared surface? callpact exec and the shims resolve the invocation against the reviewed grammar first. A route a curated overlay left closed never reaches policy evaluation at all.
  2. Policy — the loaded ACL decides whether this caller may run it.

The consequence is easy to misread when reviewing acl.yaml: an allow there is necessary and not sufficient. A cli.git.log entry left behind by a wider earlier scan does not make git log runnable while the git overlay declares only status. The refusal says so — it names the closed route, asks for a preview commands[] entry plus a rescan, and reports details.layer: coverage in the --error-format json envelope, so it is distinguishable from an ACL denial (general_invalid_input rather than general_internal_error).

callpact list --diagnostics prints both halves of that picture: the routes each overlay left closed, and the ACL targets that match no loaded module. The second list is usually a merge artefact — callpact scan keeps grants for tools it did not touch, and now drops the grants of a tool it did rescan when the route is gone — and it is the one place those dead entries can be seen without reading the policy by hand. A shim does not repeat the finding on every call: it registers only the routes of the command it stands in for, so every other rule in a shared ACL would look dead by construction. --scanned lowers the grammar bar for declared routes; it cannot widen the set.

4.5 callpact config

Shows, initializes or updates CallPact configuration. Without an operation or flag, callpact config prints the same resolved YAML as callpact config --show.

callpact config [OPTIONS]
Option Description
--show Print resolved configuration as YAML
--init Create default config at ~/.callpact/config.yaml

4.6 callpact paths

Prints the filesystem access boundary every wrapped tool is checked against, or checks one path against it. This is the only way to inspect the path guard (§9.7) without standing up a server and driving it with a client.

The policy itself lives in ~/.callpact/config.yaml under paths:. That file is the reference — read it (or the template below), not this page, for the field list. The template describes only what the current release enforces: paths: and annotations:, both read by this release.

docs/config.example.yaml      the shape `callpact config init` writes, fully commented

Its vocabulary is taken from the systems that own these ideas rather than invented: read_only / read_write / no_access are systemd's ReadOnlyPaths= / ReadWritePaths= / InaccessiblePaths=, and write_only is AppArmor's w right. The deepest matching entry decides; a path in no list is read_write.

callpact paths [OPTIONS]
Option Default Description
--path <PATH> - Check this one path instead of printing the whole policy. Resolved exactly as a wrapped tool's argument would be: joined to the working directory, symlinks followed, .. folded afterwards
--mode <MODE> write Access mode --path is checked under: write is what every unannotated module gets, read is the narrower boundary a readonly module is held to
--format <FMT> table Output format: table or json

With no --path, the summary is read off the installed guard rather than re-derived from config.yaml, so it can never describe a policy other than the one in force. It lists the working directory relative paths resolve against, both compiled-in baselines, anything additional_denied_paths added, the allowed_paths carve-outs, and the derived temp-directory exemption.

callpact paths                                   # the whole boundary
callpact paths --format json                     # same, machine-readable
callpact paths --path /etc/passwd                # would a writer be refused?
callpact paths --path /etc/passwd --mode read    # would a readonly module?
callpact paths --path ~/.ssh/id_rsa --mode read  # credentials bind readers too

--path calls the guard's own check, the same call a real argument goes through, so its verdict cannot drift from what an invocation would get. The two modes disagree exactly where §9.7 says they should — a system path is legible to a reader and refused to a writer:

$ callpact paths --path /etc/passwd
DENY   /etc/passwd  (mode: write)
  the given --path resolves to '/private/etc/passwd', which is protected by '/private/etc'
  hint: '/etc/passwd' resolves to '/private/etc/passwd', inside or above the protected
        location '/private/etc'. This is a compiled-in boundary that no configuration
        removes. Choose a path outside the protected system and credential directories.

$ callpact paths --path /etc/passwd --mode read
ALLOW  /etc/passwd  (mode: read)

4.7 callpact exec

Execute a native command with passthrough output, or a scanned module with JSON input and captured output. apexe run has been removed; there is no compatibility alias. Native execution does not require activation or installing shims.

# Native argv: put `callpact` options before -- and child arguments after it.
callpact exec --dry-run -- ls -la
callpact exec -- ls -la
printf 'one\ntwo\n' | callpact exec -- cat | callpact exec -- head -n1

# Module JSON: use the property names in your scanned binding schema.
callpact exec cli.ls --input '{"file":["."]}'
callpact exec cli.ls --input '{"file":["."]}' --dry-run --as ci
# File or stdin JSON; both use the same validation and governance.
callpact exec cli.ls --input-file request.json --dry-run
cat request.json | callpact exec cli.ls --input-file - --error-format json
Option Default Description
--input <JSON> {} JSON object for module mode; conflicts with native argv
--input-file <PATH> none Read a JSON object from a file, or stdin when PATH is -; conflicts with --input and native argv
--bindings-dir <DIR> configured bindings directory Binding files to load
--acl <PATH> <config_dir>/acl.yaml when present Missing explicitly requested files and malformed policies fail closed
--dry-run off Report schema, ACL, approval, path-guard decisions and planned argv without execution
--as <CALLER> local Simulate a caller; accepted only with --dry-run
--unmanaged <deny\|allow\|approval> deny Native mode only: policy for commands with no registered CLI binding; loaded ACL still applies

Native mode uses the same reviewed grammar, route selection and argv reconstruction as PATH shims. A matching authoritative overlay, current scan format and consistent capabilities are required. It checks the executable resolved from the clean PATH against the binding; an absolute executable path is accepted when it identifies the same binary. Installed shim directories are excluded from lookup. Known commands with invalid arguments, unavailable or ineligible bindings, ACL denials or removed installed routes never fall back to unmanaged execution. Rescan when the executable or its grammar changes.

Native stdout and stderr pass through unchanged; module mode prints the captured JSON result. Both modes preserve normal child exit codes. On Unix, passthrough reports 128 + signal for signal termination; captured module mode reports exit_code: -1 in JSON and the CLI process exits with status 255. Diagnostics go to the log files by default; --log-stderr mirrors them to stderr. Failures remain visible on stderr. Pipes, redirections, wildcards and && are handled by the calling shell, not interpreted by exec. Use one exec call per pipeline stage that needs governance. Child flags such as --help, --man or --timeout belong after the separator.

Real execution uses the fixed local ACL caller. No ACL file means no access control, with a warning. Timeout, the captured-environment allowlist and audit remain active. Dry-run prints mode (module, native, or unmanaged) and governance checks; ACL-denied plans omit binary and argv details. Invalid governance checks produce nonzero exit status. Command lookup and native grammar errors are reported on stderr before a plan can be produced.

approval_required reports the preflight approval requirement; for flag-derived annotations it can be a static ceiling. The execution gate weighs the actual arguments and may stand down when none escalate. Native local execution prompts on the controlling terminal (/dev/tty) and accepts y/yes; a non-interactive stdin is refused with a remedy instead of blocking. Captured module execution has no interactive client, so a call that still needs approval is refused. Dry-run can inspect the requirement but cannot obtain approval. --as is an asserted simulation identity. See the execution surfaces below for stdin behavior. Stdin is not validated by the argv policy; see the Threat Model.

Execution surfaces

Surface Child I/O and timeout Approval and sandbox
Reviewed native and installed PATH shims Inherited stdin and output streams; local_timeout defaults to 0 (no deadline). Local terminal approval where required. Local sandbox policy can select these modules.
Explicit unmanaged passthrough Null stdin, inherited output streams, local_timeout. No schema-based argument path checks. Local approval when required; sandbox policy can select the unmanaged.<basename> ID.
Module-mode exec Null stdin and captured output; default_timeout is 30 seconds by default. No interactive approval. Local sandbox policy can select these modules.
MCP and A2A subprocesses Null stdin and captured output; configured execution and transport limits apply. A2A has a separate task deadline. MCP approval needs a capable client or store; A2A CLI has no interactive approval. The CLI's local sandbox configuration does not apply.
Imported OpenAPI operations HTTP proxy request and response, not subprocess I/O. Protocol approval rules apply. No local subprocess sandbox or path guard.

Passthrough uses the inherited environment subject to the denylist; captured subprocesses use the scrubbed allowlist. See Sandboxing for each backend's capabilities and enforcement limits.

Explicit unmanaged execution

By default, commands absent from the bindings are refused. Opt in per call:

# Requires ACL permission for unmanaged.my-tool when an ACL is loaded.
callpact exec --unmanaged allow -- my-tool --version
callpact exec --unmanaged approval --dry-run -- my-tool --version

Unmanaged calls use module ID unmanaged.<executable-basename> and the same executor, local caller, ACL, approval gate, timeout, environment policy and audit. allow does not override an ACL denial. Review and add a rule for that module ID when your ACL defaults to deny. approval requires a human decision: local native execution prompts on the controlling terminal and refuses when stdin is not a terminal.

Unmanaged argv is passed literally without schema reconstruction. No argument path typing is available, so schema-based path checks do not apply; dry-run reports path_guard_available: false. stdin is null. This mode can run arbitrary programs, including ones that launch other commands, and needs an external sandbox when used by an agent. It does not certify an unknown command as safe.

These policies apply to calls through callpact exec. Activating PATH shims still leaves uninstalled commands, builtins and shell functions outside CallPact; use an external execution boundary to require agents to enter through exec.

4.8 callpact env

The installed source helpers enable governed external-command shims, configure automatic activation in future terminals, and activate the current terminal. Use the installed CallPact binary in bash or zsh; no repository checkout is required:

callpact scan cat head ls --no-cache
# Write a starter policy once (skip this if ~/.callpact/acl.yaml already exists).
callpact acl init
# Review ~/.callpact/acl.yaml, then install the shell helpers once.
callpact env --enable
source ~/.callpact/bin/callpact-activate.sh
callpact env --check
printf 'one\ntwo\n' | cat | head -n1
ls -la
# Remove owned shims/startup blocks and restore the current terminal.
source ~/.callpact/bin/callpact-deactivate.sh
# Automatically re-enable and activate using the same installed helper.
source ~/.callpact/bin/callpact-activate.sh

POSIX sh uses . instead of source. Source the files in the terminal you want to change; running them with bash or sh changes only that child process's environment. The source helpers support sh, bash and zsh. For fish and PowerShell, use the shell-specific setup below.

Option Default Description
--enable off Create or update eligible shims, source helpers and managed shell startup blocks
--reload off Refresh an existing installation using its stored settings; automatically enable when absent
--disable off Remove owned shims and managed startup blocks; retain namespaced shell helpers; succeeds when already disabled
--check off Diagnose installed shims, current PATH resolution, bindings and ACL without executing commands
--rc-file <PATH> detected startup file Configure an explicit startup file with --enable or --reload
--no-rc off Install shims without touching shell startup files, and remove blocks a previous installation left behind. Use it when the host selects callpact-sh (callpact agent <host> --write), so only the agent's shell is governed
--shim-dir <DIR> <config_dir>/bin Directory for command links and their routing manifest
--bindings-dir <DIR> configured directory Binding snapshot to install from
--acl <PATH> default ACL when present Explicit policy path to store in the manifest
--tags <TAGS> absent Require every listed tag
--prefix <PREFIX> absent Restrict the eligible module IDs
--scanned <off\|readonly\|all> off Also route bindings without a reviewed overlay. readonly admits only readonly, non-destructive, closed-world modules; all admits any current binding
--also <NAMES> absent Admit these shim commands even when --scanned excludes them. Comma-separated command names (node,python3), matched against the name the shim installs. This is how an interpreter is governed without taking all: node is neither readonly nor destructive, so readonly skips it. The name overrides the annotation gate only — never the structural checks (current scan format, usable command path, reachable binary). Every admission the policy would have refused is reported by env --enable and env --check
--exclude <NAMES> absent Refuse these shim commands even when the policy admits them
--shell <SHELL> detected for --enable; sh for printed activation Choose sh, bash, zsh, fish or powershell

--enable detects the shell from SHELL and integrates startup configuration with shim installation. Startup blocks are validated before links are installed. An unknown shell requires an explicit --shell. The startup block activates only when the CallPact executable and shim manifest exist. Once enabled, use native commands directly; there is no per-command or per-terminal setup to repeat.

--no-rc drops the startup half and leaves the operator's own terminal ungoverned. Login-time tooling (pyenv, nvm, brew) shells out to rm, ln, sort and similar before the interactive session exists; with the shim directory on PATH at that point, those calls resolve through the policy and fail wherever a rule denies one — a pyenv rehash interrupted this way leaves its prototype behind and every later login reports it. A host that selects callpact-sh reaches the shims without any startup block, so --no-rc is the setting to use when the governance boundary is the agent rather than the human shell.

--enable also names the commands whose whole surface is a heuristic subcommand tree. A shimmed command validates the caller's argv against the scanned grammar and refuses anything outside it rather than forwarding it, so a tree the scan did not read completely fails ordinary calls closed: git rev-parse --show-toplevel was reported as an undeclared flag, one invocation at a time. Single-route tools are not listed — one help block is a surface the scan reads in full — and the report gives the route count for the ones that are. --exclude <command> is the way to leave one ungoverned instead of discovering the gap at call time. Use --reload when newly scanned eligible tools or subcommands change the shim list or routing, or when changing the prefix/tag filter. For example, adding reviewed ls to an installation previously covering cat and head needs reload. Existing bindings are read during execution, so parameter descriptions or schemas alone normally do not require rebuilding the shim list.

--also and --exclude name individual commands and outrank the scanned policy in the direction they state. They persist in the manifest, so the activation script's env --reload keeps them, and a --reload without them retains the stored names for the same reason it retains the prefix and tags. Re-running env --enable without them clears them: --enable rebuilds the filter from its own arguments.

--scanned widens coverage beyond reviewed overlays. A scanned route parses and validates the caller's argv against the scanned schema, then executes the original argv; it never rebuilds or reorders the command line. Schema inference is not a reviewed contract, so path-guard coverage for arguments the scanner did not type may be incomplete. Use readonly for the conservative subset and all only after reviewing the bindings. callpact sh --check lists scanned routes separately from verified ones.

--scanned is a coverage filter, not a permission gate: it decides which unreviewed commands get a shim at all, while the ACL decides which calls a caller may run. --also adds commands to that coverage by name, so --scanned readonly --also rm installs an rm shim while the manifest still records readonly as the policy. That grant is legitimate — the operator named the command — but it must not be silent, so env --enable prints each command admitted this way with the annotation the policy would have refused (destructive, open-world, not readonly, or the scanned policy is off), and env --check reports POSTURE <command> for the same set. The readonly label is not protection for a command --also named; the ACL is where permission lives. --also also cannot make a structurally ineligible binding eligible: a stale scan format, an unusable command path or an unreachable binary is refused regardless of the name.

For an existing installation, reload retains its binding directory, binding pattern, explicit ACL path, prefix, tags, --also/--exclude names and scanned policy unless command-line options override them. It preserves startup files by default and does not need shell detection. An explicit --shell or --rc-file also updates startup configuration. When there is no installed manifest, including after disable, reload automatically performs enable with the current settings and flags. The source helpers also activate the current terminal immediately; a direct --enable or --reload call requires sourcing a helper or opening a new terminal.

Shell Default startup file
zsh .zshrc and .zprofile under $ZDOTDIR, or under ~ when ZDOTDIR is unset; covers interactive and noninteractive login shells
bash ~/.bashrc and the first existing login file among .bash_profile, .bash_login, .profile; creates .bash_profile if none exists
fish $XDG_CONFIG_HOME/fish/config.fish, or ~/.config/fish/config.fish
sh / dash ~/.profile, loaded by login shells
PowerShell Requires --rc-file "$PROFILE" in the target PowerShell host

Use absolute ZDOTDIR and XDG_CONFIG_HOME paths. For custom shell startup layouts or multiple installed shells, configure each explicitly:

callpact env --enable --shell zsh
callpact env --enable --shell bash --rc-file ~/.config/bash/interactive.rc
callpact env --enable --shell powershell --rc-file "$PROFILE"

Enabling preserves unrelated text, existing file permissions and startup file symlinks. It is idempotent and records ownership in <shim-dir>/.apexe-shell-init.json. Disable removes only the recorded blocks, preserving user edits outside them and leaving startup files in place. A managed block changed by hand is refused; restore or remove that block before retrying.

For Codex CLI with zsh, use callpact env --reload --shell zsh, then restart Codex so its shell snapshot reflects the updated startup files. This also upgrades installations that previously configured only .zshrc, retaining the installed bindings, ACL and filters. Codex's ordinary /bin/zsh -lc calls then activate shims through .zprofile, after system PATH setup; commands need no per-call wrapper. Use --shim-dir for a custom installation. Setting SHELL=callpact-sh alone does not select Codex's shell. This integration was checked with Codex CLI 0.145.0 on macOS, with shell snapshots both enabled and disabled; later user startup code can still change PATH.

New terminals calculate activation using their current PATH. An CallPact subprocess cannot modify the parent shell, so source a helper to change an existing terminal. --enable and --reload install two namespaced files in <shim-dir> (default ~/.callpact/bin), even when CallPact itself is installed in ~/.cargo/bin:

source ~/.callpact/bin/callpact-activate.sh
callpact env --check
source ~/.callpact/bin/callpact-deactivate.sh

callpact-activate.sh reloads the installed settings, automatically enabling when absent, then activates the current terminal. callpact-deactivate.sh — and the deactivate alias beside it — removes the shim directory from the current PATH and restores the previous values of CALLPACT_SHIM_DIR and APEXE_SHIM_DIR, leaving the installation and any PATH entries added after activation in place, the way deactivate leaves a Python virtualenv on disk. Uninstalling is callpact env --disable, a separate command: a per-shell helper that removes every shim, the entry point and the startup blocks is one keystroke away from being run by accident, and the damage reaches terminals and agent hosts the caller never mentioned. Repeated activation preserves that original snapshot, including unset and empty values; sourcing deactivate twice is harmless. No separate eval or rehash is required. New-terminal startup and eval "$(callpact env)" also save the environment so the same deactivation script can leave the shell. Both namespaced scripts and their ownership record remain installed after disable, including manual callpact env --disable, so they can be sourced again without a checkout. For an older installation, run callpact env --reload once to generate the current helper paths in bin; previously installed helpers outside the shim directory are left untouched.

If the installation record itself is lost while callpact-sh or the activation helpers remain on disk, nothing proves which of those files CallPact wrote, and callpact env --enable refuses to touch them. --reload and --disable read the same record and fail the same way, so the installation cannot be repaired without deleting files by hand. The --replace-unowned flag states that those reserved names (callpact-sh, callpact-activate.sh, callpact-deactivate.sh) may be regenerated in that state:

callpact env --enable --replace-unowned

Command shims that are links to the CallPact binary are recovered without the flag, because the link itself shows what wrote it. A file sitting on a command name is never replaced, whatever else is missing.

These scripts work like Python venv activation by changing the current shell. CallPact prepends command shims, while venv selects Python. The full namespaced paths distinguish the two; CallPact does not define or replace the venv's deactivate function, change VIRTUAL_ENV or add a prompt prefix. Activate the venv before CallPact, then deactivate CallPact before the venv so the saved PATH is restored in order:

source .venv/bin/activate
source ~/.callpact/bin/callpact-activate.sh
# Use commands in the combined environment.
source ~/.callpact/bin/callpact-deactivate.sh
deactivate

The scripts use the installation's absolute executable and shim directory. Their ownership record is <shim-dir>/.apexe-source-scripts.json; modified files, symlinks or invalid records are refused before reload. Enable and reload regenerate missing owned helpers. For compatibility, they also create <shim-dir>/activate and <shim-dir>/deactivate, recorded in the shim manifest; disable removes these compatibility files. activate, deactivate, callpact-activate.sh, callpact-deactivate.sh and .apexe-source-scripts.json are reserved names in the shim directory. Repository scripts/activate.sh and scripts/deactivate.sh are optional development conveniences, requiring CallPact on PATH.

For custom shim directories, both scripts and their ownership record are installed directly in that directory. Enable/reload prints their full paths:

callpact env --enable --shell zsh --shim-dir "$HOME/.callpact/custom-bin"
source "$HOME/.callpact/custom-bin/callpact-activate.sh"
callpact env --check --shim-dir "$HOME/.callpact/custom-bin"
source "$HOME/.callpact/custom-bin/callpact-deactivate.sh"

The helper selects its recorded shim directory even before CALLPACT_SHIM_DIR is set. Pass installation options such as --acl, --tags and --prefix to callpact env --enable or --reload before sourcing it. After disable removes the manifest, re-enabling uses the current configuration and command-line defaults; set nondefault bindings, ACL or filters again before activation if needed.

The deactivation helper changes the installation as well as the current shell: it removes the recorded automatic startup blocks and owned shims. If uninstall is refused because an owned file or block was modified, it returns failure and keeps the current terminal environment active. Other open terminals retain their existing environments; reopen them to load the cleaned startup configuration.

--enable and --reload write diagnostics to the log files without printing activation scripts; use --log-stderr to mirror those diagnostics. A direct --disable call cannot restore the parent shell; source ~/.callpact/bin/callpact-deactivate.sh (or the printed custom helper) to restore its saved environment, even after uninstall. --disable also warns when OpenCode or pi still points at the callpact-sh entry point it just removed; those hosts start every command through that path, so they will fail until callpact env --enable restores it or the host setting is removed. With --shim-dir, use the same directory for enabling, reloading and disabling. Enable, reload, disable and check are mutually exclusive operations.

--rc-file requires --enable or --reload.

Check the environment from the terminal where the shims should be active:

callpact env --check
callpact env --check --shim-dir /path/to/custom/shims

The check selects --shim-dir, then CALLPACT_SHIM_DIR, then <config_dir>/bin. It reports [PASS], [FAIL], [WARN] and [SKIP] findings and a summary. Exit status is 0 when there are no failures and 1 when any check fails; warnings alone do not fail the check. It inspects the current process PATH without removing shims, including each command's lookup priority and duplicate directory entries, and validates owned links, executable permissions, compatibility helpers and persistent namespaced scripts with their ownership record. Legacy installations without source scripts receive a warning to reload; recorded scripts that are missing or modified fail the check. The installed executable must match the CallPact executable running the check; when multiple installations exist, run the recorded executable or reload using the intended one. The manifest must contain valid absolute paths and unambiguous command routes. Bindings are loaded using the manifest's directory, pattern and filters, then checked for runtime registration, native executable availability, matching routes and current overlay capabilities. Retained refusal tombstones are reported as failed bindings because those routes cannot execute. A shimmed command whose bindings are only partly installed is reported as [WARN] INHERIT <command> with its installed and available route counts: those are the calls an application that inherits the shim PATH will be refused, so the remedy is part of the warning. See Applications launched from a governed shell.

ACL checks use the manifest's explicit policy, or the current default <config_dir>/acl.yaml when no explicit path was installed. Missing or malformed ACLs fail the check, including an installation running without access control; target naming errors that would prevent runtime startup also fail. Unmatched target patterns produce warnings. Independent checks continue after a failure; checks requiring an unreadable manifest are skipped.

--check does not execute wrapped commands, create configuration directories, write audit records, or change links and shell startup files. Installation options such as --acl, --bindings-dir, --tags and --prefix cannot be combined with it: it checks the installed settings. Shell aliases, functions and command hashes are outside the process's visibility; use type -a in the target shell to inspect those. Successful ACL loading does not prove that a particular invocation will be allowed.

An eligible binding needs a matching authoritative overlay and an explicit cross_flag_ordering: false assertion. Short bundles such as -la and attached short values such as -n20 need short_flag_bundling: true. Inherited stdin needs streaming_stdin_safe: true; otherwise stdin is null. These are reviewed overlay facts, never scanner guesses. Re-scan after updating an overlay: old bindings cannot acquire capabilities just by reinstalling links. Overlay format 1.1 introduces these fields; format 1.0 remains supported for scanning.

The locally verified BSD pilot covers cat, head and ls in the companion corpus. Other entries remain scan-only until their native grammar is reviewed. Unknown flags, unsupported grammar and mutually exclusive options are refused. The parser builds typed JSON, and the executor validates it and rebuilds the actual argv; no unresolved tokens are forwarded. Subcommands route through the original command_path, and a selected subcommand's refusal is final.

stdout and stderr are inherited; there is no JSON envelope or output buffering. A child exit code reaches the shell unchanged; a POSIX signal returns 128 + signal. POSIX children restore default SIGPIPE, so an upstream pipeline stage exits quietly when its reader closes. The captured-output byte cap does not apply to passthrough. ACL, approval, path checks, local environment inheritance and audit stay active. A call requiring approval prompts on the controlling terminal; a non-interactive process is refused with a remedy instead of blocking.

A passthrough call has no wall-clock bound by default. A shim stands in for the command you typed, so node, vim, ssh, npm run dev, a pager and a long test run are bounded by your terminal, not by a timer; killing them mid-flight also truncates inherited output into torn escape sequences. Set local_timeout (or CALLPACT_LOCAL_TIMEOUT) to bound the local surface when it is driven by something that cannot be interrupted by hand. default_timeout still bounds captured execution, where no human is attached. An explicit global --timeout bounds both.

Activation is idempotent. Scanners and wrapped children remove managed shim directories from PATH. Reinstalling updates owned links and refuses name collisions or unowned files. Removed commands remain refusal tombstones until an explicit uninstall; a missing module never falls through to a native binary. Installation uses symbolic links on Unix and hard links on Windows.

Shims cover external commands only. Builtins, aliases, functions and absolute paths can bypass them; a local human gets an audit trail and mistake guard, while enforcement requires an externally controlled PATH and filesystem. Per-call latency measurements and their limits are in the F8 delivery record.

The runnable local execution example uses a temporary HOME and working directory. From the repository root:

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

The default demo checks captured execution, preflight, ACL denial and audit. The --shims variant also checks a native pipeline and owned uninstall.

4.9 callpact verify

Re-scan source help/man/completion contracts without replacing stored bindings. The baseline is captured before overlays are applied, so an authoritative overlay cannot hide a source upgrade. Changes are classified as breaking, additive, cosmetic or review; unparsed source-text changes require review. Breaking, review and unverifiable checks exit nonzero. --strict also fails on additive or cosmetic changes. A missing baseline requires a rescan, never an invented pass.

callpact scan cat head ls --no-cache
callpact verify --report ./verification.json
callpact verify --cases ./readonly-cases.json --report ./verification.json
Option Description
--bindings-dir <DIR> Binding baseline to compare
--depth <N> Fresh scan depth (1-5); defaults to configured scan_depth (normally 2). Explicit flags take precedence
--strict Fail on every detected change
--cases <PATH> Explicit JSON behavioral cases; none execute by default
--overlay <PATH> Reapply an explicit overlay used by the original scan
--report <PATH> Save JSON with binding, binary and case digests; destination must be outside the binding baseline directory
{"allowlist":["cli.cat"],"cases":[{"module_id":"cli.cat",
 "input":{"file":["$FIXTURE/input.txt"]},
 "fixtures":{"input.txt":"hello\n"},"expected_stdout":"hello\n"}]}

Behavioral admission is conjunctive: explicitly allowlisted, readonly/idempotent, non-destructive, no approval requirement and no network boundary. The default readonly case mode uses an independently reviewed binary allowlist is system cat/head/ls; other modules are recorded as unverifiable. String inputs are restricted to fixture paths, selected flags must have literal option spellings, and system cat/head/ls do not accept appended JSON-output flags. Every path operand must reference $WORKDIR or $FIXTURE/name; real paths and long-running options are refused. Each case uses an isolated temporary HOME/work directory and a governed callpact exec child, with a scrubbed environment, a temporary default-deny ACL allowing only the selected readonly module, and bounded timeout. Expected stdout and exit zero must match. A failed case is failed, an inadmissible case unverifiable.

passed is earned for the specific case and hashes in the report. The corpus's legacy confidence: verified remains an author assertion backed by provenance; CallPact caps source-derived flag confidence at high. No case requested means behavioral unverifiable, without failing the drift-only command.

Additional option Description
--allow-dry-run Requires --cases; authorize explicitly reviewed, digest-pinned dry-run cases only
--isolation <MODE> auto (default), required or none; dry-run and isolated modes always require a working backend
--record Requires --cases; write digest-bound evidence for passed cases and unchanged source contracts
callpact verify --cases ./readonly-cases.json --record --report ./verification.json
callpact verify --cases ./dry-run-cases.json --allow-dry-run --isolation required --record
python3 examples/verification/demo.py --callpact target/debug/callpact

readonly is the default case mode. dry_run additionally requires an exact binary_digest, a declared boolean dry_run_parameter set to true, one of the literal switches --dry-run, --check, --noop, --plan or --whatif, and working OS isolation. Its temporary binding authorizes that scoped invocation; normal binding annotations and approvals are preserved. Fixture inputs are read-only. isolated admits explicitly digest-pinned readonly/idempotent, non-destructive, non-networked modules under mandatory isolation, including literal subcommands matching command_path. expected_stderr defaults to empty; optional expected_files checks temporary fixture effects.

macOS uses system sandbox-exec. Linux requires bwrap and enabled unprivileged user namespaces, with read-only system mounts, private network/IPC/PID namespaces and writable case data for non-readonly idempotent cases. required refuses unavailable isolation; auto can fall back only for the independently reviewed readonly binary allowlist. Other platforms report required isolation as unavailable. Cases never run without an explicit case file, and admission failures remain unverifiable.

--record preserves binding documents and writes .apexe-verification/evidence.json beneath the binding directory. Subsequent loads attach metadata.confidence: verified with scope: explicit_cases only when binding, executable, case-file and case digests match. Modified executor metadata, missing/changed case files, executable or verifier updates invalidate evidence. A recording run replaces the snapshot; failed cases cannot retain a previous passed verdict. Corrupt or symlinked records fail loading. Retain the case files for reproducibility and restart servers after revalidation. See the verification guide and runnable example for the full format and trusted local-state boundary.

OpenAPI sources on serve and a2a

See the OpenAPI guide and its runnable MCP/A2A example.

Both servers can import an OpenAPI 3.0/3.1 document at startup, alongside the CLI bindings. Imported operations are HTTP proxy modules, not CLI targets; no generated binding files or helper programs are needed. The import resolves inherited and referenced parameters into the tool schema. Startup validates the selected operations against the proxy's supported encodings. See the OpenAPI compatibility rules.

To run both MCP and A2A against a temporary local API, use Python 3 from the repository root:

cargo build --all-features
python3 examples/openapi_import/demo.py --callpact target/debug/callpact
python3 examples/openapi_import/demo.py --callpact target/debug/callpact --remote-spec

The demo checks path/query parameters, JSON bodies, ACL denial and independent transport/API credentials. --remote-spec additionally checks protected specification fetching with a separate credential.

callpact serve --openapi ./openapi.yaml --openapi-base-url https://api.example.com --acl ./acl.yaml
callpact a2a --openapi https://api.example.com/openapi.json --openapi-prefix api.inventory --acl ./acl.yaml
Option Default Description
--openapi <SOURCE> absent Local JSON/YAML file or exact HTTP(S) specification URL
--openapi-base-url <URL> document servers[0].url Absolute HTTP(S) API base URL
--openapi-prefix <PREFIX> api Canonical apcore namespace for imported operation IDs; getPet becomes api.get_pet
--openapi-header <NAME: VALUE> absent Repeatable specification-fetch header; never forwarded to API calls
--openapi-token <TOKEN> CALLPACT_OPENAPI_TOKEN Upstream API bearer credential; separate from MCP --auth-token

--tags and --prefix filter both sources before serving. Imported operations use the same schema validation, ACL, approval configuration and audit sink. ACL rules may target api.* or individual operation IDs. API operations are marked open_world; DELETE operations also require approval when the approval gate is enabled. --timeout governs specification fetching and proxied requests. Missing origins, malformed documents, registration failures and ID collisions fail startup. The source is read again on each startup; it is not persisted. --show-config preserves the source, base URL and namespace, resolving local sources to absolute paths. Credentials and specification-fetch headers are omitted; supply credentials separately in the client launch environment.

The current SDK proxy handles path parameters, query parameters on GET/DELETE/ HEAD/OPTIONS/TRACE, and JSON bodies on POST/PUT/PATCH. A body method declaring query parameters is refused because the SDK would put them in the body. Multipart uploads, per-input header/cookie parameters and non-JSON responses are outside this initial import surface. The local subprocess path guard does not govern paths on a remote API. Review the imported API's permissions and write operations when authoring its ACL.

4.10 callpact init

Initialize this machine with matching command rules, bindings and a starter ACL. This is the normal first step after installation. config --init only writes a configuration template, and scan <TOOLS> remains the custom scanning entry. The old overlays subcommand has been removed.

callpact init
callpact list --verbose
# Review ~/.callpact/acl.yaml before execution.
callpact exec cli.ls
# Optional native argv and shims: require modules in native_ready.
callpact exec --dry-run -- ls -la
# Optional shell integration or MCP service.
callpact env --enable
source ~/.callpact/bin/callpact-activate.sh
callpact serve --acl ~/.callpact/acl.yaml
Option Default Behavior
--overlays <SOURCE> default_overlay_repository HTTPS/GitHub OWNER/REPO source, local Git repository or corpus archive for this invocation
--ref <REF> stored reference, initially the newest release Select a Git branch, tag or commit; a changed explicit reference fetches that revision. A release archive is selected with --overlays <url>
--refresh off Update the selected rules snapshot and regenerate unchanged init-owned bindings
--offline off Disable network downloads; cached snapshots and local Git sources remain available. Also accepts CALLPACT_OFFLINE=true
--force off Replace an installed corpus that uses the same name from a different source; otherwise init asks on a terminal and refuses in a non-interactive shell
--format <table\|json> table Print initialization results; JSON includes corpora, degraded, warnings, tools, written, preserved, native_ready, binding directory and ACL path

Table output shows progress while preparing rules, scanning each candidate tool and saving bindings and ACL. Each progress line is flushed immediately, even with logging disabled. JSON output contains only the final report.

The initializer resolves the configured source, normally cli-permissions, and loads candidate command names from available rules. It checks executables on a PATH with shim directories removed, then uses the shared scanner to detect variants and match platform, version and probes. Absent commands and unmatched variants are skipped. It does not scan the entire PATH or install programs. Native exec and env still require reviewed native capabilities; a binding alone does not imply native support.

Git snapshots and release archives are validated and stored under <config_dir>/corpora/. Reports include repository, recorded identity and corpus metadata; the identity is the resolved commit for a Git source and the sha256 of the archive bytes for a release, so "which rules are installed" has one answer either way. An optional root manifest.json defines the name, SemVer release and overlay directory; legacy repositories use their basename and overlays/. Repository scripts, Git hooks and submodules are not run by the data installer. Tool help/version/probe calls remain part of scanning.

Normal initialization reuses the recorded snapshot, discovers newly installed covered tools and preserves existing bindings. When the newest release of a GitHub source has no <repo>.tar.gz asset, the first installation falls back to the repository's Git history once and records HEAD; later refreshes keep using Git. If Git also fails, initialization fails and names both attempts. Pass --ref to state the source explicitly. Refresh only replaces bindings that still match the fingerprint recorded by init; custom scans and edited bindings are preserved. No bindings are deleted when a tool or rule disappears. Manual ACL rules, existing defaults and config files are preserved. An invalid existing ACL fails before binding generation. A missing ACL is recreated from available initialized bindings. A new policy defaults to deny. Initialization also leaves shell startup and server enforcement unchanged.

callpact init --overlays https://github.com/acme/team-corpus
callpact init --overlays ../cli-permissions --ref <COMMIT>
callpact init --overlays ../cli-permissions --refresh
callpact init --offline --format json
# Refresh active shim links after binding changes.
callpact env --reload
# Deliberately regenerate a custom or edited binding when wanted.
callpact scan my-tool --no-cache

--overlays does not rewrite configuration. To make a mirror or source the standing default, set default_overlay_repository in config.yaml or CALLPACT_DEFAULT_OVERLAY_REPOSITORY. A commit-pinned source stays pinned until its reference is explicitly changed. Older validated snapshots remain available for concurrent readers. Refresh updates the selected source, not every installed corpus. Cached sources match by repository identity, including installations under an alias; a corpus name alone never substitutes for a newly configured source.

Initialization writes canonical *.binding.yaml filenames. A configured apcore bindings.pattern must include new filenames, or initialization fails before writing bindings or ACL. Existing bindings excluded by the pattern are preserved; the report marks degraded coverage and warns that they are unavailable to execution.

If the default source is unavailable, available local rules are still used. With no usable rules, init reports degraded fallback coverage and scans only cat, head, ls and wc using built-in classification. These bindings have no reviewed native shim contract. Any explicit-source acquisition/validation failure, failed refresh, scan failure or run with no applicable initialized/preserved modules exits nonzero. JSON reports are emitted for completed discovery runs, including partial failures; source/configuration failures can stop earlier with diagnostics on stderr.

For uncommitted local rule development, use overlay_dirs or an invocation-local CALLPACT_OVERLAY_DIRS instead of installing a Git snapshot. Selection precedence and author verification requirements remain documented in Authoring Tool Overlays.

4.11 callpact sh

Run a shell with the installed shim environment, or report launcher readiness. This is the integration point for terminal agents that can be configured to use a shell executable. callpact sh prepares PATH and the CallPact environment variables, then replaces itself with the real shell through exec. It does not parse -c strings, proxy output, or remain in the process tree.

callpact env --enable also installs callpact-sh in the shim directory. Hosts that only accept a shell path can use that absolute path. callpact-sh forwards every argument to the real shell and does not accept CallPact options.

Option Default Behavior
--shell <PATH> CALLPACT_REAL_SHELL, then SHELL when it is not callpact-sh, then /bin/bash or /bin/sh Real shell to execute
--check off Print launcher, entry-point, manifest, ACL, environment-policy and coverage diagnostics, then exit
--format <text\|json> text Diagnostic format; requires --check
--locked off Restrict PATH to the shim directory plus --allow-path entries. Reduces accidental discovery of ungoverned binaries; not a sandbox
--allow-path <DIR> none Extra directory kept on PATH when --locked is used; repeatable
callpact sh --check
callpact sh --check --format json
callpact sh -c 'ls -la'
callpact sh -- /path/to/script.sh
callpact sh --locked -c 'ls'
callpact sh --locked --allow-path /bin -c 'ls'

Local shim execution inherits the caller's environment, so credential helpers that depend on GH_TOKEN, AWS_PROFILE, KUBECONFIG or SSH_AUTH_SOCK keep working. Dynamic-loader variables such as LD_PRELOAD and DYLD_* are removed before the child starts. Child processes started by a governed command keep the shim directory on PATH, so descendant commands can still resolve through the same shims.

Applications inherit that PATH as well. A program started from an activated shell — an editor opened with code ., a GUI launcher, or your own wrapper under a different name — hands the shim directory to everything it spawns, and those calls are refused exactly like a person typing an undeclared route. The command still runs inside CallPact's boundary, but the operator never asked for it: a Git integration that probes git --version and git rev-parse to decide whether a folder is a repository is refused both times and reports "no repository". callpact env --check names the commands where this is possible as [WARN] INHERIT <command>. Deactivating after the application has started does not reach into its process; quit and relaunch it from a deactivated shell, start it through LaunchServices (open -a), or exclude the command from shims. See Applications launched from a governed shell.

--locked is a restricted command search path, not a guarantee. Absolute paths, shell builtins, functions, sudo and interpreters can still run commands outside it. CALLPACT_SHELL_LOCKED=1 and CALLPACT_SHELL_ALLOW_PATH provide the same setting to callpact-sh, which forwards all arguments to the shell.

--check reports a failure when the entry point or manifest is missing. A missing ACL is a warning: shim-routed commands run without access control. It also prints the local environment policy and the dynamic-loader denylist (LD_PRELOAD, LD_LIBRARY_PATH, DYLD_*), so the output shows what a governed child inherits and what is stripped. Bindings that exist but are not shim-eligible are listed as coverage warnings with the reason each was excluded; they are not executed by the launcher. Host configuration snippets are printed for OpenCode (shell), pi (shellPath), Codex and Claude Code.

// opencode.json
{ "$schema": "https://opencode.ai/config.json", "shell": "/home/me/.callpact/bin/callpact-sh" }
// pi settings.json
{ "shellPath": "/home/me/.callpact/bin/callpact-sh" }
# Claude Code: start it with the shim directory already on PATH
PATH="$HOME/.callpact/bin:$PATH" claude

Claude Code 2.1.318 rejects callpact-sh as SHELL or CLAUDE_CODE_SHELL and falls back to /bin/zsh. Its shell snapshot copies the launch environment's PATH, so startup-file edits alone are not enough: activate shims in the launching terminal or set PATH explicitly.

Commands marked requires_approval prompt on the controlling terminal when stdin is interactive; a non-interactive process is refused with the remedy instead of hanging. MCP/A2A keeps its client-based elicitation path. Routes installed with callpact env --scanned execute the original argv after schema validation; --check lists them separately and records tier: scanned in the execution audit.

The launcher only changes command lookup order. Commands with a reviewed shim are governed; builtins, functions, absolute paths, sudo, interpreter-internal execution and commands without a shim are not. Login shells (-l) may rebuild PATH from profile files after path_helper; use the managed startup block written by callpact env --enable. This is not a sandbox and does not guarantee that every command in the shell passes through CallPact.

4.12 callpact hook

Translate a host hook event into a governed execution request. The command reads one JSON event from stdin and writes the host's hook response to stdout. It is intended for hosts that support a pre-tool hook; it is not a shell and does not execute commands itself.

Argument / option Default Behavior
<HOST> required Hook protocol; claude or antigravity
--persistent off Route every shell tool call through a persistent governed shell session, preserving cwd, variables, functions and aliases
# Claude Code PreToolUse hook
callpact hook claude
# Antigravity PreToolUse hook
callpact hook antigravity

--persistent is experimental. It keeps one detached session per host session id and project directory, so compound commands, pipelines and shell state survive between calls; it exits after 30 minutes idle (CALLPACT_SESSION_IDLE_SECONDS) and stops with CALLPACT_SESSION_STOP=1 callpact sh -c stop. See Shell Integration.

For Claude Code, configure it as a PreToolUse hook matching Bash. A simple external command is rewritten to callpact sh -c '<command>' with permissionDecision: "allow"; Claude Code still evaluates its own deny/ask rules against the rewritten command. The original tool_input fields are preserved. A command that is already routed through callpact, the legacy apexe executable or callpact-sh is left unchanged, so the hook does not recurse.

Shell builtins that change session state (cd, export, set, alias, …), pipelines, redirections, command substitution and compound commands are left unchanged: a one-shot callpact sh -c would not preserve their semantics. Those commands continue to rely on the installed PATH shims. The hook denies the call when the shim manifest is missing and tells the operator to run callpact env --enable.

The hook uses updatedInput; the tested Claude Code 2.1.318 release (verified 2026-11-05) executes the rewritten command. Verify the current host version before relying on enforcement; without updatedInput support the hook can only deny or ask.

For Antigravity, configure callpact hook antigravity as a PreToolUse hook matching run_command in .agents/hooks.json or ~/.gemini/config/hooks.json. Simple external commands are rewritten through overwrite.CommandLine with decision: "allow"; pass-through commands exit 0 with empty stdout, and a missing shim manifest returns decision: "deny". See Antigravity integration.

4.13 callpact acl

Writes and explains the caller-permission policy. callpact scan produces an inventory; this is the only command group that turns it into permissions.

Flag Default Meaning
acl init --profile <developer\|strict> developer Grant model for the starter policy. developer lets the local shell run cli.* below the denials; strict grants nothing implicitly
acl init --path <PATH> <config_dir>/acl.yaml Where to write the policy
acl init --force off Replace an existing policy. There is no backup
acl init --stdout off Print the policy instead of writing it
acl sync --path <PATH> <config_dir>/acl.yaml Policy to refresh; it must already exist
acl sync --bindings-dir <DIR> configured Bindings the denials are derived from
acl sync --dry-run off Show what would change and exit non-zero when the file differs — the form a pipeline uses for drift detection
acl explain <module-id> --caller <ID> local Which rule decides this module for this caller
acl explain --path <PATH> <config_dir>/acl.yaml Policy to evaluate
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

acl sync rewrites only the destructive and open-world deny rules. An allow is never generated after init, so a scan can never hand out a permission nobody reviewed, and a newly scanned readonly module does not become a grant.

4.14 callpact agent

Print the supported host configuration, or check the launcher and host configuration without changing any files. This is the quickest way to copy the correct callpact-sh path into OpenCode or pi, and to see the PATH/hook guidance for Codex, Claude Code and Antigravity.

Argument / option Default Behavior
<HOST> required opencode, pi, codex, claude or antigravity
--check off Check launcher readiness, the shim installation's bound ACL and the host configuration
--format <text\|json> text Diagnostic format; requires --check
--write off Write the host configuration instead of printing it; preserves other keys and refuses invalid JSON
--scope <project\|user> project (pi: user) Configuration scope for --write
--mcp-only off Generate an MCP-only deployment instead of shell configuration
callpact agent opencode
callpact agent --check pi
callpact agent --check codex --format json
callpact agent --check claude
callpact agent --check antigravity
callpact agent opencode --write
callpact agent claude --write
callpact agent antigravity --write
callpact agent opencode --mcp-only --write
callpact agent antigravity --mcp-only --write --scope user

--write is atomic and merges into existing JSON. It refuses to overwrite a file that is not valid JSON, and OpenCode refuses when an opencode.jsonc already exists. For OpenCode and pi it also refuses when the installed callpact-sh entry point is missing, because both start every command through that path. Codex has no shell file to write: agent codex --write runs callpact env --reload --shell zsh instead. Claude Code project scope writes .claude/settings.json; MCP-only also writes .mcp.json at the project root and adds Bash to permissions.deny. Antigravity writes a PreToolUse hook to .agents/hooks.json (project) or ~/.gemini/config/hooks.json (--scope user), and --mcp-only --write --scope user merges mcpServers.apexe into ~/.gemini/config/mcp_config.json. OpenCode MCP-only writes a V2 shell deny rule for OpenCode 2.3.0 only after checking for conflicting configuration. See host merge and scope behavior. Codex MCP-only prints a config.toml snippet; pi has no stable MCP-only profile in the tested version. Shell writes require a loadable ACL recorded in the shim manifest. Reload older shim installations to bind an existing default policy. MCP-only configuration requires a loadable ACL and passes its path to serve --acl.

Without --write, the command never touches host configuration. OpenCode and pi output a complete JSON object to merge into their settings file. Codex output describes the login-shell PATH activation that must exist in .zprofile/.zshrc; Claude Code output describes the PreToolUse hook or the launch-environment PATH setup. --check reports a missing host configuration as a warning and fails only when the launcher itself is not ready. Config detection is best-effort: a file that exists but is not configured is reported without its contents.

4.15 callpact sandbox

Report the sandbox backend selected for this installation, or inspect the translation with callpact exec --dry-run. The sandbox is opt-in: only module ids listed in sandbox.modules are confined.

Argument / option Default Behavior
sandbox check -- Report backend, enforcement, capabilities, mode, selected modules and reason
sandbox check --format <table\|json> table Output format
callpact sandbox check
callpact sandbox check --format json
callpact exec --dry-run -- find . -name '*.txt'

Configuration lives in config.yaml:

sandbox:
  backend: auto          # auto | systemd-run | bwrap | sandbox-exec | docker
  default: required      # off | required | auto
  modules: [cli.find]
  external: none         # reserved in 0.15.0
  backends:
    docker:
      image: ""          # required for the docker backend
      network: none
      read_only: true

default: off is the safe default. Under required/auto, a missing backend, an inexpressible policy (write_only on systemd-run/bwrap/docker), a missing Docker image or a translation error refuses before spawn; there is no advisory execution mode. Linux local uses bwrap (the bubblewrap package); systemd-run is system/root only (its user manager ignores path properties); macOS uses sandbox-exec; Docker is an optional container backend. The docker backend is a docker run container; Docker Sandboxes (sbx, a microVM with its own kernel and private Docker Engine) is a separate agent sandbox, not this backend, and is not used by 0.15.0. sandbox check is static; run the A/B/C probes in sandbox-testing.md when accepting a backend.

4.16 callpact setup

Prepare this machine in one step. It orchestrates the commands that own each decision rather than reimplementing them, so setup cannot drift from init, env or agent.

Argument / option Default Behavior
--yes off Configure detected agent hosts without asking
--dry-run off Print the plan — rules, shims, detected hosts — and change nothing
--no-hosts off Prepare rules and shims only
--offline off Use cached rules instead of downloading a release
--force off Replace an installed corpus that uses the same name from a different source
--overlays <SOURCE> configured source Rules repository, local checkout or corpus archive for this run
--ref <REF> none Git branch, tag or commit; a release archive is selected by its URL
callpact setup
callpact setup --dry-run
callpact setup --yes --offline

The steps, in order:

  1. Resolve the configured rules source and write bindings through init. Fresh setup uses the strict starter ACL profile and preserves existing policy choices.
  2. Install callpact-sh and the command shims through env --enable --no-rc, or refresh an existing installation through env --reload. The manifest records the selected ACL. Existing shim settings and startup files are preserved when refreshing.
  3. agent <host> --write --scope user for each detected host that accepts a configuration file. With a terminal, setup asks per host; without one it prints the command instead. --yes writes unprompted.
  4. Codex is reported, not changed: it reads its login shell, so the remedy is callpact agent codex --write, which is the operator's decision.

On a fresh installation, configured hosts and callpact sh use the new shims. Use callpact env --enable to add the shim directory to shell startup.

scripts/install.sh downloads a release, verifies its checksum, installs into ~/.local/bin (never with sudo), and then executes callpact setup.

Installer option Default Behavior
--version <tag> newest release Install one specific release
--prefix <dir> ~/.local/bin Install directory; an unwritable target is an error, never an escalation
--no-setup off Install the binary and stop
--dry-run off Print the resolved download, checksum URL and install path
--yes, --no-hosts, --offline, --force off Forwarded to callpact setup
--overlays <SOURCE>, --ref <REF> configured source Forwarded to callpact setup, so a custom corpus is prepared in the same run

When the script is piped into a shell it reattaches the terminal before callpact setup prompts; without a terminal, setup writes no host configuration.

4.17 callpact corpus

Inspect or remove managed rule corpora. init adds a corpus and a scan never changes the set, so this is the deliberate way to narrow a machine to one source.

Subcommand Behavior
list Name, release version, source (commit or sha256), identity and repository for each installed corpus; --format json for scripts
remove <NAME> Delete the corpus and its snapshots; asks on a terminal and requires --yes otherwise
callpact corpus list
callpact corpus list --format json
callpact corpus remove cli-permissions --yes

Removing a corpus does not delete the bindings it informed: those stay until a later callpact init or scan replaces them, because a binding is a written contract, not a pointer into the snapshot. Re-adding a removed corpus is callpact init --overlays <SOURCE>.

Two installations cannot share a name. A name belongs to the corpus's manifest.json, not to its repository, so a fork that keeps "name": "cli-permissions" collides with the official corpus. The collision is never silent: on a terminal init asks before replacing the installed corpus, and a non-interactive shell requires --force. Leaving it out keeps the existing rules and reports both ways out — callpact corpus remove <name>, or a different name in the new corpus. --refresh only reproduces the source an installation recorded; it cannot replace one corpus with another.

5. Configuration

Configuration resolves in 4 tiers (highest priority wins):

CLI flags  >  Environment variables  >  Config file  >  Defaults

bindings_dir has a fifth tier, and apcore owns it. bindings.dir is apcore's canonical key for the directory holding .binding.yaml files (PROTOCOL_SPEC §9.1.1). CallPact used to carry a second name for the same location, which is the kind of duplication that ends with the two disagreeing, so where an ~/.callpact/apcore.yaml declares bindings.dir, that value beats CallPact's own config.yaml:

--bindings-dir  >  CALLPACT_BINDINGS_DIR  >  apcore.yaml bindings.dir  >  config.yaml bindings_dir  >  default

The two override tiers stay on top because they are per-invocation instructions rather than a second standing opinion. Only a declared value counts: apcore answers ./bindings for a configuration that declares nothing, and taking that would replace CallPact's absolute default with a working-directory-relative path on every machine that merely has an apcore.yaml — callpact scan would write beside wherever you were standing, and callpact serve from elsewhere would find nothing. CallPact logs at info when apcore's declaration is the one that decided.

bindings.pattern is apcore's too, and CallPact holds no copy of it. The glob selecting binding files inside that directory is read from the same apcore.yaml, on the same declared-only terms. There is no callpact config key and no default value here: when nothing declares the key, CallPact passes nothing and the Surfaces Toolkit loader applies the identical canonical default (*.binding.yaml) itself — so there is no second string that could drift. The pattern matches the file name only; * and ? are the metacharacters, and recursion is not expressible through it (CallPact loads one directory, non-recursively).

Binding validation. serve, a2a, and list load bindings in strict mode. Unknown document or entry keys, a missing half of the input_schema / output_schema pair, and non-list tags fail loading with a diagnostic naming the file. Move custom entry fields into metadata, provide both inline schemas, and use a YAML list for tags. Runtime-only auto_schema and schema_ref are unsupported because CallPact loads pure data and constructs its own governed CLI modules. Bindings generated by callpact scan already satisfy these requirements; hand-edited bindings may need these changes.

Config file

Located at ~/.callpact/config.yaml. Create with callpact config --init.

bindings_dir: ~/.callpact/bindings
cache_dir: ~/.callpact/cache
audit_log: ~/.callpact/audit.jsonl
log_level: warn
default_timeout: 30
local_timeout: 0
scan_depth: 2
json_output_preference: true

# Read reviewed command facts from an external overlay corpus. Paths are loaded
# in order; a local ~/.callpact/overlays entry still takes precedence.
overlay_dirs:
  - /opt/cli-permissions/overlays

# Appended to the compiled-in path-guard baselines. See section 9.7.
additional_denied_paths:
  - /srv/production-data

# Carved OUT of those baselines. Empty by default; you own what you open.
allowed_paths:
  - /etc/nginx/conf.d

# Embedded child commands (`find -exec`). `refuse` is the safe default.
child_exec:
  mode: refuse          # refuse | analyze | delegate
  trust_uncovered: []   # bare program names the operator vouches for
Field Type Default Description
bindings_dir path ~/.callpact/bindings Binding file storage
cache_dir path ~/.callpact/cache Scan result cache
audit_log path ~/.callpact/audit.jsonl Audit trail file
log_level string warn Diagnostic file log level: off, error, warn, info, debug, trace
default_timeout integer 30 Captured-execution timeout (seconds): serve, MCP, A2A and module-mode exec. 0 disables the bound
local_timeout integer 0 Local passthrough timeout (seconds) for shims, callpact exec native argv and callpact sh. 0 (the default) means no bound — a terminal, an editor or an agent session is the stop signal
scan_depth integer 2 Default depth for init, scan and verify; explicit scan/verify --depth overrides it
json_output_preference boolean true Prefer a detected, schema-declared JSON switch in newly generated captured-execution bindings
overlay_dirs list of paths [] Explicit local corpus directories; skip automatic downloads and load before personal overlays
default_overlay_repository string https://github.com/aiperceivable/cli-permissions Default initialization and automatic scan source. A GitHub repository uses its newest release archive; other HTTPS mirrors and local Git repositories are fetched with Git
additional_denied_paths list of paths [] Locations to deny in addition to the path-guard baselines (§9.7)
allowed_paths list of paths [] Carve-outs out of the path-guard baselines (§9.7). The only setting that relaxes the guard; you own the consequences
child_exec.mode refuse | analyze | delegate refuse Policy for a command that embeds another program's argv (find -exec). refuse rejects every list; analyze resolves the program to its own module and applies that module's ACL, path and approval gates; delegate does the same and runs each match through the installed child shim, with a scoped delegated approval and the actual path checked
child_exec.trust_uncovered list of names [] Bare program names the operator vouches for when no binding exists. Skips coverage and child-argument analysis; the parent approval is the only remaining gate. Every use is recorded as a child_exec audit event (trusted_unanalyzed) and logged

Embedded child commands (find -exec)

A command like find . -exec rm {} \; runs a second program whose argv is not find's grammar. CallPact refuses every such list by default: letting the parent call admit it would hide the child from its own ACL, path policy and approval gate. Set child_exec.mode: analyze (reviewed and native grammar only) to have the child resolved and gated:

  1. the program is resolved through the reviewed bindings, and the binary the analysis checks must be the binary the parent will run (the child PATH is pinned to the real one, without shim directories);
  2. the child argv is parsed against that module's schema;
  3. the child call runs its real preflight — ACL, path policy, approval — for the same caller;
  4. {} is checked as the parent call's starting paths at the child's access mode. When {} is a positional operand and the child module declares end_of_options, -- is inserted before the child's first positional operand — not before {}, which may be a later operand or a flag value — so a matched file named -rf is a path, not an option. A {} in a flag value gets no separator;
  5. one terminal prompt covers the parent and any child that requires human approval. If none requires approval, execution needs no prompt. The parent execution is audited; the child analysis is a child_exec audit record (with the parent trace), including a refused row for a refused analysis, and in delegate the child shim adds its own execution record and the grant id.

delegate adds per-match governance on top of that. The parent launches with the selected shim directory first in PATH and passes a short-lived grant to its children. Each match re-enters the shim and checks the prepared child binding, arguments, starting paths and selected ACL. The shim reruns the ACL and path guard against the actual {} path, including symlink resolution and -execdir's working directory. Only a completed terminal approval for the prepared child can satisfy a per-match approval requirement. The ordinary execution scope carries no approval and cannot satisfy a new requirement. An absent terminal, a refusal or a prompt timeout leaves no usable grant. The grant file is 0600 in a 0700 directory, expires after 30 minutes, and is removed when the parent execution finishes or times out.

The effective decision is the intersection of the parent's gates and the child's. find /etc -exec rm {} \; is refused at write strength even when find and rm are both allowed; find . -exec rm {} \; runs only when the caller may call rm, the path policy allows the starting tree, and the prompt is answered.

What it does not do — and what must stay refused or move to a confinement backend:

  • programs that compute their own paths (sh -c, sed 'w /etc/x', python -c), or any child whose module is not reviewed;
  • in analyze, per-match filesystem effects after the analysis: {} is checked as the starting roots, not each expanded value, and a symlink is not resolved. delegate checks the actual resolved path per match, including symlinks and -execdir, but neither mode confines what the program does after that check (TOCTOU);
  • child subprocesses and network behaviour.

delegate requires the child program to be installed as a shim; without it the call is refused (use analyze, which runs the real binary directly). A destructive child such as rm is left out of the default shim set, so install it explicitly with callpact env --enable --also rm. It is the mode for -execdir, symlinks and per-match paths; it is still not enforcement — a child that computes its own paths is refused in both modes.

The module-JSON surface (--input/MCP/A2A) refuses an exec-list even when the mode is analyze or delegate: that surface has no analyzer, so it cannot make the promise the native surfaces make.

trust_uncovered is the explicit exception: it admits a bare program name for which no binding exists, skipping analysis. It is empty by default, reported at startup when non-empty, and every use is recorded as trusted_unanalyzed and logged. It is not a safety claim.

A list that arrives through --input/MCP/A2A is refused even with analyze: that surface has no analyzer, and admitting it there would make the mode a false promise.

json_output_preference applies when scan or init generates bindings. A preference records json_flag and the corresponding schema default. Execution renders that default through the normal argument guards and respects explicit inputs, including json: false, alternative output modes and declared conflicts. It does not infer switches from examples alone or turn an output-file argument into a format selector. Native exec and shims keep native output unchanged. After changing the setting, rescan the affected tools or use init --refresh for unchanged init-owned bindings; custom or edited bindings stay preserved.

The key set above is closed. A key CallPact does not read is ignored, and a startup diagnostic names the key and the one it was probably meant to be. Read the log files or use --log-stderr to display it:

WARN Ignoring unrecognised config key 'additional_denied_path' -- did you mean
     'additional_denied_paths'? It has no effect. That path-guard setting is
     NOT in force.

The last sentence appears only for additional_denied_paths and allowed_paths, because those are the two whose loss changes what the process will permit: a misspelled additional_denied_paths leaves only the path-guard baseline in force, and nothing else in the run would tell you.

An unrecognised key does not stop CallPact or discard the rest of the file — the remaining keys still apply.

Upgrading from apexe

New installations use ~/.callpact. If that directory does not exist, CallPact continues using an existing ~/.apexe directory, including its ACL, bindings, and audit trail. The old apexe-sh, apexe-activate.sh, and apexe-deactivate.sh names remain available after reloading the installation. Existing binding keys such as x-apexe-flag retain their spelling.

Rust consumers should update imports to callpact. To keep existing use apexe::… statements while upgrading Cargo dependencies, declare apexe = { package = "callpact", version = "0.17" } in the consumer's Cargo.toml.

Environment variables

Use the CALLPACT_ prefix for new configuration. For each setting, CallPact reads the matching APEXE_ variable only when the CALLPACT_ variable is unset. A set but empty value takes precedence, so CALLPACT_OVERLAY_DIRS= clears the old overlay list. Explicit command-line flags retain their existing precedence.

Variable Overrides Example
CALLPACT_BINDINGS_DIR bindings_dir /opt/apexe/bindings
CALLPACT_CACHE_DIR cache_dir /tmp/apexe-cache
CALLPACT_LOG_LEVEL log_level debug
CALLPACT_TIMEOUT default_timeout 120
CALLPACT_LOCAL_TIMEOUT local_timeout 600
CALLPACT_SCAN_DEPTH scan_depth 3
CALLPACT_OVERLAY_DIRS overlay_dirs /opt/cli-facts/overlays:/srv/team-policy
CALLPACT_DEFAULT_OVERLAY_REPOSITORY default_overlay_repository https://example.com/team/cli-permissions.git
CALLPACT_OFFLINE scan --offline true

CALLPACT_OVERLAY_DIRS is :-separated like PATH, and replaces the config file's list rather than appending to it, as every other variable here does. Empty segments are dropped, so a stray leading or trailing : does not resolve to the working directory.


6. Scanning Engine

CallPact uses a three-tier deterministic scanning engine. No LLM is involved.

A scan that matches a curated overlay reports tier 4 (§6.5). The three tiers below are the ones that read the binary; tier 4 is a human-reviewed description applied on top of what they found, so a tool with no matching overlay tops out at tier 3.

Tier 1: --help Parsing

Runs <tool> --help and auto-detects the help format. Six built-in parsers, tried in the order below:

Parser Detects Examples
Man A --help that is actually a man page (NAME + SYNOPSIS at column 0) every git <subcommand> — git log --help runs man git-log
BSD Usage Single-line bundled usage (BSD/macOS built-ins that reject --help) ls, cat, chmod, sort (macOS)
GNU Standard GNU-style help ls, grep, curl, git (GNU/Linux)
Click Python Click / argparse aws, pip
Cobra Go Cobra framework, including grouped Docker command lists and typed Options/Global Options kubectl, docker, gh
Clap Rust Clap framework ripgrep, fd, bat

Extracts: subcommands, flags (long/short), positional args, types, defaults, enum values, descriptions. Each extracted flag records source confidence (high > medium > low); verified is earned module evidence for explicit cases through callpact verify --record, rather than a scan-source label.

Tier 2: Man Page Enrichment

Parses man <tool> output — both GNU (OPTIONS section) and BSD (options listed inside DESCRIPTION) layouts:

  • DESCRIPTION section: Enriches commands that have sparse descriptions (< 20 chars).
  • OPTIONS section: Contributes flags directly to global_flags (not just enrichment) — this is what makes tools whose --help is a single bundled usage line (most BSD/macOS built-ins) scan to a full flag list instead of zero.
  • EXAMPLES section: Hand-written invocations are extracted into ScannedCLITool.examples / CommandContract.examples — the only human-reviewed usage a scan can reach, since flag parsing alone can't say which flag combinations make sense together.

Tier 3: Shell Completion Discovery

Parses zsh/bash completion scripts from standard paths: - /usr/share/zsh/functions/Completion/_<tool> - /usr/local/share/zsh/site-functions/_<tool> - /etc/bash_completion.d/<tool>

Discovers subcommands that Tier 1 missed and merges them into the result (added as stubs with a warning).

Subcommand Discovery

For tools with subcommands, CallPact recursively runs --help on each subcommand up to --depth levels. For example, with --depth 2:

git --help          → discovers: commit, push, remote, ...
git remote --help   → discovers: add, remove, show, ...

Caching

Scan results are cached in ~/.callpact/cache/. Cache entries are keyed by tool name + variant + version (<name>@<variant>_<version>.scan.json), so a machine with both BSD /bin/ls and Homebrew's GNU ls caches them separately instead of one overwriting the other. Use --no-cache to force a fresh scan.

6.4 Tool Variant Detection

Every scan probes the binary (<binary> --version) and classifies it into ScannedCLITool.variant:

Variant Example
bsd macOS system /bin/ls, /usr/bin/grep
gnu Linux coreutils, Homebrew GNU tools on macOS
apple Apple-authored ports (sort, git shipped with Xcode CLT)
busybox BusyBox-based Linux (Alpine, embedded)
unknown Version probe inconclusive

The same command name can be a different program depending on the host, and BSD/GNU/Apple builds of the same tool frequently expose different flag sets — variant detection is what lets a scan (and a matching overlay, see below) pick the right one.

6.5 Tool Overlays

An overlay is a curated, human-reviewed description of one tool variant, keyed by (command, variant, version_range). CallPact ships no overlays itself. The independently maintained cli-permissions corpus contains reviewed POSIX-core and sed variants, and CallPact automatically obtains and consumes a cached snapshot at scan time.

  • mode: authoritative replaces the scan result for that command entirely.
  • mode: merge keeps the scan as the base and only overrides the flags the overlay declares — a gap in the overlay degrades to the scanner's answer instead of erasing a real flag.
  • confidence: verified requires a provenance block (platform, version, source document, date) recording how the overlay was checked; the schema rejects a verified overlay without it.
  • Overlays are the only source that can express conflicts_with (mutually exclusive flags) and long_running (a flag that may block indefinitely, e.g. tail -f) — no --help/man format expresses either machine-readably.
  • Overlays can also override behavioral annotations (readonly/destructive/idempotent/requires_approval/open_world) for a specific command. open_world is the one inference reads off a name list rather than the command's own surface, so it is the one an overlay most often has to correct: GNU sed runs s///e as a shell command while BSD sed rejects the flag, and the name sed cannot tell them apart.

The default corpus needs no separate install step, but automatic acquisition never changes the set of installed corpora: if any managed corpus is installed, a scan uses it and does not also fetch the configured default. Adopting a new default is an explicit callpact init. Install another managed corpus with callpact init --overlays <REPOSITORY>, load one explicit overlay with callpact scan <tool> --overlay <PATH> (JSON or YAML), add a corpus directory through overlay_dirs or CALLPACT_OVERLAY_DIRS, or place a local correction under ~/.callpact/overlays/. The format is defined by tool-overlay.schema.json, which ships with the corpus rather than with CallPact. That schema still pins 1.0/1.1; the commands[]/global_flags 2.0 surface is a preview accepted by this build only. See the cli-permissions example for an operator walkthrough, docs/overlay-consumers.md for reading overlays from outside CallPact, and docs/overlays.md for the full authoring and verification procedure — writing a verified overlay from memory instead of a real installation is exactly what it warns against.


7. Schema Generation

Each scanned flag/argument becomes a JSON Schema property.

Type Mapping

CLI Type JSON Schema Example
String "type": "string" --message "hello"
Integer "type": "integer" --count 5
Float "type": "number" --ratio 0.5
Boolean "type": "boolean" --verbose
Path "type": "string", "format": "path" --config /etc/app.yaml
URL "type": "string", "format": "uri" --url https://...
Enum "type": "string", "enum": [...] --format json\|yaml\|table

Special handling

  • Required flags: Added to the schema's required array.
  • Repeatable flags (--include a --include b): Wrapped as "type": "array", "items": {...}.
  • Default values: Included with type-correct coercion ("10" becomes 10 for integers).
  • Boolean defaults: false unless explicitly set.
  • Format hints: Path and URL types emit "format" so AI agents can distinguish paths from plain strings.

Output Schema

Tools with detected JSON output flags get an enhanced output schema:

{
  "type": "object",
  "properties": {
    "stdout": { "type": "string" },
    "stderr": { "type": "string" },
    "exit_code": { "type": "integer" },
    "json_output": { "description": "Parsed JSON value, when available" }
  }
}

The result envelope remains an object. json_output accepts any JSON value, including arrays, strings, numbers, booleans and null, while stdout retains the original text. Unparseable output omits json_output. This concerns output; module input still requires one JSON object. Older generated bindings that restrict json_output to an object need a rescan, or init --refresh for unchanged init-owned bindings, before returning other JSON roots. Custom binding schemas remain authoritative and must describe the command's actual output.

7.1 Contract Keywords

A generated schema is valid JSON Schema, plus a set of x- extension keywords that carry what a JSON Schema cannot say about a command line: which literal to render, where in argv it goes, and what the executor must refuse. They are extension keywords rather than constraints on purpose — follow: true is a perfectly valid value, and what these tell an executor is how to render it or whether to refuse, not that the input is malformed.

Read this table if you are writing an MCP client against CallPact, consuming callpact scan --format json, or authoring an overlay.

Keyword Where Value Meaning
x-apexe-flag property string The literal spelling the executor renders for this property (--message, -maxdepth). The long form when a flag has both
x-apexe-positional property integer This property is a positional operand, not a flag. The integer is its order among operands
x-apexe-flag-position property "before-operands" | "before-subcommand" Where this flag goes. before-subcommand is derived for a subcommand's inherited global flags; before-operands is a curated assertion and is never overwritten by the derived rule
x-apexe-operand-position property "before-flags" This operand precedes every flag. Set for find's paths, whose grammar is find path … [expression] — both variants reject the other order outright
x-apexe-path property true The value is a filesystem path, so the path guard (§9.7) resolves and checks it. Emitted for ValueType::Path; a value the scan did not type as a path is not checked
x-apexe-value-optional property true The flag's value is optional (--color[=WHEN]), so the executor must render --flag=value rather than two argv entries. Paired with a union type so both spellings are expressible
x-apexe-opaque-after property true This token and every one after it are forwarded verbatim, because the tool stops interpreting there. On the last, variadic operand it covers node <script> <argv for the script>; on a flag it covers python3 -m <module> <args for the module> and python3 -c <code> <argv for the code>, where the tail starts at the flag's value rather than at a positional. Either way the parser stops validating, so a script's own flags are not measured against the interpreter's grammar. Execution still forwards the caller's original argv. The tail still lands in the declared operand, so a path-typed operand puts those tokens to the path guard like any other value
x-apexe-tail-parsed property true This operand starts a trailing mini-language that is parsed, not forwarded: find path … [expression]. The boundary is the first token matching a declared trailing flag (options marked x-apexe-flag-position: "before-operands" stay ahead of the leading operand); every token from there is resolved against the declared flags, so -delete reaches the approval gate and x-apexe-writes-with sees the write. A token no flag explains refuses the call and names the token. A command list such as -exec is declared with x-apexe-exec-list and governed by child_exec.mode (refused by default). A shim validates the call and replays the caller's argv verbatim, so no token is reordered and the route needs no cross_flag_ordering claim; the module-JSON path still renders it. Valid only on the last, variadic operand, with every earlier operand marked x-apexe-operand-position: "before-flags". Distinct from x-apexe-opaque-after on purpose; declaring both is refused
x-apexe-tail-literal schema root array of strings Non-dash tokens a parsed tail may contain — find's (, ), !, ,. They are neither flags nor operand values, so they are declared separately: one opens the tail like a flag, and inside it they are skipped while every flag is still resolved. ;, + and {} are refused, because they are -exec's terminators and skipping one would let -exec utility ; run a program. Root-level like x-apexe-end-of-options, because they punctuate the whole expression
x-apexe-exec-list property true This flag introduces another program's argv, ended by ; or + (find -exec rm {} \;). The resolver collects the tokens instead of classifying them as this command's flags; the child-execution policy decides whether the list may run. With child_exec.mode: refuse (the default) every list is refused; with analyze or delegate, the program is resolved to its own module and that module's ACL, path policy and approval apply (delegate re-enters the child shim per match so the actual path is checked). A list that reaches the module-JSON surface without that analysis is refused. Requires the tool's own invocation, a parsed tail and the flag in approval_flags
x-apexe-digit-value property true A bare -<digits> token is this flag's value, as in head -20 / tail -20. At most one property per command may carry it. Declared only by an overlay that probed the binary: neither man page documents the spelling, and -N is not one rule (git log -5 counts commits, ls -5 is invalid)
x-apexe-conflicts-with property array of property names Flags that must not be sent together — whether the binary diagnoses the pair or silently resolves it last-one-wins. A JSON object has no key order, so for a last-wins pair which flag wins would otherwise be unpredictable
x-apexe-long-running property true This flag may not terminate on its own (tail -f). Bound the timeout or refuse; it is not a reason to reject the input
x-apexe-escalates property true | false Three-state with absence. true sends the call to the approval gate when that parameter is present — a flag, or an operand an overlay marked with risk; false is a human overruling the name list for this parameter; absent defers to the name list (§8)
x-apexe-exec property true The value is a command the wrapped tool will run. The executor refuses any call that fills it (§8)
x-apexe-end-of-options schema root true The tool honours the -- separator. Root-level because -- describes the whole invocation, not one property. Permits a --leading value and tells the executor where to emit the separator
x-sensitive property true The value is credential-bearing, so the logging middleware redacts it (§10). Note the different prefix — this one is apcore's, not CallPact's

Two more live on the module's annotations, not the schema, and are written together by the converter:

Key Value Meaning
x-apexe-computes-paths true The command computes filesystem paths inside its own logic (sed 'w /etc/x', awk system(...), python -c), so its argv is not the whole story. The child-execution analysis refuses such a module instead of treating the argument paths as complete; it needs a confinement backend or an explicit trust decision
x-apexe-approval-basis "flags" requires_approval was set because the command accepts an escalating flag, not because it is destructive by name — so the gate may stand down (§8)
x-apexe-overlay-undeclared array of property names (metadata) Recorded on a module when an overlay's approval_flags/writes_with named properties the module does not declare. The lists are dropped — conservative, because a trigger that can never fire would check a writing call at read strength — and this is where that fact is visible, since a log line nobody reads is indistinguishable from silence
x-apexe-writes-with array of property names Narrow the path guard's access mode per call: when none of these properties is set, the call's path arguments are checked at read strength even though the module is not readonly. It can only narrow, never widen, so a module that writes without them must not carry the key — sed is the standing example (sed -n 'w /etc/x' file writes with no flag at all). Without the key the module is checked at write strength, which is the safe direction
x-apexe-escalating-params array of property names Which properties those are. A "flags" basis without this list is a corrupted annotation, and the gate prompts rather than standing down

A binding written by an older CallPact carries only the keywords that existed then. Re-scan with --no-cache to pick up new ones — upgrading CallPact does not rewrite bindings already on disk.


8. Behavioral Annotations

CallPact infers behavioral annotations from the command's name, from the tool it belongs to, and — for approval only — from the arguments an individual call actually sends.

Command Name Patterns

Annotation Trigger Patterns
readonly list, ls, show, get, status, info, version, help, describe, view, cat, log, diff, search, find, check, inspect, display, print, whoami, env, top, ps
destructive + requires_approval delete, rm, remove, destroy, purge, drop, kill, prune, clean, reset, format, wipe, erase
idempotent get, list, show, status, info, describe, version, help, check
cacheable (readonly AND idempotent)

Command Executors Outrank the Name Lists

An executable whose arguments are another command to run is classified destructive whatever its name says: env, xargs, nice, ionice, nohup, timeout, chroot, setsid, stdbuf, script, watch, time, sudo, doas, su.

This is not a refinement. env is in the readonly list above, and BSD env takes -S "rm -rf /etc" — a string it splits into argv and executes. Marking these destructive flips the generated ACL from allow to deny and makes the path guard judge their arguments as a writer's. It does not make them safe: nothing can statically decide what argv a caller-supplied string becomes. See threat model §5.9, which recommends keeping them out of the registry entirely.

Approval Escalation Is Per Call, Not Per Command

A scan sees the flags a command accepts; a call carries the flags a caller sent. Only the second is a reason to interrupt a human, so the two are kept apart:

Stage What it does
Scan A command that accepts any of --force, -f, --hard, --recursive, -r, --all, --prune, --no-preserve-root, --cascade, --purge, --yes, -y is marked requires_approval as a ceiling, and the schema properties carrying them are recorded in x-apexe-escalating-params, with x-apexe-approval-basis: "flags" saying the mark came from accepted flags alone
Call With --enable-approval, the gate (§9.6) reads that list against the arguments actually sent and prompts only if one of them carries an effective value. Otherwise it stands down, recording approved_by: "apexe-approval-gate" so an audit reader can tell it from a human's yes

Example: git log accepts --all, so the binding is marked requires_approval. A plain git log sends no escalating argument and runs without a prompt; git log --all prompts. git push --force prompts; git push alone does not. A command marked destructive by name has no such basis recorded and always prompts — no absent flag makes rm safe.

There is no --dry-run → idempotent boost. It existed and was removed: a command that accepts --dry-run does not run dry, so the boost made cacheable true for a mutating command whenever the caller left the flag off, and the next reader was served a cached result for a call that changed something. Nothing consults idempotent at invocation time, so there was no per-call hook to move it to. Use an overlay's annotation_overrides to assert it for a specific command.

Flag Risk

Three assertions an overlay can make about one flag, which no --help format expresses and no scan can infer. Help text does not distinguish --exec-path=<path>, which sets a search path, from --upload-pack=<cmd>, which runs one — both read as "takes a value" to every parser.

risk Meaning Effect Contract keyword
absent / none Nobody has said The name list above decides —
benign A human checked; the name list is wrong here Escalation suppressed for this flag only x-apexe-escalates: false
escalates Sending it changes the operation's blast radius Goes to the approval gate, but only when actually sent x-apexe-escalates: true
executes The value is a command the tool will run The call is refused, not gated x-apexe-exec: true

escalates reaches the flags no name list generalizes — nothing about the string --privileged suggests danger. benign goes the other way, because the name list matches on spelling and spelling is sometimes a coincidence: bsdtar -y is bzip2, sort -f folds case, cut -f selects fields, and none of them mean "force".

executes is a different claim rather than a louder one. CallPact's central guarantee is that argv reaches execve with no shell on the path; a flag whose value becomes a command hands that guarantee back, and no JSON Schema constrains what the string becomes. So such a parameter is refused with ACL_DENIED before anything spawns — there is nothing for a human to approve, because approving would mean predicting what an arbitrary string will do. Known members include git --upload-pack / --receive-pack, tar --use-compress-program, rsync -e / --rsync-path, and find -exec / -ok.

See docs/overlays.md for how to verify a risk claim before asserting it.

Risk / open_world

Risk is derived from annotations plus an open_world signal — the executable itself (curl, wget, ssh, scp, rsync, …) or a networked subcommand of an otherwise local tool (push, pull, fetch, clone, deploy, login, …). Precedence when a command matches more than one: destructive > open-world > readonly. This is name-based, so it's a floor rather than a guarantee — an overlay's annotation_overrides is the way to assert the truth for a specific tool that doesn't fit the pattern.


9. Governance

9.1 Access Control (ACL)

callpact acl init writes ~/.callpact/acl.yaml once, from the scanned modules and a named profile, using a default-deny model. callpact scan does not write it: a scan produces an inventory (which routes exist, what each does), while the policy decides who may run them, and only callpact acl writes the policy.

Command Writes When to run
callpact scan <tool> bindings only whenever a tool or its version changes
callpact acl init [--profile developer\|strict] a starter policy, once after the first scan; refuses to overwrite an existing file
callpact acl sync the destructive and open-world denials, nothing else after scanning tools whose annotations changed; safe in CI
callpact acl explain <module-id> [--caller X] nothing when a call is refused and you want to know which rule decided

--profile developer (the default) adds one rule below the denials: callers: ['local'] may run cli.*. The local shell means this machine's shims and callpact exec — the human at the keyboard — so installing a tool is the grant, and a module the scanner could not classify stays usable instead of falling to default_effect: deny. Unauthenticated serve/a2a clients (@external) are unaffected by that rule. --profile strict omits it: every grant is one you write yourself.

Only acl sync's two deny rules are ever regenerated, because a generated denial can only restrict. An allow is never generated after init, so a new scan cannot hand a caller a permission nobody reviewed. Matching corpus annotations override the built-in name-based inference; a mismatched or absent overlay does not grant access on its own. The corpus describes command capabilities, rather than caller permissions. New ACLs use the following rules:

Module type Default rule
Readonly modules that stay local effect: allow
Destructive modules effect: deny, unconditional (no conditions: key)
Open-world modules (git push, git fetch, curl, …) effect: deny, unconditional
All others Default deny (no explicit rule)

The three generated lists are disjoint. Destructive annotations take precedence over readonly annotations, so contradictory labels never auto-allow a destructive module. Separate hand-authored rules and the existing default_effect are preserved when scanning again. Automatically managed target lists are recalculated for the current scan; put persistent operator restrictions in separate rules before broader allow rules. open_world disqualifies a module from the auto-allow rule even when it is readonly: readonly says the command does not modify local state and says nothing about what it sends, and a read that reaches the network is the exfiltration shape rather than the safe one. A module that is both destructive and open-world is listed once, under destructive.

The open-world rule denies what default_effect: deny already denied by silence, so it changes no decision on a stock policy. It earns its place twice over regardless: it still denies under default_effect: allow, where silence would have become blanket network access, and it gives network reach one place to be granted — an operator who wants git fetch back edits this rule instead of discovering by trial which module ids were denied by nothing but the absence of a rule. It is deliberately not allow + approval: required: that is the other defensible reading, but it loosens the shipped default, which is a choice to make explicitly rather than inherit from a generated file.

ACL format (editable):

default_effect: deny
rules:
  - callers: ["*"]
    targets: ["cli.git.status", "cli.git.log", "cli.git.diff"]
    effect: allow
    description: "Auto-allow readonly git commands"
  - callers: ["*"]
    targets: ["cli.git.clean", "cli.git.reset"]
    effect: deny
    description: "Block destructive git commands"
  - callers: ["*"]
    targets: ["cli.git.push", "cli.git.fetch", "cli.curl"]
    effect: deny
    description: "Block open-world CLI commands by default"

9.1.1 Wrap a CLI and enforce its ACL

Use this sequence when introducing an existing CLI to an agent. It produces bindings, lets you review the policy against the modules actually generated, and then enables the reviewed policy on either transport:

# Scan commands on PATH. This writes bindings, not policy.
callpact scan git
# Write a starter policy once; refuses to overwrite an existing file.
callpact acl init

# Show modules and the decision the ACL makes for the served anonymous caller.
callpact list --verbose --acl ~/.callpact/acl.yaml

# Review and edit the policy before relying on it.
${EDITOR:-vi} ~/.callpact/acl.yaml

# Serve the same bindings through MCP or A2A with ACL enforcement enabled.
callpact serve --acl ~/.callpact/acl.yaml
# Or:
callpact a2a --acl ~/.callpact/acl.yaml

The generated policy is a starting point, not an authorization decision made for your environment. By default it permits local readonly modules and denies destructive, open-world, and unclassified modules. For example, a scan of Git will normally permit cli.git.status, cli.git.log, and cli.git.diff, while denying cli.git.reset, cli.git.clean, cli.git.push, and cli.git.fetch. An operator can grant a narrowly selected module by adding it to an allow rule; place narrow deny rules before broad allow rules because evaluation is first-match-wins.

--acl is the switch that attaches the policy to the Executor. Omitting it does not mean “use the generated default”; it means no ACL is enforced. The path guard remains active either way, so a path-typed argument still cannot write a protected system location or read a credential store.

Current served-identity limitation: callpact serve and callpact a2a do not populate a distinct Identity or role set for each network caller. Rules that use roles or identity_types are useful when embedding the Executor with an explicit apcore Context, but do not currently provide per-user RBAC over CallPact's built-in MCP or A2A commands. Use the generated module-level allow/deny rules, --prefix/--tags, transport authentication where available, and the path guard as the current served boundary.

9.1.2 A wrapped tool is not a shell pipeline

Each generated module executes exactly one scanned binary with a direct argv array. CallPact does not parse shell source, spawn a shell, or connect one module's stdout to another module's stdin. A | in an input value is just an argument byte; it cannot create a pipeline. The child receives stdin from /dev/null.

This is intentional: accepting ls | grep secret as shell text would bypass the binding contract and make ACL, argument validation, path checks, and audit records ambiguous. For now, an agent must make separate tool calls and use the first result in its own reasoning. A future pipeline feature must be a declarative, no-shell graph whose every stage is a scanned module and receives its own ACL, path-guard, timeout, output-limit, and audit decision; it must not be emulated with sh -c.

A deny rule must be unconditional to deny. apcore registers exactly five condition keys — identity_types, roles, max_call_depth, $or, $not. Any other key is treated as unsatisfied, so the rule never matches and the call falls through to the next rule or to default_effect. Earlier versions of this manual showed the destructive-deny rule carrying conditions: {require_approval: true}; copied verbatim under default_effect: allow, that rule denies nothing and the destructive command runs. CallPact logs the reason when it happens:

WARN apcore::acl: Unknown ACL condition 'require_approval' — treated as unsatisfied

The ~/.callpact/acl.yaml that CallPact generates has always been correct; only the manual was wrong. There is no ACL condition that means "ask a human first" — approval is a separate layer (§9.6), not an ACL condition.

Rule ordering is first match wins, not most-specific-wins: an allow rule for cli.* placed before a deny rule for cli.rm lets cli.rm through. Put the narrow denials above the broad allows.

A denial says why on both transports. Over MCP the caller gets:

[ACLDenied] Access denied: caller 'None' cannot access module 'cli.cp'

Over A2A the task lands in TASK_STATE_REJECTED carrying its refusal class in status.message, and the JSON-RPC error carries a governance-specific code:

-32040  Access denied: caller 'None' cannot access module 'cli.cp'

apcore-a2a 0.6 answers a governance refusal with its own code — -32040 access-denied, -32041 approval-denied, -32042 approval-timeout — instead of the -32001 Task not found and -32603 Internal server error earlier versions used. That distinction is what an agent should branch on: the code itself now says stop and pick a different skill, where Task not found used to invite a retry of the one thing that was fine.

Authenticated A2A returns the fixed per-class string (Access denied), naming no caller, target or rule. disclose_refusal_reason is disabled to preserve the boundary between principals. Explicit --auth none and an unauthenticated library builder retain the detailed reason shown above. A2A JSON-RPC notifications (requests with no id) produce HTTP 204 with an empty body; explicit id: null requests still receive replies. The current SDK's legacy streaming method uses statusUpdate / artifactUpdate wrappers. The Agent Card's supportedInterfaces advertises 1.0, but the current server does not implement the entire advertised wire contract; see the compatibility flow.

The same applies to an approval denial and an approval timeout (§9.6); an approval pending is untouched and still arrives as TASK_STATE_INPUT_REQUIRED carrying its approval_id.

audit.jsonl remains the record of what was decided and why (§9.2), with decision: deny, the matched rule index and the same trace_id the caller saw — the response now agrees with it instead of pointing elsewhere.

9.2 Audit Trail

~/.callpact/audit.jsonl records both the calls that ran and the calls that were refused. Discriminate on event; trace_id joins a record to the corresponding tracing line and to the ACL entries below.

A call that reached the wrapped binary — event: "execution":

{
  "timestamp": "2026-08-20T01:24:04.535Z",
  "event": "execution",
  "trace_id": "a09dfb2ab24d4faab69b222c52aac5e4",
  "caller_id": "@external",
  "module_id": "cli.cp",
  "status": "success",
  "exit_code": 0,
  "duration_ms": 3
}

A call the governance stack stopped — event: "refusal". error_code replaces exit_code, since nothing ever ran to exit:

{
  "timestamp": "2026-08-20T01:20:34.532Z",
  "event": "refusal",
  "trace_id": "71a7bbc6e5f44437a97441952755d9a5",
  "caller_id": "@external",
  "module_id": "cli.cp",
  "status": "refused",
  "error_code": "APPROVAL_DENIED",
  "duration_ms": 0
}
  • Refusals are recorded regardless of --no-logging. That flag governs the tracing stream; turning the operational log down must not turn the audit trail off. A caller probing the argv guards produces one refusal row per attempt either way — the sequence an audit exists to capture.
  • caller_id is the authenticated principal, or @external for an unauthenticated inbound request (apcore's canonical name for one). It is omitted entirely rather than guessed when the call names nobody at all. Resolved from Context::identity first and Context::caller_id second, and the order matters in both directions: Context::caller_id names the calling module in a nested chain, so preferring it would report the wrong thing for an authenticated call — but apcore 0.31 stopped synthesizing an Identity for a call that supplied none (decision D-103, correctly: a module written to check if not context.identity was being admitted by the manufactured principal), and marks such a call by setting Context::caller_id to @external instead. Reading only identity would therefore drop the field from every unauthenticated execution and refusal row while apcore's own acl_decision rows for the same call kept recording @external — two record kinds in one file disagreeing about one caller.
  • duration_ms is 0 for a refusal that short-circuited ahead of the middleware phase — in practice the approval gate, since an ACL denial produces no CallPact refusal row at all (see below). No clock had started.
  • No input values, hashed or otherwise. Earlier versions wrote an input_hash; it was salted with random bytes that were then discarded, so nothing could ever be checked against it. A field that cannot be verified is not a privacy control, so it was dropped rather than kept for appearance.
  • Resilience: audit logging never causes execution failures. Write errors are reported via tracing and the call proceeds.
  • Permissions: the file is created 0600 — the mode is set through OpenOptions::mode, so it never exists world-readable even briefly, and an operator's own later chmod is left alone.

A third shape appears in the same file. ACL decisions are written by apcore itself, not by CallPact, and carry its richer entry — decision, reason, identity_type, roles, call_depth, and an RFC 3339 timestamp with a +00:00 offset rather than Z:

{
  "timestamp": "2026-07-30T01:24:35.300132+00:00",
  "caller_id": "@external",
  "target_id": "cli.ls",
  "decision": "deny",
  "reason": "default_effect",
  "identity_type": "external",
  "roles": [],
  "call_depth": 1,
  "trace_id": "36df7e553f354ffcb572e5b961ec4627"
}

CallPact deliberately does not also emit a refusal row for an ACL denial: it would double-count the same event with strictly less detail. A consumer counting refusals should count event == "refusal" plus decision == "deny". A call that reached the wrapped binary and then failed — a timeout, a spawn failure, an output overflow — is not a refusal: it appears once, as event: "execution" with status: "error" and exit_code: -1.

Breaking change (unreleased). The user and input_hash fields are gone, and event, trace_id and caller_id are new. user came from getlogin(), which returns the owner of the controlling terminal — under a service manager that is the terminal's owner or root, not whoever made the call, so it attributed every request to the wrong principal. Consumers keying on either removed field need updating.

9.3 Subprocess Isolation (always-on)

Every CliModule call uses the process controls in module::executor and module::io unconditionally. These bound the subprocess; they do not provide OS filesystem or network containment. There is no normal-execution --sandbox toggle: sandboxing is opt-in through sandbox.modules in config.yaml, and 0.15.0 implements it for the selected modules. Imported HTTP operations use a proxy instead of this subprocess path.

  • Environment policy: captured subprocesses (MCP/A2A and module JSON) do not inherit CallPact's full environment. The env is cleared and only a base allowlist is passed through (PATH, HOME, USER, LOGNAME, SHELL, LANG, LC_*, TERM, TZ, TMPDIR), so secrets in CallPact's environment cannot leak to — or be surfaced by — a wrapped tool. Local native exec, PATH shims and callpact sh instead inherit the caller's environment so credential helpers (GH_TOKEN, AWS_PROFILE, KUBECONFIG, SSH_AUTH_SOCK) keep working; LD_PRELOAD, LD_LIBRARY_PATH and DYLD_* are removed. This is a trust decision, not a sandbox: a local wrapped tool can use the caller's credentials.
  • No shell: arguments are passed as direct argv and handed to execve — no shell is spawned anywhere on the execution path, so shell metacharacters are inert data and pass through unchanged. (curl --data '{"a":1}' and every jq filter depend on that.) A caller-supplied value is rejected only for NUL and the five line terminators, which would corrupt the audit trail's framing, and for a leading -, which the wrapped tool would parse as an option the caller was not granted — see CONTROL_CHARS and validate_argument_value in src/module/executor.rs. The shell-metacharacter blacklist that remains (BINDING_INJECTION_CHARS) applies only to json_flag and the command path read out of a binding file, which is a build-time artifact rather than caller input.
  • Captured output cap: module JSON and server CLI calls cap stdout/stderr at 64 MiB each (executor::DEFAULT_MAX_OUTPUT_BYTES). A command that exceeds it gets stdout_truncated/stderr_truncated: true in the result. Native exec/shims inherit output streams instead of capturing them, so this cap does not apply there.
  • Timeout kills the process: the child is spawned with kill_on_drop(true); when the effective bound (--timeout, or default_timeout for captured calls and local_timeout for passthrough calls) elapses, the subprocess is actually terminated rather than left running as an orphan.
  • stdin is connected to /dev/null for module JSON, server CLI calls and unmanaged native calls. Reviewed native exec/shims inherit it only when their declared capabilities admit streaming stdin.

Normal execution is not OS-sandboxed unless the module is selected in sandbox.modules. The opt-in implementation is described in sandbox.md: contract + backends, per-platform default macOS sandbox-exec / Linux bwrap (the bubblewrap package; systemd-run is system/root only), required refusing when no backend is available, and no advisory execution mode. Explicit verification cases can use macOS sandbox-exec or Linux bwrap; those backends are scoped to case execution. See verification.

9.4 Preview (Dry-Run Prediction)

Destructive modules (annotations.destructive == true) implement apcore's Module::preview() hook. It does not attempt to predict the actual side effects of an arbitrary CLI binary (CallPact has no way to know what git push --force will do to a remote) — it only surfaces the exact resolved command line, so an approver can see what they're about to allow. Readonly/non-destructive modules return no preview (nothing to predict). Reachable via apcore-mcp's __apcore_module_preview meta-tool.

9.5 Resilience Middleware

build_executor wires two middleware on by default (--no-circuit-breaker/--no-retry to disable, on both callpact serve and callpact a2a):

  • HealthOnlyCircuitBreaker — short-circuits calls to a (module_id, caller) pair after repeated failures (default: ≥5 samples, ≥50% error rate), instead of letting every caller keep hammering a hanging or broken CLI tool. Auto-recovers after a cooldown window via a single probe call. Only outcomes that say the wrapped binary is unhealthy feed the window — spawn failure, timeout, signal death, internal error. Input-validation rejections, conflict refusals and governance decisions (ACL denial, approval denied/timeout/pending, cancellation, depth and frequency limits) do not count: the module was reachable and enforced its contract exactly as designed, and schema trial-and-error is the normal behaviour of an LLM caller. Counting those meant five malformed calls disabled a tool for every caller while a binary that failed every time kept its circuit closed.
  • RetryMiddleware — retries a call after a transient failure, but only when the error is explicitly marked retryable. CliModule marks a timeout retryable only when the module is annotated idempotent (§8) — a killed non-idempotent command (e.g. rm -rf timing out mid-delete) is never auto-retried, since it may have partially applied its side effect.

9.6 Approval: --enable-approval prompts the connected client

--enable-approval gates every call to a module annotated requires_approval on a human decision, delivered to the connected MCP client as an elicitation/create request. Accept and the call runs; decline or cancel and it is refused.

It only works with a client that declared elicitation support in its initialize handshake. A client that did not cannot be prompted, so its gated calls are refused — fail-closed, with a reason that says the prompt could not be delivered and names what to use instead. Check your client before turning the flag on: against one without elicitation, this is still an unconditional deny gate over every requires_approval module.

The Surfaces MCP adapter includes the elicitation support that required apcore-mcp 0.18 or later in the standalone crate. Earlier versions could not reach the prompt at all: the ElicitCallback lives inside the MCP router, and an ApprovalHandler built outside it — which is all a CLI entry point can build — received only the JSON Context, whose data map holds the string "available" rather than the callback, because no closure is a serde_json::Value. 0.18 registers the callback per tool call and puts its id in the context instead, which is a Value, so the handler can exchange it for the live callback.

CallPact wraps the Surfaces MCP ElicitationApprovalHandler in its own ApprovalGate for two things upstream cannot do from where it sits: every refusal is written to the audit trail (§9.2) — the approval gate runs ahead of the middleware phase, so nothing else in the stack observes it — and a refusal for want of a prompt is reported with a remedy rather than as Elicitation returned no response. A human's own "no" is passed through verbatim.

For a per-caller boundary that needs no human at all, use --acl (§9.2).

Local execution (callpact exec native argv, PATH shims and callpact sh) uses a terminal handler instead of MCP elicitation. It prompts on /dev/tty and accepts y/yes; a stdin that is not a terminal is refused with a remedy so an agent cannot hang. The prompt waits 60 seconds by default; CALLPACT_APPROVAL_TIMEOUT_SECONDS overrides it with a minimum of 1. Captured module JSON and server calls keep the MCP path.

For approval flows where the approver isn't in the session (e.g. a Slack bot), The Rust library's ExecutorOptions/McpServerBuilder/A2aServerBuilder accept an Arc<dyn apcore_surfaces::mcp::ApprovalStore>. With an enabled store, MCP uses the Surfaces scoped approval handler on stdio or Streamable HTTP. A tool call reports a pending decision with a public approval ID and a private resume credential. Resolve the decision using the public ID, then resume the same invocation with the private credential. The Core pipeline records a refused attempt when auditing is enabled and keeps the credential out of the audit log.

Interactive approval weighs the arguments a call actually sent. A module marked requires_approval only because it accepts an escalating flag (§8) records which schema properties those are, and the gate stands down for a call that carries none of them — git log runs unprompted, git log --all prompts. This is the one decision apcore cannot make: neither ApprovalHandler nor its ExecutionPolicy hook is handed a call's arguments, and ApprovalRequest is the first place they are visible. A stand-down is recorded with approved_by: "apexe-approval-gate", so an audit reader can tell it from a human's yes. A module marked destructive by name carries no such basis and always prompts.

The scoped MCP store holds every invocation that Core marks as requiring approval, including one that omits the flags that caused the annotation.

Known limitation. The escalating-flag list is still name-based, so a dangerous flag under an unremarkable name is not on it — that is what an overlay's risk: escalates is for (§8). And cli.ssh and cli.curl are gated by nothing here: they are open-world, not destructive, and accept no flag on the list.

There is no CLI flag for this — apcore-mcp's InMemoryApprovalStore is documented as unsuitable for production (state isn't shared across process invocations, so a hypothetical callpact approval resolve command couldn't reach a running server's store anyway). Embed CallPact as a library and supply your own persistent store (Redis, a database, etc.) to use this for real.


9.7 Path Guard (always-on)

Three gates decide whether a wrapped call runs, in this order:

Gate Answers Lives in Inspect with
Coverage can this route be expressed at all? ~/.callpact/bindings/ callpact list --verbose
Permission may this caller run this command? ~/.callpact/acl.yaml callpact acl explain <module-id>
Access may it touch this location? ~/.callpact/config.yaml → paths: callpact paths --path <p> --mode write

A refusal names the gate that decided, because the fix differs per gate: a coverage refusal is a rescan, a permission refusal is an ACL rule, an access refusal is a paths: entry. Allowing cli.rm in acl.yaml does not let it write /etc; paths.read_only still refuses that write.

Paths already configured the old way map one-to-one:

Before (config.yaml) After
allowed_paths: [/x] paths.read_write: [/x]
additional_denied_paths: [/y] paths.no_access: [/y]
(compiled system paths) paths.read_only: [...] — shipped in the file, editable
(compiled credential dirs) paths.no_access: [...] — shipped in the file, editable

Both key sets are read: the old allowed_paths/additional_denied_paths keep working and are merged with paths: when both are present, so an existing file is never silently reinterpreted. callpact config init writes the new shape for a machine that has no file yet.

The built-in defaults are compiled in for three jobs only — seeding config.yaml on first run, standing in when that file (or its paths: section) is missing, and telling an upgrade which entries are new. When the file exists, its paths: section is the policy; the compiled lists are not consulted.

The ACL (§9.1) decides whether a module may be called. It cannot decide what a call may touch — apcore ACL rules match on caller and target module id, not on argument values. rm is not a command to forbid outright; rm /etc is.

The path guard covers that gap. Every argument the module's input schema types as a filesystem path is resolved and checked before the subprocess is built. It is on by default on every surface, needs no flag, and has no off switch.

Two lists, because reading and writing are different risks. Which one binds a call comes from the module's readonly annotation (§8):

System paths Credential paths
readonly module — cat ls grep find allowed refused
Everything else — rm mv cp chmod refused refused
List Locations Compiled in
read_only /bin /boot /dev /etc /lib /lib32 /lib64 /proc /run /sbin /sys /usr /var — plus /System /Library /Applications /private/etc /private/var on macOS writes refused; editable in config.yaml
Credential ~/.ssh ~/.aws ~/.gnupg ~/.kube ~/.docker ~/.config/gh ~/.config/gcloud ~/.config/apcore ~/.git-credentials ~/.netrc read and write
CallPact's own state ~/.callpact (policy, audit trail, security evidence) write only — legible, so an operator or an agent can see what is enforced; refused to writers, so a tool cannot govern itself

cat /etc/hosts and ls /usr/bin are ordinary work, so a readonly module may name a system path — refusing it protected nothing, since the file is world-readable and an agent's own file tools reach it regardless. Credential paths are refused to readers as well: deleting a private key announces itself the next time the key is used, while copying one into a model context leaves no trace, so the stricter treatment goes to the risk that is harder to notice. ~/.callpact is on that list because it holds the ACL and audit trail governing the call being made.

A module with no readonly annotation is treated as a writer. Note that §9.1's caveat carries over: a command misclassified as readonly gets the weaker treatment here too — fix it with an overlay.

~/.config is deliberately not guarded. It holds ordinary application settings a wrapped tool has legitimate reason to touch.

/ is not an entry either — every absolute path starts with it, so listing it would refuse the whole filesystem. rm / is still refused, because for a writer a target that contains a protected location is refused too.

Extend it in config.yaml:

additional_denied_paths:
  - /srv/production-data
  - ~/customer-exports

Configured entries join the credential list, so they bind readers as well as writers: naming a path explicitly asserts that it is sensitive.

Reopen a subtree with allowed_paths:

allowed_paths:
  - /etc/nginx/conf.d

This is the only setting that relaxes the guard, and it is empty by default — the feature is inert until you write it down. It exists because the alternative is worse: an agent that legitimately has to write /etc/nginx/conf.d would otherwise have to be handed that tooling outside CallPact entirely, which drops the audit trail and the ACL along with the path check.

You own what you open here. Nothing validates that an entry is wise — naming /etc, or a credential directory, is honoured. What the guard does instead is make the decision visible: every carve-out is logged at startup, and one that opens a whole system location or exposes credentials is logged at warn.

Two things worth knowing before you use it:

  • Prefer the narrowest subtree that does the job. /etc/nginx/conf.d, not /etc. A carve-out grants everything beneath it.
  • A config directory grants the service's behaviour. Write access to /etc/nginx/conf.d is enough to add a proxy_pass and redirect traffic anywhere, without touching anything else under /etc. That is the real scope of the permission, not "one directory".

Carve-outs and denials share one specificity ladder, so you can open a subtree and still fence off part of it:

allowed_paths:
  - /etc/nginx/conf.d
additional_denied_paths:
  - /etc/nginx/conf.d/secrets   # more specific, so this wins

~/.config needs no entry here — it is not guarded in the first place.

What gets compared. Not the string the caller sent — the path the kernel would act on. A relative path is joined to the working directory the subprocess actually runs in, symlinks are followed, and .. is folded afterwards. All three matter:

// cli.rm (writer)
{ "file": ["/etc/passwd"] }          // Refused: resolves into /etc
{ "file": ["../../../etc/passwd"] }  // Refused: climbs out of the workspace
{ "file": ["/tmp/x/hosts"] }         // Refused: /tmp/x is a symlink to /etc
{ "file": ["/"] }                    // Refused: contains a protected location
{ "file": ["/etcetera/notes"] }      // Allowed: /etcetera is not /etc

// cli.cat (readonly)
{ "file": ["/etc/hosts"] }           // Allowed: system paths are legible
{ "file": ["~/.ssh/id_rsa"] }        // Refused: credentials bind readers too
{ "file": ["/"] }                    // Allowed: ancestry binds writers only

A refusal is ACL_DENIED and names all three of the requested path, the resolved path and the protected location that matched:

{
  "code": "ACL_DENIED",
  "message": "Element 0 of parameter 'file' resolves to '/private/etc/passwd', which is protected by '/private/etc'",
  "details": {
    "requested_path": "../../../etc/passwd",
    "resolved_path": "/private/etc/passwd",
    "protected_path": "/private/etc"
  }
}

The requested path alone is often not enough to see the problem — that is the point of resolving it — so both are reported.

The temp directory stays writable. On macOS $TMPDIR lives under /var/folders/, which the /var baseline would otherwise refuse. A compiled-in carve-out keeps it usable. The carve-out list is not configurable, and a TMPDIR pointing at a system location is discarded rather than honoured. A credential path nested inside the temp directory — a sandboxed HOME — is still refused, by the more-specific-rule-wins tiebreak rather than by voiding the carve-out.

Limits. The guard acts on values the schema types as paths. A tool whose help text never reveals that an option takes a filename yields an unmarked value the guard cannot see; nothing bounds what the tool does after it starts (find . -delete is past the boundary); because ancestry binds writers only, a recursive read rooted above a credential directory — grep -r … / — is not caught; and the mode is per module rather than per argument, so cp /etc/hosts ~/backup is refused even though the system path is only being read. See docs/threat-model.md §4.8 and §5.8 for the full accounting.

9.8 Where a decision belongs

Most policy belongs in a data file, because that is the only layer an operator can change without a release. Reach for code last.

Decision Data file What it cannot do
Allow or deny a module acl.yaml rules — first match wins, so rule order is the policy —
Require approval for a module approval: required on an acl.yaml rule It can only add approval. An approval demanded by the module's annotation cannot be cancelled here; apcore unions the two sources
Let a command write into a system directory name the subtree under paths.read_write The deepest matching entry wins, so the subtree is opened without editing the read_only entry. A reader is not held to the write list at all
Grammar: flags, operands, where validation stops A local overlay in ~/.callpact/overlays/ It must match at least as strongly as the corpus file it amends, and it replaces that file wholesale
Classification: destructive, open_world, requires_approval, risk The same overlay's annotations Same two limits
What a fresh callpact init writes for everyone EXEC_WRAPPER_TOOLS and the other lists in src/adapter/annotations.rs This is the last resort: it changes a default, and every machine that has written its own data already outranks it

An MCP or A2A service refuses to start with an ACL containing an approval: required rule unless approval is enabled. For MCP, use callpact serve --enable-approval with an elicitation-capable client, or configure an approval store in the library builder. A2A requires a library-configured approval store and has no CLI approval backend. Modules whose approval requirement comes only from annotations retain the server's existing opt-in behavior.

Two consequences worth knowing before choosing:

  • Comments do not survive. A policy write (callpact acl init/sync, callpact init) re-serializes acl.yaml, so a decision recorded only in a comment is lost. Record it as a rule with a description instead: the description is what the audit trail reports as matched_rule, so the reason is visible in every record.
  • The local surface has one caller id: local. Rules cannot distinguish the operator's own shell from an agent running in it. That needs a caller identity, not a rule condition.

10. MCP Server

Transport Options

Transport Use case Command
stdio Claude Desktop, Cursor (default) callpact serve
streamable-http Remote agents, browser UI callpact serve --transport http --port 8000
sse ⚠️ Deprecated upstream, but served callpact serve --transport sse --port 8000

--transport sse is deprecated, but it works again and no longer needs an acknowledgement. CallPact used to refuse it: apcore-mcp shared one process-global channel across every connection, so responses went round-robin to whichever stream was next and, with two clients connected, one client received the other's tool output. apcore-mcp 0.18 scopes a session per connection and emits the event: endpoint a spec-compliant MCP SSE client waits for. The Surfaces MCP adapter retains that per-connection routing.

SSE is still deprecated upstream and CallPact warns at startup. Prefer --transport http (streamable HTTP) for anything new.

--allow-deprecated-sse is still accepted so existing invocations keep parsing, but it decides nothing and is hidden from --help. It will be removed in a later release.

Transport Authentication

The three transports have different trust boundaries, so they get different defaults:

Transport / bind Default Why
stdio no auth The boundary is the parent/child process relationship — whatever can spawn CallPact already holds your privileges. A token adds nothing and would break every Claude Desktop / Cursor config.
HTTP/SSE on 127.0.0.1 bearer token, generated and written to stderr at startup Any local process can reach the port, including a page in your browser. You should not have to manage a secret for a local dev server.
HTTP/SSE on any other host authentication required CallPact wraps arbitrary local binaries. An unauthenticated non-loopback bind is a remote-execution entry point for every executable on the host.

CallPact terminates no TLS. On a non-loopback bind the bearer token or JWT travels in cleartext, and anything on the path can replay it to reach the same remote-execution surface the credential exists to close. CallPact warns at startup — both through tracing and in the token notice on stderr, since the two can be filtered differently — but it cannot refuse: CallPact behind a TLS-terminating reverse proxy is the correct deployment and looks identical from inside the process. Put one in front, or bind to 127.0.0.1 and reach it through an SSH tunnel.

callpact serve --transport http                              # token generated + printed
callpact serve --transport http --auth-token "$MY_TOKEN"     # or CALLPACT_AUTH_TOKEN
callpact serve --transport http --auth jwt --jwt-secret "$S" # or CALLPACT_JWT_SECRET
callpact serve --transport http --auth none                  # loopback only
callpact serve --transport http --host 0.0.0.0 --auth none \
            --allow-unauthenticated-bind                  # states that you mean it

A generated token is written directly to stderr, not through the log pipeline. Two consequences worth relying on: it appears at every --log-level, including warn and error, so the server can never demand a credential you have no way to read back (--show-config omits credentials by construction); and it is never written into a log file, journald, or a log aggregator you have pointed tracing at. The log itself only records that token auth is on.

Clients send Authorization: Bearer <token>. The Explorer UI's Authorization field is wired to this — browsing (GET) is open, execution (POST, including POST /explorer/tools/{tool}/call) requires the credential.

/health is exempt so container and load-balancer probes work. /metrics is not exempt: its module_id labels and per-module call volumes are reconnaissance about what this host wraps and what actually gets used.

--auth none on a non-loopback bind refuses to start without the separate --allow-unauthenticated-bind acknowledgement — a --disable-* flag gets copied out of a tutorial once and then lives in everyone's startup script forever.

Built-in Middleware

Middleware Status Effect
LoggingMiddleware Enabled by default Structured logging of inputs/outputs, redacting properties the scanner marked x-sensitive — see below
FailureLogMiddleware Automatic with --no-log-arguments, and whenever an audit log is configured One payload-free ERROR record per failed call, plus the refusal rows in audit.jsonl — see below
CircuitBreakerMiddleware Enabled by default (--no-circuit-breaker) Short-circuits a hanging/broken tool — see §9.5
RetryMiddleware Enabled by default (--no-retry) Retries idempotent timeouts only — see §9.5
ApprovalGate Opt-in (--enable-approval) Prompts the connected MCP client for a human decision on a requires_approval module; refuses when the client cannot be prompted — see §9.6

Credentials in tool arguments. The logging middleware records each call's inputs and output at INFO. Redaction is schema-driven: the scanner marks credential-bearing options (curl --user, --oauth2-bearer, --header, key and certificate paths, and their equivalents) with x-sensitive: true, and those values are replaced before anything is written.

The marker lives in the binding file, so a binding scanned before the release that introduced it carries none and redacts nothing. Redaction is not retroactive: it is the scanner that writes x-sensitive, and upgrading CallPact does not rewrite bindings already on disk. Check with

grep -L x-sensitive ~/.callpact/bindings/*.yaml

— every file listed still logs credentials verbatim. Re-scan those tools (callpact scan <tool> --no-cache) to pick the marker up, or run with --no-log-arguments until you have.

A heuristic cannot be exhaustive over every wrapped tool's option set — a request body (curl --data) and a key sitting in a URL's query string announce themselves in no schema — so if you pass secrets through options CallPact may not recognize, run with --no-log-arguments.

--no-log-arguments drops the payload from every log event, the error record included. That matters because apcore's error record renders the same partially-redacted argument object as the START line, so a call rejected by schema validation used to print the body a successful call would have hidden. The operational record survives in a different shape: CallPact installs its own FailureLogMiddleware, which emits one ERROR per failed call carrying module_id, trace_id, caller_id, error_code and duration_ms — and nothing the caller sent, not even the error message, since a validation message quotes the value it rejected. So a refusal is still visible, and error_code is what an alert keys on.

The CLI also suppresses MCP SDK call-router diagnostics under either switch: those records can contain schema-redacted arguments or error text even when execution middleware payload logging is disabled. This suppression applies at debug/trace levels and cannot be overridden by RUST_LOG.

--no-logging disables call logging middleware, failure records included. Payload-free execution events and server diagnostics still follow --log-level. The audit.jsonl trail records no raw argument values in any case.

Observability

callpact serve --transport http --metrics enables two endpoints (HTTP/SSE only, ignored on stdio):

Endpoint Format Content
/metrics Prometheus text apcore_module_calls_total, apcore_module_duration_seconds histogram, per module_id
/usage JSON Per-module call count, error count, average latency, unique callers, trend

Tool Filtering

--tags and --prefix (and their McpServerBuilder equivalents) restrict which scanned modules the server exposes. The filter is applied at registration time, so an excluded module is not merely absent from tools/list — it does not exist on this server at all, and tools/call, resources/list and resources/read all return ModuleNotFound for it.

callpact serve --prefix cli.git            # a git-only server
callpact serve --tags readonly             # every listed tag must match (AND)
McpServerBuilder::new()
    .tags(vec!["readonly".to_string()])     // only expose readonly tools
    .prefix("cli.git")                       // only expose git tools
    .build()?;

This is coarse-grained: it selects a subset of the tool surface for everyone. For per-caller rules, use --acl (§9.2).

A stray comma is refused, not applied. --tags readonly, splits to ["readonly", ""], and every listed tag must match — no module carries an empty tag, so the filter would admit nothing and the server would start with an empty registry and no callable tools at all. callpact serve exits with an error naming the empty tag instead. A tag that is merely unknown to this host is not an error (one invocation is meant to be portable across differently scanned machines), but if the filter excludes every loaded module CallPact logs a warning saying so, rather than the admitted=0 info line that looked identical to an empty bindings directory.

Availability Filtering

Registration also drops any module whose binary is not actually reachable on this machine — checked against the target (exec://{binary_path} ...) recorded in its binding file at scan time. A binding file can outlive the tool it wraps: uninstalled since, moved, or the bindings_dir copied to a different host. Unlike --tags/--prefix, this check is unconditional and has no opt-out flag — callpact serve and callpact a2a share the same build_executor, so it applies to both, and it is not optional because an MCP/A2A client has no graceful way to recover from a tool it was told exists failing every call with ModuleNotFound/"not installed".

An excluded module logs a warning naming the module_id and the target that could not be resolved:

WARN callpact::module::registry: Binary not reachable on this machine; excluding
from the registered tool surface module_id="cli.ghost" target="exec:///..."

callpact list shows binding files as-is by default (useful for reviewing what was ever scanned, e.g. before moving bindings_dir to a new host); pass --available-only to apply the same check there:

callpact list --available-only              # only binaries reachable right now

Explorer UI

Enable with --explorer (HTTP transport only):

callpact serve --transport http --port 8000 --explorer

Provides a browser-based interface to explore available tools, view schemas, and test invocations.

The Try-It editor prefills only what a call needs. It emits exactly the keys in the tool's required list — each with its declared default when the schema has one, and null otherwise — and omits every optional property. For cli.curl, whose contract has 257 properties, that is {"url": null} rather than 259 lines of blanks.

A null placeholder is deliberately not valid against a typed property, so Validate refuses an untouched prefill and names the field you still have to fill. That is the point: an earlier version filled every string with "" and every number with 0, which satisfied both required and the declared types, so Validate certified an empty call as correct and Execute sent it — the wrapped tool was the first thing to object. Needs apcore-mcp 0.18.1 or later (mcp-embedded-ui 0.5).

OpenAI Tools Export

Export tool definitions in OpenAI function calling format (programmatic API):

let tools = McpServerBuilder::new()
    .bindings_dir("~/.callpact/bindings")
    .export_openai_tools()?;

11. A2A Server

callpact a2a exposes the same scanned modules as an A2A agent via apcore-a2a, instead of (or alongside) MCP. It shares governance with callpact serve — both build their Executor through the same callpact::module::build_executor(), so an --acl policy, the logging middleware, the audit trail, and the always-on subprocess isolation behave identically regardless of which transport a caller uses. Approval is the one exception: callpact serve offers --enable-approval, which prompts the connected MCP client for a human decision (§9.6), while callpact a2a has no such flag at all — A2A has no elicitation transport, so a prompt could never be delivered over it — approval on A2A is library-only (supply an ApprovalStore to A2aServerBuilder). A2A uses bearer token authentication by default; it also supports JWT.

Wire compatibility: The current SDK advertises JSONRPC 1.0 in its Agent Card but does not support the complete A2A 1.0 interface. Startup warns on stderr. Use the authenticated, headerless legacy message/send flow below. This is not a claim of full 0.3 interoperability either.

callpact a2a                                       # http://127.0.0.1:8000
callpact a2a --url http://127.0.0.1:9000 --explorer  # custom port + browser UI
# A public unauthenticated bind requires both explicit opt-outs:
callpact a2a --url http://0.0.0.0:9000 --auth none --allow-unauthenticated-bind
callpact a2a --acl ~/.callpact/acl.yaml               # governed by an ACL policy

Calling a skill: send a DataPart, not prose

Every CallPact skill takes a JSON object — build_input_schema always produces "type": "object" — so its arguments ride in a DataPart, and the skill's skillId goes in the message metadata:

With cli.cp registered, a permitted test file, and the same CALLPACT_AUTH_TOKEN set in the server and client environments, send:

curl --fail-with-body http://127.0.0.1:8000/ \
  -H "Authorization: Bearer ${CALLPACT_AUTH_TOKEN:?set CALLPACT_AUTH_TOKEN}" \
  -H 'Content-Type: application/json' -d '{
  "jsonrpc": "2.0", "id": 1, "method": "message/send",
  "params": { "message": {
    "role": "ROLE_USER",
    "messageId": "m1",
    "metadata": { "skillId": "cli.cp" },
    "parts": [ { "data": { "source_file": ["/tmp/a"], "target": "/tmp/b" } } ]
  } }
}'

The legacy method returns the Task directly under result. For a self-contained authenticated loopback example using a temporary local API, run python3 examples/openapi_import/demo.py from the repository root (see the runnable example for options).

A TextPart carrying prose does not work, and the error says why in terms of the mechanism rather than the remedy:

TextPart text is not valid JSON: expected value at line 1 column 1

For an object-typed skill, apcore-a2a parses a TextPart's text as JSON — so {"kind": "text", "text": "{\"source_file\": [...]}"} is accepted and {"kind": "text", "text": "copy this file"} is not. That rule is shared with apcore-a2a's Python and TypeScript siblings; a DataPart is the direct way to say the same thing.

The agent card's per-skill inputModes is the field to read. Each skill advertises ["application/json"], computed from its own schema. The card also carries an agent-level defaultInputModes of ["text/plain", "application/json"] — that is apcore-a2a's hardcoded default and describes what the framework can accept, not this agent: CallPact never produces a string-rooted skill, so text/plain is unreachable here. Per the A2A spec a skill's own inputModes overrides the default, so a client that reads it gets the right answer; one that reads only the agent default will try prose and hit the error above. CallPact cannot narrow the default — APCoreA2AConfig exposes no field for it.

Endpoints

Endpoint Purpose
GET /.well-known/agent-card.json A2A Agent Card (skills derived from registered modules)
GET /health Liveness check
GET /explorer Browser-based Explorer UI (with --explorer)

Skill aliasing

Like MCP, A2A reads the display overlay callpact scan computes (metadata["display"]["a2a"]["alias"]) to name each skill; see Display Names below.

Authenticated caller identities

Token authentication establishes the shared apexe-token identity. JWT maps sub and roles into the executor context and audit records. ACL callers match module call-chain IDs, not JWT subjects: inbound transport requests use @external. Gate authenticated roles through conditions, for example:

version: '1.0'
default_effect: deny
rules:
  - callers: ['@external']
    targets: ['cli.echo']
    effect: allow
    conditions: {roles: [ops]}

An expired or invalid credential is rejected before module execution. Authenticated A2A returns masked governance messages; an explicit unauthenticated surface may disclose detailed refusal reasons.


12. Integrating with AI Agents

Terminal agents: shell or hook integration

Start with Shell Integration. callpact setup initializes bindings and the starter ACL, installs shims, and offers to configure detected OpenCode, pi and Claude Code hosts. Configure Codex through its login shell. Once the host route is verified, covered commands use ordinary shell syntax. Use the host verification procedure to check an ordinary call in the actual agent session and confirm its audit record.

When the host cannot use this integration, follow the Agent Skill fallback. The operator selects the project configuration and the agent uses explicit callpact exec with separate preflight and execution calls. The exec reference covers native passthrough, module JSON and approval. Contributors can verify the fallback using the maintainer procedure.

For an independently launched shell or script, see the env reference for activation, coverage and diagnostics.

Optional protocol integration: MCP and A2A

Use MCP/A2A when the client needs protocol tool discovery, structured protocol calls, a network endpoint or imported OpenAPI HTTP operations. HTTP import is unavailable through local exec/shims. The following client configurations are for this protocol path; terminal Skill use does not need them.

--show-config reproduces the invocation you type

--show-config renders the rest of the command line into the snippet, so add every flag you intend to serve with:

callpact serve --show-config claude-desktop \
  --bindings-dir /srv/apexe/modules --prefix cli.git --acl /etc/apexe/acl.yaml
{
  "mcpServers": {
    "CallPact": {
      "command": "callpact",
      "args": ["serve", "--transport", "stdio",
               "--bindings-dir", "/srv/apexe/modules",
               "--prefix", "cli.git",
               "--acl", "/etc/apexe/acl.yaml"]
    }
  }
}

--bindings-dir, --tags, --prefix, --acl, --name, --enable-approval, --no-logging, --no-log-arguments, --no-circuit-breaker and --no-retry are all carried through. --bindings-dir matters most: a client launching callpact serve without it reads the default ~/.callpact/bindings, so anyone who scanned elsewhere would get a server with no tools at all.

Paths are made absolute. A relative --bindings-dir ./modules is written into the snippet as /abs/path/to/cwd/modules, resolved against the directory you ran --show-config in. The client that later runs the snippet launches callpact from its own working directory, so a relative path would resolve somewhere else entirely — the server would log Bindings directory not found, starting with zero tools and exit 0, and a relative --acl would silently apply no policy at all.

Credentials are never written into a snippet. --auth-token and --jwt-secret are excluded by construction, because a config file is shared and often committed. For an HTTP server behind --auth token, the snippet carries only the URL — configure the Authorization: Bearer header in the client, from your own secret store.

An unrecognised target (--show-config vscode) is rejected on stderr with a non-zero exit, so callpact serve --show-config … > mcp.json cannot write an error message into the config file.

Claude Desktop

callpact scan git curl grep
callpact serve --show-config claude-desktop --acl ~/.callpact/acl.yaml

Copy the JSON output into: - macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - Linux: ~/.config/claude/claude_desktop_config.json

Restart Claude Desktop. Scanned tools appear as MCP tools.

Cursor

callpact serve --show-config cursor --acl ~/.callpact/acl.yaml

Add the JSON to Cursor's MCP settings. cursor honours --transport: with --transport http it emits the url form rather than a command block.

HTTP Mode (Remote Agents)

callpact serve --transport http --host 0.0.0.0 --port 8000 --acl ~/.callpact/acl.yaml
callpact serve --show-config claude-desktop --transport http --port 8000 --acl ~/.callpact/acl.yaml

The MCP endpoint is at POST /mcp (the deprecated SSE transport is served at GET /sse instead, and the generated snippet uses whichever path matches --transport).

Display Names

CallPact generates display metadata for MCP clients:

Module ID MCP Display Alias
cli.git.commit git_commit
cli.docker.container.ls docker_container_ls
cli.curl curl

Aliases are auto-sanitized for MCP compatibility (dots replaced with underscores, digit prefixes escaped).


13. Error Handling and AI Guidance

Domain errors attach ai_guidance when recovery advice is available:

Structured CLI failures

Use the global --error-format json before or after a subcommand to emit a single-line, versioned error envelope on stderr. The default remains human text. Help, version, man pages, successful stdout and wrapped child exit codes keep their existing behavior. Argument errors exit 2; runtime failures exit 1. A completed child with exit 1 still returns its captured result on stdout without a CallPact error envelope.

callpact --error-format json exec cli.ls --input-file request.json
cat request.json | callpact exec cli.ls --input-file - --error-format json
{"schema_version":1,"error":{"code":"GENERAL_INVALID_INPUT","message":"Input must be a JSON object","details":{},"retryable":false,"ai_guidance":"Provide one JSON object matching the advertised input schema.","trace_id":null}}

code uses the existing apcore domain codes; generic failures use GENERAL_INTERNAL_ERROR. Schema errors retain details.errors, and domain errors retain available retry advice and trace IDs. Unavailable optional fields are null. Do not parse message to identify the failure. Successful or partial command reports may already exist on stdout when a later operation fails. --log-stderr explicitly adds diagnostic logs; omit it when consuming stderr as just an error envelope. Errors inside a running MCP/A2A server retain their protocol-specific error contract.

--input-file is exclusive with inline --input and native argv. File/stdin input is limited to 1,048,576 bytes, must contain exactly one UTF-8 JSON object, and rejects empty data, arrays, invalid JSON and trailing documents. Stdin must be piped or redirected; a terminal is rejected instead of waiting interactively. Input is read before entering the execution runtime and follows the same schema, ACL, approval and audit path as inline JSON. Malformed-input diagnostics contain positions, not the input body. Inline --input and its default {} are preserved.

Recovery guidance

Error ai_guidance
Tool not found "The tool 'xyz' is not installed. Install it and try again."
Command timeout "The command took too long. Try with simpler arguments or increase timeout."
Option injection (value starts with -) The value would be read as an option the caller was never granted. Send it without the leading dash, or use a tool whose overlay declares -- support (x-apexe-end-of-options)
Path refused by the guard "'/etc/passwd' resolves to '/private/etc/passwd', inside or above the protected location '/private/etc'. … Choose a path outside the protected system and credential directories."
Parameter refused as a command executor "Parameter 'upload_pack' is refused: its value is a command the wrapped tool would run … send the call without it, or run the tool outside CallPact."
Permission denied "Permission denied. Check file permissions or run with appropriate privileges."
Non-zero exit code "Command 'git push' exited with code 1. stderr: (first 200 chars)"

There is no "shell injection" error on the execution path. Earlier versions listed one. No shell is spawned anywhere (§9.3), so ;, |, &, $ and quotes are inert bytes in an argument and pass through unchanged — curl --data '{"a":1}' and every jq filter depend on it. The guards that do fire are the three rows above plus NUL and the five line terminators, which are rejected because they would corrupt the audit trail's framing. An agent that escapes metacharacters in response to a refusal is solving the wrong problem. CallPactError::CommandInjection still exists, but it is a tamper signal for a hand-edited .binding.yaml (BINDING_INJECTION_CHARS), never a response to caller input.

Additionally, each execution response includes: - trace_id for end-to-end correlation - duration_ms for performance tracking - exit_code for programmatic error detection

A non-zero exit is not an MCP error — key on exit_code

A wrapped command that runs and exits non-zero comes back as an ordinary, successful tool result: isError: false, with exit_code, stdout, stderr and ai_guidance in the payload.

exit_code is not a sibling of isError. Compatible MCP clients receive the payload in structuredContent, with serialized JSON also retained in content[0].text. A legacy client's text response remains:

{
  "content": [
    {
      "type": "text",
      "text": "{\"exit_code\":2,\"stdout\":\"\",\"stderr\":\"curl: option --max-time=1: is unknown\",\"ai_guidance\":\"Command 'cli.curl' exited with code 2. stderr: ...\"}"
    }
  ],
  "isError": false
}

The Surfaces MCP adapter negotiates 2025-06-18, retaining 2025-03-26 and 2024-11-05 for legacy clients. On stdio and SSE this decision belongs to the live connection. Streamable HTTP remains stateless: after initialization, send MCP-Protocol-Version: 2025-06-18 on each request to receive structured fields. Without the header, HTTP keeps the legacy format; unsupported versions return HTTP 400. Request body metadata cannot override the transport's decision.

For compatible clients, tools/list exposes an object binding's outputSchema, and successful calls expose the same redacted object in structuredContent and serialized text. Advertised output schemas are checked after redaction; schema mismatches become payload-free tool errors rather than leaking the original output or returning an invalid success. Async task submissions omit the final-result schema, and non-object results retain text output. Legacy clients receive neither new structured field. Authentication, approval and execution governance use the existing pipeline on every transport.

Sensitive fields referenced through local JSON Schema pointers or scoped anchors are redacted by apcore before MCP validates and publishes the result. Output validation supports a single declared Draft 7, 2019-09 or 2020-12 dialect; unresolved references, mixed dialects and precision-losing JSON numbers are rejected without exposing the payload. External schema resources are never fetched.

CallPact gets this implementation through its Cargo dependency. Surfaces MCP adapter

A client supports both result formats with:

if (result.isError) throw new Error(result.content[0]?.text ?? "Tool call failed");
const payload = result.structuredContent ?? JSON.parse(result.content[0].text);
if (payload.exit_code !== 0) { /* the command ran and answered */ }

Reading result.exit_code directly yields undefined, and a client that then falls back to isError lands exactly in the trap the rest of this section exists to prevent.

This exit-status distinction is deliberate. In a CLI bridge, a non-zero exit is frequently the answer, not a failure:

Command Exit 1 means
grep pattern file no match found
diff a b the files differ
test -f path the predicate is false

Setting isError: true on a non-zero exit would report all three as failed tool calls, and an agent would retry or abandon a tool that answered its question correctly.

isError: true means the bridge could not return a valid execution result:

  • schema validation rejected the arguments,
  • the ACL denied the caller,
  • --enable-approval blocked a requires_approval module,
  • the circuit breaker was open, the timeout killed the process, or the binary could not be spawned at all,
  • output validation, including validation after redaction, failed.

A timeout or output-validation failure can occur after execution started. Do not infer that no side effects occurred, or automatically retry destructive calls.

On that path content[0].text is a plain diagnostic sentence rather than a success payload. Read it as an error diagnostic; do not apply the success schema.

So: an MCP client must not treat isError: false as "the command succeeded". Read structuredContent, falling back to parsed text, and inspect exit_code (it is required in every generated output schema, alongside stdout and stderr), then apply the wrapped tool's own convention.

The A2A surface follows the same split: a non-zero exit yields TASK_STATE_COMPLETED with the exit_code inside the artifact, while a governance or validation refusal yields TASK_STATE_FAILED (or TASK_STATE_INPUT_REQUIRED when an approval is pending, and TASK_STATE_CANCELED on cancellation). There too, the task state answers "did the command run", not "did it succeed".


14. File Locations

Path Purpose Created by
~/.callpact/config.yaml Configuration callpact config --init or config set
~/.callpact/bindings/*.binding.yaml Tool binding files callpact init or scan
~/.callpact/cache/ Scan result cache callpact init or scan
~/.callpact/acl.yaml Access control rules callpact init or callpact acl init
~/.callpact/corpora/ Validated rules snapshots and ownership catalog callpact init or automatic scan acquisition
~/.callpact/log/callpact.log.YYYY-MM-DD Rotating diagnostic logs Commands and governed shims
~/.callpact/bin/.apexe-shims.json Owned shim routes callpact env --enable
~/.callpact/bin/.apexe-shell-init.json Owned shell startup blocks callpact env --enable
~/.callpact/bin/callpact-activate.sh Persistent activation helper for sh/bash/zsh callpact env --enable or --reload
~/.callpact/bin/callpact-deactivate.sh Persistent uninstall and environment restoration helper callpact env --enable or --reload
~/.callpact/bin/.apexe-source-scripts.json Ownership record retained after disable callpact env --enable or --reload
~/.callpact/bin/activate, ~/.callpact/bin/deactivate Compatibility helpers removed by disable callpact env --enable or --reload
~/.callpact/audit.jsonl Audit trail MCP/A2A and local governed execution
~/.callpact/apcore.yaml apcore ecosystem config (optional) Manual

These are default paths; configured directories and --shim-dir can override them. The namespaced shell helpers and their ownership record remain after disable; compatibility helpers in the shim directory are removed. Commands create their required directories automatically; env --check is read-only for installation state; it may create or append diagnostic logs in ~/.callpact/log/.


15. Global Flags, Logging and Debugging

Four flags are global — they parse before or after the subcommand, whichever is more natural to type:

Flag Default Description
--log-level <LEVEL> warn unless configured or overridden by the environment Diagnostic log level; overrides RUST_LOG, CALLPACT_LOG_LEVEL and config.yaml
--log-stderr Off Also mirror diagnostic logs to stderr
--timeout <SECS> default_timeout / local_timeout from config.yaml (30 / 0) Per-call timeout override, applied to every subcommand that runs or probes a wrapped binary. Bounds captured and passthrough calls alike; 0 is rejected because it would kill every call before it started. Requires positive integer seconds representable as 64-bit milliseconds (at most 18446744073709551)
--error-format <FORMAT> text Render CLI failures on stderr as text or a versioned json envelope; successful output and child status are unchanged
callpact --timeout 120 scan ffmpeg     # a slow tool needs longer than the default
callpact scan ffmpeg --timeout 120     # identical; both positions parse

All commands and governed shims use structured logging via tracing. Diagnostics go to ~/.callpact/log/callpact.log.YYYY-MM-DD, with daily UTC rotation and retention of the latest 14 files. The terminal does not show diagnostic logs unless --log-stderr is supplied. Command results, failures, child process output and necessary operator notices still appear normally. The governance audit trail is independent of this log level. On Unix, the diagnostic log directory is restricted to its owner (mode 0700), including when a previous installation created it with broader permissions.

Precedence: --log-level > RUST_LOG > CALLPACT_LOG_LEVEL > config.yaml (log_level) > warn. Existing saved levels remain effective.

# Via CLI flag (global)
callpact --log-level debug scan git

# Via environment variable
RUST_LOG=debug callpact scan git

# Persist the level (updates log_level in config.yaml)
callpact config set log.level debug

# Also display logs in the terminal
callpact --log-level debug --log-stderr scan git
Level Records
off No diagnostics
error Failures only
warn Warnings (e.g., failed to write ACL, cache miss)
info Normal operation: tool loaded, modules registered, server started
debug Internal detail: parser selection, cache hits, enrichment decisions
trace Very verbose: raw help text, parsed structures

16. Troubleshooting

For terminal-agent Skill discovery, project activation, bare command routing, sequential preflights and ACL file access, start with Agent troubleshooting. The cases below cover the CLI application and optional shims/servers.

"Tool not found" during scan

The tool must be on $PATH:

which <tool>

Scan produces incomplete results

  1. Increase depth: callpact scan <tool> --depth 3
  2. Force re-scan: callpact scan <tool> --no-cache
  3. Check parser selection: RUST_LOG=debug callpact scan <tool>

"No eligible shim modules" when enabling

Check callpact list first. Zero registered modules means there are no callable bindings in the configured directory. The default is ~/.callpact/bindings; pre-0.8.0 bindings in ~/.callpact/modules are not loaded there. Regenerate current bindings with reviewed overlays rather than copying stale files:

callpact scan cat head ls --no-cache
# Write a starter policy once; skip if ~/.callpact/acl.yaml already exists.
callpact acl init
# Review ~/.callpact/acl.yaml, then install and activate.
callpact env --enable
source ~/.callpact/bin/callpact-activate.sh
callpact env --check

The scan obtains the default corpus automatically when no managed corpus is installed: an installation that already holds one keeps exactly that set until an explicit callpact init changes it. Loaded modules still need matching authoritative native contracts to become shims; check the exclusion diagnostics and the eligibility requirements. Other platforms and variants need their own reviewed overlays.

Native commands still resolve outside the shim directory

In bash or zsh, inspect the current terminal:

printf 'shim dir: %s\n' "$CALLPACT_SHIM_DIR"
type -a cat head
command -v cat
command -v head
callpact env --check

For the default installation, the resolved paths should be ~/.callpact/bin/cat and ~/.callpact/bin/head. Source the installed ~/.callpact/bin/callpact-activate.sh helper (or the printed custom helper) to activate this terminal. Aliases and functions can take precedence over PATH; absolute binary paths bypass shims. Inspect these with type -a; a separate rehash is not normally required after sourcing the helper.

Applications launched from a governed shell cannot find a tool

Symptom: VS Code, Cursor or another editor opened from the command line (code .) reports no Git repository, no source control provider, or a GitHub integration that cannot detect the project — while git status typed in the same terminal works.

Cause: the application inherited the shim PATH from the shell that launched it. Its internal calls are undeclared routes, the shim refuses them by design, and the application sees only a failed probe rather than the refusal. This is not specific to code: any launcher, renamed command or custom wrapper inherits the same PATH, because the shim matches command names, not the process that started them. callpact env --check reports the affected commands before this happens:

[WARN] INHERIT git: 7 of 142 routes; applications started from a governed shell inherit the shim PATH, ...

Fix, in order of preference:

  1. Quit the application completely — closing its window leaves the running process with the environment it was started in — then deactivate and start it again:
source ~/.callpact/bin/callpact-deactivate.sh
code .
  1. Start it through LaunchServices so it never inherits the shell environment:
open -a "Visual Studio Code" .
  1. Keep the editor and the terminal governed by excluding the command from shims. Other commands keep theirs; the editor and the terminal then share the ungoverned git:
callpact env --reload --exclude git
  1. Pin the editor to the real binary where it offers the setting. VS Code's git.path covers only that editor's Git integration.

--scanned all does not fix this: the editor also probes flag forms such as git --version that match no route, and widening the admission policy weakens governance for every caller. A terminal opened inside the editor is a new shell and activates shims normally.

The installed CallPact does not recognize env --check

Confirm which build the terminal uses, then update it using your installation method. For a source installation, run cargo install --path . --force from the updated checkout. After updating the binary:

command -v callpact
callpact env --help
callpact env --enable
source ~/.callpact/bin/callpact-activate.sh
callpact env --check

Serve command does nothing (stdio mode)

Stdio mode reads JSON-RPC from stdin and writes to stdout. It is launched by AI agents, not run interactively. Use --show-config to get the agent integration snippet.

Tool invocation fails with ACL denied

The starter ACL denies destructive and network-reaching commands to every caller. Its developer profile also lets the local shell run cli.* above those denials; strict grants nothing implicitly. Edit ~/.callpact/acl.yaml:

rules:
  - callers: ["*"]
    targets: ["cli.<tool>.<command>"]
    effect: allow

Stale scan results

callpact scan <tool> --no-cache
# Or clear cache entirely:
rm -rf ~/.callpact/cache/

Known Limitations

  • Authenticated identities: MCP and A2A token/JWT modes carry identities into execution. JWT roles gate ACL conditions; module-chain callers and authenticated subjects are separate — see §11.
  • Windows: Not supported.
  • Interactive CLI tools: PTY-based interactive sessions (e.g., vim) remain unsupported. Module-mode callpact exec supplies no stdin; native exec and shims inherit stdin only with an explicit reviewed capability.
  • Streaming output: Captured execution buffers output; native shims pass stdout and stderr through directly, including in pipelines.