Buffaly Logo Buffaly
Companion agent

Online Memory Critic

The Online Session Memory Critic is a hidden companion that reviews one completed source turn at a time and writes high-confidence session-local ontology back into that source session. It learns durable referents. It does not learn reusable actions, and it does not keep a markdown ledger.

What it is

Profile online-session-memory-critic attaches as {source}-online-memory-critic. It observes only a normal buffaly-agent source session. Specialized agents, Level 2 watchers, and other critics are rejected so companion chains cannot recurse.

The critic is not a report writer. If a memory is accepted, it materializes as raw ProtoScript through a source-session write bridge. If nothing qualifies, it writes nothing.

Unit of analysis

Each instruction is one completed interaction pair, not a bag of nouns from the whole session.

  • The user message is primary evidence of intent, naming, corrections, and what the user expects to keep using.
  • The final assistant outcome is evidence of how that intent was resolved: canonical names, selected approaches, identifiers, paths, and completed work.
  • Tool results and artifacts are supporting evidence for existence and technical properties.

Cross-role recurrence is strong identity evidence even when wording differs. “We need a web module” in the user message and “GoDaddyWebModule” in the outcome can be the same planned entity. Recurrence does not automatically prove every technical property: user statements prove intent; assistant outcomes prove what was proposed or completed; tool results prove materialized facts.

Operational Handle Requirement

A memory is written only when the prototype itself carries at least one operational handle, or a typed link to an entity that does. Handles include filesystem paths, repository roots, URLs, package or site ids, session keys, secret names, commit SHAs, commands, prompt paths, and typed references. Secret values are never stored.

Notes and Description do not satisfy the requirement when they are the only place a path or id appears. Architecture nouns, process rules, and planned workers with no path, id, command, or typed link are not new entities.

Required two-pass review

Pass 1: identity

Extract candidates from the user message and the final outcome. Merge aliases. Split different lifecycles. Search source ontology for every strong candidate with a real tool call. Assign existing-sufficient, existing-augment, new-create, reference-only, or deferred-uncertain.

Pass 2: properties

Inspect current values and property schema before writing. Do not overwrite an already-valued property. Declare a new evidence-scoped property when state changes. Keep prototypes sparse but handle-complete. Preserve modality: planned stays planned until creation evidence exists.

Search is executable, not internal reasoning. The critic cannot claim “search found nothing” unless the tool result exists in that critic turn.

How memory is written

Accepted memories go through ToWriteSessionLocalMemoryToSourceSession as one raw ProtoScript prototype. The critic never interprets definitions in its own runtime and never writes to its own artifacts/nl-memory directory. NLMemory in the source session owns validation, interpretation, registration, and persistence.

The write bridge rejects malformed ProtoScript and rejects partial writes that try to assign a property that already has a value. That fail-closed behavior is why later turns can trust session-local ontology instead of fighting silent overwrites.

What it will not remember

  • Raw logs, full tool dumps, transient guesses, and one-off implementation details
  • Facts already in permanent ontology or already in source session-local memory
  • Generic turn summaries, critic mechanics, or candidate-only markdown
  • Standalone fact, failure, blocker, or decision wrappers when the information belongs on an entity
  • Every noun mentioned in passing

Lifecycle

A thumbs-up or management attach action ensures the deterministic hidden child, queues exactly the selected completed turn, and returns immediately. Waiting inside the source evaluate gate would deadlock the write-back path. Attach also registers future turn.completed delivery through ToDispatchOnlineSessionMemoryCriticEvent. It does not scan historical turns.

Next