Skip to content

v0.1.4 — Bidirectional reference graph (okf_refs + read annotations)

Choose a tag to compare

@likai-hust likai-hust released this 02 Aug 04:38
· 8 commits to main since this release

opencode-okf-context v0.1.4

This release adds bidirectional reference awareness — the model can now see who a concept links to AND who links back to it, without loading full bodies or making extra okf_list calls.

What's new

okf_read now annotates both directions. When you read a concept, the output shows:

  • Outgoing references — what this concept links to
  • Incoming references — which other concepts link back to it

Each neighbor is shown as metadata only (title + type + description + a ready-to-run okf_read reload command). The model can decide whether a cross-link is worth following without another tool call.

New okf_refs tool queries a concept's reference graph without loading any body — purpose-built for impact analysis ("who depends on this table?", "what breaks if I change X?"). It is not tracked by the unload mechanism, so it never occupies context.

How it works

buildBacklinkIndex does a real-time scan over the in-memory concept map (bodies are already loaded at discovery time), so there is zero extra I/O and no cache to invalidate. A freshly written concept is visible immediately. The index records the raw link facts; a scheme-B filter (concept must have a type) applies only at presentation, so plain .md docs don't clutter the graph.

E2E verified

The release was validated end-to-end against deepseek-v4-flash:

  • Trigger hit-rate: 100% (5/5 positive cases fired okf_*, 1/1 negative correctly did not) — the new manifest entry didn't regress triggers.
  • okf_refs in action: on an impact-analysis query ("如果修改 orders 表会影响哪些概念?"), the model spontaneously reached for okf_refs, read the incoming/outgoing neighbors, and produced a structured dependency assessment — without ever loading a concept body.

Docs

README, README.zh-CN, and AGENTS.md updated in sync (7 tools, okf_refs row, reference-annotation mention). Test count grew to 99 pass.


中文摘要

本次发布新增双向引用感知能力。

  • okf_read 读取 concept 时,现在同时附上出边(它引用了谁)和入边(谁引用了它)的邻居元数据,模型无需额外调用即可判断交叉链接值不值得展开。
  • 新工具 okf_refs 查询某个 concept 的引用图谱,不加载正文——专为影响分析设计("改这个表会影响谁?")。它不被卸载机制跟踪,绝不占用上下文。

核心机制 buildBacklinkIndex 对内存中的 concept 映射做实时扫描(正文在发现阶段已加载),零额外 I/O、无需缓存失效处理,写完立即可见。已通过 deepseek-v4-flash 端到端验证:触发命中率 100%,模型在影响分析场景下主动调用了 okf_refs。