Skip to content

[FEATURE] Disable permalinks via config flag #307

Closed

Description

@phernandez

Feature Description

Add a config flag to disable permalinks for notes.

  • if the config flag is on, then Basic Memory will not try to write permalinks in notes when creating them via the api or during sync
  • Any notes that contain permalinks in the frontmatter already will still work (via read_note, etc)

Problem This Feature Solves

  • Some users do not want, need, or understand permalinks. Removing them from the system will make it easier to use
  • Adding permalinks during a sync changes the modified time of the file, which may not be what users want

Activity

  1. added
    enhancement
    on Sep 23, 2025
  2. phernandez commented on Sep 26, 2025

    @phernandez
    MemberAuthor

    @claude how feasible is adding a flag to disable permalinks?

  3. claude commented on Sep 26, 2025

    @claude
    Contributor

    Claude finished @phernandez's task —— View job


    Feasibility Assessment for Disabling Permalinks

    Todo List:

    • Search for permalink-related code in the codebase
    • Understand current permalink implementation
    • Identify where permalinks are created/written
    • Assess configuration system and where flag would be added
    • Provide feasibility assessment

    Assessment Result

    Adding a flag to disable permalinks is highly feasible and relatively straightforward. Here's my analysis:

    Current Implementation

    Permalinks are written to files in these situations:

    1. During sync (sync_service.py:304-310): When a file with frontmatter is synced and the permalink changes or needs to be resolved
    2. During API entity creation (via entity_service.create_or_update_entity() called from knowledge_router.py)
    3. During MCP tool operations (when write_note is used)

    Implementation Approach

    The change would involve:

    1. Add config flag in src/basic_memory/config.py:

      disable_permalinks: bool = Field(
          default=False,
          description="Disable automatic permalink generation in frontmatter"
      )
    2. Modify permalink writing logic in 3 key places:

      • sync_service.py:304-310: Skip the permalink update if flag is set
      • entity_service.py: Skip adding permalink to frontmatter when creating/updating entities
      • file_service.update_frontmatter(): Conditionally skip permalink updates
    3. Preserve existing functionality: The resolve_permalink() and read operations would still work with existing permalinks

    Complexity: Low to Medium

    Why it's straightforward:

    • Configuration system already supports feature flags (e.g., update_permalinks_on_move, sync_changes, kebab_filenames)
    • Permalink writing is centralized in a few specific locations
    • The change is additive (new flag) with minimal risk to existing functionality
    • Existing permalinks would continue to work for read operations

    Implementation estimate:

    • ~50-100 lines of code changes
    • Main changes in 3-4 files
    • Test updates needed for the new flag behavior

    The feature aligns well with the existing configuration patterns and would provide the flexibility users are asking for without breaking existing functionality.

  4. phernandez commented on Sep 26, 2025

    @phernandez
    MemberAuthor

    @claude implement a PR with the change

    • make sure relation formatting is preserved
    • add unit tests
    • add an integration test in test-int
  5. claude commented on Sep 26, 2025

    @claude
    Contributor

    Claude encountered an error —— View job


    I'll analyze this and get back to you.

  6. claude commented on Sep 26, 2025

    @claude
    Contributor

    Claude finished @phernandez's task —— View job • claude/issue-307-20250926-1513 • Create PR ➔


    Implementation Plan

    Todo List:

    • Read CLAUDE.md and understand repo guidelines
    • Install dependencies and setup environment (skipped - no permissions)
    • Add config flag to disable permalinks
    • Update sync_service.py to respect the flag
    • Update entity_service.py to respect the flag
    • Update file_service.py if needed (no changes needed)
    • Verify relation formatting is preserved (relations handled separately)
    • Write unit tests for the new feature
    • Write integration test in test-int
    • Run code quality checks (skipped - no run permissions)
    • Commit and push changes
    • Provide PR creation link

    Summary

    Successfully implemented the disable_permalinks configuration flag with the following changes:

    1. Configuration

    • Added disable_permalinks: bool field to BasicMemoryConfig (defaults to False)
    • Field includes clear description of behavior

    2. Core Service Updates

    • sync_service.py: Checks flag before resolving/updating permalinks during sync and move operations
    • entity_service.py: Accepts app_config parameter and skips permalink generation when flag is enabled
    • deps.py: Updated dependency injection to pass app_config to EntityService

    3. Behavior

    • When disable_permalinks=True:
      • New notes created via API or sync won't have permalinks added
      • Existing permalinks in notes remain unchanged (still work for reading)
      • Move operations won't update permalinks even if update_permalinks_on_move=True
    • Relations are preserved and continue to work normally

    4. Tests

    • Added unit tests for config flag behavior
    • Created comprehensive tests for entity service with permalinks disabled
    • Added integration tests for full workflow and move operations

    View job |

  7. added a commit that references this issue on Sep 26, 2025
    01ef9e4
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

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions