████                                       
                             ░░███                                       
 ████████  ████████   ██████  ░███   ██████   ███████ █████ ████  ██████ 
░░███░░███░░███░░███ ███░░███ ░███  ███░░███ ███░░███░░███ ░███  ███░░███
 ░███ ░███ ░███ ░░░ ░███ ░███ ░███ ░███ ░███░███ ░███ ░███ ░███ ░███████ 
 ░███ ░███ ░███     ░███ ░███ ░███ ░███ ░███░███ ░███ ░███ ░███ ░███░░░  
 ░███████  █████    ░░██████  █████░░██████ ░░███████ ░░████████░░██████ 
 ░███░░░  ░░░░░      ░░░░░░  ░░░░░  ░░░░░░   ░░░░░███  ░░░░░░░░  ░░░░░░ 
 ░███                                        ███ ░███                     
 █████                                      ░░██████                      
░░░░░                                        ░░░░░░                      
      

AI Agent Memory Library

Dual-layer memory. First-principles execution. Zero compromise.
Long-term persistence for AI agents — file-based storage with compression ladders, visibility boundaries, and built-in safety frameworks.

Copy bun add @aegntic/prologue
Core Components

What is Prologue?

A durable memory system that survives context window resets, session restarts, and process crashes. Purpose-built architecture — not a vector database wrapper.

Memory Store

MemoryMatrix

File-based persistence with optional Graphiti knowledge graph.

  • Compression Ladders — working, project, overview, core
  • Visibility Boundaries — private, inspectable, shared, canonical
  • Atomic Writes — tmp+rename prevents corruption
  • Envelope Scans — list without exposing body data
Orchestration

Orchestrator

Automates the agent lifecycle — run tasks, capture learnings.

  • Agent Spawning — runs CLIs with post-session analysis
  • Git Diff Pipeline — diff, insight extraction, memory storage
  • Recovery Manager — graduated escalation protocol
  • Circular Fix Detection — Jaccard similarity > 0.3
Safety

FPEF v2.0

First Principles Execution — 4-phase gate enforcement.

  • Phase Gates — Find, Prove, Evidence, Fix
  • Anti-Dishonesty — 6 deterministic rules, zero LLM calls
  • Catastrophic Recovery — 5-step protocol, always returns
  • Post-Hoc Validation — deterministic output checking
Memory Architecture

Compression Ladder

Memories move up through four compression levels as confidence grows.

Working

scratchpad
confidence < 0.5

Raw notes & ephemera.

Project

dossier
confidence ≥ 0.5

Focused task context.

Overview

atlas
confidence ≥ 0.7

Cross-project awareness.

Core

biography
confidence ≥ 0.9

Durable truths.

Quick Start

Up and running in seconds

import { MemoryMatrix } from "prologue";

// Create a memory store
const memory = await MemoryMatrix.create("/path/to/project");

// Store a memory
const cell = await memory.store("Auth uses JWT RS256", {
  visibility: "private",
  compression: "working",
  tags: ["auth", "jwt"],
});

// Query memories
const results = await memory.query("auth token");
console.log(results[0].cell.body.content);
Developer Reference

API Reference

MemoryMatrix

Method Returns Description
MemoryMatrix.create(dir) Promise<MemoryMatrix> Static factory, initializes directory
store(content, opts?) Promise<MemoryCell> Store a new memory
query(queryText, opts?) Promise<MemoryResult[]> Search memories (exact match + tags)
promote(id, targetLevel) Promise<MemoryCell> Move memory up compression ladder
envelopeScan(vis?) Promise<MemoryEnvelope[]> List envelopes respecting visibility
delete(memoryId) Promise<void> Delete a memory

FPEF v2.0

Method Returns Description
wrapPrompt(task, opts?) string Inject phase instructions around task
validate(output) Violation[] Post-hoc output validation (deterministic)
antiDishonesty(output) DishonestyCheck[] 6-rule anti-dishonesty checks, zero LLM
catastrophicFailure(report) RecoveryStep[] 5-step failure recovery protocol

RecoveryManager

Method Returns Description
classifyFailure(error) FailureClassification Classify into 5 failure types
isCircularFix(edit, prev) boolean Jaccard similarity > 0.3 detection
getRecoveryAction(class, attempt, circular) RecoveryAction Graduated: retry, analyze, escalate
isStuck(id, attempts) boolean True after 3 attempts on same failure
174
Tests
0
Failures
371
Assertions
1
Runtime Dependency