kPlan
kPlan put agent plans on a real web page and bound every approval to one immutable version. Plan review in kCortex has since replaced it.
The problem
Coding agents produce plans faster than anyone can responsibly approve them. The plan scrolls by in a terminal, the human types "looks good", and nobody can later say which version of what was approved.
kPlan made the approval a first-class artifact. An agent published markdown through an API (or a bundled MCP server (a service that exposes tools to coding agents)), got a shareable URL back, and waited. A reviewer read a server-rendered page, commented on individual headings, and approved or rejected one specific version. The decision went back to the waiting agent as an HMAC (a keyed hash that authenticates a message)-signed webhook, a long-poll (client holds an open request until the server has a result) response, or an SSE event (a one-way HTTP event stream).
Architecture
kPlan was a single Bun/Hono application with a React 19 client, persisting to SQLite in WAL mode (write-ahead logging: changes append to a log before the main file). Markdown was the source of truth: the server rendered and sanitized it once at write time and stored the result with the immutable version. Rendering used markdown-it with task lists, footnotes, GitHub alerts and containers, Shiki dual-theme highlighting, and KaTeX, with Mermaid drawn in the browser. Every asset was bundled, so production loaded nothing from a CDN.
Versioning was the load-bearing part. Updating a plan created a new immutable
version under the same URL and reset it to review. Decisions were
version-bound: deciding a stale version returned 409, repeating the same
decision on the same version was idempotent (safe to repeat without changing the result), and old versions stayed
readable as snapshots with a diff view between them. Every review event
carried a (plan, version, cursor) key, so an agent could consume them over
webhooks, long polling, or SSE and drop duplicates. Webhooks were
at-least-once, with scheduled retry cycles and an operator CLI command for
deliveries that ran out of retries.
Tokens were scoped (plans:read, plans:write, plans:decide) and stored
only as SHA-256 hashes. An agent could mint its own token over HTTP; that
token never got plans:decide and only saw the plans it created.
Boundaries
An approval in kPlan released a waiting agent and did nothing else. kPlan never ran agent work, never touched repositories, and couldn't move an agent's host out of plan mode; the agent still waited until its own harness allowed changes.
The review URL was the weak spot. Plans were unlisted, and every page load
minted signed approve and reject tokens for whoever held the link. Token
scopes kept plans:decide away from self-minted credentials, but the agent
that created a plan also held its URL, and nothing on the page proved a human
clicked the button. kPlan recorded which version was approved; it didn't
record who approved it.
kPlan treated agent-generated content as hostile. The markdown renderer
ignored raw HTML and sanitize-html cleaned its output before storage;
Mermaid ran in strict mode, and DOMPurify sanitized the SVG it produced.
Production sent a nonce-based CSP (browser rules that restrict which scripts and origins a page may load) with no external origins. Browser
actions used stateless signed tokens bound to plan, version, and action, and
webhooks only went to destinations whose exact host:port was on an
allowlist. The API and the browser forms had body-size and rate limits.
kPlan ran as one Bun process (or one compiled binary) behind a reverse proxy (a server that receives requests and forwards them to internal services). Rate limits lived in process memory and reset on restart, so it ran as a single instance. Signing secrets sat in plaintext in the SQLite file.
Plan review in kCortex replaced kPlan. It keeps
version-bound decisions and moves approval into the web app, revocable share
links, or a token carrying plans:decide.