Skip to content

Sync phase 3: dsh connector, new skills, keyless graph, Origin provenance, hybrid recall - #8

Merged
ChronodeAi merged 9 commits into
mainfrom
sync/v0.9.29-phase3
Aug 24, 2026
Merged

Sync phase 3: dsh connector, new skills, keyless graph, Origin provenance, hybrid recall#8
ChronodeAi merged 9 commits into
mainfrom
sync/v0.9.29-phase3

Conversation

@ChronodeAi

Copy link
Copy Markdown
Owner

Phase 3 of the v0.9.29 sync (follows the merged #5/#7 trains; ports 696cf7a + skills from a2a2af9).

  • DeepSeek Harness connector: agentmemory connect dsh writes 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.
  • New skills (15→17): memory-discipline reference + invocable /lesson; every consistency-gated surface updated.
  • Keyless graph: deterministic structural pass always runs at session end (project-stamped nodes/edges, fork provenance accumulated); LLM pass still gated behind GRAPH_EXTRACTION_ENABLED + provider + external-processing rules — strict sessions now get local-only extraction instead of hard-failing (security property preserved, reason surfaced as llmSkipped). Adds mem::graph::import-graphify + POST /agentmemory/graph/import-graphify via registerApiTrigger (project required, scope:"global" admin-gated).
  • Write-time Origin provenance (additive): channel user|agent|tool|import|shared stamped at observe/remember/import/replay and inherited through both compression paths; commit-provenance fields untouched.
  • Hybrid recall on the primary path: BM25+vector+graph fusion with per-stream normalization over streams-that-ranked + agreement bonus + deterministic ordering; fork's project/cwd/agentId filters and retrieval-quarantine apply post-ranking BEFORE limits (final-page semantics preserved); superseded versions leave BM25+vector indexes; lesson recall moves to an incrementally maintained BM25 index with generation guard.

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

  • vitest run 1881/1882 (only the pre-existing cli-connect repair failure; profile byte-verified identical to baseline)
  • tsc error set byte-identical to baseline; R13 preflight passes; evidence inventory passes with measured counts; bundles current; skills:check green

…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.
@ChronodeAi
ChronodeAi merged commit 19b24c3 into main Aug 24, 2026
4 checks passed
@ChronodeAi
ChronodeAi deleted the sync/v0.9.29-phase3 branch August 24, 2026 19:29
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.

1 participant