Skip to content

Match a memory index entry on the line's first link only - #437

Merged
ilovepixelart merged 1 commit into
mainfrom
fix/memory-entry-line
Nov 15, 2026
Merged

ilovepixelart merged 1 commit into
mainfrom
fix/memory-entry-line

Conversation

@ilovepixelart

Copy link
Copy Markdown
Owner

ENTRY_LINE in extensions/memory.ts matched an index entry's title with a lazy \[.*?\], which could extend past the first link on the line to a later ](name.md). A list line that starts with another link or a checkbox and mentions a memory file was treated as that memory's entry.

With this index:

- [docs](https://example.com/guide) relates to [b](b.md)
- [ ] todo: revisit [b](b.md) later
- [b](b.md): two
Action Before After
save b the docs line gets the new description, - [b](b.md): two stays only - [b](b.md): ... is rewritten
delete b all three lines are removed only - [b](b.md): two is removed

The title now accepts bracket pairs one level deep (- [Fix [WIP] thing](wip-thing.md) still matches) and cannot span a ](. A title with an unbalanced bracket or brackets nested two deep is no longer an entry.

The pattern runs in under 0.05 ms on 20,000-character adversarial lines.

  • npm run check passes (Biome, strict tsc, Vitest)
  • Tests cover the change

ENTRY_LINE matched its title with a lazy `\[.*?\]`, which could extend
past the first link on the line to a later `](name.md)`. A list line
starting with another link or a checkbox and mentioning a memory file
was therefore taken for that memory's entry.

With the index

    - [docs](https://example.com/guide) relates to [b](b.md)
    - [ ] todo: revisit [b](b.md) later
    - [b](b.md): two

saving `b` appended the description to the docs line and left
`- [b](b.md): two` unchanged, and deleting `b` removed all three lines.

The title now accepts bracket pairs but cannot span a `](`, so only the
link the list item starts with identifies the entry. Saving rewrites
only `- [b](b.md): ...` and deleting removes only that line.
@sonarqubecloud

Copy link
Copy Markdown

@ilovepixelart
ilovepixelart merged commit e560370 into main Nov 15, 2026
13 checks passed
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.

1 participant