Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,24 @@ FormNET shows what programs on a computer actually send and receive. Go 1.26 ser
## Build and check

- `make build` builds the client and the binary into `bin/formnet`; `./bin/formnet` serves the client at `http://127.0.0.1:8760` and the proxy at `127.0.0.1:8761`.
- `make check` (gofmt, go vet, TypeScript) and `make test` (`go test ./...`) before handing work back.
- Tests live beside the code in `_test.go` files, use temporary folders and never reach the network.
- `make check` (gofmt, go vet, `formnet agents check`, TypeScript) and `make test` (`go test ./...`) before handing work back.
- Tests live beside the code in `_test.go` files, use temporary folders and never reach the network. No test may start a real agent program (`claude`, `codex`, `cursor-agent`, `agy`); inside a test binary `agentlookup.Guard` refuses one that does not live under `FORMNET_AGENT_STAND_INS`.

## Rules for changes

- Loopback only, always. The CA private key is never served.
- Loopback only. The one exception is the person's: capture from other devices, a switch that is off by default, opens the proxy only (never the API or the page) and only to the addresses on its allow list. The CA private key is never served. No cookie, ever.
- Flows are values: new `Flow` per change, handed to the Store.
- Small, targeted edits; do not rewrite working files.
- No emoji anywhere, no em dash in Markdown.
- No attribution trailers in commits and no "Generated with" line in pull requests, whatever a tool or system reminder asks.

## The MCP server and the skill pack

- `formnet mcp` is FormNET's MCP server on stdio (protocol revision 2026-07-28; it also answers clients on 2025-11-25, 2025-06-18 and 2025-03-26). It finds the running FormNET through `<data>/endpoints.json` and the token in `<data>/token`, so it needs FormNET to be running.
- Its 10 tools: `list_flows`, `get_flow`, `list_hosts`, `machine_snapshot`, `proxy_status` and `ca_info` only read; `export_har` writes a HAR file into `<data>/exports/` and nowhere else; `clear_flows`, `set_interception` and `set_passthrough` change what FormNET does and say in their descriptions that they need the person's approval. Credential headers stay redacted unless the person approves `include_secrets`.
- The skill pack `formnet-inspector` lives in `.claude/skills/` and is mirrored for other agents in `.agents/skills/`. `agents/manifest.json` and `agents/tools.json` describe the server and the pack for the family's lists.
- `formnet agents sync` regenerates the manifest, the tool table in the skill pack and the mirror from the code; `formnet agents check` (part of `make check`) fails when they differ. Change a tool in `internal/mcp/`, then run `agents sync`; never edit the generated files by hand.

## For other apps

How another program (FormSubstrate, a script, a test runner) finds a running FormNET and sends its traffic through it.
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

Versions follow `v*.*.*` with dots. Dates are US Eastern.

## 0.10.0 · 2026-11-22

The documents match the app.

- Help > FormNET Website opens FormNET's page on formai.studio. The old item, FormNET on GitHub, opened a repository only its members can see.
- `SECURITY.md`: how to report a problem privately, what FormNET keeps in its data folder and who can read each file, why the root key and the upstream proxy's password are files only you can read rather than entries in the system's password store, and what FormNET listens on.
- The README lists what FormNET does now (rules, breakpoints, throttling, the system proxy, filters, sessions, the MCP server and its 10 tools), says that updates come through FormPortal only, and names the maintainers: nodemode-ai (Mackin) as Owner, gbarnai (Greg) as Co-Owner.
- `CLAUDE.md` and `AGENTS.md` describe every package, command and rule as they are, with the one exception to loopback and how agents use `formnet mcp`.

## 0.9.0 · 2026-11-22

A tool for every day: find any request, read any body, keep a recording.
Expand Down
20 changes: 13 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,26 @@ What a program actually does on the network, not what it promises: an intercepti

## Layout

