Skip to content

docs(roadmap): add #459 — memory file discovery hardcoded to CLAUDE.md; AGENTS.md/CLAW.md/.claude/CLAUDE.md/case variants silently ignored; memory_files[] not exposed#3072

Open
Yeachan-Heo wants to merge 1 commit into
mainfrom
docs/roadmap-459-memory-file-discovery-hardcoded-claude-only
Open

docs(roadmap): add #459 — memory file discovery hardcoded to CLAUDE.md; AGENTS.md/CLAW.md/.claude/CLAUDE.md/case variants silently ignored; memory_files[] not exposed#3072
Yeachan-Heo wants to merge 1 commit into
mainfrom
docs/roadmap-459-memory-file-discovery-hardcoded-claude-only

Conversation

@Yeachan-Heo
Copy link
Copy Markdown
Contributor

ROADMAP pinpoint #459 — memory file discovery is hardcoded to 4 literal names with no case-folding, no cross-tool aliases, and no memory_files[] structured field

Dogfooded for the 2026-05-24 10:00 Clawhip pinpoint nudge (message 1508046936177901639).

Discovery matrix (clean isolated env)

File memory_file_count
CLAUDE.md 1
CLAUDE.local.md 1
.claw/CLAUDE.md 1
.claw/instructions.md 1
claude.md (lowercase) 0 ❌
Claude.md (mixed case) 0 ❌
CLAUDE.MD (uppercase ext) 0 ❌
CLAW.md (the product's own name) 0 ❌
claw.md 0 ❌
AGENTS.md (Codex / OpenAI Agents / Copilot Agents standard) 0 ❌
agents.md 0 ❌
AGENT.md (singular) 0 ❌
GEMINI.md 0 ❌
CONTEXT.md 0 ❌
memory.md 0 ❌
.claude/CLAUDE.md (Claude Code documented subdir) 0 ❌

Root cause (traced)

rust/crates/runtime/src/prompt.rs:203-223:

fn discover_instruction_files(cwd: &Path) -> std::io::Result<Vec<ContextFile>> {
    // … ancestor walk …
    for dir in directories {
        for candidate in [
            dir.join("CLAUDE.md"),
            dir.join("CLAUDE.local.md"),
            dir.join(".claw").join("CLAUDE.md"),
            dir.join(".claw").join("instructions.md"),
        ] {
            push_context_file(&mut files, candidate)?;
        }
    }
    Ok(dedupe_instruction_files(files))
}

Four hardcoded literal PathBuf::join calls. No case-folding, no cross-tool aliases, no .claude/CLAUDE.md (the official Claude Code documented subdir per docs.anthropic.com/en/docs/claude-code/memory).

Status JSON drops the path list: StatusContext { …, memory_file_count: project_context.instruction_files.len(), … } keeps only the count. The original Vec<ContextFile> with full paths and content is discarded before reaching the JSON envelope.

Why distinct from existing items

ROADMAP mentions AGENTS.md 5 times (#215, #216, #225, #231, etc.) but only as a config-mutation target ("installer changes AGENTS.md", "AGENTS.md orchestration brain is loaded automatically" — installer/onboarding noise, not the runtime memory loader). Nothing in ROADMAP documents that claw-code does not actually read AGENTS.md as a memory file at runtime.

#84 covers the dump-manifests repo root: /Users/... build-host leak — a different name-identity bug. #1756 mentions ancestor CLAUDE.md for worker safety — different concern. No entry documents the discovery name set or the .claude/CLAUDE.md blind spot.

Why it matters

  1. Cross-tool migration silently breaks. A user with an existing AGENTS.md workflow installs claw, runs it in their existing project, status reports memory_file_count: 0. No warning that AGENTS.md was found-but-ignored, no doctor check, no hint. Silent zero context.
  2. Product-name divergence. Binary is called claw. Discovered file is CLAUDE.md. A user typing CLAW.md (matching the tool they invoked) gets silently zero memory.
  3. Claude Code documented subdir location ignored. .claude/CLAUDE.md is the Claude Code documented memory-file location. claw-code (which advertises Claude Code parity throughout) does not read it.
  4. Case-sensitivity is OS-leaky. macOS HFS+/APFS case-insensitive → claude.md happens to work. Linux/Windows case-sensitive → claude.md invisible. Cross-platform users get different memory behavior from the same repo layout.
  5. memory_file_count: 0 with no memory_files: [] field means a claw cannot debug "why is my memory not loading?" without re-implementing the discovery walk.

Required fix shape (full detail in ROADMAP entry)

(a) Extend discovery name set: CLAUDE.md, CLAUDE.local.md, CLAW.md, CLAW.local.md, AGENTS.md, AGENTS.local.md, plus .claude/CLAUDE.md and .claw/CLAUDE.md. Optional user-configurable extras via .claw.json memory.discoveryNames: [...]. (b) Case-fold the comparison on case-sensitive filesystems. (c) Expose workspace.memory_files: [{path, source, bytes}] in status JSON. (d) Add a doctor check that lists discovered files AND files found-but-skipped because of a non-discovered name. (e) Update README/--help to document the discovery name set. (f) Regression coverage for each row in the matrix above.

Acceptance check (one-liner)

for n in CLAUDE.md CLAW.md AGENTS.md .claude/CLAUDE.md; do
  mkdir -p $(dirname /tmp/cmp/$n); echo test > /tmp/cmp/$n
  ( cd /tmp/cmp && claw status --output-format json | \
    jq -e --arg path "/tmp/cmp/$n" '.workspace.memory_files | map(.path) | index($path)' ) \
    || echo "MISS: $n"
  rm /tmp/cmp/$n
done

Should print no MISS lines.


[repo owner's gaebal-gajae (clawdbot) 🦞]

…d; AGENTS.md, CLAW.md, .claude/CLAUDE.md, case variants all silently ignored; memory_files[] not exposed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants