Skip to content

xiao-zi-chen/Beliefsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
BeliefSync mark BeliefSync wordmark

BeliefSync typing intro

English | ZH-CN

🧠 BeliefSync gives coding agents a repository-state sync layer: explicit beliefs, stale-belief detection, targeted revalidation, git-aware scans, and reportable recovery state.

βš™οΈ Build with the project: make coding agents more inspectable, more stable in dynamic repositories, and less dependent on brute-force context rescans.

Quick Start BeliefSync Architecture Workspace Workflow Kimi Support Commands Surface License

CI GitHub stars GitHub issues Python Runtime dependencies 16 commands 5 belief types 4 report formats 13 tests 2 adapters

Why BeliefSync 🧠✨

Coding agents are already good at producing patches in static snapshots.
They are much worse at one quieter but much more realistic failure mode πŸ‘€

  • πŸ” a commit lands while the agent is still reasoning from an older snapshot
  • πŸ§ͺ a test changes what β€œcorrect” means
  • πŸ’¬ an issue comment narrows the requirement
  • πŸ“¦ a dependency update invalidates an earlier hypothesis

Most stacks answer that problem by rescanning more repository context 😡

BeliefSync takes a different view:

the problem is not only missing context, but stale repository beliefs.

So instead of hiding state inside prompt history, BeliefSync:

  • 🧩 turns working assumptions into explicit repository-state beliefs
  • πŸ“Ž attaches evidence, scope, and version validity to each belief
  • 🚨 detects which beliefs likely became stale after repository events
  • 🎯 recommends low-cost revalidation actions before the agent keeps editing code

This makes BeliefSync useful as:

  • πŸ›‘οΈ a reliability layer for coding agents
  • πŸ” a debugging and observability tool for agent runs
  • πŸ§ͺ a project-first foundation for stale-belief research in software engineering agents

BeliefSync Architecture πŸ§©πŸ› οΈ

BeliefSync architecture

πŸ”„ Repository events become explicit beliefs, stale assessments, and targeted recovery actions.

BeliefSync is built around one architectural bet 🧠

coding agents need an explicit repository-state layer, not just longer prompt history.

The runtime core is intentionally simple and visible:

  • Belief Constructor 🧠
    • extracts candidate beliefs from issue text, test logs, and repository context
  • Belief Store πŸ—‚οΈ
    • persists repository-state claims with scope, evidence, and version metadata
  • Stale Belief Detector 🚨
    • scores which beliefs likely drifted after repository changes
  • Revalidation Planner 🎯
    • converts stale beliefs into low-cost, high-value recovery actions
  • Task Agent Adapter πŸ€–
    • feeds the cleaned state back into a coding-agent loop

The design is deliberately:

  • agent-agnostic πŸ”Œ
    • BeliefSync can sit beside different coding-agent runtimes
  • inspectable πŸ‘€
    • beliefs are stored as explicit JSON, not hidden in opaque traces
  • project-first, research-ready πŸ§ͺ
    • useful as an open-source reliability tool while still structured enough for benchmark and paper work later

Quick Start πŸš€

What You Need 🧰

Item Why It Matters
Python 3.10+ required for the CLI, belief models, reports, and repository scanning
git used for repository-event ingestion and refresh workflows
optional OpenAI-compatible provider used for llm-smoke-test and llm-extract

1. Clone and Install πŸ“¦

git clone https://github.com/xiao-zi-chen/Beliefsync.git
cd Beliefsync
python -m pip install -e .

2. Run the Built-In Demo ▢️

python -m beliefsync demo

3. Initialize a Workspace πŸ—οΈ

python -m beliefsync init --repo-id demo/repo
python -m beliefsync status
python -m beliefsync show-config

4. Create a Baseline Snapshot πŸ“Έ

python -m beliefsync snapshot ^
  --repo-id demo/repo ^
  --repo-path . ^
  --issue-file examples/demo_issue.md ^
  --test-log examples/demo_test_log.txt

5. Scan Repository Changes πŸ”

python -m beliefsync scan ^
  --repo-id demo/repo ^
  --repo-path . ^
  --issue-file examples/demo_issue.md ^
  --test-log examples/demo_test_log.txt ^
  --base-ref HEAD~1 ^
  --head-ref HEAD

6. Refresh from the Last Snapshot πŸ”„

python -m beliefsync refresh ^
  --repo-path . ^
  --head-ref HEAD ^
  --format markdown

Workspace Workflow πŸ—ΊοΈπŸ”

BeliefSync is not just a one-shot CLI. It now supports a small but real workspace lifecycle ✨

