Apache-2.0 · Python 3.10+ · zero runtime deps

The thin shared core of the Spine family.

corespine packs only the domain-neutral primitives — six seams plus a unified error shape — that belong to neither RAG nor agents. It is depended on by ragspine and spineagent but never the reverse; the core imports zero SDKs and runs fully offline.

Why corespine

Small, obviously stable primitives — shared, not reinvented.

Registry

name → factory resolution, plus entry-point discovery so packages extend a seam without touching core.

lazy_extra_import

Real backends live behind optional extras — a missing one becomes a friendly "pip install pkg[extra]".

InProcessPrivacyTraceSink

A trace sink that records codes / counts / timings only and rejects any payload carrying a body.

MockProvider

An offline, deterministic LLM in the OpenAI chat-completions shape — zero network, zero key, reproducible.

load_from_env

Reads PREFIX_* environment variables into a frozen dataclass by field type.

FakeQueue

A synchronous inline TaskQueue that runs jobs in place — failures captured into status, never raised.

ConformanceSuite × InvariantPack

Runs implementation × invariant as a cartesian product — a mechanism, with no business invariants baked in.

CorespineError / error_to_dict

A unified error shape with a stable, greppable code — any exception flattened to a serializable dict.

Architecture

Six seams, one meta-pattern.

Every seam wears the same shape, and that shape is the key to the whole library: Protocol + offline deterministic default + make_*/Registry factory + parameterized conformance.

01

Protocol

A structural interface only — the seam never imports an SDK.

02

Offline default

A zero-network, zero-key, reproducible implementation ships in core.

03

make_* / Registry

Choosing an implementation collapses to one spec string or factory call.

04

Parameterized conformance

One invariant set runs across every implementation of the seam.