Skip to content

claude-memory/session-flow/docs-hygiene: memory_dir/contract_dir config-value parsing is hand-rolled and copy-pasted across ≥4 files, not a shared helper #474

Description

@kyle-sexton

Lane

babysit (safe tier, /loop 15m /source-control:babysit-prs)

Triggering example

PR #469 (fix/420-retro-resolve-memory-dir): worker fixed a Codex P2 in plugins/session-flow/skills/retro/context/session.md — a hand-rolled sed-extract-then-strip-whitespace snippet for reading memory_dir out of .claude/topic-docs.yaml was collapsing interior whitespace in quoted values (".agent work".agentwork), not just trimming. Fixed with a trailing-only trim.

The fix immediately re-triggered a Codex re-review that found a second, same-class bug in the identical snippet: a # inside a quoted value is also mishandled (the hand-rolled parser has no comment-vs-value disambiguation). The worker correctly declined to patch this in place — because the exact same hand-rolled sed/bash parsing shape is copy-pasted, not shared, across at minimum:

Fixing the whitespace bug in one copy does not fix it in the other three; each will independently surface the same class of Codex finding (whitespace-in-value, hash-in-value, and likely YAML escape sequences) on its own PR, one at a time.

Observed vs expected

  • Observed: #419 and #420 (already filed, both open) treat this as "some consumers hardcode .work/ instead of resolving memory_dir" and point at noise-shapes.sh as the correct fleet precedent to copy. That framing undersells the actual gap: even the cited "correct" precedent is itself a hand-rolled, not-fully-robust scalar parser (doesn't yet handle #-in-value; likely doesn't handle YAML escapes either), and it is copy-pasted rather than shared, so any robustness fix made in response to one PR's Codex review never reaches the sibling copies.
  • Expected: a single shared helper (bash function or small script) that resolves a .claude/topic-docs.yaml key robustly — handling quoted/unquoted values, interior whitespace, # inside quotes, and YAML escapes — sourced or invoked identically everywhere memory_dir/contract_dir is read, so a robustness fix lands once and propagates. #419/#420 are the right first step (stop hardcoding .work/); this issue is the follow-on it doesn't yet cover (stop copy-pasting the parser itself).

Category

improvement

Note

Related to but distinct from #419 and #420 — those are "hardcoded default vs resolved value" bugs; this is "the resolution snippet itself is duplicated and insufficiently robust." Not filing as a duplicate; commenting cross-reference isn't appropriate since neither existing issue's acceptance criteria would cover extracting a shared helper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumReal value, no hard deadline; normal backlog flow.status: readyTriaged, unblocked, and fully specified; eligible to pick up.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions