Skip to content

feat: add #bm:links_to directive for ambiguous relations - #1306

Closed
mikemikimike wants to merge 10 commits into
basicmachines-co:mainfrom
mikemikimike:fix/1301-links-to-directive-v2
Closed

feat: add #bm:links_to directive for ambiguous relations#1306
mikemikimike wants to merge 10 commits into
basicmachines-co:mainfrom
mikemikimike:fix/1301-links-to-directive-v2

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

Summary

Implementation

The markdown relation plugin strips only the exact terminal directive before inline wikilink parsing. Such lines emit links_to for every wikilink; explicit relation syntax and non-terminal lookalikes remain unchanged.

Tests

  • python -m pytest -p no:cov -o addopts='' --confcutdir=tests/markdown -q tests/markdown/test_relation_edge_cases.py tests/markdown/test_markdown_plugins.py (24 passed)
  • python -m ruff check src/basic_memory/markdown/plugins.py tests/markdown/test_relation_edge_cases.py (passed)

The repository-wide test suite and full just check were not run because the local dependency bootstrap was incomplete and the GitHub transport was unstable; the focused parser tests and Ruff check ran successfully.

@phernandez

Copy link
Copy Markdown
Member

hi @mikemikimike thanks for the PR. Would you mind doing

git rebase HEAD~3 --signoff

and force pushing to the branch again? We require commits to be signed off (-s) for our DCO.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69783a0be6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# those bracket prefixes stay ordinary content (issue #1219).
_TIMESTAMP_VALUE = r"\d{1,3}:\d{2}(?::\d{2})?(?:[.,]\d{1,3})?"
_TIMESTAMP_CATEGORY = re.compile(rf"^{_TIMESTAMP_VALUE}(?:\s+-\s+{_TIMESTAMP_VALUE})?$")
_LINKS_TO_DIRECTIVE = re.compile(r"\s+#bm:links_to\s*$")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the new relation directive

This introduces the only way to disambiguate a single-token prose prefix such as Mother [[Alice]], but neither the canonical docs/NOTE-FORMAT.md relation reference nor the write_note tool description mentions #bm:links_to. Those user-facing surfaces still state that any single token before [[ becomes a relation type, so users and tool-calling models cannot discover the new escape hatch and will continue producing unintended typed relations.

Useful? React with 👍 / 👎.

@mikemikimike
mikemikimike force-pushed the fix/1301-links-to-directive-v2 branch 3 times, most recently from 04d6c9d to f1fdcd0 Compare August 24, 2026 02:38
mikemikimike and others added 6 commits August 24, 2026 10:40
Signed-off-by: Mike Mikemikike <mikemikimike@users.noreply.github.com>
Signed-off-by: mikemikimike <13286568797@163.com>

Signed-off-by: mikemikimike <13286568797@163.com>
Add regression coverage for preserving the directive in source and excluding it from observation semantics.

Signed-off-by: Mike Mikemikike <mikemikimike@users.noreply.github.com>
Signed-off-by: mikemikimike <13286568797@163.com>

Signed-off-by: mikemikimike <13286568797@163.com>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: mikemikimike <13286568797@163.com>
…icmachines-co#1309)

Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: mikemikimike <13286568797@163.com>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: mikemikimike <13286568797@163.com>
Signed-off-by: mikemikimike <13286568797@163.com>
phernandez and others added 4 commits August 25, 2026 14:09
…cmachines-co#1310)

Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: mikemikimike <13286568797@163.com>
Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: mikemikimike <13286568797@163.com>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: mikemikimike <13286568797@163.com>
…asicmachines-co#1313)

Signed-off-by: phernandez <paul@basicmachines.co>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: mikemikimike <13286568797@163.com>
@mikemikimike
mikemikimike force-pushed the fix/1301-links-to-directive-v2 branch from d55de46 to 42b4faf Compare August 25, 2026 06:10
@phernandez

Copy link
Copy Markdown
Member

Closing as landed: the feature is on main as 29a98ac / e05e62f / 295124b with your commits and authorship intact — it was bundled into the v0.23.1 fast-follow branch before this PR could be merged directly (the only delta vs this branch is a ruff line-wrap in one test assert). #bm:links_to ships in v0.23.1, releasing today, credited to you. Thanks for the clean design — directive stripped from indexed content while preserved in source is exactly right.

@phernandez phernandez closed this Aug 25, 2026
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.

Add a #bm:links_to directive for ambiguous relation-shaped bullets

2 participants