LLM Memory

Architecture & Integration Guide

← Back to Search

What is this?

LLM Memory is a searchable knowledge base designed to help LLM agents (like Claude Code) access documentation, lessons learned, and institutional knowledge across sessions.

The core problem: each conversation starts fresh. Agents repeatedly make the same mistakes because they don't remember past lessons. This service is an experiment in giving agents persistent, searchable memory.

Architecture

┌─────────────────────────────────────────────────────────────┐ │ Claude Code │ │ ┌─────────────────────────────────────────────────────┐ │ │ │ WebFetch("https://memory.aisloppy.com/api/search") │ │ │ └─────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ LLM Memory Service │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │ Flask API │ │ Indexer │ │ SQLite │ │ │ │ │ │ │ │ + FTS5 │ │ │ │ /api/search │◄─┤ Scans docs │──►│ │ │ │ │ /api/docs │ │ on startup │ │ Full-text │ │ │ │ /api/learn │ │ │ │ search │ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ └─────────────────────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ Indexed Documents │ │ • Infrastructure guides (deploy-on-hub.txt, etc.) │ │ • Service documentation (authreturn, brightwrapper) │ │ • Project READMEs │ │ • Lessons learned (manually added) │ └─────────────────────────────────────────────────────────────┘

Integration Options

1. WebFetch (Current)

Claude Code can query the API using WebFetch:

WebFetch https://memory.aisloppy.com/api/search?q=deploy+flask+app

Pros: Works now, no setup required
Cons: Manual invocation, agent must remember to use it

2. MCP Server (Future)

MCP (Model Context Protocol) allows Claude Code to call external tools directly. An MCP server would expose memory search as a native tool.

# Claude could call directly:
search_memory(query="how to deploy flask app")

Pros: Cleaner integration, feels native
Cons: Requires local MCP server setup, adds complexity

Note on MCP performance: MCP works best as a local subprocess alongside Claude Code. Browser-based MCP interactions are slow because they require proxying through additional layers. For CLI tools like Claude Code, MCP is snappy.

3. Hooks/Skills (Future)

Claude Code supports hooks that run before/after certain actions. A hook could automatically query memory before starting certain tasks.

API Reference

GET /api/search?q={query}

Full-text search across all documents.

{
  "query": "deploy flask",
  "count": 2,
  "results": [
    {
      "id": 1,
      "title": "How to Deploy on AI Sloppy Hub",
      "snippet": "...Flask backend with deploy script...",
      "doc_type": "infrastructure",
      "rank": -2.5
    }
  ]
}

GET /api/docs

List all indexed documents. Optional ?type= filter.

GET /api/doc/{id}

Get full content of a specific document.

POST /api/learn

Add a new lesson learned.

{
  "title": "Always use authreturn components for auth",
  "content": "Don't hand-roll auth forms. Use the standard..."
}

POST /api/reindex

Re-run the document indexer to pick up new/changed files.

What Should Be Indexed?

Current Status

This is v1 - a minimal viable experiment. Current limitations:

Future Ideas