Auwai

Schema

The coverage ledger is .auwai/auwai.sqlite. Its DDL is skills/auwai/schema/ledger.sql, schema version 1, executed by store.init.

The planning cache is .auwai/plan.sqlite. Its DDL is skills/auwai/schema/plan.sql, schema version 2, executed by planindex.build.

Both are ordinary text files in the skill bundle, so an installed skill carries the exact schema it expects.

Migrations

The ledger carries meta.schema_version. store.init refuses a ledger newer than the release and refuses a ledger whose meta.root does not match the repository. Older ledgers are upgraded in place: facts gain fact_key, revision, and timestamps; reads gain delivered bytes and completion; plans and segments gain planner columns. The facts identity migration deduplicates by stable key and is idempotent.

The knowledge service records its own migrations in schema_migrations (see knowledge service).

Core tables

meta

Key and value. It stores the repository name, root, head, generated time, scope counts, and schema_version.

files

Path, sha256, mtime, size, scope, skip reason, and indexed time.

chunks

The table stores the chunk identity, file range, symbol, kind, language, token and byte counts, hash, provider, method, purpose, scope, and skip reason.

partitions

Partition id, parent, path, kind, language, tokens, chunk count, depth, and oversized flag.

Coverage tables

coverage

Chunk id, indexed, mapped, read, finding count, stale flag, last turn, and read time.

findings

Autoincrement id, chunk id, path, text, purpose, tags, time, and stale flag. The unique key is chunk id, time, and text.

reads

Session, chunk id, turn, and time.

events

Kind, path, chunk id, time, and detail. It records sync, read, finding, and segment changes.

Plan tables

plans

The table stores the plan id, repository, context, fixed prompt, output reserve, safety, segment budget, read count, synthesis count, turns, compactions, time, and status.

segments

Segment id, plan, ordinal, kind, partition, budget, tokens, chunk ids, status, and created time.

Search table

chunk_fts

FTS5 over chunk id, path, symbol, label, and purpose. The chunk id is unindexed and is used to join the chunk row.

Multiple repositories

There is one ledger per repository. store.db_path(repo) resolves to <repo>/.auwai/auwai.sqlite unless [database] path names another location.

The schema has no repo_id column. Every table is implicitly scoped to the repository that owns the file. A workspace keeps a manifest over several per-repository ledgers; it does not merge their tables.

A database records its owner in meta.root. Opening a ledger whose meta.root names another repository is refused, so two repositories cannot accidentally share one file.

SQLite support

auwai doctor reports the SQLite version and whether FTS5 is available. The check runs an in-memory CREATE VIRTUAL TABLE ... USING fts5 probe.

If Python was built without sqlite3, or SQLite was built without FTS5, the ledger cannot open. index and refresh still write the JSONL index and warn that the ledger sync failed. query, coverage, fullread, watch, and audit return a clear error instead of a traceback.