()
| 356 | * The gate check and config loading happen lazily when the hook runs. |
| 357 | */ |
| 358 | export function initSessionMemory(): void { |
| 359 | if (getIsRemoteMode()) return |
| 360 | // Session memory is used for compaction, so respect auto-compact settings |
| 361 | const autoCompactEnabled = isAutoCompactEnabled() |
| 362 | |
| 363 | // Log initialization state (ant-only to avoid noise in external logs) |
| 364 | if (isInternalBuild()) { |
| 365 | logEvent('ncode_session_memory_init', { |
| 366 | auto_compact_enabled: autoCompactEnabled, |
| 367 | }) |
| 368 | } |
| 369 | |
| 370 | if (!autoCompactEnabled) { |
| 371 | return |
| 372 | } |
| 373 | |
| 374 | // Register hook unconditionally - gate check happens lazily when hook runs |
| 375 | registerPostSamplingHook(extractSessionMemory) |
| 376 | } |
| 377 | |
| 378 | export type ManualExtractionResult = { |
| 379 | success: boolean |
no test coverage detected