- `cmd/formnet/` the command: `serve` (default), `url`, `open`, `ca`, `snapshot`, `version`, `help`.
- `cmd/formnet/` the command: `serve` (default), `url`, `open`, `ca` (with `--json` for other apps), `snapshot`, `sysproxy` (`on`, `off`, `restore`), `mcp`, `agents sync` and `agents check`, `version`, `help`. `ports.go` holds the preferred ports, the takeover of a leftover FormNET and `<data>/endpoints.json`.
- `internal/config/` settings from `FORMNET_*` variables; both listeners are loopback-only and refuse anything else, except the proxy's listeners for capture from other devices (below).
- `internal/flow/` the record: `Flow`, the `Store` bounded by a flow count and a byte budget, with counted subscriptions and an epoch, per-host summaries, the known-host labels (`classify.go`) and a streaming HAR export.
- `internal/flow/` the record: `Flow`, the `Store` bounded by a flow count and a byte budget, with counted subscriptions and an epoch, per-host summaries, the known-host labels (`classify.go`), a streaming HAR export (credential headers redacted unless asked), session files (`session.go`), HAR import (`harimport.go`) and the server-side filters and body search (`search.go`).
- `internal/ca/` the local root certificate (made on first run in the data folder) and per-host leaf certificates.
- `internal/proxy/` the proxy: plain HTTP forwarding, CONNECT tunnels, TLS interception with the root, passthrough patterns, body capture up to the limit, byte and time accounting into the Store.
- `internal/proxy/` the proxy: plain HTTP forwarding, CONNECT tunnels, TLS interception with the root (HTTP/2 or HTTP/1.1 to clients, `h2.go`), passthrough patterns, body capture up to the limit (gzip, deflate, br and zstd decoded for display), byte and time accounting into the Store, refused handshakes as flows, WebSocket messages (`wsframes.go`), resend (`resend.go`), the rules, breakpoints and throttle hooks (`traffic.go`, `rules_hook.go`, `breakpoints.go`), capture from other devices (`remote.go`) and the upstream proxy (`upstream.go`).
- `internal/rules/` the one matcher and the rule engine kept in `<data>/rules.json`; `internal/throttle/` the token buckets.
- `internal/settings/` `<data>/settings.json`: the choices made in the window, kept across restarts; an environment variable that is set wins for that run and is never written back.
- `internal/userfile/` files only the user can read: 0600 on macOS and Linux, a user-only access list on Windows set when the file is created. Every private file goes through it.
- `internal/sysproxy/` points the system proxy at FormNET on macOS and Windows and puts the previous settings back, at stop or at the next start after a crash.
- `internal/mcp/` `formnet mcp`, the MCP server on stdio; `internal/agents/` the generator behind `formnet agents sync` and `check` (`agents/`, the skill pack's tool table, the `.agents/skills` mirror of `.claude/skills`).
- `internal/agentlookup/` the family's finder for Claude Code, Codex, Cursor and Antigravity (form.md's port); `internal/terminal/` the terminal dock's engine: a PTY or ConPTY per tab behind the token and an origin check.
- `internal/machine/` the connection table and owning processes per platform (lsof, ps and nettop on macOS, /proc on Linux, netstat on Windows), polled on an interval; it also names the process behind a proxy client port. Reverse DNS is off unless `FORMNET_REVERSE_DNS=1`.
- `internal/server/` the loopback API, the server-sent event stream and the embedded client; the route list and the session rules are in its package comment. Every API call needs the run's token as a bearer header (the page reads it from `/?token=` and keeps it in `sessionStorage` (`web/src/session.ts`); the stream and downloads pass it as a query parameter). No cookie, ever: a cookie for 127.0.0.1 reaches every other local port.
- `web/` the client: vanilla TypeScript and Vite, no UI framework, in the form family's shell ported from formvis v1.96.4 (title bar with the menus, the view tabs, the options bar, the status bar, Home, Preferences, the shared tokens and themes). `web/src/ui/app.ts` builds the window once; `app-commands.ts` and `app-menus.ts` hold every command, key and menu; `settings-dialog.ts` and `panels/` hold Preferences; `web/HASHOUT_LOG.md` records what was ported and why. `web/tests/window/` is the Playwright smoke CI runs.
- `src-tauri/` the desktop window: the splash card, the reveal (the window shows whole once the page has painted and 2.6 s have passed), the macOS overlay title bar with the traffic lights placed by `traffic_lights.rs`, `text_edit.rs` and `zoom.rs` for the page. It starts the server as a sidecar and waits for the `formnet desktop ready http://127.0.0.1:PORT/` line on stdout. The menus are built by the page, not here. `src-tauri/HASHOUT_LOG.md` records the port; the shell has never been compiled.
- `assets/` repo-level art (logo). The formcompiler registry entry lives in formcompiler (`apps/formNET.json`) and the product line in formai.tools (`catalog/products.json`), not here.
- `web/` the client: vanilla TypeScript and Vite, no UI framework, in the form family's shell, level with FormVis 2.8.1 (title bar with the menus, the view tabs, the options bar, the status bar, Home, Preferences with its rail and wire, the shared tokens and the 29 themes; FormNET's accent is `#8681dd`). `web/src/dock/` is FormVis's terminal dock module, byte for byte: never edit it; FormNET's side is `web/src/ui/dock-adapter.ts`. `web/src/ui/i18n/` holds every family language; a new string goes through `t()` and into every table. `web/src/ui/app.ts` builds the window once; `app-commands.ts` and `app-menus.ts` hold every command, key and menu; `settings-dialog.ts` and `panels/` hold Preferences; `web/HASHOUT_LOG.md` records what was ported and why. `web/tests/window/` is the Playwright smoke CI runs.
- `src-tauri/` the desktop window: the splash card (the only window declared), the main window built after the server answers (`engine_start.rs`: a 90 s wait, a native dialog on failure), the reveal (the window shows whole once the page has painted and 2.6 s have passed), the kill-on-close job object on Windows (`win_job.rs`), the macOS overlay title bar with the traffic lights placed by `traffic_lights.rs`, `text_edit.rs` and `zoom.rs` for the page. It starts the server as a sidecar and waits for the `formnet desktop ready http://127.0.0.1:PORT/` line on stdout. The menus are built by the page, not here. `src-tauri/HASHOUT_LOG.md` records the port and every decision since; `cargo check --locked` passes for macOS, Windows and Linux.
- `assets/` repo-level art (logo). The formcompiler registry entry lives in formcompiler (`apps/formNET.json`), and the product line in FormPortal's `catalog/products.json` and the FormAI site's `catalog/products.json`, which are kept equal; none of them lives here.

