Skip to content

Add GitHub Copilot CLI support - #1

Open
Random-Word wants to merge 70 commits into
mainfrom
feature/copilot-cli-support
Open

Random-Word wants to merge 70 commits into
mainfrom
feature/copilot-cli-support

Conversation

@Random-Word

@Random-Word Random-Word commented May 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • adds a GitHub Copilot CLI plugin manifest, MCP config, and hook config
  • adds agentmemory connect copilot-cli for MCP-only setup, including COPILOT_HOME and Windows-safe command handling
  • normalizes Copilot hook payload shapes and adds focused tests for plugin/install behavior

Validation

This PR is against the fork only for review before deciding whether to open the upstream PR.

Random-Word and others added 6 commits May 18, 2026 19:45
- plugin/.plugin/plugin.json: Copilot manifest with name/version/skills/mcpServers/hooks refs
- plugin/.mcp.copilot.json: MCP server config with type:local, npx, env passthrough, tools:[*]
- plugin/hooks/hooks.copilot.json: Copilot hooks (version:1) with 11 supported events and PreToolUse matcher
- test/copilot-plugin.test.ts: 11 tests covering manifest, MCP config, and hooks validation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds Copilot CLI support through a root plugin manifest, Copilot-specific MCP and hook configuration, and a connect adapter for MCP-only setup.

Includes Windows-safe Copilot MCP command generation, COPILOT_HOME handling, Copilot hook payload normalization, generated hook scripts, and targeted tests for plugin shape, hook execution, and connect behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Random-Word

Copy link
Copy Markdown
Owner Author

Reopening to trigger CI after workflows were registered on the fork.

@Random-Word

Copy link
Copy Markdown
Owner Author

CI probe complete; closing fork-local PR.

@Random-Word Random-Word reopened this May 19, 2026
@Random-Word Random-Word changed the title Test Copilot CLI support CI Add GitHub Copilot CLI support May 19, 2026
@Random-Word
Random-Word requested a review from Copilot May 19, 2026 08:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GitHub Copilot CLI as a supported agent. Introduces a new plugin/plugin.json manifest plus Copilot-specific MCP and hooks config, a new copilot-cli connect adapter (with COPILOT_HOME support and Windows-safe command handling), and normalizes hook payload handling to also accept Copilot's camelCase field names (e.g. sessionId, toolName, toolArgs, userPrompt, errorMessage, notificationType, tool_result/toolResult). Adds focused tests for the plugin manifest, hooks config, hook scripts, and the new adapter.

Changes:

  • New Copilot plugin manifest + .mcp.copilot.json + hooks/hooks.copilot.json and a new copilot-cli connect adapter (allowed on Windows).
  • All Claude/Codex hook scripts and their TS sources now read both snake_case and camelCase payload fields; pre-tool-use switches to lowercase tool matching with create/view added; post-tool-use falls back to tool_result/toolResult.text_result_for_llm.
  • README/AGENTS/CLI help updated; new test/copilot-plugin.test.ts and Copilot-adapter tests in test/cli-connect.test.ts.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
