# What Types of Data Are Recorded as Durable Facts in Maka's Runtime Event Log?

> Discover the six durable facts Apache Maka records in its Runtime Event Log: model messages, tool calls, tool results, permissions, usage records, and terminal facts for deterministic replay and crash recovery.

- Repository: [The Apache Software Foundation/maka](https://github.com/apache/maka)
- Tags: deep-dive
- Published: 2026-08-26

---

**Apache Maka's Runtime Event Log stores six immutable categories of durable facts—model messages, tool calls, tool results, permissions, usage records, and terminal facts—that enable deterministic replay and crash recovery.**

The **Runtime Event Log** serves as the single source of truth for agent execution in Apache Maka. Every interaction between the LLM and the system is captured as a durable fact that survives process restarts and crashes. Understanding what types of data are recorded as durable facts in Maka's Runtime Event Log is essential for building resilient AI applications that can recover state exactly after failures.

## Six Categories of Durable Facts in the Runtime Event Log

According to the architecture documentation in [`docs/architecture/runtime-core-architecture-draft.md`](https://github.com/apache/maka/blob/main/docs/architecture/runtime-core-architecture-draft.md), the log persists six distinct types of canonical interaction facts. These facts are appended in an immutable, ordered fashion and form the foundation for deterministic replay.

### Model Messages

**Model messages** capture the text-based exchanges generated by the LLM during a session. These include the model's reasoning, responses, and any intermediate outputs that constitute the conversational history.

### Tool Calls

**Tool calls** record invocations of external tools issued by the model, such as `web-search-tool` or `file-write-tool`. Each entry preserves the tool name and arguments passed at the moment of invocation.

### Tool Results

**Tool results** store the outcomes returned from tool invocations. These facts complete the request-response cycle and provide the data necessary for the model to continue reasoning after external operations finish.

### Permissions

**Permissions** document grants or denials that control which tools or actions a model may perform. This audit trail ensures security policies are enforced and can be reviewed during replay.

### Usage Records

**Usage records** track quantitative resource consumption, including token counts and CPU utilization. These metrics support billing, rate limiting, and performance optimization analysis.

### Terminal Facts

**Terminal facts** mark the final completion status of a run—whether success, failure, or partial completion. Once recorded, these facts make the run immutable and signal that no further events will be appended.

## Why Durable Facts Enable Deterministic Recovery

The durability guarantee means facts are never updated or deleted; they are only appended to the log. During crash recovery, components like `SessionManager`, `AgentRun`, and `RuntimeKernel` read only these durable facts to reconstruct the exact execution state.

As documented in [`docs/architecture/runtime-resume-architecture.md`](https://github.com/apache/maka/blob/main/docs/architecture/runtime-resume-architecture.md), this append-only design eliminates guesswork. The system does not need to predict the model's next move—it simply replays the sequence of recorded facts to restore the previous state.

## Recording Durable Facts with AgentRun

The `AgentRun` class in [`packages/runtime/src/agent-run.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/agent-run.ts) implements the durable execution envelope that commits facts to the log. The following example demonstrates how tool calls are recorded:

```typescript
import { RuntimeEventStore } from '@maka/runtime';
import { AgentRun } from '@maka/runtime';

async function recordToolCall(agentRun: AgentRun, toolName: string, args: any) {
  const event = {
    kind: 'tool-call',
    tool: toolName,
    payload: args,
    timestamp: Date.now(),
  };
  // The store guarantees the fact is durable and immutable.
  await RuntimeEventStore.append(event);
}

```

The `RuntimeEventStore.append` method ensures the fact is persisted before the operation proceeds, maintaining the atomicity required for safe recovery.

## Replaying State from Durable Facts

During recovery, the system queries the stored facts to rebuild execution context. The `RuntimeEventStore.query` method retrieves all events for a specific `runId`:

```typescript
import { RuntimeEventStore } from '@maka/runtime';

async function recoverRun(runId: string) {
  const durableFacts = await RuntimeEventStore.query({ runId });
  // Re-play the sequence of messages, tool calls, and results.
  for (const fact of durableFacts) {
    // …re-create the execution state from each fact…
  }
}

```

This query operation reads from [`packages/runtime/src/runtime-event-store.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/runtime-event-store.ts), which provides the append-only storage API that underpins Maka's fault tolerance.

## Summary

- **Six durable fact types** are recorded: model messages, tool calls, tool results, permissions, usage records, and terminal facts.
- **Immutable append-only storage** in the Runtime Event Log guarantees that recorded facts survive crashes and restarts.
- **Key source files** include architecture docs at [`docs/architecture/runtime-core-architecture-draft.md`](https://github.com/apache/maka/blob/main/docs/architecture/runtime-core-architecture-draft.md) and [`docs/architecture/runtime-resume-architecture.md`](https://github.com/apache/maka/blob/main/docs/architecture/runtime-resume-architecture.md), with implementation in [`packages/runtime/src/agent-run.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/agent-run.ts) and [`packages/runtime/src/runtime-event-store.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/runtime-event-store.ts).
- **Deterministic replay** is achieved by reading the ordered sequence of facts during recovery, eliminating the need to re-execute model inference.

## Frequently Asked Questions

### What makes a fact "durable" in Maka?

A fact is durable when it is appended to the Runtime Event Log in an immutable, ordered fashion that survives process restarts and crashes. Once written, durable facts cannot be modified or deleted, ensuring the system can always reconstruct the exact state of a previous execution by replaying the recorded sequence.

### How does the Runtime Event Log handle crash recovery?

During recovery, the `RuntimeKernel` and `SessionManager` read all durable facts for a given run from the log. By replaying these facts in order, the system reconstructs the execution state without re-invoking the LLM or external tools, guaranteeing deterministic resumption from the point of failure.

### Where is the Runtime Event Log implementation located?

The core implementation spans several files in the Apache Maka repository. The architecture is defined in [`docs/architecture/runtime-core-architecture-draft.md`](https://github.com/apache/maka/blob/main/docs/architecture/runtime-core-architecture-draft.md), while the recording logic resides in [`packages/runtime/src/agent-run.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/agent-run.ts) and the storage API is implemented in [`packages/runtime/src/runtime-event-store.ts`](https://github.com/apache/maka/blob/main/packages/runtime/src/runtime-event-store.ts).

### Can durable facts be modified after they are recorded?

No. Durable facts are immutable by design. The append-only nature of the Runtime Event Log ensures that once a fact is written—whether a tool result, permission grant, or terminal status—it becomes a permanent part of the execution history that cannot be altered or removed.