/** * BRAIN Multi-Pass Retrieval Bundle (PSYCHE Wave 4 · T1090). * * Executes up to three passes in parallel: * - Cold (20 % of budget): user-profile traits + peer instructions * - Warm (50 % of budget): peer-scoped learnings, patterns, decisions * - Hot (30 % of budget): session narrative + recent observations + active tasks * * @task T1090 * @epic T1083 */ /** * Cold pass — fetch user-profile traits and peer instructions from NEXUS. * * Calls `listUserProfile({ minConfidence: 0.5 })` from Wave 1 (T1078). * `peerInstructions` is populated from the sigil's `systemPromptFragment` * when a sigil exists for `peerId` (Wave 8 — T1148). Falls back to an empty * string when no sigil is found or when the sigil has no fragment set. * * @param peerId - CANT peer identifier (used to look up the sigil). * @param nexusDb - Drizzle nexus database handle. * @returns Cold-pass bundle slice: userProfile traits + peerInstructions + sigilCard. * * @task T1090 * @task T1148 */ export declare function fetchIdentity(peerId: string, nexusDb: import('drizzle-orm/node-sqlite').NodeSQLiteDatabase): Promise<{ userProfile: import('@cleocode/contracts').UserProfileTrait[]; peerInstructions: string; sigilCard: import('../../nexus/sigil.js').SigilCard | null; }>; /** * Warm pass — fetch peer-scoped learnings, patterns, and decisions from BRAIN. * * Uses the Wave 2 peer_id filter: each query returns rows where * `peer_id = peerId OR peer_id = 'global'`. When `query` is supplied the * learnings search is narrowed to relevant entries via FTS; decisions and * patterns are returned by recency (most recent first, capped at 10 each). * * @param peerId - CANT peer identifier. * @param brainDb - Drizzle brain database handle. * @param query - Optional search term to scope learnings retrieval. * @returns Warm-pass bundle slice: peerLearnings, peerPatterns, decisions. * * @task T1090 */ export declare function fetchPeerMemory(peerId: string, query?: string): Promise<{ peerLearnings: import('@cleocode/contracts').RetrievalLearning[]; peerPatterns: import('@cleocode/contracts').RetrievalPattern[]; decisions: import('@cleocode/contracts').RetrievalDecision[]; }>; /** * Hot pass — fetch live session state: narrative + recent observations + active tasks. * * Calls `getSessionNarrative(sessionId)` from Wave 3 (T1089). * Active tasks are queried from tasks.db via the DataAccessor. * * @param sessionId - Active session identifier. * @param projectRoot - Project root for DB resolution (tasks.db + brain.db). * @returns Hot-pass bundle slice: sessionNarrative, recentObservations, activeTasks. * * @task T1090 */ export declare function fetchSessionState(sessionId: string, projectRoot: string): Promise<{ sessionNarrative: string; recentObservations: import('@cleocode/contracts').RetrievalObservation[]; activeTasks: import('@cleocode/contracts').RetrievalActiveTask[]; }>; /** * Build a structured multi-pass retrieval bundle for agent briefing. * * Executes up to three passes in parallel (controlled by `passMask`): * * - **Cold** (20 % of budget): user-profile traits + peer instructions * - **Warm** (50 % of budget): peer-scoped learnings, patterns, decisions * - **Hot** (30 % of budget): session narrative + recent observations + active tasks * * When the total token estimate exceeds `tokenBudget`, the hot pass is trimmed * first (observations then tasks) to preserve the more stable cold/warm context. * * This function is the primary entry point consumed by `computeBriefing` in * `packages/core/src/sessions/briefing.ts` (T1091). * * @param req - Retrieval request with peerId, sessionId, optional query and passMask. * @param projectRoot - Project root directory for DB resolution. * @returns Fully-structured `RetrievalBundle` with token accounting. * * @example * ```ts * const bundle = await buildRetrievalBundle( * { peerId: 'cleo-prime', sessionId: 'ses_abc', passMask: { cold: true, warm: true, hot: true } }, * '/mnt/projects/cleocode', * ); * console.log(bundle.cold.userProfile.length, 'profile traits'); * ``` * * @task T1090 * @epic T1083 */ export declare function buildRetrievalBundle(req: import('@cleocode/contracts').RetrievalRequest, projectRoot: string): Promise; //# sourceMappingURL=build-retrieval-bundle.d.ts.map