Documentation
¶
Overview ¶
Package types defines data structures used throughout agentic-memorizer.
Type Categories:
Internal Processing Types (FileMetadata, SemanticAnalysis, IndexEntry): Used by metadata extraction, semantic analysis, worker pool. NOT exposed in public output formats.
File Index Types (FileIndex, FileEntry): Public output format consumed by integrations and MCP clients. Flattened structure optimized for knowledge graph representation.
Processing pipeline: FileMetadata -> SemanticAnalysis -> IndexEntry -> FileEntry
Index ¶
- type CachedAnalysis
- type Cluster
- type Entity
- type EntityCount
- type EntityRef
- type Fact
- type FactStats
- type FactsIndex
- type FileEntry
- type FileIndex
- type FileInfo
- type FileMetadata
- type Gap
- type ImageDim
- type IndexEntry
- type IndexInsights
- type IndexStats
- type KnowledgeSummary
- type Recommendation
- type Reference
- type RelatedFile
- type SemanticAnalysis
- type TagCount
- type TopicCount
- type UsageGuide
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedAnalysis ¶
type CachedAnalysis struct {
// Versioning - tracks cache entry compatibility
SchemaVersion int `json:"schema_version"` // CachedAnalysis structure version
MetadataVersion int `json:"metadata_version"` // Metadata extraction logic version
SemanticVersion int `json:"semantic_version"` // Semantic analysis logic version
// Provider information - tracks which provider and model produced this analysis
Provider string `json:"provider"` // Provider name (e.g., "claude", "openai", "gemini")
Model string `json:"model"` // Model ID used (e.g., "claude-sonnet-4-5-20250929")
// Core fields
FilePath string `json:"file_path"`
FileHash string `json:"file_hash"`
AnalyzedAt time.Time `json:"analyzed_at"`
Metadata FileMetadata `json:"metadata"`
Semantic *SemanticAnalysis `json:"semantic,omitempty"`
Error *string `json:"error,omitempty"`
}
CachedAnalysis represents a cached semantic analysis result.
Version fields (SchemaVersion, MetadataVersion, SemanticVersion) track cache compatibility. Entries with version 0.0.0 are legacy entries from before versioning was implemented. See internal/cache/version.go for version semantics.
type Cluster ¶ added in v0.13.0
type Cluster struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
FileCount int `json:"file_count"`
FilePaths []string `json:"file_paths,omitempty"`
CommonTags []string `json:"common_tags,omitempty"`
}
Cluster represents a group of related files sharing common themes
type Entity ¶ added in v0.13.0
type Entity struct {
Name string `json:"name"` // The entity name (e.g., "Terraform", "AWS")
Type string `json:"type"` // Entity type: technology, person, concept, organization, project
}
Entity represents a named entity extracted from content (internal use) Used by semantic analyzer; converted to EntityRef for output.
type EntityCount ¶ added in v0.13.0
type EntityCount struct {
Name string `json:"name"`
Type string `json:"type"`
Count int `json:"count"`
}
EntityCount represents an entity with its mention count
type EntityRef ¶ added in v0.13.0
type EntityRef struct {
Name string `json:"name"`
Type string `json:"type"` // technology, person, organization, concept, project
}
EntityRef is a reference to an entity from a file
type Fact ¶ added in v0.14.0
type Fact struct {
ID string `json:"id"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
Source string `json:"source"`
}
Fact represents a single user-defined fact in the knowledge graph
type FactsIndex ¶ added in v0.14.0
type FactsIndex struct {
Generated time.Time `json:"generated"`
Facts []Fact `json:"facts"`
Stats FactStats `json:"stats"`
}
FactsIndex represents the output format for facts This structure is used when outputting facts via CLI or hooks
type FileEntry ¶ added in v0.13.0
type FileEntry struct {
// Identity
Path string `json:"path"`
Name string `json:"name"`
Hash string `json:"hash"`
// Classification
Type string `json:"type"` // file extension
Category string `json:"category"` // documents, code, images, etc.
// Physical attributes
Size int64 `json:"size"`
SizeHuman string `json:"size_human"`
Modified time.Time `json:"modified"`
IsReadable bool `json:"is_readable"`
// Type-specific metadata (optional)
WordCount *int `json:"word_count,omitempty"`
PageCount *int `json:"page_count,omitempty"`
SlideCount *int `json:"slide_count,omitempty"`
Dimensions *ImageDim `json:"dimensions,omitempty"`
Duration *string `json:"duration,omitempty"`
Language *string `json:"language,omitempty"`
Author *string `json:"author,omitempty"`
// Semantic understanding
Summary string `json:"summary,omitempty"`
DocumentType string `json:"document_type,omitempty"`
Confidence float64 `json:"confidence,omitempty"`
// Graph relationships (the knowledge graph edges)
Tags []string `json:"tags,omitempty"`
Topics []string `json:"topics,omitempty"`
Entities []EntityRef `json:"entities,omitempty"`
// Related files (the graph value-add) - populated in verbose mode
RelatedFiles []RelatedFile `json:"related_files,omitempty"`
// Error (if analysis failed)
Error *string `json:"error,omitempty"`
}
FileEntry represents a file in the knowledge graph This is a flattened structure replacing the nested IndexEntry
type FileIndex ¶ added in v0.14.0
type FileIndex struct {
// Metadata
Generated time.Time `json:"generated"`
MemoryRoot string `json:"memory_root"`
Stats IndexStats `json:"stats"`
// Files with their semantic understanding and relationships
Files []FileEntry `json:"files"`
// Knowledge graph summary (tag/topic/entity landscape)
Knowledge *KnowledgeSummary `json:"knowledge,omitempty"`
// Insights from graph analytics (verbose mode only)
Insights *IndexInsights `json:"insights,omitempty"`
// Usage guide for consuming files
UsageGuide *UsageGuide `json:"usage_guide,omitempty"`
}
FileIndex represents the file memory index This is the primary format for file index output
type FileInfo ¶
type FileInfo struct {
Path string `json:"path"`
RelPath string `json:"rel_path"`
Hash string `json:"hash"`
Size int64 `json:"size"`
Modified time.Time `json:"modified"`
Type string `json:"type"`
Category string `json:"category"`
IsReadable bool `json:"is_readable"`
}
FileInfo represents basic file metadata (internal use)
type FileMetadata ¶
type FileMetadata struct {
FileInfo
// Type-specific fields
WordCount *int `json:"word_count,omitempty"`
PageCount *int `json:"page_count,omitempty"`
SlideCount *int `json:"slide_count,omitempty"`
Dimensions *ImageDim `json:"dimensions,omitempty"`
Duration *string `json:"duration,omitempty"`
Sections []string `json:"sections,omitempty"`
Language *string `json:"language,omitempty"`
Author *string `json:"author,omitempty"`
}
FileMetadata represents extracted file-specific metadata (internal use) Used by metadata extractors to collect file-specific information.
type Gap ¶ added in v0.13.0
type Gap struct {
Type string `json:"type"` // topic, entity, tag, category
Name string `json:"name"`
Description string `json:"description"`
Severity string `json:"severity"` // low, medium, high
Suggestion string `json:"suggestion,omitempty"`
}
Gap represents a knowledge gap or coverage issue
type IndexEntry ¶
type IndexEntry struct {
Metadata FileMetadata `json:"metadata"`
Semantic *SemanticAnalysis `json:"semantic,omitempty"`
Error *string `json:"error,omitempty"`
}
IndexEntry combines metadata and semantic analysis (internal use) Used by worker pool and graph manager for processing pipeline.
type IndexInsights ¶ added in v0.13.0
type IndexInsights struct {
// File recommendations based on graph relationships
Recommendations []Recommendation `json:"recommendations,omitempty"`
// Topic clusters detected in the graph
TopicClusters []Cluster `json:"topic_clusters,omitempty"`
// Coverage gaps identified in the knowledge base
CoverageGaps []Gap `json:"coverage_gaps,omitempty"`
}
IndexInsights contains graph analytics results (verbose mode only)
type IndexStats ¶
type IndexStats struct {
// File statistics
TotalFiles int `json:"total_files"`
TotalSize int64 `json:"total_size"`
AnalyzedFiles int `json:"analyzed_files"`
CachedFiles int `json:"cached_files"`
ErrorFiles int `json:"error_files"`
// Graph statistics
TotalTags int `json:"total_tags,omitempty"`
TotalTopics int `json:"total_topics,omitempty"`
TotalEntities int `json:"total_entities,omitempty"`
TotalEdges int `json:"total_edges,omitempty"`
ByCategory map[string]int `json:"by_category,omitempty"`
// Coverage metrics
FilesWithSummary int `json:"files_with_summary,omitempty"`
FilesWithTags int `json:"files_with_tags,omitempty"`
FilesWithTopics int `json:"files_with_topics,omitempty"`
FilesWithEntities int `json:"files_with_entities,omitempty"`
AvgTagsPerFile float64 `json:"avg_tags_per_file,omitempty"`
}
IndexStats provides summary statistics
type KnowledgeSummary ¶ added in v0.13.0
type KnowledgeSummary struct {
// Top tags by file count
TopTags []TagCount `json:"top_tags,omitempty"`
// Top topics by file count
TopTopics []TopicCount `json:"top_topics,omitempty"`
// Top entities by mention count
TopEntities []EntityCount `json:"top_entities,omitempty"`
}
KnowledgeSummary provides an overview of the knowledge landscape
type Recommendation ¶ added in v0.13.0
type Recommendation struct {
SourcePath string `json:"source_path"`
TargetPath string `json:"target_path"`
TargetName string `json:"target_name"`
Reason string `json:"reason"`
Score float64 `json:"score"`
}
Recommendation suggests related files based on graph analysis
type Reference ¶ added in v0.13.0
type Reference struct {
Topic string `json:"topic"` // The referenced topic
Type string `json:"type"` // Reference type: requires, extends, related-to, implements
Confidence float64 `json:"confidence"` // Confidence score 0.0-1.0
}
Reference represents a topical reference or dependency
type RelatedFile ¶ added in v0.13.0
type RelatedFile struct {
Path string `json:"path"`
Name string `json:"name"`
Via string `json:"via"` // "tags", "topics", "entities", "similarity"
Score float64 `json:"score,omitempty"`
}
RelatedFile represents a file related through the knowledge graph
type SemanticAnalysis ¶
type SemanticAnalysis struct {
Summary string `json:"summary"`
Tags []string `json:"tags"`
KeyTopics []string `json:"key_topics"`
DocumentType string `json:"document_type"`
Confidence float64 `json:"confidence"`
Entities []Entity `json:"entities,omitempty"` // Named entities mentioned in content
References []Reference `json:"references,omitempty"` // Topic references and dependencies
}
SemanticAnalysis represents AI-generated understanding (internal use) Used by semantic analyzer and cache; fields are flattened into FileEntry for output.
type TopicCount ¶ added in v0.13.0
TopicCount represents a topic with its usage count
type UsageGuide ¶ added in v0.14.0
type UsageGuide struct {
// Description explains what the memory index is
Description string `json:"description"`
// WhenToUse provides guidance on when to access files
WhenToUse string `json:"when_to_use"`
// DirectReadable lists file types that can be read directly by the agent
DirectReadable string `json:"direct_readable"`
// ExtractionRequired lists file types that need extraction before reading
ExtractionRequired string `json:"extraction_required"`
}
UsageGuide provides instructions for AI agents on how to use the memory index