olog
The log is the state machine.
Ontology-organized logging for the AI era. Every log line is one typed state transition of one entity — so the log replays into a state machine, and the places where the code broke its own contract become the debugging output.
Read the skill The spec GitHub
Implementations: TypeScript · Go · Python · Rust · Java
Logging was built for eyes
Almost every logging system grew up around a human reading a terminal:
printf templates, MDC, com.foo.Bar logger names, appenders and
layouts, level enums, async queues, redaction layers, hundreds of lines of
XML configuration.
An agent gets none of the value and all of the cost. It must parse a template to learn which argument landed where. It cannot tell what scope an MDC entry was in. It cannot tell whether the file on disk is XML or JSON. It gets a level — a human filter knob, not a fact about the system. It gets a stack trace: a blob of text no replay can reason about.
Meanwhile the thing a human actually does when debugging — folding the log back into state — has never been automatable, because the log threw the state away.
Keep the state
Say, on every line, which entity moved and from where to where. The ontology says what is legal.
{"seq":3,"ts":1764000000123,"run":"run-1",
"type":"Request","id":"req-7","op":"running",
"props":{"method":"GET","path":"/api/x"},
"links":{"caused_by":["job-2"]}}
type Request
enum Request state queued,running,completed,failed
trans Request queued running
trans Request running completed
trans Request running failed
One line of JSON, one event. One directive per line in the ontology. Nothing else to learn.
Replay is a fold
Fold the events in order and you get the state machine back. The fold can also fail loudly — and those failures are the answer.
| Anomaly | What it means |
|---|---|
illegal_transition | The code moved an entity somewhere the ontology forbids. |
unknown_entity | An entity appeared without ever being created. |
dangling_link | Something referenced an entity that does not exist. |
invalid_prop | An event does not match the ontology's shape. |
That anomaly list is the debugging output — not a stack
trace to squint at, but a list of contract violations with the
seq that caused each one.
Five actions
import { olog } from "olog";
const log = olog.open("./olog");
log.emit("Request", "req-7", "queued", { method: "GET", path: "/api/x" });
log.emit("Request", "req-7", "running");
log.emit("Request", "req-7", "completed", { code: 200 });
const { states, anomalies } = log.replay();
No logger object. No level. No formatter. No global state. Five actions:
emit, link, replay,
validate, open.
What was removed, and why
| Gone | Because |
|---|---|
level | A filter knob for human eyes. Severity belongs to a type — declare it as a property. |
| logger hierarchy | A naming convention, not an ontology. The type is the grouping. |
| MDC / thread-local context | Implicit scope is unreadable. Put it in props or links. |
| printf templates | The agent has to parse them. props is already structured. |
| appenders / layouts / encoders | One shape only: JSONL. |
| async queues / ring buffers | Write order stops matching event order, and replay becomes fiction. |
| redaction layer | Redaction rewrites history; a replay of rewritten history is a lie. Redact before you emit. |
| sampling | The sampled-out stretch is a hole; replay reports phantom anomalies. |
See it work
You declared that a request goes queued → running → completed.
The code let req-8 skip running. The log says so,
with the seq that did it.
$ npx olog replay ./olog
2 entities
Request req-7 completed
code=200 method=GET path=/api/x
Request req-8 completed
code=500 method=POST path=/api/y
1 anomaly
seq 4 illegal_transition Request req-8 cannot go from "queued" to "completed"
One command, and the CLI reads any olog log — whatever language wrote it. The format is the contract, not the implementation.
The one rule
A log line names a state, not a sentence. If you cannot say what state the entity moved to, you do not yet know what you are logging.