/**
 * Cross-database cleanup hooks for brain.db → tasks.db soft FK enforcement.
 *
 * SQLite does not support foreign key constraints across database connections.
 * This module provides application-layer guards that maintain referential
 * integrity between brain.db and tasks.db after destructive operations.
 *
 * Implements the recommendations from T030 audit (XFKB-001 through XFKB-005).
 *
 * @task T033
 * @epic T029
 */
/**
 * Clean up brain.db references after a task is deleted from tasks.db.
 *
 * Handles:
 * - XFKB-001/002: Nullify brain_decisions.context_epic_id / context_task_id
 * - XFKB-003: Delete brain_memory_links rows where task_id matches
 * - XFKB-005: Delete brain_page_nodes with id='task:<taskId>' and cascade brain_page_edges
 *
 * This is a best-effort cleanup — brain.db is a cognitive store and minor
 * staleness is preferable to failing task deletions due to brain.db errors.
 *
 * @remarks
 * Best-effort: failures in brain.db cleanup do not propagate to the caller.
 * A background reconciliation pass can clean up any residual stale refs.
 *
 * @param taskId - The ID of the task being deleted from tasks.db
 * @param cwd - Optional working directory
 *
 * @example
 * ```ts
 * await cleanupBrainRefsOnTaskDelete('T042');
 * ```
 */
export declare function cleanupBrainRefsOnTaskDelete(taskId: string, cwd?: string): Promise<void>;
/**
 * Clean up brain.db references after a session is deleted from tasks.db.
 *
 * Handles:
 * - XFKB-004: Nullify brain_observations.source_session_id where it matches
 *
 * @remarks
 * Best-effort: failures do not propagate. brain.db may not be initialised.
 *
 * @param sessionId - The ID of the session being deleted from tasks.db
 * @param cwd - Optional working directory
 *
 * @example
 * ```ts
 * await cleanupBrainRefsOnSessionDelete('ses_20260321_abc');
 * ```
 */
export declare function cleanupBrainRefsOnSessionDelete(sessionId: string, cwd?: string): Promise<void>;
/**
 * Verify a task ID exists in tasks.db before writing a cross-DB reference to brain.db.
 * Returns true if the task exists, false otherwise.
 *
 * Provides write-guard for XFKB-001/002/003 on brain.db insert.
 *
 * @remarks
 * Used as a write-guard before inserting cross-DB references into brain.db.
 *
 * @param taskId - Task ID to verify
 * @param tasksDb - The tasks.db drizzle instance
 * @returns True if the task exists in tasks.db
 *
 * @example
 * ```ts
 * if (await taskExistsInTasksDb('T042', db)) { /* safe to reference *\/ }
 * ```
 */
export declare function taskExistsInTasksDb(taskId: string, tasksDb: Awaited<ReturnType<typeof import('./sqlite.js').getDb>>): Promise<boolean>;
/**
 * Verify a session ID exists in tasks.db before writing a cross-DB reference to brain.db.
 * Returns true if the session exists, false otherwise.
 *
 * Provides write-guard for XFKB-004 on brain.db insert.
 *
 * @remarks
 * Used as a write-guard before inserting cross-DB references into brain.db.
 *
 * @param sessionId - Session ID to verify
 * @param tasksDb - The tasks.db drizzle instance
 * @returns True if the session exists in tasks.db
 *
 * @example
 * ```ts
 * if (await sessionExistsInTasksDb('ses_abc', db)) { /* safe to reference *\/ }
 * ```
 */
export declare function sessionExistsInTasksDb(sessionId: string, tasksDb: Awaited<ReturnType<typeof import('./sqlite.js').getDb>>): Promise<boolean>;
//# sourceMappingURL=cross-db-cleanup.d.ts.map