Documentation
¶
Index ¶
- Variables
- func MatchQuestion(a, b string) bool
- func NormalizeQuestion(q string) string
- type AddInput
- type Entry
- type EntryType
- type Recorder
- func (r *Recorder) FindByTopicKey(projectID, topicKey string) ([]Entry, error)
- func (r *Recorder) RecordAppliedProposal(projectID, proposalID, summary string) (Entry, error)
- func (r *Recorder) RecordApprovedContext(projectID, atype, content string) (Entry, error)
- func (r *Recorder) RecordApprovedResearch(projectID, researchID, topic, summary string) (Entry, error)
- func (r *Recorder) RecordChangeEvent(projectID, eventType, summary string) (Entry, error)
- func (r *Recorder) Search(projectID, query string) ([]Entry, error)
- func (r *Recorder) Supersede(projectID, oldTopicKey string, newEntry Entry) (Entry, error)
- type Service
- type Store
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("memory entry not found")
Functions ¶
func MatchQuestion ¶
MatchQuestion returns true if two questions match after normalization.
func NormalizeQuestion ¶
NormalizeQuestion normalizes a question for comparison: lowercase, trim, remove punctuation, normalize whitespace. Hyphens, slashes, and similar separators are treated as whitespace.
Types ¶
type AddInput ¶
type AddInput struct {
ProjectID string `json:"project_id"`
EntryType EntryType `json:"entry_type"`
Title string `json:"title"`
Question string `json:"question,omitempty"`
Answer string `json:"answer,omitempty"`
Content string `json:"content,omitempty"`
Citation string `json:"citation,omitempty"`
Source string `json:"source,omitempty"`
}
AddInput specifies the fields for creating a new memory entry.
type Entry ¶
type Entry struct {
ID string `json:"id"`
ProjectID string `json:"project_id"`
EntryType EntryType `json:"entry_type"`
Title string `json:"title"`
Question string `json:"question,omitempty"`
Answer string `json:"answer,omitempty"`
Content string `json:"content,omitempty"`
Citation string `json:"citation,omitempty"`
Source string `json:"source,omitempty"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Entry is a single durable project memory record.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder writes memory records automatically when important project events occur: approved context, approved research, applied proposals, change events. It is the single authority for "what gets remembered."
All writes use the memory.Service (and Store) underneath, ensuring FTS-backed storage. The Recorder also supports supersession and topic-key-based lookup.
func NewRecorder ¶
NewRecorder creates a recorder backed by the given store.
func (*Recorder) FindByTopicKey ¶
FindByTopicKey searches memory entries by their topic_key in source.
func (*Recorder) RecordAppliedProposal ¶
RecordAppliedProposal creates a memory entry from an applied proposal.
func (*Recorder) RecordApprovedContext ¶
RecordApprovedContext creates a memory entry for an approved context item.
func (*Recorder) RecordApprovedResearch ¶
func (r *Recorder) RecordApprovedResearch(projectID, researchID, topic, summary string) (Entry, error)
RecordApprovedResearch creates a memory entry when research is approved.
func (*Recorder) RecordChangeEvent ¶
RecordChangeEvent creates a memory entry from a change event.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides memory CRUD and question reuse.
func NewService ¶
NewService creates a memory service backed by the given store.
func (*Service) Ask ¶
Ask searches for a matching question and reuses the answer if found. Returns the entry, reused=true if a match was found, or an empty entry with reused=false.