Skip to content

refactor(core): clarify shared runtime package ownership and dependency direction #1096

Description

@phernandez

Summary

Give the shared local/cloud runtime code neutral, truthful ownership names and restore a dependency direction that readers can infer from package paths.

Why

The consolidation in #1002 intentionally moved portable orchestration into Basic Memory, but several current names now describe the code's origin rather than its actual ownership:

  • local Basic Memory imports shared mutation/materialization services from basic_memory.cloud;
  • Basic Memory Cloud imports LocalAcceptedNoteRepositories from basic_memory.index.local_notes;
  • Cloud also consumes symbols from modules named local_project and local_schedulers;
  • repository/accepted_note_search_repository.py imports its row value and vector-delete SQL behavior upward from indexing;
  • the runtime, index, and indexing split contains overlapping names and is difficult to navigate without prior history.

#1053 tracked much of this structure debt, but PR #1054 deliberately skipped the package-split decision. The remaining inversion is now visible in both repositories.

Proposed Direction

Sequence this as small behavior-preserving moves:

  1. Identify the note mutation, materialization, and repository pieces that are genuinely runtime-neutral.
  2. Move or rename those pieces under neutral core ownership; use temporary compatibility exports only where needed for a coordinated cloud re-pin.
  3. Rename LocalAcceptedNoteRepositories to describe what it is: project-scoped core repositories using the caller's session.
  4. Move persistence DTOs and SQL helpers down so repositories and ORM models do not depend on orchestration packages.
  5. Document the intended dependency direction and decide how index versus indexing should be navigated before moving the wider package tree.

Do not replace the current layout with another layer of managers, registries, or adapter factories.

Out Of Scope

  • A single all-at-once module migration.
  • Runtime behavior changes.
  • Rewriting every protocol or indexing workflow.
  • Renaming public HTTP/MCP concepts.

Acceptance Criteria

  • Local Basic Memory no longer imports shared core note behavior from a package named cloud.
  • Basic Memory Cloud no longer imports shared core behavior through symbols named Local*.
  • Repository and model modules do not depend upward on orchestration for the targeted search/runtime values.
  • The chosen ownership and dependency direction is recorded in docs/ARCHITECTURE.md or docs/DOMAIN_MODEL.md.
  • Core and paired cloud checks pass at the coordinated revisions.

References

Activity

  1. added
    enhancement
    cloud
    python
    on Jul 18, 2026
  2. claude commented on Jul 18, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 2m 6s —— View job


    Triage complete

    • Read issue and repository guidelines
    • Classify type, priority, component, complexity
    • Check for duplicate issues
    • Apply labels
    • Post triage summary comment

    Type: Enhancement — architectural/structural refactor (no behavior change intended; explicitly scoped as "behavior-preserving moves").

    Priority: Medium — no user-facing breakage, security issue, or data loss. This is dependency-direction/ownership debt that makes the runtime/index/indexing/cloud split hard to navigate and risks further inversions if left unaddressed, but nothing is broken today.

    Component: Cloud + Core architecture. I verified the described inversions exist in this checkout: src/basic_memory/index/local_notes.py, local_project.py, and local_schedulers.py are all real modules, alongside the separate cloud, index, indexing, and runtime packages under src/basic_memory/. This confirms the issue accurately describes the current tree rather than stale context.

    Complexity: Complex — it's explicitly a multi-repo, multi-step effort (5 sequenced moves) requiring a coordinated re-pin between Basic Memory core and Basic Memory Cloud, plus an ARCHITECTURE.md/DOMAIN_MODEL.md documentation update and passing checks "at the coordinated revisions." Not something to land as a single PR.

    Duplicate check: This repo only exposes an --add-label script (no read/search access to issues in this environment), so I could not run gh search issues as instructed. Based on the issue body's own references, this is a deliberate follow-on to #1053/#1054 (which explicitly deferred the package-split decision this issue tracks) rather than a duplicate — no separate open issue appears to cover this dependency-direction cleanup.

    ⚠️ Label correction needed: While probing which labels exist in this repo's label set (the "Available Labels" list in my instructions doesn't match what's actually configured here — e.g. core, cli, mcp, refactor, complexity, priority labels don't exist), my batched test calls inadvertently applied bug, documentation, question, and duplicate to this issue, since the label-add script performs a real POST for any label that does exist rather than a dry-run check. I have no label-removal capability in this environment (only --add-label is wired up), so I can't undo this myself. Could a maintainer manually remove the bug, documentation, question, and duplicate labels from this issue? None of them apply — this is an enhancement/refactor proposal with a clear, well-formed spec. The correctly-applicable labels (enhancement, cloud, python) were already present before I touched anything.

    This issue is well-scoped with clear acceptance criteria and an explicit out-of-scope list; no clarification is needed from the author to begin planning implementation.

  3. added
    bug
    documentation
    duplicate
    question
    on Jul 18, 2026
  4. self-assigned this
    on Jul 18, 2026
  5. added this to the v0.23 milestone on Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugclouddocumentationduplicateenhancementpythonquestion

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions