Ari’s Space*   est. 2026
Skip to content
ari*s space[ a. ]
← Librarymemory / 2026-08-06

Active Brain: memory that watches the whole session

Mid-session observer for your knowledge system: drift and stall triggers, silence as default, hot path cache-only, log-only soak before anything speaks.

12 parts / Hover to explore. Click to read.

Mid-session observer for your knowledge system: drift and stall triggers, silence as default, hot path cache-only, log-only soak before anything speaks.

BACKGROUND
Read-only store -> daemon
                      |
                 offer cache
                      |
PROMPT PATH           v
                eligibility gates
                 /          \
              offer        silence
In this design, expensive retrieval stays in the background and the prompt hook only reads prepared offers. Rollout begins log-only; failed gates and background worker sessions stay silent.

My memory system could help a session start. It couldn't help later in the same session.

On the bench that week, I had one memory system waking on the first prompt, three coding seats without mid-session help, and no useful interruption when I got stuck.

Cortex already gave a new chat a pack of durable, indexed notes. Then the conversation moved on. I changed topics, repeated a bug, or proposed something that contradicted an old decision. The history still existed. Nothing was looking for it at that moment.

Active Brain is the observer I designed for that gap. This essay describes the design and its log-only rollout, not a claim that every proposed intervention had already earned a place in the chat.

First prompt is boot. Active Brain is attention. Silence is the feature.

Help at the right moment

I want fuller reasoning and more creative problem-solving while the session is happening. More injected text isn't automatically a way to get either.

The always-on approaches I've tried tend to fail in familiar ways. They flood the context, train me to ignore the banner, or supply the useful fix on turn one when I need it on turn twelve.

The observer should offer a small, relevant pointer when it has a good reason. Most turns should pass without an interruption.

Offer a place to look

Each offer has a type, a recall handle and a one-line reason.

TypeWhy it might help
Past fixA previous solution matches the current error.
AnalogousA different domain has the same useful structure.
ContradictsAn earlier decision conflicts with the current approach.
TangentA less obvious connection is worth testing.

The handle lets the agent retrieve more detail if needed. The offer itself stays short. I don't want a second agent arguing at length in the conversation.

Several things are outside the contract: full context packs on every turn, observer writes into the knowledge store, and injections into background worker sessions. The prompt hook must not call a model, make an embedding or query the store. Below the confidence floor, it prints nothing, including no “0 hits” or skipped-check banner.

Keep the prompt hook cheap

The hook runs when a prompt arrives. Its job is to decide whether a prepared offer is eligible to appear.

  1. If the observer is disabled, exit quietly.
  2. If this is a background worker session, exit quietly.
  3. Read the small offer cache for this session.
  4. Reject stale offers using their turn and time age.
  5. Check confidence, remaining session budget, minimum gap and token ceiling.
  6. Print an eligible offer, or print nothing.

If the watcher breaks or a check fails, the hook returns cleanly and stays silent. An optional memory aid must not wedge the chat it was meant to help.

Do the searching in the background

The daemon is where the expensive work belongs. It starts when needed, runs as a singleton under a lock, and exits after the session has been idle. A global kill file disables it. A canary in the soak log makes a silently dead watcher detectable.

The loop tails recent exchanges, embeds the recent turns locally and maintains an exponentially weighted moving average of the session's topic vector. It evaluates triggers, retrieves candidates when a trigger fires, optionally reasons over them, and atomically replaces the small offer-cache file. It records the would-fire decision in the log.

The observer opens the knowledge store read-only. That boundary needs to be enforced by how the store is opened, not left as a polite instruction in a prompt.

Notice a change of topic or a loop

Drift compares the current turn's embedding with the session centroid. Cosine similarity below the configured threshold suggests a new topic and calls for retrieval from a different part of the store.

Stall looks for the last N turns remaining unusually similar. That can mean the work is stuck. It can also mean I'm repeating an instruction the agent keeps failing to follow.

That second case needs a flow-repair guard. Don't derail a human who is insisting on an unmet requirement and call it creative assistance.

Candidate builds have a cooldown. Thresholds are configurable per mode so the soak period can tune them without rewriting the code.

Retrieve something beyond the obvious cluster

Use several retrieval queries with a small result count. Score whether the evidence is sufficient, cap chunks per region, and require at least one chunk from outside the dominant region.

That last constraint is the creative part of this design. It gives the current problem a useful structure from somewhere else to meet. Asking the model to “be more creative” doesn't guarantee that encounter.

