Skip to content

ADR 0008 hierarchical memory scoping

Pedro Gomes Branquinho edited this page Feb 15, 2026 · 1 revision

ADR 0008: Hierarchical Memory Scoping

Status: Implemented Date: 2026-02-04 Memory ID: 20260204191624-14925ea2

Context

The hive monorepo contains multiple subprojects. We need:

  • Parents see children's memories (downward visibility)
  • Children isolated from parents (upward isolation)

Decision

Configuration Cascade (local precedence)

~/.config/hive.edn              # Global defaults
~/project/.hive-project.edn     # Project overrides
~/project/sub/.hive-project.edn # Submodule overrides (highest)

Memory Visibility (asymmetric scoping)

hive-mcp/                    # Sees all below
├── hive-connectors/         # Sees its children only
│   ├── slack/               # Isolated
│   └── github/              # Isolated
└── hive-addons/             # Sees its children only
    ├── diagrams/            # Isolated
    └── presentations/       # Isolated

Hybrid Approach (Option E - Recommended)

Resolution Priority:

  1. Check .hive-project.edn for explicit :parent-id
  2. Check persistent index (DataScript) for cached hierarchy
  3. If stale or missing, scan filesystem and update index
  4. Fall back to string-based inference (colon-delimited)

Implementation Phases

Phase Scope Effort
1 Add .hive-project.edn to subprojects Low
2 Persistent DataScript index Medium
3 Downward visibility (descendant-scopes) Medium
4 Multi-repo workspaces (~/.config/hive.edn) Future

NIH Research

Tool Hierarchy Model Key Insight
Nx workspace.json "Affected" detection via dep graph
Polylith workspace.edn Single source of truth
deps.edn monorepos :local/root Sean Corfield pattern
Git submodules .gitmodules Recursive traversal

Consequences

Positive

  • Subprojects get isolated memories
  • Parent aggregates children's memories
  • Incremental adoption

Negative

  • Requires adding .hive-project.edn to each subproject
  • Cache invalidation complexity

Clone this wiki locally