-
Notifications
You must be signed in to change notification settings - Fork 0
Implement shared organizational memory with OrgMemoryBackend protocol (DESIGN_SPEC §7.4) #125
Description
Context
Implement the shared organizational memory system defined in DESIGN_SPEC §7.4. Beyond individual agent memory (§7.1-7.3, covered by #32), the framework needs organizational memory — company-wide knowledge that all agents can access: policies, conventions, ADRs, coding standards, and operational procedures.
This is not personal episodic memory ("what I did last Tuesday") but institutional knowledge ("we always use FastAPI, not Flask").
Shared organizational memory is implemented behind an OrgMemoryBackend protocol, making the system modular and extensible.
Backends (§7.4)
Backend 1: Hybrid Prompt + Retrieval (Default / MVP)
Critical rules (5-10 items) injected into every agent's system prompt. Extended knowledge (ADRs, procedures) stored in a queryable store, retrieved on demand at task start.
- Simple to implement. Core rules always present. Extended knowledge scales.
- Basic retrieval may miss relational connections.
Backend 2: GraphRAG Knowledge Graph (Future)
Organizational knowledge as entities + relationships in a knowledge graph. Multi-hop reasoning: "FastAPI is our standard" → "don't use Flask" → "exception: data team uses Django for admin."
- Significant accuracy improvement over vector-only retrieval.
- More complex infrastructure.
Backend 3: Temporal Knowledge Graph (Future)
Like GraphRAG but tracks how facts change over time. Agents see current truth but can query history.
- Handles policy evolution naturally.
- Most complex. Potentially overkill for small setups.
Acceptance Criteria
Protocol Interface
-
OrgMemoryBackendprotocol defined:query(context) → list[OrgFact],write(fact, author),list_policies() - Backend selection configurable via YAML (
org_memory.backend: "hybrid_prompt_retrieval") - New backends addable without modifying existing ones
Hybrid Prompt + Retrieval Implementation (MVP)
-
core_policieslist injected into every agent's system prompt - Extended knowledge store with queryable interface (backed by SQLite initially)
- Retrieval at task start with configurable
max_retrieved_per_query -
OrgFactmodel: content, author, category, created_at, version
Write Access Control
- Core policies: human-only writes
- ADRs and procedures: writable by senior+ agents (configurable role levels)
- All writes versioned and auditable
- Write access configurable per fact category
Testing
- Unit tests for protocol and MVP backend (>80% coverage)
- Test: core policies always present in system prompt
- Test: extended knowledge retrieved by relevance
- Test: write access control enforced per role level
Dependencies
- Individual agent memory interface (Design individual agent memory interface: working, episodic, semantic, procedural (DESIGN_SPEC §7.1-7.3) #32) — separate but related
- Memory layer candidate evaluation (Evaluate memory layer candidates: Mem0, Zep, Letta, Cognee, custom #39) — selected library may provide graph capabilities for Backends 2-3
- System prompt construction (engine, Implement agent engine core with ExecutionLoop protocol integration (DESIGN_SPEC §3.1, §6.1, §6.5) #11) — for injecting core policies
Design Spec Reference
- §7.4 — Shared Organizational Memory (OrgMemoryBackend protocol, 3 backends, write access control)