memory

package
v0.0.0-...-f70ad4e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportSchema

func ExportSchema(db *storage.DB) (string, error)

ExportSchema exports the full SQLite schema + table row counts.

func FormatAutoLinkCode

func FormatAutoLinkCode(r *AutoLinkCodeResult) string

FormatAutoLinkCode formats auto-link code results as markdown.

func FormatBlockerPrediction

func FormatBlockerPrediction(p *BlockerPrediction) string

FormatBlockerPrediction formats a blocker prediction as markdown.

func FormatBranchContext

func FormatBranchContext(action string, mapping *BranchMapping, mappings []BranchMapping) string

FormatBranchContext formats branch context operation results as markdown.

func FormatBurndown

func FormatBurndown(d *BurndownData) string

FormatBurndown formats burndown data as markdown.

func FormatCodeImpact

func FormatCodeImpact(r *CodeImpactResult) string

FormatCodeImpact formats a CodeImpactResult into a human-readable string.

func FormatComparison

func FormatComparison(c *FeatureComparison) string

FormatComparison formats a feature comparison as markdown.

func FormatContradictions

func FormatContradictions(alerts []ContradictionAlert) string

FormatContradictions formats contradiction alerts into a human-readable string.

func FormatDebugContext

func FormatDebugContext(dc *DebugContext, topic string) string

func FormatDeduplicate

func FormatDeduplicate(d *DeduplicateResult) string

FormatDeduplicate formats deduplication results as markdown.

func FormatDependencies

func FormatDependencies(deps []FileDependency) string

FormatDependencies formats a list of file dependencies into a human-readable string.

func FormatDependencyAlerts

func FormatDependencyAlerts(alerts []DependencyAlert) string

FormatDependencyAlerts formats dependency alerts into a human-readable string.

func FormatErrorSearch

func FormatErrorSearch(errors []ErrorEntry) string

func FormatFocusTime

func FormatFocusTime(entries []FocusTimeEntry, days int) string

FormatFocusTime formats focus time entries as markdown.

func FormatGlobalSearch

func FormatGlobalSearch(results []GlobalSearchResult) string

func FormatGraph

func FormatGraph(r *GraphResult, format string) string

FormatGraph formats a GraphResult into a human-readable string.

func FormatHooks

func FormatHooks(hooks []HookEntry) string

FormatHooks formats hooks into a human-readable string.

func FormatIntegrityCheck

func FormatIntegrityCheck(r *IntegrityResult) string

FormatIntegrityCheck formats integrity check results as markdown.

func FormatInterruptions

func FormatInterruptions(report *InterruptionReport) string

FormatInterruptions formats interruption report as markdown.

func FormatMigrationResult

func FormatMigrationResult(src *MigrationSource) string

FormatMigrationResult formats a migration result.

func FormatPatterns

func FormatPatterns(patterns []PatternInfo) string

func FormatPeriodSummary

func FormatPeriodSummary(s *PeriodSummary) string

FormatPeriodSummary formats a period summary as markdown.

func FormatPlanAlerts

func FormatPlanAlerts(alerts []PlanAlert) string

FormatPlanAlerts formats plan alerts into a human-readable string.

func FormatPluginList

func FormatPluginList(plugins []PluginInfo) string

FormatPluginList formats a list of plugins into a human-readable string.

func FormatProjectMap

func FormatProjectMap(pm *ProjectMap) string

FormatProjectMap returns a human-readable markdown representation of the project map.

func FormatRelatedResult

func FormatRelatedResult(r *RelatedResult) string

FormatRelatedResult formats a RelatedResult into a human-readable string.

func FormatReplay

func FormatReplay(r *SessionReplay) string

FormatReplay produces a formatted output string for a SessionReplay.

func FormatReviewChecklist

func FormatReviewChecklist(items []ChecklistItem, featureName string) string

FormatReviewChecklist formats a review checklist as markdown.

func FormatReviewContext

func FormatReviewContext(contexts []ReviewContext) string

FormatReviewContext formats review context results as markdown.

func FormatReviewRisk

func FormatReviewRisk(risks []ReviewRisk) string

FormatReviewRisk formats risk assessment results as markdown.

func FormatRiskScores

func FormatRiskScores(entries []RiskEntry) string

FormatRiskScores formats risk scores as markdown.

func FormatStaleAlerts

func FormatStaleAlerts(alerts []StaleAlert) string

FormatStaleAlerts formats stale alerts into a human-readable string.

func FormatStandup

func FormatStandup(d *StandupData) string

FormatStandup formats standup data as markdown.

func FormatSuggestions

func FormatSuggestions(suggestions []Suggestion) string

FormatSuggestions renders a list of suggestions as a bullet list string.

func FormatTestMemory

func FormatTestMemory(current *TestResult, history []TestResult) string

func FormatTimeTravel

func FormatTimeTravel(r *TimeTravelResult) string

FormatTimeTravel produces a compact summary string for a TimeTravelResult.

func FormatTimeline

func FormatTimeline(events []TimelineEvent) string

FormatTimeline renders events as a chronological timeline string.

func FormatTokenSummary

func FormatTokenSummary(summaries []TokenSummary) string

func FormatVelocity

func FormatVelocity(entries []VelocityEntry) string

FormatVelocity formats velocity entries as markdown.

func FormatWebhooks

func FormatWebhooks(webhooks []WebhookEntry) string

FormatWebhooks formats webhooks into a human-readable string.

func FormatWeeklyReport

func FormatWeeklyReport(report *WeeklyReportData) string

FormatWeeklyReport formats the weekly report data as markdown.

func FormatWhatIf

func FormatWhatIf(r *WhatIfResult) string

FormatWhatIf produces a human-readable string for a WhatIfResult.

func ManageWebhook

func ManageWebhook(action, url, event string) (string, error)

ManageWebhook registers, lists, or removes webhooks.

func RegisterHook

func RegisterHook(event, command string) error

RegisterHook stores a hook in ~/.memorx/hooks.json.

func RunPerfReport

func RunPerfReport(db *storage.DB) string

RunPerfReport benchmarks tool response times.

