diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/SKILL.md | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/SKILL.md b/doc/SKILL.md index fb17189..570bde7 100644 --- a/doc/SKILL.md +++ b/doc/SKILL.md @@ -33,6 +33,10 @@ guix shell -D -f guix.scm -- odin build . -out:bin/ai-memory -vet -strict-style "-extra-linker-flags:-L$GUIX_ENVIRONMENT/lib -Wl,-rpath,$GUIX_ENVIRONMENT/lib" ``` +`guix build -f guix.scm` also runs the package's check phase, which builds a +throwaway store, records an entry, indexes it and queries it -- that is what +proves the Guile side is wired up. + The store defaults to `<repo>/ai-memory.sqlite`; override with `--db PATH` or `$AI_MEMORY_DB`. `--repo PATH` / `-C PATH` selects the repository, and may be given before or after the command. @@ -68,6 +72,40 @@ ai-memory -C REPO attach HEAD --session fix-parser `record` and `attach` import the commit on demand, so they work immediately after committing even if `sync` has not run yet. +## The topic index (optional, derived) + +A second, *derived* store: a Xapian index over the SQLite one, so a reader can +enter by **concept** ("topic:pve") or by repository and kind ("repo:genenetwork4 +type:commit") instead of by symbol name. It is disposable -- delete the +directory and `update-index --rebuild` -- and SQLite stays the truth. + +```sh +ai-memory --index DIR update-index # bring it up to date +ai-memory --index DIR update-index --rebuild # after a schema change +ai-memory --index DIR search 'topic:pve' +ai-memory --index DIR search --limit 5 'type:commit ravanan repo:genenetwork4' +``` + +(The directory defaults to `<store>.d/index`, override with `--index` or +`$AI_MEMORY_INDEX`. `search` without `--index` keeps using SQLite FTS.) + +**Prefixes**: `topic:`, `repo:`, `type:` (`reasoning`|`commit`), `session:`, +`commit:` (7-character hash), `date:` (`yyyymmdd`). Everything else is free +text, stemmed. The default operator is AND; `--or` widens it. + +Topic terms come from the **session id**, split on hyphens: a session called +`gemma-pve` answers `topic:gemma` and `topic:pve`. So the cheapest way to make +an entry findable by concept is to name the session after the concept. + +Why a subprocess and a Guile script: `libxapian` is C++-only, so a foreign call +from Odin needs a hand-written C shim. `guile-xapian` already has one, tested +and maintained (`scripts/index.scm` owns every Xapian call; ai-memory shells +out to it). The boundary is a store path in, JSON out. + +The JSON a search returns is the record as indexed -- `key`, `repo`, `session`, +`kind`, `date`, `commit`, `title`, `body`, `terms` -- plus `docid` and +`percent`. `count` is how many came back, `matches` how many the index found. + ## Rules - **Never write to `commits`, `symbols` or `touches` by hand.** They are derived; |
