Add profile-driven lifecycle rules

This commit is contained in:
2026-05-18 22:20:14 +02:00
parent 322571c02c
commit 908494b712
12 changed files with 700 additions and 14 deletions

View File

@@ -44,13 +44,14 @@ not what adjacent repositories may already provide.
## Current Baseline - 2026-05-18
Overall maturity: **4.3 / 5**
Overall maturity: **4.4 / 5**
The repo has crossed from intent-only into a working deterministic library
foundation, a usable local runtime facade, a CLI, a file-backed local
workspace, first-slice policy/review/audit gates, a concrete Markitect package
bridge, deterministic activation quality helpers, and first-slice service
readiness contracts with profile-driven runtime adapter resolution.
readiness contracts with profile-driven runtime adapter resolution and
profile-derived lifecycle rules.
| Dimension | Current | Target | Evidence | Needed Next |
| --- | ---: | ---: | --- | --- |
@@ -58,18 +59,18 @@ readiness contracts with profile-driven runtime adapter resolution.
| Package foundation | 4.0 | 4.0 | Python package, exports, runtime facade, CLI entrypoint, config, service contracts, dependency-light tests | Maintain public API compatibility as adapters expand. |
| Profile contract ingress | 3.2 | 4.0 | Markitect-compatible profile loading, diagnostics, runtime envelopes, profile-derived runtime config, local adapter alias normalization | Add richer compatibility coverage. |
| Graph/event contract ingress | 3.5 | 4.0 | Graph loading, edge endpoint diagnostics, event model, JSONL event log, export, repair diagnostics, service import/export contracts | Add broader external adapter fixtures. |
| Phase domain model | 3.0 | 4.0 | Phases, memory kinds, lifecycle states, actions, explicit path records | Add profile-driven transition rule evaluation and migration semantics. |
| Phase domain model | 3.4 | 4.0 | Phases, memory kinds, lifecycle states, actions, explicit path records, profile-derived transition rules | Add migration semantics. |
| Profile execution planning | 3.8 | 4.0 | Adapter plan, capabilities, policy gates, fallback behavior, CLI output, snapshot fixture, service contract, config-driven local adapter resolution | Add external adapter injection coverage. |
| Lifecycle planning | 3.0 | 4.0 | Transition, retention, refresh, compaction dry-run plans, review-gated local apply | Add profile-driven rule evaluation and service apply contracts. |
| Lifecycle planning | 3.6 | 4.0 | Transition, retention, refresh, compaction dry-run plans, profile-driven lifecycle rules, review-gated local apply | Add service apply contracts and migration semantics. |
| Activation planning | 3.8 | 5.0 | Budgeted selection, Markitect-compatible selection output, package request envelope, graph neighborhoods, event paths, ranking, metadata preservation, metrics | Add semantic-index adapters and broader evaluation corpora. |
| Local persistence | 3.0 | 4.0 | Versioned local workspace, file-backed graph store, JSONL event log, JSONL audit sink | Add migration/repair utilities and stronger durability semantics. |
| Policy and audit | 3.2 | 5.0 | Operation points, policy gateway checks, audit schema, review records, redaction, activation denials | Add external policy adapters and richer audit retention behavior. |
| Observability and diagnostics | 3.5 | 4.0 | Planner diagnostics, runtime diagnostics, event log corruption checks, repair diagnostics, policy denial diagnostics, health envelopes, adapter status | Add production telemetry adapters. |
| Markitect interop | 3.5 | 4.0 | Compatible contract ingress, optional validation boundary, enriched selection metadata, package request/response envelopes | Add live optional Markitect compiler adapter when available. |
| Kontextual/Infospace interop | 2.5 | 4.0 | Boundaries documented, small derived fixtures, activation quality report fixture, Kontextual delegation envelope | Add live fake/real delegation adapters and broader Infospace reports. |
| Testing and evaluation | 4.0 | 4.0 | 54 deterministic tests over planners, adapters, runtime envelopes, CLI, snapshots, file-store round trips, apply denial, review records, audit schema, policy redaction, Markitect bridge fixtures, retrieval, activation metrics, service contracts, config, health, conformance, and adapter resolution | Add broader evaluation corpora. |
| Service readiness | 3.8 | 4.0 | Runtime ports, service contracts, config model, profile-derived adapter resolution, health checks, local service runner, adapter conformance helpers | Add framework-specific bindings and production adapter packs. |
| Developer experience | 3.5 | 4.0 | README quick start, package map, runtime facade docs, CLI examples, local persistence guide, service adapter resolution docs | Add troubleshooting and richer examples. |
| Testing and evaluation | 4.0 | 4.0 | 58 deterministic tests over planners, adapters, runtime envelopes, CLI, snapshots, file-store round trips, lifecycle rules, apply denial, review records, audit schema, policy redaction, Markitect bridge fixtures, retrieval, activation metrics, service contracts, config, health, conformance, and adapter resolution | Add broader evaluation corpora. |
| Service readiness | 3.9 | 4.0 | Runtime ports, service contracts, config model, profile-derived adapter resolution, health checks, local service runner lifecycle support, adapter conformance helpers | Add framework-specific bindings and production adapter packs. |
| Developer experience | 3.6 | 4.0 | README quick start, package map, runtime facade docs, CLI examples, local persistence guide, service adapter resolution docs, lifecycle rule docs | Add troubleshooting and richer examples. |
## Progress Update - PMEM-WP-0002
@@ -173,6 +174,26 @@ Remaining maturity blockers:
- Optional framework-specific service bindings.
- Production telemetry and audit retention integrations.
## Progress Update - PMEM-WP-0009
Closed on 2026-05-18:
- Added `LifecycleRuleConfig` for profile-derived retention, transition,
refresh, and compaction settings.
- Added profile-derived retention planning.
- Added review-gated phase transition rules from profile metadata.
- Added `plan_lifecycle_from_profile(...)`.
- Added `PhaseMemoryRuntime.plan_lifecycle_with_profile(...)`.
- Added CLI `graph lifecycle --profile`.
- Added lifecycle rule docs, README examples, and regression tests.
Remaining maturity blockers:
- Migration semantics for profile/rule changes over durable stores.
- Service apply contracts.
- Live external adapter implementations.
- Broader evaluation corpora.
## Progress Update - PMEM-WP-0004
Closed on 2026-05-18:
@@ -237,6 +258,7 @@ flowchart TD
WP6["PMEM-WP-0006\nRetrieval and activation quality"]
WP7["PMEM-WP-0007\nService readiness and adapters"]
WP8["PMEM-WP-0008\nProfile-driven runtime config"]
WP9["PMEM-WP-0009\nProfile-driven lifecycle rules"]
WP1 --> WP2
WP2 --> WP3
@@ -252,6 +274,9 @@ flowchart TD
WP3 --> WP8
WP5 --> WP8
WP7 --> WP8
WP2 --> WP9
WP4 --> WP9
WP8 --> WP9
```
## Next Tracking Cadence

View File

@@ -0,0 +1,118 @@
---
id: PMEM-WP-0009
type: workplan
title: "Profile-Driven Lifecycle Rules"
domain: markitect
repo: phase-memory
status: finished
owner: codex
topic_slug: phase-memory
created: "2026-05-18"
updated: "2026-05-18"
---
# PMEM-WP-0009: Profile-Driven Lifecycle Rules
## Goal
Let Markitect-compatible memory profiles drive lifecycle planning directly,
instead of requiring every retention, refresh, compaction, and transition
parameter to be passed by hand.
This moves the phase domain model and lifecycle planning rows toward their
target maturity by turning profile policy into executable dry-run behavior.
## Current Evidence
PMEM-WP-0008 added profile-derived runtime configuration. Lifecycle planning
still depended on explicit CLI/runtime parameters for stale/delete thresholds,
refresh digests, and compaction targets.
## Non-Goals
- Mutate durable lifecycle state automatically.
- Add physical delete behavior.
- Replace review gates for stabilization, rigid promotion, refresh, or
compaction.
- Build a profile migration engine.
## Implementation Update - 2026-05-18
Implemented the first profile-driven lifecycle rules slice:
- Added `LifecycleRuleConfig` with retention, transition, refresh, and
compaction rule extraction from `ProfileIntent` or mappings.
- Added profile-derived retention planning.
- Added profile metadata phase transition rules.
- Added `plan_lifecycle_from_profile(...)`.
- Added `PhaseMemoryRuntime.plan_lifecycle_with_profile(...)`.
- Added CLI `graph lifecycle --profile`.
- Added local service runner support for profile-driven lifecycle planning.
- Added docs, README examples, and regression tests.
## T01 - Add lifecycle rule config
```task
id: PMEM-WP-0009-T01
status: done
priority: high
```
Derive retention, transition, refresh, and compaction rule settings from a
profile.
## T02 - Plan retention from profile rules
```task
id: PMEM-WP-0009-T02
status: done
priority: high
```
Support default retention rules and node-kind-specific retention rules.
## T03 - Plan phase transitions from profile metadata
```task
id: PMEM-WP-0009-T03
status: done
priority: medium
```
Support first-slice metadata transition rules with node kind, source phase,
target phase, minimum age, and review-gated transition actions.
## T04 - Wire runtime and CLI profile lifecycle planning
```task
id: PMEM-WP-0009-T04
status: done
priority: high
```
Expose profile-driven lifecycle planning through the runtime facade and CLI.
Include local service runner handling for the same contract.
## T05 - Document and test the rule path
```task
id: PMEM-WP-0009-T05
status: done
priority: medium
```
Add lifecycle rule docs, README examples, fixture coverage, transition rule
coverage, and CLI regression coverage.
## Acceptance Criteria
- Profile retention rules can produce lifecycle actions.
- Profile transition metadata can produce review-gated phase transitions.
- Refresh and compaction remain deliberate caller/profile inputs.
- Runtime and CLI envelopes expose the derived rule config.
- Tests cover fixture-derived rules and explicit transition rules.
## Closure Review - 2026-05-18
Closed after adding executable profile lifecycle rules, runtime/CLI support,
documentation, and deterministic regression tests.