Built on the foundations of MemPalace.
The fourth one stayed up.
Local, searchable memory for AI assistants.
SwampCastle v4 stores verbatim memory in a collection backend and structured facts in a graph backend.
- Local mode: LanceDB + SQLite
- Server mode: PostgreSQL + pgvector
- Test mode: in-memory stores
The public architecture is:
CLI / MCP / Sync
↓
Castle
├── CatalogService
├── SearchService
├── VaultService
└── GraphService
↓
CollectionStore + GraphStore
The spatial model is still the same:
WING (project / person / domain)
└── ROOM (topic)
└── DRAWER (verbatim text chunk)
pip install swampcastleRequirements
- Python 3.11+
- first-run ONNX model download for the default embedder (~87 MB, cached locally)
Optional extras:
pip install 'swampcastle[server]' # FastAPI + uvicorn for sync server
pip install 'swampcastle[postgres]' # PostgreSQL + pgvector backend
pip install 'swampcastle[gpu]' # sentence-transformers embedder support
pip install 'swampcastle[chroma]' # legacy ChromaDB tooling for migration onlyBefore doing anything else, SwampCastle will create a default global runtime config at ~/.swampcastle/config.json the first time you use the CLI. The default backend is Lance. If you want to change backend or storage settings, run:
swampcastle wizardThe wizard can also store your own identity in ~/.swampcastle/entity_registry.json so SwampCastle can recognize you by name or nickname during ingest.
If you stick with the canonical CPU ONNX embedder and want to rerun the local performance benchmark later, use:
swampcastle tuneswampcastle project ~/projects/myapp --team dekoza sarahproject creates project-local mining config in .swampcastle.yaml. It does not ingest files by itself. If an older swampcastle.yaml exists, SwampCastle will migrate it to the hidden filename and tell you.
The optional team list lets ingest tag drawers with a best-effort contributor identity from git history.
swampcastle gather ~/projects/myappConversation exports use the same command:
swampcastle gather ~/chat-exports --mode convos --wing myappswampcastle seek "why did we switch auth providers"
swampcastle seek "pricing" --wing myapp --room billing
swampcastle seek "auth migration" --contributor dekozaswampcastle survey
swampcastle brief --wing myappUse brief (alias: minstrel) when you want a human-readable wing summary. Use herald when you want the strict SwampCastle memory-use protocol for agent instructions.
Show the setup command:
swampcastle drawbridgeRun the server directly:
swampcastle drawbridge run
# or
swampcastle-mcpExample Claude Code setup:
claude mcp add swampcastle -- swampcastle-mcpExample Gemini CLI setup:
gemini mcp add swampcastle swampcastle-mcp --scope userSee docs/mcp.md.
Recommended entry point:
from swampcastle.castle import Castle
from swampcastle.models import AddDrawerCommand, SearchQuery
from swampcastle.settings import CastleSettings
from swampcastle.storage import factory_from_settings
settings = CastleSettings(_env_file=None)
factory = factory_from_settings(settings)
with Castle(settings, factory) as castle:
castle.vault.add_drawer(
AddDrawerCommand(
wing="myapp",
room="auth",
content="We switched providers because rotation and local testing got simpler.",
)
)
result = castle.search.search(SearchQuery(query="provider switch", wing="myapp"))
print(result.results)For low-level backend access, see docs/python-api.md.
Hub:
pip install 'swampcastle[server]'
swampcastle serve --host 0.0.0.0 --port 7433Client:
swampcastle sync --server http://homeserver:7433SwampCastle sync now works against the configured collection backend. Version vectors are still stored locally alongside castle_path.
See docs/sync.md.
SwampCastle can raise a legacy ChromaDB palace into the v4 local castle layout:
swampcastle raise --source-palace ~/.mempalace/palaceBy default the target is your configured castle_path (usually ~/.swampcastle/castle).
You can override it:
swampcastle raise --source-palace ~/.mempalace/palace --target-castle /tmp/swampcastle/castle
swampcastle raise --source-palace ~/.mempalace/palace --dry-runThe source palace is left untouched. Drawer data is imported into LanceDB, and common sidecar files such as the knowledge graph and sync identity files are copied when present.
The core ingest / search / MCP / sync path is working:
projectgather/mineseek/searchsurvey/statusdrawbridge/mcpserve/sync
Some maintenance commands are still being rebuilt and are intentionally thin right now:
reforge/reindexdistill/compress
The docs call that out explicitly where relevant instead of pretending those flows are complete.
| Document | Contents |
|---|---|
| Getting started | First ingest, first search, MCP setup |
| Architecture | Castle, services, storage contracts, backends |
| CLI reference | Real command surface and aliases |
| Configuration | CastleSettings, env vars, backend selection |
| Mining | Project + conversation ingest |
| Mining adapters | Internal ingest adapter seam and declared transformations |
| Searching | CLI and Python search flows |
| Audit overlay | Source-origin manifests, local curation files, derived catalogs/traces, transcript auto-ingest, explainable search |
| Knowledge graph | Graph service and direct stores |
| MCP server | Setup and tool catalog |
| Sync | Hub / spoke sync model |
| Hooks | Hook protocol and supported harnesses |
| Python API | Programmatic usage |
| AAAK dialect | Experimental compression layer |
| Migration | Moving from MemPalace |
| Changelog | Release history and notable changes |
| Notices | Security notes and release errata |
MIT — see LICENSE.