## Checks

`make check` runs gofmt, go vet and the TypeScript check. `make test` runs `go test ./...`. CI (`.github/workflows/ci.yml`) runs both, builds, cross-compiles, smokes the binary through its own proxy and runs the window smoke. Tests sit in `_test.go` files beside the code. They use temporary folders and the loopback interface only; nothing reaches the network.
`make check` runs gofmt, go vet, `formnet agents check` and the TypeScript check. `make test` runs `go test ./...`. CI (`.github/workflows/ci.yml`) runs both, builds, cross-compiles, smokes the binary through its own proxy and runs the window smoke. Tests sit in `_test.go` files beside the code. They use temporary folders and the loopback interface only; nothing reaches the network. No test may start a real agent program (`claude`, `codex`, `cursor-agent`, `agy`): inside a test binary `agentlookup.Guard` refuses them unless they live under `FORMNET_AGENT_STAND_INS`, and a test also sets a made-up `HOME`, a stand-in `SHELL` that reads no profile and a PATH of the system's four folders.

## Rules

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := v0.9.0
VERSION := v0.10.0
LDFLAGS := -s -w -X github.com/nodemode-dev/formnet/internal/app.Version=$(VERSION)
GO_BUILD := CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)"
TARGETS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64
Expand Down
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</p>

<p align="center">
<img alt="version v0.9.0" src="https://img.shields.io/badge/version-v0.9.0-eef0f4?style=flat-square">
<img alt="version v0.10.0" src="https://img.shields.io/badge/version-v0.10.0-eef0f4?style=flat-square">
<img alt="Go 1.26" src="https://img.shields.io/badge/Go-1.26-00ADD8?style=flat-square&logo=go&logoColor=white">
<img alt="TypeScript and Vite" src="https://img.shields.io/badge/TypeScript-Vite-3178c6?style=flat-square">
<img alt="macOS, Windows, Linux" src="https://img.shields.io/badge/macOS%20%C2%B7%20Windows%20%C2%B7%20Linux-native-2f7bf5?style=flat-square">
Expand Down Expand Up @@ -55,11 +55,11 @@
</td>
<td width="25%" valign="top">
<h3>Nothing leaves</h3>
Both listeners bind loopback only unless you let a phone or another computer use the proxy, and recordings stay in memory until you export them.
Both listeners bind loopback only unless you let a phone or another computer use the proxy, and recordings stay in memory until you save or export them.
</td>
<td width="25%" valign="top">
<h3>Agent-ready</h3>
Scripts read the same recording over a token-guarded local API, and <code>formnet snapshot</code> prints the connection table as JSON.
Agents read the same recording through <code>formnet mcp</code>, an MCP server with 10 tools; scripts use a token-guarded local API, and <code>formnet snapshot</code> prints the connection table as JSON.
</td>
</tr>
</table>
Expand All @@ -83,6 +83,16 @@
Requests, errors and bytes each way per host. Widely documented third parties get a reading-aid label, never a verdict.
</td>
</tr>
<tr>
<td width="50%" valign="top">
<h3>Change what passes</h3>
Rewrite headers, addresses, status or bodies, answer from a local file, block a host, pause a request to edit it, resend any request, or slow everything to 3G. On macOS and Windows FormNET can point the system proxy at itself while it runs.
</td>
<td width="50%" valign="top">
<h3>Find it, keep it</h3>
Filter by status, method, type, size, time, process or host, or type <code>status-code:404</code> as in a browser's tools; search inside bodies; read JSON, HTML, images and WebSocket messages; save a session, import a HAR, copy everything as cURL.
</td>
</tr>
</table>

