Implement local runtime persistence and policy gates

This commit is contained in:
2026-05-18 18:21:27 +02:00
parent 7f9913c45a
commit 8089a7c8fa
23 changed files with 2263 additions and 42 deletions

View File

@@ -4,7 +4,7 @@ type: workplan
title: "Local Runtime Facade And CLI"
domain: markitect
repo: phase-memory
status: proposed
status: finished
owner: phase-memory
topic_slug: local-runtime
planning_priority: P1
@@ -50,11 +50,34 @@ together and there is no command-line path for inspecting plans.
- Do not start a long-lived HTTP service in this workplan.
- Do not add live LLM, vector, or graph database dependencies.
## Implementation Update - 2026-05-18
The local runtime and CLI slice is complete.
Implemented outputs:
- `src/phase_memory/runtime.py` defines `PhaseMemoryRuntime` with stable
runtime envelopes for profile import, graph import, profile planning,
lifecycle planning, activation planning, and package compilation handoff.
- `src/phase_memory/cli.py` adds dependency-light `argparse` commands for
profile planning, graph lifecycle planning, and graph activation planning.
- `pyproject.toml` exposes the installed console script as `phase-memory`.
- Runtime and CLI tests cover JSON envelopes, dry-run lifecycle actions,
package requests, summary output, and console-script metadata.
- Snapshot fixtures pin the public profile-plan and activation-plan envelope
shape without freezing internal dataclass details.
- `README.md` and `docs/architecture.md` document local usage, the facade
boundary, dry-run guarantees, and adjacent-repo expectations.
Validation:
- `python3 -m pytest` -> 23 passed.
## T01 - Add a local runtime facade
```task
id: PMEM-WP-0002-T01
status: todo
status: done
priority: high
state_hub_task_id: "456557a9-3ac3-483b-bbdd-5591224894b9"
```
@@ -78,7 +101,7 @@ usable, but gives integrations one obvious local entrypoint.
```task
id: PMEM-WP-0002-T02
status: todo
status: done
priority: high
state_hub_task_id: "b04054cb-d743-4fcd-9b37-2685d1f9c00d"
```
@@ -100,7 +123,7 @@ ids, dry-run flags, and source contract references.
```task
id: PMEM-WP-0002-T03
status: todo
status: done
priority: high
state_hub_task_id: "8463924e-a6ce-43f1-b7fc-544a2aa7fd5f"
```
@@ -120,7 +143,7 @@ Output: CLI command, tests around success and diagnostics, and README usage.
```task
id: PMEM-WP-0002-T04
status: todo
status: done
priority: high
state_hub_task_id: "ab818835-5ef3-4a43-adf2-444ab712ead9"
```
@@ -142,7 +165,7 @@ refresh, and compaction proposals.
```task
id: PMEM-WP-0002-T05
status: todo
status: done
priority: medium
state_hub_task_id: "9c8e8511-f00a-4685-91b5-a52c93d8461d"
```
@@ -161,7 +184,7 @@ Output: activation command, deterministic output tests, and README usage.
```task
id: PMEM-WP-0002-T06
status: todo
status: done
priority: medium
state_hub_task_id: "a005aa31-053e-4b51-b3ea-3bebf24ac833"
```
@@ -176,7 +199,7 @@ Output: stable examples for downstream repos and future compatibility checks.
```task
id: PMEM-WP-0002-T07
status: todo
status: done
priority: medium
state_hub_task_id: "f6c6c6b2-141a-44da-a3d5-dbef95559049"
```
@@ -200,3 +223,26 @@ five minutes.
the CLI against existing fixtures.
- Runtime outputs are deterministic and JSON-serializable.
- No default path mutates durable memory stores.
## Closure Review - 2026-05-18
**Outcome:** All tasks completed.
### Completed
- PMEM-WP-0002-T01 - Add a local runtime facade
- PMEM-WP-0002-T02 - Define runtime input and output envelopes
- PMEM-WP-0002-T03 - Implement profile planning CLI
- PMEM-WP-0002-T04 - Implement graph lifecycle CLI
- PMEM-WP-0002-T05 - Implement activation CLI
- PMEM-WP-0002-T06 - Add snapshot tests for CLI and runtime envelopes
- PMEM-WP-0002-T07 - Update documentation for local usage
### Cancelled
None.
### Carried Forward
Local persistence, review-gated apply behavior, richer policy enforcement, and
external adapter readiness remain in PMEM-WP-0003 through PMEM-WP-0007.