An example
A customer starts an export. Your app opens an export span, prepares the report, and then a retry path swallows an error. No exception reaches your error tracker, and no file is ever produced. The customer waits.
With Logika, the export carries a rule: it must finish, one way or the other, within two minutes.
{"name": "export",
"message": "Export {export_id} for {user_id}",
"params": ["export_id", "user_id"],
"span": {"timeout": "2m", "paths": ["prepared (completed|failed)"]},
"children": [
{"name": "prepared", "message": "Prepared {rows} rows", "params": ["rows"]},
{"name": "completed", "message": "Completed"},
{"name": "failed", "message": "Failed: {reason}", "params": ["reason"]}]}
Two minutes after the export started, nothing has completed and nothing has failed. Logika raises an issue, "export timed out", with the export's id, its timeline and the app version, and your agent can start on the fix.
Nobody wrote that rule up front. Your agent logged the export's steps while coding it. Later, in a short session, it read a week of real exports, saw that every one either completed or failed within about forty seconds, and asked you whether two minutes was a fair limit. You said yes, and it became a rule.
What you get
Rules from real behaviour
Rules are written from what your code actually emitted, in its own names, rather than guessed before it ran.
Proven before they go live
Each rule must stay silent on the real data, and fire on a replay that deliberately breaks it.
Checked every five minutes
Every event is judged by the rules its own release was built with, so an old version is never held to a new rule.
One issue per broken rule
Repeats are occurrences of the same issue. A bad deploy is one email, not a thousand.
How it works
The rules live in a ledger: the list of the events your code emits, with their types and what must hold between them. It is a file in your repository, logika.json, reviewed in pull requests like the code beside it. A ledger can start empty: Logika then stores everything and raises only failures. Each declaration adds something: a readable message, typed values, and something a rule can talk about.
Rules are written in a reflection session: every so often, once there is real data, your agent reads the code and what it emitted, proposes rules, and asks you the questions only you can answer, such as whether a behaviour is a bug or the business working as intended. The session runs on nock, which logika init installs. A rule can say:
| What must hold | For example |
|---|---|
| a fact about one event's values | the amount is above zero |
| the order of an operation's steps | a payment is reserved, then captured or declined |
| that something finishes in time | an export completes or fails within 2 minutes |
| that one event obliges another | every captured payment is fulfilled or refunded within 15 minutes |
| a relation between events | an order is charged once |
When the session is done, logika sync sends the ledger to Logika. From then on, what breaks it is an issue with its evidence.
Controls and boundaries
- Nothing changes on its own. Rules are proposed, tested and written into
logika.json; they take effect only when you or your release pipeline runlogika sync. - No mute button. A rule that fires when it shouldn't is wrong, and the next session corrects it in the ledger.
- Rules check only what was recorded. If a rule needs a value the code doesn't log yet, the session says which event or value to add.
- Your code depends on nothing. It sends plain OpenTelemetry; the ledger only names what it sends.
The ledger's every key is in the ledger reference; a session, step by step, is in the reflection guide.