Documentation
¶
Overview ¶
Package recall is a tiny full-text index over saved sessions. It powers the /recall slash command — search across every conversation you've had with yottacode, ranked by FTS5 relevance.
The index lives at ~/.yottacode/index.sqlite and is rebuilt incrementally whenever a session is saved. At startup the TUI re-indexes every session in a background goroutine so historical sessions become searchable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hit ¶
type Hit struct {
SessionID string
SessionName string
Model string
Created time.Time
Role adapter.Role
MsgIndex int
Snippet string
}
Hit is one search result: the message that matched plus the surrounding session metadata. Snippet contains FTS5-highlighted match context with `[…]` brackets around the matched terms.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index is the writable handle on the FTS5 database. Safe to share across goroutines because database/sql serializes operations.
func MustOpenForTest ¶
MustOpenForTest opens a fresh in-temp-dir index for use from another package's tests. Panics on failure (which would mean the test fixture itself is broken). Lives in the production file so it's exported, but is only intended to be called from *_test.go.
func Open ¶
Open returns the index living at ~/.yottacode/index.sqlite, creating the directory and schema as needed.
func (*Index) Close ¶
Close releases the underlying database handle. It's fine to ignore the error during shutdown.
func (*Index) IndexSession ¶
IndexSession upserts every user/assistant message body for the given session. Replaces any prior FTS rows for that session id, so re-indexing after a turn is correct (and cheap — sessions are at most a few KB).
func (*Index) Search ¶
Search runs an FTS5 MATCH query and returns up to `limit` hits sorted by rank (most relevant first). limit defaults to 10 when ≤ 0.
The first attempt uses the raw query so power users can still write FTS5-native expressions ("auth OR jwt", "\"exact phrase\"", etc.). On a syntax failure we retry with a sanitized version so naive inputs like "nothing-matches-this" — which FTS5 reads as a NOT operator — still produce a clean empty result instead of a SQL error.