Tideline

API, tools, MCP & eval

Reach Tideline four ways: as a library facade, through the agent tools, over MCP, or via the evaluation harness. The engine is structured to be lifted out as a standalone brigade-tideline package — nothing in the facade imports Brigade-specific code.

Library API#

Open a workspace and you get a small, stable facade:

tideline.ts
import { Tideline } from "brigade-tideline"; const memory = Tideline.open("/path/to/workspace"); memory.add({ content: "I keep a strict vegetarian diet.", segment: "preference" }); const hits  = memory.recall("dietary restrictions");        // hybrid BM25 + vectorconst block = memory.context("dietary restrictions", { maxChars: 800 });memory.feedback(hits[0].memoryId, "up");                    // +0.05, reinforce
MethodWhat it does
open / overOpen a workspace, or wrap an existing storage backend
add / rememberWrite a fact (through the write-gate + dedup)
recallHybrid recall (preferred); search is pure-lexical
contextA budgeted, origin-scoped block for a prompt
explainPassive recall with a per-hit score breakdown
feedbackAsymmetric up/down on a fact
inspect / export / listGraph neighbourhood, full dump, filtered list
purgeReversible soft-delete (lifecycle → pruned)

The facade takes injectable adapters for the clock, a recall-time threat-scan, an embedder, and an LLM. The embedder and LLM adapters are reserved seams — v1 recall is served by the bundled HRR vector lane (see Recall & ranking).

Agent tools#

Inside a turn, the crew reaches memory through four origin-scoped tools:

  • recall_memory — meaning-based recall for the current origin.
  • read_memory — read the markdown vault (MEMORY.md / daily notes).
  • write_memory — write a fact (segment, importance, subjectKey, supersedes).
  • manage_memory — owner-only maintenance: inspect, export, vault, purge, retention, relink, plus the gated dream, retract, restore, and propose actions.

Each call threads the caller's origin: owners write/recall owner memory; a channel peer is scoped to their own session and can never reach yours.

MCP server#

Expose an agent's memory to any MCP client (an editor, a desktop assistant) over stdio, bound to one principal:

terminal
$ brigade mcp                 # serves the `main` agent's memory$ brigade mcp --agent support # a specific agent

It surfaces memory_add, memory_search, and memory_context. Results are sanitized — control/bidi characters stripped, </> escaped, threats replaced with [BLOCKED], wrapped as untrusted data — and writes from a non-owner principal are stamped retrieved_document so the write-gate and trust weighting apply.

Evaluation harness#

Recall quality is measured, not asserted. The harness runs a capability over deterministic gold sets and reports ranking metrics plus latency percentiles:

  • recall@k, MRR, nDCG@k, and hit-rate, with bootstrap confidence intervals.
  • Gold sets seed facts, apply supersessions, and resolve cases to memoryIds before scoring.
terminal
$ npm run bench   # comparison, gold-hard, fs↔convex parity, and ASR edge-case suites

Configuration#

SettingEffect
BRIGADE_MEMORY_EMBEDDERVector lane: model-free (default HRR), openai-256, or a local model
BRIGADE_MEMORY_LLM_TIMEOUT_MSTimeout for the extraction/consolidation LLM call (default 60000)
BRIGADE_DISABLE_MEMORY_EXTRACTKill-switch — freezes extraction, consolidation, and decay
BRIGADE_MAINTENANCE_INTERVAL_MSCadence of the nightly maintenance cron (default 24h)
extensions.slots.memoryPin a plugin memory backend in brigade.json

Pluggable backend

The default backend is the file-based FactStore (JSONL) plus a markdown vault. Any module implementing the MemoryCapability contract — registered via b.memory(...) — can replace it; a DB-backed store is the roadmap target. See Extending Brigade.