Documentation
¶
Overview ¶
Package agent is the conversational assistant.
The rest of the system is retrieval and automation; this is the part that talks back. It grounds each reply in the vault (so it answers from what you actually know) and in the open loops you have left (so it knows what is on your plate right now), and it remembers the conversation — which is the difference between an assistant and a search box.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Learn ¶
Learn extracts durable memories from the most recent exchange and persists them, so the next session starts already knowing them. Kept separate from Reply so the caller controls timing and database lifetime — it runs after the reply is delivered, and a failure to learn never affects the answer. Returns how many new memories were stored.
func Reply ¶
func Reply( db *sql.DB, ix *index.Index, rt *router.Router, conv *Conversation, userMsg string, onToken func(string), ) (string, error)
Reply streams the assistant's response to the latest user message.
It assembles three things into the prompt: who it should be, what it already knows that is relevant (vault retrieval), and what is currently on the user's plate (the brief). Then the conversation history, then the question. onToken receives text as it generates, so the UI fills in live.
Types ¶
type Conversation ¶
type Conversation struct {
Turns []Turn
}
Conversation holds the running dialogue. Kept in memory on the app side; a second brain's conversations are ephemeral working context, not vault content — anything worth keeping becomes a note through the review queue.