Projects
A project in shmem is a tag on each fact — a string column that organizes memories into logical groups. Every fact you capture has a project tag, and queries can filter by it.
All facts live in a single unified database at ~/.shmem/db/facts/shmem.db regardless of project. The project tag is what shmem ask --project NAME (or --here) filters by.
This is a change from earlier shmem versions, where each project was its own SQLite database directory. The unified model means:
- Queries from inside a project directory scope to that project automatically, plus the shared spaces you've joined and what teammates wrote into projects you've shared, and auto-broaden to all projects only if that finds no matches — locality without thinking. Pass
--global(or setSHMEM_DEFAULT_SCOPE=global) to opt out. - Cross-project work — a question that started in one repo and continued in another — works without any extra effort once the auto-broaden fires (or always, with
--global). - Single-player and multiplayer share the same data model
- Backups, exports, and disaster recovery operate on one file
Installs predating v0.1.33 kept a separate database per project. That layout is no longer readable and the in-place migration has been removed; if shmem reports an empty store while ~/.shmem/projects/ still has data, start fresh or open an issue to recover it.
Should I use projects, or just default?
Use projects for the repos you'll want to scope or share. shmem install captures every session without any per-repo setup — live sessions land in default, imported history is tagged by where it happened, and shmem ask searches all of it. Run shmem init in a repo when you want it to have its own tag.
Projects are shmem's unit of organization and sharing, and they line up with how other agent tools already scope work to a directory — so tagging by repo matches the boundary you're already thinking in. Sharing is per-project: when you grant a teammate access, the project is what you grant. A single undifferentiated store gives you nothing to hand over.
default is the fallback, not a recommendation. Sessions in directories you haven't run shmem init in land there, and that's fine — nothing is lost, and you can always retag later with shmem admin project rename --from OLD --to NEW. But you give up the ability to scope a question to one codebase, and you give up sharing granularity.
You're not choosing isolation. Because everything lives in one database and queries auto-broaden when a project has no matches, tagging costs you nothing in recall — a question that spans two repos still finds both.
Should I import my existing history?
Yes — import everything. shmem install imports your agents' past sessions automatically; shmem import --auto picks up anything added later.
shmem is more useful the more of your past work it can see, and an empty store is the single biggest reason a new install feels useless. Retrieval is ranked rather than exhaustive, so additional history competes for the top slots rather than crowding anything out.
Imports are additive and idempotent, so you can start with one source and add the rest later without duplicating anything.
Where does my data go?
For writes, shmem picks the project tag in this order:
- A
.shmem/projectmarker file found by walking up from the current directory (written byshmem init). Per-directory routing always wins over global config. SHMEM_DEFAULT_PROJECTenv var (or set in~/.shmem/.env) — the "global mode" key for users who want one tag everywhere.SHMEM_PROJECTenv var — deprecated for theshmemCLI (prints a one-shot warning when consulted). Still the canonical config mechanism forshmem-mcpserver instances configured via.mcp.json.- The fallback name
default.
For reads, the default is "no scope" — every project's facts are searched together. To narrow:
| Flag | Effect |
|---|---|
--here |
Walk up from cwd for a .shmem/project marker; scope to that tag alone, without the shared spaces the implicit scope adds. |
--project NAME |
Restrict to a specific tag. |
--mine |
Only facts you (SHMEM_CALLER_USER) authored. |
--shared / --private |
Restrict to one scope. |
These compose: shmem ask --here --mine --private "what was I thinking?" is the cwd's project, only your facts, only private.
Memory with no project is account-wide. Your own memories in default (sessions captured outside any project, and what the Claude app saves through the connector, which arrives on your machines with no project) belong to no one project, so every project scope includes them: --here, --project NAME, the implicit cwd scope, and the MCP tools' project scope alike. --project default still lists only them. Two things never come in this way: another person's memories, and, for a teammate reading a project you shared, your account-wide memory. shmem query --ids, whose output feeds shmem delete --stdin, keeps to the project alone.
shmem admin status prints the resolved write tag, the unified DB path, and a hint if legacy per-project DBs are detected on disk.
Why a unified DB?
The trade-offs the old per-project model optimized for (signal-to-noise, predictable retrieval cost, portability) still apply, but they're now solved by other mechanisms:
- Signal-to-noise is solved by retrieval ranking (keyword IDF + temporal + optional semantic) and the explicit
--project/--herefilters when you do want narrow scope. - Cross-project work — the most common pain point of the old model — works trivially: a question that started in one repo and continued in another is now one query.
- Privacy moves to a per-fact
scopecolumn (private vs shared) instead of a per-project boundary. Your personal memories never mix into team views by accident. - Portability — one file at
~/.shmem/db/facts/shmem.db. Back it up, sync it, replicate it. - Performance — the keyword index is a persisted SQLite FTS5 index (maintained at write time); the temporal index is in-memory and fast. The optional dense-embedding index is opt-in via
SHMEM_EMBED_MODEL.
First-run expectations
A fresh install starts with an empty unified DB; ~/.shmem/db/ is created on the first write. The quickest way to get useful data in is one of the import sources:
shmem import --from claude-code # all your Claude Code transcripts
shmem import --from cursor # Cursor IDE chat history
shmem import --from codex-cli # OpenAI Codex CLI rollouts
shmem import --from github --per-repo # PRs and issues you authored, via gh
The transcript sources tag facts with a project name derived from the source's structure (Claude Code project directory, Cursor workspace, Codex session path). --from github does not — it writes into your current project unless you pass --per-repo (one project per repo, named owner-repo) or --project <name>.
After import, shmem ask "..." defaults to your current project (with auto-broaden to all projects on empty), and shmem ask --global searches everything explicitly.
Import is a pure parse-and-insert with no LLM calls, which is why it's fast even for thousands of facts. LLM calls only happen at query time (ask_memory).
Facts
One fact is one message — one user turn, one assistant turn, or one tool call. Fact counts grow quickly (a single busy Claude Code session produces hundreds), and that's intentional: keyword retrieval stays fast at these sizes, and the finer granularity gives the QA pipeline better context to synthesize from.
Facts are immutable in content once stored. You can delete them (shmem delete) but not edit them. The scope column (private vs shared) is mutable so facts can be promoted from private to shared without rewriting content.
Sharing
Sharing in the unified model operates at the fact level via the scope column (private vs shared), with optional shared_with group. Project-level promotion rules — "share my customers project with team alice/team" — translate to "for every fact tagged customers, set scope to shared." The promotion mechanics are tracked under M2 of the unified-memory plan and not yet implemented.
For the current group + permissions model, see the Reference.
Related CLI commands
| Command | What it does |
|---|---|
shmem admin status |
Show the unified DB path, the resolved write tag, and any legacy DB hints. |
shmem admin project list |
List project tags from the legacy projects.json registry (still useful for the dashboard's project drill-down). |
shmem ask --here "..." |
Query the project tagged for the current directory. |
shmem ask --project NAME "..." |
Query a specific tag. |
shmem query --mine "..." |
Filter to facts you authored. |