Repository navigation
Description
Summary
Build a first-class Execution Identity & Evidence Spine across Maka Runtime and Headless.
The goal is to let the system answer one question precisely:
Which version of Maka, in which execution and workspace state, produced this fact, projection, decision, or piece of evidence?
This is more than logging. It is a shared identity, provenance, freshness, and inspection contract connecting Runtime Events, AgentRun, Turn, Tool execution, TaskRun, Attempt, Self-check, Compaction, recovery, and AHE evidence.
Why this matters
Maka already has strong local mechanisms:
- Runtime Event Log as the canonical interaction history;
- AgentRun and Session projections;
- Tool Calls, Tool Results, artifacts, and Turn-level evidence;
- History Compaction checkpoints;
- append-only Task Events and TaskRun projections;
- bounded Heavy-task Self-check;
- AHE target snapshots and evidence export.
The remaining gap is the lineage between them. Today, an operator or downstream subsystem should be able to answer questions such as:
- Which AgentRuns and Runtime Event ranges belong to this TaskRun Attempt?
- Which Tool Result proves a Self-check evidence claim?
- At which Runtime and Task Event high water was a projection built?
- Which workspace state did the check observe?
- Did later events or side effects make an earlier Self-check stale?
- Which exact event range does a Compaction checkpoint cover?
- Which code/target snapshot and execution state produced an AHE result?
- After a crash, which facts were committed and which side effects may still be in flight?
Without a shared evidence spine, each subsystem can be locally correct while cross-system debugging, recovery, freshness, and evaluation remain ambiguous.
Proposed mental model
Target / code identity
└── TaskRun
└── Attempt
└── AgentRun
└── Turn
└── Runtime Event range
├── Tool Call / Tool Result
├── Artifact / workspace observation
├── Compaction source coverage
└── Self-check evidence
AHE exports, UI read models, model context, TaskRun state, and inspection output are projections over this fact lineage. They are not additional fact authorities.
Proposed contract direction
Introduce a shared reference/cursor contract. The exact type is open to design, but conceptually it needs to carry identities such as:
interface ExecutionEvidenceRef {
sessionId: string;
turnId?: string;
agentRunId?: string;
taskRunId?: string;
attemptId?: string;
runtimeEventCursor?: string | number;
taskEventCursor?: string | number;
workspaceRevision?: string;
targetSnapshotId?: string;
}Important: a high-water cursor must have explicit ordering semantics. A random event id is not automatically a valid high water.
The contract should be small enough to reuse, versioned where it crosses durable boundaries, and capable of representing partial knowledge without inventing identities.
Required invariants
1. Canonical fact ownership
Task Events must describe task-level state transitions and reference Runtime trajectories. They should not silently become a second copy of model messages, Tool Calls, or Tool Results.
2. Projection source coverage
Every durable projection that affects recovery, evaluation, or future model context should be able to identify the source log and covered cursor/range from which it was built.
3. Evidence provenance
Important evidence should answer:
- who or what produced it;
- what was observed;
- which Runtime/Task Events support it;
- which workspace revision it describes;
- which later mutations can invalidate it.
Model interpretation may explain evidence, but executor-owned facts should prove commands, exit codes, outputs, artifacts, and workspace changes.
4. Freshness and invalidation
Self-check and other completion evidence must not remain current after relevant later events or workspace mutations.
Conceptually:
check source high water < current high water
+ later events may affect checked artifacts
=> check is stale or requires revalidation
5. Compaction coverage
A durable Compaction checkpoint should identify at least:
- covered Runtime Event range/high water;
- projection/checkpoint schema or policy version;
- successor facts that remain outside the compacted prefix.
Compaction changes the provider-visible projection, never the canonical evidence lineage.
6. Version-bound exports
TaskRun and AHE exports must bind results to an unambiguous target/code identity plus the execution lineage that produced them.
7. Recovery-visible uncertainty
If a crash leaves uncertainty between an external side effect and durable event commit, the lineage must represent that uncertainty. Recovery must not infer success merely because an event is absent, or repeat a non-idempotent action without an explicit policy.
Developer-facing observability
The contract should produce a useful inspection surface, not remain an internal type-only refactor.
Candidate commands:
maka inspect <sessionId|agentRunId>
maka eval task inspect <taskRunId>
maka inspect <taskRunId> --jsonA human-readable view could look like:
TaskRun task-42
├─ Attempt 1
│ ├─ AgentRun run-a
│ ├─ Runtime Events 100–246
│ ├─ Tool Calls 12
│ ├─ Workspace W1 → W7
│ └─ stopped: permission_required
├─ Attempt 2
│ ├─ AgentRun run-b
│ ├─ Runtime Events 247–421
│ ├─ Compaction checkpoint: 100–310
│ ├─ Self-check at event 418 / workspace W12
│ └─ completed
└─ AHE export
└─ snapshot maka-ahe-abc123
The JSON form should be stable enough for debugging tools and future UI visualization.
Suggested delivery phases
Phase 0 — Contract and audit
- Inventory current ids, refs, cursors, and duplicated facts across core/runtime/headless/storage.
- Define canonical ownership and ordering semantics.
- Add a versioned shared execution/evidence reference contract.
Phase 1 — Runtime ↔ Task lineage
- Persist TaskRun/Attempt ↔ AgentRun linkage.
- Record Runtime Event ranges or stable cursors per Attempt.
- Make TaskRun projection expose lineage without copying Runtime facts.
Phase 2 — Evidence freshness
- Bind Tool/Artifact evidence to executor facts and workspace observations.
- Bind Self-check to Runtime/Task high waters and workspace revision.
- Invalidate or mark stale evidence after relevant later mutations.
- Bind Compaction checkpoints to explicit source coverage.
Phase 3 — Inspect surface
- Add human-readable timeline/tree output.
- Add machine-readable JSON output.
- Surface gaps, stale evidence, missing refs, and ambiguous in-flight state rather than hiding them.
Phase 4 — Evolution lineage
- Carry target snapshot and execution lineage into AHE exports.
- Make baseline/candidate evidence traceable to exact Runtime and Task facts.
Acceptance criteria
- A TaskRun Attempt can be traced to its AgentRun(s) and Runtime Event coverage.
- Tool, Artifact, Self-check, and Compaction records expose source provenance appropriate to their authority.
- Self-check freshness can be evaluated deterministically after later events/workspace mutations.
- Compaction coverage has explicit, validated cursor semantics.
- AHE/TaskRun exports bind target identity to execution lineage.
- Recovery can represent ambiguous side-effect/commit windows instead of guessing.
- A CLI inspection command renders the end-to-end lineage.
- A machine-readable inspection format is covered by contract tests.
- Projection/replay tests protect canonical ownership and ordering invariants.
- Existing durable data has a migration or backward-compatible read strategy.
Non-goals
- Building a general distributed tracing backend.
- Shipping a hosted telemetry service.
- Claiming bit-exact deterministic LLM replay.
- Moving raw Runtime facts into Task Events.
- Allowing Self-check or AHE candidates to rewrite their evidence source.
- Solving every external-tool idempotency policy in one change.
Design principle
Maka should be able to prove which version of the system, in which state, did what — and why every current projection is still valid.
This spine should become the observability foundation for Runtime debugging, durable recovery, Self-check trust, Compaction correctness, and AHE evolution.
Related documentation
ARCHITECTURE.md/ARCHITECTURE.en.md- Chapter 1: Log Is the Runtime
- Chapter 2: Evidence Before Compression
- Chapter 3: Compaction Is a Projection
- Chapter 4: The Durable Task Loop
- Chapter 5: Self-Check Is Not Self-Trust
- Chapter 6: Self-Iteration Happens Outside the Runtime
Activity
Nyvo-io commentedon Jul 19, 2026
I would like to claim a focused Phase 0 slice of #948: the execution-identity and evidence-spine contract/audit foundation.
Proposed scope:
I will keep Phase 1+ lineage persistence, freshness invalidation, inspect commands, and AHE export wiring out of this slice unless the maintainers explicitly split them into follow-up work. I will first wait for assignment and maintainer confirmation before creating a branch or implementing anything.
Astro-Han commentedon Jul 19, 2026
Closing — all nine phase PRs are merged, covering Phase 0–4 and the 9 acceptance criteria: #949 (Phase 0 contract), #950 (Phase 1 Runtime↔Task lineage), #953/#954/#955 (Phase 2A/B/C evidence freshness and compaction coverage), #957/#959 (Phase 3A/B inspect), #961/#967 (Phase 4A/B AHE content-addressing and lineage export). The unified inspect CLI is in place.