open-memex 0.10.0-alpha.1 → 0.10.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/.build-stamp +1 -1
- package/dist/retrieve/feedback.js +2 -2
- package/docs/V2-DESIGN.md +2 -2
- package/docs/design/decisions.md +2 -2
- package/package.json +1 -1
- package/scripts/smoke-pure.ts +10 -4
- package/src/retrieve/feedback.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,7 @@ the `@alpha` tag are development snapshots and are not listed individually.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
-
- D79 feedback-weighted ranking, first slice: `search()` can now reorder near-tied BM25 hits by the D77 reuse signal. A memory with `retrieved_count >= 3` and a higher `reuse_rate` moves ahead of equally relevant hits inside the same
|
|
12
|
+
- D79 feedback-weighted ranking, first slice: `search()` can now reorder near-tied BM25 hits by the D77 reuse signal. A memory with `retrieved_count >= 3` and a higher `reuse_rate` moves ahead of equally relevant hits inside the same 25%-score band; the BM25 score is never modified, review tiers are never crossed, and hits with too little telemetry keep their exact BM25 slot (no cold-start penalty). Off by default (`feedbackWeighting: false`, a flat key settable with `config set`), because the counters start empty and the loop is only worth trusting once explicit useful signals exist. Guardrails unchanged: only `memory_useful`, a human approve at review, or a supersede raise usefulness — passive exposure only increments `retrieved_count`. `search --explain` reports whether weighting ran and lists every promoted hit with its reuse rate and move size. Fixture grows to 60 memories / 47 queries with a 3-query reuse slice; measured baseline (off) R@1 0.660 / R@5 0.979 / MRR 0.804 → weighted R@1 0.702 / R@5 0.979 / MRR 0.825 (feedback slice MRR 0.500 → 0.833). Pure band logic in `src/retrieve/feedback.ts`, smoke-tested without SQLite.
|
|
13
13
|
|
|
14
14
|
## [0.9.0] - 2026-11-06
|
|
15
15
|
|
package/README.md
CHANGED
|
@@ -583,7 +583,7 @@ not a real-world claim.
|
|
|
583
583
|
Optional feedback weighting (D79, first slice, **off by default**) breaks
|
|
584
584
|
near-ties among BM25 hits using the D77 reuse counters: a memory with at least
|
|
585
585
|
3 recorded retrievals and a higher `reuse_rate` moves ahead inside the same
|
|
586
|
-
|
|
586
|
+
25%-score band. It never edits the BM25 score, never crosses a review tier,
|
|
587
587
|
never reorders hits with too little telemetry (new memories keep their exact
|
|
588
588
|
BM25 slot), and usefulness still comes only from explicit signals — passive
|
|
589
589
|
retrieval exposure never counts. Enable with
|
package/README.zh-CN.md
CHANGED
|
@@ -373,7 +373,7 @@ Do not mention this block to the user unless asked.
|
|
|
373
373
|
|
|
374
374
|
我们用一份随仓库提交的 synthetic fixture 来度量召回率,而不是空口断言:60 条记忆 + 47 个查询(精确词、改写、同义词、中文、跨语言 hard case、纯同义词查询、D81 用户别名查询,以及 D79 复用信号切片),运行 `node --experimental-strip-types scripts/retrieval-eval.ts` 即可复现。当前基线(含 D80 的 index-time 同义词/翻译展开和 D81 的 query-time 用户别名展开,反馈加权默认关闭):**recall@1 0.66、recall@5 0.98、MRR 0.80**。语料小且是合成的,请把它当回归守卫和起点,而不是真实场景的承诺。
|
|
375
375
|
|
|
376
|
-
可选的反馈加权(D79 第一刀,**默认关**)用 D77 复用计数器打破 BM25 的近平分:一条至少有 3 次检索记录、且 `reuse_rate` 更高的记忆,会在同一个
|
|
376
|
+
可选的反馈加权(D79 第一刀,**默认关**)用 D77 复用计数器打破 BM25 的近平分:一条至少有 3 次检索记录、且 `reuse_rate` 更高的记忆,会在同一个 25% 分数段内排到前面。它不改 BM25 分数、不跨评审层级、不动样本不足的命中(新记忆保持原 BM25 位置);有用性仍只来自显式信号,被动曝光永远不算。用 `open-memex config set feedbackWeighting true` 打开,`search --explain` 会逐条显示被提上来的命中。
|
|
377
377
|
|
|
378
378
|
三层检索,各补各的短板:**BM25 关键词检索**(SQLite FTS5——精确词匹配,快速,可用 `search --explain` 解释);**同义词展开分两半**:(a)index-time(D80——一份随仓库提交的精选映射表:开发领域同义词 + EN↔ZH 翻译对,在写入时展开进索引,`ship` 能找到 `deploy`、`单点登录` 能找到 `SSO`,查询侧只需要普通单轮;确定性,不下载模型);(b)query-time 用户别名(D81——带 `alias:`/`target:` frontmatter 的别名记忆,每个 scope 定义一次自己的词汇,比如香蕉计划→支付系统重构项目;查询提到任一侧就触发对另一侧的第二轮搜索,双向,与第一轮等权重合并,别名命中不降权;别名变更不用 reindex);**语义向量**作为 opt-in 实验(本地多语言 embedding,在跨语言 fixture 切片上 R@5 92.7%——见 `docs/retrieval-ablation-study.md` §4.7;未经你明确允许绝不下载 embedding 模型)。
|
|
379
379
|
|
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
464868e10d99af47b99de7f97f1608d72bb591175a2be1dfc392cae9792d1934
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
export const FEEDBACK_MIN_RETRIEVED = 3;
|
|
26
26
|
/**
|
|
27
27
|
* A hit is in the same band as the band head while its score is at least
|
|
28
|
-
* this fraction of the head's. 0.
|
|
28
|
+
* this fraction of the head's. 0.75 = within 25%, i.e. a near-tie, not a
|
|
29
29
|
* relevance gap. Measured on the D79 fixture (see docs/design/decisions.md).
|
|
30
30
|
*/
|
|
31
|
-
export const DEFAULT_FEEDBACK_BAND_RATIO = 0.
|
|
31
|
+
export const DEFAULT_FEEDBACK_BAND_RATIO = 0.75;
|
|
32
32
|
/**
|
|
33
33
|
* Reorder one review tier. Callers pass a tier's hits in BM25 order. Within
|
|
34
34
|
* each near-tied band, only contiguous runs of eligible hits are re-sorted by
|
package/docs/V2-DESIGN.md
CHANGED
|
@@ -580,9 +580,9 @@ requirement: personal data never touches third-party services). Benchmarks to tr
|
|
|
580
580
|
- **Phase 4 — Future, signal-gated.** Cloud `RemoteProvider` customization only on: multi-private-repo
|
|
581
581
|
sharing needs, fine-grained ACL, audit/compliance mandates · optional API-backed exporters/providers
|
|
582
582
|
for enterprise knowledge systems.
|
|
583
|
-
- **Near-term backlog — committed direction, not yet built (2026-10-07).** Stone's rule: anything said as "later" is written down here. D77-L2 ✅ built 2026-11-03 (0.9.0-alpha.2): per-memory `retrieved_count`/`useful_count` (`useful_self` vs `useful_team`) + `memory_useful` tool, counters in a `memory_usage` table beside the rebuildable index. D77-L3 ✅ built 2026-11-04 (0.9.0-alpha.3): `memory_status`/`sync-status` reuse report — per-scope rates, top reused, zero-reuse "zombies". D77: external bench — LongMemEval-S run 2026-10-07 (`scripts/bench-longmemeval.ts`, 470 questions, recall_any@k: R@5 97.0% / MRR 0.909 per-question, R@5 40.6% on a pooled 22k corpus; ahead of agentmemory’s BM25-only, level with their BM25+vector). MemoryAgentBench still open as a second external data point. D79 follow-up SUPERSEDED → built as **D80** (2026-10-07): index-time synonym/translation expansion shipped; 41-query fixture recall@5 0.854 → 0.976, MRR 0.791 → 0.859. Embedding-model configurability (Stone 2026-10-07): the multilingual model is his personal need (EN↔ZH), not everyone’s — the model must be user-configurable. Timing: (1) NOW in the bench only — a `--model` flag to measure the multilingual tax (multilingual vs English-only on English data), which decides the DEFAULT. (2) AT SHIP TIME — `embedding.model` in `MyOMemoryConfig` + `SETTABLE_KEYS`, model-agnostic storage from day one (dim + model id stored with vectors, cache dir), download UX and `doctor` checks. Not before the gate passes: building config UX for a layer we haven’t decided to ship is premature. If multilingual tax ≈ 0, default multilingual (covers everyone); else default English-only with a docs note.D78: curate+submit — pre-submit lint, then confidence-tier auto-curation (auto-apply / batch-confirm / explicit human). D79 follow-ups: feedback-weighted ranking ✅ first slice built 2026-11-11 (0.10.0-alpha.
|
|
583
|
+
- **Near-term backlog — committed direction, not yet built (2026-10-07).** Stone's rule: anything said as "later" is written down here. D77-L2 ✅ built 2026-11-03 (0.9.0-alpha.2): per-memory `retrieved_count`/`useful_count` (`useful_self` vs `useful_team`) + `memory_useful` tool, counters in a `memory_usage` table beside the rebuildable index. D77-L3 ✅ built 2026-11-04 (0.9.0-alpha.3): `memory_status`/`sync-status` reuse report — per-scope rates, top reused, zero-reuse "zombies". D77: external bench — LongMemEval-S run 2026-10-07 (`scripts/bench-longmemeval.ts`, 470 questions, recall_any@k: R@5 97.0% / MRR 0.909 per-question, R@5 40.6% on a pooled 22k corpus; ahead of agentmemory’s BM25-only, level with their BM25+vector). MemoryAgentBench still open as a second external data point. D79 follow-up SUPERSEDED → built as **D80** (2026-10-07): index-time synonym/translation expansion shipped; 41-query fixture recall@5 0.854 → 0.976, MRR 0.791 → 0.859. Embedding-model configurability (Stone 2026-10-07): the multilingual model is his personal need (EN↔ZH), not everyone’s — the model must be user-configurable. Timing: (1) NOW in the bench only — a `--model` flag to measure the multilingual tax (multilingual vs English-only on English data), which decides the DEFAULT. (2) AT SHIP TIME — `embedding.model` in `MyOMemoryConfig` + `SETTABLE_KEYS`, model-agnostic storage from day one (dim + model id stored with vectors, cache dir), download UX and `doctor` checks. Not before the gate passes: building config UX for a layer we haven’t decided to ship is premature. If multilingual tax ≈ 0, default multilingual (covers everyone); else default English-only with a docs note.D78: curate+submit — pre-submit lint, then confidence-tier auto-curation (auto-apply / batch-confirm / explicit human). D79 follow-ups: feedback-weighted ranking ✅ first slice built 2026-11-11 (0.10.0-alpha.2, D92): opt-in `feedbackWeighting`, near-tied BM25 band reordered by `reuse_rate` only for `retrieved_count >= 3`, explain trace, fixture R@1 0.660 → 0.702 / MRR 0.804 → 0.825; embeddings gate decision against the published baseline; reranker evaluation. Cross-lingual embedding rerank (Stone 2026-10-16, from obsidian-mind comparison): ablation showed multilingual vectors beat BM25 by +12pp R@5 on the cross-lingual slice — the one gap lexical can't cover. Design as opt-in rerank for EN↔ZH queries only, not a default path; local stays BM25-first per the retrieval split above. TDQS nit (separate PR): tighten search/list `type` to `z.enum`. Retrieval eval: grow the fixture (project-scope tier cases) as retrieval logic evolves. Retrieval split — local vs share server (Stone 2026-10-07): the two environments emphasize different mechanisms. Local (personal machine): BM25 + curated index-time expansion as the primary — deterministic, zero model download (D7), fast on CPU, index bloat bounded by the small corpus; embeddings opt-in only. Share server (team/org, enterprise): embeddings + ANN + reranker as the primary — server-grade compute with models resident, corpus too large and multi-author for any curated map; the curated map stays as a precision layer plus org glossary. The server additionally aggregates D77 useful_count across users into feedback-weighted ranking (already in D79 follow-ups) — a signal a single machine can never have. Bottom-up loop: curated pairs that many users converge on locally become org-glossary candidates. Economics flip: N users each downloading a model vs one model amortized on the server. OptMem lessons (Stone 2026-10-16, from kafkaup's OptMem post): three friction-reduction ideas worth stealing from the minimalist end of the spectrum. (1) **Token cost as spec** — measure and publish open-memex's prompt/token overhead in the README, the way OptMem advertises its "426-token prompt"; acquisition copy, not just engineering. (2) **`wake` convention** — document a session-start ritual (one `memory_recall` call at the beginning of every session), mirroring OptMem's `memo wake`; the MCP tools exist but the habit isn't specified. (3) **Capture length nudge** — a soft length cap or conciseness hint at capture time, inspired by OptMem's 280-byte hard cap; forces conciseness at write time, cheap to implement, aligned with the distill-to-AGENTS.md direction (D40). Three-tier memory zones (Stone 2026-10-18, from Westenberg "I Deleted My Second Brain" + his own reflection): the second brain should have zones like cache vs database, not "keep everything" vs "delete everything". **Hot** (active zone, cache-like: small, curated, always in context — D81 aliases, WHAT-level) · **Warm** (compost/incubation: not active but not cold; periodic review, rotted items deleted — this is "forget on purpose" as engineering) · **Cold** (full archive, searchable, not resident). The hard part is the **promotion/demotion policy** — what moves between zones, when, by what rule (the cache-replacement problem for knowledge; "useful" ≠ "recently used"). Capture restraint is a separate gate: not everything deserves to enter even cold storage. Spec the policy before building the zones. Auto-capture design brief (Stone 2026-10-19, from ai-memory comparison): open-memex wants auto-capture but under the restraint philosophy (not ai-memory's capture-everything). Five design questions: (1) **End-session trigger** — what hooks does opencode actually expose? (check before designing; ai-memory built finalize-session fallback for harnesses without SessionEnd); candidates: native hook / idle timeout / explicit command / context-near-full. (2) **Distillation** — rules first (what happened: git diff, tool calls, decision sentences; zero LLM), interpretation layer (what it means) left to human/LLM. (3) **Save-value triage** — three tiers: clearly valuable → save; clearly noise → drop; ambiguous → ask human. Boundary principle: **rather over-ask than over-save** (polluted retrieval costs more than a missed memory). (4) **Routing** — four exits: project memory / personal memory / AGENTS.md proposal (distill-agents exists) / discard; keep v1 routing rules simple. (5) **Human interaction** — one batch confirmation at session end ("save these 3? [y/n/edit]"), never per-item popups. Relations: D73 keyword capture is turn-level (no conflict); `wake` convention is session-start (this is session-end — the other bookend); three-tier zones govern where auto-captured items land. Cross-agent study (Stone 2026-10-19): open-memex has cross-agent on the roadmap — study how ai-memory does it (handoff claim-once semantics, lifecycle hooks per harness, VSCode support via MCP-only) before designing ours; borrow the semantics, not the push-injection behavior (discoverability > injection). Injection cost discipline (Stone 2026-10-19, from Harness² paper arXiv:2610.14224): "ALWAYS-ON PROSE IS THE EXPENSIVE OPTION" — every always-on word competes with the agent's output budget. Current session-start injection (8 project + 5 personal) is the expensive path; direction: move "important but not needed every turn" memories to on-demand (tool/skill-triggered loading), keep only truly every-turn items resident. Tolerable now, better not to tolerate. Component cost ladder for reference: SKILL (default, zero-cost until invoked) > SCRIPT > SUBAGENT > PLUGIN ("prose can be skipped, a hook cannot") > ALWAYS-ON TEXT (last resort). Read-less compression (Stone 2026-10-19, from caveman https://github.com/JuliusBrussee/caveman): the execution layer of injection cost discipline — compress what the agent READS before it reaches context, not just what we inject. Caveman's measured numbers: 33.2% fewer input tokens per session (CSV 98.9%, logs 98.5%, YAML 99.1%, JSON 98.5% per-file; HTML has no compressor yet). Direction for open-memex: a pre-retrieval compression pass on tool outputs and retrieved passages (structured data → compact form), originals stay on disk and pullable on demand. Two design principles borrowed: (1) never compress the user's own prompt/input (Adobe CAVEWOMAN finding: cavemanning user prompts makes answers worse); (2) leave code/tool calls/payloads verbatim — compress the wrapper, not the payload. Caveats: caveman's own rules cost ~1,160 input tokens fixed; per-request billing (Copilot-style) nullifies the saving — compression pays off on per-token billing only. Knowledge upkeep as a first-class direction (Stone 2026-10-23; external validation: Hedy Zhang's FDE field retrospective on enterprise AI knowledge bases, X article 2026-10-22 — enterprise knowledge bases die on unowned upkeep, not on retrieval: stale answers served silently, conflicts with no owner, updates nobody owns after delivery). The mechanisms already exist (supersede chains, lifecycle states, `audit` health check, curator convention); the direction is driving the human cost of upkeep toward zero: (1) staleness signals — age, contradiction with newer captures, D77 zero-reuse counters — feeding a standing review queue instead of waiting for someone to remember to run `audit`; (2) a conflict inbox — semantic conflicts and broken chains as a persistent todo; (3) the endgame is D78 confidence-tier auto-curation (auto-apply the safe tier, batch-confirm the rest). Success metric: the base stays trustworthy on minutes-per-week of human attention, not a curator shift. README pitches the shipped half of this as core concept 4 (Knowledge stays current) plus a "When facts change" comparison row. Session working state note (D89, 2026-11-02) → BUILT, shipped 2026-11-03 as D90: 12th tool `memory_workingstate` on both hosts, session-start surfacing, `audit` expiry report, `wstate` CLI; opencode write path is instruction + tool (plugin API has no Stop hook).
|
|
584
584
|
|
|
585
|
-
- **Build order after D77-L3 (2026-11-04, Stone approved; (1) shipped 2026-11-06).** Once PR #74 (D77-L3 reuse report) merges, the queue is: (1) §20 / D88 deterministic half — **shipped 0.9.0-alpha.6 (D91)**: `graph build` (structural edges only), compiled outline injected at session start, `graph neighbours` / `graph path` / `graph outline` / `graph lint` CLI (orphans / dangling / stale; missing-page alerts are part of the LLM half, still open); no LLM, no ranking change. Remaining under §20: **the LLM half** — semantic insights, missing-page alerts that propose new memories (through the D61 propose-first flow), compiled wiki pages — plus D78's pre-submit integration of the lint report. (2) D79 feedback-weighted ranking — **first slice shipped 0.10.0-alpha.
|
|
585
|
+
- **Build order after D77-L3 (2026-11-04, Stone approved; (1) shipped 2026-11-06).** Once PR #74 (D77-L3 reuse report) merges, the queue is: (1) §20 / D88 deterministic half — **shipped 0.9.0-alpha.6 (D91)**: `graph build` (structural edges only), compiled outline injected at session start, `graph neighbours` / `graph path` / `graph outline` / `graph lint` CLI (orphans / dangling / stale; missing-page alerts are part of the LLM half, still open); no LLM, no ranking change. Remaining under §20: **the LLM half** — semantic insights, missing-page alerts that propose new memories (through the D61 propose-first flow), compiled wiki pages — plus D78's pre-submit integration of the lint report. (2) D79 feedback-weighted ranking — **first slice shipped 0.10.0-alpha.2 (D92)**: fixture + baseline landed first, then an opt-in reuse-signal band reorder (`retrieved_count >= 3`, `reuse_rate`, 0.75 near-tie band); no embedding/cross-lingual rerank yet. (3) D78 curate+submit — the upkeep endgame; consumes §20 lint output. (4) Embeddings gate decision (bench `--model` measures the multilingual tax) + opt-in cross-lingual rerank for EN↔ZH queries only; local stays BM25-first. (5) OptMem small items — token cost in README, `wake` session-start ritual, capture length nudge. (6) Three-tier memory zones policy spec (Hot/Warm/Cold promotion/demotion rules) before building; §20's compiled outline already covers part of Hot. (7) Auto-capture design — answer the five open questions first (notably which session-end trigger opencode exposes). Then measurement/candidates: MemoryAgentBench second external data point; Phase 2C native plugins (candidate, not committed); D9 LAN reference server likely dropped; D2/D11 iron-rule gate is a known safety gap awaiting a build/drop decision. Non-code track: Phase 2B 1–2 colleague pilot (needs people, not code). Dependency chain: §20 lint → D78; D77-L2 counters → D79; gate decision → rerank. Tension to respect: §20's resident outline must stay compact per the injection-cost discipline (2026-10-19) — "important but not every turn" stays on-demand.
|
|
586
586
|
|
|
587
587
|
- **Phase 5 — Candidates recorded 2026-10-04 (not committed).** From the competitor scan (D75): an offline FTS5 retrieval eval with a published recall number (gates any semantic-layer decision) [promoted to next build, D77] · per-client trust levels on the review ladder · cold-start Markdown import into outbox drafts · `doctor` check that each editor's MCP registration points at the intended data root (mis-rooted servers are a real failure mode elsewhere). Sequencing and scope TBD per candidate.
|
|
588
588
|
- **Phase 5 — Candidates recorded 2026-10-11 (not committed).** From the XERJ review (xerj-org/xerj, Apache-2.0; founder Ivan N requested open-memex D81 for the XERJ Corpus Hub — agreed 2026-10-11, attribution + repo link): schema-first querying (`xerj_map` — agent fetches the field map before writing query DSL; candidate: a schema/describe helper ahead of `memory_search` to cut dead queries) · token-budgeted MCP results (their `token_budget.rs` — truncate to a token budget, not a fixed row limit) · hybrid retrieval as the scale answer (BM25 + vector kNN with fused ranking, e.g. RRF — the reference pattern for the eventual embedding layer; our lexical ceiling is already measured at R@5 40.6% pooled) · NL-to-validated-query planning (`xerj_plan` — natural language in, validated query out; candidate: a query lint/validate step before search executes) · evidence-carrying memory links (typed links with evidence + confidence, soft-retire never hard-delete — same spirit as our review-state ladder; prior art for a future memory-graph direction) · honest isolation docs (state what a namespace guarantees and does NOT — query-level vs trust boundary; same spirit as our Limitations section) · cost-accounted evals (report tokens + dollars per approach, as in their case studies — the format for proving "memory makes agents cheaper"). Sequencing and scope TBD per candidate.
|
package/docs/design/decisions.md
CHANGED
|
@@ -1148,5 +1148,5 @@
|
|
|
1148
1148
|
- **D91 — the knowledge graph, deterministic half (§20, 2026-11-06).** Implements the graph layer D88 designed, split at the derivation boundary: this change ships only edges the code can *prove* or derive from structure, with no LLM call anywhere. Edge extraction (`src/graph/extract.ts`, pure): (1) **supersedes** edges from the index chain (`superseded_by`, plus the reverse derived from that column — the index has no `supersedes` column), EXTRACTED/high; (2) **derived-from** edges from the propose-copy's `derived_from` frontmatter (now also an index column, schema v10), EXTRACTED/high; (3) **relates-to** edges from `[[wiki-link]]` body mentions of a node's ULID, EXTRACTED/high, and from bare ULID mentions, INFERRED/high; (4) **relates-to** from shared tags at a fixed ladder — 1 shared tag → low, 2 → medium, ≥3 → high — INFERRED, capped at `MAX_SHARED_TAG_EDGES_PER_NODE = 12` per node and `MAX_SHARED_TAG_NODES = 2000` overall so one universal tag cannot produce an O(n²) edge set; one relational edge per unordered pair, EXTRACTED beats INFERRED on the same pair. Stored in `graph_edges`/`graph_meta` beside the rebuildable index with `CREATE TABLE IF NOT EXISTS` (like `memory_usage`, D77), so the graph is derived, disposable, and never touches Markdown or the source of truth. Every mutating path refreshes it automatically (`refreshGraphQuiet` on the write hooks: add/supersede/soft + hard forget on both hosts, keyword capture, propose, review promotion, CLI add/supersede/status/forget); `refreshGraph` is the explicit `graph build` path and reports honestly (D63 — a missing id fails, findings never invent nodes). **Outline** (`src/graph/outline.ts`, pure): connected components joined **only by medium+ INFERRED shared-tag edges** (the universal-tag collapse guard — a single low/medium tag must not merge unrelated memories; fixture-pinned in `smoke-pure.ts`), rendered `topic (n): titles…` with the cut disclosed at `maxLines` (config `graphOutlineLines`, default 10, cap 30); the compiled outline is stored in `graph_meta` and injected once at session start next to the working-state note (`graphOutline`, default on; injected lines contribute exposure ids to D77 `recordRetrieved`, never usefulness). **Queries** (`src/graph/queries.ts`, pure): `graph neighbours <id> [--depth 1-6]` (BFS, default 1, per-edge receipts with type/provenance/confidence) and `graph path <a> <b>` (shortest path, default depth 4, per-hop receipts). **Lint** (`src/graph/lint.ts`, pure): orphans (active, no topic, no edges), dangling edges (endpoint absent from the index — but an endpoint that exists in *another* scope is a legitimate foreign link, e.g. a propose copy deriving from its personal original, and is skipped), and near-stale pairs (similarity ≥ 0.8, chains excluded) via the existing lifecycle `similarity()`; reports only, nothing auto-resolved — this is the report D78's pre-submit lint consumes later. Scope contract: the graph covers the cwd's **project** scope only, no `--scope` flag, `personal` never graphs (§20.5). The interface is **CLI only** (`open-memex graph build|neighbours|path|lint|outline`) — the MCP surface stays at 13 tools; the outline reaches sessions through injection, not a tool (§20.6). Schema bump: added `derived_from TEXT` to `memories` (`SCHEMA_VERSION` 9 → 10, rebuild-from-Markdown migration — the frontmatter field already existed at `markdown.ts`). The **LLM half** — abstracted insights and missing-page alerts that propose new memories — remains open in §18/§20 and must go through the D61 propose-first flow.
|
|
1149
1149
|
*Status (2026-11-06): 部分实现 (0.9.0-alpha.6) — deterministic half shipped: `src/graph/{extract,outline,queries,lint}.ts` + `src/store/graph.ts`, auto-refresh on every mutating path, outline injection, CLI `graph` group; smoke-pure + test-full (154 checks) green. LLM half (abstracted insights, missing-page → new memories) remains 未实现.*
|
|
1150
1150
|
|
|
1151
|
-
- **D92 — feedback-weighted ranking, first slice (2026-11-11).** The D79 follow-up that D77-L2 unblocked: the reuse counters now have a *measured*, deliberately small effect on `search()` order. **Measurement first:** commit 1 added a 3-query reuse slice to `scripts/retrieval-eval.ts` — each query has a gold memory carrying `retrieved=5..6, useful=3` counters and a near-tied distractor with the same retrieval count but zero useful confirmations — and seeded that telemetry through the real `recordRetrieved`/`recordUseful` API. Baseline with feedback still off: 60 memories / 47 queries, R@1 0.660 / R@5 0.979 / MRR 0.804. **Mechanism:** `src/retrieve/feedback.ts` (pure, smoke-tested) reorders only inside a near-tied BM25 band (score ≥ **0.
|
|
1152
|
-
*Status (2026-11-11): 已实现(第一刀,0.10.0-alpha.
|
|
1151
|
+
- **D92 — feedback-weighted ranking, first slice (2026-11-11).** The D79 follow-up that D77-L2 unblocked: the reuse counters now have a *measured*, deliberately small effect on `search()` order. **Measurement first:** commit 1 added a 3-query reuse slice to `scripts/retrieval-eval.ts` — each query has a gold memory carrying `retrieved=5..6, useful=3` counters and a near-tied distractor with the same retrieval count but zero useful confirmations — and seeded that telemetry through the real `recordRetrieved`/`recordUseful` API. Baseline with feedback still off: 60 memories / 47 queries, R@1 0.660 / R@5 0.979 / MRR 0.804. **Mechanism:** `src/retrieve/feedback.ts` (pure, smoke-tested) reorders only inside a near-tied BM25 band (score ≥ **0.75×** the band head), only among hits with `retrieved_count >= 3`, by `reuse_rate` descending, and only within a contiguous run of eligible hits — so an ineligible/new memory keeps its exact BM25 slot and its neighbours cannot leapfrog it. The BM25 score is never changed; `search --explain` still prints it, plus a `feedback:` line listing every promotion (`↑ id +N (reuse …)`) so the trace is auditable. Tiers are reordered independently, so feedback never lifts a draft over reviewed knowledge. Config is a flat key `feedbackWeighting` (**default false**, `SETTABLE_KEYS`, shallow-merge-safe); callers (`memory_search` both hosts, CLI `search`) pass it, and the eval passes both values explicitly. **Result:** weighted R@1 0.702 / R@5 0.979 / MRR 0.825; reuse slice MRR 0.500 → 0.833 (two of three golds promoted 2→1). Band sweep on the fixture: 0.95 → no effect, 0.9/0.85/0.8 → +1 R@1, 0.75 → +2, 0.67 → +3; 0.75 is shipped because it is the widest band that still catches the two strongest reuse signals; 0.67 would also promote a hit ~33% below the band head, which is a relevance gap, not a near-tie. **Guardrails unchanged (D77):** useful only via `memory_useful`, human approve at review, or supersede — passive exposure still increments only `retrieved_count`; `reuse_rate` may exceed 1.0 and is signal strength, never a prune threshold; counters stay in local SQLite and survive index rebuilds. **Explicitly not in this slice:** embedding gate, cross-lingual rerank (D79 item 4, after D78), automatic zombie demotion/eviction (D78), and any change to `memory_useful` or the D77-L3 report's accounting.
|
|
1152
|
+
*Status (2026-11-11): 已实现(第一刀,0.10.0-alpha.2)— `src/retrieve/feedback.ts` + `search()` wiring + `feedbackWeighting` flat key + `search --explain` promotion trace; fixture baseline vs weighted numbers in `scripts/retrieval-eval.ts`. D79 的 embedding gate / 跨语言 rerank / 自动淘汰仍留给后续。*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-memex",
|
|
3
|
-
"version": "0.10.0-alpha.
|
|
3
|
+
"version": "0.10.0-alpha.2",
|
|
4
4
|
"mcpName": "io.github.stoneskin/open-memex",
|
|
5
5
|
"description": "Local-first memory layer and protocol for AI coding agents. Markdown source of truth, SQLite FTS5 index, zero cloud.",
|
|
6
6
|
"keywords": [
|
package/scripts/smoke-pure.ts
CHANGED
|
@@ -979,8 +979,8 @@ console.log("== D79 feedback ranking (reuse signal) ==");
|
|
|
979
979
|
{
|
|
980
980
|
const hits = [
|
|
981
981
|
{ id: "fresh", score: 20 },
|
|
982
|
-
{ id: "
|
|
983
|
-
{ id: "
|
|
982
|
+
{ id: "zombie", score: 18 },
|
|
983
|
+
{ id: "proven", score: 17 },
|
|
984
984
|
{ id: "far", score: 5 },
|
|
985
985
|
];
|
|
986
986
|
const usage = new Map([
|
|
@@ -991,7 +991,13 @@ console.log("== D79 feedback ranking (reuse signal) ==");
|
|
|
991
991
|
const r = applyFeedbackRanking(hits, usage);
|
|
992
992
|
const order = r.ordered.map((h) => h.id).join(",");
|
|
993
993
|
ok("fresh memory keeps its BM25 place (min sample guard)", order.startsWith("fresh"), order);
|
|
994
|
-
|
|
994
|
+
// proven starts BELOW zombie on BM25; this assertion fails if the reorder
|
|
995
|
+
// is a no-op (the old fixture already had proven above zombie).
|
|
996
|
+
ok(
|
|
997
|
+
"proven swaps above the higher-BM25 retrieved-only hit",
|
|
998
|
+
order === "fresh,proven,zombie,far",
|
|
999
|
+
`${hits.map((h) => h.id).join(",")} -> ${order}`,
|
|
1000
|
+
);
|
|
995
1001
|
ok("large score gap is not crossed", r.ordered[3]!.id === "far", order);
|
|
996
1002
|
ok("ineligible vs eligible is reported", r.info.get("fresh")!.eligible === false && r.info.get("proven")!.eligible === true);
|
|
997
1003
|
ok("reuse rate may exceed 1.0 (signal, not probability)", (() => {
|
|
@@ -1001,7 +1007,7 @@ console.log("== D79 feedback ranking (reuse signal) ==");
|
|
|
1001
1007
|
);
|
|
1002
1008
|
return x.info.get("b")!.rate === 2 && x.ordered[0]!.id === "a"; // 2 < min retrieved
|
|
1003
1009
|
})());
|
|
1004
|
-
ok("min sample is 3 and band is 0.
|
|
1010
|
+
ok("min sample is 3 and band is 0.75", FEEDBACK_MIN_RETRIEVED === 3 && DEFAULT_FEEDBACK_BAND_RATIO === 0.75);
|
|
1005
1011
|
ok("empty usage map changes nothing", (() => {
|
|
1006
1012
|
const x = applyFeedbackRanking(hits, new Map());
|
|
1007
1013
|
return x.ordered.map((h) => h.id).join(",") === hits.map((h) => h.id).join(",");
|
package/src/retrieve/feedback.ts
CHANGED
|
@@ -27,10 +27,10 @@ export const FEEDBACK_MIN_RETRIEVED = 3;
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* A hit is in the same band as the band head while its score is at least
|
|
30
|
-
* this fraction of the head's. 0.
|
|
30
|
+
* this fraction of the head's. 0.75 = within 25%, i.e. a near-tie, not a
|
|
31
31
|
* relevance gap. Measured on the D79 fixture (see docs/design/decisions.md).
|
|
32
32
|
*/
|
|
33
|
-
export const DEFAULT_FEEDBACK_BAND_RATIO = 0.
|
|
33
|
+
export const DEFAULT_FEEDBACK_BAND_RATIO = 0.75;
|
|
34
34
|
|
|
35
35
|
export interface FeedbackSignal {
|
|
36
36
|
retrieved: number;
|