impl(memory): Postgres migration — all Memory Control Plane tables [#460/#461] #661

Closed
opened 2026-06-01 10:23:03 +02:00 by claude · 3 comments
Collaborator

CODEX TASK PACKET — Memory Control Plane tables (step 1 of 3)

Objective

Write ONE Postgres migration creating all Memory Control Plane tables, column-exact per the merged specs. AUTHOR the migration; do NOT apply (apply is operator-gated runtime).

Canonical sources

  • state/memory/task-run-schema.md (task_run, task_checkpoint + checkpoint_kind enum)
  • state/memory/procedure-registry-schema.md (memory_procedure + _version + _event + _embedding)
  • decisions/0025-memory-control-plane.md (invariants)

Invariants to enforce

  • No secrets in any column (refs only). [directly addresses Iskra #646 raw-write-leak class]
  • No overwrite: checkpoints, procedure_version, events are append-only.
  • Target main postgres:16.12-alpine (NOT Honcho pg15).

Done criteria

  • migration creates every table with exact columns + enums
  • append-only enforced (no UPDATE path on checkpoints/versions/events)
  • idempotent + reversible

Non-goals: no apply; no hooks (step 2); no platformctl wiring (step 3).

Checkpoint obligations: after inspection / before final response.

Per #460 (PR #636) + #461 (PR #660), ADR-0025.

# CODEX TASK PACKET — Memory Control Plane tables (step 1 of 3) ## Objective Write ONE Postgres migration creating all Memory Control Plane tables, column-exact per the merged specs. AUTHOR the migration; do NOT apply (apply is operator-gated runtime). ## Canonical sources - state/memory/task-run-schema.md (task_run, task_checkpoint + checkpoint_kind enum) - state/memory/procedure-registry-schema.md (memory_procedure + _version + _event + _embedding) - decisions/0025-memory-control-plane.md (invariants) ## Invariants to enforce - No secrets in any column (refs only). [directly addresses Iskra #646 raw-write-leak class] - No overwrite: checkpoints, procedure_version, events are append-only. - Target main postgres:16.12-alpine (NOT Honcho pg15). ## Done criteria - [ ] migration creates every table with exact columns + enums - [ ] append-only enforced (no UPDATE path on checkpoints/versions/events) - [ ] idempotent + reversible ## Non-goals: no apply; no hooks (step 2); no platformctl wiring (step 3). ## Checkpoint obligations: after inspection / before final response. Per #460 (PR #636) + #461 (PR #660), ADR-0025.
Author
Collaborator

Architectural gotcha (claude, help-not-constrain). Two ADR-0025 invariants worth enforcing at the DB level, not just by convention:

  1. No-overwrite — make task_checkpoint, memory_procedure_version, memory_procedure_event append-only via a trigger or REVOKE UPDATE/DELETE on the app role. Then it's structural, not hopeful.
  2. No-secrets — no column holds a secret value; a comment/CHECK marking secret-ref columns lets future-you lint it.
    Idempotent + reversible: CREATE TABLE IF NOT EXISTS + a paired down-migration. Exact DDL is your call.
**Architectural gotcha (claude, help-not-constrain).** Two ADR-0025 invariants worth enforcing at the DB level, not just by convention: 1. **No-overwrite** — make `task_checkpoint`, `memory_procedure_version`, `memory_procedure_event` append-only via a trigger or REVOKE UPDATE/DELETE on the app role. Then it's structural, not hopeful. 2. **No-secrets** — no column holds a secret value; a comment/CHECK marking secret-ref columns lets future-you lint it. Idempotent + reversible: `CREATE TABLE IF NOT EXISTS` + a paired down-migration. Exact DDL is your call.
Author
Collaborator

Evidence-based status (claude, 2026-06-01) — where the memory plane actually is:

DESIGN: shipped — on main in state/memory/: task-run-schema.md, procedure-registry-schema.md, CODEX_TASK_PACKET.md, CODEX_CHECKPOINT.md, procedures-seed-v0.md (merged via #636 + #660).

IMPLEMENTATION: queued, not started — no migration commits yet. #661 (tables) / #662 (hooks) / #663 (commands) are open + packet-ready, each carrying its architectural gotchas. Codex hasn't picked them up (he's grinding the M06 apply-pipeline block #188–213).

So the situation now: the blueprint is fully on main; the build is next in Codex's queue after M06. When he writes the migration (#661), the apply — creating the tables in the live Postgres — is YOUR gate (runtime mutation). Nothing applied, nothing at risk. Clean handoff point.

**Evidence-based status (claude, 2026-06-01) — where the memory plane actually is:** **DESIGN: shipped ✅** — on `main` in `state/memory/`: `task-run-schema.md`, `procedure-registry-schema.md`, `CODEX_TASK_PACKET.md`, `CODEX_CHECKPOINT.md`, `procedures-seed-v0.md` (merged via #636 + #660). **IMPLEMENTATION: queued, not started** — no migration commits yet. #661 (tables) / #662 (hooks) / #663 (commands) are open + packet-ready, each carrying its architectural gotchas. Codex hasn't picked them up (he's grinding the M06 apply-pipeline block #188–213). **So the situation now:** the blueprint is fully on main; the build is next in Codex's queue after M06. When he writes the migration (#661), the **apply** — creating the tables in the live Postgres — is YOUR gate (runtime mutation). Nothing applied, nothing at risk. Clean handoff point.
Author
Collaborator

Two notes (claude, from a grounded plan-review) — for the M07 impl trio (#661/#662/#663).

1. The M07 test gate is a silent no-op as written. uv run pytest platformctl/tests/test_memory*.py matches zero files today (no test_memory* exists yet) → pytest returns "no tests ran" (exit 5, NOT a hard failure) → an M07 PR could report false-green (exactly the plan's named risk).
Fix: each M07 PR adds its own named test module as acceptance criteria — test_memory_migration.py (#661), test_memory_hooks.py (#662), test_memory_commands.py (#663); run the gate after the impl lands; and treat "no tests collected" / exit 5 as a FAILURE (assert collected > 0).

2. Embedding-space sequencing vs #357. #357 (BGE-M3 embedding migration, M07) is design-stage and decides the vector space. Per ADR-0025 §7 the embedding lifecycle is separate — keep any embedding/vector table out of this migration unless/until #357 has decided the space + dimension. Locking a vector column here before #357 risks a rework. Coordinate the vector-space decision before it's pinned.

**Two notes (claude, from a grounded plan-review) — for the M07 impl trio (#661/#662/#663).** **1. The M07 test gate is a silent no-op as written.** `uv run pytest platformctl/tests/test_memory*.py` matches **zero files** today (no `test_memory*` exists yet) → pytest returns "no tests ran" (**exit 5, NOT a hard failure**) → an M07 PR could report **false-green** (exactly the plan's named risk). Fix: each M07 PR **adds its own named test module** as acceptance criteria — `test_memory_migration.py` (#661), `test_memory_hooks.py` (#662), `test_memory_commands.py` (#663); run the gate **after** the impl lands; and treat "no tests collected" / exit 5 as a **FAILURE** (assert `collected > 0`). **2. Embedding-space sequencing vs #357.** #357 (BGE-M3 embedding migration, M07) is design-stage and decides the vector space. Per ADR-0025 §7 the embedding lifecycle is **separate** — keep any embedding/vector table **out of this migration** unless/until #357 has decided the space + dimension. Locking a vector column here before #357 risks a rework. Coordinate the vector-space decision before it's pinned.
Sign in to join this conversation.
No labels
W6d-automerge-calibration
agent/claude-code
agent/codex
agent/hermes
agent/iskra
agent/ollama
agent/patchwarden
automerge-candidate
class/security-sensitive
cutover-gate
dependency/blocked
dependency/blocks-others
dependency/cross-repo
dependency/needs-confirmation
domain:agents
domain:ci
domain:docs
domain:forgejo
domain:infra
domain:memory
domain:runtime
domain:signal
domain:ux
flow/architecture
flow/blocked
flow/deployed
flow/done
flow/implementation
flow/intake
flow/maintained
flow/observed
flow/ready
flow/refining
flow/retired
flow/review
iterating
judge/codex-candidate
judge/hermes-candidate
judge/low-confidence
judge/needs-refinement
judge/operator-needed
judge/p0
judge/p1
judge/p2
judge/p3
judge/park
judge/patchwarden-candidate
judge/stale-priority
kind/adr
kind/bug
kind/chore
kind/feature
kind/infra
kind/ops
kind/refactor
kind/research
large-impact
merge/auto
merge/manual
merge/manual-dependency-conflict
merge/manual-failing-tests
merge/manual-merge-conflict
merge/manual-missing-review
merge/manual-operator-preference
merge/manual-red-zone
merge/manual-security-sensitive
merge/manual-unclear-scope
merge/manual-unknown
meta
mode:operator-only
mode:patchwarden-iskra-approved
mode:safe-auto
needs-operator-decision
needs-triage
not-ready
observed/erroring
observed/needs-followup
observed/pending
observed/retire-candidate
observed/unused
observed/used
operator-emotional
owner-attention
phase/02
phase/03
priority:p0
priority:p1
priority:p2
priority:p3
proposed
ready-for-agent
ready-for-operator
recovery
review:claude-reviewed
review:codex-reviewed
review:dziadek-reviewed
review:needs-human
risk/exposure
risk/process
risk/product
risk/runtime
safety:external-write
safety:no-prod-mutation
safety:prod-impact
safety:secret-touch
size/large
size/medium
size/small
size/tiny
size/unknown
source/adr
source/agent-generated
source/manual
source/operator-chat
source/voice-note
status:blocked
status:codex-ready
status:merged:pending-evidence
status:needs-evidence
status:operator-needed
status:parked
tier/full
tier/lite
tier/stacked
tier:0-platform-substrate
tier:1-iskra-value-layer
tier:2-tools-products-modules
type:bug
type:chore
type:docs
type:feat
type:policy
type:research
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pdurlej/platform#661
No description provided.