Kastra: runtime policy enforcement and history scan for coding agents
Suggested by runchr · today
Draft — a suggested stack, not yet verified by a member.
Intercept agent tool calls, scan past sessions, turn risky actions into rules.
What they did
Fernando and the author built Kastra after a Cursor agent nearly ran DELETE FROM customers WHERE status='test' against a production database. They caught it manually, but realized nothing in their stack deterministically decided what the agent was allowed to do. Kastra intercepts AI agent tool calls and evaluates them against deterministic policies before execution, returning allow, hold, or deny. Policies can be authored in plain English from a web app, and the interception engine evaluates tools, targets, and parameters of every action. They shipped policy packs for common high-risk scenarios and an immutable audit trail for every decision. They also built Recon, a scan that reads local agent session history (Claude Code, Codex, Cursor, OpenClaw) to surface risky past actions: secrets written to tracked files, production databases touched, force pushes, curl-to-shell, and more. Each finding can be converted into a runtime policy. The scan runs locally so secrets never leave the machine. The desktop app, CLI, dashboard, and Recon scan are free for developers.
How it went
They shipped a working product with a brew-installable CLI, desktop app, dashboard, docs, and a demo video. Policy evaluations typically complete in under a millisecond. In their own use, scans surfaced actions they had forgotten or never knew agents had taken. Open problem: managing teams of agents with conflicting policies. They are soliciting scan results from HN to tune policy packs.
Worth knowing
The post is a launch announcement, not a detailed walkthrough; exact policy syntax and config file formats are not shown. Recon only reads local session history, so coverage depends on which agents and logs exist on the machine. Multi-agent policy conflict resolution is explicitly unsolved. The near-miss incident was caught manually, not by Kastra.
Wiring
Install the CLI via Homebrew tap (brew install kastra-labs/tap/kastra-edge), then run kastra-edge scan, which reads local agent session history on the machine. Findings are reviewed in the Kastra dashboard or desktop app, where each can be converted into a runtime policy authored in plain English. The interception engine sits in front of agent tool calls (Claude Code, Codex, Cursor, OpenClaw) and evaluates tool, target, and parameters against deterministic policies, returning allow, hold, or deny before execution. Every decision is written to an immutable audit trail. Policy packs cover common high-risk scenarios and can be adjusted based on scan results.
Try it yourself
Install Kastra Edge and scan my local coding-agent history for risky actions, then help me turn the findings into runtime policies.\n\n1. Run: brew install kastra-labs/tap/kastra-edge\n2. Run: kastra-edge scan\n3. Summarize the findings by category: secrets written to tracked files, production database access, force pushes, curl-to-shell, and anything else flagged.\n4. For each high-risk finding, draft a plain-English policy (allow / hold / deny) that would have blocked it, and note which agent (Claude Code, Codex, Cursor, OpenClaw) and tool call it applies to.\n5. Flag any findings that look like false positives before I convert them into rules.\n\nDo not modify or delete any files during this process; only read and report.
Tools in this stack
Run this stack
Install the stack into this project. It writes AGENTS.md and the manifest, merges the MCP servers into .mcp.json, and — with --yes — runs the tool installs.
npx runchr install runchr/show-hn-policy-enforcement-for-claude-code-cursor-and-cocurl -s https://api.runchr.com/api/recipes/runchr/show-hn-policy-enforcement-for-claude-code-cursor-and-co/manifestSystem prompt
You are a security assistant for a one-person company, helping the operator install Kastra Edge, scan local coding-agent session history for risky actions, and turn findings into runtime policies. You only read and report: never modify or delete files, and never invent tools, slugs, or capabilities beyond what is listed.
This system prompt was generated from this stack's copy and tools. A person has not reviewed it.
The manifest is also at api.runchr.com/api/recipes/runchr/show-hn-policy-enforcement-for-claude-code-cursor-and-co/manifest.