Why Kompile Is Opinionated
Most AI coding harnesses hand an LLM a shell tool, append a long system prompt full of "please don't…" rules, and hope the model behaves. Over a 40-turn session — especially after context compaction or across parallel subagents — prompt-only rules routinely fail: models fall back to sed -i or grep, spawn invisible nested subagents, drift off-goal, forget earlier constraints, or report misleading cost numbers.
Kompile takes a deliberately opinionated stance: separate hard invariants from probabilistic supervision, enforce invariants deterministically, fail open on LLM judges, contain every child process, and keep durable evidence for everything.
The Three Architectural Planes
| Plane | Failure mode | Cost / latency | What lives here |
|---|---|---|---|
| 1. Deterministic Enforcer | Fail-closed | Zero LLM, < 1 ms | Shell Mandate, Build/Script/Lane/Draft Enforcers, /tmp Redirect, Memory Mandate, Deflection Monitor, Subagent Containment, Admission, Budgets & Report Exit Gate |
| 2. LLM Supervision | Fail-open | Judge / auditor model | Compliance Judge (EnforcerJudge), Direction Judge (DirectionJudge), Periodic Transcript Auditor (/policy-enforce) |
| 3. Durable Evidence & Honest Accounting | Best-effort append-only | Local disk / journal | Persistent Memory (pre-turn injection, BM25 + semantic search, gardening), Judgement Log, Tool-Call Catalog, Diff Archive, Build Provenance, Test Milestones, Incidents, Per-Token vs. Plan Billing & NNLS Quota Fitting |
Lifecycle of a Single Agent Turn
User prompt + active reminders + memory context
│
▼
[ Agent Turn ]
│
┌────────────┴─────────────────────────┐
▼ ▼
Proposed Tool Call Turn-End Output
│ │
▼ ▼
1. Deterministic Enforcer 4. Turn-End Mandates
(Shell / Build / Script / • MemoryResponseMandate
Lane / Draft / /tmp) (recall before answering)
├─ Violation ─▶ Hard Block • DeflectionMonitor (opt-in)
└─ Pass ──────────────────┐ (no receipt-less excuses)
▼
2. Compliance Judge / Gateway 5. Compliance + Direction Judges
(LLM, fail-open) • EnforcerJudge (rules + reminders)
ALLOW | BLOCK | REWRITE • DirectionJudge (goal drift)
│ • EnforcerDiffArchive (rollback)
▼
3. Execution + Containment 6. Periodic Auditing & Accounting
• MCP tool / resource lane • /policy-enforce (full transcript)
• Subagent containment, • JudgementLog + tool_call_catalog
admission, 4-state budget, • ModelPriceCatalog (PER_TOKEN)
& mandatory progress report • NNLS quota attribution (PLAN)Five Opinions Worth Knowing Up Front
- Shell bypasses are blocked deterministically, not begged away. If a dedicated Kompile tool exists (
read,edit,grep,glob,list,build,script,memory,draft), invoking its raw shell equivalent (cat,sed -i,grep,find,mvn,python -c,flock) is blocked with an actionable re-comply message. Legitimate sysadmin commands (rm,mv,mkdir,chmod,git) remain allowed for normal permission and judge review. See The Enforcer. - LLM judges are high-confidence exceptions and fail open. If a judge backend times out, errors, or returns malformed JSON, Kompile treats the turn as compliant/on-track so a flaky judge never stalls your work. Compliance judging and goal-drift judging are separate lanes with separate override rules. See The Judge.
- Subagents are never trusted to police themselves. Kompile strips each vendor's native subagent tools (Claude
Task/Agent, Codexspawn_agent, Gemini agents, OpenCodetask, Antigravityinvoke_subagent/swarm, Qwenagent), refuses unknown vendors without verified containment, bounds every child with a 4-state budget machine (NORMAL→WARN→CHECKPOINT→HARD_STOP), and holds exit until the child posts aprogressreport. See Subagents. - Compaction must not erase accountability. Conversation history compacts as sessions grow, so periodic
/policy-enforceaudits read the append-only transcript on disk, while judgements, tool calls, diffs, builds, and test milestones are stored in structured ledgers you can query anytime. See Auditing & Provenance. - Never fabricate
$0for cost. Subscription plans and API keys are tracked in separate billing buckets (PER_TOKEN,PLAN,UNKNOWN). Unmatched routes are marked unpriced rather than$0, cache writes distinguish 5-minute vs. 1-hour TTLs, and subscription windows are attributed via per-message quota sampling and NNLS regression. See Cost Estimation & Quota Attribution.
Every opinionated gate has an explicit escape hatch or configuration toggle — the deep-dive pages below document both the default behavior and exactly how to tune or disable each layer.