Skip to content

Commit 986bba5

Browse files
authored
docs: make public docs friendlier (#173)
docs: make public docs friendlier
1 parent e744bd9 commit 986bba5

12 files changed

Lines changed: 418 additions & 233 deletions

README.md

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,38 @@
22

33
> **Keep your castle secure and moving.**
44
5-
Calciforge is a self-hosted security gateway for AI agents. It sits
6-
between your agents and the rest of the world, so every agent gets its
7-
own model routes, command permissions, destination-scoped secret
8-
substitution, and audit trail without holding your raw API keys.
5+
Calciforge is a self-hosted safety layer for AI agents. It sits between
6+
your agents and the outside world, then applies the rules you set:
7+
which model an agent may use, which commands it may run, where a secret
8+
may be sent, and what gets written to the audit trail. The agent can ask
9+
for `{{secret:NAME}}`; it does not need to hold the actual API key.
910

10-
The longer feature tour, configuration examples, and architecture notes
11-
live on the docs site: **[calciforge.org](https://calciforge.org/)**.
11+
The longer tour, setup examples, and architecture notes live on
12+
**[calciforge.org](https://calciforge.org/)**.
1213

1314
## What Works Today
1415

15-
This is usable for a solo operator, but still in active hardening. New
16-
installations should be smoke-tested against their real channel
17-
credentials, fnox store, gateway providers, and synthetic routes before
18-
being treated as daily-driver infrastructure.
16+
This is usable for a solo operator, but still being hardened. Before you
17+
make it daily-driver infrastructure, test it with your real chat
18+
channels, fnox secret store, model providers, and routing choices. Castles
19+
move; config should still have brakes, labels, and fewer mysterious bathroom
20+
potions than Howl would tolerate.
1921

2022
| Area | Status | Where to read more |
2123
|---|---:|---|
22-
| `{{secret:NAME}}` substitution in URL, headers, and body | Working | [Secret management](https://calciforge.org/#secret-management) |
24+
| Explicit `{{secret:NAME}}` substitution in URL, headers, and body | Working | [Secret management](https://calciforge.org/#secret-management) |
25+
| Opaque placeholder credentials for supervised agent env vars or managed credential files | Staged primitives | [Placeholder injection mode](https://calciforge.org/roadmap/placeholder-injection-mode.html) |
2326
| Per-secret destination allowlists | Working | [Outbound traffic gating](https://calciforge.org/#outbound-traffic-gating) |
24-
| Local paste UI for one-shot and bulk `.env` secret input | Working | [Secret management](https://calciforge.org/#secret-management) |
25-
| MCP and CLI tools for agent-facing secret-name discovery, with no value readback | Working | [Agent-facing tools](https://calciforge.org/#agent-facing-tools-mcp) |
26-
| Agent runtime contract for CLI-first guidance, optional MCP, artifacts, and future Calciforge APIs | Working draft | [Agent runtime contract](docs/agent-runtime-contract.md) |
27+
| Local paste form for one-shot and bulk `.env` secret input | Working | [Secret management](https://calciforge.org/#secret-management) |
28+
| Command-line and optional MCP tools for agent-facing secret-name discovery, with no value readback | Working | [Agent-facing tools](https://calciforge.org/#agent-facing-tools-mcp-and-cli) |
29+
| Agent runtime contract for command-line guidance, optional MCP, artifacts, and future Calciforge APIs | Working draft | [Agent runtime contract](docs/agent-runtime-contract.md) |
2730
| Telegram, Matrix, WhatsApp, Signal, and text/iMessage routing | Working | [Multi-channel chat](https://calciforge.org/#multi-channel-chat) |
2831
| OpenAI-compatible model gateway, provider routing, model aliases, alloys, cascades, dispatchers, and local model switching | Working | [Model gateway](docs/model-gateway.md) |
2932
| Helicone-backed gateway observability with dashboard-visible doctor checks | Working | [Model gateway](docs/model-gateway.md#external-gateway-engines) |
3033
| Codex CLI and OpenClaw Codex subscription/OAuth integration paths | Working | [Codex integration](docs/codex-openclaw-integration.md) |
3134
| `calciforge doctor` config/state/endpoint diagnostics | Working | [Quick Start](#quick-start) |
3235
| Default-on inbound prompt-injection scanning, with opt-in outbound exfiltration and response secret-leak heuristics via editable policy | Working | [Traffic gating](https://calciforge.org/#outbound-traffic-gating) |
33-
| Configurable scanner checks with editable Starlark policy, Rust-backed `regex_match`, and remote HTTP/LLM extension points | Working | [Security gateway](docs/security-gateway.md) |
36+
| Configurable scanner checks with editable Starlark policy, Rust-backed `regex_match`, and optional remote model review | Working | [Security gateway](docs/security-gateway.md) |
3437
| Contributor red-team fixtures for prompt-injection, encoding, Unicode, and tool-policy bypass cases | Working | [Security gateway](docs/security-gateway.md#testing) |
3538
| [`clash`](https://crates.io/crates/clash)-backed tool policy via the `clashd` sidecar | Working | [Policy sidecar](crates/clashd/README.md) |
3639
| mTLS `host-agent` for ZFS, systemd, PCT, git, and exec operations | Working | [Host-agent](crates/host-agent/README.md) |
@@ -52,7 +55,7 @@ After install, the default local pieces are:
5255
- `security-proxy` on `127.0.0.1:8888` — substitution, destination checks, scanning, credential injection
5356
- `clashd` on `127.0.0.1:9001` — small HTTP adapter around the `clash` policy engine
5457
- `secrets-client` — env → fnox → Vaultwarden secret resolver
55-
- `calciforge-secrets`non-MCP secret-name discovery and `{{secret:NAME}}` reference helper
58+
- `calciforge-secrets`command-line secret-name discovery and `{{secret:NAME}}` reference helper
5659
- `paste-server` — short-lived local/LAN forms for adding secrets without putting values in chat history
5760

5861
The installer attempts to install and initialize `fnox` automatically.
@@ -97,9 +100,11 @@ routing, and observability. Route agent tool/web traffic through
97100
content needs scanning or `{{secret:NAME}}` substitution.
98101

99102
First-class adapters are expected to document and test their Calciforge ingress
100-
and egress paths. Generic CLI, generic ACP, and recipe adapters are useful but
101-
best effort unless their recipe proves a network boundary; hardened deployments
102-
should disable unverified adapters rather than assuming proxy env is enough.
103+
and egress paths. Generic command-line, generic ACP, and recipe adapters are
104+
useful but best effort unless their recipe proves a network boundary. ACP means
105+
Agent Client Protocol, a way to run persistent agent sessions. Hardened
106+
deployments should disable unverified adapters rather than assuming proxy
107+
environment variables are enough.
103108

104109
For externally managed agent daemons that Calciforge does not launch, proxying
105110
has to be configured on that daemon or its service manager and validated
@@ -110,13 +115,30 @@ export HTTP_PROXY=http://127.0.0.1:8888
110115
export NO_PROXY=localhost,127.0.0.1,::1
111116
```
112117

113-
Do not treat ambient `HTTPS_PROXY` as a security boundary unless it points at
114-
Calciforge's MITM listener and the agent runtime trusts the Calciforge CA. The
115-
installer enables the experimental hudsucker-backed listener and generates a
116-
persistent local CA by default; manual deployments can set
118+
Do not treat a generic `HTTPS_PROXY` setting as a security boundary unless it
119+
points at Calciforge's inspecting proxy and the agent runtime trusts the
120+
Calciforge CA. CA means certificate authority: a local certificate issuer your
121+
machine can trust so Calciforge may open an HTTPS tunnel, inspect the request,
122+
and then re-encrypt it. Without that trust step, HTTPS is mostly an opaque
123+
tube; Calciforge can see the destination host, not the page or request body
124+
inside. The installer enables the experimental hudsucker-backed listener and
125+
generates a persistent local CA by default; manual deployments can set
117126
`SECURITY_PROXY_CA_CERT=...` and `SECURITY_PROXY_CA_KEY=...`. Use a
118-
Calciforge-owned model gateway, fetch/tool path, audited recipe, or tested MITM
119-
proxy setup when HTTPS content needs scanning or secret substitution.
127+
Calciforge-owned model gateway, fetch/tool path, audited recipe, or tested
128+
inspecting-proxy setup when HTTPS content needs scanning or secret
129+
substitution.
130+
131+
Secret handling is in a transition period. The working path today is explicit
132+
reference syntax: an agent emits `{{secret:NAME}}`, and Calciforge resolves it
133+
only at an approved destination. The next path is opaque placeholder
134+
credentials: Calciforge will generate fake-looking random values such as
135+
`cfg_OPENAI_API_KEY_<random>`, register them with the security proxy, then
136+
provide them to supervised agents through env vars or managed credential files.
137+
That matters for agents like OpenClaw lanes that expect plaintext credential
138+
files or ordinary `*_API_KEY` variables. Once that path is wired, they can
139+
receive stand-ins instead of real secrets, and the gateway will swap in the
140+
real value only during an allowed outbound request. That path is not the
141+
default yet.
120142

121143
## Tiny Config Sketch
122144

docs/agent-runtime-contract.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ Secrets:
4242
- Put `{{secret:NAME}}` placeholders only into outbound requests that are
4343
routed through Calciforge. Do not try to resolve, print, log, or store secret
4444
values yourself.
45+
- If your runtime receives an env var or credential file whose value starts
46+
with `cfg_`, treat it as an opaque Calciforge-managed credential stand-in.
47+
Use it only in the provider request it was configured for. Do not print,
48+
transform, rotate, or copy it elsewhere.
4549

4650
Artifacts:
4751
- If Calciforge provides `CALCIFORGE_ARTIFACT_DIR`, write generated images,
@@ -71,6 +75,9 @@ Current surfaces:
7175
discovery and placeholder construction.
7276
- Optional `mcp-server` tools for the same secret-name workflow when MCP is
7377
explicitly configured.
78+
- Managed opaque placeholder credentials for supervised runtimes. Calciforge
79+
or an installer-managed wrapper must generate and provide these values; the
80+
agent should never invent a `cfg_*` value itself.
7481
- `CALCIFORGE_ARTIFACT_DIR` for recipes or adapters that produce files.
7582
- The OpenAI-compatible model gateway when a local agent should route model
7683
calls through Calciforge rather than directly to a provider.

docs/agents.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@ title: Agents, Identities, and Routing
55

66
# Agents, Identities, and Routing
77

8+
Status: Implemented
9+
810
This page covers the three configuration sections that together control who
911
can talk to Calciforge and which AI backend handles their messages:
1012

11-
- `[[agents]]` — AI backends Calciforge dispatches to
12-
- `[[identities]]` — users and their per-channel aliases
13-
- `[[routing]]` — maps identities to agents
13+
- `[[agents]]` — the AI backends Calciforge can call
14+
- `[[identities]]` — the people or service accounts Calciforge recognizes,
15+
plus their per-channel aliases
16+
- `[[routing]]` — the rules that map identities to agents
17+
18+
The short version: an incoming chat message becomes an identity, the identity
19+
chooses a route, and the route chooses an agent. It is a little like Howl's
20+
door dial, but with fewer colors and more audit logs.
1421

1522
## Architecture
1623

@@ -35,15 +42,17 @@ Channel message arrives
3542
## Agents (`[[agents]]`)
3643

3744
Each `[[agents]]` entry defines one AI backend. The `kind` field selects the
38-
adapter. All other fields are adapter-specific.
45+
adapter, which is the small piece of Calciforge that knows how to talk to that
46+
backend. All other fields are adapter-specific.
3947

4048
First-class adapters carry a stronger maintenance promise than generic
41-
wrappers: Calciforge should document how user ingress, callback auth, model
42-
egress, and tool/web egress are protected for that adapter, and regressions in
43-
those paths are Calciforge bugs where the upstream runtime gives us enough
44-
control to fix them. Generic CLI, generic ACP, and recipe adapters remain
45-
best-effort unless their recipe documents a tested boundary. In hardened
46-
profiles, prefer first-class adapters or explicitly verified recipes.
49+
wrappers: Calciforge should document how user messages arrive, how callbacks
50+
are authenticated, and how model/tool/web traffic is protected for that
51+
adapter. Regressions in those paths are Calciforge bugs when the upstream
52+
runtime gives us enough control to fix them. Generic command-line, generic ACP
53+
(Agent Client Protocol), and recipe adapters remain best-effort unless their
54+
recipe documents a tested boundary. In hardened profiles, prefer first-class
55+
adapters or explicitly verified recipes.
4756

4857
### Common fields
4958

@@ -63,7 +72,8 @@ profiles, prefer first-class adapters or explicitly verified recipes.
6372
### `kind = "openclaw-channel"`
6473

6574
HTTP adapter for an OpenClaw gateway that has the Calciforge bridge plugin
66-
installed. The plugin package is still named `calciforge-channel` for
75+
installed. HTTP is the web protocol used for the request between the two
76+
services. The plugin package is still named `calciforge-channel` for
6777
compatibility, but Calciforge owns the user-facing channel. Calciforge POSTs
6878
each routed message to the plugin's
6979
`/calciforge/inbound` route, OpenClaw runs the selected agent lane with its own
@@ -79,8 +89,9 @@ Calciforge controls identity routing, channel access, callback authentication,
7989
and artifact delivery for this path. OpenClaw's outbound model/tool traffic is
8090
only covered by Calciforge's security layers when you configure the OpenClaw
8191
service to use a tested proxy/tool/policy integration; installing the channel
82-
plugin alone does not prove outbound egress enforcement. In managed MITM mode,
83-
prompt-injection response blocking is the default safety gate. Outbound
92+
plugin alone does not prove outbound egress enforcement. In managed
93+
inspecting-proxy mode, prompt-injection response blocking is the default safety
94+
gate. Outbound
8495
exfiltration heuristics and high-entropy response secret-leak detection are
8596
operator opt-ins because they can be noisy on provider/tool transcripts.
8697

@@ -152,7 +163,7 @@ and the same reply token in `reply_auth_token_file`/`reply_auth_token`.
152163
### `kind = "openai-compat"`
153164

154165
Generic OpenAI-compatible HTTP endpoint (Ollama, LM Studio, Anthropic,
155-
Together, any endpoint that accepts `/v1/chat/completions`).
166+
Together, or any endpoint that accepts `/v1/chat/completions`).
156167

157168
Required: `endpoint`. Recommended: `model`.
158169

@@ -229,8 +240,9 @@ timeout_ms = 300000
229240

230241
### `kind = "cli"`
231242

232-
Spawns a subprocess for each message. The command receives the message via
233-
the argument template: `{message}` in `args` is replaced at dispatch time.
243+
Spawns a command-line subprocess for each message. The command receives the
244+
message via the argument template: `{message}` in `args` is replaced at
245+
dispatch time.
234246

235247
Required: `command`.
236248

docs/channels/matrix.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ title: Matrix Channel Setup
55

66
# Matrix Channel
77

8-
Calciforge connects to Matrix via the [Client-Server API v3](https://spec.matrix.org/v1.9/client-server-api/)
9-
using **HTTP long-polling** (`/sync`). No webhook endpoint or open firewall port required.
10-
11-
> **No end-to-end encryption.** The Matrix channel receives plaintext `m.text`
12-
> events and can send plaintext replies plus native media events for agent
13-
> artifacts. E2EE is not supported due to compile-time dependency conflicts in
14-
> the current workspace. Do not use this channel in rooms where E2EE is required.
8+
Calciforge connects to Matrix through the [Client-Server API v3](https://spec.matrix.org/v1.9/client-server-api/)
9+
using **HTTP long-polling** (`/sync`). Long-polling means Calciforge keeps
10+
asking the homeserver for new events, so no webhook endpoint or open firewall
11+
port is required.
12+
13+
> **No end-to-end encryption yet.** The Matrix channel currently uses the raw
14+
> Matrix Client-Server API, so it receives plaintext `m.text` events and sends
15+
> plaintext replies plus native media events for agent artifacts. Matrix itself
16+
> supports end-to-end encryption, and the Matrix Rust SDK has crypto support,
17+
> but Calciforge has not yet wired the required encrypted-room client state,
18+
> device trust, and persistent crypto store. Do not use this channel in rooms
19+
> where E2EE is required.
1520
1621
## Architecture
1722

@@ -42,7 +47,9 @@ curl -s -X POST 'https://matrix.example.com/_matrix/client/v3/login' \
4247
}' | grep access_token
4348
```
4449

45-
Copy the `access_token` value from the response.
50+
Copy the `access_token` value from the response and store it like a
51+
password. Access tokens are not decorative boilerplate; they are the key to
52+
the bot account.
4653

4754
3. **Find the room ID** for the room you want the bot to listen in:
4855
- In most clients: room settings → Advanced → Internal room ID
@@ -126,13 +133,20 @@ Some Matrix clients and bridges expose buttons or polls differently, and
126133
bridges such as Beeper may not support the downstream app's native controls.
127134
Use `ui_mode = "text"` in `[[channels]]` to force plain text for a channel;
128135
`ui_mode = "auto"` is reserved for channel-native affordances once the Matrix
129-
adapter can expose them without breaking bridged clients.
136+
adapter can expose them without breaking bridged clients. Plain text is not as
137+
flashy, but it behaves predictably across the moving castle of Matrix clients.
130138

131139
You can still use a richer channel, such as Telegram, as the Calciforge control
132140
surface for agent/model selection while keeping Matrix as the main chat room.
133141
Selections are keyed by Calciforge identity and apply across that operator's
134142
channels.
135143

144+
E2EE support is a high-priority follow-up, not a philosophical objection. The
145+
likely path is to move this adapter onto the Matrix Rust SDK crypto stack,
146+
persist the bot device's encrypted state, and add a real encrypted-room smoke
147+
test. Until that lands, treat Matrix as convenient self-hosted transport rather
148+
than the secure-room option it should become.
149+
136150
<div class="channel-ui-grid">
137151
<figure>
138152
<img src="../assets/channel-ui-matrix-fallback.svg" alt="Matrix text fallback for agent and model selection">

0 commit comments

Comments
 (0)