CallPact Feature Manifest¶
Project Overview¶
CallPact is a governed execution layer for CLI tools and HTTP APIs. It turns discoverable CLI commands into typed apcore modules, runs CLI commands locally, and serves CLI and imported OpenAPI operations through MCP and A2A. Configured access controls, approval checks and audit records accompany the execution path.
Version: 0.17.0
Status: CLI discovery, initialization, binding/Skill generation, local
module execution, reviewed native argv and PATH shims, MCP/A2A serving, OpenAPI
import and CLI contract verification are implemented. Native coverage remains
a bounded reviewed-overlay pilot; verification evidence covers explicit cases.
Run cargo test --all-features for the current test count. Host-dependent
git/docker scan tests and the macOS native example are opt-in.
Current capability inventory¶
| Capability | Implementation / entry point | Scope |
|---|---|---|
| CLI discovery and schemas | scanner, adapter; scan |
Help, man pages, completions, variant-aware overlays, JSON Schema and annotations |
| Reviewed source initialization | corpus, cli::init; init |
Cached rules from release archives or Git, revision pinning, version-range checks, offline use, refresh and binding/policy preservation |
| One-step machine preparation | cli::setup, scripts/install.sh; setup |
Composes init, shim installation without shell-startup edits, and host configuration for detected agents; the installer verifies the release checksum and never uses sudo |
| Installed corpus management | cli::corpus; corpus |
Lists installed corpora with source and identity, and removes one without touching the rest |
| Terminal-agent execution routing | skills/callpact/SKILL.md, scripts/install_agent_skill.py |
Fallback Claude Code/Antigravity/Codex/pi/OpenCode Skill for hosts without shell/hook integration; host integration uses callpact agent and callpact sh, and the Skill routes exec only when no host integration is active |
| Binding and agent guidance output | output; scan --skills-dir |
YAML bindings and optional Claude Skills; Rust API tool-definition export |
| Policy authorship | governance::acl; acl |
acl init writes a starter policy once (--profile developer\|strict), acl sync refreshes only the destructive and open-world denials, acl explain names the rule that decided a module. scan writes bindings and never policy |
| Discovery and policy inspection | list --verbose, paths |
Module schemas, annotations, ACL context, validated evidence and filesystem boundary checks |
| Local execution | cli::exec, module, cli::child_exec; exec |
Module JSON and reviewed native argv; preflight dry-run, child status and native streams; embedded child commands (find -exec) default to refusal, with analyze and per-match delegate policies |
| Shell integration | cli::env, shim, shell_init; env |
Eligible external-command PATH shims, startup activation, refresh, removal and diagnostics; --scanned routes execute the original argv after schema validation |
| Agent shell launcher | cli::sh; sh |
Executes a real shell with the installed shim environment; readiness diagnostics and host config snippets. Not a full-governance boundary |
| Host hook translation | cli::hook; hook |
Rewrites simple Claude Code (Bash) and Antigravity (run_command) calls to callpact sh -c through updatedInput / overwrite; stateful and compound commands rely on PATH shims |
| Host configuration helper | cli::agent; agent |
Prints OpenCode/pi/Codex/Claude Code/Antigravity setup, checks launcher/host readiness, and merges configuration only with --write; OpenCode/pi --write refuses when the launcher is not installed |
| MCP serving | mcp; serve |
stdio, streamable HTTP, legacy SSE, structured results, Explorer, client snippets and optional metrics |
| A2A serving | a2a; a2a |
Authenticated agent server and agent card over the shared executor |
| HTTP API import | openapi; serve/a2a --openapi |
OpenAPI 3.0/3.1 file/URL import at startup; supported JSON proxy operations |
| Execution governance | governance, module::approval, auth |
Configured ACL/approval, token/JWT identities and payload-free governance audit records |
| CLI process controls | module::executor, module::io, governance::path_guard |
Typed-path checks, direct argv, scrubbed environment, timeout and capped captured output |
| CLI contract verification | verification, cli::verify; verify |
Source drift and explicit readonly/isolated/authorized dry-run cases with digest-bound evidence |
| Configuration and diagnostics | config, logging; config |
CLI/env/file defaults, structured errors, rotating diagnostics and argument-log controls |
Local execution loads the default ACL when present and installs an approval
gate. Servers require --acl to enforce access control; MCP interactive approval
requires --enable-approval, while A2A approval stores are library-only. OpenAPI
modules use shared schema validation, configured ACLs and auditing, but not CLI
filesystem checks. HTTP import is unavailable to local exec/shims. Normal
execution is not OS-sandboxed unless the module is selected in
docs/sandbox.md; 0.15.0 implements opt-in delegation for the
selected modules. The current native BSD
pilot covers cat/head/ls; builtins and absolute paths can bypass PATH shims.
A command that embeds another program's argv (find . -exec rm {} \;) is
refused by default. child_exec.mode: analyze resolves the child to its own
module and applies that module's ACL, path policy and approval at the parent's
starting paths; delegate runs each match through the installed child shim
with a scoped delegated approval, so the actual {} path, symlinks and
-execdir are judged per match. Neither mode is OS confinement: a child that
computes its own paths is refused, and the sandbox delegation in
(docs/sandbox.md) is the enforcement boundary for selected
modules (0.15.0). See the user manual
and docs/overlays.md.
The section headings below tagged "(v0.1.0 …)" record when each piece first landed. For the authoritative current state see
CHANGELOG.mdanddocs/user-manual.md.
Architecture¶
Scan path — a binary becomes governed bindings on disk:
CLI Tool Binary
|
v
[Scanner Engine] ──→ ScannedCLITool (tiers 1-3: --help, man, completions)
| (tier 4: curated overlay, if one matches)
v
[Adapter Layer] ──→ ScannedModule (apcore-toolkit)
|
├──→ [YamlOutput] ──→ .binding.yaml files (one per module)
└──→ [SkillOutput] ──→ .claude/skills/<id>/SKILL.md (with --skills-dir)
Policy is a separate document: callpact acl init/sync (and callpact init) write
acl.yaml; the scan path never touches it.
Call path — MCP, A2A, local execution and the library use shared executor construction. Servers enable ACL and approval explicitly; local execution loads the default ACL when present and always installs the approval gate. Local execution disables retry and circuit breaking and suppresses argument logs:
MCP client A2A client exec / PATH shims Rust library
| | | |
+----------------+------------------+-------------------+
|
[apcore Executor]
|
schema validation / configured ACL
approval handler / middleware chain
|
+------------+------------+
| |
[CliModule] [HTTP proxy module]
| server import only
typed-path checks |
argv validation |
| |
direct argv / scrubbed env HTTP API
timeout / captured output cap upstream timeout
| |
CLI binary |
+------------+------------+
|
audit.jsonl: execution / refusal
and ACL decision records
CLI process controls do not apply to the HTTP proxy branch. Audit records cover both module types; the API must enforce its own data authorization.
Module Map¶
src/
├── a2a/ A2A agent server integration
│ └── server A2aServerBuilder wrapping apcore_a2a; bind-URL validation
├── adapter/ ScannedCLITool → ScannedModule conversion
│ ├── converter CliToolConverter (tree flattening, module ID generation,
│ │ mark_escalating_params for per-call approval)
│ ├── schema JSON Schema from flags/args, incl. the x-apexe-* keywords
│ ├── contract CommandContract: the flattened per-command scan report
│ ├── annotations ModuleAnnotations inference (readonly/destructive/
│ │ idempotent/open_world, EXEC_WRAPPER_TOOLS)
│ └── overlay ToolOverlay: curated flag/arg descriptions, apply_overlay
├── auth Transport authentication for the HTTP-family MCP/A2A
│ transports (token/JWT, loopback-bind detection)
├── cli/ clap CLI entry point (setup/scan/serve/a2a/exec/sh/hook/agent/env/verify/init/list/corpus/acl/sandbox/config/paths)
│ ├── init Reviewed source bootstrap, binding ownership and starter ACL
│ ├── exec Module JSON and native argv through shared governance
│ ├── config_set Persistent log-level updates preserving other settings
│ ├── config_gen Claude Desktop / Cursor config snippet generation
│ ├── env Governed shim enable/reload/disable and activation output
│ └── shell_init Managed startup blocks for automatic terminal activation
├── config CallPactConfig + apcore CoreConfig integration
├── corpus/ Managed Git snapshots, validated catalog and source acquisition
├── logging Binary diagnostic file logging with daily rotation
├── errors CallPactError + From<CallPactError> for ModuleError
├── governance/ Access control, audit, filesystem boundary
│ ├── acl AclManager wrapping apcore::ACL
│ ├── audit AuditManager, CallPact's own JSONL execution/refusal record
│ └── path_guard PathGuard: resolves every x-apexe-path argument and checks
│ it against the system/credential baselines. Always-on, no
│ flag; `callpact paths` reports it. CLI process controls
│ are in module/executor.rs and module/io.rs
├── mcp/ MCP server integration
│ └── server McpServerBuilder wrapping apcore_mcp::APCoreMCP
├── models/ ScannedCLITool, ScannedCommand, ScannedFlag, ScannedArg
├── module/ apcore Module trait implementation
│ ├── cli_module CliModule (subprocess execution via Module trait)
│ ├── executor Argument building, validation, env scrubbing,
│ │ tokio::process (timeout + kill_on_drop)
│ ├── approval ApprovalGate wrapping apcore's approval handlers
│ ├── breaker HealthOnlyCircuitBreaker middleware
│ ├── failure_log Payload-free failure/refusal logging middleware
│ └── registry build_executor: load bindings, wire middleware/ACL/approval
├── output/ Binding file I/O
│ ├── yaml YamlOutput wrapping apcore_toolkit::YAMLWriter
│ ├── loader load_modules_from_dir (reads .binding.yaml)
│ └── skill SkillOutput: writes a Claude Skill (SKILL.md) per module
├── openapi HTTP operation import shared by MCP and A2A
├── runtime_path Clean PATH resolution excluding governed shim directories
├── verification/ Source drift, isolated cases and digest-bound evidence
└── scanner/ Deterministic CLI scanner engine (tiers 1-3 + overlay)
├── orchestrator ScanOrchestrator (top-level coordinator)
├── pipeline ParserPipeline (priority-based parser selection)
├── parsers/ Man, BSD Usage, GNU, Click, Cobra, Clap format parsers
├── discovery SubcommandDiscovery (recursive subcommand scanning)
├── cache ScanCache (JSON filesystem caching)
├── resolver ToolResolver (binary path + version + format detection)
├── exec run_with_timeout: bounded subprocess probes
├── man_page Man-page section/option/example extraction
├── variant Tool variant detection (bsd/gnu/apple/busybox)
├── overlay_store External corpus + user overlay loading and matching
├── value_placeholder Shared placeholder → ValueType inference table
├── completion Shell-completion-script subcommand discovery
└── protocol ParsedHelp / CliParser: the shared parser contract
apcore Ecosystem Integration¶
| Crate | Version | Usage |
|---|---|---|
apcore |
0.34.1 | Module trait, Registry, ACL, ModuleError, ErrorCode, Context, Config |
apcore-surfaces |
0.1.1 | Toolkit scanning and writers, HTTP proxying, MCP and A2A servers, man pages and module detail formatting |
v0.1.0 Features¶
Scanner Engine (preserved from v0.1.x)¶
Three-tier deterministic scanner with programmatic parser registration, plus a fourth tier that applies a human-reviewed overlay on top of what the first three observed:
- Tier 1 --
--helpparser (6 built-in parsers: Man, BSD Usage, GNU, Click, Cobra, Clap) - Tier 2 -- Man page parser (DESCRIPTION / OPTIONS / EXAMPLES extraction)
- Tier 3 -- Shell completion parser (zsh/bash subcommand discovery)
- Tier 4 -- Curated overlay (applied only when one matches the detected variant; see below)
Additional: ParserPipeline, SubcommandDiscovery, ScanCache, ToolResolver, programmatic parser registration.
Adapter Layer (v0.1.0 new)¶
CliToolConverter: flattens subcommand trees →Vec<ScannedModule>schema::build_input_schema/output_schema: JSON Schema from flags/argsannotations::infer: readonly/destructive/idempotent inference from command names
Module Executor (v0.1.0 new)¶
CliModule: implements apcoreModuletrait for CLI subprocess execution- Async execution via
tokio::process::Commandwithtokio::time::timeoutandkill_on_drop(true) - No shell is ever invoked — argv is built as a
Vec<String>and passed straight toexecve, so shell metacharacters (;|&$\'") are inert data, not something the argument path needs to block. The actual guard rejects a value that would be parsed as an *option* by the wrapped binary (a leading-, unless the schema declares--` support) and rejects control characters. - Argument validation happens inline in
executor::build_argv(there is no separatepreflightstep)
Output Layer (v0.1.0 new, replaces v0.1.x binding generator)¶
YamlOutput: wraps apcore-toolkitYAMLWriterwith verificationload_modules_from_dir: reads.binding.yamlfiles back asVec<ScannedModule>
MCP Server (v0.1.0 new, replaces v0.1.x self-built server)¶
McpServerBuilder: bindings_dir → Registry → Executor → APCoreMCP- Transports: stdio, streamable-http (was "http"), SSE
- MCP tool discovery and invocation via the published apcore-mcp SDK.
It negotiates
2025-06-18and retains2025-03-26and2024-11-05. Compatible clients receive objectoutputSchemaand redactedstructuredContent, with JSON text retained for compatibility. HTTP selects the format per protocol-version header. - Explorer UI (HTTP transports)
- Transport authentication is a first-class CLI surface (
--auth token|jwt|none,--auth-token,--jwt-secret), required by default on the HTTP-family transports; a non-loopback bind without an explicit acknowledgement (--allow-unauthenticated-bind) refuses to start. Seedocs/user-manual.md§9.
Governance (v0.1.0 rewritten, extended through v0.7.0)¶
AclManager: wrapsapcore::ACL, generates default rules from annotations; fails closed when a configured ACL is missing/malformed. Opt-in — a server started without--aclenforces no access controlAuditManager: CallPact's own append-only JSONL trail (log0o600); records executions, refusals (event,trace_id,caller_id,error_code) and ACL allow/deny decisions. No input values, hashed or otherwise — see user-manual §9.2PathGuard(v0.7.0): resolves every argument the schema typesx-apexe-pathand checks it against two compiled-in baselines — system paths bind writers, credential paths bind readers and writers alike. Always-on, no flag.config.yamlextends it withadditional_denied_pathsand relaxes it withallowed_paths;callpact pathsreports the installed boundaryApprovalGate: weighs actual escalating inputs and audits refusals. Local execution installs it automatically. MCP interactive approval is opt-in via--enable-approval; approval stores can be supplied through the MCP/A2A library builders- CLI process controls: always-on in
module/executor.rsandmodule/io.rs— env scrubbing, direct argv, captured output cap, timeout +kill_on_drop, plus option-injection, control-character andx-apexe-execguards. Captured execution is bounded bydefault_timeout; local passthrough is unbounded by default (local_timeout: 0) because the caller owns a terminal. Native streams are inherited. Normal execution is unsandboxed by default;governance::sandboxadds opt-in per-module confinement in 0.15.0 (see below andsandbox.md).
Tool Overlays & Variant Detection (v0.4.0, extended in v0.5.0)¶
- Variant detection: every scan probes the binary (
<binary> --version) and classifies it asbsd,gnu,apple,busyboxorunknown, surfaced asScannedCLITool.variant. Same command name, different implementation (macOS/bin/lsvs. Homebrew GNUls) now yields different, correct results instead of one overwriting the other in cache. - Curated overlays: a reviewed description of one
(command, variant, version_range), matched byprobe>platform+binary_globs>platformalone.mode: authoritativereplaces the scan surface;mode: mergeoverrides matching flags on top of the scan. CallPact ships none: the corpus is the cli-permissions repository, read throughoverlay_dirs,~/.callpact/overlays/*.{json,yaml},callpact scan --overlay <PATH>, or one of the packaged locations searched by default. Format defined bytool-overlay.schema.json, which lives with the corpus. That schema still pins1.0/1.1;commands[]andglobal_flagsatschema_version: "2.0"are a preview this build accepts ahead of the schema. Seedocs/overlays.mdfor the authoring/verification procedure. - Per-route grammar trust (v0.10.0):
metadata.grammaris stamped on every binding,reviewedonly when every flag the route can emit, globals included, came from a curated overlay andscannedotherwise. Nativecallpact execandVerifiedshims admit reviewed routes only; bindings written before the stamp fall back toshim_contract.authoritative. See the threat model. - Provenance requirement: an overlay at
confidence: verifiedmust record how it was checked (platform, version, source document, date); the schema rejects averifiedoverlay without it. - Per-flag confidence/sources: every
ScannedFlagrecords source evidence capped athigh; runtimeverifiedmodule confidence is earned by explicit cases with matching digests.callpact verify --recordpersists case evidence and invalidates stale binding, binary and case-file fingerprints. Dry-run and private-CLI cases require OS isolation; see verification. - Man page
EXAMPLESextraction (v0.5.0):ScannedCLITool.examples/CommandContract.examplescarry hand-written invocations pulled from a tool's man page. open_worldinference (v0.5.0, breaking): risk annotation is inferred from the executable and networked subcommand names instead of being hardcoded, soRisk::OpenWorldis now actually emitted (e.g.curl,git push/pull/clone).
Key Rust Crates¶
| Crate | Purpose |
|---|---|
apcore |
Core module system, ACL, errors |
apcore-surfaces |
Toolkit scanning and writers, HTTP proxying, MCP and A2A servers, man pages and module detail formatting |
clap (derive mode) |
CLI argument parsing |
serde + serde_json + serde_yaml |
Serialization |
tokio |
Async runtime |
tracing + tracing-subscriber |
Structured logging |
thiserror |
Typed error definitions |
regex |
Help-text parsing and format detection (all parsers) |
chrono |
RFC 3339 timestamps for the audit trail |
uuid |
UUID v4 for trace IDs |
shell-words |
Shell argument splitting |
Initialization¶
callpact init bootstraps reviewed command coverage using the shared scanner and
ACL writer. Source selection, pinning and refresh use --overlays, --ref and
--refresh; the old overlays command is removed. Initialization preserves
existing policy and custom/edited bindings, and reports fallback coverage.
Scope and remaining work¶
- Broader native command coverage — Requires matching reviewed grammar and explicit stdin/bundling capabilities. Scanner coverage alone does not make a command eligible for native argv or PATH shims.
- Session daemon — Deferred F8 stage; current shims invoke the CallPact process for each command. See F8 for measurements.
- Normal execution sandboxing — 0.15.0 implements opt-in delegation for
modules listed in
sandbox.modules: contract + four built-in backends (systemd-runsystem/root,bwrap,sandbox-exec,docker), per-platform defaults (Linux localbwrap; macOSsandbox-exec), fail-closedrequired/auto, and audit.systemd-run --useris not a path backend: it ignoresReadOnlyPaths/InaccessiblePaths. Unselected modules remain unsandboxed. Optionalnono/Apple container/microVM/remote adapters are later. Seedocs/sandbox.md, F9 and the threat model. - Additional HTTP proxy formats — Multipart, per-input header/cookie parameters and non-JSON responses are outside the current OpenAPI surface. See OpenAPI import for supported method/parameter combinations.
- Native Windows scanning — Not supported; Windows help and PowerShell reflection need their own discovery path.
CallPact evo— Deferred; depends on apevo product maturity.