{"record":{"id":"3fdcddc9a97793a6","repo":"thedotmack/claude-mem","slug":"native-codex-hooks-registered-but-failed-to-dis","errorCode":null,"errorMessage":"  Native Codex hooks registered, but failed to disable legacy transcript AGENTS.md context in ${CODEX_TRANSCRIPT_WATCH_CONFIG_PATH}.","messagePattern":"  Native Codex hooks registered, but failed to disable legacy transcript AGENTS\\.md context in (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/services/integrations/CodexCliInstaller.ts","lineNumber":513,"sourceCode":"    console.error(`\\nInstallation failed: ${message}`);\n    return 1;\n  }\n}\n\nfunction performCodexInstall(marketplaceRootOverride?: string): number {\n  assertCodexMarketplaceSupported();\n  const marketplaceRoot = resolvePluginMarketplaceRoot(marketplaceRootOverride);\n\n  console.log(`  Registering Codex plugin marketplace: ${marketplaceRoot}`);\n  registerCodexMarketplace(marketplaceRoot);\n  enableCodexPluginConfig();\n  runCodex(['plugin', 'add', CODEX_PLUGIN_ID]);\n  console.log('  Installed Codex plugin cache.');\n  if (!cleanupLegacyCodexAgentsMdContext()) {\n    console.warn(`  Native Codex hooks registered, but failed to remove legacy AGENTS.md context from ${CODEX_AGENTS_MD_PATH}.`);\n  }\n  if (!cleanupLegacyCodexTranscriptAgentsContext()) {\n    console.warn(`  Native Codex hooks registered, but failed to disable legacy transcript AGENTS.md context in ${CODEX_TRANSCRIPT_WATCH_CONFIG_PATH}.`);\n  }\n\n  console.log(`\nInstallation complete!\n\nCodex marketplace: ${MARKETPLACE_NAME}\nPlugin source:     ${marketplaceRoot}\n\nNext steps:\n  1. Open Codex CLI in your project\n  2. Review and trust the five claude-mem hooks when Codex prompts you\n  3. Restart sessions opened before trusting the hooks\n\nFor a fresh setup, the supported entry point is:\n  npx claude-mem@latest install\n`);\n  return 0;\n}","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/services/integrations/CodexCliInstaller.ts#L495-L531","documentation":"Companion to the AGENTS.md cleanup: performCodexInstall also calls cleanupLegacyCodexTranscriptAgentsContext to disable the legacy transcript-based AGENTS.md context in the Codex transcript watch config (CODEX_TRANSCRIPT_WATCH_CONFIG_PATH). A false return means that config could not be updated; native hooks work, but legacy transcript context may remain enabled and conflict or duplicate.","triggerScenarios":"cleanupLegacyCodexTranscriptAgentsContext() returns false during performCodexInstall — the TOML config file is missing/unparseable, the expected table/key is absent, or writing the file fails.","commonSituations":"User's Codex config was regenerated by a newer Codex CLI; config is hand-edited and markers/keys changed; read-only config directory; partial uninstall from an older version.","solutions":["Inspect CODEX_TRANSCRIPT_WATCH_CONFIG_PATH and manually disable the legacy transcript AGENTS.md context setting, then re-run the installer","Back up the config and restore a known-good one (or delete it so the installer can recreate defaults)","Check write permissions on the Codex config file/directory","Ignore if you deliberately keep transcript-based context and want native hooks only for triggering"],"exampleFix":"// before: legacy key still enabled in codex config\n[transcript_watch]\nagents_md_context = true\n// after: disable legacy context\n[transcript_watch]\nagents_md_context = false","handlingStrategy":"fallback","validationCode":"import { accessSync, constants } from 'fs';\ntry { accessSync(CODEX_TRANSCRIPT_WATCH_CONFIG_PATH, constants.W_OK); } catch { console.warn('Codex config not writable; legacy transcript cleanup will fail'); }","typeGuard":null,"tryCatchPattern":"if (!cleanupLegacyCodexTranscriptAgentsContext()) {\n  console.warn(`Manually disable legacy transcript agents context in ${CODEX_TRANSCRIPT_WATCH_CONFIG_PATH}.`);\n}","preventionTips":["Do not regenerate/hand-edit the Codex config between install steps","Keep the Codex config file and its directory writable","Back up CODEX_TRANSCRIPT_WATCH_CONFIG_PATH before upgrades","After install, verify the transcript watch setting is disabled"],"tags":["codex","cleanup","installer","config"],"backgroundTag":"file-write-failed","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}