Engine documentation

404-in-a-box

Engine protocol and working reference.

File in, memory out. A complete, empty, persistent memory brain for an AI companion or a company assistant. You fill it with YOUR data; it ships with none.

The promise: your AI stops forgetting. Facts survive sessions. Search finds what was actually said, with the source. The distilled core lands at the start of every session, so a fresh instance already knows you instead of asking you to explain everything again.

Requirements: Python 3 (standard library only, no pip) and bash. One SQLite file, no server, no cloud dependency, nothing leaves your machine.

The five layers

Layer Files What it does
1. Ingest + search ingest.py, ask.py everything in input/ becomes a searchable brain (data/brain.db, SQLite FTS5)
2. Canon generate_canon.py, CANON/ distills the essence + the why into CANON/KERN.md, regenerable without destroying manual work
3. Memory files remember.py, memory/ single facts that must never be forgotten, with an index
4. Archivers archivers/ a timer/cron pulls new input in automatically
5. Session start + behavior session-start/ injects the core at second zero of every session; a behavior catcher keeps the assistant on its rules

Quickstart (ten minutes)

  1. Drop your raw material into input/: chat transcripts, exports, notes, docs (.md, .txt, .json). Subfolders are fine.

  2. Build the brain:

     python3 ingest.py
  3. Try it:

     python3 ask.py "something you know was said"
  4. Distill the core:

     python3 generate_canon.py

    That writes CANON/KERN.md (offline structured extract) and CANON/LLM-PROMPT.md. For a much better core: feed LLM-PROMPT.md to any LLM you use, save the answer, then python3 generate_canon.py --from-file answer.md. Add your own notes between the <!-- HAND --> markers in KERN.md; they survive every regeneration.

  5. Store your first fact:

     python3 remember.py "my preference" "the thing to never forget"
  6. Automate intake:

     bash archivers/install.sh
  7. Wire up session start so every fresh session lands with the brain attached: see session-start/README.md. That step is what turns a search tool into something that remembers you.

Want a dry run first? Copy examples/sample-input/ into input/ and walk the same steps with the dummy data, then delete data/brain.db and start clean with your own.

Companion use

Goal: a personal AI that is not allowed to forget itself or you. Feed it your chat history (layer 1), distill who it is and what it knows into KERN.md (layer 2), store running facts with remember.py (layer 3), keep new conversations flowing in automatically (layer 4), and inject the whole thing at session start with a behavior catcher guarding the persona (layer 5).

Company use

Goal: knowledge that stops leaking away. Feed it meeting notes, support threads, decision docs. KERN.md becomes the onboarding core every AI session (or new hire) starts from; ask.py answers "what did we decide and where does it say so" with sources; remember.py captures decisions the moment they happen.

Layout

404-in-a-box/
├── README.md            you are here
├── FIMO-RUN.md          build notes + the test run that proves it works
├── fimo_core.py         shared core: paths, schema, search helpers
├── ingest.py            layer 1: input/ -> data/brain.db (idempotent)
├── ask.py               layer 1: question -> memory hits + sources
├── generate_canon.py    layer 2: brain -> CANON/KERN.md + CANON/LLM-PROMPT.md
├── remember.py          layer 3: store one fact + index it
├── input/               your raw material goes here
├── data/                brain.db lives here (created on first ingest)
├── CANON/               KERN.md + LLM-PROMPT.md (created by generate_canon.py)
├── memory/              MEMORY.md index + one file per memory
├── archivers/           systemd timer + cron templates + installer
├── session-start/       injection block, CLAUDE.md pattern, behavior catcher
└── examples/            dummy sample data for a dry run

Privacy

Everything stays local: data/brain.db and every generated file live in this folder. The only thing that ever touches an external model is what you yourself paste into your LLM (CANON/LLM-PROMPT.md), and even that is optional; the offline extractor needs no model at all.