Skip to main content

Module semantic_skills

Module semantic_skills 

Source
Expand description

A9 — Semantic Skills: Vectors, Embeddings & Scratchpads.

First-class vector cosine distance, in-process text embedding, semantic search, and ephemeral scratchpad memory for agent workflows.

§Design

  • Vector: Fixed-size f32 vector with cosine distance.
  • VectorStore: A bounded collection of vectors with semantic search (k-nearest neighbors by cosine similarity).
  • TextEmbedder: In-process text embedding using FNV-1a hashing into a fixed-dimensional vector. This is a lightweight embedding suitable for semantic deduplication and approximate search — not a replacement for neural embeddings.
  • Scratchpad: Ephemeral key-value memory for agent workflows. Bounded, with TTL-based expiry.

§Integration

  • Uses A5 (blackboard) for observable state channels.
  • Designed for zero-heap on hot paths (search uses caller-supplied buffers).

Structs§

Scratchpad
An ephemeral key-value scratchpad with TTL-based expiry. Designed for agent workflows that need temporary memory between steps.
ScratchpadEntry
An ephemeral scratchpad entry with TTL.
SearchResult
A search result from the vector store.
StoredVector
A stored vector with an associated key and optional metadata.
TextEmbedder
A lightweight in-process text embedder using FNV-1a hashing. Maps text into a fixed-dimensional vector by hashing character n-grams into vector dimensions. This is suitable for semantic deduplication and approximate search, not as a replacement for neural embeddings.
Vector
A fixed-size vector.
VectorStore
A bounded vector store with semantic search.

Enums§

ScratchpadError
Errors from the scratchpad.

Constants§

DEFAULT_SCRATCHPAD_TTL
Default scratchpad TTL (in ticks).
EMBED_DIM
Default embedding dimensionality.
MAX_SCRATCHPAD_ENTRIES
Maximum scratchpad entries.
MAX_VECTORS
Maximum vectors in a store.