Expand description
On-disk sidecar for the “git roundtrip” promise.
ASD’s live state lives in a SQLite-backed ASG repository. The sidecar
mirrors the current-state subset of that data to a .asd/v1/ tree
inside the project root so it travels with git clone and can hydrate
a fresh machine without a network registry.
Two entry points:
sync_to_dir: ASG -> disk. Walks the/asd/v1/ASG tree and emits one JSON file per effect/ledger entry/symbol under<dir>/.asd/v1/, plus a plaintextmeta/schema-version.hydrate_from_dir: disk -> ASG. Reads the sidecar back and writes via the existingAsgIndexStore,AsgEffectStore,AsgLedgerStoretraits, producing equivalent state to what was synced.
§What the sidecar does NOT carry
Per DESIGN.md’s three-tier split: the sidecar is current-state only.
ASG commit metadata (per-edit intent/confidence/authority) lives in
the full-fidelity ASG and is lost on hydrate — that tier is what an
opt-in ASG registry would restore. Speculative branches, transitive
caches, traces, and the semantic index are also excluded: they’re
either regenerable (asd index, asd verify-effects) or registry-
only. Effect verification fields rehydrate as-is; no re-verification
runs during hydrate.
§Orphan handling
Sync writes files whose keys are present in ASG and leaves other files
untouched. If a symbol is removed from the index, its sidecar files
become orphans on disk. M10 accepts this; asd sync --prune is a
follow-up. (See DEFERRED.md § Miscellaneous.)
§Filename safety
Python qnames (payments.charge_card) and TypeScript qnames
(driver.main) are filesystem-safe on macOS and Linux: no slashes,
no colons. On Windows there could be conflicts with reserved device
names (COM1, LPT1, NUL, CON, etc.). M10 ignores that; a
follow-up should sanitize or hash Windows-reserved filenames.
Structs§
- Hydrate
Summary - Result of
hydrate_from_dir.missing_schema_versionis true when the sidecar exists but has nometa/schema-versionfile; hydrate still proceeds but callers should surface the mismatch. - Sync
Summary - Result of
sync_to_dir. Counts what was written; the schema version is always stamped.
Enums§
- Sidecar
State - Observable lifecycle state of the on-disk sidecar.
Functions§
- hydrate_
from_ dir - Read a
.asd/v1/sidecar underdirand write its contents back into the ASG repo via the existing stores. - hydrate_
from_ dir_ with_ cache hydrate_from_dir, also writing the ledger entries it loads into the ledger cache, which answerslist_entries.- mark_
fresh_ reset - Write the
meta/fresh-resetsentinel so agents know a deliberate reset occurred. Call this whenasd init --resetor an equivalent wipe operation runs. - outdated_
hooks - A warning when the project under
rootruns git hooks from before Plan B, which reload the whole ledger from.asd/v1/withasd hydrateon every checkout and merge. On a store that holds more than the sidecar — anything since the lastasd sync— that rewrote every entry each time, and before v1.4.7 it re-filed moved entries under their old symbols.asd initinstalls the current hooks, which import committed conclusions instead. - prune_
sidecar - Remove orphaned
.asd/v1/sidecar files — files whose keys no longer exist in the live ASG index. Returns the number of files/dirs removed. - sidecar_
lifecycle_ state - Inspect the on-disk sidecar under
dirand return its lifecycle state. - sync_
to_ dir - Mirror live ASG state into the
.asd/v1/sidecar underdir.