# Meta
`deft/stdext/meta` owns the unified project metadata database,
`.deft/meta.db` (SQLite, WAL). AI chat sessions, the symbol index, and
the file-access log all live in one file so tools can join across them
for project-aware context.
import "deft/stdext/meta" as meta
## API
| Def | Signature | Description |
|---|---|---|
| `db-path` | constant | `.deft/meta.db` (cwd-relative — the "project" is the process working dir) |
| `db-open` | `{||}` | Open/create the DB and ensure the schema; nil when SQLite is unavailable |
| `db-open-memory` | `{||}` | Same schema on `":memory:"` (tests) |
| `ensure-schema` | `{| db |}` | PRAGMAs, tables, indexes, optional FTS5 table + sync triggers |
| `get-symbols` | `{| db filepath |}` | Symbol vector for a file (`kind name line col label file meta`) |
| `indexed-at` | `{| db filepath |}` | Indexed-at timestamp (ms), or 0 |
| `find-symbol` / `find-symbol-all` | `{| db name |}` | First / all exact-name matches |
| `fts-search` | `{| db query |}` | FTS5 search over name/kind/decorators, ranked, limit 20 |
| `recently-accessed` | `{| db limit |}` | Distinct paths with last action + time |
| `recently-changed-symbols` | `{| db limit |}` | Symbols from recently saved files |
## Schema
Tables: `sessions`, `messages`, `chat_history`, `files`, `symbols`
(unique on `(file_id, name)` so concurrent runtimes can't duplicate
rows), `file_access`, and an optional `symbols_fts` external-content
FTS5 table. FTS5 creation is attempted at schema time; triggers are
installed only when it succeeds, so code touching `symbols_fts` should
tolerate absence.
`decorators` is stored as JSON text and parsed back into `meta` on read.
Paths are normalized with `fs/abs` before queries.
## Example
set db [meta/db-open] if ! [nil? $db] { set syms [meta/get-symbols $db "packages/stdext/src/html.dft"] set hits [meta/fts-search $db "syntax highlight"] set where [meta/find-symbol $db "html-escape"] set recent [meta/recently-changed-symbols $db 10] [sqlite/close $db] }