Skip to main content

Module wiki_index

Module wiki_index 

Source
Expand description

Wiki INDEX.md 自动生成。

从 ledger projection 生成 <vault_root>/INDEX.md,按 scope (user / project) 分节 列出所有 accepted/canonical 记录。该文件作为 LLM 在 wakeup 时的知识导航入口, 类比 Karpathy LLM Wiki 的 index 层。

§不变量

  • 只列 Accepted / Canonical 记录 (candidate 在 review queue,archived 不导航)
  • 按 scope 分段:User-Level (always loaded) → Project: <id> 若干段
  • 段内按 recorded_at 倒序,最新优先
  • 幂等:内容不变不写盘,避免 mtime 抖动
  • 失败降级:错误日志 stderr,不阻断 lifecycle 主路径

Structs§

IndexWriteResult

Enums§

IndexWriteStatus

Constants§

INDEX_FILE_NAME

Functions§

filter_index_sections
纯函数:按 ## 大标题切段,保留 User-Level + 当前 project 段。 暴露方便单元测试。
index_path
load_index_section
<vault_root>/INDEX.md,按当前 scope 过滤出相关 section:
refresh_index_from_config
从 config_path 加载 AppConfig,resolve vault_root 和 lifecycle_root, 读 latest_state 条目并刷写 INDEX.md。失败降级为 stderr warn 并返回 None, 不阻断调用方的 lifecycle 主路径。
refresh_index_result
CLI-facing variant of refresh_index_from_config that propagates errors instead of swallowing them. Used by memory sync-index --apply.
render_index
把 ledger 条目渲染为 markdown 导航索引。
render_index_from_config
Render the INDEX markdown without writing to disk (dry-run preview).
write_index
entries 渲染成 INDEX.md 并写入 <vault_root>/INDEX.md,幂等。