func ZeroConfig

func ZeroConfig() string

ZeroConfig auto-detects installed MCP clients and returns what was found.

Types

type ADR

type ADR struct {
	Title        string
	Date         string
	Status       string
	Context      string
	Decision     string
	Consequences string
}

ADR represents an Architecture Decision Record.

type Agent

type Agent struct {
	Name, Role, RegisteredAt string
}

type AgentScope

type AgentScope struct {
	Agent, Feature string
}

type ArchiveFeature

type ArchiveFeature struct {
	FeatureName, ArchivedAt string
}

type AuditEntry

type AuditEntry struct {
	ID, Operation, Details, Agent, CreatedAt string
}

type AutoLinkCodeResult

type AutoLinkCodeResult struct {
	LinkedNotes int
	LinkedFiles int
	NewLinks    int
}

AutoLinkCodeResult holds the result of auto-linking code files.

type BenchmarkResult

type BenchmarkResult struct {
	TotalScenarios int
	Passed         int
	Failed         int
	Score          float64
	Comparison     string
}

BenchmarkResult holds the result of a benchmark comparison.

func RunBenchmarkCompare

func RunBenchmarkCompare(db *storage.DB) (*BenchmarkResult, error)

RunBenchmarkCompare runs a simplified benchmark and returns comparison text.

type BlockerPrediction

type BlockerPrediction struct {
	FeatureName         string
	BlockerCount        int
	UnresolvedDeps      int
	TestCount           int
	DaysSinceLastCommit int
	SimilarFeatureRisk  float64
	RiskLevel           string // "High", "Medium", "Low"
	Explanation         string
}

BlockerPrediction holds the result of predicting blockers for a feature.

type BranchMapping

type BranchMapping struct {
	Branch      string
	FeatureName string
	SavedAt     string
}

BranchMapping holds a mapping between a git branch and a feature.

type BudgetedMemory

type BudgetedMemory struct {
	ID, Type, Content, CreatedAt string
	Score                        float64
	Pinned                       bool
	TokenEstimate                int
}

type BurndownData

type BurndownData struct {
	FeatureName    string
	TotalSteps     int
	CompletedSteps int
	StepDates      []StepCompletion
	Velocity       float64 // steps per day
	ETADate        string
	Chart          string // ASCII burndown
}

BurndownData holds burndown chart data for a feature's plan.

type ChecklistItem

type ChecklistItem struct {
	Text   string
	Source string
}

ChecklistItem represents an item in an auto-generated review checklist.

type ChunkEntry

type ChunkEntry struct {
	ID        string `json:"id"`
	Type      string `json:"type"` // "note", "fact", "decision"
	Feature   string `json:"feature"`
	Content   string `json:"content"`
	NoteType  string `json:"note_type,omitempty"`
	Subject   string `json:"subject,omitempty"`
	Predicate string `json:"predicate,omitempty"`
	Object    string `json:"object,omitempty"`
	CreatedAt string `json:"created_at"`
	Author    string `json:"author,omitempty"`
}

ChunkEntry is a single memory entry serialized to a JSONL chunk.

type ChunkManifest

type ChunkManifest struct {
	LastExportAt string   `json:"last_export_at"`
	Chunks       []string `json:"chunks"`
}

ChunkManifest tracks exported chunk files.

type CodeImpactFeature

type CodeImpactFeature struct {
	Name   string
	Status string
}

CodeImpactFeature represents a feature that touched the file.

type CodeImpactResult

type CodeImpactResult struct {
	FilePath     string
	Features     []CodeImpactFeature
	Notes        []Note
	Dependencies []FileDependency
}

CodeImpactResult holds the impact analysis for a file path.

type CommitInfo

type CommitInfo struct{ Hash, Message, Author, CommittedAt string }

type ComparisonSide

type ComparisonSide struct {
	Name         string
	NoteCount    int
	FactCount    int
	CommitCount  int
	SessionCount int
	BlockerCount int
	PlanProgress string // "3/5" or "no plan"
	Status       string
	LastActive   string
}

ComparisonSide holds stats for one side of a comparison.

type ComplianceExport

type ComplianceExport struct {
	Notes    []Note
	Facts    []Fact
	Audit    []AuditEntry
	Feature  string
	ExportAt string
}

type ConfigEntry

type ConfigEntry struct {
	Key, Value string
}

type ConflictPair

type ConflictPair struct {
	NoteA  string `json:"note_a"`
	NoteB  string `json:"note_b"`
	Topic  string `json:"topic"`
	ValueA string `json:"value_a"`
	ValueB string `json:"value_b"`
}

ConflictPair describes two contradicting decisions.

type ConsolidationSnapshot

type ConsolidationSnapshot struct {
	EntropyScore      float64 `json:"entropy_score"`
	UnsummarizedCount int     `json:"unsummarized_count"`
	LastRun           string  `json:"last_run"`
}

type Context

type Context struct {
	Feature                     *Feature
	Summary, LastSessionSummary string
	Plan                        *PlanInfo
	RecentCommits               []CommitInfo
	RecentNotes                 []Note
	ActiveFacts                 []Fact
	PinnedMemories              []MemoryItem
	Links                       []MemoryLink
	SessionHistory              []Session
	FilesTouched                []string
}

type ContextSnapshot

type ContextSnapshot struct {
	ID           string
	FeatureID    string
	SessionID    string
	Content      string
	SnapshotType string
	CreatedAt    string
}

ContextSnapshot represents a saved conversation context snapshot.

type ContradictionAlert

type ContradictionAlert struct {
	Content     string
	FactSubject string
	FactPred    string
	FactObject  string
	FactDate    string
}

ContradictionAlert represents a contradiction between new content and existing facts.

type DBStats

type DBStats struct {
	Tables   map[string]int
	FileSize int64
}

type DebugContext

type DebugContext struct {
	Decisions, Facts, Files, Commits []RelatedItem
	Errors                           []ErrorEntry
	TestResults                      []TestResult
}

type DecisionEntry

