Skip to content

v0.1.1 — 校验工具 + 智能修复 + 元数据优先搜索 + 工具路由强化

Choose a tag to compare

@likai-hust likai-hust released this 31 Jul 06:50
· 17 commits to main since this release

opencode-okf-context v0.1.1

This release ships 4 improvements centered on making OKF knowledge bundles more standardized, more token-efficient, and more likely to be used by the model.

✨ New: okf_validate read-only validation tool

  • Validates OKF concept documents against 7 concept-level rules (type required; title/description/tags well-formed; body non-empty)
  • Each issue comes with a ready-to-run okf_write(...) fix command; auto-fixable issues are pre-filled, content issues emit <placeholder> templates
  • Tool count: 5 → 6

🔧 Enhanced: okf_write partial update

  • In update mode, only passed fields change — the rest are preserved from disk, so you can fix a single field without restating the whole document
  • This is the core mechanism that makes okf_validate's fix commands safe to run

🔍 Improved: okf_search metadata-first, body-fallback

  • Before: searched title/description/tags/body in one pass — the body was scanned every time, violating progressive disclosure
  • Now: searches metadata (title/description/tags) first; returns without scanning any body when metadata matches enough, and only falls back to the body when metadata yields nothing
  • Results are tagged [metadata: field] or [body]; metadata hits always rank above body hits

🧭 Improved: stronger L0 manifest so the model prefers OKF tools

  • Previously the model often defaulted to glob/read for knowledge lookups unless explicitly told to use OKF tools
  • The manifest intro is now an explicit routing instruction: for knowledge/documentation/concept lookups, MUST prefer the OKF toolchain (okf_list → okf_read)
  • Live-tested: a vague "read the customer-table knowledge" request auto-routes through okf_list + okf_read without mentioning OKF

Offline install (air-gapped)

See INSTALL.txt inside the archive. Quick steps:

tar -xzf opencode-okf-context-0.1.1-offline.tar.gz -C ~/.config/opencode/plugin okf.js
opencode debug agent build | grep okf    # should show 6 tools incl. okf_validate: true

Archive contents

  • okf.js — self-contained plugin (all deps bundled; zero runtime dependencies)
  • okf.schema.json — plugin config schema
  • INSTALL.txt — install guide (Chinese)

Upgrade

Replace ~/.config/opencode/plugin/okf.js and restart opencode.

Tests

All 54 tests pass (23 new tests for validate + search); tsc --noEmit clean.


Full changes: see the commit history under git tag v0.1.1 (4ed5307 → 0f27b9d).


中文说明

opencode-okf-context v0.1.1

本次发布包含 4 项重要改进,围绕"让 OKF 知识库更规范、更省 token、更容易被模型用上"。

✨ 新增:okf_validate 只读校验工具

  • 按 7 条概念级规则校验 OKF concept 文档(type 必填、title/description/tags 格式、正文非空)
  • 每个问题附带可直接运行的 okf_write(...) 修复命令;可自动修复项预填好值,需内容判断项给 <占位符> 模板
  • 工具数 5 → 6

🔧 增强:okf_write 部分更新

  • update 模式下只改传入字段,其余从磁盘保留 —— 可只修一个字段而无需重述整篇文档
  • 这是让 okf_validate 的修复命令安全可行的核心机制

🔍 改进:okf_search 元数据优先 + 正文回退

  • 之前:title/description/tags/body 一锅搜,正文每次都被翻,违背渐进式披露
  • 现在:先搜元数据(title/description/tags),够数就返回不碰正文;仅当元数据无果才回退搜正文
  • 结果带来源标记 [metadata: 字段] 或 [body],元数据命中优先于正文命中

🧭 改进:强化 L0 manifest,模型主动用 OKF 工具

  • 之前模型常默认用 glob/read 读知识,除非显式要求才用 OKF 工具
  • 强化 manifest 措辞为主动路由指令:查知识/文档/概念时 MUST 优先 OKF 工具链
  • 实测:不提 OKF,只说"读一下 XX 知识",模型会主动走 okf_list → okf_read

离线安装(内网)

见压缩包内 INSTALL.txt。简要步骤:

tar -xzf opencode-okf-context-0.1.1-offline.tar.gz -C ~/.config/opencode/plugin okf.js
opencode debug agent build | grep okf    # 应看到 6 个工具,含 okf_validate: true

压缩包内容

  • okf.js — 自包含插件(已 bundle 所有依赖,零运行时依赖)
  • okf.schema.json — 插件配置 schema
  • INSTALL.txt — 中文安装说明

升级

替换 ~/.config/opencode/plugin/okf.js 后重启 opencode 即可。

测试

54 个测试全部通过(新增 validate + search 共 23 个测试);tsc --noEmit 干净。


完整变更:见下方 git tag v0.1.1 对应的提交历史(4ed5307 → 0f27b9d)。