Sync phase 3: dsh connector, new skills, keyless graph, Origin provenance, hybrid recall - #8
Merged
Merged
Conversation
…ayer agentmemory connect dsh appends an @deepseek-ai/dsh-mcp-client row to $DSH_HOME/cordis.patch.yml (default ~/.dsh), the machine-local patch layer every Harness profile loads, so the MCP tools register as mcp__agentmemory__*. --with-hooks additionally writes the bundled hook manifest (absolute script paths via the codex-hooks merge engine) to $DSH_HOME/agentmemory.hooks.json plus a hooks-claude-code bridge row. Idempotent by marker, --force replaces rows, dry-run supported. util gains shared writeTextAtomic; skills:gen refreshes the agents reference (19 adapters).
Ports both upstream skills: memory-discipline (non-invocable reference for the recall-first / save-at-decision-points session loop) and lesson (user-invocable confidence-weighted correction recording). Skill count 15 -> 17 across every consistency-gated surface: README (invocable 8->9, reference 7->8), AGENTS.md, the three plugin manifests, and the connect summary hint.
mem::graph-extract now always runs the deterministic structural pass (files and concepts on compressed observations name the nodes; co-occurrence is a related_to edge, capped at 12/obs with provenance accumulation on repeated pairs) so the graph populates without an LLM key. The LLM pass layers typed relations on top only when GRAPH_EXTRACTION_ENABLED is set and the provider is real; strict sessions keep keyless extraction but skip external LLM work instead of failing the whole run. Session end fires mem::graph-extract unconditionally and graph functions register unconditionally, so the trigger always resolves. Inline persistence factored into shared persistGraphDelta (name-index upsert, degree bookkeeping, snapshot maintenance) reused by the new mem::graph::import-graphify function and POST /agentmemory/graph/import-graphify route (registerApiTrigger; project required, scope:global admin-gated). Graphify import maps file_type / relation / confidence enums onto memory graph types, caps at 32MiB / 5k nodes / 20k edges with loud truncation reporting, and merges on re-import through the (project,type,name) index.
Adds the immutable Origin block (channel user|agent|tool|import|shared, detail, capturedAt) alongside — not touching — the fork's existing commit-provenance fields. Stamped at capture (observe derives the channel from the hook type: tool hooks -> tool with toolName detail, prompt_submit -> user, lifecycle -> agent), at save (mem::remember -> agent), and at import (mem::import + JSONL replay mark unmarked records via the importOrigin keep-or-mark factory). Both compression paths inherit the raw observation's origin into the compressed record. Regression tests cover stamping, detail threading, dual-path inheritance, and import keep-or-mark.
… indexed lessons, recall hygiene - mem::search ranks through the full BM25+vector+graph fusion when a ranker is injected and the vector index is populated; the primary recall surface was keyword-only while only smart-search got hybrid ranking. Ranker failure falls back to keyword search. Fork reconciliation: project/cwd/agent filters and retrieval-quarantine still apply post-ranking before any limit is taken, so final-page semantics match the keyword path. - fusion normalizes once per query by the best attainable weighted score over streams that actually produced results (the old every-enabled-stream denominator permanently penalized single-stream hits; the graph stream is empty on default installs), plus a small explicit cross-stream agreement bonus. Ordering is deterministic: score, best rank, then id — including the expansion merge. - supersession candidates in mem::remember come from the search index (top-50) once a full rebuild has covered KV.memories (isMemoryIndexReady), with a full-scan fallback while cold; near-miss similarity (0.4-0.7) is reported as an advisory similarTo hint; superseded versions leave both indexes but stay in KV for the version chain. - lessons get a dedicated BM25 index built lazily from one KV list and maintained incrementally on save/strengthen/delete/decay; recall over-fetches under project/confidence filters and reranks by the same confidence x recency composite; import/replay/reset invalidate the cache via resetLessonIndex. - memoryToObservation carries agentId so memories survive agent-scoped filters; shared mock helper gains store access and looseTrigger. - consistency surfaces recomputed for the new route and adapter: README/AGENTS.md/index.ts endpoint counts 136 -> 137, evidence inventory http_routes/host_connectors, r13 test manifest (168 files).
skills:check caught AUTOGEN:rest drift from the new POST /agentmemory/graph/import-graphify route.
input_sha256 covers the new graphify route, dsh connector, and skill set; skills:gen output already committed in 1c304fc.
The ported tests relied on a developer-machine ~/.agentmemory/.env to enable the LLM pass; under the R13 profile (clean temp HOME) the flag was absent and the merge assertions saw heuristic-only output. Pin it in beforeEach like upstream does, restore afterwards, re-stamp the content manifest.
The managed-hook assertion matched the substring 'agentmemory', which only holds when the repo is cloned into a directory literally named agentmemory; worktrees and fork checkouts with other names failed it. Assert the <pluginRoot>/scripts/<hook>.mjs command shape instead — same decoupling upstream applied to resolveProject tests in rohitg00#1138.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 3 of the v0.9.29 sync (follows the merged #5/#7 trains; ports 696cf7a + skills from a2a2af9).
agentmemory connect dshwrites a marker-idempotent MCP row into $DSH_HOME/cordis.patch.yml and an optional hooks bridge row (--with-hooks→ $DSH_HOME/agentmemory.hooks.json through the bundled Claude Code hook scripts). 11 isolated tests.memory-disciplinereference + invocable/lesson; every consistency-gated surface updated.Measured surface changes: REST routes 136→137, host connectors 18→19, skills 17, tools 60 unchanged, tracked tests 162→168 (+47 net-new tests).
Test plan