Lattice Commit
A git-native checkpoint layer for test-gated AI code repair.
Lattice Commit wraps an LLM repair loop with a simple rule: commit only when the test signal improves, and reset when it does not. The goal is to preserve partial progress across multi-file fixes instead of throwing away a good change because another bug still fails.
This repository is the project home for the published package: the research
extract, examples, tests, and the distribution layer. The package itself is on
PyPI: pip install lattice-commit.
Status
- Open-source package: alpha,
lattice-commiton PyPI - Core behavior: git commits for improvements,
git reset --hard HEADfor regressions - Safety default: refuses to run unless the workspace is a clean git repository root
- Audit trail: JSONL run logs under
.git/lattice-commit/runs/ - Evidence: a synthetic multi-file repair benchmark (22 workspaces, 3 local models)
- Next evidence target: real-repo validation and reproducible benchmark bundle
The failure mode
The motivating benchmark studied a one-file-at-a-time edit/test/revert loop. In that setup, the bare loop solved one-file bug sets but failed when fixes had to accumulate across multiple files: a failed later test run reverted earlier useful work. Lattice Commit changes the state boundary from "all-or-nothing per cycle" to "keep monotone test improvements."
| Scenario | Bare loop | Lattice Commit |
|---|---|---|
| Bugs isolated in one file | Solved in benchmark | Solved in benchmark |
| Fixes required across 2+ files | Failed in benchmark | Solved in benchmark |
Each benchmark cell ran 8 or 10 trials: 8 for the one-file bug sets and the 2-bug, 2-file set, 10 for the sets spread over 3 and 4 files (the full table is in PAPER.md). The 22 workspaces and the trial data are not public and are available on request from futurisminstitute@gmail.com. The bare loop committed only when every test passed, so it could not solve a bug set spanning two files; the paper's 2026-10-22 correction explains what that means for the result.
The current claim is deliberately scoped: this demonstrates a structural failure mode in the tested loop. It is not yet a universal claim about every coding agent, repository, model, or test runner.
Install
pip install lattice-commit
Use it
Python library
from lattice_commit import incremental_repair
result = incremental_repair(
workspace="./my_project",
test_cmd=["python", "-m", "pytest", "-q"],
llm_fix=my_fix_function,
max_cycles=30,
)
print(result)
print(result.run_log)
The callback signature is:
def my_fix_function(filepath, content, error_output):
return complete_replacement_content_or_none
CLI with Ollama
lattice-commit --workspace ./my_project --test-cmd "python -m pytest -q"
lattice-commit --workspace ./my_project --test-cmd "python -m pytest -q" --majority-vote 3
The CLI uses a local Ollama model by default. It expects a clean git repo and prints the run-log path after completion.
Safety model
Lattice Commit now uses real git operations:
- It verifies
workspaceis the repo root. - It refuses dirty or untracked files unless
--allow-dirty/allow_dirty=Trueis passed. - It creates commits with messages like
lattice-commit: checkpoint cycle 3. - It stages only the selected repair file for each checkpoint.
- It rolls back non-improving edits with
git reset --hard HEADplusgit clean -fd. - It records lifecycle events in
.git/lattice-commit/runs/*.jsonl.
Run it on a branch or throwaway clone until the behavior has been validated on your project.
Research
The public research extract is in PAPER.md. It describes the synthetic multi-file wall result and the boundary-mechanism framing.
Development priorities
- Publish a reproducible benchmark bundle.
- Validate the mechanism on real repositories with known multi-file bugs.
- Improve test-result parsing beyond pytest-style output.
- Add a dry-run/report mode before editing files.
- Ship one integration recipe tested end to end.
Files
- PAPER.md - public research extract
- CHANGELOG.md - release notes
- examples/ - integration sketches and examples
- site/ - static project page
License
MIT
Metadata
Release files for lattice-commit 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lattice_commit-0.1.2.tar.gz | 24.1 kB | Without provenance | Details for lattice_commit-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lattice_commit-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for lattice_commit-0.1.2-py3-none-any.whl |
Total release size: 40.1 kB
Release files / lattice_commit-0.1.2.tar.gz
| Download URL | lattice_commit-0.1.2.tar.gz |
|---|---|
| Size | 24.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20ca6b4ffb43504765ef848a7eb592d0702a2fd80f12358ac604090ebc43c3d8
|
|
BLAKE2b-256 checksum How to use checksums |
48822e2d3584d7926e03f6d7433832a7ed888b4f48701c1a84b6af0c22078912
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / lattice_commit-0.1.2-py3-none-any.whl
| Download URL | lattice_commit-0.1.2-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc602be62571f30ebcd26b7d7aad97efb88b6318b9bd113f0c0735bd3a883a6d
|
|
BLAKE2b-256 checksum How to use checksums |
980d82143882e33f8e53cc8bf69d3f6b38196859440b59652c9f945aab7f06d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for lattice-commit 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.