Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureDirs ¶
Types ¶
type Config ¶
type Config struct {
Memory MemoryConfig `yaml:"memory"`
Embedding EmbeddingConfig `yaml:"embedding"`
Search SearchConfig `yaml:"search"`
Sanitizer SanitizerConfig `yaml:"sanitizer"`
Indexer IndexerConfig `yaml:"indexer"`
Curation CurationConfig `yaml:"curation"`
Dream DreamConfig `yaml:"dream"`
ContextOptimizer ContextOptimizerConfig `yaml:"context_optimizer"`
Debug DebugConfig `yaml:"debug"`
Plugin PluginConfig `yaml:"plugin"`
Remote RemoteConfig `yaml:"remote"`
// Remotes maps named remotes. When non-empty, takes precedence over Remote.
Remotes map[string]RemoteEntry `yaml:"remotes,omitempty"`
}
func (*Config) ResolveRemote ¶ added in v0.5.0
func (c *Config) ResolveRemote(projectPath string) *RemoteEntry
type ContextOptimizerConfig ¶ added in v0.3.0
type CurationConfig ¶ added in v0.5.7
type CurationConfig struct {
Enabled bool `yaml:"enabled"`
IntervalHours int `yaml:"interval_hours"`
// IntervalMinutes overrides IntervalHours when > 0. Useful for tests and
// users who want more aggressive local-only maintenance.
IntervalMinutes int `yaml:"interval_minutes,omitempty"`
Threshold float64 `yaml:"threshold"`
MaxUpdates int `yaml:"max_updates_per_run"`
}
CurationConfig controls the lightweight serve-time maintenance pass. It is intentionally safe by default: the worker only refreshes lifecycle metadata such as quality_score/importance/curation_status. Destructive cleanup still requires explicit CLI commands.
type DebugConfig ¶ added in v0.4.4
DebugConfig controls anchored's optional NDJSON event log.
When Enabled is false (the default), no log file is created and no events are recorded — the cost of the feature is one struct field. When Enabled is true, every hook invocation and every MCP tool call is appended to Path as a single JSON line, suitable for `jq` post-mortem analysis.
Env overrides (handled in pkg/debuglog): ANCHORED_DEBUG and ANCHORED_DEBUG_PATH always win, so users can flip logging on without editing config.yaml.
type DreamConfig ¶ added in v0.2.0
type EmbeddingConfig ¶
type IndexerConfig ¶ added in v0.2.0
type MemoryConfig ¶
type PluginConfig ¶ added in v0.4.7
type PluginConfig struct {
// AutoUpdate=true makes the SessionStart hook fast-forward the
// marketplace git clone and delete the old cache dir when a newer
// release is detected. User still has to restart Claude Code, but
// no /plugin commands are needed.
AutoUpdate bool `yaml:"auto_update"`
// MarketplaceDir overrides where the Claude Code marketplace mirror
// lives. Defaults to ~/.claude/plugins/marketplaces/anchored.
MarketplaceDir string `yaml:"marketplace_dir"`
// CacheDir overrides where Claude Code keeps the installed-plugin cache.
// Defaults to ~/.claude/plugins/cache/anchored/anchored.
CacheDir string `yaml:"cache_dir"`
// AutoRecall controls the UserPromptSubmit auto-recall injection:
// "off" — inject only the routing reminder (no retrieval)
// "hits" — inject the routing reminder + top relevant memories (default)
// "full" — "hits" plus recent artifacts (test reports, stack traces)
// Empty resolves to "hits".
AutoRecall string `yaml:"auto_recall"`
// HookBudgetBytes caps the size of the auto-recall context block. Lowest-
// relevance hits are dropped to fit rather than truncating mid-content.
// Empty/0 resolves to 4800 (~1200 tokens).
HookBudgetBytes int `yaml:"hook_budget_bytes"`
// SessionStartBudgetBytes caps the rich context block injected by the
// SessionStart hook. nil resolves to 7000 (~1750 tokens); an explicit 0
// disables the rich block entirely (restores the old plain format).
SessionStartBudgetBytes *int `yaml:"sessionstart_budget_bytes"`
// AutoSaveStop controls whether the Stop hook extracts and saves durable
// candidates at the end of each turn. nil resolves to true.
AutoSaveStop *bool `yaml:"auto_save_stop"`
// AdaptiveReminder controls whether the UserPromptSubmit hook adjusts
// the recall reminder based on the quality of the hits. nil resolves to true.
AdaptiveReminder *bool `yaml:"adaptive_reminder"`
}
PluginConfig controls how anchored handles drift between the binary version and the Claude Code plugin cache. Detection (notification in SessionStart) is always on; AutoUpdate flips on the opt-in side effect of fast-forwarding the marketplace git mirror and removing the stale cache entry, which lets Claude Code re-fetch the plugin on its next launch.
func (PluginConfig) AdaptiveReminderEnabled ¶ added in v0.8.0
func (p PluginConfig) AdaptiveReminderEnabled() bool
AdaptiveReminderEnabled reports whether the UserPromptSubmit hook should adapt the recall reminder based on hit quality. nil → true.
func (PluginConfig) AutoRecallMode ¶ added in v0.7.0
func (p PluginConfig) AutoRecallMode() string
AutoRecallMode resolves the configured mode to one of off|hits|full, defaulting to "hits" for any empty/unknown value.
func (PluginConfig) AutoSaveStopEnabled ¶ added in v0.8.0
func (p PluginConfig) AutoSaveStopEnabled() bool
AutoSaveStopEnabled reports whether the Stop hook should extract and save durable candidates. nil → true.
func (PluginConfig) HookBudget ¶ added in v0.7.0
func (p PluginConfig) HookBudget() int
HookBudget resolves the configured byte budget, defaulting to 4800.
func (PluginConfig) SessionStartBudget ¶ added in v0.8.0
func (p PluginConfig) SessionStartBudget() int
SessionStartBudget resolves the SessionStart rich-block byte budget. nil → 7000; explicit value (including 0) → that value.
type RemoteConfig ¶ added in v0.5.0
type RemoteConfig struct {
Enabled bool `yaml:"enabled"`
ServerURL string `yaml:"server_url"`
APIKey string `yaml:"api_key"`
Projects []string `yaml:"projects"`
// AutoSync controls whether anchored_save pushes each newly-saved memory
// to the remote automatically (local-first: local save always succeeds,
// the remote push is best-effort and async). The sync safety filter still
// applies, so user-scoped/personal/secret memories never leave the machine.
// Defaults to true when a remote is configured; set explicitly to false
// to disable.
// omitempty keeps an unset value out of the file entirely — marshaling a
// nil *bool without it writes a confusing "auto_sync: null" (which still
// means enabled, but reads like something is broken).
AutoSync *bool `yaml:"auto_sync,omitempty"`
}
RemoteConfig controls the remote sync endpoint for team-shared memories. All fields default to zero/off — no network calls happen unless explicitly configured. The preview command is offline-only and uses the filter pipeline without contacting any server.
type RemoteEntry ¶ added in v0.5.0
type RemoteEntry struct {
Name string `yaml:"-"`
ServerURL string `yaml:"server_url"`
APIKey string `yaml:"api_key"`
Default bool `yaml:"default,omitempty"`
// Paths are glob patterns matched against a project's local path to
// route it to this remote (e.g. "/home/me/work/*"). path.Match
// semantics: `*` does not cross `/`.
Paths []string `yaml:"paths,omitempty"`
// Projects are remote project IDs linked to THIS server via
// `anchored remote link --remote <name> <id>`. IDs are server-scoped,
// so each entry carries its own links.
Projects []string `yaml:"projects,omitempty"`
AutoSync *bool `yaml:"auto_sync,omitempty"`
}
RemoteEntry is a single named remote server in the remotes map.
func (*RemoteEntry) AutoSyncEnabled ¶ added in v0.6.1
func (e *RemoteEntry) AutoSyncEnabled() bool
type SanitizerConfig ¶
type SearchConfig ¶
type SearchConfig struct {
VectorWeight float64 `yaml:"vector_weight"`
BM25Weight float64 `yaml:"bm25_weight"`
MaxResults int `yaml:"max_results"`
MMREnabled bool `yaml:"mmr_enabled"`
MMRLambda float64 `yaml:"mmr_lambda"`
TemporalDecayEnabled bool `yaml:"temporal_decay_enabled"`
TemporalDecayHalfLifeDays int `yaml:"temporal_decay_half_life_days"`
}