Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge remote-tracking branch 'upstream/release/2.6' into feat/nix-service
Test46d37d63b17a
diff --cc CHANGELOG.mdindex 819023cd,4ce62d08..e8e623e4--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -7,45 -7,123 +7,162 @@@ and this project adheres to [Semantic V## [Unreleased]+### Added+- A NixOS module (`nix/nixos-module.nix`, exposed as `nixosModules.default`)+ so NixOS hosts can run `services.ai-memory.enable = true` as a hardened+ systemd service — dedicated `ai-memory` system user (`nologin`, gated by+ `createUser`) plus a shared systemd sandbox applied to both NixOS and the+ packaged FHS units (`nix/systemd-sandbox.nix`). Typed+ `services.ai-memory.settings` renders declarative `config.toml`; secrets use+ `ageSecret`, `sopsSecret`, or `environmentFile` (required for non-loopback+ binds). The web UI defaults off (`enableWeb = false`, matching the CLI+ flag's own default rather than the packaged unit's hardcoded+ `--enable-web`). `flake.nix` adds eval checks for sandbox keys, settings →+ `--config`, agenix/sops wiring, refusal contracts (age+sops mutex, secrets+ in `settings.auth`, forbidden `settings.bind`), `ExecStart`+ (`--data-dir` / `serve` / `--transport http`), default `StateDirectory` vs+ custom `dataDir` tmpfiles/`ReadWritePaths`, and cheap+ network-online / `openFirewall` / `MemoryMax` / `TasksMax` round-trips.+ `packages.x86_64-linux.nixos-ai-memory-docker` builds one NixOS+ `system.build.toplevel` (via the docker-image rootfs tarball) and+ `scripts/test-nixos-systemd-container.sh` runs a privileged systemd+ container smoke (`systemctl` + in-container `/healthz` + dataDir+ restart/volume persistence) on the Linux `nix.yml` leg. The existing+ `flake.nix` package/devShell/CLI build is unchanged. (#989)++### Changed+- `.github/workflows/nix.yml` now builds the flake on `x86_64-linux` and+ `aarch64-darwin` with `scripts/check-nix-packaging.sh` artifact smoke tests+ (binary, hooks, config template, `nix run`); NixOS module eval and the+ NixOS systemd container smoke stay on the Linux leg only. (#989)++### Fixed+- NixOS systemd container smoke injects a NixOS `PATH` on every+ `docker exec` (`/run/current-system/sw/bin` + profile + `/bin`) so+ `systemctl`/`curl`/`chown` resolve after activation. Bare `chown` under+ `/bin/sh` previously exited 127 once `/healthz` already passed; absolute+ profile paths alone were also missing until activation linked+ `current-system`. Host-side `/healthz` stays in-container because the+ module's default `127.0.0.1` bind is unreachable through Docker+ published ports. (#989)++ ## [2.5.2] - 2026-10-01++ ### Added+ - Added `ai-memory run --jail[=TOGGLES]` and `--no-jail`, and an interactive+ checklist after the `--yolo` ai-jail offer, to choose which ai-jail+ credentials and capabilities the jailed session gets. Bare `--jail` re-runs+ inside ai-jail without asking, using smart defaults: every credential present+ on the host (`~/.config/gh`, `~/.aws`, `~/.kube`, `~/.config/gcloud`,+ `~/.docker/config.json`), SSH when `origin` is an SSH remote, and worktree+ metadata in a linked worktree; host capabilities (`docker`, `gpu`,+ `display`, `pictures`, `tailscale`) stay off, and anything else is left to+ the user's own ai-jail config. `--jail=github,aws,no-mise` is exact: it+ passes every checklist row it does not name as `--no-X`, so a global+ `~/.ai-jail` cannot add to it (`all` and `none` also work); the checklist+ likewise passes unchecked rows as `--no-X`. `--jail` works without `--yolo`+ and in scripts, and fails instead of running unjailed when ai-jail is not+ usable. Only toggles the installed ai-jail advertises in its+ `--help` are offered or passed; the credential mounts need ai-jail 2.5.0.+ ai-jail's security switches (`seccomp`, `landlock`, `private-home`, …) are+ never accepted. `--no-jail` skips the offer while keeping the `--yolo`+ warning. A project `.ai-jail` in the launch directory replaces the checklist+ and the bare-`--jail` defaults (ai-jail loads it under its own trust rules;+ `--jail=…` still applies on top), and every jailed re-run now passes+ `--no-save-config`, so ai-jail no longer writes ai-memory's `--network` /+ `--agent-state` / credential flags into the repository's `.ai-jail`.++ ### Fixed+ - Fixed the shell and PowerShell session-start hooks for Claude Code, Codex,+ Cursor, Gemini CLI, OpenCode, Command Code, Devin, and Antigravity CLI not+ sending the marker's `[briefing]` keys (`briefing`, `briefing_budget`) on the+ handoff request, so a repository with `inject_on_session_start = true` got+ the handoff without its compiled brief on script installs (Docker wrapper,+ `setup-agent`). Only the native `ai-memory hook` command and the Kiro CLI and+ Kimi Code scripts sent them; all now match `docs/marker-file.md`. (#998)+ - Fixed a wiki checkpoint leaving `.git/index` behind the commit it made. A+ path-scoped checkpoint wrote the index file only once every 50 commits, so+ between writes `HEAD` and the working tree held the new page while the index+ still named the old blob, and `git status` from outside the server showed+ every checkpointed page as `MM`; a checkpoint with nothing to commit left a+ stale index the same way. The history itself was always correct. Not specific+ to Windows. (#983, #1006)+ - Fixed a wiki checkpoint failing instead of retrying when a full walk listed a+ file that was gone by the time it was read (libgit2's `Os`-class "failed to+ read file into stream", e.g. an atomic writer's temp file renamed away+ mid-walk). It now takes the same bounded racy-read retry as a file changed+ mid-write; unrelated I/O errors still fail fast. This was also the source of+ an intermittent `concurrent_commits_queue_instead_of_failing` CI failure.++ ### Security+ - Fixed GHSA-gf78-hf8g-vffm: `memory_read_page` with `include_related` returning pages from+ projects the caller cannot read under per-project authorization, and walking+ through them to reach others: in multi-user mode an authenticated user without+ a grant saw the paths, titles, kinds, and project names of pages in a+ `restricted` project up to three hops away (never their bodies). `page_links`+ and the graph already hid them; the multi-hop related walk now filters every+ hop the same way. Installs without authorization, and root, are unchanged.+ (#999)+ - Fixed CLI `ai-memory message send` (`POST /admin/messages/send`) bypassing+ `message_send` admission: it inserted the message without consulting a+ configured webhook's reject policy or notifying observers, while the MCP+ send path enforced both. It now runs admission at the recipient scope before+ the insert — a rejection returns 403 and stores nothing — and notifies+ observers only after a successful commit, without waiting on nonblocking+ ones. (#756)++ ## [2.5.1] - 2026-10-01++ ### Fixed+ - Fixed `ai-memory run --yolo`'s ai-jail re-exec aborting when the wrapped+ command carried a flag that ai-jail also defines: `run claude --yolo --env+ GH_TOKEN=…` failed with "flag --env after command would be passed to the+ child". The invocation now separates ai-jail's sandbox flags from the+ wrapped command with `--`; forwarding such a flag also needs ai-jail 2.4.2 or+ later, whose guard honors the separator.+ - Fixed the `--yolo` ai-jail offer appearing when accepting it could not+ work. It is now shown only on Linux/macOS when both ai-jail and its sandbox+ backend (`bwrap` / `sandbox-exec`) are present — never on Windows, even with a+ file named `ai-jail` on `PATH` — and otherwise the run proceeds without the+ question. The re-exec runs the exact binary that was found, so a+ `~/.local/bin`-only ai-jail no longer fails to exec after the user accepted.+ - Fixed `--true-yolo`. It now implies `--yolo` (the warning, the ai-jail+ offer, and each harness's dangerous mode), so passing it alone no longer+ bypassed Claude's permissions with no warning; it is interchangeable with+ `--yolo` for non-Claude harnesses instead of printing "ignoring it"; and it is+ recognized after native arguments (`run claude --model opus --true-yolo`)+ instead of being passed to Claude as an unknown option. The `claude_true_yolo`+ config key now+ only upgrades an explicit `--yolo`/`--true-yolo` launch, as documented,+ rather than applying `bypassPermissions` to every managed Claude run.+ - Fixed relaunching right after an interrupted `ai-memory run` failing with+ "workstream is already active: owned by … until …" when the previous+ launcher could not release its lease (killed, terminal closed, or an+ ai-jail sandbox torn down). An interactive launch now names the holder and+ waits for that lease to lapse (at most one ~90-second lease; Ctrl-C aborts),+ then starts by itself. A holder that renews the lease meanwhile is reported+ as a launcher still running — never displaced — and non-interactive launches+ keep the short retry window.+ - Fixed `--true-yolo` claiming protections it never provided. It set three+ `CLAUDE_CODE_DISABLE_*RM*` environment variables that Claude Code does not+ read, and passed an empty `permissions.ask` array that cannot clear `ask`+ rules from other settings scopes (Claude Code unions them). Both were+ removed; true-yolo now forces only `bypassPermissions`, and the docs state+ that Claude still honors your own `ask` rules and command-safety checks in+ every mode.++ ### Security+ - Fixed GHSA-vh98: a capture-exclusion candidate or shell argument spelled+ with a leading `//` (e.g. `//repo/secret/token.txt`) self-classified as a+ Windows UNC path regardless of the actual host, so it matched zero POSIX+ `ignore_paths` patterns (a flavor mismatch) and was captured instead of+ dropped. Path flavor for an untrusted candidate is now derived from the+ host (the cwd) rather than the candidate string alone, both in the native+ hook (`ai-memory-hooks` `capture_policy.rs`) and the generated+ OpenCode/OMP/Pi/OpenClaw TypeScript integrations+ (`ai-memory-cli` `render_shared.rs`); a genuine Windows/UNC host's UNC+ candidates are unaffected.+## [2.5.0] - 2026-09-30### Added