How Kumi's kernel keeps a record of its policy decisions, and checks that record every time it starts.
Change one byte in the middle of Kumi's audit log and start kumid again. It refuses to start, and its error message says Core audit recording failed.
Kumi is an AI agent client, and nearly everything in it is a plugin. The kernel is the fixed part underneath that isn't one. Earlier posts covered what a plugin may do and what it may hold. This one is about the record the kernel keeps of what its policy check decided, and how you can tell whether someone changed that record later.
What a record holds
A record is small on purpose. It has a principal, which is who acted, and an action, which is what was done. It can also have an object, which is what it was done to, and a content hash, which is a BLAKE3 hash of the content involved. The content itself stays where it is.
The first three are ids. An id is 1 to 64 symbols long, drawn from A-Z a-z 0-9 . - _ :. The log's API takes no free text and no bytes, so there is nowhere to put a message or a key. The id check goes one step further and refuses text that looks like a secret: anything that starts like a known key format, such as sk- or a vault handle, and anything with a run of more than 24 letters and digits in a row.
Here is what a policy decision looks like when the kernel writes it. The principal is the agent or component that asked, as the kernel identified it. The action is policy.decision. The object is the verdict. The rule ids that matched, and the reason in words, go into a small JSON document, and only its hash goes into the log.
Only the code that holds the log can write to it, and that is the kernel. A plugin has no call that reaches the log. When a tool call reaches the policy check, the kernel writes the decision. For a call from a plugin, it sets the principal from the chat session it checked that plugin may use, so the plugin can't supply an arbitrary name for the record. The log also takes an exclusive lock on its directory, so a second writer can't open it while kumid runs.
If writing a decision fails, the answer is no. The policy check doesn't hand out a yes it couldn't write down.
Each record points at the one before
Every record carries the hash of the record before it. The first record carries 32 zero bytes. Each record is stored with its own hash, computed over all of its fields with a fixed, length-prefixed encoding, so moving a byte from one field to the next gives a different hash.
That is enough to catch most edits. Here is what the check reports for each kind, taken from the crate's own hostile tests, which rewrite records the way someone with write access to the files would:
| What someone does | What the check reports |
|---|---|
| Changes a byte in a record | That record is reported as broken |
| Changes a record and gives it a fresh hash | The next record doesn't follow the one before it |
| Deletes a record | The record after the gap is out of place |
| Swaps two records | The first of them is out of place |
| Rewrites every later record to keep the links | The next checkpoint's signature is not valid |
| Cuts off records after the newest checkpoint | Nothing |
The last row is the honest one, and we come back to it below.
Checkpoints are signed
A checkpoint is a record too. Instead of a principal and an action, it holds an Ed25519 signature over its own sequence number and the hash of the record before it. Since that hash covers every earlier record, one signature pins down the whole log up to that point.
The signing key is a 32-byte random seed that kumid makes the first time it sets up your installation. It is stored in the vault, under the name kumi.audit.key, and its only allowed destination is audit.kumi.invalid, a name that never resolves on the network. The kernel gets the key through a vault handle, like any other secret. The public half is written into the installation's state file, and on every start the kernel checks that the key from the vault still matches it.
kumid writes a checkpoint each time it starts, before it accepts a connection. On an orderly shutdown, it writes another before confirming cleanup. Today's Kumi build registers no tools, so this log holds only checkpoints. Anything the kernel does without going through the policy check isn't in this log either.
The check runs on every start
When kumid starts, it opens the log and reads every record from the first one. This is the code that does it (excerpt, reindented):
let policy_audit = AuditLog::open(root.join("audit/policy"), signer)
.map_err(|_| CoreCompositionError::AuditFailed)?;
match policy_audit
.verify(None)
.map_err(|_| CoreCompositionError::AuditFailed)?
{
Verification::Valid(_) => {}
_ => return Err(CoreCompositionError::AuditFailed),
}
Anything other than a clean result stops the start. There is no repair step and no "continue anyway". For each record, the check asks a short list of questions, in this order (excerpt, reindented):
if record.redacted {
return Err("the record was redacted");
}
let decoded = codec::decode(&record.payload)?;
let body = decoded.body;
if record.seq != expected_seq || body.seq != expected_seq {
return Err("the record is out of place");
}
if body.prev != *prev {
return Err("the record does not follow the one before it");
}
decode compares a record with its own hash. The check then compares the record's type with its content and, for a checkpoint, checks the signature. It names the first record that fails; kumid's error message does not name that record. If an event is changed and rehashed while the following record is left unchanged, that following record exposes the broken link. If later links are rewritten too, the failure can appear at a checkpoint farther along.
If the damage is to the file itself rather than to a record, the storage layer underneath finds it first and refuses to read. The start is refused either way.
What it doesn't protect against
We'd rather say this plainly. These are the limits the design notes list:
- Records can be cut off the end without a trace. The kernel doesn't keep the newest checkpoint anywhere outside the log, so it has nothing to compare the log's length against. Someone who can write the log files can remove the newest records, checkpoints included, and the shorter log still checks out, because every signature left in it is real. The next time kumid starts, it signs the shorter log like any other. Records after the last checkpoint are chained but unsigned. Someone with write access can rewrite those records and their links without the signing key.
- Anyone who holds the signing key can write records that check out, including a whole new log. The key lives in the vault, so the log is only as safe as the vault that holds it.
- The id check is a guard against mistakes. It can't recognise every secret, and the code that writes a record has to pass names, never values.
- Each record has a timestamp from the system clock. It is part of the hash, but it isn't trusted to go up. The order of records comes from their sequence numbers.
The log proves that its records agree with each other. It doesn't prove that nothing was dropped from the end.
A record that checks itself
Each record points at the one before it, and kumid reads the whole chain and signs where it ends before it accepts connections. An edit that breaks a retained checkpoint's signature stops the kernel. A cut at the end doesn't, and we've said why.
If you'd like to hear when you can try Kumi, there's a waitlist.
