Add service readiness contracts

This commit is contained in:
2026-05-18 20:33:45 +02:00
parent 1efb7d4c13
commit 2a4301d22f
7 changed files with 437 additions and 20 deletions

82
docs/service-readiness.md Normal file
View File

@@ -0,0 +1,82 @@
# Service Readiness
`phase-memory` remains local-first, but it now exposes service-readiness
contracts that can be used by an embedded runtime, a lightweight service, or
external adapters.
## Service Contracts
`phase_memory.service.service_contracts()` returns the first service contract
catalog:
- `profile.plan`
- `graph.import`
- `graph.lifecycle.plan`
- `lifecycle.apply`
- `graph.activation.plan`
- `package.compile`
- `audit.query`
- `health.check`
These contracts describe request fields and response classes. They are not a
web framework binding.
## Runtime Config
`RuntimeConfig` captures:
- local store path
- adapter registry
- policy mode
- audit sink mode
- package compiler mode
- semantic index mode
- dry-run default
- trust-zone labels
The default config is local and dependency-light.
## Health
`health_report` emits:
- adapter classes
- config
- node counts
- stale memory counts
- pending review counts
- config diagnostics
The schema is `phase_memory.health.report.v1`.
## Adapter Conformance
The service module includes reusable conformance helpers for:
- graph stores
- event logs
- context package compilers
- policy gateways
- audit sinks
External adapters should pass these helpers before being wired into a runtime.
## Kontextual Delegation
The first delegation envelope keeps ownership explicit:
- `phase-memory` owns phase policy, lifecycle planning, and activation
planning.
- `kontextual-engine` owns durable records, permission-aware retrieval, and
long-lived storage.
- Boundaries exchange JSON envelopes to avoid circular imports.
## Deployment Modes
Supported modes:
- pure library
- CLI over local files
- embedded runtime
- optional service runner
- adapter layer over external stores