thedotmack/claude-mem · warning

Native Codex hooks registered, but failed to disable legacy…

Error message

  Native Codex hooks registered, but failed to disable legacy transcript AGENTS.md context in ${CODEX_TRANSCRIPT_WATCH_CONFIG_PATH}.

What it means

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.

Solutions

  1. Inspect CODEX_TRANSCRIPT_WATCH_CONFIG_PATH and manually disable the legacy transcript AGENTS.md context setting, then re-run the installer
  2. Back up the config and restore a known-good one (or delete it so the installer can recreate defaults)
  3. Check write permissions on the Codex config file/directory
  4. Ignore if you deliberately keep transcript-based context and want native hooks only for triggering

Example fix

// before: legacy key still enabled in codex config
[transcript_watch]
agents_md_context = true
// after: disable legacy context
[transcript_watch]
agents_md_context = false
Defensive patterns

Strategy: fallback

Validate before calling

import { accessSync, constants } from 'fs';
try { accessSync(CODEX_TRANSCRIPT_WATCH_CONFIG_PATH, constants.W_OK); } catch { console.warn('Codex config not writable; legacy transcript cleanup will fail'); }

Try / catch

if (!cleanupLegacyCodexTranscriptAgentsContext()) {
  console.warn(`Manually disable legacy transcript agents context in ${CODEX_TRANSCRIPT_WATCH_CONFIG_PATH}.`);
}

Prevention

When it happens

Trigger: cleanupLegacyCodexTranscriptAgentsContext() returns false during performCodexInstall — the TOML config file is missing/unparseable, the expected table/key is absent, or writing the file fails.

Common situations: 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.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/3fdcddc9a97793a6. Report an issue: GitHub.

Appendix: source

Thrown at src/services/integrations/CodexCliInstaller.ts:513

    console.error(`\nInstallation failed: ${message}`);
    return 1;
  }
}

function performCodexInstall(marketplaceRootOverride?: string): number {
  assertCodexMarketplaceSupported();
  const marketplaceRoot = resolvePluginMarketplaceRoot(marketplaceRootOverride);

  console.log(`  Registering Codex plugin marketplace: ${marketplaceRoot}`);
  registerCodexMarketplace(marketplaceRoot);
  enableCodexPluginConfig();
  runCodex(['plugin', 'add', CODEX_PLUGIN_ID]);
  console.log('  Installed Codex plugin cache.');
  if (!cleanupLegacyCodexAgentsMdContext()) {
    console.warn(`  Native Codex hooks registered, but failed to remove legacy AGENTS.md context from ${CODEX_AGENTS_MD_PATH}.`);
  }
  if (!cleanupLegacyCodexTranscriptAgentsContext()) {
    console.warn(`  Native Codex hooks registered, but failed to disable legacy transcript AGENTS.md context in ${CODEX_TRANSCRIPT_WATCH_CONFIG_PATH}.`);
  }

  console.log(`
Installation complete!

Codex marketplace: ${MARKETPLACE_NAME}
Plugin source:     ${marketplaceRoot}

Next steps:
  1. Open Codex CLI in your project
  2. Review and trust the five claude-mem hooks when Codex prompts you
  3. Restart sessions opened before trusting the hooks

For a fresh setup, the supported entry point is:
  npx claude-mem@latest install
`);
  return 0;
}

View on GitHub (pinned to d8bc9755e7)