type DecisionEntry struct {
	ID          string `json:"id"`
	Feature     string `json:"feature"`
	Content     string `json:"content"`
	Timestamp   string `json:"timestamp"`
	Author      string `json:"author,omitempty"`
	ContentHash string `json:"content_hash"`
}

DecisionEntry represents a decision for export/import.

type DeduplicateResult

type DeduplicateResult struct {
	Groups      []DuplicateGroup
	TotalDups   int
	MergedCount int
	DryRun      bool
}

DeduplicateResult holds the result of a deduplication run.

type DependencyAlert

type DependencyAlert struct {
	File            string
	RelatedFeatures []string
	RecentCommits   int
}

DependencyAlert represents a warning about files used by other features.

type DoctorCheck

type DoctorCheck struct {
	Name   string
	Passed bool
	Detail string
}

type DuplicateGroup

type DuplicateGroup struct {
	NoteIDs    []string
	Previews   []string
	FeatureID  string
	Similarity float64
}

DuplicateGroup holds a group of near-duplicate notes.

type ErrorEntry

type ErrorEntry struct {
	ID, FeatureID, SessionID string
	ErrorMessage, FilePath   string
	LineNumber               int
	Cause, Resolution        string
	Resolved                 bool
	CreatedAt                string
}

type ExtractedItem

type ExtractedItem struct {
	Content string
	Type    string // decision, blocker, progress, fact, next_step
	Fact    *FactTriple
}

ExtractedItem represents a single piece of information extracted from conversation text.

func ExtractFromText

func ExtractFromText(text string) []ExtractedItem

ExtractFromText extracts decisions, facts, progress updates, blockers, and next steps from a block of conversation text using heuristic keyword matching.

type Fact

type Fact struct {
	ID, FeatureID, SessionID       string
	Subject, Predicate, Object     string
	ValidAt, InvalidAt, RecordedAt string
	Confidence                     float64
}

type FactTriple

type FactTriple struct {
	Subject   string
	Predicate string
	Object    string
}

FactTriple represents a subject-predicate-object triple extracted from text.

type Feature

type Feature struct{ ID, Name, Description, Status, Branch, CreatedAt, LastActive string }

type FeatureAnalytics

type FeatureAnalytics struct {
	Name                                             string
	SessionCount, CommitCount, NoteCount             int
	DecisionCount, BlockerCount                      int
	FactCount, ActiveFactCount, InvalidatedFactCount int
	PlanProgress                                     string
	IntentBreakdown                                  map[string]int
	DaysSinceCreated, DaysSinceLastActive            int
	AvgSessionDuration                               string
}

type FeatureComparison

type FeatureComparison struct {
	FeatureA, FeatureB ComparisonSide
}

FeatureComparison holds side-by-side comparison data.

type FeaturePeriodSummary

type FeaturePeriodSummary struct {
	Name      string
	Commits   int
	Decisions int
	Blockers  int
	Notes     int
}

FeaturePeriodSummary holds per-feature activity in a period.

type FeatureSnapshot

type FeatureSnapshot struct {
	Name        string `json:"name"`
	Status      string `json:"status"`
	Branch      string `json:"branch"`
	Description string `json:"description"`
	LastActive  string `json:"last_active"`
	Sessions    int    `json:"sessions"`
	Commits     int    `json:"commits"`
}

type FeatureSwitch

type FeatureSwitch struct {
	From, To  string
	Timestamp string
}

FeatureSwitch represents a single context switch between features.

type FileDependency

type FileDependency struct {
	Path        string
	Occurrences int
}

FileDependency represents a file that often changes alongside another file.

type FileRecord

type FileRecord struct {
	ID, FeatureID, SessionID, Path, Action, FirstSeen string
}

FileRecord represents a file touched during a session.

type FocusTimeEntry

type FocusTimeEntry struct {
	FeatureName  string
	TotalHours   float64
	SessionCount int
}

FocusTimeEntry represents time spent on a single feature.

type GlobalSearchResult

type GlobalSearchResult struct{ ProjectName, ProjectPath, Type, Content, CreatedAt string }

func GlobalSearch

func GlobalSearch(query string) ([]GlobalSearchResult, error)

type GraphEdge

type GraphEdge struct {
	Source       GraphNode
	Target       GraphNode
	Relationship string
	Strength     float64
}

GraphEdge represents an edge in the memory graph.

type GraphNode

type GraphNode struct {
	ID   string
	Type string // note, fact, commit, plan, etc.
}

GraphNode represents a node in the memory graph.

type GraphResult

type GraphResult struct {
	Nodes    []GraphNode
	Edges    []GraphEdge
	Clusters map[string]int // cluster name -> node count
}

GraphResult holds the complete graph analysis.

type HookEntry

type HookEntry struct {
	Event   string `json:"event"`
	Command string `json:"command"`
	AddedAt string `json:"added_at"`
}

HookEntry represents a registered hook.

func ListHooks

func ListHooks() ([]HookEntry, error)

ListHooks returns all registered hooks.

type ImportResult

type ImportResult struct {
	Features int
	Notes    int
	Facts    int
	Plans    int
	Errors   []string
}

ImportSharedMemory reads an exported memorX JSON/markdown and imports features, notes, facts, and plans. Returns counts of imported items.

type IntegrityResult

type IntegrityResult struct {
	BrokenLinks    int
	OrphanSessions int
	OrphanNotes    int
	OrphanFacts    int
	TotalChecked   int
	FixedCount     int
	ScorePercent   int
	Details        []string
}

IntegrityResult holds the result of an integrity check.

type InterruptionReport

type InterruptionReport struct {
	SwitchCount          int
	DaysAnalyzed         int
	LongestUninterrupted float64 // hours
	LongestFeature       string
	Switches             []FeatureSwitch
}

InterruptionReport represents context switch analysis.

type Learning

type Learning struct{ ID, FeatureID, Content, SourceTool, CreatedAt string }

type LinkedProject

type LinkedProject struct{ ID, ProjectPath, ProjectName, Relationship, CreatedAt string }

type MemoryDiff

type MemoryDiff struct {
	NewFacts         []Fact
	InvalidatedFacts []Fact
	NewNotes         []Note
	NewCommits       int
	PlanDelta        string // e.g. "3/7 -> 5/7 (+2 steps)"
	NewLinks         int
	NewFiles         []string
	SessionsSince    int
}

MemoryDiff captures what changed in memory since a given point in time.

type MemoryFilter

type MemoryFilter struct {
	Type   string // "notes", "facts", or "" for all
	Pinned *bool  // nil = all, true = pinned only, false = unpinned only
	Limit  int
}

MemoryFilter controls which memories are returned by ListMemories.

type MemoryHealth

type MemoryHealth struct {
	Score                                                     float64
	TotalMemories, ActiveFacts, StaleFactCount, ConflictCount int
	OrphanNoteCount, StaleNoteCount, SummaryCount             int
	Suggestions                                               []string
}

type MemoryItem

type MemoryItem struct {
	ID, Type, Content, CreatedAt string
	Pinned                       bool
}

MemoryItem is a union type representing either a note or a fact.

type MemoryLink struct {
	ID, SourceID, SourceType, TargetID, TargetType, Relationship string
	Strength                                                     float64
	CreatedAt                                                    string
}

type MigrationSource

type MigrationSource struct {
	Type  string
	Path  string
	Items int
}

MigrationSource describes a memory source to import from.

func MigrateFrom

func MigrateFrom(store *Store, source, path string) (*MigrationSource, error)

MigrateFrom imports from other memory systems.

type Note

type Note struct{ ID, FeatureID, SessionID, Content, Type, CreatedAt, UpdatedAt string }

type PatternInfo

type PatternInfo struct {
	Pattern  string
	Projects []string
	Count    int
}

func DetectPatterns

func DetectPatterns() ([]PatternInfo, error)

type PerfEntry

type PerfEntry struct {
	ToolName string
	MedianMs float64
}

PerfEntry holds the performance data for a single tool.

type PeriodSummary

type PeriodSummary struct {
	Period           string
	Features         []FeaturePeriodSummary
	TotalCommits     int
	TotalDecisions   int
	TotalBlockers    int
	BlockersResolved int
}

PeriodSummary holds summarized activity for a time period.

type PlanAlert

type PlanAlert struct {
	FeatureName       string
	PlanTitle         string
	StepsDone         int
	StepsTotal        int
	DaysSinceActivity int
	Stalled           bool
	NearlyComplete    bool
	Blockers          int
}

PlanAlert represents the status of an active plan.

type PlanInfo

type PlanInfo struct {
	Title, Status             string
	TotalSteps, CompletedStep int
}

type PlanSnapshot

type PlanSnapshot struct {
	Title       string `json:"title"`
	Progress    string `json:"progress"`
	CurrentStep string `json:"current_step"`
	StepsDone   int    `json:"steps_done"`
	StepsTotal  int    `json:"steps_total"`
}

type PluginInfo

type PluginInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Status  string `json:"status"`
	Path    string `json:"path"`
}

PluginInfo describes an installed plugin.

func InstallPlugin

func InstallPlugin(url string) (*PluginInfo, error)

InstallPlugin creates the plugin directory structure and manifest.

func ListPlugins

func ListPlugins() ([]PluginInfo, error)

ListPlugins lists installed plugins from ~/.memorx/plugins/.

type PluginManifest

type PluginManifest struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description"`
	Author      string `json:"author"`
	Entry       string `json:"entry"`
}

PluginManifest describes a memorX plugin.

type ProjectAnalytics

type ProjectAnalytics struct {
	TotalFeatures, ActiveFeatures, PausedFeatures, DoneFeatures int
	TotalSessions, TotalCommits, TotalNotes, TotalFacts         int
	MostActiveFeature, MostBlockedFeature                       string
	RecentActivity                                              []string
}

type ProjectFile

type ProjectFile struct {
	Path     string `json:"path"`
	Language string `json:"language"`
	Role     string `json:"role"` // "entry", "config", "model", "handler", "test", "util", "infra"
}

ProjectFile describes a key file in the project.

type ProjectMap

type ProjectMap struct {
	Root        string         `json:"root"`
	FileCount   int            `json:"file_count"`
	Languages   map[string]int `json:"languages"`
	KeyFiles    []ProjectFile  `json:"key_files"`
	Directories []string       `json:"directories"`
	ScannedAt   string         `json:"scanned_at"`
}

ProjectMap holds a cached map of the project's structure.

type PromptMemory

type PromptMemory struct{ ID, FeatureID, Prompt, Effectiveness, Outcome, CreatedAt string }

type RelatedItem

type RelatedItem struct {
	ID, Type, Content string
	Relevance         float64
}

RelatedItem represents a single related memory.

type RelatedResult

type RelatedResult struct {
	Decisions []RelatedItem
	Facts     []RelatedItem
	Files     []RelatedItem
	Commits   []RelatedItem
}

RelatedResult holds all related memories for a topic.

type ReplayEvent

type ReplayEvent struct {
	Type      string // "note", "fact", "commit", "plan_step"
	Content   string
	Timestamp string
}

ReplayEvent represents a single event that occurred during a session.

type RetentionPolicy

type RetentionPolicy struct {
	Days  int
	Types []string
}

type ReviewContext

type ReviewContext struct {
	File    string
	Notes   []Note
	Facts   []Fact
	Commits []CommitInfo
	Summary string
}

ReviewContext holds enriched context for a file in a code review.

type ReviewRisk

type ReviewRisk struct {
	File           string
	ChangeCount    int
	RecentChanges  int
	BlockerCount   int
	RecentRefactor bool
	RiskLevel      string
	Reasons        []string
}

ReviewRisk holds risk assessment for a file.

type RiskEntry

type RiskEntry struct {
	FeatureName  string
	Score        int
	DaysInactive int
	BlockerCount int
	PlanPct      int
	StaleFacts   int
	OrphanNotes  int
	Factors      []string
}

RiskEntry holds risk scoring data for a single feature.

type SchemaTable

type SchemaTable struct {
	Name     string
	SQL      string
	RowCount int
}

SchemaTable holds info about a single table in the schema.

type SensitiveResult

type SensitiveResult struct {
	NoteID  string
	Content string
	Matches []string
}

type Session

type Session struct{ ID, FeatureID, Tool, StartedAt, EndedAt, Summary string }

type SessionReplay

type SessionReplay struct {
	SessionID string
	Tool      string
	Feature   string
	StartedAt string
	EndedAt   string
	Events    []ReplayEvent
}

SessionReplay holds the chronological replay of a session's events.

type Snapshot

type Snapshot struct {
	Project       string                `json:"project"`
	ProjectPath   string                `json:"project_path"`
	ActiveFeature *FeatureSnapshot      `json:"active_feature"`
	ActivePlan    *PlanSnapshot         `json:"active_plan"`
	Features      []FeatureSnapshot     `json:"features"`
	Consolidation ConsolidationSnapshot `json:"consolidation"`
}

type SnapshotMatch

type SnapshotMatch struct {
	ID           string
	FeatureID    string
	Content      string
	SnapshotType string
	CreatedAt    string
	Snippet      string
}

SnapshotMatch represents a search result from context snapshots.

type StaleAlert

type StaleAlert struct {
	FeatureName  string
	DaysInactive int
	Blockers     []string
}

StaleAlert represents a feature that has been inactive with unresolved blockers.

type StandupData

type StandupData struct {
	Yesterday []StandupItem
	Today     []StandupItem
	Blockers  []StandupItem
}

StandupData holds the data for a daily standup.

type StandupItem

type StandupItem struct {
	Feature string
	Content string
}

StandupItem represents a single standup line item.

type StepCompletion

type StepCompletion struct {
	StepTitle   string
	CompletedAt string
}

StepCompletion records when a plan step was completed.

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(db *storage.DB) *Store

func (*Store) AgentHandoff

func (s *Store) AgentHandoff(fromAgent, toAgent, summary string, endSessionID string) (string, error)

func (*Store) AgentMerge

func (s *Store) AgentMerge(featureName string) (int, int, int, error)

func (*Store) ApplyRetentionPolicy

func (s *Store) ApplyRetentionPolicy() (int, error)

func (*Store) ApplyTemplate

func (s *Store) ApplyTemplate(featureID, sessionID, templateName string) (*TemplateData, error)

func (*Store) ArchiveFeature

func (s *Store) ArchiveFeature(featureName string) error

func (*Store) AuditLog

func (s *Store) AuditLog(operation, details, agent string) error
func (s *Store) AutoLink(sourceID, sourceType, content string) (int, error)

func (*Store) AutoLinkCode

func (s *Store) AutoLinkCode(featureName string) (*AutoLinkCodeResult, error)

AutoLinkCode scans notes for file path patterns and creates links to files_touched.

func (*Store) BenchmarkSelf

func (s *Store) BenchmarkSelf() (insertAvg, searchAvg, contextAvg float64, err error)

func (*Store) BranchContextList

func (s *Store) BranchContextList() ([]BranchMapping, error)

BranchContextList returns all branch-to-feature mappings.

func (*Store) BranchContextRestore

func (s *Store) BranchContextRestore(branch string) (*BranchMapping, error)

BranchContextRestore restores context for a given branch by switching to the associated feature.

func (*Store) BranchContextSave

func (s *Store) BranchContextSave(branch string) (*BranchMapping, error)

BranchContextSave saves a mapping between a git branch and the active feature.

func (*Store) CodeImpact

func (s *Store) CodeImpact(filePath string) (*CodeImpactResult, error)

CodeImpact analyzes the impact of changing a file by finding all features, decisions/notes, and dependencies related to that file.

func (*Store) CompareFeatures

func (s *Store) CompareFeatures(nameA, nameB string) (*FeatureComparison, error)

CompareFeatures compares two features side by side.

func (*Store) CreateFact

func (s *Store) CreateFact(featureID, sessionID, subject, predicate, object string) (*Fact, error)

func (*Store) CreateFeature

func (s *Store) CreateFeature(name, description string) (*Feature, error)
func (s *Store) CreateLink(sourceID, sourceType, targetID, targetType, relationship string, strength float64) error

func (*Store) CreateNote

func (s *Store) CreateNote(featureID, sessionID, content, noteType string) (*Note, error)

func (*Store) CreateSession

func (s *Store) CreateSession(featureID, tool string) (*Session, error)

func (*Store) Deduplicate

func (s *Store) Deduplicate(featureName string, dryRun bool) (*DeduplicateResult, error)

Deduplicate finds and optionally merges duplicate/near-duplicate notes.

func (*Store) DetectConflicts

func (s *Store) DetectConflicts() ([]ConflictPair, error)

DetectConflicts finds contradicting decisions and facts. For facts: same subject+predicate but different object. For decisions: looks for common topic keywords with opposing choices.

func (*Store) Doctor

func (s *Store) Doctor() ([]DoctorCheck, error)

func (*Store) EndSession

func (s *Store) EndSession(sessionID string) error

func (*Store) EndSessionWithSummary

func (s *Store) EndSessionWithSummary(sessionID, summary string) error

func (*Store) ExportCompliance

func (s *Store) ExportCompliance(featureName, format string) (string, error)

func (*Store) FindContradictions

func (s *Store) FindContradictions(content string) ([]ContradictionAlert, error)

FindContradictions checks if content contradicts any existing active facts.

func (*Store) FindDependencies

func (s *Store) FindDependencies(filePath string) ([]FileDependency, error)

FindDependencies finds files that often change together with the given file based on commit co-occurrence in the files_changed JSON column.

func (*Store) FindDependencyAlerts

func (s *Store) FindDependencyAlerts(files []string) ([]DependencyAlert, error)

FindDependencyAlerts checks which features reference the given files.

func (*Store) FindPlanAlerts

func (s *Store) FindPlanAlerts(pm *plans.Manager) ([]PlanAlert, error)

FindPlanAlerts analyzes all active plans for velocity and status.

func (*Store) FindRelated

func (s *Store) FindRelated(engine *search.Engine, topic string, depth int) (*RelatedResult, error)

FindRelated finds all related memories for a topic by combining search, link traversal, and file tracking.

func (*Store) FindStaleAlerts

func (s *Store) FindStaleAlerts(daysThreshold int) ([]StaleAlert, error)

FindStaleAlerts finds features inactive for N+ days with unresolved blockers.

func (*Store) ForgetByID

func (s *Store) ForgetByID(id string) (string, error)

func (*Store) ForgetCompletedFeatures

func (s *Store) ForgetCompletedFeatures() (int, error)

func (*Store) ForgetStaleFacts

func (s *Store) ForgetStaleFacts(featureID string) (int, error)

func (*Store) ForgetStaleNotes

func (s *Store) ForgetStaleNotes(featureID string) (int, error)

func (*Store) GenerateADR

func (s *Store) GenerateADR(decisionID string) (string, error)

GenerateADR creates Architecture Decision Records from decision notes. If decisionID is non-empty, generates a single ADR; otherwise generates all.

func (*Store) GenerateAPIDocs

func (s *Store) GenerateAPIDocs() (string, error)

GenerateAPIDocs searches notes and facts for API-related content and formats as docs.

func (*Store) GenerateAgentsMD

func (s *Store) GenerateAgentsMD() (string, error)

func (*Store) GenerateChangelog

func (s *Store) GenerateChangelog(days int, format string) (string, error)

GenerateChangelog produces a changelog grouped by feature and time. days is the number of days to look back; format is "markdown" or "slack".

func (*Store) GenerateOnboarding

func (s *Store) GenerateOnboarding(feature string) (string, error)

GenerateOnboarding produces a comprehensive onboarding markdown document combining project_map, all decisions, all active facts, active plans, and recent session summaries. If feature is non-empty, scopes to that feature.

func (*Store) GenerateReadme

func (s *Store) GenerateReadme(gitRoot, output string) (string, error)

GenerateReadme creates or updates a README from project map + memory.

func (*Store) GenerateReviewChecklist

func (s *Store) GenerateReviewChecklist(featureID string) ([]ChecklistItem, error)

GenerateReviewChecklist generates review checklist items from memory.

func (*Store) GenerateRunbook

func (s *Store) GenerateRunbook(feature string) (string, error)

GenerateRunbook creates an operational runbook from error_log + decisions.

func (*Store) GetActiveFacts

func (s *Store) GetActiveFacts(featureID string) ([]Fact, error)

func (*Store) GetActiveFeature

func (s *Store) GetActiveFeature() (*Feature, error)

func (*Store) GetAgent

func (s *Store) GetAgent(name string) (*Agent, error)

func (*Store) GetBurndown

func (s *Store) GetBurndown(featureName string) (*BurndownData, error)

GetBurndown generates burndown chart data from plan velocity.

func (*Store) GetConfig

func (s *Store) GetConfig(key string) (string, error)

func (*Store) GetContext

func (s *Store) GetContext(featureID, tier string, asOf *time.Time) (*Context, error)

func (*Store) GetContextBudget

func (s *Store) GetContextBudget(budget int, featureID string) ([]BudgetedMemory, int, error)

func (*Store) GetCurrentSession

func (s *Store) GetCurrentSession() (*Session, error)

func (*Store) GetDebugContext

func (s *Store) GetDebugContext(engine *search.Engine, topic string) (*DebugContext, error)

func (*Store) GetDiff

func (s *Store) GetDiff(featureID string, since time.Time) (*MemoryDiff, error)

GetDiff returns a MemoryDiff for a feature since the given time.

func (*Store) GetEffectivePrompts

func (s *Store) GetEffectivePrompts(limit int) ([]PromptMemory, error)

func (*Store) GetFeature

func (s *Store) GetFeature(name string) (*Feature, error)

func (*Store) GetFeatureAnalytics

func (s *Store) GetFeatureAnalytics(featureID string) (*FeatureAnalytics, error)

func (*Store) GetFilesTouched

func (s *Store) GetFilesTouched(featureID string, limit int) ([]FileRecord, error)

GetFilesTouched returns files touched for a feature, ordered by most recent first.

func (*Store) GetFocusTime

func (s *Store) GetFocusTime(featureName string, days int) ([]FocusTimeEntry, error)

GetFocusTime calculates time spent per feature over the given number of days.

func (*Store) GetInterruptions

func (s *Store) GetInterruptions(days int) (*InterruptionReport, error)

GetInterruptions analyzes context switches between features.

func (*Store) GetLastSessionEndTime

func (s *Store) GetLastSessionEndTime(featureID string) (time.Time, error)

GetLastSessionEndTime returns the end time of the most recent completed session for a feature. If no completed session is found, returns zero time.

func (*Store) GetLearnings

func (s *Store) GetLearnings(featureID string, limit int) ([]Learning, error)
func (s *Store) GetLinks(memoryID, memoryType string) ([]MemoryLink, error)

func (*Store) GetMemoryHealth

func (s *Store) GetMemoryHealth(featureID string) (*MemoryHealth, error)

func (*Store) GetNote

func (s *Store) GetNote(noteID string) (*Note, error)

func (*Store) GetPinnedMemories

func (s *Store) GetPinnedMemories(featureID string) ([]MemoryItem, error)

GetPinnedMemories returns all pinned notes and facts for a feature.

func (*Store) GetProjectAnalytics

func (s *Store) GetProjectAnalytics() (*ProjectAnalytics, error)

func (*Store) GetProjectMap

func (s *Store) GetProjectMap() (*ProjectMap, error)

GetProjectMap retrieves the cached project map from the database.

func (*Store) GetRetentionPolicy

func (s *Store) GetRetentionPolicy() (*RetentionPolicy, error)

func (*Store) GetReviewContext

func (s *Store) GetReviewContext(files []string) ([]ReviewContext, error)

GetReviewContext enriches a list of file paths with related memory.

func (*Store) GetReviewRisk

func (s *Store) GetReviewRisk(files []string) ([]ReviewRisk, error)

GetReviewRisk assesses risk for each file based on memory.

func (*Store) GetRiskScores

func (s *Store) GetRiskScores() ([]RiskEntry, error)

GetRiskScores scores every active feature for risk (0-100).

func (*Store) GetSessionFiles

func (s *Store) GetSessionFiles(sessionID string) ([]FileRecord, error)

GetSessionFiles returns files touched in a specific session.

func (*Store) GetStandup

func (s *Store) GetStandup() (*StandupData, error)

GetStandup generates daily standup data from yesterday's sessions and notes.

func (*Store) GetSuggestions

func (s *Store) GetSuggestions() ([]Suggestion, error)

GetSuggestions analyzes memory patterns and returns actionable suggestions.

func (*Store) GetTestHistory

func (s *Store) GetTestHistory(testName string, limit int) ([]TestResult, error)

func (*Store) GetTimeline

func (s *Store) GetTimeline(days int, featureName string) ([]TimelineEvent, error)

GetTimeline returns chronological events for the given time range, optionally filtered by feature name.

func (*Store) GetTokenSummary

func (s *Store) GetTokenSummary() ([]TokenSummary, error)

func (*Store) GetVelocity

func (s *Store) GetVelocity(featureName string) ([]VelocityEntry, error)

GetVelocity calculates plan completion velocity per feature.

func (*Store) GetWeeklyReport

func (s *Store) GetWeeklyReport(days int) (*WeeklyReportData, error)

GetWeeklyReport generates aggregated data for a weekly dev summary.

func (*Store) GitSyncExport

func (s *Store) GitSyncExport(syncPath string) (string, int, error)

GitSyncExport writes new memories since the last export as an immutable .jsonl.gz chunk file. Returns the path of the newly created chunk.

func (*Store) GitSyncImport

func (s *Store) GitSyncImport(syncPath string) (int, error)

GitSyncImport reads chunk files not yet imported and inserts their entries into the database. Returns count of imported entries.

func (*Store) ImportSharedMemory

func (s *Store) ImportSharedMemory(data map[string]interface{}) (*ImportResult, error)

func (*Store) IntegrityCheck

func (s *Store) IntegrityCheck(fix bool) (*IntegrityResult, error)

IntegrityCheck verifies all memory links, facts, and references are valid.

func (*Store) InvalidateFact

func (s *Store) InvalidateFact(factID string) error

func (*Store) LinkProject

func (s *Store) LinkProject(projectPath, relationship string) (*LinkedProject, error)

func (*Store) ListArchivedFeatures

func (s *Store) ListArchivedFeatures() ([]ArchiveFeature, error)

func (*Store) ListConfig

func (s *Store) ListConfig() ([]ConfigEntry, error)

func (*Store) ListFeatures

func (s *Store) ListFeatures(statusFilter string) ([]Feature, error)

func (*Store) ListLinkedProjects

func (s *Store) ListLinkedProjects() ([]LinkedProject, error)

func (*Store) ListMemories

func (s *Store) ListMemories(featureID string, filter MemoryFilter) ([]MemoryItem, error)

ListMemories queries both notes and facts tables, merges results, and sorts by created_at DESC.

func (*Store) ListNotes

func (s *Store) ListNotes(featureID, noteType string, limit int) ([]Note, error)

func (*Store) ListSessions

func (s *Store) ListSessions(featureID string, limit int) ([]Session, error)

func (*Store) ListSnapshots

func (s *Store) ListSnapshots(featureID string, limit int) ([]ContextSnapshot, error)

ListSnapshots lists snapshots for a feature, newest first.

func (*Store) LogError

func (s *Store) LogError(featureID, sessionID, message, filePath, cause, resolution string) (*ErrorEntry, error)

func (*Store) ManageAgentScope

func (s *Store) ManageAgentScope(agent string, features []string, action string) ([]string, error)

func (*Store) MemoryGraph

func (s *Store) MemoryGraph(feature string) (*GraphResult, error)

MemoryGraph builds an adjacency graph of memory links for a feature. If feature is empty, it queries all links.

func (*Store) PinMemory

func (s *Store) PinMemory(id, memType string) error

PinMemory marks a note or fact as pinned so it always appears in context.

func (*Store) PredictBlocker

func (s *Store) PredictBlocker(featureName string) (*BlockerPrediction, error)

PredictBlocker analyzes patterns to predict if a feature will hit a blocker.

func (*Store) QueryAuditLog

func (s *Store) QueryAuditLog(limit int) ([]AuditEntry, error)

func (*Store) QueryFactsAsOf

func (s *Store) QueryFactsAsOf(featureID string, asOf time.Time) ([]Fact, error)

func (*Store) RecordTestResult

func (s *Store) RecordTestResult(featureID, sessionID, testName string, passed bool, errorMessage string) (*TestResult, error)

func (*Store) RecoverContext

func (s *Store) RecoverContext(featureID, query string, limit int) ([]SnapshotMatch, error)

RecoverContext searches context snapshots using FTS5 for the query term. Returns matching snippets with surrounding context, scoped to the given feature.

func (*Store) RegisterAgent

func (s *Store) RegisterAgent(name, role string) (*Agent, error)

func (*Store) ReplaySession

func (s *Store) ReplaySession(sessionID string) (*SessionReplay, error)

ReplaySession replays a session's decisions step by step. If sessionID is empty, it replays the last completed session.

func (*Store) RestoreFeature

func (s *Store) RestoreFeature(featureName string) error

func (*Store) SaveProjectMap

func (s *Store) SaveProjectMap(pm *ProjectMap) error

SaveProjectMap persists a ProjectMap to the database.

func (*Store) SaveSnapshot

func (s *Store) SaveSnapshot(featureID, sessionID, content, snapshotType string) error

SaveSnapshot stores a context snapshot for the given feature.

func (*Store) SaveTemplate

func (s *Store) SaveTemplate(featureID, templateName string) error

func (*Store) ScanProject

func (s *Store) ScanProject(gitRoot string) (*ProjectMap, error)

ScanProject scans a git root directory and builds a ProjectMap.

func (*Store) SearchErrors

func (s *Store) SearchErrors(query string) ([]ErrorEntry, error)

func (*Store) SensitiveRedact

func (s *Store) SensitiveRedact(featureID string) (int, error)

func (*Store) SensitiveScan

func (s *Store) SensitiveScan(featureID string) ([]SensitiveResult, error)

func (*Store) SetConfig

func (s *Store) SetConfig(key, value string) error

func (*Store) SetRetentionPolicy

func (s *Store) SetRetentionPolicy(days int, types []string) error

func (*Store) StartFeature

func (s *Store) StartFeature(name, description string) (*Feature, error)

func (*Store) Stats

func (s *Store) Stats() (*DBStats, error)

func (*Store) StoreLearning

func (s *Store) StoreLearning(featureID, content, sourceTool string) (*Learning, error)

func (*Store) StorePromptMemory

func (s *Store) StorePromptMemory(featureID, prompt, effectiveness, outcome string) (*PromptMemory, error)

func (*Store) SummarizePeriod

func (s *Store) SummarizePeriod(period string) (*PeriodSummary, error)

SummarizePeriod summarizes activity across all features for a time period.

func (*Store) TeamDecisionsExport

func (s *Store) TeamDecisionsExport(path string) (string, int, error)

TeamDecisionsExport writes all decision notes to a .jsonl file.

func (*Store) TeamDecisionsImport

func (s *Store) TeamDecisionsImport(path string) (int, int, error)

TeamDecisionsImport reads a decisions .jsonl file, inserting missing decisions by content hash deduplication.

func (*Store) TimeTravel

func (s *Store) TimeTravel(featureID string, asOf time.Time) (*TimeTravelResult, error)

TimeTravel queries the complete state of memory for a feature at a given point in time.

func (*Store) TrackFile

func (s *Store) TrackFile(featureID, sessionID, path, action string) error

TrackFile records a file as touched for a given feature and session. Uses INSERT OR IGNORE so duplicate (feature_id, session_id, path) is a no-op.

func (*Store) TrackTokenUsage

func (s *Store) TrackTokenUsage(sessionID, toolName string, inputTokens, outputTokens int) (*TokenUsage, error)

func (*Store) UnpinMemory

func (s *Store) UnpinMemory(id, memType string) error

UnpinMemory clears the pinned flag on a note or fact.

func (*Store) UpdateFeatureStatus

func (s *Store) UpdateFeatureStatus(name, status string) error

func (*Store) Vacuum

func (s *Store) Vacuum() (int64, int64, error)

func (*Store) WhatIf

func (s *Store) WhatIf(decisionQuery string) (*WhatIfResult, error)

WhatIf explores the impact of undoing a decision. It finds the matching decision note, finds all notes/facts created after it, and finds all notes/facts referencing the same topic.

func (*Store) WriteSnapshot

func (s *Store) WriteSnapshot(memDir, projectName, projectPath string) error

type Suggestion

type Suggestion struct {
	Category string // e.g. "blocker", "inactive", "plan", "health", "session", "conflict"
	Message  string
}

Suggestion is a single actionable suggestion based on memory patterns.

type TemplateData

type TemplateData struct {
	Name      string         `json:"name"`
	Decisions []string       `json:"decisions"`
	Facts     []TemplateFact `json:"facts"`
	PlanSteps []string       `json:"plan_steps"`
	CreatedAt string         `json:"created_at"`
}

type TemplateFact

type TemplateFact struct {
	Subject   string `json:"subject"`
	Predicate string `json:"predicate"`
	Object    string `json:"object"`
}

type TestResult

type TestResult struct {
	ID, FeatureID, SessionID string
	TestName                 string
	Passed                   bool
	ErrorMessage             string
	CreatedAt                string
}

type TimeTravelPlanSnapshot

type TimeTravelPlanSnapshot struct {
	Title string
	Steps []TimeTravelStepSnapshot
}

TimeTravelPlanSnapshot captures the state of a plan at a point in time.

type TimeTravelResult

type TimeTravelResult struct {
	AsOf        string
	ActiveFacts []Fact
	NotesAtTime []Note
	PlanAtTime  *TimeTravelPlanSnapshot
	Feature     *Feature
}

TimeTravelResult holds the complete state of memory at a specific point in time.

type TimeTravelStepSnapshot

type TimeTravelStepSnapshot struct {
	Title  string
	Status string
}

TimeTravelStepSnapshot captures a step's state at a point in time.

type TimelineEvent

type TimelineEvent struct {
	Timestamp string // formatted datetime
	Type      string // session, decision, commit, progress, blocker, fact, note
	Content   string
	Feature   string
}

TimelineEvent represents a single event in a project timeline.

type TokenSummary

type TokenSummary struct {
	ToolName                            string
	TotalInput, TotalOutput, TotalCalls int
}

type TokenUsage

type TokenUsage struct {
	ID, SessionID, ToolName, CreatedAt string
	InputTokens, OutputTokens          int
}

type VelocityEntry

type VelocityEntry struct {
	FeatureName    string
	StepsCompleted int
	TotalSteps     int
	DaysActive     int
	StepsPerDay    float64
	EstDaysLeft    float64
	Stalled        bool
	StalledDays    int
}

VelocityEntry represents plan completion velocity for a feature.

type WebhookEntry

type WebhookEntry struct {
	URL     string `json:"url"`
	Event   string `json:"event"`
	AddedAt string `json:"added_at"`
}

WebhookEntry represents a registered webhook.

type WeeklyReportData

type WeeklyReportData struct {
	DaysBack        int
	FeaturesTouched []string
	CommitsByIntent map[string]int
	TotalCommits    int
	DecisionsMade   int
	BlockersAdded   int
	SessionCount    int
	TotalHours      float64
	TopDecisions    []string
}

WeeklyReportData holds aggregated data for a weekly report.

type WhatIfResult

type WhatIfResult struct {
	Decision      Note
	AffectedNotes []Note
	AffectedFacts []Fact
	TopicRelated  []Note
	TopicFacts    []Fact
}

WhatIfResult holds the impact analysis when considering undoing a decision.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL