|
|
|
English | ZH-CN
🧠 BeliefSync 是一个给 coding agent 用的仓库状态同步层: 把隐式假设变成显式 beliefs,检测哪些 beliefs 过期,并给出定向恢复动作。
BeliefSync 的核心目标不是“让 agent 读更多上下文”,而是:
让 agent 明确知道自己当前相信仓库里的哪些事实,以及这些判断在仓库变化后是否已经失效。
它主要解决的场景包括:
- 🔁 agent 还在按旧 commit 的理解继续改代码
- 🧪 test 已经变化,但 agent 还沿用旧测试语义
- 💬 issue/comment 加了新约束,但 agent 还没同步
- 📦 dependency 更新后,旧推理链已经不成立
BeliefSync 会做 4 件事:
- 🧩 提取 repository-state beliefs
- 📎 给 belief 绑定 scope、evidence、version validity
- 🚨 检测哪些 belief stale 了
- 🎯 推荐最值得执行的 targeted revalidation 动作
BeliefSync 的运行链路很清楚:
Repository Events🔄- git diff、test 变化、issue / comment 更新
Belief Store🗂️- 存储 agent 当前对仓库状态的结构化判断
Stale Detector🚨- 判断哪些 belief 可能失效
Targeted Revalidation🎯- 生成更低成本的恢复动作
Task Agent🤖- 把清理过的状态再喂回 coding workflow
git clone https://github.com/xiao-zi-chen/Beliefsync.git
cd Beliefsync
python -m pip install -e .
python -m beliefsync demo常用工作流:
python -m beliefsync init --repo-id demo/repo
python -m beliefsync snapshot --repo-id demo/repo --repo-path . --issue-file examples/demo_issue.md --test-log examples/demo_test_log.txt
python -m beliefsync refresh --repo-path . --head-ref HEAD --format markdownBeliefSync 现在已经不是一次性 demo 脚本,而是有持续工作流的工具 ✨
init🏗️- 初始化
.beliefsync/
- 初始化
snapshot📸- 记录当前 belief baseline
- 仓库变化 🔁
refresh🚨- 基于新的 repository events 做 stale-belief 分析
- 输出:
- text / json / markdown / html 报告
- 更新 baseline,供下一轮继续用 ♻️
BeliefSync 已经支持 OpenAI-compatible 接口,也已经支持 Kimi 兼容接入 ✅
环境变量支持:
- 通用:
BELIEFSYNC_LLM_API_KEYBELIEFSYNC_LLM_BASE_URLBELIEFSYNC_LLM_MODEL
- Kimi 别名:
KIMI_API_KEYKIMI_BASE_URLKIMI_MODEL
可以从 .env.example 开始。
常用命令:
python -m beliefsync llm-smoke-test
python -m beliefsync llm-extract --repo-id demo/repo --issue-file examples/demo_issue.md --test-log examples/demo_test_log.txt --output .beliefsync/llm_beliefs.json目前仓库已经有:
16个 CLI commands5类 belief types4种报告格式2个 adapter skeleton13个测试0个运行时第三方依赖
所以它现在已经不是一个空壳 repo,而是一版可以真实演示和继续扩展的开源项目 ✨
MIT,见 LICENSE。
