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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcloudBasic Memory ClouddocumentationImprovements or additions to documentationduplicateThis issue or pull request already existsenhancementNew feature or requestpythonPull requests that update python codequestionFurther information is requested

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions