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
- Run an older contextcrawler that wrote
CONTEXTCRAWLER.md and patched AGENTS.md with @CONTEXTCRAWLER.md
- Upgrade to current develop
- Run
contextcrawler init -g --codex
- 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:
-
Restore the constants in src/hooks/init.rs:
const RTK_MD: &str = "CONTEXTCRAWLER.md";
const RTK_MD_REF: &str = "@CONTEXTCRAWLER.md";
-
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.
-
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
Summary
contextcrawler init -g --codexwrites the slim instructions to~/.codex/RTK.mdinstead of~/.codex/CONTEXTCRAWLER.md, and adds an@/Users/thehoff/.codex/RTK.mdreference toAGENTS.mdwithout removing the pre-existing@/Users/thehoff/.codex/CONTEXTCRAWLER.mdreference 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 insrc/hooks/init.rsfrom"CONTEXTCRAWLER.md"back to"RTK.md":The downstream-fork rebrand to ContextCrawler had explicitly changed these to
CONTEXTCRAWLER.md/@CONTEXTCRAWLER.mdso 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
CONTEXTCRAWLER.mdand patched AGENTS.md with@CONTEXTCRAWLER.mdcontextcrawler init -g --codex~/.codex/RTK.mdis created (new)~/.codex/CONTEXTCRAWLER.mdstill exists with its old content (orphan)~/.codex/AGENTS.mdnow has both@CONTEXTCRAWLER.mdAND@RTK.mdreferencesFix
Two parts:
Restore the constants in
src/hooks/init.rs:Add a legacy-cleanup step in
run_codex_mode_with_paths(): ifRTK.mdexists alongside the canonicalCONTEXTCRAWLER.mdlocation AND/OR@RTK.mdappears in AGENTS.md, remove the orphan file and strip the stale reference. Print a one-line note so users see what was cleaned.Regression test that pins the constant:
The pinned-constant test means a future rebase will fail the test suite if it re-introduces the regression instead of landing silently.
Scope
src/hooks/init.rsTest plan
cargo test --bin contextcrawlerpassesRTK.md+@RTK.mdin AGENTS.md → after init, onlyCONTEXTCRAWLER.mdexists, only@CONTEXTCRAWLER.mdin AGENTS.mdcontextcrawler init -g --codexagainst an environment that has the staleRTK.mdand confirm cleanup