Project Context Runtime
Shared library providing the durable identity, producer-result, semantic-index
reference, and deterministic manifest records used by every project-context
refresh caller (architecture refresh, the refresh orchestrator, branch-local
checkpoints, and main convergence).
This is an infrastructure skill — not user-invocable. Import from
<skill-base-dir>/scripts/ after resolving this loaded skill directory, or add
scripts/ to sys.path and import the bare module names.
What it owns
scripts/models.py — strict, versioned dataclasses, enums, typed
fail-closed exceptions, deterministic operation-identity derivation, and
offline JSON-Schema validation.
scripts/atomic.py — crash-safe atomic JSON writes (same-directory temp file,
fsync, atomic replace, parent fsync) and cross-process advisory file locking.
Private runtime-core; not part of the supported facade.
scripts/store.py — the OperationStore, a Git-common-dir–backed durable
ledger with per-operation locking and a validated state machine.
scripts/manifest.py — deterministic, byte-stable manifest projection and an
atomic committable writer.
install_assets/openspec/schemas/*.schema.json — the three versioned Draft
2020-12 contracts (types, operation, manifest).
Supported facade
from scripts import (
OperationStore, # durable create/resume/transition
write_manifest, # deterministic committable projection
OperationRecord, RefreshManifest, ProducerResult,
derive_operation_id,
)
Boundaries
- Records are durable per clone: the store shares state across linked
worktrees and later processes, not across machines.
- The mutable
operation.json ledger is never committed; only the deterministic
manifest projection is a repository artifact.
- Unknown schema versions, malformed records, unsafe paths, duplicate producer
identities, and illegal transitions fail closed and are never coerced into a
fresh-looking record.
- Semantic-index state is an opaque external reference; any status other than
succeeded (with indexed_revision == requested_revision) requires an
explicit fallback.
See docs/project-context-refresh.md for the full consumer contract.
1---2name: project-context-runtime3description: "Durable, versioned identity, producer-result, and manifest records for project-context refresh callers"4category: Infrastructure5tags: [project-context, refresh, runtime, shared-library]6---78# Project Context Runtime910Shared library providing the durable identity, producer-result, semantic-index11reference, and deterministic manifest records used by every project-context12refresh caller (architecture refresh, the refresh orchestrator, branch-local13checkpoints, and main convergence).1415This is an infrastructure skill — not user-invocable. Import from16`<skill-base-dir>/scripts/` after resolving this loaded skill directory, or add17`scripts/` to `sys.path` and import the bare module names.1819## What it owns2021- `scripts/models.py` — strict, versioned dataclasses, enums, typed22 fail-closed exceptions, deterministic operation-identity derivation, and23 offline JSON-Schema validation.24- `scripts/atomic.py` — crash-safe atomic JSON writes (same-directory temp file,25 fsync, atomic replace, parent fsync) and cross-process advisory file locking.26 Private runtime-core; not part of the supported facade.27- `scripts/store.py` — the `OperationStore`, a Git-common-dir–backed durable28 ledger with per-operation locking and a validated state machine.29- `scripts/manifest.py` — deterministic, byte-stable manifest projection and an30 atomic committable writer.31- `install_assets/openspec/schemas/*.schema.json` — the three versioned Draft32 2020-12 contracts (types, operation, manifest).3334## Supported facade3536```python37from scripts import (38 OperationStore, # durable create/resume/transition39 write_manifest, # deterministic committable projection40 OperationRecord, RefreshManifest, ProducerResult,41 derive_operation_id,42)43```4445## Boundaries4647- Records are durable per **clone**: the store shares state across linked48 worktrees and later processes, not across machines.49- The mutable `operation.json` ledger is never committed; only the deterministic50 manifest projection is a repository artifact.51- Unknown schema versions, malformed records, unsafe paths, duplicate producer52 identities, and illegal transitions fail closed and are never coerced into a53 fresh-looking record.54- Semantic-index state is an opaque external reference; any status other than55 `succeeded` (with `indexed_revision == requested_revision`) requires an56 explicit fallback.5758See `docs/project-context-refresh.md` for the full consumer contract.