How raulvidis/amenti works
1. What this repo is
Amenti is a local, SQLite-backed persistent memory system for AI agents. The repository is organized around one core runtime path: a CLI writes and reads memory records from a database, and an optional embedding service adds semantic search.
2. Primary entrypoint
bin/amenti is the user-facing CLI. It is the main control plane for storing memories, searching, recalling context, managing tasks/logs, stats, and reindexing vectors. The CLI is configured by environment variables like AMENTI_DB and AMENTI_AGENT, which define the database location and the active agent namespace.
3. Core storage layer
src/schema.sql defines the base SQLite schema, including the memory model, search indexes, and trigger-driven behavior. src/schema_vec.sql likely extends that schema for vector-related fields or tables. The repository is built around SQLite as the single durable system of record, not an external database service.
4. Search architecture
Search is hybrid:
- FTS5 for exact keyword retrieval
- LIKE / partial matching as fallback
- Vector embeddings for semantic retrieval
The CLI merges these signals into ranked results. This means search is not a single query path; it is a composition of lexical and semantic retrieval over the same local database.
5. Embedding subsystem
src/embed_server.py is a separate Python service that generates embeddings locally using sentence-transformers with all-MiniLM-L6-v2. The CLI talks to it over HTTP (/embed, /embed_batch, /health) when semantic indexing is enabled. If the server is absent, Amenti still works in non-vector mode.
6. Lifecycle and operational scripts
The scripts/ directory contains the operational boundaries of the system:
- init-db.sh initializes the SQLite database
- reindex.sh backfills or rebuilds embeddings
- migrate.sh imports from file-based memory layouts
- cleanup.sh performs retention/cleanup logic
These scripts are the repo’s maintenance layer around the core CLI and database.
7. Agent packaging and distribution
The templates/ directory contains agent-facing artifacts such as SKILL.md, MEMORY.md, and related skill templates. The install flow copies these into the agent’s skills/workspace directory so the agent can bootstrap with a lightweight memory interface rather than a large context file.
8. Data model and memory flow
The repo’s architecture centers on a staged memory pipeline: session activity becomes daily logs, then reflections, then durable memories, plus action items and open questions. The database holds multiple memory types such as facts, preferences, relationships, principles, commitments, moments, skills, and patterns. This is a single store with typed records rather than separate services per category.
9. Multi-agent boundary
Amenti supports multiple agents sharing one database while remaining scoped by agent_id. That makes agent identity a first-class partitioning boundary: each agent can write its own memories and optionally query others explicitly. This is important for diagramming because the DB is shared infrastructure, but access is logically segmented.
10. Installation and packaging path
install.sh is the distribution bootstrap, and README.md shows a curl-to-shell install flow. The repo is meant to be installed locally, with the CLI linked into PATH and the skill package copied into the agent’s skills directory. There is no central cloud backend; the architecture is intentionally local-first.
11. Supporting docs
docs/ARCHITECTURE.md and skill/references/distillation-guide.md provide design and usage guidance, but they are documentation rather than runtime components. In the diagram, they belong on the side as operator/agent guidance, not on the execution path.
12. Key architectural boundaries to draw
The important boundaries are:
- Agent/runtime boundary: agent invokes CLI or consumes the skill package
- Persistence boundary: CLI talks to local SQLite DB
- Semantic boundary: optional HTTP embedding server augments writes/search
- Operations boundary: shell scripts handle bootstrap, migration, reindexing, cleanup
This repo is therefore best diagrammed as a local memory platform with a thin CLI, one durable DB, and an optional embedding microservice.
Main entry points: amenti Amenti CLI · schema.sql SQLite schema · schema_vec.sql Vector schema · SKILL.md Skill package
Components 16
Runtime
User-facing command path and local services
- Amenti CLI · Main user-facing control plane for memory operations
bin/amenti - Hybrid search · FTS5, LIKE fallback, and vector ranking merged by the CLI
- Embed server · Local HTTP embedding service using sentence-transformers
src/embed_server.py
Storage
SQLite schema and memory model
- SQLite schema · Base durable memory store and indexes
src/schema.sql - Vector schema · Vector-related schema additions for semantic memory
src/schema_vec.sql - Memory records · Facts, preferences, relationships, commitments, moments, and other typed memories
- Agent namespace · agent_id boundary for multi-agent sharing and isolation
Operations
Bootstrap, migration, reindexing, cleanup
Packaging
Agent-facing templates and skill assets
- Install · Local installation and PATH/skill setup
install.sh - Skill package · Skill and memory templates copied into agent workspace
templates/SKILL.md - Memory template · Agent-facing memory bootstrap template
templates/MEMORY.md
Docs
Design and usage guidance
- Agent guidance · Operational guidance for distillation and usage
skill/references/distillation-guide.md - Architecture docs · Repository design and system overview
docs/ARCHITECTURE.md
Connections 18
- Amenti CLI → SQLite schema: reads/writes · CLI persists memories and queries SQLite
- Amenti CLI → Vector schema: uses · CLI touches vector-backed storage when semantic mode is enabled
- Amenti CLI → Hybrid search: drives · CLI composes lexical and semantic retrieval
- Hybrid search → SQLite schema: queries · FTS5 and LIKE search run against the local database
- Hybrid search → Vector schema: ranks with · Vector fields support semantic retrieval
- Amenti CLI → Embed server: HTTP /embed · Optional local embedding calls for indexing and search
- Embed server → Vector schema: produces vectors · Embeddings are stored or used to populate vector-enabled data
- Amenti CLI → Agent namespace: partitions by · All operations are scoped to an agent identity
- Init DB → SQLite schema: initializes · Bootstrap script creates the base database schema
- Reindex → Vector schema: rebuilds · Operational backfill for vector data and search structures
- Migrate → SQLite schema: imports into · Migration script loads external memory into SQLite
- Cleanup → SQLite schema: prunes · Cleanup operates on stored memory records
- Install → Amenti CLI: installs · Bootstrap links the CLI into the local environment
- Install → Skill package: copies · Install flow deploys skill assets into the agent workspace
- Skill package → Memory template: includes · Skill package carries memory-oriented templates
- Skill package → Agent guidance: references · Skill docs point to distillation guidance
- Architecture docs → Amenti CLI: documents · Architecture docs describe the runtime path
- Architecture docs → SQLite schema: documents · Docs explain the durable storage model