Files
marqdo-knowledge/docs/adr/0001-single-derived-artifact.md
marqdo-knowledge 430f950631 chore: bootstrap marqdo-knowledge crate, CLI surface and architecture docs
- pin Rust 2021 / MSRV 1.89 and exact dependency versions
- add typed model vocabulary (UTF-8 spans, canonical JSON-array node keys,
  node/edge/state enums, digest helpers) with unit tests
- add deterministic diagnostics and unified error/exit semantics (0/1/2)
- add the three-command clap surface with strict argument validation
- record the single-derived-artifact decision, architecture overview and
  current public contract; STATUS lists real evidence only
2026-11-25 22:24:51 +08:00

38 lines
1.9 KiB
Markdown

# ADR-0001: One derived SQLite artifact, one current contract
- Status: accepted (implementation baseline)
- Date: 2026-11-25
- Context: `marqdo-knowledge-development.md` §1, §7, §12, §17
## Decision
1. `marqdo-knowledge` persists exactly one knowledge artifact per root:
`.marqdo/knowledge.sqlite`. It is derived, rebuildable and private to the
tool. No `knowledge.yaml`, node manifest, JSONL graph, vector file or
separate knowledge IR is created or read.
2. The only machine input for Marqdo program semantics is the core CLI's current
public Analysis (`marqdo.analysis`, revision 3) produced by
`check ENTRY --emit PATH`. There is no second Analysis shape, version probe,
legacy reader or fallback parser.
3. The public CLI contract is exactly three business subcommands: `compile`,
`check`, `query`. No `init/search/graph/impact/export/serve` aliases.
4. Query never writes graph facts; `compile` is the only write path; `check`
never writes.
5. Schema changes are explicit and destructive: the tool rejects an old schema
revision and asks for `compile --rebuild`. There is no automatic migration.
6. Freshness is content-based: query compares the recorded input digests with
the current root and refuses to serve a stale snapshot unless the user
explicitly passes `--snapshot`.
## Consequences
* Deleting the database loses nothing; a rebuild is the only recovery needed.
* Incremental compilation must prove semantic equivalence to a full compile.
The implementation keeps a digest-guarded cache of normalised document facts
inside the database so that unchanged Analysis contexts are not re-invoked;
the cache is derived data and is verified on every use.
* Schema revision, Analysis revision and product version are independent
numbers. They are not bumped for cosmetic alignment.
* There is one producer and one validator for each boundary; retiring a shape
means deleting it, not keeping a compatibility branch.