Skip to content

pre-edit recall: a space, bracket, @ or other legal directory character inside a mentioned path still drops the memory #379

Done

Description

@kevintseng

What happens

Pre-edit recall accepts a path-style mention of the edited file only when the whole mentioned path equals the edited path or is a segment-aligned suffix of it. The mentioned path is collected by walking backwards from the file name while characters belong to PATH_TOKEN_CHAR (scripts/hooks/_shared.js). A character outside that class that is nevertheless legal inside a directory name cuts the walk short; the truncated token is a suffix of nothing, the memory that names the exact file is not recalled, and the run is recorded as "nothing to recall". #358 fixed this for ~. The rest of the family is still open — none of it introduced by #358.

Measured with containsFileNameLiterally(text, 'CLAUDE.md', editedPath) where the text names the edited file by its absolute path; every row returns false:

character where it occurs
space C:\Users\John Smith\, Program Files, macOS ~/Library/Mobile Documents/, Application Support
( ) Program Files (x86), Button (copy)
[ ] Next.js app router: app/[slug]/page.tsx
@ node_modules/@scope/pkg
' & , + # $ % = ! ; ^ { } KT's Files, R&D, Smith, John, c++lib, …
a letter outside the Basic Multilingual Plane 𠮟dir — the walk tests one UTF-16 code unit at a time, and half a surrogate pair is not a letter

Worked example: /Users/kt/Library/Mobile Documents/com~apple~CloudDocs/p/CLAUDE.md is still not recalled after the ~ fix, because the space upstream truncates first.

Only path-shaped mentions are lost; a bare mention of the file name still confirms.

Why this is two problems, not one

Every character added to PATH_TOKEN_CHAR stops being a delimiter in front of a mention.

  • Can probably join the class, low delimiter risk: @, +, =, %, $. @ alone covers every scoped npm package path.
  • Cannot join the class: space, quotes, parentheses, brackets, comma, semicolon. They are the delimiters the walk relies on (See docs/CLAUDE.md before editing, [text](docs/CLAUDE.md), 'docs/CLAUDE.md'). These are also the most common cases. They need a different mechanism, and the obvious one — retrying shorter segment-aligned suffixes of the walked token — would re-admit the false positive pre-edit recall injects unrelated auto-captured memories and hides the relevant ones (basename token match + cwd project scope) #358 removed (NOTES/docs/CLAUDE.md would shrink to docs/CLAUDE.md and confirm an edit to a different file). That trade has to be decided, not assumed.

Also

  • docs/ARCHITECTURE.md says the path-token scan covers "letters, marks and digits from any script". That is true inside the Basic Multilingual Plane only. Either say so or walk by code point.
  • None of the limits above is listed among the documented false negatives in docs/ARCHITECTURE.md.

Activity

  1. kevintseng commented on Sep 26, 2026

    @kevintseng
    CollaboratorAuthor

    Decision (owner, 2026-09-26): add @ + = % $ to PATH_TOKEN_CHAR now; @ alone covers scoped npm package paths. Space, quotes, parentheses, brackets, comma and semicolon wait for a mechanism that cannot re-admit the #358 false positive. docs/ARCHITECTURE.md lists the remaining false negatives and the Basic-Multilingual-Plane limit.

  2. kevintseng commented on Dec 2, 2026

    @kevintseng
    CollaboratorAuthor

    Path matching covers the five agreed punctuation characters while retaining the cross-directory checks. Verified on the open PR #650.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions