Skip to main content

Architecture — the four layers

Keep — the AI Trust, Risk and Security Management (AI TRiSM) Layer, a Gartner-defined category — is four layers of defense. Three of them raise the cost and lower the probability of a successful attack; one of them makes a class of action structurally impossible. Keep is precise about which is which, because the difference is the whole point.

What we disclose​

Before the detail, the frame. Not every layer carries the same kind of promise, and blurring them is how "AI security" offerings lose the plot:

LayerPromisePrecise reading
Moat (L1)Defense-in-depthRaises attack cost; a determined attacker with a novel payload can still get input through
Barbican (L2)Defense-in-depthCatches known-shape attacks after normalization; a pre-filter, not the security boundary
Rampart (L3)ProbabilisticA classifier with a measured error rate; advisory, fail-closed, never the sole line
Warden (L4)Correct-by-constructionThe action cannot reach state except through this gate; the residual risk is a measured bypass-rate, not zero-by-assertion

The layers below are ordered outermost (cheapest, first-contact) to innermost (the enforced boundary).

1. Moat — prompt pinning (L1)​

Moat is the outer wall: a client-side layer, shipped as @k9o/moat, that does two things before your agent ever calls the model.

  • System-prompt binding. The system prompt is bound and anchored so that user-supplied content cannot silently overwrite or reorder the agent's instructions — the classic "ignore your previous instructions" injection is resisted at the seam, not negotiated with the model. Moat runs in a client-owned SDK, so this is a defense-in-depth binding, not a hard guarantee.
  • Input schema enforcement. Agent input is validated against a JSON Schema, so structurally malformed or out-of-contract input is rejected before it becomes a prompt.

Moat is defense-in-depth. It is deterministic and cheap, and it runs at the edge, but it raises the cost of an attack — it does not, on its own, close the category.

2. Barbican — the normalize-first pre-filter (L2)​

Barbican is the gate-house in front of the wall. It is a WebAssembly pre-filter, shipped as @k9o/barbican, that runs a strict pipeline:

  1. Normalize first. Decode homoglyphs, base64, leetspeak, and the other evasions attackers use to smuggle a banned string past a naive matcher.
  2. Match. Run Aho-Corasick pattern matching over a ruleset, with a BLAKE3 content-hash cache so repeated inputs short-circuit.
  3. Verdict. Emit a closed-enum decision — allow, deny, or suspect — and, on output, filter or redact matched PII.
Agent inputbefore the model callMoat (L1)bind system promptvalidate JSON SchemaBarbican (L2)pre-filter, not the boundaryBarbican pipeline1 Normalizehomoglyph, base64,leetspeak, others2 MatchAho-Corasick overruleset, BLAKE3 cache3 Verdictallow, deny, suspectredact PII on outputhot-reloadableSigned, versioned rulesetverified before load, fail-closed
Moat pins and validates first; Barbican normalizes before it matches, and only loads a ruleset whose signature verifies.

A suspect verdict is returned to the caller's code, which applies its own posture. Barbican is advisory defence in depth, not un-bypassable. It is explicitly framed as a pre-filter, not the security boundary. It catches the attacks that have a known shape once normalized. It is fast and it is deterministic, and it exists so that Rampart and Warden are not asked to spend their more expensive budget on attacks a pattern-matcher should have caught.

The ruleset is signed and versioned​

Barbican doesn't trust a ruleset just because it was fetched from the right place. Every ruleset is a signed, versioned artifact — { id, pattern, severity } entries, canonicalized to a fixed byte encoding and signed before distribution. The edge SDK verifies the signature before loading a ruleset into the matcher, and rejects, fail-closed rather than fail-open, anything that doesn't verify. This is what makes air-gapped and offline deployments credible: a ruleset can be distributed out-of-band, and the edge still has a cryptographic reason to trust it rather than an operational promise that the channel it arrived over was secure. Rulesets are hot-reloadable — a new signed version replaces the old one without a redeploy of your application.

3. Rampart — semantic classification (L3)​

Rampart is the rampart walk — the layer that watches for what pattern-matching cannot see. It is a hosted semantic classifier reached at POST /rampart/classify that scores agent input and output for attack intent: injection, jailbreak, exfiltration framing, and the paraphrased attacks that never match a fixed string.

Rampart is probabilistic and advisory. It has a measured error rate; it runs fail-closed — an unavailable classifier does not silently pass traffic, it surfaces K9O_RAMPART_CLASSIFIER_UNAVAILABLE; and it is never positioned as the sole line of defense. It sharpens the picture; it does not, by itself, stop an action.

Rampart is not on the enforcement hot path​

Classification and enforcement are decoupled by design. When a gated action reaches Warden (§4), the decision Warden makes — schema, grants, approval, RLS — is deterministic: it does not wait on a classifier network call. Rampart's semantic score is a separate, advisory signal your integration can call before or alongside a gated action, not a step inside the gate's own decision path. This keeps the one place that has to be fast (the gate) fast, and keeps the one place that's inherently probabilistic (the classifier) out of the path where a false negative would mean an unenforced action rather than an un-scored one. A tool's manifest can opt in to having Warden weigh Rampart's classification receipt as an additional advisory signal at decide-time — see API reference §1 and Audit & receipts §4 for how that receipt differs from a Warden decision receipt.

4. Warden — the enforced boundary (L4)​

Warden is the keep — the innermost, defended structure, and the layer where the promise changes in kind. Warden is not advice about an action; it is the boundary the action must pass through to happen at all. It is reachable two ways: standalone, over the inbound MCP façade, governing tool calls from any agent framework wherever your agent runs; or platform-native, inside the sealed sandbox Kilimanjaro Core runs each agent in — built on Firelock, the open-source execution shell Kilimanjaro maintains — where it is the sole egress for state-mutating agent actions because the sandbox itself — by construction, zero network interfaces, one audited channel out — has no other network path. That design is Firelock's own; Kilimanjaro Core is the host that enforces it and wires Warden as the one thing on the other end. Either way it composes several deterministic controls:

  • MCP tool-schema validation — a tool call is checked against its registered manifest schema before it runs.
  • Manifest-declared grants — a tool can only do what its manifest declared and the project granted; the grant is the ceiling, and it can only contract.
  • Approval / maker-checker — high-stakes actions can require a second, human decision.
  • Row-level security — the same RLS the data plane enforces, applied to what the agent can see and touch. RLS enforces at execution time, inside the same transaction as the write, not as an earlier decide-time check alongside the schema/grant/approval gate.
  • Signed receipt — every gate decision emits a signed receipt, and the frame-level evidence inside the sandbox is checkpointed and signed, all recorded in the project's audit stream, so the record is signed and tamper-evident. See Audit & receipts for the shape.

Because Warden is the sole egress inside the sandbox, an action the policy denies has no other path to state — this is what "un-bypassable" means for Keep, and it means it only here. The claim is disciplined: the residual risk is a measured adversarial bypass-rate published from a red-team harness, a number Keep reports, not an absolute it asserts. A denied action meters identically to an allowed one — allow and deny draw from the meter identically, not two different meters, see Billing §5.

What performs an approved call matters as much as the decision itself: Keep never hands the agent a live outbound credential, so there is no gap between the call Warden checked and the call that actually executes, and no way for an approval to be captured and reused against a different call. See Audit & receipts §3 for what this guarantees about the receipt itself.

5. How the layers compose​

The layers are additive, and you adopt them in the order that matches your risk:

  • Moat + Barbican give you a cheap, deterministic first line at the edge — the Edge Filtration mode.
  • Rampart adds semantic intent scoring as a hosted service — the Semantic Classification mode.
  • Warden adds the enforced boundary — the Enforced Boundary mode, available standalone over MCP or platform-native with Keep + Core.

None of the outer layers is a prerequisite for the inner ones, but each makes the inner ones cheaper and sharper by handling what it is best placed to handle. See Delivery modes for how each composition deploys.

6. What Keep does not do​

Being precise about the boundary also means being precise about what's outside it:

  • Keep does not evaluate business logic. It enforces the grants you declared; it has no opinion on whether the grants themselves reflect what your agent should be able to do. Scoping grants correctly is on you.
  • Keep does not execute your agent's reasoning loop. Model inference, tool orchestration, and the agent's own control flow are your application's (or your chosen framework's) responsibility. Keep inspects and gates; it does not run the agent. The platform-native sandbox that runs an agent's execution is a Kilimanjaro Core capability built on Firelock, not a Keep component — see Keep overview §7.
  • Keep does not claim to detect every attack. Moat and Barbican are deterministic and complete against what they check for, but neither claims to catch novel attacks by construction; Rampart is explicitly probabilistic. Only Warden's sole-egress property is a structural, not probabilistic, guarantee, and it guarantees that an unapproved action cannot execute, not that every dangerous request was correctly classified upstream.

7. See also​

  • Keep — overview — the problem Keep solves, architectural assumptions, and the claim boundary.
  • Delivery modes — Edge Filtration, Semantic Classification, Enforced Boundary.
  • SDK reference — @k9o/moat and @k9o/barbican in code.
  • API reference — the /rampart/classify contract.
  • Audit & receipts — the receipt shape and how it correlates to the audit stream.
  • Gate — Identity & Ingress — the identity Warden's grants and RLS resolve against.
  • Kibo — audit ledger — Kibo's hash-chained ledger of custody-lifecycle operations; Warden receipts are standalone signed commitments, not entries in it.