Skip to content

Implement shared organizational memory with OrgMemoryBackend protocol (DESIGN_SPEC §7.4) #125

@Aureliolo

Description

@Aureliolo

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

  • OrgMemoryBackend protocol 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_policies list 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
  • OrgFact model: 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

Design Spec Reference

  • §7.4 — Shared Organizational Memory (OrgMemoryBackend protocol, 3 backends, write access control)

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:highImportant, should be prioritizedscope:medium1-3 days of workspec:memoryDESIGN_SPEC Section 7 - Memory & Persistencetype:featureNew feature implementation

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions