# CPLOM memory architecture — conceptual reference examples

Companion to *From Control to Memory: CPLOM as an Architecture for Long-Term
Context Organization*, Dmitry Chistyakov, 2026-09-19.

These newly written educational examples are not production CPLOM, Adamant,
or extracted proprietary code. All records and outcomes are synthetic.
Python 3.10 or later; standard library only. No installation, credentials,
network calls, external models, shell execution, or data writes are required.
Python may create its normal __pycache__ files; use `python -B` to avoid them.

## Run

Extract the ZIP, open its folder, and run:

```text
python -B memory_index.py
python -B routing.py
python -B parallel_relevance.py
python -B iterative_retrieval.py
python -B -m unittest -v test_reference
```

Keep all five Python files together: later examples import earlier ones.

## What each example demonstrates

1. `memory_index.py`: immutable memory records, source references, time,
   confidence annotations, contradiction links and a hierarchical index.
   An in-memory tree represents index structure; payloads are also in RAM in
   this tiny example. A real store would load payloads lazily by reference.
2. `routing.py`: descend branches using aggregate tags; score object metadata.
   Exact tag matching deliberately misses the security record on the first
   query. It cannot match synonyms or rescue a missing parent tag. Production
   designs need semantic routing, alternative paths and recall evaluation.
3. `parallel_relevance.py`: a fixed asynchronous worker pool, per-operation
   timeout, visible failures, deterministic result ordering. Default workers:
   4. The allowed maximum of 500 illustrates a bound; it does not reproduce
   CPLOM throughput. Lexical scoring has no CPU speedup from asyncio. Remote
   calls need additional rate limits, backpressure and request-wide budgets.
4. `iterative_retrieval.py`: a preliminary launch hypothesis leads to searches
   for approval and exceptions. New security and policy evidence changes the
   conclusion. Hypotheses never enter the source store. The analyst uses
   explicit rules for this one case, not LLM reasoning or semantic entailment.
   The contradiction link means the review challenges an unconditional reading
   of the plan; a conditional plan and a later blocker can both be true.
5. `test_reference.py`: checks routing, bounded concurrency, visible failures,
   timeout semantics, evidence-driven refinement, empty-evidence behavior,
   and explicit incomplete status when a round budget or missing evidence
   prevents the pending searches from resolving.

Expected refinement: round 1 says `launch planned`; round 2 says
`launch blocked by unresolved security review`, citing four source IDs.
Trace entries label preliminary conclusions as `provisional` and retain
`pending_queries`. A round limit or no new evidence produces an explicit
`stop_reason`; neither makes a provisional conclusion an authorized decision.

## Boundaries

Relevance is lexical overlap, not truth. Confidence is a synthetic annotation,
not a calibrated probability. The examples do not implement persistent storage,
access control, distributed scheduling, a tokenizer-based context budget,
model-based reasoning, calibrated adjudication, consolidation or deletion.
They illustrate interfaces and control flow, not measured system performance.
The article describes these broader requirements separately.
