Tegoby Attention SpanBlogBook a demo

A record of what your agent did

An AI agent's own log is its own story, and an agent that runs as you can edit it. Tego writes a separate record of every run, and you can check later that nobody changed a line.

Why the agent's log isn't enough

A transcript is the agent's account of what it did. If the agent was wrong or prompt-injected, its account can be wrong too.

Tego's record is written by Tego. Tego runs an AI agent under rules you write, and the Linux kernel and Tego's supervisor, a process outside the agent, enforce them. That supervisor appends each event to the run's record, and every line names who produced it in a source field, such as supervisor, seccomp, landlock, kernel or fanotify. When the agent tries to read your SSH key, the line comes from Tego's side of that system call, not from the agent.

What a run records

It depends on the protection level and the contract's record setting.

  • At every level: programs run, files written, connections and refusals.
  • File reads at Basic (landlock, no root): only under record: full, which makes every open slower. Under the default, a read the deny_read list refuses is still refused but leaves no line.
  • File reads at Plus and Max (root): recorded by eBPF, a kernel feature for running small checked programs.

record: full keeps every event and, when model calls are captured, the request and response bodies: prompts and tool outputs. summary, the default, keeps the same events without bodies, file paths, command lines and hosts included. off keeps the start, the end and every refusal. Credential headers such as x-api-key, authorization and cookie are never stored.

Warning

At Basic a clean receipt says nothing about reads. Under record: summary, tego run can print refused 0 after a refused read. Set record: full, set reason.reads: on, or use Plus or Max when reads matter.

How the chain catches an edit

A run's record is one file, events.jsonl, with one JSON object per line. Each line carries a sequence number, seq, and two fingerprints (SHA-256 hashes):

  • id is the hash of the line's own bytes, computed with id set to sixty-four zeros.
  • prev is the id of the line before. The first line's prev is empty.

Here is the refused read of an SSH key, from a frozen test record in the repository, spec/record/v1/fixtures/reason-reads.jsonl (pretty-printed; on disk it is one line):

JSON
{
    "v": 1,
    "seq": 2,
    "id": "95f00c46f73d2148d510455c95bd2acf0b329518f71fb0c805f2d0c5fa6fff12",
    "prev": "a0b02129b84f71a502d3b210a0e0650cea172c91459a4fd702d950ba9b3a21ec",
    "ts": "2026-09-22T09:00:00.008Z",
    "mono_ns": 812353000000,
    "run": "r-3f9c2a1b-0dllq06ts7400-r3as23",
    "agent": "retriever",
    "pid": 48212,
    "tid": 48212,
    "cgroup": 44821,
    "kind": "fs",
    "source": "seccomp",
    "rule": "fs.deny_read[~/.ssh]",
    "verdict": "refused",
    "authority": "rule",
    "reason": "read-denied",
    "attribution": {
        "confidence": "unattributed",
        "method": "none"
    },
    "flags": 524288,
    "mechanism": "landlock",
    "op": "open",
    "path": "/srv/u/.ssh/id_ed25519"
}

Change one byte and that line's id no longer matches. Fix the id and the next line's prev breaks. Rewrite every line to the end and the last id, the head, no longer matches the anchor: when a run ends, Tego appends one line naming the run and its head to ~/.tego/chain.log, and never rewrites it.

You can check the links yourself, without Tego. From a clone of the Tego repository:

Shell
python3 - spec/record/v1/fixtures/reason-reads.jsonl <<'EOF'
import hashlib, re, sys
prev = b""
for n, line in enumerate(open(sys.argv[1], "rb").read().splitlines(), 1):
    m = re.search(rb'"id":"([0-9a-f]{64})"', line)
    zeroed = line[:m.start(1)] + b"0" * 64 + line[m.end(1):]
    id_ok = hashlib.sha256(zeroed).hexdigest().encode() == m.group(1)
    prev_ok = re.search(rb'"prev":"([0-9a-f]*)"', line).group(1) == prev
    print(n, "id ok" if id_ok else "id BROKEN", "prev ok" if prev_ok else "prev BROKEN")
    prev = m.group(1)
print("head", prev.decode())
EOF
cat spec/record/v1/fixtures/reason-reads.chain.log

Each of the six lines prints id ok prev ok, and the head matches the one the anchor file names. Change one word in a copy and every edited line prints id BROKEN. tego events --verify does more: it also checks every line against the record format and the head against your own chain.log.

Verify a run

Take the run id from tego run's summary or tego receipt --last. The last four or more characters are enough when no other run ends with them. Use the end of your own id:

Shell
tego events hdcxpr --verify

A record that verifies prints one line in this shape:

Output
<run>: verified <N> lines, run_start to run_end, head <hash>, anchored in <path to chain.log>

The exit code is the verdict. 0 means verified. 1 means it doesn't verify, with the reason: tego events: <run> does not verify: .... The repository's demo kit edits a copy of a record and gets exactly that, with id does not match line bytes. 125 means Tego couldn't check, for example because a file was unreadable, which says nothing about the record itself. tego receipt --last --verify runs the same check.

A live run has no anchor yet, so its check says no anchor yet (the run has not ended) instead of claiming what it couldn't check.

Read the record

  • tego receipt --last answers "what did it do?": time taken, files written, connections, programs, sensitive files read, refusals with their rules, times it asked you, and a Coverage section saying what the record couldn't see.
  • tego events <run> prints the record as a table (SEQ, TIME, KIND, SOURCE, VERDICT, RULE, DETAIL). --kind, --verdict and --rule narrow it, --follow tails a live run, and --json prints the stored lines byte for byte.
  • tego drift compares what the contract allowed with what the run used.
  • tego serve --open shows the same record in the dashboard.
The top of the Tego dashboard's Run page for a protected run: the run id with a Verified, 26 lines badge, and a banner reading Protected: 2 secret reads and 2 sends to 127.0.0.1:8802 blocked, 1 request asked.
The top of the Run page for a protected run of the repository's supply-chain demo, which uses fake credentials and a defanged stand-in package. The badge beside the run id reads Verified, 26 lines. The whole page also shows the read request a person denied.

The dashboard runs the same check as tego events <run> --verify, against the same anchor. A run page says "Verified" with its line count, "Record broken at #N" with the reason, or "Not verified" with why, such as a run still being written. For an audit, tego events <run> --verify stays the check of record. The dashboard guide walks through each page.

Whom it protects against

The agent. An agent held by a contract can't rewrite its record or the anchor: tego compile refuses a contract whose writes cover the record's folder or the anchor, and Tego's own folder, ~/.tego, is always closed to reads.

Not you. ~/.tego/chain.log is writable by the user who launched the run, so anyone running as you outside a run can rewrite it. The repository lists this in its known gaps.

Not a record-only run. tego watch without --boundary, and tego run --observe, apply no Landlock rules. The agent, running as you, can then rewrite events.jsonl, recompute the chain and edit chain.log. A recording is not a cage.

Not a power cut. Lines reach the disk with fsync only when the run closes, so a crash or power cut can lose up to about 35 seconds of them. The chain then verifies what survived, and the run shows as orphaned with a launcher-lost gap: read it as a minimum. If a record must survive a power cut, copy it off the host.

Keep it useful

The record stays on your disk under ~/.tego/runs, in a 0700 folder with 0600 files, and Tego sends nothing anywhere. Any process running as you can read it. Under record: full it holds prompts and tool outputs, so treat it like the project itself.

Old runs expire after the retention period, 30 days by default, when tego gc runs. A live run's record isn't rotated, so for a long-lived agent set record.max_run_bytes in the machine config; the run ends with exit code 124 at that size. The operations guide covers both.

Try it

Run the quickstart in your first Tego run: its summary ends with chain verified, and tego receipt --last --verify checks it again. Then read what Tego cannot stop, and why the rules live outside the agent in a prompt is not a security boundary.