/**
 * STDP (Spike-Timing-Dependent Plasticity) for CLEO BRAIN.
 *
 * Implements a biologically-inspired Hebbian learning rule that modulates edge
 * weights based on the *temporal order* of memory retrievals within a session
 * window, not just co-occurrence frequency.
 *
 * ## Neuroscience basis
 *
 * Classical STDP: if neuron A fires before neuron B by Δt milliseconds, the
 * synapse A→B is potentiated (LTP); if A fires after B, it is depressed (LTD).
 * The magnitude of the change decays exponentially with |Δt|.
 *
 * ## Mapping to CLEO memory
 *
 * - Each entry retrieved from brain.db is a "spike".
 * - Retrievals within the same session and within `sessionWindowMs` of each
 *   other are treated as temporally related spikes.
 * - If entry A was retrieved BEFORE entry B by Δt ms:
 *     Δw = A_pre  × exp(−Δt / τ_pre)   → potentiation (LTP, positive Δw)
 * - If entry A was retrieved AFTER entry B by Δt ms:
 *     Δw = −A_post × exp(−Δt / τ_post)  → depression  (LTD, negative Δw)
 * - Weights are clamped to [0.0, 1.0].
 * - All events are logged to `brain_plasticity_events` for observability.
 *
 * ## Parameters (biologically reasonable defaults)
 *
 * | Symbol  | Value  | Meaning                                          |
 * |---------|--------|--------------------------------------------------|
 * | τ_pre   | 20 s   | Time constant for pre→post potentiation          |
 * | τ_post  | 20 s   | Time constant for post→pre depression            |
 * | A_pre   | 0.05   | Peak potentiation amplitude                      |
 * | A_post  | 0.06   | Peak depression amplitude (asymmetric, per STDP) |
 *
 * The asymmetry A_post > A_pre models the biological fact that LTD is slightly
 * stronger than LTP, preventing runaway weight growth.
 *
 * ## Relation to Hebbian co-retrieval
 *
 * Hebbian (`strengthenCoRetrievedEdges` in brain-lifecycle.ts) uses the
 * `co_retrieved` edge type and does NOT track order; it fires on pairs that
 * co-occur ≥ 3× regardless of timing. STDP is a *second plasticity pass* that
 * runs after Hebbian and refines existing `co_retrieved` edges using order data.
 *
 * If no `co_retrieved` edge exists yet between a pair, STDP inserts one with the
 * initial STDP-derived weight (potentiation pairs only — LTD does not create
 * new edges, only weakens existing ones).
 *
 * @task T626
 * @epic T626
 * @see packages/core/src/memory/brain-lifecycle.ts#strengthenCoRetrievedEdges
 */
/** Result returned by `applyStdpPlasticity`. */
export interface StdpPlasticityResult {
    /** Number of LTP (potentiation) events applied. */
    ltpEvents: number;
    /** Number of LTD (depression) events applied. */
    ltdEvents: number;
    /** Number of new edges inserted (LTP on pairs without an existing edge). */
    edgesCreated: number;
    /** Number of retrieval pairs examined. */
    pairsExamined: number;
}
/** Summary row from `getPlasticityStats`. */
export interface PlasticityStatsSummary {
    /** Total number of plasticity events ever recorded. */
    totalEvents: number;
    /** Count of LTP events. */
    ltpCount: number;
    /** Count of LTD events. */
    ltdCount: number;
    /** Net weight delta summed across all events (positive = net strengthening). */
    netDeltaW: number;
    /** Most recent event timestamp (ISO 8601), or null if no events. */
    lastEventAt: string | null;
    /** Recent events (up to `limit`, newest first). */
    recentEvents: RecentPlasticityEvent[];
}
/** A single recent plasticity event for display. */
export interface RecentPlasticityEvent {
    /** Auto-increment event ID. */
    id: number;
    /** Source node identifier. */
    sourceNode: string;
    /** Target node identifier. */
    targetNode: string;
    /** Signed weight delta. */
    deltaW: number;
    /** 'ltp' or 'ltd'. */
    kind: 'ltp' | 'ltd';
    /** ISO 8601 timestamp. */
    timestamp: string;
    /** Session ID, if available. */
    sessionId: string | null;
}
/**
 * Apply Spike-Timing-Dependent Plasticity to brain_page_edges.
 *
 * Reads `brain_retrieval_log` for rows within the past `sessionWindowMs`
 * milliseconds, reconstructs the temporal spike sequence per session, and
 * applies the STDP rule to every ordered pair within the window.
 *
 * All weight changes are logged to `brain_plasticity_events` for
 * observability and `cleo brain plasticity stats` reporting.
 *
 * @param projectRoot - Project root directory for brain.db resolution
 * @param sessionWindowMs - Time window (ms) to consider retrievals as
 *   temporally related. Defaults to 5 minutes.
 * @returns Counts of LTP/LTD events applied and edges created/updated.
 */
export declare function applyStdpPlasticity(projectRoot: string, sessionWindowMs?: number): Promise<StdpPlasticityResult>;
/**
 * Retrieve a summary of recent STDP plasticity events from `brain_plasticity_events`.
 *
 * Used by `cleo brain plasticity stats`.
 *
 * @param projectRoot - Project root directory for brain.db resolution
 * @param limit - Maximum number of recent events to include. Defaults to 20.
 * @returns Aggregated plasticity statistics and the most recent events.
 */
export declare function getPlasticityStats(projectRoot: string, limit?: number): Promise<PlasticityStatsSummary>;
//# sourceMappingURL=brain-stdp.d.ts.map