Generated banner for forgetful
Generated logo for forgetful

forgetful

Memory server

Created by Scott

Published in ScottRBK/forgetful. Publisher page

339 GitHub stars

What it is

Opensource Memory for Agents
— the description by Scott

AutoGineer overview, from the brain’s own files

Forgetful is a storage and retrieval tool designed as a Model Context Protocol (MCP) server. It provides AI agents with persistent, semantically searchable memory, enabling them to maintain context across sessions and different agentic applications. By imposing the Zettelkasten principle, Forgetful requires memories to be atomic, which facilitates the automatic construction of a knowledge graph through semantic embedding and linking. It supports flexible storage backends including SQLite for local development and PostgreSQL for production, and uses local embedding models to ensure privacy and performance. Beyond simple memory, it supports entities, projects, and procedural skills, allowing agents to coordinate tasks and maintain complex relationships between data points.

How it works

Memory model: Hybrid

AutoGineer overview, from the brain’s own files

Forgetful functions as an MCP server that exposes meta-tools to connected AI agents. When an agent records a memory, it must provide a title, content, and context, which the server then converts into semantic embeddings using local models. The system automatically links new memories to existing ones based on similarity scores, building a knowledge graph. It manages the agent's context window by enforcing a token budget and ranking retrieved information by importance. The system also supports entities and relationships, allowing for structured data management alongside unstructured memory notes.

Folders
FolderRoleFiles
.githubagent-config10
appsource-code153
docsdocs46
examplesexamples1
skillsagent-instructions13
teststests182
alembicfolder18
benchmarksfolder6
dockerfolder5
nixfolder1
test_harnessfolder12

Requirements

Runtimes: Python >=3.12

Databases: PostgreSQL, Qdrant, SQLite

API keys (by name): FORGETFUL_TOKEN

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Google Antigravity, Kiro, OpenCode, Amp, Roo Code, Cline, JetBrains Junie, Devin (ex-Windsurf)

Set it up

  1. This brain runs code automatically: 2 scripts. Review app/bootstrap.py, pyproject.toml before opening the folder in Claude Code. No step below turns a hook on for you.

    • app/bootstrap.py: python app/bootstrap.py
    • pyproject.toml: hatch build hook vcs (hatch_build.py)
  2. Not scanned by AutoGineerThe author’s README also describes installing it with Docker Compose. Read its install section: AutoGineer did not scan that path. https://github.com/ScottRBK/forgetful/blob/9f85ddcf2ca1ae0264358e0b4b50860948ec1e03/README.md#option-3-docker-deployment-productionscale
  3. Not scanned by AutoGineerThe author’s README also describes installing it from a clone of its repository. Read its install section: AutoGineer did not scan that path. https://github.com/ScottRBK/forgetful/blob/9f85ddcf2ca1ae0264358e0b4b50860948ec1e03/README.md#quick-start
  4. Not scanned by AutoGineerIts dependencies are installed by pip or uv when you run it and were not scanned by AutoGineer (28 declared). https://pypi.org/project/forgetful-ai/
  5. Created by Scott. Published in ScottRBK/forgetful. Licence: MIT License.

Usage

AutoGineer overview, from the brain’s own files

  • Connect to AI agents via MCP (stdio or HTTP).
  • Store atomic memories with context and tags.
  • Query memories using natural language with semantic search.
  • Manage projects and link memories to specific work streams.
  • Track entities and their relationships for team or system context.
  • Execute procedural skills stored as step-by-step instructions.
“Create a memory about a technical decision.”
The agent saves an atomic note linked to a project, which is then semantically indexed and linked to related past decisions.
“Find information about a specific team member's role.”
The agent retrieves the entity record for the person and any associated memories or relationship metadata.

Documentation by Scott

<h1 align="center">Forgetful</h1>

<p align="center"> <img src="https://img.shields.io/badge/python-3.12%2B-blue" alt="Python"> <img src="https://img.shields.io/badge/license-MIT-green" alt="License"> <img src="https://img.shields.io/badge/MCP-server-purple" alt="MCP"> <a href="https://github.com/jlowin/fastmcp"> <img src="https://img.shields.io/badge/FastMCP-powered-orange" alt="FastMCP"> </a> <a href="https://github.com/qdrant/fastembed"> <img src="https://img.shields.io/badge/FastEmbed-powered-orange" alt="FastEmbed"> </a> <a href="https://discord.gg/ngaUjKWkFJ"> <img src="https://img.shields.io/badge/Discord-Join%20Us-7289da?logo=discord&amp;logoColor=white" alt="Discord"> </a> </p>

