Local-first memory layer for assistant and coding workflows.
This project provides:
- a Python memory engine under
skills/memory/ - a distributable Codex skill under
memory-skill/ - a packaging script that builds a
.skillarchive from the latest source without duplicating runtime code in the repo
- Separate
global,project, andsessionstorage - Durable memory types for
preference,profile,correction,goal,decision,lesson, andfact - Workflow commands:
prepare-contextfor pre-response recallcapture-outcomefor post-task memory extraction
- Manual commands:
store,search,learn,prune,export,import,list-projects
- SQLite persistence plus JSON session state
- Keyword search with deterministic local embedding fallback
- Stable JSON output for both CLI and handler integration
memory-skill/ Codex skill source and runtime wrapper
skills/memory/ Python implementation
tests/memory/ unit tests
tools/ packaging utilitiespython -m pip install -e .Available entrypoints:
memory-skill ...
python -m skills.memory ...
python -m skills.memory.memory_cli ...Store and search durable memory:
memory-skill store "User prefers concise answers" --type preference --scope global
memory-skill search "concise answers" --scope globalUse the workflow interface:
memory-skill prepare-context "draft a status update"
memory-skill capture-outcome --messages "[{\"role\":\"user\",\"content\":\"Please use concise answers.\"}]"Project-scoped usage:
memory-skill prepare-context "fix sqlite config issues" --project-path E:\work\demo
memory-skill learn "stabilize config loading" "Always validate environment files before parsing." --project-path E:\work\demoMain exports live in skills/memory/__init__.py.
from skills.memory import prepare_context, capture_outcome, store_memory
context = prepare_context("draft a status update")
outcome = capture_outcome(
messages=[{"role": "user", "content": "Please use concise answers."}]
)
stored = store_memory(
content="User prefers concise answers.",
scope="global",
type="preference",
)Handler example:
from skills.memory import handle_memory_request
response = handle_memory_request(
{
"command": "prepare_context",
"payload": {
"query": "draft a status update",
},
}
)By default runtime data is stored under:
skills/memory/data/
global.db
projects.db
project/<project_hash>.db
session/<session_id>.jsonOverride with MEMORY_SKILL_DATA_ROOT when needed.
Run tests:
python -m unittest discover -s tests\memory -p "test_*.py" -vBuild the distributable skill:
python tools/package_skill.pyThis writes release/memory-skill.skill.
- Project databases are derived from
sha1(normalized_project_path) - Imports reuse the normal store path, so dedupe still applies
capture-outcomeonly auto-stores high-confidence user long-term memory by default- The current embedding fallback is deterministic and local by design