Skip to content

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

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

feat: add #bm:links_to directive for ambiguous relations#1306
mikemikimike wants to merge 8 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 7 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>
…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>
@mikemikimike
mikemikimike force-pushed the fix/1301-links-to-directive-v2 branch from f1fdcd0 to f57ea66 Compare August 24, 2026 02:40
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