plugin/plugin.json New top-level Copilot plugin manifest.
plugin/.mcp.copilot.json Copilot MCP server block (npx -y @agentmemory/mcp).
plugin/hooks/hooks.copilot.json Copilot hook event registrations.
plugin/scripts/*.mjs Built hook scripts updated to accept Copilot camelCase fields.
src/hooks/*.ts Source hooks updated in parallel for camelCase compatibility.
src/cli/connect/copilot-cli.ts New connect adapter for ~/.copilot/mcp-config.json.
src/cli/connect/util.ts Adds AGENTMEMORY_COPILOT_MCP_BLOCK with Windows-safe command.
src/cli/connect/index.ts Registers adapter; allows copilot-cli on Windows.
src/cli.ts Updates help text to list copilot-cli.
README.md / AGENTS.md Document new agent and update maintenance checklists.
test/cli-connect.test.ts Tests for new adapter and adapter count.
test/copilot-plugin.test.ts New tests for plugin manifest, MCP config, hooks, and hook scripts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugin/plugin.json Outdated
{
"name": "agentmemory",
"version": "0.9.20",
"description": "Persistent memory for AI coding agents -- captures tool usage, compresses via LLM, injects context into future sessions. 12 hooks, 53 MCP tools, 4 skills, real-time viewer.",
Random-Word and others added 13 commits May 19, 2026 02:04
Addresses upstream AI review suggestions by aligning the Copilot preToolUse matcher with the hook allowlist, narrowing hook payload fields at runtime, normalizing subagent fallbacks, and tightening hook config validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Includes GitHub Copilot CLI in the first-run agent picker and adds a regression test so the Copilot setup path remains discoverable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Detect Copilot CLI environment markers during first-run setup so pressing Enter wires the current agent instead of the historical Claude Code default.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Accept Content-Length framed JSON-RPC messages in addition to the existing newline-delimited transport so Copilot CLI can initialize the standalone MCP server.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ohitg00#517)

The viewer's five search inputs (graph, memories, lessons, actions,
crystals) destroy and recreate their input DOM via innerHTML on every
keystroke, which interrupts active IME composition sessions and makes
non-Latin input (Chinese, Japanese, Korean) unusable.

Additionally, the viewer's CSP includes script-src-attr 'none', which
silently blocks the inline oninput=/onchange= handlers on the lessons,
actions, and crystals panels. Those three search/filter controls have
been non-functional under the strict CSP.

This patch:

1. Adds a bindImeSafeSearch helper that guards on both an explicit
   compositionstart/compositionend flag and event.isComposing.
   compositionend triggers an immediate commit and sets a
   justCommitted one-shot flag to suppress the redundant trailing
   input event that browsers dispatch after compositionend.

2. Adds captureSearchFocus/restoreSearchFocus helpers to preserve
   focus and cursor position across innerHTML rebuilds, so multi-word
   IME input doesn't require clicking back into the search box after
   each commit.

3. Migrates all five search inputs to addEventListener via the new
   helpers, removing the CSP-blocked inline handlers on lessons,
   actions, and crystals. The actions panel's status filter <select>
   is also migrated for the same reason.

4. Unifies debounce delay to 200ms across all five panels.

Verified via:
- 8/8 jsdom + synthetic CompositionEvent regression cases (ASCII
  debounce, IME composing suppresses input, compositionend immediate
  commit + justCommitted suppression, post-IME ASCII resumes, fast
  typing coalesces, composition cancel returns to idle).
- 8/8 manual browser cases on Windows + Chrome (Chinese pinyin commit,
  multi-word IME without re-focusing, English regression, all five
  panels, zero CSP violations in DevTools, cursor position retained).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: 이민재 <19909783+honor2030@users.noreply.github.com>
Co-authored-by: honor2030 <19909783+honor2030@users.noreply.github.com>
…oken_budget (rohitg00#507) (rohitg00#516)

* fix(mcp): route memory_recall to /agentmemory/search and forward format/token_budget

memory_recall and memory_smart_search were sharing the smart-search
endpoint, which always returns compact mode and silently drops the
format and token_budget parameters that the tool schema advertises.
Split the cases so memory_recall hits /agentmemory/search (which
honors format) while memory_smart_search keeps its own endpoint.
Default format to "full" for memory_recall so the documented behavior
matches the wire call.

Signed-off-by: serhiizghama <zmrser@gmail.com>

* test(mcp): cover memory_recall endpoint, format forwarding, and defaults

Two new proxy tests for issue rohitg00#507: one asserts memory_recall calls
POST /agentmemory/search with the format and token_budget fields,
and never falls through to smart-search; the other pins the default
format to "full" when the caller omits it.

Signed-off-by: serhiizghama <zmrser@gmail.com>

---------

Signed-off-by: serhiizghama <zmrser@gmail.com>
…hitg00#1660 shipped) (rohitg00#546)

v0.9.19 (rohitg00#460 / commit bb259ac) routed the first-run iii-console
install through `bash -s -- --next` to dodge the upstream tag-prefix
bug at iii-hq/iii#1652. Upstream PR iii-hq/iii#1660 fixed the bug on
2026-05-19 — installer's jq filter now accepts both `iii/v...` and
bare `v...` tags, and `-v X.Y.Z` falls back gracefully.

`install.iii.dev/console/main/install.sh` is a thin proxy serving
`raw.githubusercontent.com/iii-hq/iii/main/console/install.sh` with
a 5-minute CDN cache — verified byte-for-byte that the live URL
already serves the post-rohitg00#1660 fix. No iii release tag needed.

Switch agentmemory back to the canonical bare invocation:

  curl -fsSL https://install.iii.dev/console/main/install.sh | sh

Drops the workaround comment block (10 lines) explaining the prior
detour. v0.9.19/v0.9.20 users on the `--next` path will still
resolve a valid release (next-release lookup also handles
`iii/v...-next.*` correctly post-rohitg00#1660), so this isn't a forced
upgrade.

1038/1038 tests pass.
…ce (rohitg00#545)

* feat(repo): add Sponsor button + GH Packages mirror for sidebar surface

Three additions that make the repo page surface clearer + give users
a single place to fund the project:

1. `.github/FUNDING.yml` — `github: [rohitg00]` renders the "Sponsor"
   button at the top of the repo + the Sponsor widget in the right
   sidebar. Requires GitHub Sponsors to be enabled at
   github.com/sponsors/accounts on the rohitg00 profile before the
   link resolves (currently 404s — enable before merging this PR).

2. `.github/workflows/publish.yml` — new `publish-github-packages`
   job runs after the existing public-npm publish completes.
   Republishes the main package as `@rohitg00/agentmemory` to
   `npm.pkg.github.com`. The repo's right-sidebar "Packages" widget
   only surfaces packages on GitHub Packages, not packages on the
   public npm registry, so this is what makes the sidebar widget
   non-empty. Public npm remains the canonical install source;
   GH Packages is purely a discovery surface.

   - Uses built-in GITHUB_TOKEN, no new secrets needed.
   - Rewrites package.json `name` + `publishConfig` in-runner via a
     small node one-liner, publishes, then restores the original so
     main isn't permanently scope-changed.
   - Skip-on-already-published guard mirrors the existing public
     publish steps.
   - Marked `|| echo "non-fatal"` so a GH Packages hiccup never blocks
     the canonical npm release.
   - `permissions: packages: write` added at workflow level.

3. README badge row — added `npm downloads`, `GitHub Packages mirror`,
   and `Sponsor rohitg00 on GitHub Sponsors` badges alongside the
   existing `npm version` / `CI` / `License` / `Stars` row. The
   sponsor badge is the same link the FUNDING.yml sidebar widget
   uses; surfacing it in-README means readers who don't notice the
   sidebar still see it.

Out of scope (asked, declined):
- Docker Hub / ghcr.io publish workflow. Not in this PR.

* ci(publish): scope write perms per-job + persist-credentials false

Inline review on rohitg00#545 flagged that the workflow-level permissions
block granted `id-token: write` + `packages: write` to every job,
including ones that don't need them. Tightened to least-privilege:

- Workflow-level: only `contents: read`.
- `publish` job: adds `id-token: write` (required for `npm publish
  --provenance` to mint a Sigstore OIDC token). The GH Packages
  job doesn't inherit this.
- `publish-github-packages` job: adds `packages: write` (required
  to push to npm.pkg.github.com). The public-npm publish job
  doesn't inherit this.

Both `actions/checkout@v6` calls also pick up `persist-credentials:
false`. The publish steps never push back to the repo, so the
GITHUB_TOKEN doesn't need to land in `.git/config` after checkout.
Same posture both jobs.

Skipped from the same review pass:

- **Pin actions to commit SHAs.** Industry rule but introduces real
  maintenance friction — Renovate/Dependabot don't auto-bump
  SHA-pinned actions to new minors, so SHA pinning trades easy
  semver tracking for stale-action drift. We stay on `@v6` major-tag
  pins (GitHub publishes those via verified moving refs).
- **Disable setup-node cache.** `actions/setup-node@v6` defaults to
  cache-off (the `cache:` input is opt-in). `package-manager-cache`
  only auto-enables when `package.json` has a `packageManager` field
  — agentmemory's doesn't (verified via `grep`). The fix is a no-op
  on this workflow.
…tg00#547)

Sponsor button still missing from the repo page despite rohitg00#545 merging.
The committed FUNDING.yml started with 4 lines of `#` comments before
the canonical `github: [rohitg00]` directive. GitHub's FUNDING parser
documents only the canonical key-value form; leading comments
shouldn't break it but some users have reported indexer lag when the
file starts with non-data lines. Strip to the bare single-line form
to match the documented schema and remove any ambiguity.

Sponsor profile is enabled (github.com/sponsors/rohitg00 returns 200
+ 'Sponsor @rohitg00' button), so the only remaining gap is GitHub's
side-bar indexing. Tightening the file forces a re-parse.
…ohitg00#548)

Reverting the GH Packages publish from rohitg00#545. GH Packages is a
separate registry from npmjs.com — anyone installing
`@rohitg00/agentmemory` from `npm.pkg.github.com` needs to point
their registry there and authenticate, which is friction users
don't have on the canonical `@agentmemory/agentmemory` install
from public npm.

The right-sidebar Packages widget on the repo page was the only
motivation for the mirror. Acceptable to leave it empty — the
single canonical install path is the better DX.

- Drop `publish-github-packages` job from `.github/workflows/publish.yml`
- Drop `packages: write` perm wording from the workflow comment block
- Remove "GitHub Packages mirror" badge from README

Manual follow-up (post-merge): delete the already-published
`@rohitg00/agentmemory@0.9.20` from GH Packages registry via
github.com/users/rohitg00/packages/npm/agentmemory/settings → Delete.
…#549)

GitHub auto-renders the "Sponsor this project" widget in the
right sidebar from .github/FUNDING.yml (Sponsor button + heart icon
+ "Learn more about GitHub Sponsors" link). The README badge was
redundant noise on the top badge row.

Sidebar widget is the canonical surface — one path, one click.
Rex57 and others added 30 commits May 20, 2026 21:47
Signed-off-by: Nanami <Rex57@users.noreply.github.com>
Co-authored-by: Nanami <Rex57@users.noreply.github.com>
Add explicit height: 48px and flex-shrink: 0 to .tab-bar to prevent
dimension shifts caused by overflow-x scroll state changes on tab switch.

Closes rohitg00#324

Co-authored-by: hungtd <hungtd@appota.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…uard (rohitg00#588)

Three concerns surfaced when auditing PRs merged since v0.9.21:

1) Graph parser regex from rohitg00#494 was correct for self-closing tags ONLY
   when they're the only entity in the document. With a self-closing
   entity followed by an explicit-close entity, the greedy `[^>]*` ate
   the trailing `/` of the self-close, the alternation fell through to
   the explicit-close branch, and `[\s\S]*?` ran ahead to the *next*
   `</entity>` — merging two entity declarations into one match and
   silently dropping a node. Switch to lazy `[^>]*?` so the
   self-closing alternation gets first chance. Test from rohitg00#494 (which
   was failing on main but I didn't notice) now passes.

2) rohitg00#386 shipped `${AGENTMEMORY_URL}` / `${AGENTMEMORY_SECRET}`
   placeholders in plugin/.mcp.json. Claude Code and Cursor expand
   those at MCP launch time; some hosts pass the literal string
   through. A truthy literal `"${AGENTMEMORY_URL}"` defeats the
   existing `|| DEFAULT_URL` fallback and would have the shim POST to
   `${AGENTMEMORY_URL}/agentmemory/...` (DNS failure). Add a
   defensive guard in src/mcp/rest-proxy.ts that strips any value of
   the form `${...}` so the fallback engages. Mirror in
   src/mcp/standalone.ts's mode-announce log line.

3) CHANGELOG entries for all PRs landed since v0.9.21 (rohitg00#321, rohitg00#325,
   rohitg00#386, rohitg00#454, rohitg00#494, rohitg00#526, rohitg00#542, rohitg00#560, rohitg00#561, rohitg00#562, rohitg00#564, rohitg00#567) plus
   the regex + env-guard hardening here.

Validation:
- npm test → 98 files, 1091 tests pass
- npm pack → 142 files, fresh install clean, iii-sdk@0.11.2 pinned,
  plugin/ shipped with hooks/scripts/skills/opencode/
- New test file covers 8 placeholder cases (unset, empty,
  `${VAR}` literal, mismatched braces, real values with $,
  unclosed `${`, no-braces `$VAR`).
…g00#508) (rohitg00#581)

* fix(docs): correct codex plugin install command

Codex's plugin CLI (codex-rs/cli/src/plugin_cmd.rs) exposes:

  codex plugin add <PLUGIN>[@<MARKETPLACE>]
  codex plugin list
  codex plugin remove <PLUGIN>
  codex plugin marketplace <add|upgrade|remove>

It does NOT have a `codex plugin install` subcommand. Users following
the README would hit:

  error: unrecognized subcommand 'install'

Fix two callsites that documented the wrong command:

  - README.md: top-level Codex install snippet + agent matrix row
  - src/cli/connect/codex.ts: final info hint after `agentmemory connect codex`

CHANGELOG history is left alone since those entries reference what the
README said at the time and rewriting history is not the right move.

Slash-command references like `/plugin install agentmemory` inside
Claude Code are unrelated and remain — that's Claude Code's slash API,
not the codex CLI.

* fix(claude-code): --with-hooks installs version-stable hooks for MCP-standalone users

When agentmemory is wired into Claude Code through the MCP-standalone
path (registering `@agentmemory/mcp` in `~/.claude.json` rather than
running `/plugin install agentmemory`), Claude Code never resolves
`${CLAUDE_PLUGIN_ROOT}`. Users have to copy hook commands into
`~/.claude/settings.json` with absolute paths, and those paths embed
the agentmemory version. Every npm upgrade silently breaks all 9 hooks
— MCP keeps working, so `memory_diagnose` stays green while
auto-capture is dead.

Adds the same `--with-hooks` flag the codex adapter already has:

  agentmemory connect claude-code --with-hooks

Resolves `${CLAUDE_PLUGIN_ROOT}` to the absolute bundled plugin/ path
at install time and merges the entries from `plugin/hooks/hooks.json`
into `~/.claude/settings.json`'s top-level `hooks` field. Idempotent
re-install via the `<pluginRoot>/scripts/` substring (mirrors the
codex-hooks pattern from rohitg00#564). Unrelated user hooks survive.

Reuses `findPluginRoot` + `buildMergedHooks` from codex-hooks.ts;
`buildMergedHooks` now takes an explicit manifest filename
(`hooks.codex.json` for codex, `hooks.json` for claude-code) so the
Claude-only events (`SessionEnd`, `SubagentStop`, `Notification`,
`TaskCompleted`, `PostToolUseFailure`) come through.

Also makes the adapter run the hooks branch even when MCP is already
wired — hooks and MCP are independent surfaces.

README: new "Claude Code without the plugin install" subsection
documents the trade-off + points at the recommended `/plugin install`
path first.

Tests (1086) + build pass; 5 new unit tests cover Claude-event
presence, path rewrite, user-hook preservation, idempotent re-install.
…rohitg00#580)

Codex's plugin CLI (codex-rs/cli/src/plugin_cmd.rs) exposes:

  codex plugin add <PLUGIN>[@<MARKETPLACE>]
  codex plugin list
  codex plugin remove <PLUGIN>
  codex plugin marketplace <add|upgrade|remove>

It does NOT have a `codex plugin install` subcommand. Users following
the README would hit:

  error: unrecognized subcommand 'install'

Fix two callsites that documented the wrong command:

  - README.md: top-level Codex install snippet + agent matrix row
  - src/cli/connect/codex.ts: final info hint after `agentmemory connect codex`

CHANGELOG history is left alone since those entries reference what the
README said at the time and rewriting history is not the right move.

Slash-command references like `/plugin install agentmemory` inside
Claude Code are unrelated and remain — that's Claude Code's slash API,
not the codex CLI.
…ohitg00#579)

Codex does not fire a separate SessionEnd event, so its Stop hook is
the only signal we get when a Codex session terminates. The current
stop hook only POSTs /agentmemory/summarize, leaving the session row
stuck on status:"active" in the viewer for Codex users (rohitg00#493).

Stop now ALSO POSTs /agentmemory/session/end, best-effort with a
short 5s timeout. For Claude Code this is a harmless idempotent second
call (session-end.mjs runs on the dedicated SessionEnd hook and sets
the same endedAt + status fields). For Codex it's the only path that
closes the lifecycle.

Tests (1081) + build pass. plugin/scripts/stop.mjs regenerated by tsdown.
…g + Graphify (rohitg00#641)

Adds docs/recipes/pairings.md walking through how agentmemory pairs with
three projects that ship the rest of the AI coding agent context layer:

- codegraph: pre-indexed code knowledge graph (MCP server)
- Understand Anything: multi-agent code-graph build + interactive dashboard
- Graphify: knowledge graph across code + docs + PDFs + images + videos

Doc includes a unified MCP config snippet, question-routing table mapping
question shapes to the right tool, install order for a new project, and
a pointer to eval/runner/adapters/ for anyone who wants to publish a
cross-project benchmark adapter.

Main README gets a one-line pointer to the recipe under the existing
benchmarks section.
) (rohitg00#643)

Hermes was reporting agentmemory as Missing/not-available even when the
service was running fine and live sessions could use it. Root cause:
`hermes memory status` reads os.environ in the Hermes CLI process. When
agentmemory is launched by systemd (or any process manager that loads
~/.agentmemory/.env via EnvironmentFile=), those values never reach the
interactive shell. Our plugin already preloads ~/.agentmemory/.env via
setdefault, but only catches uncommented key=value lines. Users whose
.env file has AGENTMEMORY_URL commented out (because it matches the
default http://localhost:3111) end up with the var unset, and Hermes
reports Missing.

Fix: after preload, os.environ.setdefault('AGENTMEMORY_URL',
DEFAULT_BASE_URL). Guarantees the var is set to the documented default
so Hermes status reflects the real runtime. Anything explicit from the
shell or .env still wins (setdefault is no-op when value is present).

AGENTMEMORY_SECRET stays untouched — it's optional per the config
schema.
* fix: remove deleted memories from vector indices

* fix: flush index persistence after delete to survive hard exits

* test(search): cover SearchIndex.remove + delete-path index cleanup

* fix: flush index persistence synchronously on delete

* test: cover all delete paths and fix persistence-mock leak
…ohitg00#638 rohitg00#431 rohitg00#544 rohitg00#563 (rohitg00#648)

* fix(multi): stability pass for rohitg00#627 rohitg00#640 rohitg00#474 rohitg00#638 rohitg00#431 rohitg00#544 rohitg00#563

Six issues, one PR. Each lands with a targeted regression test;
1119/1119 vitest pass.

rohitg00#627 OpenAI thinking-model fallback
  src/providers/openai.ts now reads message.reasoning_content alongside
  message.reasoning. DeepSeek V4 / Qwen3 / GLM / Kimi return the
  underscored field — previously compress silently failed (0/700 calls)
  and the circuit breaker tripped.

rohitg00#640 + rohitg00#474 stop reaps the worker process
  src/index.ts writes ~/.agentmemory/worker.pid on registerWorker, clears
  it on graceful shutdown. src/cli.ts runStop now reads the worker pidfile
  and signals SIGTERM alongside the engine pids. Fixes both: the daemon
  wrapper surviving stop (rohitg00#640) and the iii engine retaining stale
  function registrations because the worker reconnected to the new
  engine (rohitg00#474).

rohitg00#638 OpenCode session implicit-create on observe
  src/functions/observe.ts now creates the session record on the first
  observation when project + cwd are present and no session exists.
  OpenCode plugins (and any caller that skips POST /session/start) no
  longer leak observations into a session memory_sessions never lists,
  and summarize stops bailing with 'Session not found'.

rohitg00#431 OpenCode auto-context (zero-config injection)
  plugin/opencode/agentmemory-capture.ts captures the context returned
  by POST /session/start into a per-session cache. The existing
  experimental.chat.system.transform hook now reads from the cache
  first, falls back to /context. Cleanup on session.deleted.

rohitg00#544 paginated /memories + /export
  src/triggers/api.ts adds three query modes to /memories:
    ?count=true       — totals only, viewer status badge
    ?limit=N&offset=M — paged slice, default unlimited
  /export now forwards maxSessions + offset query params to mem::export
  (which already supported them). Viewer dashboard caps the memories
  fetch at 500; the memories tab at 2000. Both stop the iii invocation
  timeout from masking real corpora as 0 memories.

rohitg00#563 viewer graph cool-down on >1000 nodes
  src/viewer/index.html adds tick-decayed damping (coolBoost), per-node
  velocity caps tiered by node count, and quiescence-based raf parking.
  Mousedown wakes the parked loop. Dense graphs settle instead of
  bouncing forever; CPU returns to idle once the layout is quiet.

rohitg00#637 Windows em-dash ByteString — deferred to follow-up
  Cannot reproduce on macOS / Linux. The user-suggested defensive
  encoding fix is unsafe without a Windows repro confirming the actual
  exception path. Will land separately once a Windows runner or the
  reporter can validate.

* fix(multi): address review findings on PR rohitg00#648

Addresses inline review on PR rohitg00#648 — verified each finding against
current code and fixed the still-valid ones.

opencode plugin: snapshot activeSessionId into a local 'sessionId'
before await postJson('/session/start') — a second session.created
event during the await could rebind activeSessionId and cache the
context against the wrong key. The cache write + observe call now use
the snapshotted id.

src/cli.ts: clearWorkerPidfile() now runs in every stop branch:
  - Docker engine-not-running early return
  - Docker stopDockerEngine path
  - native engine-not-running 'Nothing to stop'
  - native happy path (was already there)
The worker pid is now read up front so the engine-down branch can also
reap an orphaned worker process (previously fell through to 'preserve
for manual cleanup'). A new dedicated branch reaps the worker and
exits cleanly when only the worker is lingering.

src/viewer/index.html: wakeGraphSim() shared helper consolidates the
quietTicks reset + raf restart pattern. Wheel handler, zoomGraph(),
recenterGraph(), and mousedown all now wake the parked simulation so
zoom/pan/click feedback is immediate after the layout has settled.
graphSim object initializes quietTicks: 0 alongside tickCount: 0.

src/functions/observe.ts: dedupe new Date().toISOString() into a
single 'ts' local for the implicit-create path so startedAt and
updatedAt stay consistent.

test/opencode-auto-context.test.ts: regex updated to assert the
snapshot-then-cache pattern instead of the previous direct
activeSessionId reference.

1119/1119 vitest pass.
…itg00#649)

Three user-blocking bugs in one PR. Each lands with regression tests.

rohitg00#631 npm install ERESOLVE — bumped @anthropic-ai/sdk from ^0.39.0 to
^0.93.0 so claude-agent-sdk's peer requirement (>=0.93.0) is satisfied
without --legacy-peer-deps. AnthropicProvider only uses messages.create
which is API-stable from v0.3x onward; no code change needed.

rohitg00#646 + rohitg00#628 base URL handling — appendOpenAIRoute() now detects the
base path shape instead of unconditionally prepending /v1/:
  - Empty path: still /v1/<route> (OpenAI default unchanged)
  - Path ends with /v1: append <route> directly (DeepSeek, SiliconFlow,
    vLLM, LM Studio, Ollama — all use OPENAI_BASE_URL=.../v1)
  - Path has any other versioned segment: append directly (Zhipu uses
    /api/paas/v4, never wanted /v1/ injected)
Azure paths unchanged — they have their own builders.

rohitg00#625 CLAUDE_MEMORY_BRIDGE wrong path — loadClaudeBridgeConfig() now
matches Claude Code's actual slug convention:
  ~/.claude/projects/<slug>/MEMORY.md
where <slug> preserves the leading - on POSIX absolute paths and has
no /memory/ subdirectory. Old code stripped the leading - and added
/memory/ so the bridge silently wrote a file Claude never read.

Test coverage:
  - test/openai-shared.test.ts: +5 cases (DeepSeek /v1, Zhipu /v4,
    trailing slash, localhost vLLM/Ollama)
  - test/claude-bridge-path.test.ts: 5 new tests (POSIX leading -,
    no memory/ subdir, disabled, no project path, Windows backslash)
  - 1146/1146 vitest pass, no regressions.
…nifest (rohitg00#650)

* fix(mcp): full 51-tool surface by default + env defaults in plugin manifest

Two user-blocking MCP issues, single root surface.

rohitg00#510 Claude Code drops the agentmemory MCP server silently when
AGENTMEMORY_URL is unset. Per Claude Code MCP docs: 'If a required
environment variable is not set and has no default value, Claude Code
will fail to parse the config' — and a parse failure removes the server
from /reload-plugins output with no warning. plugin/.mcp.json now uses
${VAR:-default} form for AGENTMEMORY_URL, AGENTMEMORY_SECRET, and
AGENTMEMORY_TOOLS so fresh installs Just Work without exporting envs.

rohitg00#553 OpenCode (and Claude Code, and Codex) saw 8 tools instead of the
51 every plugin manifest advertises. getVisibleTools() defaulted to
AGENTMEMORY_TOOLS=core which capped at 8 ESSENTIAL_TOOLS. README has
always said '51 MCP tools' — the default now matches the advertising.
AGENTMEMORY_TOOLS=core still available for users who want the lean set.

CLI help text and existing codex-plugin test updated to the new
contract. New test/mcp-surface-default.test.ts adds 4 regression cases
covering default, all, core, and the env-default form in the plugin
manifest.

1141/1141 vitest pass.

* fix(connect): apply same env defaults to wired-in MCP block

PR rohitg00#650 fixed plugin/.mcp.json but not src/cli/connect/util.ts —
`npx @agentmemory/agentmemory connect` (Cursor, Gemini CLI, Windsurf,
all JSON-MCP agents) was still writing ${VAR} form into user configs,
keeping rohitg00#510 unfixed on every non-Claude-Code-plugin path. util.ts now
ships the same ${VAR:-default} form with AGENTMEMORY_TOOLS=all.
Codex TOML adapter already used a literal URL — unaffected. Hermes
connect just prints YAML guidance — unaffected.

test/cli-connect.test.ts: updated existing assertion to the new
contract.
…ohitg00#651)

Three new connect adapters and a Port Mapping section in README.

rohitg00#647 Qwen Code (~/.qwen/settings.json) — standard mcpServers shape.
Qwen's 16-event hook system reuses Claude Code's payload field names
(session_id, cwd, tool_name, tool_input, tool_response), so the
existing compiled hook scripts run against Qwen without modification.
Plugin extension support (qwen-extension.json) is a separate follow-up.

rohitg00#614 Antigravity (mcp_config.json under platform-specific User dir)
— standard mcpServers shape. Gemini CLI is scheduled to stop serving
Pro/Ultra/Code-Assist requests 2026-06-18 per Google's announcement;
Antigravity is the GA replacement.

rohitg00#618 Kiro (~/.kiro/settings/mcp.json) — standard mcpServers shape.
Workspace-level overrides live in .kiro/settings/mcp.json next to the
code; we wire user-level by default.

All three use the shared json-mcp-adapter, so they inherit the
${VAR:-default} env block from PR rohitg00#650.

rohitg00#629 Port docs — README now has a Ports table under Configuration:
3111 REST, 3112 streams, 3113 viewer, 49134 engine WS. Env overrides
called out. Stale-process cleanup recipe for macOS/Linux/Windows.

Test coverage:
  - test/connect-new-agents.test.ts: 6 cases (detect + install +
    env-default form for each agent, plus a registry-membership check)
  - test/cli-connect.test.ts: bumped agent count 8 → 11
  - 1156/1156 vitest pass

Docs fetched first via context7:
  - Qwen Code docs (qwenlm.github.io/qwen-code-docs)
  - Kiro CLI docs (kiro.dev/docs/cli/mcp)
  - Antigravity docs (settings file layout)
…ohitg00#654)

* feat(scope): AGENT_ID multi-agent isolation; docs(cost,supply-chain)

Three Tier 4 issues, one PR.

rohitg00#554 AGENT_ID multi-agent memory isolation
  - New AGENT_ID env (trimmed, length-capped at 128 chars).
  - loadAgentScope() + getAgentId() helpers in src/config.ts.
  - Session interface gets optional agentId field; api::session::start
    stamps it from request body or env. Request body wins for
    multi-agent runtimes routing many roles through one server.
  - Memory interface gets optional agentId field; mem::remember stamps
    it on every new memory using the same body-wins/env-fallback rule.
  - api::memories filters by AGENT_ID env by default; ?agentId=<role>
    overrides per-request, ?agentId=* opts out of the env scope.
  - Smart-search intentionally NOT touched — filtering observation
    hits would be N+1 KV lookups; this can land in a follow-up if
    needed. Memory-level filter via /memories is enough for the
    primary multi-agent-isolation use case.
  - 7 new regression tests.

rohitg00#613 LLM cost-tier docs + runtime warning
  - When OPENROUTER_MODEL matches the premium pattern
    (sonnet/opus/gpt-4o-non-mini/gpt-4-turbo), boot prints a one-shot
    warning with cheap alternatives and a suppress flag
    (AGENTMEMORY_SUPPRESS_COST_WARNING=1).
  - README adds a 'Cost-aware model selection' table with measured
    workload data (635 reqs / 888K tokens / 35h): Sonnet ~$5 vs
    DeepSeek-V4-Pro ~$0.46. Sources linked.

rohitg00#540 supply-chain policy in SECURITY.md
  - Documents why agentmemory does not commit a lockfile (dist/ ships
    pre-built, install path does not compile from source) and what
    monitoring we do (Dependabot, full test suite cross-platform per
    PR, optionalDependencies guarded behind try/catch import).
  - Recommends shrinkwrap workflow for users running agentmemory
    inside hardened pipelines.

1163/1163 vitest pass.

* feat(scope): observation-level agentId + isolated-mode recall filter

Extends the AGENT_ID work from the previous commit to close the
cross-agent recall leak end-to-end.

New env: AGENTMEMORY_AGENT_SCOPE ("shared" default, "isolated" opt-in).
Shared keeps the audit trail; isolated also restricts recall paths.

Type changes:
- RawObservation.agentId + CompressedObservation.agentId — every
  observation now carries the role of the session that wrote it.
- AgentScope.mode (shared | isolated).

Stamping:
- mem::observe: inherits agentId from the parent session (or env
  AGENT_ID for the implicit-create path from rohitg00#638). One KV.get on the
  session is reused for both observationCount + agentId so no extra
  read.
- mem::compress (LLM path): copies agentId from the source raw.
- buildSyntheticCompression: same, on the zero-LLM compression path.

Filtering in isolated mode (or when ?agentId=<role> passed):
- mem::smart-search: filters hybrid results post-search.
- /agentmemory/memories: filter + ?includeOrphans=true for pre-tag rows.
- /agentmemory/observations: filter on the session listing.
- /agentmemory/sessions: filter sessions list.

Shared mode bypasses all filters but still tags every write — auditable
without breaking cross-role context. "?agentId=*" is the universal
opt-out at every endpoint.

Tests bumped to 1167/1167.

* test(agent-id): add edge cases for body agentId trim/cap/fallback

Three new cases on the existing remember/agentId test block:
- whitespace-padded body trimmed to canonical form
- >128 char body truncated to 128
- whitespace-only body falls through to env AGENT_ID
- bonus: empty-string body + no env still leaves agentId undefined

1171/1171 vitest pass.

* fix(agent-id): cross-agent leak in expand/count, over-fetch, normalize, comments

Six review findings, all valid against current code.

1. observe.ts: existingSession?.agentId ?? getAgentId() retroactively
   scoped unscoped sessions when AGENT_ID was set later. Switched to
   existingSession ? existingSession.agentId : getAgentId() so env
   fallback only fires on the implicit-create path.

2. smart-search.ts: expandIds branch returned early before any agent
   filter, leaking cross-agent observations. Moved filterAgentId
   computation up front; expanded results now filter through the same
   wildcardAgent / explicitAgentId / isolated-fallback logic.

3. smart-search.ts: hybrid searcher can't filter by agentId (BM25 /
   vector indexes don't carry it), so unfiltered top-limit hits could
   drop in-scope matches. Over-fetch limit*3 (capped 300) when a
   filter is active, then trim to limit post-filter.

4. api.ts /memories /sessions /observations: normalize agentId query
   param before wildcard check so '*' with stray whitespace matches
   correctly; same trim+wildcard logic in all three endpoints.

5. api.ts /memories count=true: returned unfiltered totals despite
   filtered being computed earlier. Now returns filtered.length and
   filtered.filter(latest).length so count matches the scope the list
   path would apply.

6. config.ts: premium-model warning fires every detectProvider call.
   Added module-level warnPremiumModelShown flag so the message
   prints once per process.

7. types.ts: trimmed multi-paragraph agentId comments per
   one-line-max rule. Long rationale lives in the PR + README.

test/memories-pagination.test.ts: bumped the count assertion to
match filtered.length instead of memories.length.

1171/1171 vitest pass.
Bump version across package.json + plugin manifests + version.ts +
types.ts ExportFormat union + export-import allow-list.

Strip issue-number stamps (// #NNN:) from new-wave source + test
files. CHANGELOG.md v0.9.22 entry bundles every PR merged since
v0.9.21 across Fixed / Added / Docs / Infrastructure.

1171/1171 vitest pass.
* docs(readme): refresh counts + version refs for v0.9.22

- 51 MCP tools → 53 (actual getAllTools() count)
- 4 skills → 8 (recall, remember, session-history, forget, recap,
  handoff, commit-context, commit-history)
- Embedded path example v0.9.21 → v0.9.22
- 'New in v0.9.0' callout replaced with v0.9.22 highlights
- Plugin manifest descriptions bumped to match (53 tools, 8 skills)

No code changes; 1171/1171 tests still pass.

* docs(readme): refresh gist counts, third-party logos, tool-count refs, stat SVGs

- gist badge: 1200/172 to 1.3k/182 (current live counts)
- stat-tools.svg + light: 43 to 53 MCP tools
- stat-tests.svg + light: 950+ to 1171+ tests
- Claude / Cursor / Windsurf logos: switched off brittle third-party hosts (matthiasroder.com, freelogovectors.net, exafunction.github.io) to github.com/<org>.png redirects
- all 51 memory tools to 53 in OpenClaw + Hermes setup prompts
- full 51-tool surface to 53 in MCP shim vs full-server callout
- Extended tools (51 total) to 53 in MCP table summary

* docs(readme): swap Cursor/Windsurf/OpenCode logos to svgl.app brand SVGs

github.com/<org>.png pulled personal avatars (getcursor ghost mascot, Exafunction green box, opencode-ai org icon) instead of product logos. svgl.app library serves the actual brand SVGs with light/dark variants — use <picture> with prefers-color-scheme for theme-aware rendering.
* docs(readme): ko-KR + es-ES + pt-BR translations

* docs(readme): zh-CN + zh-TW + ja-JP translations

* docs(readme): tr-TR + hi-IN translations

* docs(readme): fr-FR + de-DE + ru-RU translations

* docs(readme): language picker for 11 translated locales

Adds top-of-README link row to READMEs/README.{locale}.md files. 11 translations land alongside: zh-CN, zh-TW, ja-JP, ko-KR, es-ES, pt-BR, fr-FR, de-DE, ru-RU, tr-TR, hi-IN.

* docs(readme): label bare fences as text + fix repo-root paths in de/fr/ru

MD040: add 'text' language tag to the 5 prose-only fenced blocks (lines 431, 482, 507, 705, 738) in source README and propagated to all 11 translations.

Path: de-DE, fr-FR, ru-RU had md links + html href/src to repo-root paths (integrations/, docs/, eval/, benchmark/, src/, deploy/, plugin/, examples/, CHANGELOG, LICENSE, assets/) without ../ prefix — files live in READMEs/, so paths resolved one level too high. Prepended ../ on all matched refs.

Reviewer-flagged ko-KR path issue verified false-positive: that file already had ../ prefix from initial translation.
…rohitg00#677)

* feat(connect): Warp adapter + skills surface via Claude Code plugin

Warp stores MCP config at ~/.warp/.mcp.json with the same mcpServers schema as Claude Code, so the shared createJsonMcpAdapter wires it in 17 lines. Adds Warp to the connect surface (12 adapters total) and the README agents grid.

Native-citizen second-class win: Warp's skill discovery already scans .claude/skills/ — installing the existing agentmemory Claude Code plugin makes the 8 memory skills (remember, recall, recap, handoff, forget, commit-context, commit-history, session-history) appear in Warp's slash-command palette with zero extra wiring.

Tests bumped: ADAPTERS.length 11 -> 12, knownAgents includes 'warp', new connect-new-agents Warp install case.

* feat(connect): Cline + Continue.dev + Zed + Droid adapters

ADAPTERS bumped 12 -> 16. Schemas verified via context7 (Cline, Continue, Goose) + WebFetch (Zed, Droid).

- Cline: ~/.cline/mcp.json, same Claude-style mcpServers wrapper.
- Droid (Factory.ai): ~/.factory/mcp.json, same mcpServers wrapper with optional type:stdio per entry.
- Zed: ~/.config/zed/settings.json, uses 'context_servers' key (NOT mcpServers); createJsonMcpAdapter now accepts wrapperKey override.
- Continue.dev: ~/.continue/config.json, mcpServers is an ARRAY of named entries (not object) — custom adapter writes array form.

Goose deferred — its YAML config uses 'extensions:' with 'cmd' (not 'command') and adding a YAML dep for one adapter isn't worth it. README documents the manual path (goose configure → Add Extension → MCP).

Tests: 8 new install + detect cases under connect-new-agents.test.ts. ADAPTERS.length 12 -> 16. All 1181 unit tests pass.

* fix(connect): droid type:stdio required field + continue yaml-first

Doc verification flagged two real schema bugs in the prior commit:

1. Droid (Factory.ai): docs.factory.ai/cli/configuration/mcp specifies 'type' as REQUIRED for stdio servers ('Either stdio or http'). Previous entry was missing it — Droid would reject the agentmemory block at parse time. Extended createJsonMcpAdapter with optional extraEntryFields; droid sets type:'stdio'.

2. Continue.dev: config.yaml takes precedence over config.json per docs.continue.dev/reference/yaml-migration. config.json is deprecated and ignored when yaml is present. Prior adapter wrote to config.json blindly which would no-op on modern Continue installs.

   New three-branch logic:
   - yaml exists -> stub result with copy-pasteable block (refuses silent yaml mutation, no YAML dep in tree)
   - json exists (legacy only) -> modify in place
   - neither -> create fresh config.yaml via hand-rolled emitter (safe since no existing content to preserve)

Zed (~/.config/zed/settings.json), Cline (~/.cline/mcp.json), Warp (~/.warp/.mcp.json) paths re-verified against current docs — all correct.

* fix(connect): coderabbit feedback — grid, dead ternary, yaml message

Three of four CodeRabbit findings on PR rohitg00#677 verified valid + fixed:

- README agents grid was 9 cells x 12.5% = 112.5% on row 2 — overflow. Moved Warp to a fresh row 3.
- src/cli/connect/zed.ts had an isMac ternary returning the same path on both branches (dead code). Collapsed to one constant.
- src/cli/connect/continue.ts yaml-stub message said 'under mcpServers:' but the printed snippet already includes the top-level mcpServers: key. Reworded to 'merge this block' and explicitly noted the snippet's own top-level key, so users with an existing mcpServers list append rather than duplicate.

Skipped (one): test harness mutates HOME but not USERPROFILE. Adapter detect uses node:os homedir() which reads USERPROFILE on Windows. Connect command explicitly refuses to run on Windows (platform()==='win32' early-exit), so the Windows path isn't exercised. Pre-existing pattern across all connect tests.
* feat: add project field to Memory and scope write paths

* fix: filter enrich and search by project, block cross-project memory leakage

* feat: backfill memory project field and add diagnostic coverage check

* fix: address review

* fix: address reviews
The doctor's auto-install command for iii-console pointed at install.iii.dev/console/main/install.sh which 404s. The actual install route is install.iii.dev/iii/main/install.sh — the iii installer ships the console alongside the engine.
…g00#678) (rohitg00#682)

Two related bugs from v0.9.22:

1. The 7 `api::slot-*` HTTP triggers were registered unconditionally while
   their SDK counterparts (`mem::slot-*`) gate on `isSlotsEnabled()`. With
   the flag off the route existed but the handler didn't, so any GET
   /agentmemory/slots returned 500 with body
   `{error: "[object Object]"}`. Each handler now checks
   isSlotsEnabled() up front and returns 503 with the same
   flag/enableHow/docsHref shape as graphDisabledResponse +
   consolidationDisabledResponse. slot-reflect additionally gates on
   isReflectEnabled.

2. isSlotsEnabled() and isReflectEnabled() read `process.env` directly so
   values loaded from ~/.agentmemory/.env never reached them. Switched
   both to getEnvVar() which goes through getMergedEnv() like the rest of
   src/config.ts. Users setting AGENTMEMORY_SLOTS=true in the dotfile now
   see the flag honoured.

Regression tests in test/slots-flag-gate.test.ts cover both branches
(`.env`-only flag set + process.env winning over .env).
closes rohitg00#587, rohitg00#584) (rohitg00#683)

Buffer.from(b64, 'base64') returns a slice of Node's shared 8KB pool, and new Float32Array(buf.buffer) ignores byteOffset/byteLength — minting a 2048-element view over the entire pool. Same hazard on the encode side when the source Float32Array is itself a sub-view (e.g. .subarray() or a typed-array set into a larger buffer).

The encode path now passes byteOffset/byteLength explicitly; decode mints the view at the correct offset with length scaled by Float32Array.BYTES_PER_ELEMENT.

Reported as 'dimensions seen on disk: 2048' index-startup crashes in rohitg00#455 / rohitg00#469 / rohitg00#584 / rohitg00#587.

Two regression tests added:
- 384-dim x 5 vectors round-trip (within pool threshold, hits the decode bug)
- subarray sub-view encode (hits the encode bug)
…oses rohitg00#635) (rohitg00#685)

Previous parser hard-coded attribute order: type-before-name on <entity>, type/source/target/weight on <relationship>. Codex CLI's LLM frequently emits attrs in a different order (name first, source/target before type), and any deviation caused the whole tag to silently drop — graph extraction returned 0 nodes for an entire run.

Replaced both regexes with an order-independent two-pass approach:
- Tiny parseAttrs() reads any key="value" pair in any order
- entitySelfClose + entityWithBody patterns separate the two tag shapes (preserving the rohitg00#494 fix where greedy attr-matching swallowed trailing / and merged adjacent entities)
- Relationship matcher now reads source/target/type/weight from parsed attrs, falls back to weight=0.5 on missing or non-finite, requires type+source+target present to emit the edge

Regression test: <entity name=... type=...> + <relationship source=... target=... type=...> shape that previously dropped to zero nodes/edges. 7/7 graph tests pass.
* fix: defensive null guards on Memory.sessionIds across read + import paths

Memory.sessionIds is declared as string[] but JSONL imports + older on-disk records can carry undefined for it. Four read-side callsites accessed memory.sessionIds[0] directly, which would throw when sessionIds is missing. Switched to optional-chaining (memory.sessionIds?.[0] ?? "memory") in: src/index.ts (BM25 rebuild), src/state/memory-utils.ts (memoryToObservation), src/functions/remember.ts (vector add), src/functions/search.ts (rebuild loop). Import side in src/functions/export-import.ts now normalises Memory.sessionIds to [] when it arrives non-array, so downstream readers can rely on the field being present after import.

* docs(export-import): trim sessionIds-normalise comment to one-line WHY
…NG_API_KEY (rohitg00#503)

* fix(embed): allow separate OPENAI_EMBEDDING_BASE_URL + OPENAI_EMBEDDING_API_KEY

The OpenAI-compat embedding provider previously read OPENAI_BASE_URL and
OPENAI_API_KEY only, which the chat-LLM path (src/providers/openai.ts)
also reads. That couples both calls to the same endpoint — so operators
who want, say, chat completions on a fast hosted provider (Novita /
DeepInfra) and embeddings on a self-hosted vLLM cluster (Qwen3-Embedding-8B
on a dedicated GPU) had to either move both to the same endpoint or run
agentmemory against a single provider with whatever embedding model it
happens to expose.

Add two embedding-scoped overrides with fallback to the existing vars:

  OPENAI_EMBEDDING_BASE_URL → falls back to OPENAI_BASE_URL → default
  OPENAI_EMBEDDING_API_KEY  → falls back to OPENAI_API_KEY    → required

The fallback chain keeps existing setups working without any .env
changes. New setups can mix and match — common patterns:

  # vLLM (self-hosted GPU, free, batchable) for embeddings + Novita (DeepSeek V4 Flash) for chat
  OPENAI_BASE_URL=https://api.novita.ai/v3/openai
  OPENAI_API_KEY=sk-novita-...
  OPENAI_EMBEDDING_BASE_URL=https://embed.your.lan
  OPENAI_EMBEDDING_API_KEY=local-no-auth    # endpoints that ignore Authorization
  OPENAI_EMBEDDING_MODEL=Qwen3-Embedding-8B
  OPENAI_EMBEDDING_DIMENSIONS=4096

  # Local Ollama for embeddings + remote for chat
  OPENAI_BASE_URL=https://api.openai.com
  OPENAI_API_KEY=sk-...
  OPENAI_EMBEDDING_BASE_URL=http://localhost:11434
  OPENAI_EMBEDDING_API_KEY=ollama
  OPENAI_EMBEDDING_MODEL=nomic-embed-text

The separate API key matters because most local endpoints
(Ollama / LM Studio / llama.cpp / vLLM) ignore Authorization entirely
but Node fetch still requires a non-empty Bearer token. Setting
OPENAI_EMBEDDING_API_KEY=anything-truthy unblocks that case without
revealing the real OPENAI_API_KEY to whatever's on localhost.

No code-paths other than the embedding provider are touched. Reviewed
against the 17 existing test cases in test/embedding-provider.test.ts;
no regression (the 6 pre-existing failures on main are env-pollution
when ~/.agentmemory/.env has API keys set, unrelated to this change).

* test(embed): clear OPENAI_EMBEDDING_BASE_URL/API_KEY in beforeEach

CodeRabbit nitpick: the embedding-specific env vars take precedence
over OPENAI_BASE_URL/OPENAI_API_KEY in provider config, so a developer
with these set in their shell could see test/host config interfere.
Match what the other ENV cleanup lines already do.
… (rohitg00#687)

* fix(hooks): send repo basename as project, not full path (closes rohitg00#474)

Hooks were sending `data.cwd` (an absolute filesystem path) as the
`project` field on every observe/session/start call. Native sessions,
replay-import, and manual memory_lesson_save calls all use the repo
basename. The mismatch caused auto-injected context to filter out the
bulk of relevant lessons because the path never matches the stored
project name.

Add shared `resolveProject(cwd)` helper:
  1. AGENTMEMORY_PROJECT_NAME env (per-repo escape hatch)
  2. basename of `git rev-parse --show-toplevel` (handles subdirs)
  3. basename of cwd (final fallback when not in a git repo)

Applied to 9 hooks: notification, post-tool-use, post-tool-failure,
prompt-submit, session-start, subagent-start, subagent-stop,
task-completed, pre-compact.

Build: split hook entries into per-entry tsdown configs so each hook
bundles into a fully self-contained .mjs. Previous shared config
hoisted helpers into hashed chunks that changed on every rebuild.

* chore(hooks): drop issue-number ref from resolveProject comment

* chore: trim verbose comments on _project.ts + tsdown.config
…ohitg00#519) (rohitg00#686)

iii-observability worker emits a WARN every time its log subscriber falls behind, and that WARN re-enters the same broadcast stream the subscriber is failing to drain — positive feedback loop that wrote 137 GB to ~/.agentmemory/daemon.log.new on one reporter's laptop in a few days. Root cause sits in the iii binary (Rust upstream), but we can mute the trigger surface from this side.

Two changes:
- iii-config.yaml + iii-config.docker.yaml: sampling_ratio 1.0 → 0.1 and logs_console_output true → false. At 0.1 the subscriber catches up under sustained load; with console off, the WARN line that re-feeds the loop never reaches the amplifying layer.
- src/cli.ts findIiiConfig: precedence reversed so the bundled config no longer wins unconditionally. New order: AGENTMEMORY_III_CONFIG env var > project cwd > ~/.agentmemory/iii-config.yaml > bundled. Users who hit the loop on existing installs now have a documented override path that survives npm i -g upgrades.
…#688)

* perf(hooks): fire-and-forget telemetry hooks (closes rohitg00#573)

Telemetry hooks (notification, post-tool-failure, post-tool-use,
prompt-submit, stop, session-end, subagent-start, subagent-stop,
task-completed) previously `await fetch(..., AbortSignal.timeout(N))`
inside a try/catch. The await kept the hook process alive until the
response arrived — up to N ms per request — which blocks Claude Code's
next-prompt boundary on every assistant turn.

Switch to fire-and-forget:

  fetch(url, { signal: AbortSignal.timeout(N) }).catch(() => {});
  setTimeout(() => process.exit(0), 500).unref();

The unawaited fetch dispatches the request; the unref'd setTimeout
force-exits the process after the request has been flushed to the
local daemon's socket buffer (~500ms is enough). Without the
setTimeout Node keeps the event loop alive waiting for any in-flight
fetch to settle, which means the hook still blocks Claude Code's
next-prompt boundary for up to the AbortSignal duration.

Context-injecting hooks (pre-tool-use, pre-compact, session-start)
still use `await fetch` because Claude Code reads their stdout for
context injection — left untouched.

AGENTS.md updated with the two-pattern guidance.

* chore(hooks): drop verbose comments on fire-and-forget hooks

* fix(hooks): bump stop+session-end exit delay to 1500ms

Multi-request hooks (stop fires 2, session-end up to 4) need more
than 500ms to initiate all fetches when AGENTMEMORY_URL points to a
remote daemon — DNS + TCP + TLS handshakes can eat the budget before
the second/third fetch is even dispatched. Bump to 1500ms on those
two hooks only; single-request hooks keep 500ms.

AGENTS.md updated with the multi-request exception.
The three iii primitives are worker, function, and trigger.
HOOKS/RECALL/CONSOLIDATE are pipeline layers — accurate framing.

- website: "THREE PRIMITIVES." → "THREE LAYERS." (Primitives.tsx)
- website: anchor #primitives → #stack (matches the STACK nav label)
- README: dropped misuse on observability + iii-instance paragraphs;
  kept "three primitives" only where it accurately refers to
  worker/function/trigger.

Translated READMEs (READMEs/*.md) carry the same misuse and will be
synced in a follow-up.
…view fixes

Merge resolution:
- 9 hook source files: composed PR's camelCase payload normalization
  on top of main's resolveProject() + fire-and-forget pattern.
- pre-tool-use: kept both PR's defensive sessionId narrowing and
  main's explicit project handling (data.project, never cwd-as-project).
- src/cli/connect/index.ts: copilotCli alongside cline / continue / zed /
  droid / warp adapters added on main (ADAPTERS now 17 entries).
- test/cli-connect.test.ts: expect 17 adapters, dropped duplicate spec.
- plugin/scripts/*.mjs regenerated via npm run build (no hand-edits).

Review fixes (per rohitg00#534 audit):
- AGENTMEMORY_COPILOT_MCP_BLOCK (src/cli/connect/util.ts) +
  plugin/.mcp.copilot.json: switched env values to ${VAR:-default}
  shape so parse-strict clients don't drop the server when the user
  has no shell export (rohitg00#510 lesson). AGENTMEMORY_TOOLS:all also added.
- plugin/plugin.json: version 0.9.21 -> 0.9.22, skill count 4 -> 8 to
  match plugin/.claude-plugin/plugin.json source of truth.
- Tests updated to assert the new env shape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.