()
| 28 | * 5. Default: enabled |
| 29 | */ |
| 30 | export function isAutoMemoryEnabled(): boolean { |
| 31 | const envVal = process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY |
| 32 | if (isEnvTruthy(envVal)) { |
| 33 | return false |
| 34 | } |
| 35 | if (isEnvDefinedFalsy(envVal)) { |
| 36 | return true |
| 37 | } |
| 38 | // --bare / SIMPLE: prompts.ts already drops the memory section from the |
| 39 | // system prompt via its SIMPLE early-return; this gate stops the other half |
| 40 | // (extractMemories turn-end fork, autoDream, /remember, /dream, team sync). |
| 41 | if (isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE)) { |
| 42 | return false |
| 43 | } |
| 44 | if ( |
| 45 | isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) && |
| 46 | !process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR |
| 47 | ) { |
| 48 | return false |
| 49 | } |
| 50 | const settings = getInitialSettings() |
| 51 | if (settings.autoMemoryEnabled !== undefined) { |
| 52 | return settings.autoMemoryEnabled |
| 53 | } |
| 54 | return true |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Whether the extract-memories background agent will run this session. |
no test coverage detected