/** * Memory (BRAIN) agent-tool family — `memory_search` / `memory_observe` / * `memory_fetch` / `memory_timeline` (T11947 · M7 · epic T11456 · SG-TOOLS). * * Surfaces the EXISTING BRAIN cognitive-memory operations to the agent loop as * `agent`-toolset tools, mirroring the `cleo memory find|observe|fetch|timeline` * CLI verbs. It adds NO new store, NO new SQL, and NO new schema: each tool * DELEGATES to the established memory ops in * {@link import('../memory/engine-compat.js')} * ({@link memoryFind} / {@link memoryObserve} / {@link memoryFetch} / * {@link memoryTimeline}), which themselves route through the BRAIN retrieval * accessors + the store chokepoint. The agent loop never re-implements brain * retrieval — it reuses the SAME path the CLI and the orchestrator use. * * ## Why a seam, not a hardcoded import (AC5 + Gate-11) * * The four memory ops are injected through the {@link MemoryOps} seam, defaulting * to the real `engine-compat` functions. This lets the unit test inject a FAKE * Brain surface and assert delegation + schema validation WITHOUT opening a real * `brain.db`. Production binds the real ops. The tools are DEFINED here under * `packages/core/src/tools` and CONSUME the memory subsystem — they construct no * new atomic primitive (Gate-11). * * ## Availability (AC4) * * BRAIN read/write is a LOCAL SQLite operation through the store chokepoint — no * credential, no network, no daemon. Every memory tool is therefore * {@link ALWAYS_AVAILABLE}: it works daemon-OFF and credential-OFF. * * ## Gate-13 * * No model/transport/provider client is constructed here — BRAIN search is a * local FTS/SQLite query, not an LLM call. There is no chokepoint concern. * * @epic T11456 * @task T11947 * @see ../memory/engine-compat.js — the memory ops this family delegates to * @see ./exec-code-agent-tool.js — the injectable-seam + self-registering-marker pattern mirrored here */ import type { EngineResult } from '../engine-result.js'; import { type AgentToolRegistry } from './agent-registry.js'; /** * The BRAIN memory operations the family delegates to. Each member has the SAME * signature as the corresponding `engine-compat` function — `(params, root?) → * Promise`. Injectable so the unit test can supply a fake Brain * surface; defaults to the real ops in production. */ export interface MemoryOps { /** Token-efficient compact search (→ `cleo memory find`). */ readonly find: (params: { query: string; limit?: number; }, projectRoot?: string) => Promise; /** Append an observation (→ `cleo memory observe`). */ readonly observe: (params: { text: string; title?: string; }, projectRoot?: string) => Promise; /** Batch fetch entries by ID (→ `cleo memory fetch`). */ readonly fetch: (params: { ids: string[]; }, projectRoot?: string) => Promise; /** Chronological context around an anchor (→ `cleo memory timeline`). */ readonly timeline: (params: { anchor: string; depthBefore?: number; depthAfter?: number; }, projectRoot?: string) => Promise; } /** Options for {@link registerMemoryAgentTools} — all injectable for testing. */ export interface MemoryAgentToolOptions { /** The memory ops seam. Defaults to the real `engine-compat` functions. */ readonly memory?: MemoryOps; /** * The project root threaded into every op (defaults to the resolved project * root via {@link resolveOrCwd} — never a bare `process.cwd()` in core, T9584). */ readonly projectRoot?: string; } /** * Register the memory (BRAIN) agent-tool family into `registry`. Pure * registration — no `brain.db` is opened, no query runs here; all of that happens * later inside each tool's `execute` through the injected (or default) ops. * Import-time side-effect-free. * * @param registry - The registry to populate. * @param options - Injectable memory ops / project root (for testing). */ export declare function registerMemoryAgentTools(registry: AgentToolRegistry, options?: MemoryAgentToolOptions): void; /** * Self-registration marker (AC1) — the identifier the * {@link AgentToolRegistry.discover} bounded source scan greps for. Aliases * {@link registerMemoryAgentTools} so a future scan-dir discovery (or the * built-in aggregator) can call it uniformly with the other agent-tool modules. * * @param registry - The registry to populate. */ export declare function registerAgentTools(registry: AgentToolRegistry): void; //# sourceMappingURL=memory-agent-tools.d.ts.map