Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge remote-tracking branch 'refs/remotes/audit-open/1541'
AkitaOnRails57d9055ebabb
diff --cc CHANGELOG.mdindex 93da810d,00e5e23d..8e7c3b1d--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -285,66 -223,12 +285,72 @@@ version in [`docs/changelog/`](docs/charelay and wiki sync companions take the same `rustls-webpki` bump.### Fixed+- An empty structured answer from a Responses-API model is now reported as+ empty content rather than a JSON parse error. The `opencode`, `openai-oauth`+ and `codex` paths defaulted a missing `output_text` to an empty string and+ handed it to the parser, so the operator saw `serde: EOF while parsing a+ value at line 1 column 0`, naming neither the model nor the cause.+ ([#1529](https://github.com/akitaonrails/ai-memory/pull/1529))+- Detected `core.hooksPath` when a git config set it on the same physical+ line as the `[core]` section header, so `ai-memory-wikisync install-hook`+ no longer writes a `.git/hooks/post-merge` that git would never run.+ ([#1530](https://github.com/akitaonrails/ai-memory/pull/1530))+- Counted a file's final line in `ai-memory-wikisync` diff summaries when it+ does not end in a newline, so the `bytes/lines` figures no longer contradict+ the `first difference at line N` printed beside them.+ ([#1531](https://github.com/akitaonrails/ai-memory/pull/1531))+- `ai-memory run` now refuses an `--env`/`--env-file` entry whose key carries+ whitespace. `--env-file` lines are trimmed as a whole, not per half, so the+ common dotenv spelling `KEY = value` produced a key with a trailing space —+ an entry no shell or harness can read, so the override silently did nothing.+ ([#1532](https://github.com/akitaonrails/ai-memory/pull/1532))+- Discovered a repository page whose `--include` family names a bare top-level+ page (`README.md`), which `ai-memory-wikisync sync` previously left out of the+ repository side entirely, so a newly created one was never imported.+ ([#1533](https://github.com/akitaonrails/ai-memory/pull/1533))+- A Copilot `/responses` answer stopped by `max_output_tokens` is now reported+ as a truncated response naming the model and its output-token count, instead+ of an unexpected response shape reading "no error detail" — `error` is null+ on an incomplete answer, so nothing explained the stop and the class implied+ an unparseable reply rather than a `max_tokens` to raise.+ ([#1534](https://github.com/akitaonrails/ai-memory/pull/1534))+- Omitted TTL-expired pages from the page count in `memory_briefing` and+ `memory_explore`. Every page list in a briefing already hid them, and the+ project cards have since 3.1.x, so a project with an expired page reported+ more latest pages than any list in the same response could show. The+ all-versions total is unchanged, as is `ai-memory status`.+ ([#1535](https://github.com/akitaonrails/ai-memory/pull/1535))+++- `memory_read_page` now reads a blank `path` or `query` as omitted, as its+ sibling arguments already do. An empty or whitespace-only `query` searched+ for an empty FTS expression and reported the inevitable miss as an internal+ error (-32603), which a looping client reads as "retry"; an empty `path`+ failed as "invalid path: empty path" and never tried the `query` passed+ beside it. Both now reach the instructive "exactly one of `path` or `query`"+ refusal, and a blank `path` beside a real `query` runs the search.+ ([#1536](https://github.com/akitaonrails/ai-memory/pull/1536))+- Reported a wiki page renamed away with an external tool, which arrives as a+ rename event rather than a removal, so the next auto-commit drops it from the+ tree instead of leaving a checkpoint naming a page that no longer exists.+ ([#1537](https://github.com/akitaonrails/ai-memory/pull/1537))+- Omitted TTL-expired pages from the 7- and 30-day activity counters in+ `memory_briefing`. A page written with a short TTL made a project look+ active while the brief's own recent-page list was empty, which is the+ signal an agent uses to decide how much context to pull. Session and+ observation counters have no TTL and are unchanged.+ ([#1539](https://github.com/akitaonrails/ai-memory/pull/1539))++- Kept a literal `<mark>` tag from a page's own text out of a search snippet's+ markup, so it no longer renders as an unbalanced opening tag that highlights+ the rest of the excerpt as if it were a query match.+ ([#1540](https://github.com/akitaonrails/ai-memory/pull/1540))+ - `install.ps1` now refuses a plain-http GitHub release base. The scheme check+ sat inside a condition whose arms already implied https, so it could never+ fire, and an `http://github.com/...` base matched neither arm and skipped it+ entirely — while the archive and its checksum are fetched from that same+ origin, so the checksum proved nothing against an on-path rewrite.+ ([#1541](https://github.com/akitaonrails/ai-memory/pull/1541))- Memory health no longer counts a link from a superseded or TTL-expired pageversion as a reference. A page whose only inbound link was removed by a lateredit was reported as linked, because the old version's `links` row survivesdiff --cc crates/ai-memory-cli/tests/suite/packaging.rsindex af3dab7d,78fe1c73..c0f605b1--- a/crates/ai-memory-cli/tests/suite/packaging.rs+++ b/crates/ai-memory-cli/tests/suite/packaging.rs@@@ -741,6 -741,33 +741,32 @@@ fn install_ps1_keeps_its_safety_checks();assert_eq!(script.trim_end().lines().last(), Some("Install-AiMemory"));assert!(!script.contains("raw.githubusercontent.com"));++ // A plain-http GitHub base must be refused, and the refusal must not be+ // nested inside a branch that already requires https. That nesting is what+ // made it unreachable: both arms of+ // `$base -eq $defaultBase -or StartsWith('https://github.com/')` imply+ // `https://`, so the inner `-not StartsWith('https://')` could never fire,+ // and an `http://github.com/...` base matched neither arm and skipped the+ // check entirely.- assert!(- script.contains(r"^http://github\.com"),- "install.ps1 must refuse a plain-http GitHub release base"- );++ assert!(script.contains("[Uri]::TryCreate($base"));++ assert!(script.contains("$baseUri.Scheme -eq 'http'"));++ assert!(script.contains("$baseUri.Host.TrimEnd('.') -eq 'github.com'"));+ assert!(+ !script.contains("StartsWith('https://github.com/'"),+ "the GitHub refusal must not be gated on an https-only branch again"+ );+ assert!(+ script.contains("refusing a non-https GitHub URL"),+ "the refusal keeps its operator-facing message"+ );+ // Scoped to GitHub on purpose: `tests/install_ps1.ps1` serves its fixture+ // releases over plain http from loopback, and the header documents a+ // non-GitHub base as the operator's own trust decision.+ assert!(+ !script.contains("-match '(?i)^http://'"),+ "refusing every plain-http base would break the loopback test harness"+ );}#[test]diff --cc install.ps1index 557048f2,c4cf09ed..95f5e2b1--- a/install.ps1+++ b/install.ps1@@@ -49,8 -49,15 +49,18 @@@ function Install-AiMemory}$base = if ($env:AI_MEMORY_RELEASE_BASE_URL) { $env:AI_MEMORY_RELEASE_BASE_URL.TrimEnd('/') } else { $defaultBase }- if ($base -eq $defaultBase -or $base.StartsWith('https://github.com/', [StringComparison]::OrdinalIgnoreCase)) {- if (-not $base.StartsWith('https://', [StringComparison]::OrdinalIgnoreCase)) { Fail "refusing a non-https GitHub URL: $base" }+ # The archive and its `.sha256` come from the same origin, so a plain-http+ # GitHub base lets an on-path rewrite replace both and the checksum proves+ # nothing. The previous guard was nested inside a condition whose two arms+ # (the default base, or an https GitHub prefix) each already implied https,+ # so its inner scheme test could never fire — and a plain-http GitHub base+ # matched neither arm, so it skipped the check altogether. A non-GitHub+ # base stays the operator's trust decision, as the header documents.- if ($base -match '(?i)^http://github\.com(/|$)') {++ $baseUri = $null++ if ([Uri]::TryCreate($base, [UriKind]::Absolute, [ref]$baseUri) -and++ $baseUri.Scheme -eq 'http' -and++ $baseUri.Host.TrimEnd('.') -eq 'github.com') {+ Fail "refusing a non-https GitHub URL: $base"}$version = $env:AI_MEMORY_VERSIONif ($version) {