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 callers4---56# Project Context Runtime78Shared library providing the durable identity, producer-result, semantic-index9reference, and deterministic manifest records used by every project-context10refresh caller (architecture refresh, the refresh orchestrator, branch-local11checkpoints, and main convergence).1213This is an infrastructure skill — not user-invocable. Import from14`<skill-base-dir>/scripts/` after resolving this loaded skill directory, or add15`scripts/` to `sys.path` and import the bare module names.1617## What it owns1819- `scripts/models.py` — strict, versioned dataclasses, enums, typed20 fail-closed exceptions, deterministic operation-identity derivation, and21 offline JSON-Schema validation.22- `scripts/atomic.py` — crash-safe atomic JSON writes (same-directory temp file,23 fsync, atomic replace, parent fsync) and cross-process advisory file locking.24 Private runtime-core; not part of the supported facade.25- `scripts/store.py` — the `OperationStore`, a Git-common-dir–backed durable26 ledger with per-operation locking and a validated state machine.27- `scripts/manifest.py` — deterministic, byte-stable manifest projection and an28 atomic committable writer.29- `install_assets/openspec/schemas/*.schema.json` — the three versioned Draft30 2020-12 contracts (types, operation, manifest).3132## Supported facade3334```python35from scripts import (36 OperationStore, # durable create/resume/transition37 write_manifest, # deterministic committable projection38 OperationRecord, RefreshManifest, ProducerResult,39 derive_operation_id,40)41```4243## Boundaries4445- Records are durable per **clone**: the store shares state across linked46 worktrees and later processes, not across machines.47- The mutable `operation.json` ledger is never committed; only the deterministic48 manifest projection is a repository artifact.49- Unknown schema versions, malformed records, unsafe paths, duplicate producer50 identities, and illegal transitions fail closed and are never coerced into a51 fresh-looking record.52- Semantic-index state is an opaque external reference; any status other than53 `succeeded` (with `indexed_revision == requested_revision`) requires an54 explicit fallback.5556See `docs/project-context-refresh.md` for the full consumer contract.