Koma Core MCP
Protected RAG storage — agents discover public metadata, content only by access token.
التثبيت
أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: .cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).
koma-core-mcpclaude mcp add koma-core-mcp -e 'KOMA_MASTER_KEY=<your koma_master_key>' -- npx -y koma-core-mcp@0.1.1
{
"mcpServers": {
"koma-core-mcp": {
"command": "npx",
"args": [
"-y",
"koma-core-mcp@0.1.1"
],
"env": {
"KOMA_MASTER_KEY": "<your koma_master_key>"
}
}
}
}
متغيرات البيئة
KOMA_MASTER_KEYسري HKDF master key for content tokens (demo key fallback if unset)
التوثيق
مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.
Koma
Miko: required Skill checks for Claude Code and Codex
Your coding agent says it read the Skill, but did it really?
Miko intercepts file edits at the Hook layer. If your agent hasn't read the required Skill first, Miko rejects the edit and provides a clear, observable recovery path. It runs locally, zero-dependency, makes no LLM calls, and is free and open source.
Who needs this?
- You use Claude Code or Codex CLI, wrote project Skills/instructions, but aren't sure if the agent follows them.
- You want a hard check before file edits instead of relying solely on prompt instructions.
- You want Skill loading and checks to be observable, rejectable, and recoverable.
How Miko differs
Unlike static Skill linters or security scanners, Miko works at the runtime Hook layer—intercepting the agent's actual file edit tool calls in real time rather than statically analyzing Skill files.
Scope
Miko is an extremely lightweight tool. It checks a small set of observable events and blocks only the actions that fail them. It is not a security boundary, a compliance system, or proof that a model understood anything.
Start every conversation by telling your agent to load the Skills it needs. Miko is the backstop for when the agent forgets, not a replacement for saying what you want. Clearer instructions mean fewer pauses.
npm install -D koma-miko
npx koma-miko init --host claude
Edit the generated miko.json to name your project's Skills and protected paths,
then start a new Claude Code session.
Using Codex? Follow the Codex setup and one-time Hook review.
Codex CLI is a Technical Preview; Desktop requires prior CLI activation.
▶ Try Miko's guided terminal replay — plus Gate, Scout & Core, no signup.
Miko for Claude Code and Codex
Coding agents can say they loaded a required Skill or ran a test. Miko does not
treat that claim as evidence. At supported local host Hooks, it compares
observed Skill loads, reference reads, tool actions, and completion checks with
a project-owned miko.json.
If an agent tries to edit before satisfying the spec, Miko can return a denial and a short recovery instruction. It cannot inspect hidden model context, prove that a model understood a Skill, or verify events the host never exposes. In Claude CLI guided mode, a genuine scope exception opens one visible Miko choice: allow that exact retry once, or keep the current boundary.
npx --yes koma-miko demo # deterministic; no API key
npx --yes koma-miko probe --host claude # isolated adapter check; no model
npx koma-miko init --host claude # after local installation
Codex CLI is a Technical Preview; Codex Desktop requires prior CLI activation. The CLI requires a one-time
/hooksreview before project Hooks run. Miko promotesenforceon Codex because the current Hook API cannot open a nativeREVIEWchoice; review therefore degrades to a recoverable pause/deny. Desktop-only onboarding is not a supported alpha path. An offlineprobeproves adapter logic, not live Hook activation.
Miko README → · Current host support → · 10-second web replay →
Miko replay GIF · Still image — browser simulation, not a live host recording.
Claude Code is the primary alpha workflow. Codex CLI has a verified narrow recovery flow with the activation limits above. Gemini is outside active development. VS Code Copilot now has one verified live enforcement cycle on the Local harness, but that host does not render Miko's status text in the chat UI, so Miko asks the agent to relay it. Existing adapters and their dated results remain available in the adapter documentation.
Why use Miko instead of writing a Hook? A small native Hook is enough for a single fixed check. Miko packages project Specs, observed-read tracking, post-compaction reload requirements, recovery messages, and completion evidence so you can maintain those checks together. Neither approach proves the model understood the instructions. See when Miko helps.
Zero Dependencies: Pure TypeScript with 0 npm runtime dependencies. You get a lightweight Hook layer that halts unverified agent edits without heavy frameworks.
Key Research & Evals:
- Miko Recovery Playbook: How Miko gives agents a structured, observable path to recover after being paused/denied, avoiding agent deadlock loops.
- Claude Haiku Evals: Evaluation on Claude Haiku across N Skill scenarios proving real-world recovery and enforcement.
Feedback & Discussions: Have questions or want a specific capability? Open an Issue or Discussion—all input is read and shapes the project roadmap directly.
Four Boundaries
| Boundary | Failure mode | What Koma checks | Package |
|---|---|---|---|
| Coding agent | Required Skill or completion check skipped | Host-observed preparation, action scope, and evidence | koma-miko@alpha |
| User → LLM | Prompt injection / jailbreak | Semantic scope before the application model | koma-gate |
| Request perimeter | Audio abuse / flooding | Validation, rate limits, and geo rules | koma-scout |
| Retrieval | Data enumeration / scraping | Split index from content; token-gate retrieval | koma-core |
Different attacks cross different boundaries. Koma provides a small primitive for each one.
What Koma Is — and Isn't
Is: small composable packages · usable independently · explicit failure modes · deterministic checks where the host exposes evidence
Isn't: a model · an agent framework · proof that a model understood its instructions · a replacement for authorization · a complete security boundary by itself
Benchmarks
Miko alpha evaluation
Miko is deterministic, so its useful numbers are verifier cost and end-to-end Hook behavior—not a generic score for model intelligence.
| Signal | Observed result |
|---|---|
| Offline host conformance | Claude, Codex, Gemini, and VS Code Copilot each reproduce DENY → observed Skill → ALLOW; ledger fixtures reject prompt/code/tool-response persistence |
| Local verifier scale | 1,000 Agent Specs: 1.34 ms p95 per action; 10,001 indexed evidence events: 0.0041 ms p95; restore 1,000 evidence events: 1.52 ms p95 |
| Claude Code live + hand-test | One 100-Skill / ~20k-context run passed. A natural Chinese request drove a three-file rewrite through 3 Agent Specs and 28 observed events. Separate Haiku 4.5 runs verified visible Allow once and Keep current scope policy-exception paths |
| Codex CLI Technical Preview | Fixed live recovery completed DENY → Skill/reference → edit → COMPLETE; an interactive CLI 0.152.0 hand-test visibly rendered Miko active, recovered, and COMPLETE. Desktop also enforced after CLI activation, but onboarding and completion visibility remain unsuitable as a primary path |
| DeepSeek Harness smoke | 3/3 narrow packed-artifact recovery runs passed; 19.425 s mean model phase |
The scale row is a 2026-08-27 reference run on Node 24.19 / Windows; rerun it
with npm run eval:scale -w koma-miko. Context tokens never enter the verifier.
The paid samples are deliberately small and do not establish general model,
long-context, or editor reliability. See the
scale record,
Claude record,
host-adapter record, and
DSH record.
Koma Gate live-model benchmark
I threw 1,769 real prompt-injection attacks at Koma Gate in fail-closed mode, using real providers — not mock adapters.
| Provider | Recall | Precision | False Positives |
|---|---|---|---|
| DeepSeek (deepseek-chat) | 98.8% | 100% | 0 |
| Google (gemini-2.5-flash) | 96.2% | 100% | 0 |
Chinese attack set: 100% recall · 100% precision · 0% FPR across 8 categories.
Can you break it? Open an issue with an attack Koma misses. → Full methodology
Application-side quick start: Gate
import { createGeneralKnowledgeGuard } from 'koma-gate';
const guard = createGeneralKnowledgeGuard({
llm: { apiKey: process.env.GEMINI_API_KEY },
});
app.post('/api/chat', guard.middleware(), async (req, res) => {
// Only in-scope requests reach your model
res.json({ reply: await chat(req.body.message) });
});
git clone https://github.com/swnotmetal/Project-Koma
cd Project-Koma && node demo/server.js
curl http://localhost:8080/self-test
Application-Side Packages
koma-gate — Prompt injection firewall. LLM-based scope classifier that blocks jailbreaks, off-topic requests, and instruction overrides. Supports OpenAI, Anthropic, Google, DeepSeek, and local Ollama models. README →
Try Gate in the browser demo →
koma-scout — Perimeter protection. Rate limiting, audio upload validation, geo allowlisting. Cheap checks before expensive AI work. README →
koma-core — Protected RAG storage. Public search index, private content, opaque HKDF-derived tokens. Discovery is not authorization. README →
Each package works standalone. A typical application checks cheap request limits with Scout before Gate classification, then uses Core where protected retrieval is needed. See the architecture map.
Application-side MCP servers — these belong to Gate and Core, not Miko:
koma-gate-mcp—classify_inputtool for prompt-injection checks. README →koma-core-mcp—search_docs+retrieve_docfor protected RAG retrieval. README →
{
"mcpServers": {
"koma-gate": { "command": "npx", "args": ["-y", "koma-gate-mcp"] },
"koma-core": { "command": "npx", "args": ["-y", "koma-core-mcp"] }
}
}
Using an agent to set up Miko?
Tell it:
"Read the Miko README, then help me configure koma-miko for my existing Skills and protected paths. Use the setup for my host and explain any activation step I must complete."
For a coding-agent repository, install Miko and run
npx koma-miko init --host claude or follow the
Codex setup. Edit the generated
miko.json to name the Skills, paths, and completion evidence that matter to
the project. Miko does not install the Skills themselves.
See llms.txt for documentation entry points. Miko uses host Hooks; it does not require an MCP server.
Trust & Safety
- Minimal dependency surface. Miko, Gate, and Core have no third-party runtime dependencies; Scout declares Express as a peer.
- No model-output execution. Miko observes host events; Gate, Scout, and Core classify, rate-limit, or store. None executes generated code.
- Package-specific failure behavior. Gate defaults to fail-open and can use
failOpen: false. Miko follows each Agent Spec's mode; an enforce-mode missing-evidence check denies the applicable action. - CodeQL on every push. Targets OWASP LLM01.
- MIT licensed.
→ Security policy · Known limitations · Contributing
Koma comes from Komainu ("狛犬"), the stone guardian lions of Japanese Shinto shrines. Three deployed defense layers, each standalone, plus the Miko alpha agent-contract boundary. Patterns distilled from production, not papers.
الأسئلة الشائعة
ما هو Koma Core MCP؟
Protected RAG storage — agents discover public metadata, content only by access token.
كيف أثبّت Koma Core MCP؟
يعمل على جهازك. في Claude Code: claude mcp add koma-core-mcp -e 'KOMA_MASTER_KEY=<your koma_master_key>' -- npx -y koma-core-mcp@0.1.1. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.
هل يحتاج Koma Core MCP إلى مفتاح API؟
نعم. يتطلب KOMA_MASTER_KEY، وتضبطها في إعداداته.
هل Koma Core MCP مفتوح المصدر؟
نعم. شيفرته متاحة على GitHub بترخيص MIT.
من يصون Koma Core MCP؟
ينشره swnotmetal. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.
من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.