Koma

Four defenses, one demo: Miko keeps coding agents on-spec · Gate classifies prompts · Scout drops abusive traffic · Core gates content.
GitHub ↗

Try to sneak a bad prompt past Gate.

Choose an assistant scene, load an example or write your own prompt, then see the verdict Gate returns before your application calls its model.

Install Gate

Guard an LLM endpoint

Open the setup guide ↗
npm install koma-gate

Use it before your application model call. Express and Fastify examples are in the guide.

Try a prompt

0 / 1000 chars — oversized pastes are rejected before they reach the server.
Your prompt is sent to the configured classifier provider to produce a verdict. It is not saved by default. If you explicitly share a wrong verdict, Koma stores only the prompt for up to 30 days — not the scene, verdict, account, or network details. Do not submit personal data or secrets. Privacy details ↗
Load a passing example
Load a blocked example
Write your own injection and see if it slips through — that's the point. Runs the real koma-gate classifier.
Found a wrong verdict? Report it ↗

Verdict

Waiting for input
Enter a prompt on the left, then classify it.

Stop bad voice uploads before they burn an AI call.

Pick a real failure mode. Scout checks the cheap request boundary first, then either blocks immediately or hands the request to your expensive transcription and LLM pipeline.

Install Scout

Protect a voice or upload boundary

Open the setup guide ↗
npm install koma-scout

Add it before transcription, file parsing, or any other expensive downstream work.

Select a request
voice-api — request boundary ● Scout attached

Let a scraper steal the whole index—and still get zero content.

Core separates searchable metadata from protected payloads. Run the attack first, then compare it with the legitimate backend path that can derive the missing content address.

Install Core

Separate search from protected content

Open the setup guide ↗
npm install koma-core

Keep token derivation and protected payload retrieval on your backend.

Select a path
scraper — public network ● Core online
Miko logo

See Miko catch an AI agent cutting corners.

You ask Claude to change a UI. It tries to write before loading your design Skill. Miko blocks the write, tells Claude exactly what is missing, and lets it retry—inside the CLI you already use.

Install Miko · Alpha

Keep Claude Code on-spec

See Codex, Gemini, and Copilot setup ↗
npm install -D koma-miko@alpha
npx koma-miko init --host claude

Paste both lines in the project root. The initializer creates the Agent Spec and Claude hook configuration.

claude — ~/my-app ● Miko attached

Questions before you add Koma.

A short, honest FAQ for people shipping their first AI feature and engineers deciding whether these boundaries belong in production. / 给第一次做 AI 功能的人,也给正在判断这些边界能否进入生产环境的工程师。

For vibe coders 给 Vibe Coders Pick the right package, understand the demo, and know the trade-offs. / 选对包、看懂 Demo、知道代价。

Which Koma package should I try first?我应该先试哪个 Koma 包?

Start with the expensive mistake you want to prevent: Miko for coding agents skipping project rules; Gate for prompt injection or off-topic input; Scout for abusive voice/upload traffic; Core for searchable metadata whose payload must stay protected. Each package works alone.

从你最想避免的昂贵错误开始:Agent 忽略项目规则用 Miko;Prompt 注入或跑题输入用 Gate;恶意语音/上传流量用 Scout;需要“索引可搜索、正文受保护”用 Core。每个包都可以独立使用。

What does this live demo send or save?这个在线 Demo 会发送或保存什么?

Gate sends your prompt to the configured classifier, but saves nothing by default. A wrong-verdict prompt is stored for up to 30 days only after you explicitly opt in. Scout sends simulated metadata, Miko replays privacy-minimized verifier events, and Core uses seeded demo documents. Never paste secrets.

Gate 会把 Prompt 发给已配置的分类模型,但默认不保存。只有你明确同意提交错误判定时,该 Prompt 才会最多保留 30 天。Scout 发送模拟元数据,Miko 回放经过隐私最小化的验证事件,Core 使用预置演示文档。请勿粘贴秘密信息。查看隐私说明 ↗

Will Miko use more tokens?Miko 会增加 Token 消耗吗?

Sometimes. Local verification and the ledger use no model tokens, and a clean ALLOW path adds little or no agent context. A DENY, Skill reload, or retry costs tokens—but may save much more by preventing a wrong implementation. Koma does not yet claim measured token savings.

有时会。本地验证和账本不消耗模型 Token,正常放行几乎不增加 Agent 上下文;但 DENY、重载 Skill 和重试会产生消耗。它的目标是用可控开销避免更昂贵的错误实现与返工。目前 Koma 不宣称已经实测能够节省 Token。

For experienced engineers 给职业开发者 Inspect determinism, trust boundaries, and production caveats. / 看确定性、信任边界与生产注意事项。

Which parts are deterministic, and which still depend on a model?哪些部分是确定性的,哪些仍依赖模型?

Gate's semantic verdict depends on the configured LLM. Scout's demo boundary checks, Core's split-store/token derivation, and Miko's contract verification are deterministic once configured. External geo providers, CI evidence, storage, and host adapters remain operational dependencies.

Gate 的语义判定依赖已配置的 LLM。Scout Demo 的边界检查、Core 的分离存储与 Token 派生、Miko 的契约验证在配置确定后都是确定性的。外部地理位置服务、CI 证据、存储层和宿主适配器仍属于运行依赖。

Can Miko prove that an agent understood or obeyed a Skill?Miko 能证明 Agent 理解并遵守了 Skill 吗?

No. Miko can block observable tool boundaries when the host supports hooks, record Skill/Read/test events, and distinguish asserted evidence from observed or external evidence. It cannot inspect hidden model state, prove comprehension, or protect a path that bypasses the adapter.

不能。宿主支持 Hook 时,Miko 可以阻断可观察的工具边界,记录 Skill、Read、测试等事件,并区分 Agent 自述与真实观察/外部证据;但它无法查看模型隐藏状态、证明模型真正理解,也无法保护绕过适配器的路径。

What should I verify before using Koma in production?在生产环境使用 Koma 前应该确认什么?

Evaluate packages independently against your threat model. Choose fail-open or fail-closed behavior deliberately; test the real host adapter; use durable rate limits, storage, and key management; and exercise bypass and outage cases. The in-memory stores and scripted fixtures in this demo are demonstrations, not a production architecture.

请按你的威胁模型分别评估每个包;明确选择 fail-open 或 fail-closed;测试真实宿主适配器;使用持久化的限流、存储和密钥管理;并覆盖绕过与故障场景。本 Demo 的内存存储和脚本化 fixture 只是展示,不是生产架构。