thedotmack/claude-mem · warning

Native Codex hooks registered, but failed to disable legac

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 warning to the AGENTS.md cleanup: `cleanupLegacyCodexTranscriptAgentsContext` failed to disable the legacy transcript AGENTS.md context in CODEX_TRANSCRIPT_WATCH_CONFIG_PATH, so a legacy watcher may still inject context even though native hooks are registered and active.

Source

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

    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. Restart any running Codex sessions so native hooks are loaded

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

View on GitHub (pinned to e2d1df569a)

Solutions

  1. Open the transcript watch config named in the warning (CODEX_TRANSCRIPT_WATCH_CONFIG_PATH) and disable the AGENTS.md watcher entry manually.
  2. Fix permissions on the file and re-run install.
  3. Verify afterwards that only native hooks inject context.
Defensive patterns

Strategy: fallback

Validate before calling

import { readFileSync, existsSync } from 'node:fs';

const watchConfig = `${process.env.HOME}/.codex/config.toml`; // CODEX_TRANSCRIPT_WATCH_CONFIG_PATH
const legacyWatcherActive = existsSync(watchConfig) && /transcript|agents/i.test(readFileSync(watchConfig, 'utf8'));

Prevention

When it happens

Trigger: The transcript-watch config file exists and the installer cannot parse or rewrite it to disable the legacy watcher (permissions, unexpected format, concurrent write), so the function returns false.

Common situations: Hand-edited or permission-restricted watch config, config format changed by another tool.

Related errors


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