pando-ai 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,38 +1,162 @@
1
- # pandō CLI
1
+ # pandō — AI coding firewall
2
2
 
3
- `pando-ai` is the standalone MCP CLI for the shared pandō engine runtime.
3
+ `pando-ai` is an **AI coding firewall**. It supervises your coding agents
4
+ (`codex` and `claude`) transparently, with two jobs:
4
5
 
5
- It starts the same core indexing and tool runtime used by the VS Code extension, but runs headlessly for terminal agents and local MCP clients.
6
+ 1. **Block unsafe operations** reduce the agent to a single audited tool (the
7
+ Pando MCP server) and intercept, rewrite, or block everything else.
8
+ 2. **Keep code local** — sit inline on the wire so model/tool traffic passes
9
+ through a local gateway you control.
10
+
11
+ It is built on the same indexing + MCP engine as the Pandō VS Code extension.
6
12
 
7
13
  ## Install
8
14
 
9
15
  Requires Node.js `22.5.0` or newer.
10
16
 
11
- Run without installing globally:
12
-
13
17
  ```bash
14
- npx -y pando-ai --help
18
+ npx -y pando-ai
15
19
  ```
16
20
 
17
- Or install globally:
21
+ On a terminal this opens the **firewall console**: it detects whether `codex`
22
+ and `claude` are protected, offers to install supervised launchers for any that
23
+ aren't, and shows current status and policy. After installation you keep running
24
+ `codex` and `claude` normally — Pando supervises each launch.
25
+
26
+ ## How it works
27
+
28
+ Two choke points, one ruleset:
29
+
30
+ - **Launch shim** (`~/.pando/bin` ahead of the real tools on PATH) — supervises
31
+ every `codex`/`claude` invocation. It disables the agent's native tools where
32
+ supported, installs the Pando MCP server (root-scoped to your project), and
33
+ applies the MCP allow/deny policy via the agent's own launch flags.
34
+ - **Wire gateway** (a local reverse proxy speaking the OpenAI Responses API and
35
+ Anthropic Messages API) — sits inline on every supported request and forwards
36
+ it to the upstream you control, so traffic stays local. It blocks off-policy
37
+ tool definitions, tool calls, and tool results before they can cross the
38
+ provider boundary, and blocks off-policy tool calls on model responses before
39
+ the agent can execute them. When enabled, it runs the protocol-adapted
40
+ working-set memory engine ported from `pando-proxy`.
41
+ - **Memory manager** (`PANDO_GATEWAY_MEMORY=1`, off by default) — maintains a
42
+ per-session working set and archive recall path. The memory core is separate
43
+ from policy enforcement: policy decides which tools are allowed; memory
44
+ decides which prior context remains visible. OpenAI Responses and Anthropic
45
+ Messages use protocol adapters around the same core. The maintenance
46
+ classifier currently uses an OpenAI-compatible structured model backend.
47
+ - **Policy** (`~/.pando/policy.toml`, or a Pando DB table) — one allowlist plus a
48
+ default action. By default, native tools are denied and non-Pando MCP servers
49
+ are denied; Pando MCP is always allowed. See `[native_tools]`, `[other_mcp]`,
50
+ `[proxy]`, `[firewall]`.
51
+
52
+ ### Supported model APIs
53
+
54
+ The gateway supports the current agent-facing APIs used by the supervised
55
+ launchers:
56
+
57
+ - OpenAI/OpenAI-compatible Responses API: `/v1/responses`
58
+ - Anthropic Messages API: `/v1/messages`
59
+
60
+ Legacy completion APIs, including OpenAI chat/completions and Anthropic
61
+ `/v1/complete`, are intentionally unsupported.
62
+
63
+ ### Enforcement matrix (what is actually enforced)
64
+
65
+ | Capability | Claude Code | Codex |
66
+ | --- | --- | --- |
67
+ | Disable native tools | ✅ `--tools ""` (MCP stays available) + gateway/hook block | ⚠️ read-only sandbox + web search disabled + request/response gateway block |
68
+ | Install Pando MCP, root-scoped | ✅ `--mcp-config` | ✅ required `-c mcp_servers.pando.*` |
69
+ | `other_mcp: deny_all` | ✅ `--strict-mcp-config` (Pando only) + gateway/hook block | ✅ request/response gateway block |
70
+ | `other_mcp: allow_list` | ✅ strict config with Pando + named servers + gateway/hook block | ✅ request/response gateway block |
71
+ | `other_mcp: deny_list` | ✅ `--disallowedTools` removes denied names + gateway/hook block | ✅ request/response gateway block |
72
+ | Route traffic through local gateway | ✅ API-key/token/helper auth via `ANTHROPIC_BASE_URL`; hooks are always on | ✅ provider override |
73
+
74
+ - **Codex** has no documented strict-MCP switch and no exact `--tools ""`
75
+ equivalent, so launch-time stripping is best-effort. Pando marks its MCP
76
+ server required, disables Codex web search when native tools are denied,
77
+ strips off-policy tool definitions from `/v1/responses` requests, blocks
78
+ provider-bound off-policy tool call/result transcript items before they reach
79
+ the model provider, and blocks off-policy tool calls in model responses before
80
+ Codex can execute them.
81
+ - **Claude Code** always gets Pando hook settings for tool-call/tool-result
82
+ enforcement. API-key, auth-token, or Claude Code `apiKeyHelper` auth also
83
+ enables gateway mode through `ANTHROPIC_BASE_URL`. Subscription-only launches
84
+ use hooks-only fallback because Claude Code does not route subscription OAuth
85
+ through a custom gateway.
86
+ - **Claude Desktop general chat**: not part of the strong-enforcement claim;
87
+ transparent interception is not reliable there without app-level controls.
88
+
89
+ ### Claude Code gateway and hook modes
90
+
91
+ Claude Code tool enforcement is hook-based for every launch. Official Claude
92
+ Code gateway configuration uses `ANTHROPIC_BASE_URL` with
93
+ `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`, or `apiKeyHelper`; those
94
+ credentials take precedence over subscription OAuth. When any of those
95
+ credentials are configured and `[proxy].claude = "enforce"`, Pando also routes
96
+ Claude through the local gateway for full-wire interception and optional memory.
97
+
98
+ Pando injects Claude hook settings on each launch:
99
+
100
+ - `PreToolUse` blocks off-policy tool calls before execution.
101
+ - `PostToolUse` replaces off-policy tool output with a Pando block message
102
+ before Claude can use it.
103
+ - `PostToolUseFailure` adds retry context; the tool has already failed, so this
104
+ hook is not treated as a hard enforcement boundary.
105
+ - `PostToolBatch` blocks the loop before the next model request if a serialized
106
+ off-policy tool result appears in the batch.
107
+
108
+ Hooks are the Claude tool firewall: they prevent Claude from using
109
+ non-Pando/off-policy tools and prevent their results from becoming usable model
110
+ context. Gateway mode is an additional full-wire layer for request/response
111
+ inspection, memory, and provider-bound enforcement; hooks still run when the
112
+ gateway is active.
113
+
114
+ ### Provider proxy toggle
115
+
116
+ Users can enable or disable the local provider proxy per supervised tool:
18
117
 