Forgetful is a storage and retrieval tool for AI Agents. Designed as a Model Context Protocol (MCP) server built using the FastMCP framework. Once connected to this service, MCP clients such as Coding Agents, Chat Bots or your own custom built Agents can store and retrieve information from the same knowledge base.

Image: Banner


Table of Contents

  • Overview

  • Features

  • Quick Start

  • CLI

  • Usage Examples

  • How It Works

  • Configuration

  • Documentation

  • Contributing

  • License


Overview

A lot of us are using AI Agents now, especially in the realm of software development. The pace at which work and decisions are made can make it difficult for you to keep up from a notes and context persistence perspective.

So if you are following something like the BMAD Method for example and you want to take your brain storming session you've just had with Claude on your desktop/mobile and use it for the basis of your next Claude Code session, then having a shared knowledge base across the two agents can help with this.

This is just one example use case to illustrate the point, more and more agentic applications are going to surface and the use cases for sharing data across them is going to increase.

Knowledge bases are going to become a key infrastructure component for your interactions with AIs. There are many excellent knowledge base solutions available (many for free on github) and I would encourage you to check them out and find one that works for you (even if Forgetful doesn't) as I found from personal experience that interactions with my agents got easier and more rewarding once they knew more about me, my work and previous interactions that I had had with them or other AI systems.

What makes Forgetful different from other Memory based MCP services is that it is a rather opinionated view on how AI Agents such store and retrieve data.

Forgetful imposes the Zettelkasten principle when clients wish to record memories, that is each memory must be atomic (one concept per note). Along with the note (title and content), we also ask the client / agent to provide context around what it was doing when creating the note, along with keywords and tags. With this information we create semantic embeddings and store these to aid with later retrieval and in addition to this we also automatically link the memory to existing memories that have a particular similarity score, allowing for the automatic construction of a knowledge graph.

In this sense Forgetful becomes a little bit like Obsidian for AI Agents, where the auto linking nudges them in building up a graph of the knowledge.

We find, as do others (A-MEM: Agentic Memory or LLM Agents), all this helps in ensuring that when the agent requires relevant information from the memory system later, the correct information is returned.

In addition to just memories, Forgetful also has the concept of entities (think organisation, people, products), projects, documents, code artifacts, skills (procedural knowledge following the Agent Skills standard), and plans with tasks for multi-agent coordination, all of which can be associated with one or more memories.

Image: Architecture

Features

  • Configure either STDIO or HTTP transport mechanism (or stand up two services to support both)

  • Multiple Authentication supported, flows see FastMCP docs for full list

  • Meta Tool Discovery, only three tools exposed to client application to preserve context window.

  • Flexible Storage– SQLite (default, zero-config) or PostgreSQL (for scale and production deployments)

  • Stores memories as vectors and allowing memories to be retrieved from natural language queries from AI.

  • Cross Encoder reranking to improve recall and precision of memory retrieval.

  • Flexible ranking (embedding and cross encoder) providers, run everything locally without calls to the cloud thanks to FastEmbed

  • Automatic linking of semantically similar memories, automating the creation of the knowledge graph.

  • Plans and Tasks for multi-agent coordination -- structure work into plans with tasks that have acceptance criteria, state management with optimistic locking, and dependency tracking with cycle detection.

  • Skills for procedural memory -- store step-by-step instructions and agent capabilities with semantic search, import/export in Agent Skills SKILL.md format, and cross-referencing with memories.

For the complete roadmap, see Features Roadmap.


Quick Start

# Run directly with uvx (no installation needed)
uvx forgetful-ai

# Or install globally
uv tool install forgetful-ai
forgetful

Data stored in platform-appropriate locations (~/.local/share/forgetful on Linux/Mac, AppData on Windows).

By default, runs with stdio transport for MCP clients. For HTTP:

uvx forgetful-ai --transport http --port 8020
Option 2: From Source
git clone https://github.com/ScottRBK/forgetful.git
cd forgetful

# Install dependencies with uv
uv sync

# Run the server (uses SQLite by default)
uv run main.py

The server starts with stdio transport. For HTTP: uv run main.py --transport http

Option 3: Docker Deployment (Production/Scale)

Forgetful provides two Docker deployment options:

SQLite with Docker (Simpler, Single-Container)

See docker-compose.sqlite.yml

cd docker
cp .env.example .env
# Edit .env: Set DATABASE=SQLite and SQLITE_PATH=data/forgetful.db
docker compose -f docker-compose.sqlite.yml up -d

The SQLite database persists in the ./data directory on the host.

See docker-compose.postgres.yml and .env.example

cd docker
cp .env.example .env
# Edit .env: Set DATABASE=Postgres and configure POSTGRES_* settings
docker compose -f docker-compose.postgres.yml up -d

Note: If no .env file exists, the application uses defaults from app/config/settings.py. For all configuration options, see Configuration Guide.

Connecting to An Agent

For detailed connection guides (Claude Code, Claude Desktop, other clients that support MCP), see Connectivity Guide.

Add Forgetful to your MCP client configuration:

stdio transport (recommended for local use):

{
  "mcpServers": {
    "forgetful": {
      "type": "stdio",
      "command": "uvx",
      "args": ["forgetful-ai"]
    }
  }
}

HTTP transport (for Docker/remote):

{
  "mcpServers": {
    "forgetful": {
      "type": "http",
      "url": "http://localhost:8020/mcp"
    }
  }
}

CLI

The forgetful command is also a full terminal client over the same tool registry the MCP meta-tools use - against your local database by default, or a remote deployment after auth login.

uv tool install forgetful-ai

# Curated verbs for daily use
forgetful memory save "Set generateResolvConf false to fix WSL2 DNS" \
    --title "WSL2 DNS fix" --importance 7
forgetful memory search "wsl dns" -c "wsl networking" -n 5
forgetful memory get 812
forgetful memory recent -n 10 -p my-project
forgetful project list

# Generic passthrough to any available tool
forgetful tools list --category memory
forgetful tools info query_memory
forgetful call create_project --args '{"name": "Homelab", "description": "...", "project_type": "personal"}'

# Remote deployment (browser OAuth; saves FORGETFUL_SERVER to ~/.config/forgetful/.env)
forgetful auth login --server https://forgetful.example.com
forgetful auth status
forgetful memory search "wsl dns" -c "wsl networking"          # now runs remotely
forgetful memory search "wsl dns" -c "wsl networking" --local  # force local mode per invocation

# Scripting: --json emits machine-readable output
forgetful memory search "wsl dns" -c "wsl networking" --json | jq '.primary_memories[0].id'

forgetful serve is the canonical way to run the MCP server (forgetful serve --transport http --port 8020); the bare forgetful / uvx forgetful-ai invocation and the legacy --transport/--re-embed flags keep working indefinitely, so existing MCP client configurations are unaffected. Headless environments can set FORGETFUL_TOKEN (bearer) instead of the OAuth flow. See the Configuration Guide for precedence rules, or walk through the forgetful-cli-setup skill for install, auth, and verification steps end-to-end.


Usage Examples

Forgetful exposes only 3 meta-tools to MCP clients. The tools available through execute_forgetful_tool depend on the enabled feature flags. Use discover_forgetful_tools for the current runtime catalog.

Example 1: Project-Scoped Memory

Create a memory linked to a project for better organization and scoped retrieval.

# Create project for organizing related knowledge
project = execute_forgetful_tool(
    "create_project",
    {
        "name": "E-Commerce Platform Redesign",
        "project_type": "work",
        "status": "active"
    }
)

# Create memory linked to project
memory = execute_forgetful_tool(
    "create_memory",
    {
        "title": "Payment gateway: Stripe chosen over PayPal",
        "content": "Selected Stripe for its API, fees, and fraud detection.",
        "context": "Choosing the payment provider for the redesign",
        "keywords": ["payment", "stripe", "paypal"],
        "tags": ["payment", "decision"],
        "importance": 9,
        "project_ids": [project["id"]]
    }
)

# Later, query within project scope
results = execute_forgetful_tool(
    "query_memory",
    {
        "query": "payment processing implementation",
        "query_context": "Implementing payments for the redesign",
        "project_ids": [project["id"]]
    }
)
# Returns: Stripe decision + auto-linked related memories
Example 2: Knowledge Graph with Entities

Track people, organizations, and relationships - perfect for team and infrastructure management.

# New engineer joins your company
new_hire = execute_forgetful_tool(
    "create_entity",
    {
        "name": "Jordan Taylor",
        "entity_type": "Individual",
        "description": "Backend Engineer - Payments Team",
        "tags": ["engineering", "backend", "payments"]
    }
)

# Get company entity (create if needed)
company = execute_forgetful_tool(
    "create_entity",
    {
        "name": "TechFlow Systems",
        "entity_type": "Organization",
        "description": "SaaS platform company"
    }
)

# Create employment relationship
execute_forgetful_tool(
    "create_entity_relationship",
    {
        "from_entity_id": new_hire["id"],
        "to_entity_id": company["id"],
        "relationship_type": "works_for",
        "metadata": {
            "role": "Backend Engineer II",
            "department": "Payments",
            "start_date": "2025-01-20"
        }
    }
)

# Create memory about hiring
hire_memory = execute_forgetful_tool(
    "create_memory",
    {
        "title": "Jordan Taylor hired - payments focus",
        "content": "Jordan joins to build the Stripe integration and handle PCI compliance.",
        "context": "Recording ownership and experience for the payments work",
        "keywords": ["jordan", "stripe", "payments", "pci"],
        "tags": ["team", "hiring", "payments"],
        "importance": 7
    }
)

# Link person to memory
execute_forgetful_tool(
    "link_entity_to_memory",
    {
        "entity_id": new_hire["id"],
        "memory_id": hire_memory["id"]
    }
)

# Query Jordan's related knowledge
results = execute_forgetful_tool(
    "query_memory",
    {
        "query": "Jordan payment implementation",
        "query_context": "Finding ownership and experience for payments work"
    }
)
# Returns: Hiring memory + linked entity + relationship context
Tool Categories

The core catalog covers users, memories, projects, entities, code artifacts, and documents. Skills, files, plans, and tasks appear when their feature flags are enabled.

For complete documentation with extensive examples, see Complete Tool Reference.


How It Works

Atomic Memory Principle

Inspired by Zettelkasten, each memory stores one concept in ~300-400 words:

  • Easily titled – Forces clarity (200 char limit)

  • Self-contained – Understandable without external context

  • Linkable – Small units enable precise knowledge graphs

For detailed content, use Documents and extract 3-7 atomic memories that link to the parent document.

Automatic Knowledge Graph

When you create a memory:

  1. Embedding generated – FastEmbed converts content to 384-dimensional vector

  2. Similarity search – Finds related memories (similarity ≥0.7 by default)

  3. Auto-linking – Creates bidirectional links to top 3-5 matches (configurable)

  4. Graph traversal – Queries return primary results + 1-hop linked memories

Entities and Knowledge Graphs

Entities represent concrete, real-world things (people, organizations, teams, devices) that can be linked to memories:

  • Typed entities – Organizations, Individuals, Teams, Devices, Systems, or custom types

  • Relationships – Directional connections (e.g., "Person works_at Organization") with strength and metadata

  • Memory linking – Associate entities with relevant memories for context

  • Knowledge graph – Build networks showing how entities relate to each other and your knowledge base

Use entities for concrete things (Sarah Chen, TechFlow Systems, Cache Server 01) and memories for abstract concepts (architectural patterns, decisions, learnings).

Token Budget Management

Prevents context window overflow:

  • Configurable budget (default 8K tokens)

  • Search finds relevant memories; primary results are then sorted by importance (high first)

  • Equal-importance primary results keep their search order, even when nothing is truncated

  • Truncates gracefully if over budget

  • Respects max memory count (default 20)

This keeps query results within the LLM's context budget.

For vector search and optional cross-encoder reranking, see Search Documentation.


Configuration

No configuration required – Forgetful uses sensible defaults out of the box.

Key Settings (Optional)
  • MEMORY_TOKEN_BUDGET – Max tokens for query results (default: 8000)

  • EMBEDDING_MODEL – Embedding model (default: BAAI/bge-small-en-v1.5)

  • MEMORY_NUM_AUTO_LINK – Auto-link count (default: 3, set 0 to disable)

  • MEMORY_SIMILARITY_THRESHOLD – Minimum cosine similarity for auto-links (default: 0.7)

  • SERVER_PORT – HTTP server port (default: 8020)

  • MAX_GRAPH_LIMIT – Upper bound for /api/v1/graph ?limit and /api/v1/graph/subgraph ?max_nodes (default: 2000)

For all 40+ environment variables with detailed explanations, see Configuration Guide.


Documentation

Guides
External Resources

Contributing

We welcome contributions! Forgetful uses integration + E2E testing with Docker Compose orchestration.

See the contributor guide for:

  • Testing workflows (integration tests, E2E tests, GitHub Actions)

  • Development setup (local vs Docker)

  • CI/CD pipeline details

  • Release process


License

MIT License - see LICENSE for details.

docs/embedding_migration.md

Embedding Provider Migration

When you switch embedding providers or models (e.g., from FastEmbed to OpenAI, or from bge-small-en-v1.5 to text-embedding-3-small), existing memory embeddings become incompatible. Different providers produce vectors with different dimensions and semantic spaces, so a search query embedded with the new provider won't match memories embedded with the old one.

Forgetful includes a built-in CLI tool to handle this migration safely.


When You Need to Re-embed

You need to run a re-embedding migration whenever you change any of these settings:

SettingExample Change
EMBEDDING_PROVIDERFastEmbed -> OpenAI
EMBEDDING_MODELbge-small-en-v1.5 -> text-embedding-3-small
EMBEDDING_DIMENSIONS384 -> 1536

If you only change non-embedding settings (database, auth, reranking, etc.), no re-embedding is needed.


Quick Start

# 1. Update your .env with the new provider settings
EMBEDDING_PROVIDER=OpenAI
EMBEDDING_MODEL=text-embedding-3-small
EMBEDDING_DIMENSIONS=1536
OPENAI_API_KEY=sk-...

# 2. Preview what will happen (no changes made)
forgetful --re-embed --dry-run

# 3. Run the migration
forgetful --re-embed

If running from source:

uv run main.py --re-embed --dry-run
uv run main.py --re-embed

CLI Reference

--re-embed

Runs the re-embedding migration instead of starting the server. Processes all memories across all users, including obsolete memories, with the currently configured embedding provider and dimensions. Counts and progress include obsolete memories. Their status and supersession metadata are preserved.

forgetful --re-embed [--batch-size N] [--dry-run]
--batch-size N

Number of memories to process per batch. Default: 20.

Lower values use less memory and are safer for rate-limited APIs. Higher values are faster for local providers like FastEmbed.

forgetful --re-embed --batch-size 50    # faster for local providers
forgetful --re-embed --batch-size 5     # conservative for rate-limited APIs
--dry-run

Shows configuration and memory count without making any changes. Use this to verify your setup before committing to a migration.

forgetful --re-embed --dry-run

Output:

[1/5] Validating configuration...
  Provider: OpenAI (text-embedding-3-small)
  Dimensions: 1536
  Database: SQLite (/home/user/.local/share/forgetful/forgetful.db)
  Batch size: 20
  Memories to process: 127

[DRY RUN] Would re-embed 127 memories with the above configuration.
  No changes were made.

What Happens During Migration

The tool follows a 5-step process:

Step 1: Validate Configuration

Displays the target provider, model, dimensions, database backend, and memory count. Confirms the settings are what you intend before proceeding.

Step 2: Create Backup

Creates a timestamped backup of your database:

  • SQLite: Copies the .db file (plus WAL/SHM if present) to forgetful.db.bak-YYYYMMDD-HHMMSS

  • PostgreSQL: Runs pg_dump to forgetful-pg-YYYYMMDD-HHMMSS.sql

The backup is kept alongside your database. In-memory SQLite databases skip this step.

Step 3: Update Vector Schema

Resizes the vector storage to match the new EMBEDDING_DIMENSIONS:

  • SQLite: Drops and recreates the vec_memories virtual table

  • PostgreSQL: Alters the embedding column type to vector(N)

Step 4: Re-embed Memories

Processes all active and obsolete memories in batches:

  1. Reads a batch of memories from the database

  2. Generates new embeddings using the configured provider

  3. Writes the new embeddings back

  4. Reports progress via a live progress bar

[4/5] Re-embedding memories...
  [####################-----] 102/127 memories (80%)
Step 5: Validate

Runs three automated checks:

  1. Count check - Verifies every memory, including obsolete memories, has an embedding

  2. Dimension check - Samples embeddings and confirms correct dimension count

  3. Search check - Tests vector retrieval, including when all memories are obsolete

[5/5] Validating...
  Count check: 127 memories, 127 embeddings OK
  Dimension check: OK
  Search check: OK

Recovering Obsolete-Memory Warnings

Older full rebuilds removed vectors for obsolete memories. This prevented create_memory from warning when new content closely matched them. After upgrading, run forgetful --re-embed once, even if your embedding settings have not changed. The rebuild regenerates missing vectors from the stored memory content using the current model and dimensions. It also works when every memory is obsolete.

Obsolete memories remain excluded from normal queries and automatic links. The targeted rebuild_embeddings tool still processes active memories only; use the full CLI rebuild for recovery.


Failure Handling

The tool is designed to be safe. If anything goes wrong, your database is automatically restored.

Automatic Restore

The backup is restored automatically in these scenarios:

  • Embedding API error (rate limit, network failure, invalid key)

  • Validation failure (count mismatch, dimension mismatch, broken search)

  • Interrupt signal (Ctrl+C / SIGTERM)

[4/5] Re-embedding memories...
  [████░░░░░░░░░░░░░░░░░░░░░] 8/127 memories (6%)
  ERROR: OpenAI API rate limit exceeded

  Restoring from backup...
  Restored: /home/user/.local/share/forgetful/forgetful.db.bak-20260220-143022
  Database returned to pre-migration state.
Manual Restore

If you need to manually restore after a successful migration (e.g., you notice search quality issues):

SQLite:

# The backup path is printed at the end of the migration
cp /path/to/forgetful.db.bak-YYYYMMDD-HHMMSS /path/to/forgetful.db

PostgreSQL:

psql -h localhost -p 5099 -U forgetful -d forgetful -f /path/to/forgetful-pg-YYYYMMDD-HHMMSS.sql
Backup Cleanup

Backups are retained after a successful migration. Delete them manually once you're satisfied:

rm /path/to/forgetful.db.bak-*          # SQLite
rm /path/to/forgetful-pg-*.sql          # PostgreSQL

Common Migration Scenarios

FastEmbed (local) to OpenAI (cloud)
# .env
EMBEDDING_PROVIDER=OpenAI
EMBEDDING_MODEL=text-embedding-3-small
EMBEDDING_DIMENSIONS=1536
OPENAI_API_KEY=sk-...

# Migrate
forgetful --re-embed --batch-size 20
FastEmbed to Ollama (local)
# .env
EMBEDDING_PROVIDER=Ollama
OLLAMA_BASE_URL=http://localhost:11434
EMBEDDING_MODEL=nomic-embed-text
EMBEDDING_DIMENSIONS=768

# Migrate
forgetful --re-embed --batch-size 50
OpenAI to Azure OpenAI
# .env
EMBEDDING_PROVIDER=Azure
EMBEDDING_MODEL=text-embedding-ada-002
EMBEDDING_DIMENSIONS=1536
AZURE_ENDPOINT=https://my-resource.openai.azure.com/
AZURE_DEPLOYMENT=text-embedding-ada-002
AZURE_API_VERSION=2023-05-15
AZURE_API_KEY=...

# Migrate (same dimensions, but different provider = different vector space)
forgetful --re-embed
Upgrading Model Within Same Provider

Even when staying on the same provider, switching models requires re-embedding:

# .env - switching from small to large model
EMBEDDING_PROVIDER=OpenAI
EMBEDDING_MODEL=text-embedding-3-large
EMBEDDING_DIMENSIONS=3072
OPENAI_API_KEY=sk-...

# Migrate
forgetful --re-embed
OpenAI-Compatible Local Server (llama.cpp, vLLM)

Use the OpenAI provider with a custom OPENAI_BASE_URL to point at a local inference server serving GGUF or other models:

# .env
EMBEDDING_PROVIDER=OpenAI
EMBEDDING_MODEL=your-model-name
EMBEDDING_DIMENSIONS=1024
OPENAI_BASE_URL=http://localhost:8080/v1
OPENAI_SUPPORTS_DIMENSIONS=false

# Migrate
forgetful --re-embed

Server-side batch size: Local inference servers (llama.cpp, vLLM) have an internal processing batch size that limits the maximum input token count per request. llama.cpp defaults to 512 tokens, which may be too small for longer memories. If you see errors like input (N tokens) is too large to process, increase the server's batch size:

# llama.cpp - increase batch size to handle longer texts
llama-server -m model.gguf --embedding --batch-size 2048

# vLLM
vllm serve model-name --max-model-len 2048

A batch size of 2048 is recommended as a starting point. This is a server-side setting, not a Forgetful setting — Forgetful's --batch-size flag controls how many memories are processed per database write, not the token limit.


Docker Deployments

For Docker-based deployments, run the re-embed command inside the container:

Docker Compose
# SQLite
docker compose exec forgetful-service python main.py --re-embed --dry-run
docker compose exec forgetful-service python main.py --re-embed

# PostgreSQL
docker compose exec forgetful-service python main.py --re-embed --dry-run
docker compose exec forgetful-service python main.py --re-embed

Make sure your updated .env is mounted in the container before running.

PostgreSQL Backup Requirements

For PostgreSQL backups to work in Docker, the container needs pg_dump and psql available. The standard Forgetful Docker image includes these tools. If using a custom image, ensure the PostgreSQL client tools are installed.


Tips

  • Always dry-run first to verify your configuration and memory count

  • Use a conservative batch size (10-20) for cloud providers to avoid rate limits

  • Use a larger batch size (50-100) for local providers (FastEmbed, Ollama) for faster processing

  • Don't delete backups immediately - verify search quality first by querying a few memories

  • Stop the server before running re-embed to avoid concurrent access issues

  • The migration processes all users' memories in a single run (it's a global operation)


Further Reading

472 files · 452 not served here

Advantages

  • Automatic knowledge graph construction through semantic linking of atomic memories. evidence: README.md
  • Maintains context window efficiency via configurable token budgets and importance-based ranking. evidence: README.md
  • Flexible deployment options ranging from zero-config local SQLite to scalable PostgreSQL. evidence: README.md

Limitations

  • Requires adherence to the Zettelkasten principle, which may be restrictive for some workflows. evidence: README.md
  • Limits the number of tools exposed to the agent to preserve context window, potentially hiding advanced functionality. evidence: README.md

Security

Risk level: Medium risk

This brain runs

Agent instructions that run or fetch something (34)

  • AGENTS.md: Run `uv run pytest tests/architecture/` to check and prove the agreed import boundaries.
  • AGENTS.md: **Location**: `tests/integration/` **Purpose**: Test business logic with stubbed I/O (no real database required) **Run locally**:
  • AGENTS.md: uv run pytest tests/integration/
  • AGENTS.md: These tests use in-memory stubs and run fast (~seconds).
  • AGENTS.md: **Location**: `tests/e2e_sqlite/` **Purpose**: Test complete stack with in-memory SQLite **Requirements**: None (no Docker required) **Run locally**:
  • AGENTS.md: uv run pytest tests/e2e_sqlite/
  • AGENTS.md: **Location**: `tests/e2e/` **Purpose**: Test complete stack with real PostgreSQL **Requirements**: PostgreSQL running in Docker **Run locally**:
  • AGENTS.md: uv run pytest -m e2e
  • AGENTS.md: Ensure that you run ruff following any changes and address any issues raised
  • AGENTS.md: uv tool run ruff check .
  • skills/forgetful-cli-setup/SKILL.md: The CLI is the shell-native surface: same tool registry as MCP, reachable by anything that can run a command.
  • skills/forgetful-cli-setup/SKILL.md: After changing embedding provider or model: `forgetful re-embed --dry-run` to preview, then `forgetful re-embed` (batch size tunable via `--batch-size`).
  • skills/forgetful-context-gather/SKILL.md: Run MCP-flavored gathers in the main conversation.
  • skills/forgetful-context-gather/SKILL.md: Done when: every angle has run and its outcome is recorded.
  • skills/forgetful-encode-repo/SKILL.md: this skill moves it, and only after a run has reviewed every change up to the new commit.
  • skills/forgetful-encode-repo/SKILL.md: Run git in the repository being encoded (the current directory unless the user named one).
  • skills/forgetful-encode-repo/SKILL.md: **HEAD**: `git rev-parse HEAD`.
  • skills/forgetful-encode-repo/SKILL.md: Unless the user names another range end, this is the end commit: everything this run writes describes it.
  • skills/forgetful-encode-repo/SKILL.md: **Clean worktree**: `git status --porcelain` prints nothing.
  • skills/forgetful-encode-repo/SKILL.md: **Project**: `git remote get-url origin` → `owner/repo` → `list_projects` with `repo_name`.
  • skills/forgetful-encode-repo/SKILL.md: Checks: the checkpoint is a commit here when `git rev-parse --verify --quiet <sha>^{commit}` prints the stored value itself;
  • skills/forgetful-encode-repo/SKILL.md: `git merge-base --is-ancestor <sha> <end>` succeeds when it is an ancestor.
  • skills/forgetful-encode-repo/SKILL.md: Done when: the branch decision is written, and each value in it comes from a command or tool result in this run.
  • skills/forgetful-encode-repo/SKILL.md: **Retrieval**: when the run wrote knowledge, `query_memory` scoped to the project with `strict_project_filter` true and the questions this encoding should answer (how the system fits together, each changed area under its current name).
  • skills/forgetful-encode-repo/SKILL.md: **Pinning**: `git rev-parse HEAD` still matches Step 1, `git status --porcelain` still prints nothing, and `get_project` still shows the checkpoint read in Step 1.
  • skills/forgetful-encode-repo/SKILL.md: Advance the checkpoint only when the run recorded no gaps and the range leaves no unreviewed commit (see user ranges in Step 2).
  • skills/forgetful-encode-repo/SKILL.md: Build it from tool results in this run: an ID or count appears only when a response confirmed it, and a read that failed is reported as unknown.
  • skills/forgetful-encode-repo/SKILL.md: Correct the call against the operation's schema and run it again;
  • skills/forgetful-mcp-setup/SKILL.md: **stdio** — the client spawns the server per session: command `uvx forgetful-ai` (equivalently `forgetful serve --transport stdio`).
  • skills/forgetful-mcp-setup/SKILL.md: Recognised scopes in verified token `scope`/`scp` claims can narrow MCP access further; · uses the network
  • skills/forgetful-mcp-setup/SKILL.md: Run Forgetful MCP calls in the main conversation — subagents do not inherit MCP tool access.
  • skills/forgetful-procedures/SKILL.md: All skill operations run through the standard invocation surface below, the same as every other domain.
  • skills/forgetful-recall/SKILL.md: Run it as a deliberate step, then continue into normal recall as the task demands.
  • skills/forgetful-remember/SKILL.md: Derive the candidate from the repo: `git remote get-url origin` → `owner/repo` → `list_projects` with `repo_name`.

MCP servers (2)

  • README.md (forgetful): uvx forgetful-ai
  • README.md (forgetful): http://localhost:8020/mcp · uses the network

Install scripts (1)

  • app/bootstrap.py: python app/bootstrap.py

Package scripts (1)

  • pyproject.toml (build-hook): hatch build hook vcs (hatch_build.py)
  • Medium risk: runs-mcp-server-unpinned-runner (README.md:159)
  • Medium risk: runs-instruction-instruction-network (skills/forgetful-mcp-setup/SKILL.md:51)
  • Low risk: scripts-present (app/bootstrap.py)
  • Low risk: network-instructions (skills/forgetful-cli-setup/SKILL.md:25)

Attribution and licence

Created by
Scott
Declared authors
  • Scott (declared in pyproject.toml)
Publisher
Scott Raisbeck (Community)
Source
ScottRBK/forgetful · commit 9f85ddc
Licence
MIT License (files served here)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Scott.

Install from source

452 of its files are not served here, so there is no ZIP. ScottRBK/forgetful at 9f85ddc