Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(nix): align eval checks with escaped service argv
AkitaOnRailsecd2669b34a7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6be36b72..5efc0534 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -38,7 +38,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0secrets (including `llm_headers`) use `ageSecret`, `sopsSecret`, or`environmentFile`. Non-loopback binds require a secret source. The moduleincludes opt-in web, firewall, and resource settings plus eval and privileged- container checks. (#989)+ container checks. Flake packages are exported for x86_64 Linux, aarch64+ Linux, and Apple Silicon macOS; Intel macOS remains available through the+ release tarball and Homebrew rather than the pinned Nixpkgs revision. (#989)- Added `ai-memory doctor` reporting for Claude Code's default native`memory/` store for the current repository: location, file count, and whetherthe nearest marker's `ignore_paths` would exclude a read. Repository-rootdiff --git a/README.md b/README.mdindex b13fb13c..ad94ee44 100644--- a/README.md+++ b/README.md@@ -387,6 +387,9 @@ This flake ships a NixOS module (`nixosModules.default`) with a`MemoryDenyWriteExecute`, `RestrictAddressFamilies`, and the rest — see[`nix/systemd-sandbox.nix`](nix/systemd-sandbox.nix)). Packaged FHS unitsunder `packaging/systemd/` keep their existing lighter hardening.+The flake exports packages for `x86_64-linux`, `aarch64-linux`, and+`aarch64-darwin`. Intel macOS remains supported by the release tarball and+Homebrew, but not by the pinned Nixpkgs revision.```nix{diff --git a/flake.nix b/flake.nixindex c8317b9a..b6d80ca6 100644--- a/flake.nix+++ b/flake.nix@@ -59,7 +59,7 @@# Eval-only NixOS module smoke tests. Kept at the top level under# checks.x86_64-linux only — the eval always targets x86_64-linux, so- # duplicating these under eachDefaultSystem would add noise on Darwin.+ # duplicating these under every package system would add noise on Darwin.ageSopsStub ={ lib, ... }:{@@ -84,6 +84,7 @@modules = [self.nixosModules.defaultageSopsStub+ { system.stateVersion = "25.05"; }extra];};@@ -213,6 +214,7 @@customSc = withCustomDataDir.config.systemd.services.ai-memory.serviceConfig;customTmpfiles = withCustomDataDir.config.systemd.tmpfiles.settings."10-ai-memory";limitsSc = withLimits.config.systemd.services.ai-memory.serviceConfig;+ escapedExecArgs = args: lib.concatStringsSep " " (map builtins.toJSON args);# One NixOS system for the container smoke path. Building its# docker-image tarball builds system.build.toplevel once; there is@@ -264,11 +266,13 @@nixosChecks = {nixos-module-eval =- assert lib.hasInfix "--enable-web" execStart;- assert lib.hasInfix "--bind 127.0.0.1:49374" execStart;- assert lib.hasInfix "--data-dir" execStart;- assert lib.hasInfix " serve " (" " + execStart + " ");- assert lib.hasInfix "--transport http" execStart;+ assert lib.hasInfix (escapedExecArgs [ "--enable-web" ]) execStart;+ assert lib.hasInfix+ (escapedExecArgs [ "--bind" "127.0.0.1:49374" ]) execStart;+ assert lib.hasInfix+ (escapedExecArgs [ "--data-dir" "/var/lib/ai-memory" ]) execStart;+ assert lib.hasInfix+ (escapedExecArgs [ "serve" "--transport" "http" ]) execStart;assert !(disabled.config.systemd.services ? ai-memory);assert enabledSc.MemoryDenyWriteExecute == true;assert enabledSc.RestrictNamespaces == true;@@ -280,7 +284,7 @@assert enabledSc.ProtectSystem == "strict";assert enabledSc.StateDirectory == "ai-memory";assert lib.elem "/var/lib/ai-memory" enabledSc.ReadWritePaths;- assert lib.hasInfix "--config" settingsExec;+ assert lib.hasInfix (escapedExecArgs [ "--config" ]) settingsExec;assert withAge.config.systemd.services.ai-memory.serviceConfig.EnvironmentFile== "/run/agenix/ai-memory-env";assert withSops.config.systemd.services.ai-memory.serviceConfig.EnvironmentFile@@ -292,7 +296,8 @@nonLoopbackFailing;assert lib.any (a: lib.hasInfix "non-loopback bind requires" a.message)localhostFailing;- assert lib.hasInfix "--bind [::1]:49374" ipv6Exec;+ assert lib.hasInfix+ (escapedExecArgs [ "--bind" "[::1]:49374" ]) ipv6Exec;assert lib.any (a: lib.hasInfix "mutually exclusive" a.message) ageSopsFailing;assert lib.any (a: lib.hasInfix "mutually exclusive" a.message)ageEnvironmentFailing;@@ -305,7 +310,9 @@assert lib.elem "/data/custom ai-memory" customSc.ReadWritePaths;assert customTmpfiles."/data/custom ai-memory".d.mode == "0750";assert customTmpfiles."/data/custom ai-memory".d.user == "ai-memory";- assert lib.hasInfix "/data/custom\\x20ai-memory" customSc.ExecStart;+ assert lib.hasInfix+ (escapedExecArgs [ "--data-dir" "/data/custom ai-memory" ])+ customSc.ExecStart;assert lib.elem "network.target" enabledUnit.after;assert !(lib.elem "network-online.target" (enabledUnit.wants or [ ]));assert lib.elem "network-online.target" ageUnit.after;@@ -317,7 +324,11 @@};in- (flake-utils.lib.eachDefaultSystem (+ (flake-utils.lib.eachSystem [+ "x86_64-linux"+ "aarch64-linux"+ "aarch64-darwin"+ ] (system:letpkgs = import nixpkgs {@@ -424,12 +435,12 @@# Additive: a NixOS host can run `services.ai-memory.enable = true` to# get this binary as a hardened systemd service (see# nix/nixos-module.nix). Merged at the top level, not inside- # eachDefaultSystem, because NixOS modules are not system-scoped.+ # eachSystem, because NixOS modules are not system-scoped.nixosModules.default ={ pkgs, lib, ... }:{imports = [ ./nix/nixos-module.nix ];- config.services.ai-memory.package = lib.mkDefault self.packages.${pkgs.system}.default;+ config.services.ai-memory.package = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.default;};checks.x86_64-linux = nixosChecks;diff --git a/nix/nixos-module.nix b/nix/nixos-module.nixindex 9b644a0c..f80af90a 100644--- a/nix/nixos-module.nix+++ b/nix/nixos-module.nix@@ -104,7 +104,8 @@ inThe ai-memory package to run. No default here, so this module staysusable standalone. This repo's `flake.nix` supplies a default via`nixosModules.default`, which sets- `services.ai-memory.package = lib.mkDefault self.packages.${pkgs.system}.default`.+ `services.ai-memory.package = lib.mkDefault+ self.packages.${pkgs.stdenv.hostPlatform.system}.default`.A consumer importing this file directly (bypassing that wrapper)must set this option themselves.'';