Skip to content

Add a persistent memory layer that survives repository restarts, server reboots, and team transitions. This fundamentally transforms System Zero from a stateless system to a truly intelligent, learni ng agent. #4

@MaximilianoAcri

Description

@MaximilianoAcri

Problem

Currently, every time System Zero restarts:

  • All context is lost
  • AI has no memory of past decisions
  • Each session starts from zero
  • Team members joining mid-project are blind to past context

This is the single biggest limitation of autonomous agents.

Vision

┌─────────────────────────────────────────────────────────────┐
│                    SYSTEM ZERO CORE                        │
├─────────────────────────────────────────────────────────────┤
│  Heartbeat │  Bus  │  Memory  │  LLM  │  Storage │ ???   │
│                                              │         │
│                              ┌───────────────────────────┤ MEMORY │ │
│                              │   PERSISTENT LAYER    │  LYR  │ │
│                              │   ( sobrevive restart ) │       │ │
│                              └──────────────────────│─────────┘         │
├─────────────────────────────────────────────────────────────┤
│                    FILE SYSTEM + DATABASE                │
└─────────────────────────────────────────────────────────────┘

What Gets Persisted

Memory Type What Survives Impact
Decisions Architecture choices, tool selections High
Bugs What was fixed, root cause High
Conventions Naming, structure, patterns Medium
User Preferences How user wants things done Medium
Discovered Context Codebase learnings High

Implementation

Storage Options

Option Pros Cons
SQLite Simple, portable Single file
PostgreSQL Robust, scalable Needs DB
Files (JSON) Simple, git-trackable Slower at scale
Vector DB Semantic search Complex

Recommended: SQLite for MVP, PostgreSQL for scale

Data Schema

-- Core tables
CREATE TABLE observations (
  id SERIAL PRIMARY KEY,
  title TEXT NOT NULL,
  type TEXT CHECK (type IN (
    'decision', 'architecture', 'bugfix', 
    'pattern', 'config', 'preference'
  )),
  content JSONB NOT NULL,
  project TEXT,
  scope TEXT DEFAULT 'project',
  topic_key TEXT,
  created_at TIMESTAMP DEFAULT NOW(),
  session_id TEXT
);

-- Full-text search
CREATE INDEX obs_search ON observations 
  USING GIN (to_tsvector('spanish', title || ' ' || content));

API

# Save observation (automatic or manual)
sz mem save --type bugfix --title "Fixed N+1 in UserList" \
  --content "Found missing .include(), added eager loading"

# Search memory
sz mem search "N+1"

# Get context for new session
sz mem context --project mi-proyecto

# Topic updates (upsert)
sz mem update --topic architecture/auth-model \
  --content "Switched to JWT from sessions"

Features

1. Automatic Capture

  • ✨ Auto-save architecture decisions
  • ✨ Auto-save bug fixes with root cause
  • ✨ Auto-save team conventions
  • ✨ Auto-save user preferences

2. Search

  • Full-text search across all memories
  • Semantic search (vector similarity)
  • Filter by type, project, date

3. Context Recovery

# New team member joins
sz mem context --project misitio --limit 20
# → Returns recent context to get up to speed

4. Integration

  • Works with all existing modules
  • Compatible with heartbeat, bus, LLM
  • No breaking changes

Token Savings

With persistent context:

  • Don't repeat questions → ~30% tokens saved
  • Reuse shared understanding → ~20% tokens saved
  • Smart context loading → ~40% tokens saved
  • Total: ~50-70% token reduction

Why This Is EPIC

Before After
Stateless Stateful
Starts from zero Remembers everything
Each tick is new Builds on past
No team memory Institutional knowledge
Expensive context Efficient

Comparison with Engram

This proposal is inspired by Engram, a persistent memory system for AI agents with:

  • Proactive save triggers
  • Semantic search
  • Session summaries
  • Topic upserts

Would love to collaborate on integrating similar functionality!


This would be the most impactful addition to System Zero's core. Game-changing for autonomous AI development.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions