Skip to main content

External memory for AI agents - a mini RLM

Project description

🗃️ stash

PyPI License Python

External memory for AI agents - a lightweight RLM (Recursive Language Model) that any Clawdbot can use.

Store persistent key-value data, load large files into searchable contexts, and manage agent memory - all without consuming precious tokens.

Features

  • Key-value storage - stash set/get for persistent data
  • Context loading - Load large files without eating tokens
  • Fast search - Full-text search with FTS5, plus regex
  • Chunking - Split large contexts into manageable pieces
  • Memory helpers - Quick remember/recall for agent notes
  • Zero dependencies - Pure Python, just sqlite3 (built-in)
  • Portable - Single SQLite database, easy to sync/backup

Installation

pip install stash-rlm

Or install from source:

git clone https://github.com/klodshannon/stash.git
cd stash
pip install -e .

Quick Start

# Store things persistently
stash set api:openai "sk-12345..."
stash get api:openai

# Load large files into context (doesn't eat tokens!)
stash load server.log --as logs
stash peek logs 0:50              # View lines 0-50
stash search "ERROR" --in logs    # Search within context

# Quick memory for agent notes
stash remember "Hunter prefers concise answers" --tag prefs
stash recall prefs
stash recall                      # List all memories

# Manage entries
stash list
stash stats
stash forget logs

Commands

Key-Value Storage

stash set <key> <value>     # Store a value
stash set config - < file   # Store from stdin
stash get <key>             # Retrieve a value
stash get <key> --json      # Output as JSON

Context Management

stash load <file> [--as <id>]    # Load file into context
stash peek <id> [range]          # View slice (e.g., "10:20")
stash peek <id> 100 -n           # 20 lines from 100, numbered
stash search <pattern> --in <id> # Search within context
stash search <pattern>           # Search all entries

Memory Helpers

stash remember "note" [--tag <tag>]  # Store a memory
stash recall [tag]                   # Recall memories

Management

stash list [--type <type>]    # List entries
stash stats                   # Storage statistics
stash forget <key>            # Delete entry
stash version                 # Show version
stash export -o backup.json   # Export to JSON
stash import backup.json      # Import from JSON
stash ctx-list                # List contexts
stash ctx-info <id>           # Context details

Use Cases

For Clawdbots / AI Agents

# Store frequently needed data
stash set user:tz "America/Chicago"
stash set user:name "Hunter"

# Load documentation for reference
stash load ~/project/README.md --as docs
stash search "API" --in docs

# Remember things between sessions
stash remember "Project uses FastAPI, not Flask"
stash remember "Deploy target is Railway" --tag deploy

Context Window Management

# Load a huge log file
stash load production.log --as prod

# Search instead of loading entire file
stash search "OutOfMemory" --in prod

# Peek at relevant sections
stash peek prod 1000:1050

Knowledge Base

# Build up knowledge over time
stash remember "User prefers dark mode" --tag ui
stash remember "Always use TypeScript" --tag code
stash remember "Meetings are Tue/Thu 10am" --tag schedule

# Recall by topic
stash recall code
stash recall schedule

Storage

Data is stored in a SQLite database at:

  • Linux/macOS: ~/.local/share/stash/stash.db
  • Or set STASH_HOME environment variable
  • Or use --db <path> flag

The database is fully portable - copy it to sync between machines.

Comparison with Aleph

Feature stash Aleph
Installation pip install MCP server
Dependencies None (pure Python) MCP, various
Storage SQLite In-memory
Persistence ✅ Survives restarts ❌ Session only
Python sandbox
Sub-queries
Use case Simple persistent memory Complex analysis

stash is for simple, persistent storage. Aleph is for complex analysis sessions.

License

MIT - Built by Klod at Shannon Labs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stash_rlm-0.1.3.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stash_rlm-0.1.3-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file stash_rlm-0.1.3.tar.gz.

File metadata

  • Download URL: stash_rlm-0.1.3.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for stash_rlm-0.1.3.tar.gz
Algorithm Hash digest
SHA256 56b5cf5a279a8cd0a07e50ee309b138c0edbbb1e36f411f71e6b6dda41138324
MD5 276e0aad2ba06c30412bbb0c1a3343b2
BLAKE2b-256 2628fa979720444e00e0bc5560549b6e8d37a7ac307be0ac4e724935698775df

See more details on using hashes here.

File details

Details for the file stash_rlm-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: stash_rlm-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for stash_rlm-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5739eed901999ab853a639f3ec77517a772867cf3949568e418717c79dc4ab5a
MD5 74c38ebf734b523b4d9e50bdaebe272a
BLAKE2b-256 ed49d540907bae74bd793d00bdeee1a4348da01851917426bbec458aa1e58a96

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page