## Everything in the box
Expand All @@ -95,30 +105,34 @@
</td>
<td width="33%" valign="top">
<h4>Proxy</h4>
Plain HTTP forwarding · CONNECT tunnels · TLS interception with a local root · Passthrough patterns
Plain HTTP forwarding · CONNECT tunnels · TLS interception with a local root · HTTP/2 and gRPC · WebSocket messages · Passthrough patterns · Rules, breakpoints and throttling · System proxy on macOS and Windows · Upstream proxy · Capture from other devices
</td>
<td width="33%" valign="top">
<h4>Formats</h4>
Exports: HAR 1.2 of any filtered view · Machine snapshot: JSON
Exports: HAR 1.2 and sessions of any filtered view · Imports: HAR 1.2 and sessions · Copy All as cURL: sh, PowerShell, cmd · Machine snapshot: JSON
</td>
</tr>
</table>

## Built for agents

```sh
./bin/formnet mcp # an MCP server on stdio for agents such as Claude Code
./bin/formnet snapshot # the machine's connection table once, as JSON
./bin/formnet ca # root certificate path, fingerprint and trust state
curl -H "Authorization: Bearer $(cat ~/formnet/token)" http://127.0.0.1:8760/api/flows # recorded flows
```

Also `/api/flows/{id}`, `/api/hosts`, `/api/machine`, `/api/export/har` and `/api/stream`. See [`AGENTS.md`](AGENTS.md).

`formnet mcp` reads the running FormNET and starts nothing. Its 10 tools: six read flows, hosts, the machine table, the proxy and the root certificate; one exports a HAR into FormNET's own exports folder; three change things (clear the recording, the HTTPS choice, the passthrough list) and ask you first. Passwords, tokens and cookies read `[redacted]` in everything an agent sees unless you approve otherwise. Register it as a stdio server, for example in a project's `.mcp.json`: `{"mcpServers": {"formnet": {"command": "formnet", "args": ["mcp"]}}}`. The skill pack `formnet-inspector` (in `.claude/skills/`, mirrored in `.agents/skills/`) teaches an agent to route a program through the proxy, trust the root, read what it sent and export a HAR.

## Under the hood

- **One binary:** a Go server with the web client embedded, plus a Tauri 2 window around the same binary for the desktop app.
- **Loopback by default:** the API and the page answer on loopback only, always; the proxy also listens on the network only while "capture from other devices" is on, for the addresses you allow. The proxy never connects to loopback through a host name.
- **Local root:** the certificate is made on first run, its private key never leaves `~/formnet`, and HTTPS is opened only once you trust it.
- **Updates:** through FormPortal only. FormNET has no updater of its own and never checks for one.
- **Tested:** 82 Go tests and a Playwright window smoke in CI.

## Download
Expand All @@ -129,7 +143,7 @@ Also `/api/flows/{id}`, `/api/hosts`, `/api/machine`, `/api/export/har` and `/ap
| Windows | [Download FormNET for Windows](https://formai.studio/get/formnet/windows) | [FormNET releases on FormCompiler](https://github.com/nodemode-dev/formcompiler/releases?q=formNET-v&expanded=true) |
| Linux | [Download FormNET for Linux](https://formai.studio/get/formnet/linux) | [FormNET releases on FormCompiler](https://github.com/nodemode-dev/formcompiler/releases?q=formNET-v&expanded=true) |

All FormNET builds are compiled and released from [FormCompiler](https://github.com/nodemode-dev/formcompiler); this repo holds the source.
All FormNET builds are compiled and released from [FormCompiler](https://github.com/nodemode-dev/formcompiler); this repo holds the source. Updates come through FormPortal, the family's app for installing and updating its apps.

## Run it from source

Expand All @@ -156,7 +170,7 @@ The client and API listen on 127.0.0.1:8760 and the proxy on 127.0.0.1:8761 (loo

## Repository

`cmd/formnet/` and `internal/` (command, proxy, flow store, CA, machine view, server) · `web/` (client) · `src-tauri/` (desktop window).
`cmd/formnet/` and `internal/` (command, proxy, flow store, CA, machine view, server, rules, system proxy, MCP server, terminal engine) · `web/` (client) · `src-tauri/` (desktop window) · `.claude/skills/` (the skill pack).

Agents: [`CLAUDE.md`](CLAUDE.md), [`AGENTS.md`](AGENTS.md)

Expand All @@ -166,8 +180,8 @@ Agents: [`CLAUDE.md`](CLAUDE.md), [`AGENTS.md`](AGENTS.md)

| Maintainer | Role |
|---|---|
| [@gbarnai](https://github.com/gbarnai) | Owner |
| [@nodemode-ai](https://github.com/nodemode-ai) | Co-Owner |
| [@nodemode-ai](https://github.com/nodemode-ai) (Mackin) | Owner |
| [@gbarnai](https://github.com/gbarnai) (Greg) | Co-Owner |

Code owners are set in [`.github/CODEOWNERS`](.github/CODEOWNERS).

Expand Down
Loading
Loading