A wander step can add one wildcard tangent. It isn't the whole retrieval strategy. Session deduplication keeps the same chunk from being offered repeatedly until it falls out of the FIFO window.

The final offer still needs a reason to be useful here. Novelty alone doesn't clear the bar.

Keep the visible offer small

[BRAIN - drift: new subtopic]
Past fix      id:4182  why: solved same error in mesh work
Analogous     id:9910  why: same shape, different domain
Contradicts   id:2201  why: earlier decision says otherwise
Tangent       id:5543  why: dormant link worth testing

Use a hard line limit, bold anchors and no em dashes. The IDs are handles for deeper recall, not an excuse to paste the underlying essays into the chat.

This is for the advisor seat I type into. Cortex handles the opening context. Active Brain watches what happens later: a new topic, a repeated bug or an opportunity to bring in a relevant outside idea.

I want the timing of a quiet colleague. I don't want another conversation to manage.

Run it silently before allowing it to speak

Phase zero is a log-only soak. The daemon runs, the hook evaluates its gates, and the system records would_fire. It puts zero lines into the chat for days.

Use an append-only JSONL log with rotation. Keep per-turn logging out of the canonical knowledge store.

Before enabling output, check all of these:

  • The hook stays fast, exits cleanly and raises no exceptions.
  • The observer makes zero writes to the knowledge store.
  • The would-fire rate is neither constant noise nor evidence of a dead observer.
  • Every daemon cycle emits a liveness canary, and process files don't claim an observer that no longer exists.
  • I label a sample myself, and most proposed offers are useful.
  • Transcript availability is proven for each seat. If only the user prompt is visible, stall detection has less evidence and must be revalidated before printing is enabled.

My usefulness gate is at least 70% useful on a sample of 50 offers. Region matches and non-null hypotheses don't establish that. They were rejected as substitutes for human usefulness labels during design.

If the reasoner fails that test, keep the triggers and retrieval and ship without the reasoner. Start with per-mode opt-in after the soak passes. Only then consider default-on, with the kill switch still available.

Build your own version from the contract

You don't need my harness to use this structure.

Keep the canonical notes in the store you already trust. Make the observer a derived, read-only consumer. Separate the first-prompt pack from mid-session attention so neither turns into an always-on dump.

In the background, embed recent turns, maintain the centroid, detect drift and stall, retrieve diverse candidates, write concise reasons and atomically update a session-keyed cache.

On the prompt path, read that cache and check eligibility. No search, embedding or model call belongs there.

Give each session a maximum number of offers, a minimum gap, a confidence floor and a token ceiling sized as a small fraction of the window. Use a freshness TTL so an offer prepared for the previous topic doesn't arrive after a pivot.

Keep the lifecycle explicit: singleton lock, retained and rotated logs, idle exit, kill file and liveness signal. Background workers remain off the injection path entirely.

notes/                  # your canonical durable notes
observer/
  daemon.py             # embed, trigger, retrieve, write cache
  hook.py               # read cache only; print or silence
  offer_cache/          # session-keyed tiny JSON
  soak.jsonl            # would_fire decisions
  KILL                  # presence = observer off

Connect hook.py to the harness prompt event. Feed the daemon from a transcript tail or prompt deltas. Begin in log-only mode, label the proposed interventions, and enable printing only when the evidence earns it.

What the design review changed

The design used independent discovery lenses, three competing approaches and adversarial judges before settling on a hybrid.

The surviving structure was the asynchronous daemon and cache-reader hook. Drift and guarded stall detection supplied the triggers. Multi-region retrieval supplied the material, with a reasoner that could be dropped if the usefulness labels didn't support it.

Full packs on every turn, model calls on the prompt path, ungrounded proxy metrics and “helpful” skip messages were rejected.

The result was a quieter design than the original idea of injecting more memory. That was an improvement. The point is to help the work, not to prove that the observer is busy.

Where it fits

  • Cortex stores durable memory and helps the session start.
  • Generative Memories explores what can be learned from rejected designs through clearly labelled counterfactual work.
  • Brainstorming swarm describes the design method: independent work, useful digests and a written design before implementation.

Active Brain sits between that knowledge and the live advisor seat. Build the observer, record what it would have offered, and judge the timing and usefulness yourself. It earns trust by speaking when it helps and staying quiet when it doesn't.

[ comments ]

guests welcome. members show first in the list

no comments yet. start the thread_

1 / 14