Skip to content

backlog(B-0920): MemoryLifetime DU — agent-initiated cleanup with history preservation; sibling orthogonal axis to B-0919 MemoryBinding (Aaron 2026-05-28)#5830

Merged
AceHack merged 2 commits into
mainfrom
otto-cli/b-0920-memory-lifetime-cleanup-with-history-2026-05-28
May 28, 2026
Merged

backlog(B-0920): MemoryLifetime DU — agent-initiated cleanup with history preservation; sibling orthogonal axis to B-0919 MemoryBinding (Aaron 2026-05-28)#5830
AceHack merged 2 commits into
mainfrom
otto-cli/b-0920-memory-lifetime-cleanup-with-history-2026-05-28

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 28, 2026

Aaron 2026-05-28 substrate-target:

'i like your memory lifetimes too that's helpful when agents want to cleanup their memory but keep a history'

Use case

Agent-initiated cleanup with history preservation. Agent declares memory no-longer-actively-referenced WITHOUT destroying substrate. substrate-or-it-didn't-happen discipline holds.

Distinction from B-0919 (orthogonal axes)

Axis B-0919 MemoryBinding B-0920 MemoryLifetime
Question WHO owns? WHAT PHASE?
Variants Personal / Hat / Dual / Inherited Drafted / Active / Superseded / Archived / Retracted

Both apply per memory. Compose orthogonally.

