@riligar/agents-memories
v1.5.2
Published
RiLiGar Agents Memories - A self-improving relational memory system for AI agents.
Readme
RiLiGar Agents Memories
A high-performance, persistent memory system for AI agents, built on the Model Context Protocol (MCP). RiLiGar transforms flat data into a Relational Knowledge Graph featuring Resonance Intelligence and the Self-Improvement Protocol (SIP).
Now evolved into a Self-improving System, RiLiGar can be used both as a standalone MCP server and as a core library for cognitive applications.
🧠 Philosophy: The Cognitive Self & SIP
RiLiGar focuses on Relational Intelligence. Memory is not just retrieval; it is an extension of the agent's identity. With the Self-Improvement Protocol (SIP), the system transitions from passive storage to active learning. By capturing the Rationale of every decision, the agent can mine past patterns, audit its own architecture, and evolve its skills autonomously.
🏗️ Modular Architecture
The project is organized into distinct layers to ensure scalability and maintainability:
src/core(Cognition): Implements the heavy-lifting logic:- Resonance Intelligence: Priorities ripple through the graph; if a node is marked as critical, its semantic neighbors gain importance.
- Semantic Magnet: Automatically detects near-identical facts and creates
similar_tolinks.
src/database(Persistence): Uses LibSQL (SQLite) for edge-ready, high-speed storage.src/sdk(Interface): Provides theMemorySystemclass, a clean programmatic API.src/server(Transport): Handles MCP communication via Stdio (local) and SSE (web/remote).
🔌 Quick Start
Prerequisites
- Bun runtime (v1.x+)
Installation
bun installRunning the Standalone Server
The server starts both Stdio and SSE transports simultaneously on port 3000.
bun start- Stdio: Use this for Claude Desktop or local IDE configurations.
- SSE: Access via
http://localhost:3000/ssefor web dashboards or remote agents.
📦 Programmatic Usage (SDK)
You can use RiLiGar as a library in your own Bun projects:
import { MemorySystem, getSystemIdentity } from '@riligar/agents-memories'
import { createClient } from '@libsql/client'
const db = createClient({ url: 'file:data/memories.db' })
const ownerId = getSystemIdentity('data')
const memory = new MemorySystem(db, ownerId)
await memory.init()
// Save a memory with automatic priority inference
await memory.save({
content: 'The architecture is now modular.',
path: 'Project.Architecture',
})
// Relational Semantic Search
const results = await memory.search({ query: 'How is the project organized?' })
console.log(results)🛡️ Identity & SaaS Readiness
- Cryptographic Soul: Each installation generates an Ed25519 identity (
data/identity.json). The system uses a 10-character hexowner_idderived from this key. - Multi-Tenancy: Every memory is bound to an
owner_id, allowing the same database to securely host memories for multiple users or agents.
🛠️ MCP Tools Reference
save: Stores content with automatic priority inference. REQUIRED: Include Rationale to enable Pattern Mining.search: Relational semantic search. Essential for Pattern Mining and avoiding past errors (SIP).bridge: Manually links two memory paths (e.g.,Architecture->Security).inspect: Generates a Mermaid.js graph. Use for Architecture Audit (SIP).list: Shows all unique memory paths.
🧪 Development
Running tests
bun testStack
- Runtime: Bun
- Database: LibSQL
- Embeddings: Transformers.js (
all-MiniLM-L6-v2) - Server: Express + MCP SDK
Built with ❤️ by the RiLiGar Team.
