Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
OLLAMA_URL=http://localhost:11434
# 127.0.0.1 on purpose (not `localhost`): on Windows `localhost` can resolve
# to ::1 first while the containers publish IPv4-only ports — including when
# docker runs inside WSL2 — which hangs the HTTP clients.
OLLAMA_URL=http://127.0.0.1:11434
EMBED_MODEL=bge-m3
EMBED_DIM=1024

QDRANT_URL=http://localhost:6333
QDRANT_URL=http://127.0.0.1:6333
QDRANT_COLLECTION_CODE=code_chunks
QDRANT_COLLECTION_EPISODES=episodes

FALKOR_HOST=localhost
FALKOR_HOST=127.0.0.1
FALKOR_PORT=6379
FALKOR_GRAPH=code_graph

Expand Down
84 changes: 78 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,16 @@ from the `main` URL above before running it.

The installer fetches the CLI, drops `docker-compose.yml` into `~/.code-memory/`, starts **FalkorDB** + **Qdrant**, pulls **`bge-m3`**, and wires the **Claude Code** + **OpenCode** plugins. Idempotent — safe to re-run.

**Docker Desktop is not required.** Any working engine is used as-is; when none is found the installer offers to provision one — **docker-ce inside WSL2** on Windows, **Colima** on macOS — with confirmation at each step. See [Docker without Docker Desktop](#docker-without-docker-desktop).

### ✅ Verify

```bash
code-memory --version
code-memory health
code-memory update --check
```

`health` should print 🟢 for FalkorDB, Qdrant, and Ollama. Then point it at a repo:
`update --check` should list `Docker: FalkorDB (running)` and `Docker: Qdrant (running)` — `(running (via WSL))` on Windows without Docker Desktop — plus your Ollama models. Then point it at a repo:

```bash
code-memory ingest .
Expand All @@ -127,7 +129,7 @@ code-memory ingest .
| | |
| ---------------------------- | --------------------------------------------------------------------- |
| **Python 3.11+** | Orchestrator + CLI runtime |
| **Docker + Compose v2** | FalkorDB (`:6379`) + Qdrant (`:6333`) |
| **Any Docker engine + Compose v2** | FalkorDB (`:6379`) + Qdrant (`:6333`) — docker-ce in WSL2 (Windows), Colima (macOS), docker-ce (Linux), or Docker Desktop. See [Docker without Docker Desktop](#docker-without-docker-desktop) |
| **Ollama** | Long-running embedding daemon (keeps `bge-m3` warm) |
| **Disk ~3 GB · RAM 8 GB+** | 16 GB+ recommended for large repos |
| **OS** | macOS / Linux / Windows (WSL2 **or** native PowerShell) |
Expand All @@ -153,6 +155,8 @@ curl -fsSL https://raw.githubusercontent.com/fmflurry/code-memory/main/install.s
| `--no-claude` | Skip Claude Code marketplace + plugin |
| `--no-opencode` | Skip OpenCode plugin |
| `--no-mcp` | Skip Claude Code MCP server registration |
| `--colima` | macOS: install Colima + docker CLI if no engine found (non-interactive friendly) |
| `--docker-ce` | Linux: install docker-ce via get.docker.com if no engine found |

**Windows** — `iex` doesn't accept args, so download then run:

Expand Down Expand Up @@ -233,7 +237,7 @@ Edit `~/.code-memory/.env` (or `%USERPROFILE%\.code-memory\.env`) to point at re
FALKOR_HOST=falkor.internal
FALKOR_PORT=6379
QDRANT_URL=https://qdrant.internal:6333
OLLAMA_HOST=http://ollama.internal:11434
OLLAMA_URL=http://ollama.internal:11434
```

Re-run the one-liner with `--no-docker --no-ollama` (or `-NoDocker -NoOllama` on Windows).
Expand Down Expand Up @@ -268,6 +272,70 @@ cd code-memory

---

## Docker without Docker Desktop

code-memory needs a docker engine only to run two containers (FalkorDB + Qdrant). **Any engine works** — if Docker Desktop is already on the machine it keeps working unchanged — but you don't need its license: the recommended free setups are **docker-ce inside WSL2** on Windows and **Colima** on macOS. Everything below is what the one-liner installers automate for you (with confirmation at each step).

Detection order everywhere (installers and `code-memory update`): a working `docker` on PATH first, then — Windows only — `wsl -e docker`. Pin a specific distro with `CODEMEMORY_WSL_DISTRO=<name>`.

### 🪟 Windows — docker-ce in WSL2

The one-liner installer (`install.ps1`) offers to provision this automatically when no engine is found. Manual recap:

```powershell
wsl --install # elevated terminal; reboot; create your Linux user
# inside the distro (or via wsl -u root):
wsl -u root sh -c "printf '[boot]\nsystemd=true\n' >> /etc/wsl.conf" # if systemd is off
wsl --shutdown # WARNING: terminates ALL running WSL sessions
wsl -u root sh -c "curl -fsSL https://get.docker.com | sh"
wsl -u root sh -c "usermod -aG docker $(wsl -e whoami); systemctl enable --now docker"
```

- **How commands are routed:** code-memory calls `docker` on the Windows PATH when it answers, otherwise `wsl -e docker`. No TCP exposure of the daemon, no extra config.
- **Ports:** containers published inside WSL2 reach Windows at `127.0.0.1:6333/6379` through WSL's localhost forwarding. If they don't, check `%USERPROFILE%\.wslconfig` — `localhostForwarding` must not be `false`; with `networkingMode=mirrored` make sure the firewall allows those ports.
- **Keepalive (important):** WSL2 shuts the VM down about a minute after the last session detaches — even with systemd services running — which stops dockerd and the containers. Whenever docker is reached through WSL (freshly provisioned or pre-existing), the installer offers a Startup-folder entry (`code-memory-wsl-docker.vbs`, no elevation needed — `schtasks /SC ONLOGON` requires admin) that holds a hidden persistent session (`wsl.exe -e sleep infinity`), keeping the VM — and dockerd — alive; `restart: unless-stopped` brings the `cm-*` containers back whenever dockerd (re)starts. Disable it by deleting that file from `shell:startup`. Without it, any `wsl` command revives everything in a few seconds, but the MCP server/hooks would see connection-refused in between.
- Prefer `127.0.0.1` over `localhost` in `.env` — Windows may resolve `localhost` to IPv6 `::1` while the ports are IPv4-only.

### 🍎 macOS — Colima

```bash
brew install colima docker docker-compose
mkdir -p ~/.docker/cli-plugins
ln -sfn "$(brew --prefix)/opt/docker-compose/bin/docker-compose" ~/.docker/cli-plugins/docker-compose
colima start # big repos: colima start --memory 8
brew services start colima # optional: auto-start at login
```

The symlink exposes brew's compose v2 as the `docker compose` subcommand (code-memory always calls that form). Docker Desktop, if present and running, is used as-is instead.

### 🐧 Linux — docker-ce

```bash
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker "$USER" # re-login (or `newgrp docker`) afterwards
sudo systemctl enable --now docker
```

### 🔀 Switching engines (existing installs)

Moving an existing install off Docker Desktop (e.g. to docker-ce in WSL2):

1. Stop Docker Desktop, make the new engine reachable, then run `code-memory update` (or re-run the installer) — commands are re-routed automatically.
2. On Windows, `update` also rewrites legacy `localhost` defaults in `~/.code-memory/.env` to `127.0.0.1` (previous file kept as `.env.bak`). Old installs shipped `localhost`, which resolves to IPv6 `::1` and can't reach the IPv4-only WSL-forwarded ports.
3. **The code index does not follow** — it lives in docker volumes owned by the old engine. The simplest path is re-ingesting (`code-memory ingest <repo>`); the index is fully rebuilt from your sources, and the episodes/claims SQLite files live on the local disk, unaffected. To carry the Qdrant/FalkorDB volumes over instead, export them with the **old** engine running, then import with the **new** one (the backup dir must be visible to both engines):

```bash
for v in qdrant_data falkor_data; do
docker run --rm -v code-memory_$v:/from -v "$HOME/cm-backup:/backup" alpine tar czf /backup/$v.tgz -C /from .
done
# switch engines, `docker compose up -d` once so the volumes exist, then:
for v in qdrant_data falkor_data; do
docker run --rm -v code-memory_$v:/to -v "$HOME/cm-backup:/backup" alpine tar xzf /backup/$v.tgz -C /to
done
```

---

## Updating

After the initial install, never run the one-liner again — use the built-in updater:
Expand All @@ -286,7 +354,7 @@ code-memory update --bleeding # install CLI from git+main instead of PyPI
| Component | Detection | Refresh action |
| --------------------------- | ------------------------------------------------------ | ------------------------------------------------- |
| **CLI** | `sys.prefix` (uv tool / pipx / pip / editable) | upgrade via the same channel |
| **FalkorDB + Qdrant** | `~/.code-memory/docker/docker-compose.yml` or running | `docker compose pull && up -d` |
| **FalkorDB + Qdrant** | `~/.code-memory/docker/docker-compose.yml` or running | `docker compose pull && up -d` (native docker or `wsl -e docker`) |
| **Ollama models** | present in `ollama list` (`bge-m3`, `gemma2:9b`, …) | `ollama pull <model>` (only for already-pulled) |
| **Claude Code plugin** | `claude plugin list \| grep code-memory` | `claude plugin install … --force` |
| **OpenCode plugin** | `npm ls -g code-memory-opencode` | `npm i -g code-memory-opencode` |
Expand Down Expand Up @@ -792,7 +860,9 @@ code-memory ingest /path/to/repo --full
The Compose file ships a CPU TEI image by default so you can smoke-test
the wiring on a laptop. To enable CUDA on a Linux + NVIDIA host,
uncomment the `deploy.resources.reservations.devices` block in
`docker/docker-compose.yml`.
`docker/docker-compose.yml`. Note: GPU passthrough is not available under
Colima on macOS; TEI-CUDA needs Linux, or WSL2 with the NVIDIA container
toolkit installed inside the distro.

Expected impact on a ~17k-file C# monorepo (~134k chunks):

Expand Down Expand Up @@ -1032,6 +1102,8 @@ What the one-liner actually puts on your machine. Full install commands are in t

### Runtime services (Docker)

Run on any engine — docker-ce in WSL2, Colima, docker-ce, or Docker Desktop ([details](#docker-without-docker-desktop)):

| Service | Image | Purpose |
| ------------- | ----------------------------- | ---------------------------------------------------------- |
| FalkorDB | `falkordb/falkordb:latest` | Redis-protocol graph DB — call/import graph, claim store |
Expand Down
Loading