Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(wrapper): reach host loopback from Docker CLI

AkitaOnRailsd89be1366a08
diff --git a/CHANGELOG.md b/CHANGELOG.md
index da5ceb26..33f3a214 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -131,6 +131,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
preventing shell-active token/URL fragments.
- OpenClaw's generated plugin now forwards marker-file routing params just like
the OpenCode and OMP generated integrations.
+- The Linux/macOS Docker wrapper now lets thin-client commands such as
+ `status` and `bootstrap` reach the local quick-start server bound on the
+ host's `127.0.0.1:49374`.
## [0.1.3] - 2026-05-24
diff --git a/README.md b/README.md
index 8232b155..7cc334bc 100644
--- a/README.md
+++ b/README.md
@@ -177,6 +177,11 @@ write. The hook scripts are staged into
overwrites them so future image updates ship updated hooks. Drop
`--apply` to print the snippet instead of mutating.
+The Docker wrapper also bridges thin-client commands such as
+`ai-memory status` and `ai-memory bootstrap` back to the host's
+loopback server. With the local Docker quick start above, no
+`AI_MEMORY_SERVER_URL` override is needed.
+
To remove ai-memory later, run `ai-memory uninstall --apply` from the
same host environment. It removes ai-memory-owned config entries and
generated plugin files only after matching their ai-memory signatures;
diff --git a/bin/ai-memory b/bin/ai-memory
index dea2073d..a0614a96 100755
--- a/bin/ai-memory
+++ b/bin/ai-memory
@@ -15,6 +15,9 @@
# AI_MEMORY_DOCKER docker command (default: docker; e.g. "podman")
# AI_MEMORY_DATA_VOLUME named volume mounted at /data (default: ai-memory-data)
# AI_MEMORY_DATA_DIR host path to bind-mount at /data instead (rare)
+# AI_MEMORY_SERVER_URL server URL for thin-client commands; if unset,
+# the wrapper reaches the host loopback server
+# started by the README quick start.
# AI_MEMORY_NO_TTY=1 force non-interactive even on a real tty
# AI_MEMORY_NO_VERSION_CHECK=1 skip the once-per-day update check
set -euo pipefail
@@ -226,6 +229,25 @@ do
fi
done
+# The wrapper itself runs the CLI inside a short-lived helper container, while
+# the README server runs in the long-lived ai-memory container and publishes
+# 127.0.0.1:49374 on the host. Inside a normal bridge-network helper,
+# 127.0.0.1 would mean "this helper container", so thin-client commands like
+# `status` and `bootstrap` could not reach the default server.
+NETWORK_ARGS=()
+case "$(uname -s 2>/dev/null || true)" in
+ Linux)
+ if [ -z "${AI_MEMORY_SERVER_URL:-}" ]; then
+ NETWORK_ARGS=(--network host)
+ fi
+ ;;
+ Darwin)
+ if [ -z "${AI_MEMORY_SERVER_URL:-}" ]; then
+ ENV_ARGS+=(-e "AI_MEMORY_SERVER_URL=http://host.docker.internal:49374")
+ fi
+ ;;
+esac
+
# Mount the data dir at /data so commands that open the store
# (status, bootstrap, search, write-page, lint, embed, …) see the
# same content the server sees. Bind-mount a host path if the user
@@ -258,6 +280,7 @@ fi
# `commands::resolve_project_name` helper checks this env var first
# and falls back to the cwd basename only if it's unset.
exec "${DOCKER}" run --rm "${TTY_ARGS[@]}" \
+ "${NETWORK_ARGS[@]}" \
-v "${HOME}:${HOME}" \
-v "${PWD}:/work" \
-w /work \
diff --git a/docs/install.md b/docs/install.md
index b22007b5..5e208c2f 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -444,16 +444,16 @@ project's existing history into seed pages so the first session has
warm context.
```bash
-docker run --rm \
- -v ai-memory-data:/data \
- -v "$PWD:/repo" \
- -e AI_MEMORY_AUTH_TOKEN="$TOKEN" \
- -e AI_MEMORY_LLM_PROVIDER=anthropic \
- -e ANTHROPIC_API_KEY=sk-ant-... \
- akitaonrails/ai-memory:latest \
- bootstrap --repo-path /repo
+cd /path/to/project
+ai-memory bootstrap
```
+If you installed the Docker wrapper from the quick start and started the
+server on `127.0.0.1:49374`, the wrapper automatically reaches that host
+loopback server from its short-lived helper container. Set
+`AI_MEMORY_SERVER_URL=http://<server>:49374` only when the server is
+remote or uses a custom host/port.
+
**What gets ingested by default:**
| Source | Priority (dropped first when over budget) |
@@ -497,7 +497,7 @@ which sources would actually be sent + how many tokens that
represents. Output is JSON to stdout.
```bash
-docker run --rm -v "$PWD:/repo" ... bootstrap --repo-path /repo --dry-run
+ai-memory bootstrap --dry-run
{
"sources_collected": 117,
"sources_sent": 22,
@@ -546,6 +546,12 @@ ai-memory install-mcp --client claude-code --apply
ai-memory install-hooks --agent claude-code --apply
```
+The installed Docker wrapper runs CLI commands inside a short-lived
+helper container. For local loopback servers, it automatically bridges
+that helper back to the host's `127.0.0.1:49374`, so `ai-memory status`,
+`ai-memory search`, and `ai-memory bootstrap` work with the same default
+URL as the generated agent config.
+
### Docker compose alternative
If you prefer compose, clone the repo and run: