Skip to content

bug: regression — init --codex writes RTK.md instead of CONTEXTCRAWLER.md (incomplete rebrand) #19

Description

@thehoff

Summary

contextcrawler init -g --codex writes the slim instructions to ~/.codex/RTK.md instead of ~/.codex/CONTEXTCRAWLER.md, and adds an @/Users/thehoff/.codex/RTK.md reference to AGENTS.md without removing the pre-existing @/Users/thehoff/.codex/CONTEXTCRAWLER.md reference from an earlier install — leaving two duplicate imports and a stale orphan file.

Root cause

Commit bcddd06 (fix(hooks): rename hardcoded "rtk hook" commands + RTK.md deployment) flipped the constant in src/hooks/init.rs from "CONTEXTCRAWLER.md" back to "RTK.md":

// Current (regressed):
const RTK_MD: &str = "RTK.md";
const RTK_MD_REF: &str = "@RTK.md";

The downstream-fork rebrand to ContextCrawler had explicitly changed these to CONTEXTCRAWLER.md / @CONTEXTCRAWLER.md so the on-disk file name matches the tool name. The rebase from upstream rtk-ai/rtk brought back the upstream constants and the rebrand sweep (c0349b2, 540413e) missed them.

Reproduction

  1. Run an older contextcrawler that wrote CONTEXTCRAWLER.md and patched AGENTS.md with @CONTEXTCRAWLER.md
  2. Upgrade to current develop
  3. Run contextcrawler init -g --codex
  4. Observe:
    • ~/.codex/RTK.md is created (new)
    • ~/.codex/CONTEXTCRAWLER.md still exists with its old content (orphan)
    • ~/.codex/AGENTS.md now has both @CONTEXTCRAWLER.md AND @RTK.md references

Fix

Two parts:

  1. Restore the constants in src/hooks/init.rs:

    const RTK_MD: &str = "CONTEXTCRAWLER.md";
    const RTK_MD_REF: &str = "@CONTEXTCRAWLER.md";
  2. Add a legacy-cleanup step in run_codex_mode_with_paths(): if RTK.md exists alongside the canonical CONTEXTCRAWLER.md location AND/OR @RTK.md appears in AGENTS.md, remove the orphan file and strip the stale reference. Print a one-line note so users see what was cleaned.

  3. Regression test that pins the constant:

    #[test]
    fn test_rtk_md_constant_pinned_to_contextcrawler_filename() {
        // The downstream rebrand requires this file to be named
        // CONTEXTCRAWLER.md so it matches the tool name on disk.
        // If you're changing this, you're probably re-introducing
        // the regression from bcddd06. See issue #N.
        assert_eq!(RTK_MD, "CONTEXTCRAWLER.md");
        assert_eq!(RTK_MD_REF, "@CONTEXTCRAWLER.md");
    }

The pinned-constant test means a future rebase will fail the test suite if it re-introduces the regression instead of landing silently.

Scope

  • 2 const lines in src/hooks/init.rs
  • Cleanup function + AGENTS.md migrator
  • 1 pinning test + 1 cleanup test
  • No upstream behavior changes

Test plan

  • cargo test --bin contextcrawler passes
  • Pinning test fails if a future change flips the constant back
  • Cleanup test fixture: pre-existing RTK.md + @RTK.md in AGENTS.md → after init, only CONTEXTCRAWLER.md exists, only @CONTEXTCRAWLER.md in AGENTS.md
  • Manual: run contextcrawler init -g --codex against an environment that has the stale RTK.md and confirm cleanup

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions