Skip to content

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

Rust

Merge upstream/HEAD into feat/nix-service

Test17638a0f956f
diff --cc CHANGELOG.md
index 88eab5e3,bf0c92f3..12d2056e
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -7,27 -7,110 +7,130 @@@ and this project adheres to [Semantic V
## [Unreleased]
+### 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 stays on the
+ Linux leg only. (#NNN)
+
+### 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`, and agenix/sops wiring. The existing `flake.nix`
+ package/devShell/CLI build is unchanged. (#NNN)
+
+ ## [2.4.2] - 2026-09-29
+
+ ### Changed
+ - Documented Cheaper Inference as an endpoint for the existing `openai-compat`
+ provider. (#981)
+ - `docs/llm-providers.md` now has a dedicated OpenRouter subsection and a
+ matching row in the recommended-defaults table. The wiring
+ (`openai-compat` + `AI_MEMORY_LLM_BASE_URL=https://openrouter.ai/api/v1`)
+ and the `HTTP-Referer` / `X-Title` app-attribution headers were already
+ shipped, and `docker/.env.production.example` already ships an OpenRouter
+ default, but the provider-facing doc mentioned OpenRouter only inside the
+ generic `openai-compat` row. The new subsection covers a full working
+ env-file, the `openai-compat` embedder path (with a note to verify any
+ provider's `/v1/embeddings` endpoint before relying on it), a pointer to
+ `docs/llm-provider-comparison.md` for model selection, and a security /
+ gotchas block (auth-token requirement for non-loopback binds, env-file
+ hygiene, cheap-model consolidation drift, `:free`-tier shared-pool
+ limits, reasoning-model incompatibility). (#949)
+ - `docs/backup.md` documents the remote-git-mirror backup pattern for a
+ single-user install: what to include, what to exclude (derived SQLite index,
+ models cache, logs, secrets), how to schedule with a `systemd --user` timer,
+ how to restore, and the security posture per `SECURITY.md`, including a
+ "what ends up in your wiki" section that names the exposure (sanitized
+ prompts, tool I/O, page bodies) and lists encrypted-archive alternatives
+ (`age`, `restic`, `borg`, `git-crypt`) for cases where a private mirror
+ repo is not enough. A worked example ships under `docs/examples/backup/`
+ (snapshot script, `.service` and `.timer` unit files, `.gitignore` for
+ the mirror repo). Pointers added from `docs/deploy.md#backups`,
+ `docs/airgapped-install.md`, and the README docs table. The on-box
+ `ai-memory backup --to <tarball>` command
+ (`docs/lifecycle-ops.md#backup`) is unchanged. (#950)
+
+
### Fixed
+ - `observations.title` is now sanitized before it is truncated, not after.
+ `title_hint` used to be cut to 80 chars in `ai-memory-hooks::payload`
+ *before* the sanitizer ever ran, so a secret straddling that cutoff was
+ often left as a fragment too short to match a built-in or `[sanitize]
+ extra_patterns` rule — landing in the title, its FTS index, and every
+ surface that renders titles (session pages, briefings, handoffs, search)
+ unredacted, even though the same observation's body was correctly scrubbed
+ first. `title_hint` extraction now keeps the full first line untruncated;
+ `Sanitized::new` scrubs the title and only then applies the 80-char display
+ cap (`ai_memory_core::sanitize::truncate_for_title`), mirroring the order
+ the body already used. (#982)
+ - The `/web` page view keeps a leading H1 that is not the page title. It
+ dropped the body's first H1 whatever it said, as a duplicate of the title
+ in the header, but a frontmatter `title:` outranks the H1 and a setext H1
+ never names the page, so a heading like `# Token refresh after sleep`
+ under `title: Auth decisions` vanished from the rendered page. An H1 that
+ repeats the title is still dropped. (#967)
+ - `memory_query` now returns `global_scope_hits` (standing `_global` user/team
+ preferences) for a single-project query whose project is named explicitly
+ with `workspace`+`project`, not only when scope is omitted. The routing
+ doctrine tells static MCP clients to pass `workspace`+`project` on every call,
+ which set the old gate's "no named scope" condition to false, so those clients
+ never received global preferences despite the documented contract. The union
+ now keys on single-project resolution (`scopes` empty); only an explicit
+ multi-`scopes` set opts out, and `global=true`/`as_of` are unaffected. The
+ reserved-scope union is still keyed strictly to `_global` and never leaks
+ another project's pages. (#930)
+ - A page file rewritten under `wiki/<ws>/<project>/` (the OKF import path)
+ now gets its new version embedded the same way a brand-new file does.
+ The watcher's `reindex_page` upserted the new version and stopped —
+ embedding only ever ran on the `write_page` API path — so a rewrite left
+ hybrid search silently degraded to FTS-only ranking for that page until
+ someone ran `ai-memory embed` by hand. (#958)
+ - `[capture] ignore_paths` now covers shell commands. Shell tools (`Bash`,
+ `shell`, `execute_bash`, `terminal`, …) were classified as non-file and always
+ kept, so `cat docs/adr/*.md` stored the ignored file's full text in the
+ observation body. The native `ai-memory hook` now splits the command line
+ lexically and drops the event when an argument, resolved from the event's
+ `cwd`, matches an ignored pattern or is a glob that can reach one. Variables,
+ command substitution and commands that name no path are not followed. The
+ marker-file reference also documents excluding large tool results that Claude
+ Code saves and re-reads from `~/.claude/projects/**/tool-results/**`. (#946)
+ - The generated OpenCode, OMP, Pi and OpenClaw integrations now apply the same
+ lexical shell-command `ignore_paths` matching as the native hook, so a `bash`
+ call such as `cat docs/adr/0001.md` is dropped there too instead of being
+ captured. Both matchers now also recognize OpenClaw's and Devin's `exec` shell
+ tool, resolve relative arguments from a shell tool's `workdir` (OpenCode
+ `bash`, OpenClaw `exec`, Codex `shell`) instead of the event cwd, and treat
+ `dir/**` as covering `dir` itself when `dir` holds a glob (`docs/a?r/**`), as
+ the generated plugins already did. Refresh or reinstall generated plugins to
+ pick it up. (#948)
+ - Shell-command `ignore_paths` matching no longer joins an argument vector
+ before splitting it, which broke a path with spaces (`["cat", "private
+ notes/x.md"]`) apart and let one element's stray quote hide the elements
+ after it; each element now counts whole and is split on its own. An invalid
+ `.ai-memory.toml` now makes a shell command metadata-only, like a file tool,
+ instead of keeping its command and output, including one whose command is
+ missing or unparseable (`web_search` runs nothing and is still kept), and the
+ server now does the same when it cannot parse the client's capture marker. A
+ long `bash -lc "<script>"` element is read only as words, not also as one
+ path, so it can no longer exhaust the match budget and drop an innocuous
+ event. Applies to the native hook and the generated plugins; the server
+ accepts the new metadata-only shell form, so upgrade it together with them
+ (an older server drops such an event). (#973)
+ - `ai-memory-importer omc-wiki` now reads the frontmatter of a page saved
+ with CRLF line endings or a UTF-8 BOM, as a wiki checked out on Windows
+ with `core.autocrlf=true` is. It missed the fence, so the page's kind,
+ tier, tags and pin were dropped and the YAML block was imported as the
+ top of the body; the fence check now matches the wiki's own parser.
+ (#970)
- Grok Build CLI tool observations are no longer stored with an empty body.
Grok posts Claude Code's snake_case tool fields (`tool_name` / `tool_input` /
`tool_use_id`), but it was missing from both `closed_tool_agent` and the