Documentation
¶
Index ¶
- Variables
- type BootstrapLoader
- type ContextBuilder
- func (cb *ContextBuilder) BuildDynamicContext() string
- func (cb *ContextBuilder) BuildSystemPromptPrefix() string
- func (cb *ContextBuilder) BuildSystemPromptPrefixWithHints(hints []string) string
- func (cb *ContextBuilder) BuildSystemPromptPrefixWithHyDE(ctx context.Context, query string, hints []string, ...) string
- func (cb *ContextBuilder) BuildWorkspaceContextMode(ctx context.Context, query string, hints []string, ...) string
- func (cb *ContextBuilder) InvalidateCache()
- func (cb *ContextBuilder) WorkspaceDir() string
- type DailyNote
- type MemoryStore
- func (ms *MemoryStore) AppendLongTerm(entry string) error
- func (ms *MemoryStore) AttachVectorIndex(v *memory.VectorIndex)
- func (ms *MemoryStore) EnsureDirectories() error
- func (ms *MemoryStore) ForgetFacts(substr string) int
- func (ms *MemoryStore) GetMemoryContext() string
- func (ms *MemoryStore) GetMemoryIndex(budget int) string
- func (ms *MemoryStore) GetRecentDailyNotes(days int) []DailyNote
- func (ms *MemoryStore) GetRelevantContext(hints []string) string
- func (ms *MemoryStore) GetRelevantContextWithHyDE(ctx context.Context, query string, hints []string, ...) string
- func (ms *MemoryStore) Manager() *memory.Manager
- func (ms *MemoryStore) ProcessExtraction(response string)
- func (ms *MemoryStore) ProcessExtractionResult(response string) memory.ExtractionSummary
- func (ms *MemoryStore) ReadLongTerm() string
- func (ms *MemoryStore) RecordInteraction(event memory.InteractionEvent)
- func (ms *MemoryStore) RememberFact(content, category string) bool
- func (ms *MemoryStore) SanitizeForPrompt(s string) string
- func (ms *MemoryStore) SetWorkspaceDir(dir string)
- func (ms *MemoryStore) TodayNotePath() string
- func (ms *MemoryStore) UpdateProfile(updates map[string]string) bool
- func (ms *MemoryStore) VectorIndex() *memory.VectorIndex
- func (ms *MemoryStore) WriteDailyNote(entry string) error
- func (ms *MemoryStore) WriteLongTerm(content string) error
- type Rule
- type RulesLoader
Constants ¶
This section is empty.
Variables ¶
var BootstrapFiles = []string{
"AGENTS.md",
"SOUL.md",
"USER.md",
"IDENTITY.md",
"RULES.md",
}
BootstrapFiles are loaded in this order (all optional).
Functions ¶
This section is empty.
Types ¶
type BootstrapLoader ¶
type BootstrapLoader struct {
// contains filtered or unexported fields
}
BootstrapLoader loads and caches workspace bootstrap files.
func NewBootstrapLoader ¶
func NewBootstrapLoader(workspaceDir, globalDir string, logger *zap.Logger) *BootstrapLoader
NewBootstrapLoader creates a new loader.
func (*BootstrapLoader) InvalidateCache ¶
func (bl *BootstrapLoader) InvalidateCache()
InvalidateCache forces reload on next call.
func (*BootstrapLoader) IsStale ¶
func (bl *BootstrapLoader) IsStale() bool
IsStale checks if any cached file has been modified on disk.
func (*BootstrapLoader) LoadBootstrapContent ¶
func (bl *BootstrapLoader) LoadBootstrapContent() string
LoadBootstrapContent loads all bootstrap files with mtime-based cache invalidation. Priority: workspace > global (workspace files override global).
type ContextBuilder ¶
type ContextBuilder struct {
// contains filtered or unexported fields
}
ContextBuilder assembles the full system prompt from workspace sources.
func NewContextBuilder ¶
func NewContextBuilder(bootstrap *BootstrapLoader, memory *MemoryStore, workspaceDir string) *ContextBuilder
NewContextBuilder creates a new context builder. workspaceDir is the detected project root (or CWD) where the session started.
func (*ContextBuilder) BuildDynamicContext ¶
func (cb *ContextBuilder) BuildDynamicContext() string
BuildDynamicContext returns time-sensitive and session-aware context. Includes current time, working directory, and disambiguation instructions so the model never confuses paths from long-term memory with the current session.
func (*ContextBuilder) BuildSystemPromptPrefix ¶
func (cb *ContextBuilder) BuildSystemPromptPrefix() string
BuildSystemPromptPrefix returns workspace context to prepend to the system prompt. Includes: bootstrap files + memory context. Does NOT include mode-specific instructions (coder/agent prompts).
func (*ContextBuilder) BuildSystemPromptPrefixWithHints ¶ added in v1.97.0
func (cb *ContextBuilder) BuildSystemPromptPrefixWithHints(hints []string) string
BuildSystemPromptPrefixWithHints returns workspace context with memory retrieval tailored to the given conversation hints (keywords).
func (*ContextBuilder) BuildSystemPromptPrefixWithHyDE ¶ added in v1.106.0
func (cb *ContextBuilder) BuildSystemPromptPrefixWithHyDE(ctx context.Context, query string, hints []string, augmenter *memory.HyDEAugmenter) string
BuildSystemPromptPrefixWithHyDE returns workspace context with HyDE (Hypothetical Document Embeddings) augmenting memory retrieval.
query is the raw user message used to seed the hypothesis; hints are the existing keyword set (typically from ExtractKeywords on recent messages). When augmenter is nil and no vector index is attached, behavior matches BuildSystemPromptPrefixWithHints exactly — the no-regression contract.
func (*ContextBuilder) BuildWorkspaceContextMode ¶ added in v1.128.1
func (cb *ContextBuilder) BuildWorkspaceContextMode( ctx context.Context, query string, hints []string, augmenter *memory.HyDEAugmenter, mode string, recallHint string, ) string
BuildWorkspaceContextMode assembles the workspace context (bootstrap files + memory + path rules) honoring a memory injection mode:
"full" — hint-driven full memory retrieval (default; the push model)
"index" — only the compact, stable memory index, paired with recallHint
so the agent knows to pull detail via the @memory recall tool
"off" — no memory at all (bootstrap + rules still injected)
Bootstrap files and path rules are emitted in every mode; only the memory portion changes. "full" reuses the existing retrieval methods verbatim so that path stays byte-for-byte unchanged. recallHint (may be "") is appended after the index in "index" mode only.
func (*ContextBuilder) InvalidateCache ¶
func (cb *ContextBuilder) InvalidateCache()
InvalidateCache forces rebuild on next call.
func (*ContextBuilder) WorkspaceDir ¶ added in v1.97.0
func (cb *ContextBuilder) WorkspaceDir() string
WorkspaceDir returns the current workspace directory.
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is the backward-compatible facade that delegates to the new structured memory.Manager. All existing callers (ContextBuilder, memoryWorker, memory_command) continue to work through this interface.
func NewMemoryStore ¶
func NewMemoryStore(baseDir string, logger *zap.Logger) *MemoryStore
NewMemoryStore creates a new memory store backed by the structured Manager.
func (*MemoryStore) AppendLongTerm ¶
func (ms *MemoryStore) AppendLongTerm(entry string) error
AppendLongTerm adds new content to long-term memory.
func (*MemoryStore) AttachVectorIndex ¶ added in v1.106.0
func (ms *MemoryStore) AttachVectorIndex(v *memory.VectorIndex)
AttachVectorIndex attaches a vector index used by HyDE Phase 3b. Pass nil to detach.
func (*MemoryStore) EnsureDirectories ¶
func (ms *MemoryStore) EnsureDirectories() error
EnsureDirectories creates the memory directory structure.
func (*MemoryStore) ForgetFacts ¶ added in v1.123.0
func (ms *MemoryStore) ForgetFacts(substr string) int
ForgetFacts removes facts matching substr and returns how many were removed.
func (*MemoryStore) GetMemoryContext ¶
func (ms *MemoryStore) GetMemoryContext() string
GetMemoryContext builds the memory section for the system prompt. Uses smart retrieval when no hints are provided.
func (*MemoryStore) GetMemoryIndex ¶ added in v1.128.1
func (ms *MemoryStore) GetMemoryIndex(budget int) string
GetMemoryIndex returns the compact, stable memory digest. See memory.Manager.GetMemoryIndex.
func (*MemoryStore) GetRecentDailyNotes ¶
func (ms *MemoryStore) GetRecentDailyNotes(days int) []DailyNote
GetRecentDailyNotes returns the last N days of notes.
func (*MemoryStore) GetRelevantContext ¶ added in v1.97.0
func (ms *MemoryStore) GetRelevantContext(hints []string) string
GetRelevantContext returns memory tailored to conversation hints.
func (*MemoryStore) GetRelevantContextWithHyDE ¶ added in v1.106.0
func (ms *MemoryStore) GetRelevantContextWithHyDE(ctx context.Context, query string, hints []string, augmenter *memory.HyDEAugmenter) string
GetRelevantContextWithHyDE delegates to the manager's HyDE-aware retrieval. See memory.Manager.GetRelevantContextWithHyDE.
func (*MemoryStore) Manager ¶ added in v1.97.0
func (ms *MemoryStore) Manager() *memory.Manager
Manager returns the underlying memory.Manager for advanced operations.
func (*MemoryStore) ProcessExtraction ¶ added in v1.97.0
func (ms *MemoryStore) ProcessExtraction(response string)
ProcessExtraction processes enhanced extraction output from the memory worker. Void for API compatibility; use ProcessExtractionResult for the summary.
func (*MemoryStore) ProcessExtractionResult ¶ added in v1.123.0
func (ms *MemoryStore) ProcessExtractionResult(response string) memory.ExtractionSummary
ProcessExtractionResult is ProcessExtraction with a summary of what was persisted.
func (*MemoryStore) ReadLongTerm ¶
func (ms *MemoryStore) ReadLongTerm() string
ReadLongTerm returns the rendered long-term memory content.
func (*MemoryStore) RecordInteraction ¶ added in v1.97.0
func (ms *MemoryStore) RecordInteraction(event memory.InteractionEvent)
RecordInteraction records a usage event.
func (*MemoryStore) RememberFact ¶ added in v1.123.0
func (ms *MemoryStore) RememberFact(content, category string) bool
RememberFact stores a single fact deterministically (no LLM). category may be empty to auto-classify. Returns true if newly added.
func (*MemoryStore) SanitizeForPrompt ¶ added in v1.182.0
func (ms *MemoryStore) SanitizeForPrompt(s string) string
SanitizeForPrompt exposes the threatscan pass for graph text assembled at the cli layer (index card, @memory neighbors output) — fact summaries flow into both, and every other memory injection already goes through this. Nil-safe so callers without a memory store pass text through unchanged.
func (*MemoryStore) SetWorkspaceDir ¶ added in v1.97.0
func (ms *MemoryStore) SetWorkspaceDir(dir string)
SetWorkspaceDir sets the current session's workspace directory so that new facts are annotated with the project they were learned in.
func (*MemoryStore) TodayNotePath ¶
func (ms *MemoryStore) TodayNotePath() string
TodayNotePath returns the path for today's note.
func (*MemoryStore) UpdateProfile ¶ added in v1.123.0
func (ms *MemoryStore) UpdateProfile(updates map[string]string) bool
UpdateProfile applies deterministic profile updates and returns whether anything changed.
func (*MemoryStore) VectorIndex ¶ added in v1.106.0
func (ms *MemoryStore) VectorIndex() *memory.VectorIndex
VectorIndex returns the attached vector index (may be nil).
func (*MemoryStore) WriteDailyNote ¶
func (ms *MemoryStore) WriteDailyNote(entry string) error
WriteDailyNote appends to today's daily note.
func (*MemoryStore) WriteLongTerm ¶
func (ms *MemoryStore) WriteLongTerm(content string) error
WriteLongTerm parses content into facts and merges them into long-term memory (existing facts are kept; duplicates reinforce).
type Rule ¶ added in v1.97.0
type Rule struct {
Name string // filename without extension
Content string // markdown body (after frontmatter)
Paths []string // glob patterns; empty = applies globally
ModTime time.Time
}
Rule represents a single rule file with optional path-matching.
type RulesLoader ¶ added in v1.97.0
type RulesLoader struct {
// contains filtered or unexported fields
}
RulesLoader scans and loads path-specific rules from .chatcli/rules/ directories. Rules are loaded lazily and cached with mtime invalidation.
func NewRulesLoader ¶ added in v1.97.0
func NewRulesLoader(workspaceDir, globalDir string, logger *zap.Logger) *RulesLoader
NewRulesLoader creates a new rules loader.
func (*RulesLoader) LoadMatchingRules ¶ added in v1.97.0
func (rl *RulesLoader) LoadMatchingRules(contextPaths []string) string
LoadMatchingRules returns all rules that match the given file paths. If contextPaths is empty, returns only global rules (no paths: filter). Rules from workspace override global rules with the same name.
Directories
¶
| Path | Synopsis |
|---|---|
|
* ChatCLI - Change notification for memory sub-stores * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0 * * changeNotifier is the one-line "mark derived caches stale" seam each * sub-store embeds.
|
* ChatCLI - Change notification for memory sub-stores * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0 * * changeNotifier is the one-line "mark derived caches stale" seam each * sub-store embeds. |
|
eval
* ChatCLI - Long-term memory: retrieval evaluation harness.
|
* ChatCLI - Long-term memory: retrieval evaluation harness. |
|
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0
|
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: Apache-2.0 |