Skip to content
Flows
Tier 3 · Agent memory Agent memory · fetched 2026-07-02

Dual-Memory Complete

A production-oriented dual-store agent memory system: separate tables for memories, core files, and skills in a multi-table vector store, with configurable confidence thresholds and trigger-word driven self-evolution.

View source on GitHub

Key takeaways

  • 01

    Separate stores for memories vs skills vs core files

  • 02

    Confidence thresholds gate what gets recalled

  • 03

    One distinct idea: trigger-word driven memory updates

Flows built on this research

From the archive

Verbatim excerpts mined from our local archive of this repository — the prompts, schemas, and patterns worth stealing.

Memory

withMemory: a one-function memory middleware

async function withMemory(userMessage, generateFn, options = {}) {
  // 1. Retrieve relevant memories
  const relevant = await memory.smartRetrieve(userMessage, {
    limit: config.retrieveLimit, minConfidence: 0.5 });

  // 2. Compress recent conversation
  const recent = sessionHistory.slice(-config.shortTermRounds);
  const compressed = recent.map(m => `[${m.role}] ${m.content.slice(0, 150)}`).join('\n');

  // 3. Assemble context: system prompt -> [relevant history] ->
  //    [recent conversation] -> user input
  // 4. Call the generate function
  // 5. Record the exchange back into memory
}

[translated] Long-term memory as a wrapper function: retrieval, short-term compression, ordered assembly, and write-back - integrable into any agent with one line.

src/memory-hook-simple.js