Documentation
¶
Overview ¶
Package procedural implements the ProceduralMemory domain: first-class storage for "how-to" knowledge derived from past experience. Procedural memories capture reusable approaches, the tools they use, and the files they touch, with a success counter that tracks real-world usage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("procedural: not found")
ErrNotFound is returned when a requested procedural memory does not exist.
Functions ¶
This section is empty.
Types ¶
type AddParams ¶
type AddParams struct {
WorkspaceID *uuid.UUID
RepoName string
ProjectID *uuid.UUID
Title string
WhenToUse string
ApproachMD string
ToolsUsed []string
FilesTouched []string
}
AddParams holds parameters for creating a new procedural memory.
type ProceduralMemory ¶
type ProceduralMemory struct {
ID uuid.UUID `json:"id"`
WorkspaceID *uuid.UUID `json:"workspace_id,omitempty"`
RepoName string `json:"repo_name,omitempty"`
ProjectID *uuid.UUID `json:"project_id,omitempty"`
Title string `json:"title"`
WhenToUse string `json:"when_to_use"`
ApproachMD string `json:"approach_md"`
ToolsUsed []string `json:"tools_used"`
FilesTouched []string `json:"files_touched"`
SuccessCount int `json:"success_count"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
ProceduralMemory is the domain model for a procedural memory entry.
type QueryFilter ¶
type QueryFilter struct {
WorkspaceID *uuid.UUID
RepoName string // empty = all repos
Keywords string // free-text search in title + when_to_use + approach_md
Limit int // 0 → default 10
}
QueryFilter narrows a Query call.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the Postgres-backed implementation of StoreIface.
func New ¶
New returns a Store backed by the given pool, scoped to the optional workspaceID. nil workspaceID = legacy unscoped mode.
func (*Store) Query ¶
func (s *Store) Query(ctx context.Context, f QueryFilter) ([]ProceduralMemory, error)
Query returns procedural memories matching the filter.
type StoreIface ¶
type StoreIface interface {
// Add inserts a new procedural memory and returns the persisted record.
Add(ctx context.Context, p AddParams) (*ProceduralMemory, error)
// Query returns procedural memories matching the filter.
// Searches title, when_to_use, and approach_md with ILIKE (Postgres)
// or LIKE (SQLite) when Keywords is non-empty.
// Results ordered by success_count DESC, created_at DESC.
Query(ctx context.Context, f QueryFilter) ([]ProceduralMemory, error)
// MarkUsed increments success_count and sets last_used_at = now.
// Returns ErrNotFound if the id does not exist.
MarkUsed(ctx context.Context, id uuid.UUID) (*ProceduralMemory, error)
}
StoreIface is the backend-agnostic contract for the ProceduralMemory bounded context. Postgres-backed *Store and SQLite-backed *ProceduralStore both satisfy this interface.