Documentation
¶
Index ¶
- Variables
- func NewEmbedHandler(memStore *memory.Store, model string, logger func(string, ...any)) queue.Handler
- type Config
- type Option
- type SearchOptions
- type Tesseract
- func (c *Tesseract) Close() error
- func (c *Tesseract) Embed(ctx context.Context, recordID string) error
- func (c *Tesseract) EmbedRevision(ctx context.Context, revisionID string) error
- func (c *Tesseract) GetCurrentRevision(ctx context.Context, namespace, key string) (memory.Revision, error)
- func (c *Tesseract) GetRevisionHistory(ctx context.Context, namespace, key string) ([]memory.Revision, error)
- func (c *Tesseract) MemoryStore() *memory.Store
- func (c *Tesseract) RecallMemory(ctx context.Context, in memory.RecallInput) ([]memory.RecallResult, error)
- func (c *Tesseract) Search(ctx context.Context, query string, opts SearchOptions) ([]embedding.SearchResult, error)
- func (c *Tesseract) Store() *contextstore.Store
- func (c *Tesseract) WriteMemory(ctx context.Context, in memory.WriteInput) (memory.Revision, error)
Constants ¶
This section is empty.
Variables ¶
ErrEmbedderUnavailable is returned when an embedding operation is attempted but no embedder has been configured on the Tesseract instance. It is the same sentinel exposed by memory.ErrEmbedderUnavailable.
Functions ¶
func NewEmbedHandler ¶
func NewEmbedHandler(memStore *memory.Store, model string, logger func(string, ...any)) queue.Handler
NewEmbedHandler returns a queue.Handler that processes embed jobs. The handler decodes the revision ID from the job payload and calls EmbedRevision on the memory store to generate and persist the embedding.
Types ¶
type Config ¶
type Config struct {
// RootDir is the base directory of the tesseract data layout. When DBPath
// and RecordsDir are empty, the main database and JSON record tree are
// derived under RootDir/data/ — the layout embedded consumers (nanite,
// tesseract lib v0.7.0) rely on. RootDir is always required.
RootDir string
// DBPath, when set, is the explicit path to the main context database,
// overriding the RootDir/data/index/context.db derivation.
//
// RecordsDir, when set, is the explicit JSON record tree, overriding
// RootDir/data/records.
//
// These let a go-apppaths-resolved caller (cmd/tesseract, cmd/smoke) point
// the library at the XDG layout without changing default behavior for
// RootDir-only consumers. Added for the go-apppaths migration
// (CW-20260517-0066).
DBPath string
RecordsDir string
}
Config holds the top-level configuration for a Tesseract instance.
type Option ¶
type Option func(*options)
Option is a functional option for Open.
func WithDedupThreshold ¶
WithDedupThreshold sets the similarity threshold for semantic dedup.
func WithEmbedder ¶
func WithEmbedder(e embedcontracts.Embedder) Option
WithEmbedder sets the embedding provider used for vector indexing.
func WithEmbeddingModel ¶
WithEmbeddingModel sets the model name passed to the embedder.
func WithLogger ¶
WithLogger sets a custom log function (defaults to log.Printf).
type SearchOptions ¶
SearchOptions controls the behavior of a Search call.
type Tesseract ¶ added in v0.8.0
type Tesseract struct {
// contains filtered or unexported fields
}
Tesseract is the top-level library handle. Create one via Open().
func Open ¶
Open creates a Tesseract instance rooted at cfg.RootDir, initializing the SQLite store, memory subsystem, and decay goroutine.
func (*Tesseract) Close ¶ added in v0.8.0
Close stops the decay goroutine and closes the underlying store.
func (*Tesseract) Embed ¶ added in v0.8.0
Embed generates and stores a vector embedding for the record identified by recordID. It fetches the record from the store, extracts embeddable text, calls the configured embedder, and upserts the resulting vector.
func (*Tesseract) EmbedRevision ¶ added in v0.8.0
EmbedRevision generates and stores an embedding for a memory revision.
func (*Tesseract) GetCurrentRevision ¶ added in v0.8.0
func (c *Tesseract) GetCurrentRevision(ctx context.Context, namespace, key string) (memory.Revision, error)
GetCurrentRevision returns the current revision for a namespace/key pair.
func (*Tesseract) GetRevisionHistory ¶ added in v0.8.0
func (c *Tesseract) GetRevisionHistory(ctx context.Context, namespace, key string) ([]memory.Revision, error)
GetRevisionHistory returns all revisions for a namespace/key pair, newest first.
func (*Tesseract) MemoryStore ¶ added in v0.8.0
MemoryStore returns the underlying memory.Store.
func (*Tesseract) RecallMemory ¶ added in v0.8.0
func (c *Tesseract) RecallMemory(ctx context.Context, in memory.RecallInput) ([]memory.RecallResult, error)
RecallMemory retrieves memories by namespace, ranking, and filters.
func (*Tesseract) Search ¶ added in v0.8.0
func (c *Tesseract) Search(ctx context.Context, query string, opts SearchOptions) ([]embedding.SearchResult, error)
Search embeds the query string and returns the top matching records ranked by cosine similarity against all stored embeddings for the configured model.
func (*Tesseract) Store ¶ added in v0.8.0
func (c *Tesseract) Store() *contextstore.Store
Store returns the underlying contextstore.Store.
func (*Tesseract) WriteMemory ¶ added in v0.8.0
WriteMemory writes a new memory revision.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
smoke
command
|
|
|
tesseract
command
|
|
|
Package domains defines the in-tree domain discriminator and per-domain policy interface for Tesseract revisions.
|
Package domains defines the in-tree domain discriminator and per-domain policy interface for Tesseract revisions. |
|
examples
|
|
|
adoption-go
command
Command adoption-go is the compile-checked external-consumer example used by docs/guides/tesseract-adoption-and-v0.9-migration.md.
|
Command adoption-go is the compile-checked external-consumer example used by docs/guides/tesseract-adoption-and-v0.9-migration.md. |
|
internal
|
|
|
contextapi
Package contextapi — synthesis handler.
|
Package contextapi — synthesis handler. |
|
contextstore
Package contextstore — audit event type identifiers.
|
Package contextstore — audit event type identifiers. |
|
knowledge
Package knowledge implements the Knowledge domain on top of the shared memory revision store.
|
Package knowledge implements the Knowledge domain on top of the shared memory revision store. |
|
llm/anthropic
Package anthropic is a thin SDK-backed wrapper that satisfies the Complete/Capabilities portion of llmcontracts.Provider for tesseract's synthesis path (POST /v1/synthesis/ask).
|
Package anthropic is a thin SDK-backed wrapper that satisfies the Complete/Capabilities portion of llmcontracts.Provider for tesseract's synthesis path (POST /v1/synthesis/ask). |
|
llm/openai
Package openai is a thin SDK-backed wrapper that satisfies embedcontracts.Embedder and the Complete/Capabilities portion of llmcontracts.Provider for tesseract's embedding + synthesis paths.
|
Package openai is a thin SDK-backed wrapper that satisfies embedcontracts.Embedder and the Complete/Capabilities portion of llmcontracts.Provider for tesseract's embedding + synthesis paths. |
|
mcpadapter/skills
Package skills embeds agent-facing markdown skills that document Tesseract primitives and features.
|
Package skills embeds agent-facing markdown skills that document Tesseract primitives and features. |
|
memory
Package memory — audit sink definition.
|
Package memory — audit sink definition. |
|
memorytime
Package memorytime owns the sortable timestamp encoding used by the memory subsystem's SQLite tables.
|
Package memorytime owns the sortable timestamp encoding used by the memory subsystem's SQLite tables. |
|
sqlitedsn
Package sqlitedsn centralizes SQLite connection-string construction.
|
Package sqlitedsn centralizes SQLite connection-string construction. |
|
webui
Package webui serves the embedded Tesseract frontend as an SPA.
|
Package webui serves the embedded Tesseract frontend as an SPA. |
|
Package memory re-exports the Tesseract memory subsystem types for use by external consumers.
|
Package memory re-exports the Tesseract memory subsystem types for use by external consumers. |