v1.75.0 ·
A sync that changed nothing reported 229 updates
aidlc knowledge sync, run twice with nothing changed in between, reported most of the graph as updated. On this repo on 2026-10-09 the second run said updated: 229 of 264 entities. The true answer was 0.
The cause was entitiesEqual in packages/cli/src/knowledge/sync.ts. It compared JSON.stringify of the stored copy against JSON.stringify of the entity just parsed from YAML. The stored copy always comes back from SQLite with metadata: {}. A YAML file with no metadata key parses with none. Key order and keys outside the indexed shape could also make two equal entities differ. I measured the real corpus before writing the fix: all 229 false updates came from the missing metadata key alone. No entity differed by key order or an extra key today, but those are the same defect, so I covered them too.
What changed
Sync now counts an entity as updated only when its content changed. Run twice with nothing changed, it reports zero added, zero updated, zero removed. The comparison names each field the index stores, treats a missing metadata as an empty one, and ignores key order and keys the index never keeps. The order of tags still counts, because reordering a list is an edit someone made to the file. It is a patch: no command, flag or file format changed, only the value of updated.
I put the fix in the comparison, not the store. Making the stored copy drop an empty metadata would only move the mismatch to every entity that writes an empty one, and it would change what every other reader of the store receives. The comparison now knows a missing field and an empty one are the same thing, which is all the store can tell anyway.
The risk the other way is a comparison so forgiving it stops seeing real damage from a merge. Two guards cover it. The field list sits in a structure the compiler checks against the entity type, so a field added later fails the build until someone decides whether it counts. And packages/cli/test/knowledge-sync-counts.test.ts has a case per field, each changing that field alone and expecting exactly one update. I saw each fail when its field was dropped from the check.
The other half: a block that vanished without a word
The second fix is about the same area. When a knowledge source file broke, the # Codebase Knowledge block quietly disappeared from the instruction files and nobody was told.
Now aidlc update and aidlc init say so. A merge that leaves conflict markers in modules.yaml, or a hand edit that makes a document unreadable, prints knowledge graph: modules.yaml: skipped corrupt document on every run until you fix the file, not only on the run that happened to rebuild the index. When nothing is left to render, a second line says the block was left out and why. The block still goes, as it should. Keeping rows built from a file that no longer says them would serve stale facts.
A document holding a value the index cannot store, such as a description: that is a map, a missing author or a null name, used to throw a SQLite parameter error out of aidlc update, aidlc init and aidlc gate. Now that one document is left out, the warning names its file, id and field, and the rest of the graph is indexed. An index file that cannot be opened at all leaves the block out with a warning carrying the error, and the command finishes. Each warning prints once however many platforms the project has, since the render now runs once per command. A project with no graph, or a healthy one, sees the same output as before.