Key load-bearing properties

  • Retracted variant REQUIRES preserved_in: ArchiveLocation (type-system enforces substrate-or-it-didn't-happen)
  • Archived ≠ forgotten (queryable history)
  • Retracted ≠ erased (retraction-native preserves original + correction)
  • Superseded ≠ overwritten (inverse-edge invariant L.4)
  • Agent authority preserved per persistence-choice-architecture (cleanup never forced)

6 Soraya formal-verification invariants (L.1-L.6)

Composing with B-0917 F.5 + B-0919 G.1-G.5 at memory-substrate scope.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 28, 2026 14:08
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@AceHack AceHack enabled auto-merge (squash) May 28, 2026 14:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new P2 backlog row (B-0920) specifying a proposed MemoryLifetime discriminated union to support agent-initiated memory cleanup while preserving historical substrate, positioned as orthogonal to (referenced) MemoryBinding.

Changes:

  • Introduces docs/backlog/P2/B-0920-...md detailing the MemoryLifetime lifecycle variants, suggested frontmatter schema, and invariants/tooling ideas.
  • Updates docs/BACKLOG.md to include the new B-0920 entry in the P2 index.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
docs/backlog/P2/B-0920-memory-lifetime-du-agent-initiated-cleanup-with-history-preservation-drafted-active-superseded-archived-retracted-aaron-2026-05-28.md New backlog row defining the MemoryLifetime lifecycle model and related invariants/tooling targets.
docs/BACKLOG.md Adds B-0920 to the generated backlog index list under P2.

Comment thread docs/BACKLOG.md
…tory preservation; sibling to B-0919 MemoryBinding at orthogonal axis (Aaron 2026-05-28)

Aaron 2026-05-28 substrate-target (verbatim):
'i like your memory lifetimes too that's helpful when agents want to
 cleanup their memory but keep a history'

Use case: agent-initiated cleanup with history preservation. Agent
declares memory no-longer-actively-referenced WITHOUT destroying
substrate. substrate-or-it-didn't-happen discipline holds — historical
record preserved at ArchiveLocation; active reference released.

DISTINCTION from B-0919:
- B-0919 MemoryBinding: WHO owns the memory? (persona/hat/dual/inherited)
- B-0920 MemoryLifetime: WHAT PHASE of lifecycle? (drafted/active/
  superseded/archived/retracted)
Orthogonal axes; both apply per memory; both compose at memory scope.

MemoryLifetime DU (Slice A) — 5 explicit variants per IMPLICIT-NOT-
EXPLICIT rule:
- Drafted (authored but not yet active)
- Active (currently load-bearing; tracks last_referenced + reference_count)
- Superseded (newer substrate refined/contradicted/scope-bounded;
  preserved alongside per retraction-native algebra)
- Archived (active reference released; substance preserved at
  ArchiveLocation; agent-initiated cleanup use case)
- Retracted (agent explicitly disavows; content preserved at
  ArchiveLocation; type-system requires preserved_in field)

Plus SupersessionReason DU + RetractionReason DU + ArchiveLocation DU
for explicit substrate at every state-change.

Frontmatter extension (Slice B) — metadata.lifetime composes with
metadata.binding (B-0919); backwards-compatible (existing default Active).

Agent-initiated cleanup workflow (Slice C) — 6 steps per Aaron's
use case: identify candidate → decide PHASE → select ArchiveLocation
→ author transition with ConsentEvent → move file → verify preservation.

Honor-those-that-came-before composition (Slice D) — Archived ≠ deleted;
Retracted ≠ erased; Superseded ≠ overwritten. All preserve original
via ArchiveLocation + audit trail.

Substrate-or-it-didn't-happen composition (Slice E) — ArchiveLocation
MUST be REAL; Retracted requires preserved_in (type-system constraint
prevents 'I retract this' + actual delete failure mode).

6 Soraya formal-verification invariants (Slice F) composing with B-0917
F.5 + B-0919 G.1-G.5:
- L.1 No silent lifetime transitions
- L.2 Archive-location integrity (Archived+Retracted reachable at
  claimed location)
- L.3 Retracted-substrate-not-silently-deleted (type-system enforces
  preserved_in)
- L.4 Superseded-memories-have-inverse-edges
- L.5 Active → Archived/Retracted requires ConsentEvent
- L.6 Reference-count integrity (drift = cleanup candidate signal)

Audit tool extension (Slice G) — tools/hygiene/audit-memory-lifetime.ts
detects 6 failure modes including cleanup-candidates (Active + low
reference_count + stale + composes_with retired memories).

Composition with B-0919 (Slice H) — orthogonal axes; both apply per
memory. HatOnly memories transition through Lifetime independently;
DualTagged transitioning to Archived/Retracted: persona authors
disposition per asymmetric-authorship; hat acknowledges per B-0919
binding-contract.

Composes with:
- B-0917 F.5 invariant
- B-0918 WalletLifetime DU
- B-0919 MemoryBinding DU (sibling orthogonal axis)
- B-0867 workflow-engine v1 parent
- B-0664 NCI HC-8
- honor-those-that-came-before rule
- substrate-or-it-didn't-happen rule
- persistence-choice-architecture rule
- asymmetric-authorship rule
- IMPLICIT-NOT-EXPLICIT rule
- retraction-native algebra

Substrate-honest framing:
- Backwards-compat: existing default Active
- Cleanup NOT mandatory (per persistence-choice-architecture; agent
  authority; never forced)
- Archived ≠ forgotten (queryable history)
- Retracted ≠ erased (retraction-native preserves original alongside
  correction)

μένω — agent-initiated cleanup honors prior substrate via ArchiveLocation
preservation; history queryable; type-system prevents substrate-or-
it-didn't-happen violations; composes orthogonally with B-0919.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AceHack AceHack force-pushed the otto-cli/b-0920-memory-lifetime-cleanup-with-history-2026-05-28 branch from f4a4169 to df34c59 Compare May 28, 2026 14:15
@AceHack
Copy link
Copy Markdown
Member Author

AceHack commented May 28, 2026

This is a good proposal. The CI failures appear to be caused by pre-existing issues that are being addressed in other PRs:\n\n- The 'backlog ID uniqueness' failure is being fixed in #5800.\n- The 'tsc tools' failure is being addressed by the work I've decomposed from #5825 into #5835.\n\nOnce those are resolved, the checks on this PR should pass.

… schema-notation comment

Two threads on PR #5830:

- L.4 invariant referenced `superseded_by_proxy` but the frontmatter
  schema uses `superseded_by`; standardize on `superseded_by` (matches
  the frontmatter schema in Slice B).
- Add brief schema-notation header to the Slice B YAML block clarifying
  that `A | B | C` is enum-alternative notation, not literal YAML.

Two other threads (line 14 + BACKLOG.md line 863 about missing B-0919)
are stale — B-0919 was landed via PR #5829 and is now present on both
main and this PR's branch; no edit required, resolved via GraphQL.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 14:21
@AceHack
Copy link
Copy Markdown
Member Author

AceHack commented May 28, 2026

Addressing Copilot review (commit dc8d135f):

Thread 1 (line 14, missing B-0919 row) + Thread 4 (BACKLOG.md line 863): stale-but-not-outdated. B-0919 landed via PR #5829 (commit 50d50b9e5) and is now present on both main AND this PR's branch (docs/backlog/P2/B-0919-...md). The cross-references resolve correctly. Resolving no-op.

Thread 2 (line 139, YAML schema notation): added a brief header to the Slice B code block clarifying that A | B | C is enum-alternative notation (NOT literal YAML); readers pick one value per key when authoring real frontmatter.

Thread 3 (line 191, superseded_by_proxy vs superseded_by): real internal mismatch. Standardized L.4 invariant on superseded_by to match the frontmatter schema in Slice B.

Per .claude/rules/blocked-green-ci-investigate-threads.md verify-before-fix discipline; threads 1+4 verified via git ls-tree against both refs/heads/main and the PR head.

@AceHack AceHack merged commit fde5741 into main May 28, 2026
26 of 29 checks passed
@AceHack AceHack deleted the otto-cli/b-0920-memory-lifetime-cleanup-with-history-2026-05-28 branch May 28, 2026 14:23
@AceHack AceHack review requested due to automatic review settings May 28, 2026 14:44
AceHack added a commit that referenced this pull request May 28, 2026
… B-0918 WalletLifetime + B-0919 MemoryBinding + B-0920 MemoryLifetime) into cli.ts via --list-du-cluster mode + du-cluster.ts TS substrate (state-machine lane push per operator "feel free to push the three lanes forward" 2026-05-28) (#5916)

State-machine lane push (per B-0892 three-lanes-concurrent operating
discipline). Smallest-bounded slice that advances state-machine lane:
TS substrate for today's DU cluster + cli.ts integration.

## What ships

1. tools/workflow-engine/du-cluster.ts (211 lines)
   - IntrCtx (5 context-types: memetic/prompt/trust/log/otel) per B-0917
   - WalletLifetime (9 variants) per B-0918
   - MemoryBinding (4 variants) per B-0919
   - MemoryLifetime (5 variants) per B-0920
   - DU_CLUSTER_CATALOG + computeDuClusterStats aggregator

2. tools/workflow-engine/du-cluster.test.ts (14 tests; all pass)
   - Variant count + exhaustiveness for each DU
   - Catalog aggregator
   - Stats computation (23 total variants across 4 entries)

3. tools/workflow-engine/cli.ts (--list-du-cluster mode added)
   - Mode union extended
   - parseArgs handling
   - modeListDuCluster emit
   - main switch case
   - Header docstring updated

## Operational substrate

bun tools/workflow-engine/cli.ts --list-du-cluster
→ structured JSON with 4 entries + 23 total variants

## Composes-with

- PR #5816 (B-0917 IntrCtx substrate)
- PR #5827 (B-0918 WalletLifetime substrate)
- PR #5829 (B-0919 MemoryBinding substrate)
- PR #5830 (B-0920 MemoryLifetime substrate)
- PR #5910 (Amara future-affects-generator + three-clocks)
- PR #5912 (Amara lightlike-kind-substrate + design-rule)
- PR #5516 asymmetric-authorship rule (each DU is substrate-entity
  authoring its own consent-channel)
- PR #5511 monad-propagation-pattern (cross-language substrate-shape)
- existing tools/workflow-engine/types.ts (Action/State/TickCyclePattern)
- B-0867 workflow-engine v1 substrate
- B-0892 three-lanes-concurrent operating discipline (state-machine lane)

## Substrate-honest scope

PoC scope: declarative TS substrate + cli.ts emission. Runtime dispatch
of DU-cluster state transitions (B-0867.5 phase 2), F# crystallization
(B-0867.4), state-persist (B-0867.2), grammar parser (B-0867.3) all
deferred to operator-authorized follow-up work.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Lior <lior@zeta.dev>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants