Skip to content

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 ​

PlaneFailure modeCost / latencyWhat lives here
1. Deterministic EnforcerFail-closedZero LLM, < 1 msShell Mandate, Build/Script/Lane/Draft Enforcers, /tmp Redirect, Memory Mandate, Deflection Monitor, Subagent Containment, Admission, Budgets & Report Exit Gate
2. LLM SupervisionFail-openJudge / auditor modelCompliance Judge (EnforcerJudge), Direction Judge (DirectionJudge), Periodic Transcript Auditor (/policy-enforce)
3. Durable Evidence & Honest AccountingBest-effort append-onlyLocal disk / journalPersistent 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 ​

text
  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 ​

  1. 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.
  2. 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.
  3. Subagents are never trusted to police themselves. Kompile strips each vendor's native subagent tools (Claude Task/Agent, Codex spawn_agent, Gemini agents, OpenCode task, Antigravity invoke_subagent/swarm, Qwen agent), 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 a progress report. See Subagents.
  4. Compaction must not erase accountability. Conversation history compacts as sessions grow, so periodic /policy-enforce audits 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.
  5. Never fabricate $0 for 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.

Released under the Apache-2.0 License.