Metadata-Version: 2.4
Name: cognitive-runtime-core
Version: 1.0.0
Summary: 認知循環対話 — Cognitive Dialogue Runtime Foundation (Runtime Core).
Author: Runtime Foundation
License: MIT
Keywords: dialogue,cognitive-architecture,runtime,replay-deterministic
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Dynamic: license-file

# Cognitive Runtime Core — 認知循環対話 Runtime Foundation

A replay-deterministic cognitive dialogue runtime. The conversation loop is a single
`tick()` pipeline (`dialogue/dialogue_loop.py`) orchestrating ~30 cognitive stages
(observatory capture → phase interpretation → memory coupling → distortion →
language generation → residue/persistence), with every stage extracted to
`dialogue/tick_stages.py` behind a per-tick `TickState` carrier.

## Quick start

```bash
python main.py                 # interactive dialogue loop
python main.py --seed 42       # deterministic seed (reproducible run)
python main.py --debug         # per-tick cognitive-state snapshot
python main.py --legacy        # legacy DialogueManager pipeline (back-compat)
```

Runtime Core is **pure standard library** — no third-party runtime dependencies.
Requires Python ≥ 3.11.

## Install (optional)

```bash
pip install .                  # installs the Runtime Core packages + `cognitive-dialogue` entry point
pip install -e .[dev]          # editable + pytest for development
```

Packaging is **additive**: the source tree runs without installation (the test/replay
harness uses the repository root on `sys.path`), so installing changes no behaviour.

## Architecture — four import-separable layers

```
   Education (future)  ─┐  read-only until override-coordinator
   Extension           ─┤  audit_logs · observatory analyzers · dependency_mapper
        │ imports        │  (imports runtime_core.api; never imported by Core)
        ▼                │
   ┌─────────────────────▼─────────────────────┐
   │              RUNTIME CORE                   │  ◄── Research (research/)
   │  dialogue/ · core/ · memory/ ·             │      reaches Core only via
   │  runtime_core/{commitment,continuity_…} ·  │      degrade-to-False guards
   │  observatory/ (live) + cognitive subsystems│
   └────────────────────────────────────────────┘
```

Legal dependency direction: **Education → Extension → Core ← Research**. The boundary
is an *import-direction invariant* enforced at every commit by
`tests/runtime/test_import_graph_boundary.py` (7 tests), independent of file location.

- **Runtime Core** runs standalone. `research/` is a *path directory* (no `__init__.py`):
  a ship-core checkout omits it and the ~53 guarded research imports degrade to
  `_AVAILABLE = False` — a proven byte-identical degraded mode (`main.py` / `conftest.py`
  add `research/` to `sys.path` only when present).
- **Public API:** Extension and Education depend on `runtime_core/api/` (a 29-name thin
  re-export), never on Core private symbols.

## Replay contract (absolute invariant)

The runtime is byte-for-byte reproducible. Any change must preserve:

```bash
python audit_logs/tierc_replay_tuple.py --check    # tuple a31522d2… / output e3b1df88…
python audit_logs/tierc_baseline.py --replay       # ON  → e3b1df88
# (14 TIERC_*_DISABLE=1 then --replay)              # OFF → 43638b02
```

## Gates

```bash
pytest tests dialogue/tests runtime_core            # core gate  → 2459 passed
pytest tests/ecology_observatory                    # observatory → 74 passed
pytest tests/runtime/test_import_graph_boundary.py  # boundary    → 7 passed
```

## Repository layout

| Path | Role |
|---|---|
| `dialogue/`, `core/`, `memory/`, `runtime_core/`, `observatory/` + cognitive subsystems | Runtime Core |
| `audit_logs/`, `dependency_mapper/`, `pacing/`, `calibration/` | Runtime Extension (evaluators / observability) |
| `research/` | Research module (path-dir seam; detachable) |
| `education/` | Education module (greenfield scaffold; future phase) |
| `governance/` | Phase docs, RUNBOOK, packaging records, archived investigations |
| `scripts/` | Ad-hoc investigation/measurement scripts (not part of the runtime) |
| `tests/` | Test suite (`pytest.ini` `testpaths = tests`) |
| `main.py` | Entry point |

See `governance/packaging/` for the packaging phase records and
`governance/thin_orchestrator/RUNBOOK.md` for the de-monolith STOP-LINE contract.

## Research archive

This project is research-grade: its design rationale, audits, and investigations are
kept (not deleted) under `governance/` so the runtime root stays minimal.

| Path | Contents |
|---|---|
| `governance/research/` | Conversation-pathology atlas, taxonomy, and review records |
| `governance/archive/investigations/` | Archived investigations, design notes, and audits (e.g. detachment, coherence, growth/forgetting evaluations) |
| `governance/packaging/` | Packaging phase records (`00`–`14`) and equivalence reports |
| `governance/handover/` | Session handover docs and policy |
| `governance/doctrine/`, `governance/current_status/` | Standing doctrine and current-status snapshots |

These are reference material for understanding *why* the runtime is shaped as it is;
none of it is required to run or install Runtime Core.

## License

Released under the [MIT License](LICENSE).
