memdate — file-based memory with a hard CAPTURE/DISTILL split
Plain Markdown memory for people or agents. One load-bearing invariant:
CAPTURE preserves. DISTILL interprets. Never mix them.
- CAPTURE appends timestamped raw records. No summarizing, no synthesis, no editing yesterday's entries. Raw is the permanent record.
- DISTILL consolidates raw into
distilled.md— and the library checksums raw before and after, voiding the run if anything touched it. - INDEX regenerates the cross-domain connective tissue (entities→domains, dependencies, open questions, hot zones) after any multi-domain distill. Derived, never authoritative over raw.
No prerequisites. You don't need to know anything about the project's history. The mechanism is the whole product.
(Lineage: front-facing conversion of the memdate-v2 skill from Ryan's
skill-suite, MIT. What changed is documented in CHANGELOG.md — the
decoupling record.)
What it does
A memory store is a directory:
<root>/
├── INDEX-cross-domain.md ← regenerated after multi-domain distills
├── PINNED.md ← derived pin list (v2; PINNED-log.md is the record)
├── PINNED-log.md ← append-only pin/unpin log (v2)
├── EVIDENCE.md ← append-only reconfirmation log (v2)
├── KIND-log.md ← append-only kind-set/defer log (v2)
├── RESTORE-log.md ← append-only restore log (v2)
├── APPLIED.md ← append-only dream-apply receipts (v2)
├── archive/<domain>/ ← archived facts, one file each (v2)
├── DROP/ ← ingestion: NEW / PROCESSED / PENDING / QUARANTINE
├── personal/
│ ├── raw.md ← append-only evidence log
│ └── distilled.md ← derived synthesis + provenance frontmatter
└── work/
├── raw.md
└── distilled.md
The domain list is configuration, not identity. This package ships with
neutral defaults (personal, work, projects, reference, misc) —
define your own via constructor, JSON, or YAML. Storage is a
StorageAdapter: the local filesystem by default, Google Drive as an
optional seam you can implement (it fails loudly until you do, instead of
pretending to work).
Why it works
Most memory systems rot because recording and interpreting happen in the same motion: you write down what happened and what it means, and a month later you can't tell which was which. The split is enforced in code, not just in prose:
- Capture isolation —
capture()only appends; it has no code path that edits prior entries (tested: old content is always a strict prefix of new content). Entry text is scanned for interpretation markers ("in summary", "overall,", … — configurable); a hit raises unless you passforce=True, and then the bypass is stamped into the entry header. The exception is visible, never silent. - Distill isolation —
distill()checksumsraw.mdbefore writingdistilled.mdand re-checks after. If raw changed mid-run, the run is void. A test adapter that sabotages raw mid-distill proves the check fires. - Index discipline — the four required sections and the 7-step regeneration procedure are code. Single-domain distills skip the index with a recorded reason. The verify pass asserts no orphan entities and no sourceless questions.
- Raw wins conflicts — stated in the docs, enforced by the architecture: nothing in the distill path can write to raw.
Dreaming memory (v2)
Version 2.0.0 adds the dreaming cycle on top of the capture/distill
split. The design lives in DESIGN-dreaming-memory.md; what follows
is what the code actually does. The dream pass, pin list, migration
tool, and evidence logs have no CLI commands — they are library calls.
Provenance (P1). Every capture is stamped with where it came
from: SAID (text the operator typed himself, in his own words),
PASTED, or OBSERVED (the default — nothing promotes by accident).
capture(..., provenance="SAID") stamps the header
— provenance: SAID; unknown values are refused. sweep_new()
defaults to PASTED — drop files arrive from anywhere, so the sweep
must not claim SAID.
A standing-rule line in a distilled body must carry a citation,
cites: <domain>@<timestamp>#<digest-short>, and distill() lints
every citation with verify_promotion() before writing anything: a
forged citation (digest mismatch), a citation to a missing capture,
or a citation to a PASTED/OBSERVED entry refuses the run. A valid
SAID citation passes. A body with no citations passes vacuously —
the lint verifies citations that are present; it cannot detect a
standing-rule line carrying no citation at all, since distill()
takes an opaque body string.
Kinds and tiered decay. Each fact carries one of four exact
kinds — event (one-shot), state (live), standing (never
decays), unknown — via capture(..., kind="event"). Anything else
raises KindError; there is no coercion and no case-folding. A body
carrying two or more distinct ISO dates or sub-bullet lines must name
its sub-fact (sub_fact=...) or the capture raises
CompositeKindError.
Decay runs on reconfirmation, recorded in EVIDENCE.md:
capture(..., confirms=<digest>, strength="STRONG") restates a fact
and resets its clock; strength is required whenever confirms is
passed, and there is no default strength — a weak sighting is
recorded but does not reset the clock. record_evidence(),
set_kind() / defer_kind(), supersede(), and restore() are the
operator's tools for kind passes, supersession chains, and bringing
an archived fact back; every one appends to its log (KIND-log.md,
RESTORE-log.md).
Adopted numbers (measured from the legacy corpus in step 0, ruled by
the operator): line_budget = 250 lines per domain block;
decay_days_state = 30 days for live-state facts; unknown_clock = "never" — an unclassified fact never archives by default, and the
state-clock treatment of unknowns is an explicit per-store opt-in
that requires a kind-pass-complete receipt first. The one-shot
event clock is not set: until a re-run measurement earns it its
own number, event facts age on the state clock, labeled
state (interim) in every proposal it touches.
The pin list (P2). pin(cfg, domain, digest, reason) marks a
fact as never decaying; unpin() hands it back to the normal tier
rules. A reason is required — a pin with no reason is unauditable
and is refused. Pin history is the append-only PINNED-log.md
(clock stamp, digest, operator, reason); PINNED.md is the derived
current list, regenerated from the log. The pin list holds memory
(facts that must never decay). Hard lines — a spend cap, a
never-send rule — are gates, not memory, and do not go in it.
Dream and apply (P3). dream(cfg, output_path) reads raw +
distilled + PINNED and writes a proposal to a caller-supplied path
outside the store root — the store tree is byte-identical after
the run. The proposal lists the budget per domain, the cuts (with
digests, clocks, and archive destinations), spotted evidence,
unclassified facts, kind-review items, and held facts. The cuts are
applied by the next distill() call, which takes the proposal
digest as an explicit argument: distill(..., apply_proposal=<digest>, proposal_path=<path>). The parameter defaults to None — no digest,
no apply — so old call shapes keep working. The apply is verified
whole before the first write (unknown proposal, re-apply, failed
evidence citation, missing cut fact, or existing archive target
refuses the whole run and writes nothing), then archives the cut
facts to archive/<domain>/<timestamp>-<digest>.md, appends the
evidence records, records the digest in the distilled frontmatter
(applied_dream: <digest>), and appends one line to APPLIED.md.
A re-apply is refused — the receipt is already on record. Nothing is
deleted from disk by any operation: "prune" means "leave the live
block", never "destroy".
Migration and import mode (P6). migrate_legacy(cfg, legacy_root, classify=...) imports a legacy corpus — MEMORY.md and the daily
logs, line for line — with a manifest covering every imported entry
(digest + source file + line number). High-stakes lines (money, hard
lines, facts about people) are tagged first in the manifest; the
remainder follows in the same run. It refuses to run unless the
config carries exactly the ruled domain set, unless a classify
mapping is supplied, and if a manifest already exists (one-time —
never run twice over the same store). capture(..., import_mode=True, original_timestamp=<date>) stamps the original
date as data (imported, original: <date>) and bypasses the
interpretation-marker scan by design, with the bypass stamped in the
header. freeze_legacy() sets the legacy file read-only after a
migration (mode verified) and deletes the reconciler's write path,
not pauses it. Bank content imports as distilled
bodies with provenance OBSERVED; memory/people/ and
memory/groups/ stay as they are and are named as entities in
distill frontmatter.
Clock discipline (P4). Every stamp comes from the clock: the
today override is removed from distill() and
regenerate_index() (a call passing it is refused), and distilled
and index frontmatter carry date_source: clock. The CLI capture
command takes no date argument. The import mode is the only
historical-stamping path and is unaffected.
Heretic policy (P5). Deployment policy, not a library feature —
see HERETIC-POLICY.md and the section below.
One honest boundary, stated in the design: the library cannot verify a human tap. What it guarantees by construction is (a) no implicit application — nothing applies a dream proposal unless the operator explicitly passes its digest; (b) every application is receipted in an append-only log; (c) the proposal file is the only input to an application. The guarantee that a background process never applies is procedural — the operator's command is the only caller that receives the apply argument — and the design says so instead of claiming a mechanism that does not exist.
Version note: the protocol stamps on v2 artifacts read
memdate/2.0.0 (PROTOCOL_VERSION, PINNED_PROTOCOL) — the version
bump to 2.0.0 landed with the release cut. The stamps are
consistent and the readers only require the field be present.
Quickstart
Zero dependencies beyond Python 3.10+.
pip install memdate
memdate --root /tmp/memo init
memdate --root /tmp/memo capture \
--domain work --text "Acme Corp emailed: contract renews March 1." --source email
memdate --root /tmp/memo capture \
--domain work --text "In summary, the deal is safe."
# InterpretationError: Entry looks like interpretation, not capture —
# markers found: in summary. Rewrite as raw record, or pass force=True
# to record the bypass explicitly.
memdate --root /tmp/memo capture \
--domain personal --text "Priya confirmed she handles the paperwork."
Distill from files holding your consolidated synthesis — write the two bodies first, then distill each domain, then regenerate the index (it needs at least two distilled domains):
printf 'Acme Corp: contract renews March 1.\n' > /tmp/work-distilled.md
printf 'Priya handles the paperwork.\n' > /tmp/personal-distilled.md
memdate --root /tmp/memo distill --domain work \
--file /tmp/work-distilled.md \
--entities "Acme Corp,Priya" --informs personal \
--questions "Does the freeze delay the paperwork?"
memdate --root /tmp/memo distill --domain personal \
--file /tmp/personal-distilled.md \
--entities "Priya" --informs work
memdate --root /tmp/memo index --touched work,personal
From a repo checkout the same commands run as python -m memdate
(with PYTHONPATH=src), and the suite runs offline:
cd memdate
PYTHONPATH=src python3 -m unittest discover -s tests # 198 offline tests
Or use it as a library:
from memdate import (
MemoryConfig, default_adapter, ensure_layout,
capture, distill, regenerate_index,
)
cfg = MemoryConfig(root="/tmp/memo", domains=("garden", "car"))
store = default_adapter(cfg.root)
ensure_layout(cfg, adapter=store)
capture(cfg, "garden", "Planted tomatoes, north bed.", adapter=store)
distill(cfg, "garden", "North bed: tomatoes planted.",
entities=["north bed"], lifecycle="ITERATIVE", adapter=store)
Drop a file in DROP/NEW/ with a leading domain: <name> line and
sweep routes it — captured to the right domain's raw, or quarantined
with a reason file if it's unroutable or reads like synthesis:
printf 'domain: work\n\nFixed the flaky test.\n' > /tmp/memo/DROP/NEW/note.md
memdate --root /tmp/memo sweep
Inputs, outputs
- Input (capture): domain, text, optional source. Output: timestamped
entry appended to
<domain>/raw.md. - Input (distill): domain, consolidated body, optional entities /
entity notes / informs / open questions / lifecycle. Output:
<domain>/distilled.mdwith provenance frontmatter. - Input (index): list of domains the distill touched. Output:
INDEX-cross-domain.md, or a recorded skip for single-domain distills. - Input (dream, v2): nothing but the store and a caller-supplied
output path outside the store root. Output: a proposal file
(budget / cuts / evidence / unclassified / kind-review / held) with
a
proposal_digest; the store tree is unchanged. - Input (distill with proposal, v2): a proposal digest plus the
proposal file path. Output: the cut facts archived under
archive/<domain>/, the digest recorded in the distilled frontmatter (applied_dream) and one line inAPPLIED.md; a re-apply is refused. - Input (pin / unpin, v2): domain, fact digest, reason. Output:
a line in
PINNED-log.mdand a regeneratedPINNED.md. - Input (migrate_legacy, v2): a legacy root holding
MEMORY.mdand amemory/subtree, plus aclassifymapping. Output: the imported store plus a manifest covering every imported entry (digest + source file + line number).
Distilled body conventions
Two line-prefixes the index understands:
?— uncertainty flag → collected into Hot Zones.!— explicit raw↔distilled divergence note → collected into Hot Zones.
Entity note contradictions across domains (work says "reliable", personal
says "misses deadlines") also land in Hot Zones as [tension] entries.
Evidence-taxonomy mapping
This package shares a vocabulary with the adversarial-ifs evidence
taxonomy (ten tiers). The mapping is explicit — memdate doesn't tag
evidence itself, but its artifacts sit at defined tiers:
| memdate artifact | IFS tier | Why |
|---|---|---|
raw.md entry (logged event) |
OBSERVATION |
Reported/logged, not independently verified |
raw.md entry (someone's assertion) |
CLAIM |
Explicit assertion by a source |
distilled.md synthesis |
INFERENCE |
Conclusion drawn from raw evidence |
distilled.md ? flags, index open questions |
UNKNOWN |
Flagged as not presently determinable |
| distiller-verified fact | FACT |
Directly established ground truth |
| provisional model in a distillation | HYPOTHESIS |
Needs stress-testing before use |
No code dependency between the packages — the table is the contract, so neither taxonomy can silently fork.
Worked example
examples/example-1-two-domains.md — a full CAPTURE → DISTILL → INDEX
cycle on two neutral domains, with the actual file contents shown at
each step.
examples/example-2-dreaming-cycle.md — a full CAPTURE → DREAM →
DISTILL-with-proposal → INDEX cycle: a cut, a held fact, an
unclassified fact, a pin, and a refused re-apply, with the actual
file contents shown at each step. The code blocks run as written
against a scratch store and reproduce the quoted outputs exactly,
except the distilled and index frontmatter dates, which come from
the clock at run time.
The field is constructed for teaching — it shows the mechanism's shape, not real findings.
Heretic policy
HERETIC-POLICY.md — deployment policy for Ostral's own memdate
store: operator-only capture, read-before-you-describe as a harness
wall, obedience and trust pinned, and the trust boundary stated
honestly. Policy, not library mechanism.
FAQ
Where's Google Drive? The original skill lived in a Drive folder.
This package defaults to the local filesystem; GoogleDriveAdapter
documents the seam and raises DriveNotConfigured with setup pointers
until you implement it. Drive is an adapter, not the root.
Can a model do the distilling? Yes — that's the intended shape. The model supplies the consolidated body; the library stamps provenance and enforces that raw wasn't touched. The library never calls a model itself.
Does capture need the index? No. Capture works from the first entry; distill works per-domain; the index appears once two domains are distilled.
What about the memory interviewer? The guided-capture interviewer
(meminqu) builds on this library's capture contract — it converts next
and shares this package's domain config.
License
MIT. See LICENSE.
Metadata
Release files for memdate 2.0.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 | Provenance | Actions |
|---|---|---|---|---|
| memdate-2.0.0.tar.gz | 110.6 kB | With provenance | Details for memdate-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| memdate-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for memdate-2.0.0-py3-none-any.whl |
Total release size: 189.8 kB
Release files / memdate-2.0.0.tar.gz
| Download URL | memdate-2.0.0.tar.gz |
|---|---|
| Size | 110.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
932143a7540ec8240f931ad7035a3d59c8162577a43143b2aaf193dbb35037ee
|
|
BLAKE2b-256 checksum How to use checksums |
621ae4373c83e6d8ab866b78de466135832af75f36fed447fb8731a63f2d785b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 29, 2026.
Transparency logRelease files / memdate-2.0.0-py3-none-any.whl
| Download URL | memdate-2.0.0-py3-none-any.whl |
|---|---|
| Size | 79.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d860d8305faef608fd061f03f608f031cfca2e69bf6ec9337ebafcd8ad88c27f
|
|
BLAKE2b-256 checksum How to use checksums |
a5d8a5828c217fc112ebb4b2edda54de65d77cb04a532c8376cc76ae86626db1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 29, 2026.
Transparency logSecurity for memdate 2.0.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for memdate-2.0.0.tar.gz
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 Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.