Skip to content

kernel+spec: step-declared memory, slice 1 — make the injected pack a journal fact #220

Description

@kjgbot

Gate 1 is met as of 2026-09-07. RFC-0001's dependency order says gates 5–8 are horizontals that "start as soon as gate 1 holds", so this opens gate 5.

Verified absent, not assumed

  • memory appears 0 times in packages/sdk/src/spec.ts. A step cannot declare it.
  • Every memory match in kernel/**/*.rs is MemoryJournal — the in-memory test journal — or a // SAFETY: comment. None of it is gate 5's concept.
  • relayhistory appears only in kernel/DESIGN.md. Nothing consumes it.

Scope: slice 1 of the gate, deliberately

Gate 5's full "Done when" requires a behavioural result — "an agent avoiding a mistake recorded in a previous run's trajectory, with the citation in its output" — which needs relayhistory wired in and an eval. That is not one PR.

This issue is the substrate only, and stops short on purpose:

  1. A memory: declaration on a step in the spec — scope (script | agent), query, budget — in both packages/sdk/src/spec.ts and the kernel dialect, kept in parity the way spec-parity already enforces.
  2. The kernel records the injected pack as a journal fact: what was requested, what was injected, and what it cost against the step's budget. Same discipline as every other kernel concept — if it is not in the journal it did not happen, and replay must reproduce it.
  3. Budget accounting is exact under resume, matching gate 1's rule that a resumed run's spend equals one execution of each step. An injected pack must not be charged twice.

Explicitly NOT in scope: any relayhistory call, any retrieval implementation, any behavioural claim about pack quality. A stub provider returning a fixed pack is correct here. Retrieval quality is gate 5's hard part and gets its own issue once the substrate is replayable.

Suggested acceptance

Following #212's shape — pin the property, not the API:

  • A crash-resume test where a step declaring memory: is killed after injection but before completion, resumes, and the journal shows the pack injected once with the budget charged once.
  • A replay test: replaying the journal reproduces the identical injected pack without calling the provider again, because the pack is a recorded fact rather than a re-derived one.
  • Spec parity holds: the SDK and kernel dialects accept the same memory: shape, and the existing parity test proves it.

The first test is the deliverable; the rest exists to make it pass.

Note on ordering

I picked gate 5 over gate 7 because gate 9 depends on 5 + 8, so it is on the critical path while routing is standalone. That is the RFC's reasoning, not a product decision I own — say so and I will repoint the lane at gate 7 instead.

Ledger: https://claude.ai/code/artifact/1edcf8ae-af0c-4115-b953-df5bd8cdd0c9

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions