# 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. `RuntimeConfig.from_profile(...)` can derive this config from a Markitect-compatible memory profile. It reads explicit adapter declarations when present and also understands the first local store aliases used by the fixtures: - `local-graph-store` -> file-backed graph store - `local-event-log` -> JSONL event log - `markitect-context-package` -> local no-op package compiler boundary `resolve_runtime_adapters(config)` materializes the local adapter bundle. It supports: - in-memory or file-backed graph stores - in-memory or JSONL event logs - recording or JSONL audit sinks - no-op package compiler - disabled or in-memory semantic index - in-memory runtime registry External adapter modes are valid configuration values, but they must be supplied explicitly by the caller. The local resolver reports `missing_external_adapter` instead of silently replacing them. ## External Adapter Packs `phase_memory.external_adapters.fake_external_adapter_pack()` supplies a deterministic fake external pack for conformance and integration tests. It includes fake Markitect package compilation, Kontextual-shaped graph/event and runtime registry adapters, a fake semantic index, a fake policy gateway, and a fake telemetry audit sink. Use it with `fake_external_runtime_config()` and `resolve_runtime_adapters(config, external_adapters=pack.adapters)` to exercise the external wiring path without live services. ## 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 - semantic indexes - policy gateways - audit sinks - runtime registries 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