agsync
ESLint for your agents' memory — because the decision log your AI agents write is already lying to them.
$ agsync check
AGENTS.md
6 error protocol-files-exist boot protocol requires 'memory/goal.md', which does not
exist — this step is unsatisfiable and every session skips it
memory/decisions.md
11 error unique-decision-ids D-021 is redefined here (first defined at line 7);
7 reference(s) to D-021 are now ambiguous
88 error relations-resolve D-027 supersedes D-019, which is not defined
tasks/25-search-indexing.md
3 warn status-not-qualified status is qualified with free text ('(all tiers except the
edge cache)'); keep the status machine-readable
tasks/README.md
- error index-matches-files task 26 exists (tasks/26-webhook-retries.md) but is absent
from the index — invisible to anyone reading it
14 error index-matches-files task 25: index says 'todo', file says 'done'
27 decisions, 26 tasks, 25 index rows
9 error(s), 4 warning(s)
The problem
You gave your agents a memory. AGENTS.md with a boot protocol, a numbered
decision log, a task queue. Every session starts by reading it. It is the only
thing standing between a new agent and a cold start.
Nothing checks that it is true.
Markdown never fails. A decision ID reused for a second, unrelated decision. A
boot step pointing at a file nobody ever wrote. A status of done (stub). An
index row that disagrees with the task file it names. Every one of these parses,
renders, and reviews perfectly well, and every one is read as ground truth by the
next agent that boots.
Four things make the decay invisible, and they compound:
- The reference graph is prose.
D-021is a bare token, not a link. Nothing resolves it, so nothing notices when a second entry claims the same ID and every existing reference to it silently becomes ambiguous. - Contradictions live in separate files. The index says
todo, the task file saysdone. The protocol says "read this", and the file was never created. No single diff contains both halves, so no review can catch it. - Every writer has a partial view. Each session is a different agent, and each edit is locally reasonable. Rot is what locally reasonable edits add up to when nothing holds the whole.
- A false memory looks exactly like a true one. No crash, no red test. The agent reads a confident, well-formatted, wrong statement and acts on it.
The failure is not hypothetical and it is not slow. A repo written by several agents over a couple of days will already contain several of these.
A memory system whose integrity depends on being maintained by hand degrades at exactly the speed you use it.
The design is not the problem — AGENTS.md plus a decision log is the right
shape. The problem is that nothing enforces it.
The fix is not a smarter agent
Agents self-report badly. They tell you what they intended to do, not what they did, and every harness writes in a different dialect. "Be more careful" does not survive a new agent joining.
git push is a choke point nobody can skip. Put the validation there.
Install
uvx agsync check # try it, no install
pipx install agsync # keep it
pip install agsync
Python 3.11+. Zero dependencies — the whole thing is stdlib, so it runs in a git hook without a virtualenv surprise.
Use
agsync check # lint the repo
agsync check --warn-only # first run: see everything, fail nothing
agsync check --baseline # accept today's mess, fail on new mess
agsync check --no-baseline # what an agent runs at boot: everything, unsuppressed
agsync check --format github # inline annotations on the PR diff
agsync check --format json # for your own tooling
agsync replay <repo> # how many past pushes the gate would have stopped
agsync rules # what it checks and why
agsync init # scaffold a memory structure from scratch
agsync install-hooks # gate commits locally
Adopting an existing repo
Do not turn everything on at once — a linter that rejects most of your pushes on day one gets uninstalled on day one.
agsync check --warn-only # 1. look at the damage
agsync check --baseline # 2. freeze it; new violations now fail
The baseline records a fingerprint per violation that survives line shifts, so
unrelated edits above a known problem don't resurrect it as "new". Delete
entries from .agsync-baseline.json as you fix them.
The baseline governs the gate, and never the reader. It records what should stop a push — a decision about your rollout, not a statement about what is true. An agent about to act on this memory needs the whole picture, including the parts you chose not to block, so the boot protocol runs:
agsync check --no-baseline
Suppressing a finding is how you keep working. Believing it was suppressed because it was fixed is how a new session acts on something false.
Replay: how bad is it already?
agsync replay runs the same check engine at every commit in a repository's
history and counts the pushes the gate would have stopped. Point it at a repo
that has been running on hand-maintained memory for a while, and it will tell you
when each violation started and how long it has been sitting there.
$ agsync replay . --ref main --first-seen
sha date errors rules
3ad9e51 2026-03-02 0 —
...
b7e2d13 2026-03-14 4 index-matches-files, links-resolve, unique-decision-ids
18 of 42 pushes would have been rejected
rule first failed survived
protocol-files-exist 9f1c0a4 2026-03-04 31 commits, 9 days (still failing at HEAD)
unique-decision-ids c40b8f2 2026-03-09 14 commits, 4 days (still failing at HEAD)
index-matches-files c40b8f2 2026-03-09 14 commits, 4 days (still failing at HEAD)
The second table is the uncomfortable one. A broken boot step usually dates from the commit that introduced the protocol and is usually still broken at HEAD, because nothing has ever checked it.
Replay clones the target to a temp directory and moves HEAD only inside that clone, so it cannot leave your repository detached at an old commit. It takes a path or a clone URL, exits 0 unless the run itself fails — it reports on history, it does not gate it — and ignores any baseline, because the question is what the rules would have caught, not what someone had already told the gate to overlook.
One caveat worth stating out loud: replay judges old commits by today's rules. The claim is "these would be rejected now", not "these were rejected then".
Rules
| Rule | Default | Catches |
|---|---|---|
unique-decision-ids |
error | Two ledger entries sharing an ID, making every reference ambiguous |
decision-refs-resolve |
error | A D-xxx cited anywhere that the ledger never defines |
relations-resolve |
error | (supersedes D-019) where D-019 doesn't exist |
no-self-reference |
error | A decision superseding itself |
decision-has-date |
error | An entry with no date, so the ledger can't be ordered |
protocol-files-exist |
error | A boot instruction pointing at a file that isn't there |
links-resolve |
error | Any relative markdown link with no target |
status-in-enum |
error | A status outside todo/in-progress/done/superseded |
status-not-qualified |
warn | done (stub) — not machine-readable |
index-matches-files |
error | Index and task files disagreeing, or a task missing entirely |
task-refs-resolve |
error | A dependency on a task that doesn't exist |
no-dependency-cycles |
error | Tasks that can never be executed in any order |
blocked-task-not-done |
warn | A task marked done while its dependency is still open |
no-orphan-memory-files |
warn | A memory file nothing references, so no agent reads it |
Configuration
.agsync.toml. Severity is configuration; rule logic is not.
exclude = ["archive/"]
[rules]
status-not-qualified = "warn"
decision-has-date = "off"
Also readable from [tool.agsync] in pyproject.toml.
CI
- uses: gabrielft-me/agsync@v1
Or directly:
- run: pipx install agsync && agsync check --format github
Findings render inline on the pull request diff. Pair it with branch protection and the memory can't rot through a merge.
How it works
Normalize, don't demand. Real memory repos are written by several agents over weeks and the format drifts: field sets vary between entries, values wrap across lines, index tables use different column orders in the same file. The parser absorbs all of it into a graph. Rules only ever see the graph.
Rules are tiny and isolated. Each is a function taking the parsed memory and yielding findings. No shared state, no ordering, no knowledge of each other.
from agsync.rules import rule
from agsync.model import ERROR, Finding
@rule("no-undated-tasks", ERROR, "A task file carries no date.")
def no_undated_tasks(memory):
for task in memory.tasks.values():
if "date" not in task.status_raw:
yield Finding("no-undated-tasks", task.path, 1, "no date")
One report contract. Every finding is {rule, path, line, message, severity}.
Text output, JSON, and GitHub annotations all derive from it, so a new output
format never touches a rule.
Roadmap
- Linter, config, baseline, JSON/GitHub output
-
initscaffold, local hooks with chaining -
replay: measure the decay across a repository's whole history -
--fix: regenerate the task index; interactive ID renumbering - YAML front matter schema — make the D-ID ↔ task graph structured instead of prose
- Harness adapters (Claude Code, Cursor) writing commit trailers at commit time
-
agsync draft: turn captured trailers into a ledger entry, BYO key, opened as a PR - Single static binary
What this will never be
An intent-inference engine. A post-receive hook fires after the push —
the agent's turn is over and its context is gone. All the server sees is a diff
and a message, strictly less than the agent had. The reason a project pivoted
from one approach to another is not in the diff and no model recovers it from
there.
So: capture at commit time, enforce at push time. When the ledger entry lands, the model formats a why that a human or agent already stated. It never invents one. If nobody supplied a reason, the right outcome is a rejected push — not a plausible-looking fabrication. A ledger that looks trustworthy and isn't is worse than no ledger.
Contributing
See CONTRIBUTING.md. New rules are welcome and are the easiest place to start — one function, one test, one row in the table above.
License
MIT.
Metadata
Release files for agsync 0.1.0
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 | |
|---|---|---|---|---|
| agsync-0.1.0.tar.gz | 45.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agsync-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 79.7 kB
Release files / agsync-0.1.0.tar.gz
| Download URL | agsync-0.1.0.tar.gz |
|---|---|
| Size | 45.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0fc6a2857f62805311508728fd611aba5818679cef11fbb5e2c07ca4bf21683
|
|
BLAKE2b-256 checksum How to use checksums |
e1c6806114070b2fa845f20b789f31cb92c8c810c1b923460e5a82bc643550b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / agsync-0.1.0-py3-none-any.whl
| Download URL | agsync-0.1.0-py3-none-any.whl |
|---|---|
| Size | 34.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0559fc90bc22fcdb494a67aea0340860acbc48f2fd0d3c366b387fb27aea1da
|
|
BLAKE2b-256 checksum How to use checksums |
26f10dd31371cd9797213648b93d7cb9051ffebb4cdbd4abee258db27fd17aca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logSecurity for agsync 0.1.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for agsync-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logA 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.