coreason-human-layer
Domain: HITL, Durable Execution, & RLHF Data Capture Role: The "Switchboard" & "Labeling Factory"
coreason-human-layer is the dedicated bridge between autonomous execution and human oversight, operationalizing Online Alignment through a Multiverse Branching Strategy. Instead of a simple "Stop/Go" model, it allows humans to fork agent reality, capturing decisions as DPO Triplets to fuel the model improvement loop.
Features
1. The Stasis Engine (Durable Execution)
Implements an event-sourcing pattern for durable execution.
- Snapshot: Stores a pointer to the last event ID rather than a massive state blob.
- Rehydration: Replays events to rebuild context.
- Storage: Hot storage in Redis Streams, cold archival in S3.
2. The Branch Manager (Cognitive Forking)
Manages the tree topology of execution branches.
- Forking:
create_forkAPI allows instantiating new execution paths with human overrides. - Prefix Caching: Optimizes costs and latency by reusing the KV Cache of the shared prefix (
cached_prefix_id) on the LLM backend. - Topology: Exposes the conversation tree structure for visualization.
3. The Super-Prompt Injector (System Injection)
Ensures the model obeys human overrides.
- Frame Injection: Injects a high-priority
[SYSTEM PRIORITY INTERRUPT]block. - Variable Patching: Parses and hard-updates variables from human overrides (e.g., "Dose = 50mg").
4. The Learning Bridge (Auto-DPO)
Converts operational actions into training assets.
- Trigger: Merging a fork (approving it) while abandoning another.
- Auto-DPO: Automatically constructs a DPO object (
{ prompt, chosen, rejected }) and pushes it tocoreason-synthesis.
Server Mode (The Switchboard)
The library now includes a standalone microservice mode, exposing a REST API for managing branches and forks.
Deployment (Docker)
docker build -t coreason-human-layer .
docker run -p 8000:8000 \
-e REDIS_URL=redis://host.docker.internal:6379 \
-e SYNTHESIS_BASE_URL=http://host.docker.internal:8001 \
coreason-human-layer
Endpoints
POST /fork: Create a new execution branch.POST /merge: Merge two branches (triggers DPO signal).GET /topology/{root_id}: Get the branch tree structure.GET /health: Check service health.
Installation
pip install coreason-human-layer
Usage (Library)
See docs/usage.md for detailed usage examples including the REST API.
from uuid import uuid4
from coreason_human_layer.branch_manager import BranchManager
from coreason_human_layer.stasis import InMemoryStasisEngine
# Initialize engines
stasis = InMemoryStasisEngine()
manager = BranchManager(stasis_engine=stasis)
# Create a root branch
root_id = uuid4()
branch_id = manager.create_fork(
parent_branch_id=None,
parent_event_id=None,
root_id=root_id,
human_override_text="Initial Start",
user_context=... # UserContext object
)
License
Copyright (c) 2025 CoReason, Inc. Licensed under the Prosperity Public License 3.0.
Metadata
Release files for coreason-human-layer 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| coreason_human_layer-0.4.0.tar.gz | 17.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| coreason_human_layer-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.1 kB
Release files / coreason_human_layer-0.4.0.tar.gz
| Download URL | coreason_human_layer-0.4.0.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ff969410e2d9000d3d18fc9c2d9838bd5d67dba2b7c7fe0b040067b17abacad
|
|
BLAKE2b-256 checksum How to use checksums |
97af7ecd6cdc4d466a206b63d5fc48be682d4d8dc9214957b855759ef9f46205
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 31, 2026.
Transparency logRelease files / coreason_human_layer-0.4.0-py3-none-any.whl
| Download URL | coreason_human_layer-0.4.0-py3-none-any.whl |
|---|---|
| Size | 23.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d12b85bce803f7d5f34e61c8de2f87f275ac2cc8376c8a2af6943732bf2cba5
|
|
BLAKE2b-256 checksum How to use checksums |
cbc718bb334be4c9f6ecf5ddeb9cada180680f4f2b34a30a44d609aa10c8ba1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 31, 2026.
Transparency log