Kontext CLI

Tools & Infrastructure 💻 Go ⚖️ MIT 🟢 Actively maintained
212 stars

Kontext is a local policy engine that intercepts AI agent tool calls before they execute, evaluating them against deterministic policies and recording decisions in an authorization ledger. It solves the problem of risky AI-agent actions running unchecked by providing pre-action enforcement and attribution for supported agents like Claude Code, Claude Cowork, and Codex. It is for security and platform teams who want to govern AI agent behavior without wrapping commands.

Kontext CLI demo
🎞️ Demo from the project README

✨ Key features

  • Local policy evaluation alongside the agent
  • Pre-action enforcement at supported synchronous hooks
  • No wrapper command; install once and use agents normally
  • Attributable evidence: agent, session, action, policy decision, outcome
  • Observe mode to see what policy would stop
  • Managed rollout with redacted evidence export

🎯 Use cases

  • Block destructive shell commands before they run
  • Prevent sensitive-file access by AI agents
  • Enforce policies on production-system operations
  • Audit agent actions with an authorization ledger
  • Roll out policy gradually from observe to enforce mode

📦 Installation

🧰 Requirements: macOS for self-serve setup; supported agents: Claude Code, Claude Cowork, Codex; requires an install token from the Kontext dashboard.

brew install kontext-security/tap/kontext

Create an install token in the Kontext dashboard, then run:

kontext setup

Verify the installation:

kontext doctor

🚀 Usage

After setup, continue using Claude Code or Codex normally. No wrapper command needed. To diagnose an installation:

kontext doctor

To fix a stale daemon:

kontext doctor --fix

To rotate the token, run kontext setup again. To uninstall:

kontext setup --uninstall

⚠️ Good to know

Self-serve setup currently supports macOS only; enforcement is limited to event surfaces where the agent waits for Kontext, and Kontext does not capture model reasoning or full conversation history.

❓ FAQ

Which agents does Kontext support?

Kontext currently supports Claude Code, Claude Cowork, and Codex, with exact event and enforcement coverage varying by agent.

Does Kontext require launching agents through a wrapper?

No, you install Kontext once and continue using your agents normally; no wrapper command is needed.

What is the difference between observe and enforce mode?

Observe mode records policy decisions without interrupting the agent, while enforce mode returns a real denial at supported synchronous pre-action hooks.

Where are policy decisions made?

Policy decisions happen locally, alongside the agent, and a hosted service does not need to answer every tool call.

📊 Repository

Stars★ 212
Forks🍴 7
Open issues🐛 23
Last commit🕒 Sep 4, 2026
Created📅 Apr 2026
Language💻 Go
License⚖️ MIT

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.