import type { ToolDefinition } from "../../tools/types.js"; export * from "./types.js"; export { MemoryExtractor } from "./extractor.js"; import type { MemoryTier, MemoryType, MemoryUnit, LoadResult, MemoryLoaderConfig } from "./types.js"; export declare class MemoryLoader { private readonly config; private units; private loaded; private static readonly DEFAULT_BUDGETS; constructor(config: MemoryLoaderConfig); private sanitizeFileSegment; static fromRoot(root: string, opts?: Partial): MemoryLoader; private ensureDirectoryStructure; scan(): void; private registerFileSelf; /** * wake() — Load Tier 0 (identity). Always called first. * Additive: already-loaded units are skipped. */ wake(): LoadResult; /** * orient() — Load Tier 1 (working, user/PROFILE, INDEX files). * Additive. */ orient(): LoadResult; /** * match(task) — Load Tier 2 units relevant to the task string. * Scored by tag-overlap × recency. Additive. * Returns empty LoadResult if taskTokens is empty (no error). */ match(task: string): LoadResult; /** * query(topic) — Load Tier 3 units. Called only via the memory_query tool. * Additive. */ query(topic: string): LoadResult; /** * load(key) — Directly load a specific memory unit by key. Additive. */ load(key: string): MemoryUnit | null; /** * loadType(type) — Load all units of a given memory type. * Budget: 16000t fixed (intentional escape hatch). * Non-additive: returns ALL units of the requested type regardless of * whether they were already loaded during this session. This is * intentional — callers such as MemoryExtractor.consolidate() need a * complete view of every unit on disk, not just the incremental delta. */ loadType(type: MemoryType): LoadResult; /** * buildSystemPrompt(tiers) — Assemble loaded units into a system prompt string. * Default tiers: [0, 1, 2] */ buildSystemPrompt(tiers?: MemoryTier[]): string; /** * getLoadedManifest() — Compact list of loaded keys + costs. * Format: "- (T, t)" per line. */ getLoadedManifest(): string; /** resetSession() — Clear loaded set and release hydrated content. Does not remove files. */ resetSession(): void; /** * persist() — Write a memory unit to disk. * autoIndex: rebuildIndex() called synchronously before return when autoIndex === true. * Returns MemoryUnit with content populated. */ persist(type: MemoryType, filename: string, content: string, subfolder?: string): MemoryUnit; private persistInternal; /** * persistEpisodic() — Write session log to episodic/recent/_.md. * Triggers compaction if recent/ has files older than episodicRecentDays. */ persistEpisodic(sessionId: string, content: string): MemoryUnit; /** * persistSemantic() — Write knowledge unit to semantic//.md. * Rebuilds both domain INDEX.md and root semantic INDEX.md. */ persistSemantic(domain: string, topic: string, content: string): MemoryUnit; /** * rebuildIndex() — Rewrite the INDEX.md for a given folder. * INDEX.md files are write-only — never read back by the loader. */ rebuildIndex(folder: string): void; /** rebuildAllIndexes() — Rebuild every INDEX.md in the tree. */ rebuildAllIndexes(): void; stats(): { totalUnits: number; currentlyLoaded: number; totalTokensOnDisk: number; byType: Record; byTier: Record; root: string; }; /** * getQueryTool() — Returns the memory_query ToolDefinition. * The `reason` param is prompting-only — not used in execute logic. * `_ctx` is typed as ToolContext (base); MemoryLoader needs no harness-specific context. */ getQueryTool(): ToolDefinition<{ topic: string; reason: string; }, object>; private loadByTier; private getUnitsByTier; private getBudget; private hydrate; private injectFrontmatter; private compactEpisodicIfNeeded; private log; } //# sourceMappingURL=index.d.ts.map