19
118
  ```bash
20
- npm install -g pando-ai
21
- pando-ai --help
119
+ pando-ai proxy status
120
+ pando-ai proxy enable claude
121
+ pando-ai proxy disable claude
122
+ pando-ai proxy enable codex
123
+ pando-ai proxy disable codex
124
+ ```
125
+
126
+ This writes the `[proxy]` section in `~/.pando/policy.toml`:
127
+
128
+ ```toml
129
+ [proxy]
130
+ codex = "enforce" # enforce | off
131
+ claude = "enforce" # enforce | off
22
132
  ```
23
133
 
24
- ## Usage
134
+ When Claude proxying is off, Pando uses hooks-only fallback for
135
+ tool-call/tool-result enforcement. When Codex proxying is off, Pando still
136
+ launches Codex with Pando MCP and best-effort local restrictions, but
137
+ provider-bound gateway enforcement is disabled.
138
+
139
+ ## Surfaces
25
140
 
26
141
  ```bash
27
- pando-ai [project-path]
28
- pando-ai --version
29
- pando-ai --help
142
+ pando-ai # firewall console (TTY): status + proactive install
143
+ pando-ai install # force a (re)install pass
144
+ pando-ai serve [path] # stdio MCP server for MCP clients
145
+ pando-ai serve-http # HTTP MCP server
146
+ pando-ai gateway # run the firewall gateway in the foreground (debug)
147
+ pando-ai proxy status|enable|disable [codex|claude]
148
+ pando-ai login|logout|whoami
149
+ pando-ai config set telemetry false
30
150
  ```
31
151
 
32
- ## Commands
152
+ `pando-ai launch codex|claude -- <args>` is the supervised launcher the shims
153
+ call; you don't run it directly.
154
+
155
+ ## MCP serve mode
33
156
 
34
- - `pando-ai [project-path]` starts the engine for the given path, or the current working directory.
35
- - `pando-ai config set telemetry false` disables usage telemetry.
157
+ When invoked without a TTY (e.g. spawned by an MCP client) `pando-ai` starts the
158
+ engine over stdio for the given path, or the current working directory, exactly
159
+ as before. `pando-ai config set telemetry false` disables usage telemetry.
36
160
 
37
161
  ## Transport behavior
38
162