Persistent memory layer for AI coding assistants
Project description
memory-cli
A CLI memory layer for developers across editors (Cursor, VSCode, etc.) with prompt-driven memory mode.
🚀 New: Prompt-Driven Mode
The CLI now supports natural language queries with automatic memory recall!
# Ask any question - automatically recalls relevant context
memory "how did I integrate payments last week?"
memory "what was the bug I fixed yesterday?"
memory "show me my recent work on authentication"
# Check memory statistics
memory --stats
Installation
pip install .
Usage
🎯 Prompt-Driven Mode (Recommended)
Option 1: Direct natural language queries
# Using the installed command (if in PATH)
memory "how did I integrate payments last week?"
# Using Python directly
python prompt_direct.py "what was the bug I fixed yesterday?"
# Using batch file (Windows)
.\run_prompt.bat "show me my recent work on authentication"
Option 2: Using the chat command
memory chat "how did I integrate payments last week?"
memory chat --stats
🔧 Structured Commands (Legacy)
Option 1: Using the installed command (if in PATH)
memory init
memory add "Fixed login bug with JWT token"
memory recall "login"
memory attach cursor
memory ask "How do I fix a JWT login bug?"
Option 2: Using Python directly
python cli.py init
python cli.py add "Fixed login bug with JWT token"
python cli.py recall "login"
python cli.py attach cursor
python cli.py ask "How do I fix a JWT login bug?"
Option 3: Using the batch file (Windows)
.\run.bat init
.\run.bat add "Fixed login bug with JWT token"
.\run.bat recall "login"
.\run.bat attach cursor
.\run.bat ask "How do I fix a JWT login bug?"
Commands
Prompt-Driven Mode
memory "your question"— Ask any question with automatic memory recallmemory --stats— Show memory statisticsmemory chat "your question"— Alternative chat interface
Structured Commands
init— Initializes a .memory folder with config and SQLite DB.add "note or context"— Stores the note with timestamp and project path.recall [query]— Searches for notes matching the query.attach editor— Stub for future editor integration.ask "prompt"— Ask the LLM with memory context.
LLM Integration
The tool supports multiple LLM providers. Add your API key to .memory/config.json:
OpenAI
{
"llm_provider": "openai",
"llm_api_key": "YOUR_OPENAI_KEY"
}
Anthropic
{
"llm_provider": "anthropic",
"llm_api_key": "YOUR_ANTHROPIC_KEY"
}
Google Gemini (Recommended)
{
"llm_provider": "gemini",
"gemini_api_key": "YOUR_GEMINI_KEY"
}
To get a Gemini API key:
- Visit Google AI Studio
- Create an API key
- Update your config.json
Test your setup:
python test_gemini.py
How It Works
Prompt-Driven Mode
- Natural Language Input: You ask any question in plain English
- Automatic Memory Recall: System searches for relevant past conversations and notes
- Context Enrichment: Your question is combined with relevant memory context
- LLM Processing: Enhanced prompt is sent to OpenAI/Anthropic/Gemini
- Automatic Storage: Both your question and the LLM response are saved for future reference
Database Schema
- notes table: Stores all conversations with embeddings support
- memory table: Legacy table for backward compatibility
Extensibility
The code is modular for future commands like sync, proxy, and editor integrations.
For best keyword extraction, run:
import nltk; nltk.download('punkt'); nltk.download('averaged_perceptron_tagger')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memory_layer-0.1.0.tar.gz.
File metadata
- Download URL: memory_layer-0.1.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61b97f2db02725d72adc73b55a187a0c9dee8cc36d177fc4ecaf0c25b610a60b
|
|
| MD5 |
c785d1d91f93a0c4f1a29d5cfc6d9b13
|
|
| BLAKE2b-256 |
57a3a1cf6023bd2b766d61b445214f35616aef2ee6b59195ddd42b45288ade69
|
File details
Details for the file memory_layer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: memory_layer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c17cbba079db6d32f75c8dd89ebbaff69cb7ff8227d3bcbd7f904f86bf52f83
|
|
| MD5 |
e68c309047f62ace27bca7ab500a3e65
|
|
| BLAKE2b-256 |
3540987e7d78eaa7949a603ecd89addc4d71d582ae3c46477631c72945b912c1
|