Baseline Loop

  1. beliefsync init πŸ—οΈ
    • create .beliefsync/
  2. beliefsync snapshot πŸ“Έ
    • store the current belief baseline
  3. repository changes happen πŸ”
  4. beliefsync refresh 🚨
    • compare the last belief baseline against new repository events
  5. BeliefSync emits:
    • stale-belief assessments
    • targeted revalidation actions
    • text / JSON / Markdown / HTML reports
  6. the refreshed beliefs become the next baseline ♻️

Why This Matters

That workflow makes BeliefSync feel like a practical tool rather than a one-off demo:

  • 🧠 you can keep a local belief baseline in .beliefsync/beliefs.json
  • 🧾 you can inspect workspace state via .beliefsync/state.json
  • πŸ“š you can keep report history under .beliefsync/reports/

This is the shape of a real β€œagent reliability sidecar,” not just a benchmark script πŸ’‘


Kimi / OpenAI-Compatible Support πŸŒ™πŸ€

BeliefSync already supports OpenAI-compatible LLM access, including Kimi-compatible usage βœ…

Supported Env Vars πŸ”‘

Generic:

  • BELIEFSYNC_LLM_API_KEY
  • BELIEFSYNC_LLM_BASE_URL
  • BELIEFSYNC_LLM_MODEL
  • BELIEFSYNC_LLM_TIMEOUT

Kimi aliases:

  • KIMI_API_KEY
  • KIMI_BASE_URL
  • KIMI_MODEL

You can start from .env.example.

Smoke Test the Connection πŸ§ͺ

python -m beliefsync llm-smoke-test

This command:

  • πŸ“‹ lists available models from the provider
  • ⚑ performs a tiny completion request
  • πŸ” retries on transient overload
  • 🧭 falls back to reasonable OpenAI-compatible model choices when possible

Use an LLM to Extract Beliefs 🧠

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

This is useful when you want richer candidate beliefs than the purely heuristic extractor.


Commands Surface πŸŽ›οΈ

BeliefSync currently exposes 16 CLI commands:

Command Purpose
init initialize a .beliefsync/ workspace
status inspect workspace state
show-config print the active config
snapshot create a baseline belief snapshot
refresh re-run stale-belief analysis against new repository changes
llm-smoke-test test OpenAI-compatible/Kimi connectivity
llm-extract extract candidate beliefs with an LLM
demo run the built-in end-to-end example
extract heuristic belief extraction
detect stale-belief detection
plan targeted revalidation planning
report produce text / JSON / Markdown / HTML reports
ingest-git turn a git diff into repository events
scan run extract + ingest + report in one workflow
validate-beliefs validate belief JSON files
validate-events validate event JSON files

This is enough to make the repository immediately useful for:

  • πŸ§ͺ local developer experiments
  • πŸ€– coding-agent wrappers
  • 🧾 report-first debugging workflows
  • πŸ”Œ future adapter work with OpenHands or SWE-agent

Project Surface πŸ“‘

BeliefSync is compact on purpose, but it already has a meaningful open-source surface:

Surface Count What It Gives You
CLI commands 16 end-to-end workflows, validation, LLM integration
belief types 5 bug localization, API contract, test expectation, requirement, dependency
report formats 4 text, json, markdown, html
adapters 2 OpenHands and SWE-agent placeholders for future integration
tests 13 baseline regression coverage
runtime dependencies 0 standard-library-first baseline

That combination is a big part of the project’s identity:

  • 🧱 serious enough to be useful
  • πŸ‘€ simple enough to inspect
  • 🌱 structured enough to extend

Project Layout πŸ—‚οΈ

Beliefsync/
  .github/
    assets/
    workflows/
  docs/
  examples/
  src/beliefsync/
  tests/
  README.md
  README.zh-CN.md
  pyproject.toml

Important paths:


Roadmap Direction πŸ›£οΈ

The next steps are not β€œmake the README prettier again.”
They are product and integration steps:

  • 🧬 richer symbol-level scope extraction
  • πŸͺ better git-native event parsing
  • 🧠 learned stale-belief detectors
  • 🀝 OpenHands and SWE-agent integration
  • ⏱️ watch / hook driven workflows
  • πŸ“Š richer dashboards for belief drift and recovery actions

BeliefSync should grow into:

a real reliability layer for coding agents operating in changing repositories.


Contributing 🌱

If you want to help, the most valuable contributions right now are:

  • 🧾 real repository traces
  • 🚨 stale-belief failure cases
  • 🧩 better event parsers
  • 🎨 stronger report UX
  • πŸ”Œ coding-agent integrations

See CONTRIBUTING.md, SECURITY.md, and CODE_OF_CONDUCT.md.


License πŸ“„

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages