memory

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePath

func DecodePath(encoded string) string

DecodePath converts an encoded project directory name back to a filesystem path.

Types

type ConsolidationGroup added in v0.2.0

type ConsolidationGroup struct {
	ID             int           `json:"id"`
	Files          []*MemoryFile `json:"files"`
	MaxScore       float64       `json:"max_score"`
	SharedKeywords []string      `json:"shared_keywords"`
	Reason         string        `json:"reason"`
	Prompt         string        `json:"prompt"`
}

type ConsolidationReport added in v0.2.0

type ConsolidationReport struct {
	Groups    []ConsolidationGroup `json:"groups"`
	CheckedAt int64                `json:"checked_at"`
}

func FindConsolidation added in v0.2.0

func FindConsolidation(files []*MemoryFile) *ConsolidationReport

FindConsolidation detects cross-project duplicate memories and groups them.

type GraphData

type GraphData struct {
	Nodes  []GraphNode  `json:"nodes"`
	Edges  []GraphEdge  `json:"edges"`
	Groups []GraphGroup `json:"groups"`
}

func BuildGraph

func BuildGraph(files []*MemoryFile) *GraphData

BuildGraph creates a graph representation of memory files and their relationships.

type GraphEdge

type GraphEdge struct {
	Source string `json:"source"`
	Target string `json:"target"`
	Type   string `json:"type"` // "index-link"
}

type GraphGroup

type GraphGroup struct {
	Project string `json:"project"`
	Label   string `json:"label"`
	Count   int    `json:"count"`
}

type GraphNode

type GraphNode struct {
	ID       string `json:"id"`
	Label    string `json:"label"`
	Project  string `json:"project"`
	Category string `json:"category"`
	FMType   string `json:"fm_type"`
	ModTime  int64  `json:"mod_time"`
}

type HealthReport added in v0.5.0

type HealthReport struct {
	Scores       []HealthScore  `json:"scores"`
	AverageScore int            `json:"average_score"`
	GradeCount   map[string]int `json:"grade_count"`
	CheckedAt    int64          `json:"checked_at"`
}

HealthReport is the overall health assessment for all memory files.

func ScoreHealth added in v0.5.0

func ScoreHealth(files []*MemoryFile) *HealthReport

ScoreHealth computes health scores for all memory files.

type HealthScore added in v0.5.0

type HealthScore struct {
	Path          string   `json:"path"`
	Project       string   `json:"project"`
	Category      string   `json:"category"`
	FMName        string   `json:"fm_name,omitempty"`
	Overall       int      `json:"overall"`       // 0-100 weighted average
	Freshness     int      `json:"freshness"`     // 0-100 based on age
	Structure     int      `json:"structure"`     // 0-100 frontmatter completeness
	Specificity   int      `json:"specificity"`   // 0-100 concrete entities vs vague prose
	Connectedness int      `json:"connectedness"` // 0-100 indexed, cross-referenced
	Suggestions   []string `json:"suggestions"`   // improvement hints
	Prompt        string   `json:"prompt"`        // Claude Code prompt to fix issues
	Grade         string   `json:"grade"`         // A/B/C/D/F
}

HealthScore represents the health assessment of a single memory file.

type MemoryFile

type MemoryFile struct {
	Path        string `json:"path"`
	Project     string `json:"project"`
	Category    string `json:"category"` // "claude-md", "rules", "auto-memory", "memory-file"
	Content     string `json:"content"`
	HTMLContent string `json:"html_content"`
	ModTime     int64  `json:"mod_time"`

	// Parsed frontmatter fields
	FMName        string `json:"fm_name,omitempty"`
	FMDescription string `json:"fm_description,omitempty"`
	FMType        string `json:"fm_type,omitempty"` // user, feedback, project, reference
}

func DiscoverAll

func DiscoverAll(claudeDir string) ([]*MemoryFile, error)

func SearchMemories

func SearchMemories(memories []*MemoryFile, query string) []*MemoryFile

SearchMemories searches all memory files for a query string (case-insensitive).

type StalenessAlert

type StalenessAlert struct {
	Type       string `json:"type"`     // "broken-link", "orphaned-file", "index-mismatch"
	Severity   string `json:"severity"` // "error", "warning"
	Project    string `json:"project"`
	FilePath   string `json:"file_path"`
	TargetPath string `json:"target_path,omitempty"`
	Message    string `json:"message"`
}

type StalenessReport

type StalenessReport struct {
	Alerts     []StalenessAlert `json:"alerts"`
	TotalFiles int              `json:"total_files"`
	CheckedAt  int64            `json:"checked_at"`
}

func CheckStaleness

func CheckStaleness(files []*MemoryFile) *StalenessReport

CheckStaleness analyzes memory files for broken links, orphaned files, and index mismatches.

Jump to

Keyboard shortcuts

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