Engineering documents from the cMCP pilot build (October 2026). Statuses here are engineering states, not product claims: see cMCP for what is available. All documents
Status 2026-10-11. Stages 1a–1t of Build Phase 1 are built and tested (1l–1s on 2026-10-11, M-109; 1t, M-111). The pilot company has not adopted cMCP, so its account is now a test account with its company data cleared. Next, on hold until the owner resumes it (M-112): the web console moves to cmcp.it-labs.in and the API, sign-in, database and local AI model to a GPU server, so the addresses on this page will change. See the build plan, section 15.

Architecting a Shared Cognitive Memory Layer
for Enterprise AI Infrastructure

A Technical Whitepaper on Multi-Scope Memory Systems,
Hybrid Authorization, and Corporate AI Deployments

Technical Whitepaper  ·  Enterprise AI Architecture  ·  Version 1.3  ·  Updated 2 October 2026

Contents

  1. The Enterprise Memory Problem
  2. Architectural Foundations
  3. The Multi-Scope Memory Model
  4. Multi-Tenant Isolation Architecture
  5. Authorization and Access Control for Multi-Scope Memory
    1. Hybrid Model Recap
    2. Why Pure Approaches Fail
    3. How the Layers Interact
    4. Mapping to the Codebase
    5. Data Models and Entities
    6. Request Decision Flow
    7. Implementation Considerations
    8. Risks and Trade-offs
    9. Implementation Roadmap
  6. Security, Governance, and Compliance
  7. Memory Retrieval and Context Assembly
  8. Technical Implementation Considerations
  9. Organizational Learning and Knowledge Compounding
  10. Conclusion
  11. Appendix A: Memory Object Schema
  12. Appendix B: Relationship Tuples
  13. Appendix C: Glossary
  14. Appendix D: Reference implementation (cMCP)

Part I — Foundation

1. The Enterprise Memory Problem

1.1 The Statelessness Gap

Large language models are stateless. Each inference call begins with a blank slate, bounded by a finite context window. This creates a fundamental disconnect between the growing ambitions of AI agents—which must sustain coherent behavior over hours, days, and weeks of interaction—and their inability to remember, learn, or adapt from past experience.

In enterprise settings, the consequences are severe:

1.2 The Patchwork Anti-Pattern

Today, every team building a production AI agent assembles the same ad-hoc architecture: a vector database for embeddings, Redis for session state, PostgreSQL for user profiles, and custom glue code to stitch them together. This patchwork—replicated across thousands of organizations—fails at precisely the capabilities agents need most:

1.3 The Enterprise Brain Concept

The industry has begun to converge on a solution: a shared layer of memory and governance that sits beneath all of a company's AI agents, so that what one agent learns is available to every other one instead of disappearing when the session ends. This "enterprise AI brain" is not a better model—it is a brain.

However, this rapid evolution outpaces governance, raising critical concerns about data ownership, security risks such as context poisoning, and the ethical implications of employee data. Experts urge companies to audit AI memory, assign context-layer ownership, and establish clear policies.

2. Architectural Foundations

2.1 Memory Taxonomy

A shared cognitive memory layer must support multiple memory types, each with distinct purposes, access patterns, and lifecycles.

Memory TypeDescriptionRetentionScope
Working MemoryThe agent's current context window; immediate task stateSession-boundAgent + User
Episodic MemoryInteraction history; specific events and their contextMedium-termUser / Team
Semantic MemoryLearned facts, relationships, and entity knowledgeLong-termTeam / Org
Procedural MemoryLearned workflows, patterns, and operational knowledgeLong-termTeam / Org
Personalized MemoryStable preferences, habits, and constraints about users or teamsLong-termUser

Personalized memory tracks stable information about particular users, teams, or environments: preferences, habits, recurring constraints, and prior interactions. This state must not be collapsed into the agent's general self-improvement store, because user-specific traces obey different retention, retrieval, and privacy rules.

2.2 Architectural Paradigms

Current memory systems can be read as four broad architectural paradigms, progressing from simple to sophisticated:

  1. Monolithic Context. All relevant history remains directly in the prompt. Transparent but capacity-limited; state disappears with the session.
  2. Context with Retrieval Storage. Near-term working state stays in context while longer-horizon traces are stored externally and retrieved on demand. This is the dominant pattern in production copilots and assistants.
  3. Hierarchical Memory and Orchestration. Once flat retrieval proves insufficient, systems introduce memory hierarchies with explicit policies for what gets written, promoted, retrieved, compressed, or forgotten.
  4. Adaptive Memory Systems. The most advanced paradigm, where memory operations (ADD, UPDATE, DELETE, NOOP) are learned through reinforcement learning, enabling the system to optimize its own memory management.

The enterprise architecture proposed in this paper operates at the Hierarchical Memory and Orchestration level, with provisions for adaptive optimization.

Implementation status (cMCP). The reference implementation (cMCP, Appendix D) is built at the Hierarchical Memory and Orchestration level. Adaptive, learned memory operations remain future work.

3. The Multi-Scope Memory Model

3.1 Scope Definitions

The core innovation of this architecture is its explicit, multi-dimensional scoping model. Every memory record is scoped along multiple axes, ensuring that information flows correctly between different organizational levels while maintaining strict boundaries.

3.1.1 Personal Memory (User-Scoped)

Personal memory belongs exclusively to a single user-agent pairing. It functions as a private workspace containing communication preferences and working style, personal priorities and follow-ups, individual constraints and recurring preferences, and private notes and decision context. These memories are invisible to other users' agents and are subject to the strictest retention and privacy rules.

3.1.2 Team Memory (Group-Scoped)

Team memory is shared across a defined group—a project team, department, or functional unit. It contains business facts and domain knowledge relevant to the team, shared workflows and operational procedures, team-specific conventions and standards, and collective decisions and their rationale. Team memory is the primary mechanism for organizational learning at the group level. Teams follow the organization's role and reporting hierarchy (a team can contain sub-teams); projects (3.1.5) cut across teams.

3.1.3 Agent Memory (Agent-Scoped)

Agent memory allows individual AI agents to build self-knowledge across sessions. This includes what approaches worked and which failed, which tools were most effective for specific task types, strategies that produced the best outcomes, and agent-specific performance patterns. Agent-scoped memory enables agents to improve their own performance over time without requiring human intervention or explicit retraining. Two kinds of agent are covered: agents a person is using, which act with that person's rights, and independent AI bots with their own work identities (for example a Jira account), which take assigned jobs like a team member and always have a named human sponsor.

3.1.4 Organizational Memory (Enterprise-Scoped)

Organizational memory represents the highest level of collective knowledge. It contains company-wide policies and procedures, strategic context and business objectives, cross-team patterns and best practices, and institutional knowledge derived from aggregated experience. Organizational memory is the foundation of the "enterprise brain" concept—a layer that allows all AI agents to learn collectively.

3.1.5 Project Memory (Cross-Team)

Project memory holds requirements, decisions, timelines and deliverables for one initiative. Its members come from many teams, and one or more project leads decide what enters it. Project members read it; project leads write it.

3.1.6 User Memory (Person-Scoped)

User memory holds one person's profile, preferences and history across every AI tool they use, so each of their agents respects the same preferences. It is separate from Personal memory: User memory is shared with the person's delegated agents and can contribute to promotion by rule, while Personal memory stays private.

3.1.7 Client Memory (Client-Scoped)

Client memory holds facts about one client the organization works for: contacts, agreements, preferences and history across that client's projects. Only the people assigned to the client and the members of its linked projects can read it, and it is walled off from every other client. It is restricted by default, can be deleted in one step when the work for that client ends, and client-specific details are removed before any lesson moves beyond it.

3.1.8 The Account Level

Above the organization sits the Account: the customer of the memory platform. One account can own and manage several organizations; its administrators can set account-wide guidance and settings, and see every scope in their organizations except Personal memory, which requires a logged emergency access with a stated reason and notice to the person.

3.2 The Promotion Pipeline

The critical mechanism connecting these scopes is the promotion pipeline—the process by which memories move from lower scopes to higher scopes:

User / Agent → Team → Project → Organizational

Personal memory is never promoted.

Promotion criteria include:

When a memory is promoted, it is anonymized to remove user-specific identifying information while preserving the operational insight. For example, "User A prefers tabs over spaces" might be promoted to "The team's codebase convention uses tabs for indentation."

Promotion from User or Agent to Team can happen automatically when at least three independent sources agree, confidence is high and no personal data is found. Promotion to Project or Organizational memory always needs approval by the project lead or organizational governance.

3.3 Inheritance, Synthesis and Downward Sync

Implementation status (cMCP). Built and tested in Phase 1 (stages 1a to 1t): all eight scopes (Account, Organization, Client, Project, Team, User, Agent and Personal), the promotion pipeline, lateral synthesis with approval, downward sync with scope versions and force refresh, and change requests. Still planned for Phase 2: the logged emergency (break-glass) access to Personal memory described in 3.1.8 and the retention job that applies the per-scope retention periods (the periods are already stored and shown).

4. Multi-Tenant Isolation Architecture

4.1 Tenant Boundary Enforcement

In multi-tenant environments, every memory record must carry a tenant boundary so that one account's agents, users, facts, and deletion requests never affect another account. In this architecture the tenant is the Account, which can own several organizations. Tenant isolation should be enforced by the database layer, not just application code.

The architecture enforces this through:

Implementation status (cMCP). cMCP Phase 1 implements this with PostgreSQL 18 row-level security: every table carries account_id (the tenant column), with RLS enabled and forced, and the memory worker runs under its own database role. The search index (Hindsight) keeps one bank per account, with separate banks for Personal and Client memory. Hash partitioning and per-partition HNSW indexes are not used in Phase 1; they remain a Phase 2 scaling option.

4.2 Scope Hierarchy Within Tenants

Within a single tenant (organization), memory scopes form a hierarchy:

Scope LevelAccess BoundaryExample
UserSingle user onlyPersonal preferences
AgentSingle agent instanceLearned patterns
TeamDefined groupTeam conventions
ProjectProject members from many teamsRequirements and decisions
OrganizationAll usersCompany policies
ClientPeople assigned to one client and its linked projectsClient-specific facts, walled off from other clients
AccountAccount administrators across the account's organizationsAccount-wide guidance and settings

Each memory record carries metadata identifying its scope, and retrieval queries automatically filter based on the requesting user's authenticated scope permissions.

4.3 Cross-Entity Reuse Prevention

A conventional enterprise AI platform may promise that client data is isolated, but the technical architecture may still rely on ordinary database separation, access-control lists, tenant labels, or post-hoc audit logs. These mechanisms do not necessarily prevent a downstream AI workflow from reusing data across entities.

This architecture prevents cross-entity reuse through:

Part II — Authorization and Access Control

5. Authorization and Access Control for Multi-Scope Memory

Scope of this section. This section applies the hybrid RBAC + ReBAC + ABAC model to the multi-scope memory architecture defined in Part I. It specifies where each authorization layer lives, how it maps to data models and services, the request decision flow, implementation considerations, and the roadmap. Where the underlying code plan is not yet fixed, assumptions are explicitly marked.

5.1 Hybrid Model Recap

5.1.1 What each layer handles

LayerResponsibilityTypical Questions
RBAC Coarse-grained, system-level governance Is this user an admin? Can this service account call the memory API? Can this role manage tenants?
ReBAC Fine-grained, relationship-based access to shared or nested content Is this user a member of the team that owns this memory? Is this agent delegated by the user? Is this memory shared with the project group?
ABAC Dynamic, context-dependent rules and caveats Is the request within allowed hours? Does the data residency match? Is the sensitivity label compatible with the purpose?

5.1.2 Why pure approaches are insufficient

5.1.3 How the layers interact in a single request

A request passes through three gates in order:

  1. RBAC gate. Does the subject have the coarse permission to perform this action on this resource type?
  2. ReBAC gate. Does the subject have the required relationship to this specific memory scope?
  3. ABAC gate. Given the relationship and role, do dynamic context rules allow the action?

Only if all three pass is the request allowed. This is a deny-by-default pipeline.

Implementation status (cMCP). cMCP Phase 1 implements the RBAC and ReBAC gates in one permission service (roles, memberships, delegation grants and audience labels, evaluated on every request and checked again by database policies). The ABAC gate (context rules such as time, residency and purpose) is a Phase 2 item. Grants always give an agent the smaller of the person's rights and the grant.

5.2 Why Pure Approaches Fail for UGC and Multi-Scope Memory

User-generated content platforms with multi-scope memory combine three properties that no single model handles well:

The hybrid model is not a preference—it is a necessity. Each layer covers the blind spots of the others:

RequirementRBACReBACABAC
Tenant admin can manage all teams✔——
User can read team memory they belong to—✔—
Agent can read memory delegated by its owner—✔—
Memory with sensitivity=restricted requires purpose=support——✔
Cross-region access blocked by data residency——✔
Only auditors can export memory✔——
Promotion from personal to team scope requires ownership—✔—

5.3 Mapping to the Codebase

Assumption. The codebase is a service-oriented application with an API gateway, an authentication service, a memory service, a relational database, and optionally a policy engine. If the actual code plan differs, these mappings should be adjusted. No details are invented beyond this structural assumption.

5.3.1 Where each authorization layer lives

LayerCode LocationResponsibility
AuthenticationAPI gateway / auth middlewareResolve user identity, tenant ID, agent ID, session context
RBACAuth service or dedicated RBAC moduleLoad roles, resolve coarse permissions
ReBACRelationship service / graph storeStore and query relationship tuples
ABACPolicy engine or policy moduleEvaluate dynamic context rules
EnforcementMemory service + middlewareCombine decisions, enforce at read/write boundaries
AuditCross-cutting logging serviceRecord every decision with reason and policy version
Implementation status (cMCP). Built as follows. Authentication: Keycloak 26 (OAuth 2.1 / OIDC) in front of a FastAPI REST service and an MCP server (streamable HTTP). RBAC and ReBAC: the permission service in the API, with relationships held in PostgreSQL tables. Audit: written in the same transaction as the change.

5.3.2 Which entities, tables, services, and modules are involved

The memory object table should include scope and ownership metadata. The following sketch is consistent with the schema in Part I and adds authorization-relevant fields:

memory_objects (
  id UUID,
  tenant_id UUID,
  scope_type ENUM('personal','user','agent','team','project','client','org','account'),
  scope_id UUID,
  owner_id UUID,
  sensitivity_label TEXT,
  policy_tags JSONB,
  content TEXT,
  created_at TIMESTAMP,
  updated_at TIMESTAMP
)

A relationship table supports the ReBAC layer:

relationships (
  id UUID,
  tenant_id UUID,
  subject_type ENUM('user','agent','bot','team','org'),
  subject_id UUID,
  relation TEXT,          -- e.g. 'member_of', 'owner_of', 'delegated_to'
  object_type ENUM('team','project','client','memory','agent','org','account'),
  object_id UUID,
  created_at TIMESTAMP
)

RBAC tables support coarse governance:

roles (id, tenant_id, name)
permissions (id, name, resource_type, action)
role_permissions (role_id, permission_id)
user_roles (user_id, role_id, tenant_id)

5.3.3 What checks happen at each layer, and in what order

  1. Authenticate → resolve user_id, tenant_id, agent_id if present.
  2. RBAC check → e.g. can(user, 'memory:read', 'team_memory').
  3. ReBAC check → e.g. has_relation(user, 'member_of', team_id).
  4. ABAC check → e.g. sensitivity == 'internal' AND purpose == 'support' AND time within business_hours.
  5. Enforce → allow or deny; log the decision.

5.3.4 Changes needed to data models, APIs, or middleware

5.4 Data Models and Entities

The authorization model touches four categories of entities. Each is summarized below with its role in the hybrid pipeline.

Entity CategoryExamplesUsed By
SubjectUser, Agent, Service AccountRBAC, ReBAC, ABAC
ResourceMemory, Team, OrganizationRBAC, ReBAC, ABAC
Relationshipmembership, ownership, delegation, parent-childReBAC
Contexttime, IP, purpose, data residency, deviceABAC

5.4.1 Subject model

Subjects may be human users or autonomous agents. Both must be first-class principals with stable identifiers. Agents should carry a delegation relationship to their owning user or team, which the ReBAC layer uses to resolve access.

Every principal has a type: human, delegated_agent (acts for a person, never with more rights than that person), bot (independent, with its own identity and a human sponsor) or service. Each request also carries a caller context: the verified identity, type, the person being acted for and the client application, plus declared values such as the model name, current project, purpose and token budget. Only verified values decide access; declared values can narrow access and shape the response, and all of them are recorded in the audit trail.

5.4.2 Resource model

Memories are the primary protected resource. Teams and organizations are also resources for membership and administrative actions. Each memory carries its scope metadata, which determines which relationship and policy checks apply.

5.4.3 Relationship model

Relationships form a directed graph. The most important relations for the multi-scope memory architecture are:

5.4.4 Context model

The context object is assembled per request and passed to the ABAC evaluator. It should include only the attributes needed for policy evaluation, and it should be treated as untrusted input unless cryptographically attested.

5.5 Request Decision Flow

5.5.1 Step-by-step flow from authentication to final allow/deny

1. Request arrives at API gateway.
2. Authentication middleware validates token/session.
3. Authz middleware builds AuthzContext:
   - subject: user_id, agent_id, roles
   - resource: memory_id, scope_type, scope_id, owner_id
   - action: read | write | delete | share | promote
   - environment: time, IP, purpose, device, data_residency
4. RBAC gate: coarse permission check.
5. ReBAC gate: relationship path check.
6. ABAC gate: policy evaluation.
7. Decision: allow or deny.
8. If allow, memory service executes.
9. Audit log records decision, reason, policy version, relation path.

5.5.2 Pseudo-code

def authorize(ctx: AuthzContext) -> Decision:
    # 1. RBAC
    if not rbac.check(ctx.subject, ctx.action, ctx.resource_type):
        return Deny("RBAC: missing coarse permission")

    # 2. ReBAC
    relation_path = rebac.find_path(
        subject=ctx.subject,
        relation=ctx.required_relation,
        object=ctx.resource_scope
    )
    if not relation_path:
        return Deny("ReBAC: no relationship to resource")

    # 3. ABAC
    abac_decision = abac.evaluate(
        subject=ctx.subject,
        resource=ctx.resource,
        action=ctx.action,
        environment=ctx.environment,
        relation_path=relation_path
    )
    if not abac_decision.allowed:
        return Deny(f"ABAC: {abac_decision.reason}")

    return Allow(relation_path=relation_path, policy_version=abac_decision.version)

5.5.3 Caching, consistency, and failure modes

Implementation status (cMCP). cMCP Phase 1 uses Valkey 8 for short-lived caches (time-to-live of at most five minutes, keyed by account, person, app, place and scope version), dropped on change notices; PostgreSQL stays the record and the system works without Valkey. Grants shrink at once when their grantor loses the role, with no background job. Failure behavior is fail closed.

5.5.4 Sequence diagram (text)

Client → Gateway: request(memory_id, action)
Gateway → AuthN: validate(token)
AuthN → Gateway: subject, tenant, agent
Gateway → AuthZ: build AuthzContext
AuthZ → RBAC: check(subject, action, resource_type)
RBAC → AuthZ: allow/deny
AuthZ → ReBAC: find_path(subject, relation, scope)
ReBAC → AuthZ: path or empty
AuthZ → ABAC: evaluate(context, path)
ABAC → AuthZ: allow/deny + version
AuthZ → Gateway: final decision
Gateway → MemoryService: execute (if allow)
MemoryService → Audit: log decision
MemoryService → Gateway: result
Gateway → Client: response

5.6 Implementation Considerations

5.6.1 Policy engine vs. custom logic

Implementation status (cMCP). cMCP Phase 1 implements this with custom logic in one permission service backed by PostgreSQL relationship tables and recursive queries; no policy engine or graph store is deployed. OPA or Cedar for ABAC, and SpiceDB or OpenFGA for relationships, remain Phase 2 options. Hindsight is used only as the memory index, not for authorization.

5.6.2 Relationship store: graph database vs. relational tables

5.6.3 Audit logging, testing, and migration

5.6.4 Performance and scalability

5.7 Risks and Trade-offs

5.7.1 Common pitfalls in hybrid authorization

5.7.2 Where this design could become over-engineered

5.7.3 What to simplify

5.8 Next Steps

5.8.1 Concrete implementation order

  1. Define scopes and actions: personal, agent, team, org; read, write, delete, share, promote.
  2. Implement RBAC tables and coarse checks.
  3. Implement ReBAC relationship table and basic path queries.
  4. Add authorization middleware and enforce in the memory service.
  5. Add audit logging.
  6. Add ABAC policies for sensitivity and residency.
  7. Add caching and invalidation.

5.8.2 Open questions to resolve before coding

5.8.3 Suggested milestones or proof-of-concept scope

Implementation status (cMCP). Milestones 1 to 4 and the caching part of milestone 5 are built (stages 1a to 1t). The ABAC policy engine and migration tooling are planned for Phase 2.

Part III — Operations and Governance

6. Security, Governance, and Compliance

6.1 Governed Memory Lifecycle

Memory governance ensures that shared memory remains subject to organizational policies throughout its lifecycle. This includes:

6.2 Audit and Forensics

For regulated industries, the ability to reconstruct what an agent knew at any point in time is essential. The architecture provides:

6.3 Regulatory Compliance

The architecture is designed to address major regulatory frameworks:

6.4 Memory Poisoning Prevention

Memory poisoning attacks represent a distinct threat category (OWASP ASI06). These attacks attempt to inject false or misleading memories that degrade agent performance or cause harmful actions. The architecture defends against this through:

Implementation status (cMCP). Built in Phase 1: versioned memory with supersession (every change keeps the earlier version), an audit trail written in the same transaction as each change, staged imports and approvals before anything reaches a shared scope, a suspicious-text check in the memory worker, and one-step client erase (hidden at once, purged after a configurable delay, 30 days by default). Planned for Phase 2: the hash-chained audit trail (cryptographic attestation), PII detection and redaction (Presidio), per-tenant encryption keys, and the compliance readiness work for GDPR, the EU AI Act, HIPAA and SOC 2.

7. Memory Retrieval and Context Assembly

7.1 Hybrid Retrieval

Effective memory retrieval requires more than simple semantic similarity. The architecture employs multi-channel retrieval, combining:

Candidates from each channel are fused using reciprocal rank fusion, producing a ranked list that balances precision and recall.

Implementation status (cMCP). cMCP Phase 1 delegates search to Hindsight (run in "chunks" mode, so cMCP's own governed rows are indexed as given), with keyword search in PostgreSQL as the fallback when the engine is down. The permission service builds the scope filter from the verified identity, and results from the account, Personal and Client banks are merged by similarity. A cross-encoder reranker is switched off in the request path on the CPU-only host. Measured on the pilot (95th percentile): search 88 ms and context pack 55 ms against the targets in 8.3.

7.2 Context Assembly

When an agent needs to generate a response, the system assembles a context package containing:

  1. Working memory. The current session's recent turns.
  2. Relevant episodic memories. Similar past interactions.
  3. Applicable semantic knowledge. Facts and relationships relevant to the query.
  4. Procedural guidance. Learned workflows applicable to the task.
  5. Personal preferences. User-specific constraints and habits.

The assembly process is token-aware, ensuring the context package fits within the model's context window while maximizing relevance.

Memory enters the system through explicit saves by people or their AI, end-of-session summaries the person confirms, optional client hooks, and connectors that import existing knowledge (for example Jira) to seed project and organizational memory. Nothing from a person's conversations reaches a shared scope without an approval step.

Implementation status (cMCP). Built: eleven MCP tools (including memory_get_context, memory_search, memory_save, memory_request_change and resource_lookup) paired with REST endpoints, and connectors for Jira, read-only PostgreSQL views and IMAP mailboxes. Imports are staged and approved by the project or client lead before they become memory. Secrets for connectors are held in OpenBao.

7.3 Role-Aware Routing

In multi-agent systems, different agents may have different access permissions and responsibilities. The retrieval layer implements role-aware routing, ensuring that:

This prevents agents from accessing memories outside their authorized scope, even when operating within the same tenant.

Every memory also carries an audience label: internal, restricted or external_ok. An agent or bot replying to someone outside the organization receives only external_ok memories. Memory derived by promotion or synthesis takes the strictest label of its sources. All models receive the same facts; only the size and format of the response is adapted to each model and application.

Implementation status (cMCP). Built: the three audience labels, the client wall (client memory is returned only at a client place or a project linked to it), and a resource catalogue of locations (never passwords).

8. Technical Implementation Considerations

8.1 Storage Backend

The architecture supports multiple storage backends to accommodate different deployment scenarios:

The storage layer abstracts these backends behind a unified interface, allowing organizations to start with SQLite and migrate to PostgreSQL as their needs grow.

Implementation status (cMCP). cMCP Phase 1 implements this with PostgreSQL 18 and pgvector only. SQLite and specialized vector databases (Qdrant, Weaviate, Milvus) are not used; they remain Phase 2 options. PostgreSQL is the governed record and the durable job queue, and Hindsight (which stores its vectors in PostgreSQL with pgvector) is the search index rebuilt from it.

8.2 Embedding Models

The choice of embedding model significantly impacts retrieval quality. The architecture supports:

Embedding model selection is configurable per tenant, allowing organizations to optimize for their specific vocabulary and use cases.

Implementation status (cMCP). cMCP Phase 1 uses the small local embedding model built into Hindsight, run on the CPU, with no cloud embedding calls. Per-tenant model choice and cloud or custom embeddings are Phase 2 options.

8.3 Latency Budget

Enterprise deployments demand predictable latency. The architecture targets:

OperationTarget Latency (p95)
Memory write (governed)< 10 ms
Memory retrieval (hybrid)< 100 ms
Context assembly< 150 ms
Full query cycle< 300 ms

These targets are achievable through in-memory caching, efficient indexing, and parallel retrieval across channels.

Implementation status (cMCP). Measured on the Phase 1 pilot (95th percentile): the "up to date" check 5 ms, context pack 55 ms and search 88 ms.

8.4 Deployment Topologies

The architecture supports multiple deployment topologies:

Implementation status (cMCP). Phase 1 runs as a Docker Compose stack on one server, with every service on localhost and one entry point: Caddy behind Apache on port 443, TLS and login on separate site names. Helm charts, an air-gapped bundle and multi-tenant hosting are planned for Phase 2.

8.5 The Memory Worker (Internal LLM)

An internal worker, separate from the models people chat with, turns what people and AIs write into clean shared memory: it extracts short facts, keeps one neutral writing style whichever model sent the input, detects duplicates and contradictions, anonymizes content for promotion, drafts syntheses and flags suspicious text. It runs in the background and is never in the request path, so the system still works in a reduced form without it. It uses one model-agnostic interface: a small local model to start, with a cloud model or GPU as later options.

Implementation status (cMCP). cMCP Phase 1 implements this with its own worker (extraction, indexing, promotion, synthesis and housekeeping jobs, taken from a PostgreSQL queue under a separate database role) and a small local CPU model served by Ollama: Qwen3 4B Instruct (2507). A cloud model is used only for synthetic test data; the company pilot stays local. A cloud API or GPU for extraction remains a Phase 2 option.

9. Organizational Learning and Knowledge Compounding

9.1 The Learning Flywheel

The ultimate value of a shared memory layer is the compounding of organizational knowledge. When agents and users contribute memories, and those memories are promoted and refined, the entire organization becomes smarter over time. This creates a positive feedback loop:

  1. Individual agents discover patterns through task execution.
  2. Patterns are validated through repetition and reinforced with confidence scores.
  3. Validated patterns are promoted to team scope, benefiting all team members.
  4. Team patterns that prove broadly applicable are promoted to organizational scope.
  5. New team members and new agents bootstrap from accumulated organizational knowledge.

9.2 The Memory Operating System Metaphor

This architecture can be understood as a memory operating system for AI agents—a unified context layer that replaces the fragile patchwork of vector databases, session stores, and custom glue code. Like an operating system manages hardware resources, this layer manages memory resources:

9.3 From Tool to Teammate

The fundamental shift enabled by shared memory is the transformation of AI from tool to teammate. Tools are stateless—they perform a function and return a result. Teammates learn, adapt, and build shared understanding over time. This transformation has profound implications for how organizations deploy and manage AI:

10. Conclusion

The enterprise AI landscape is at an inflection point. Organizations have deployed AI agents across business functions, but the majority of these deployments are not delivering expected ROI—not because the models are inadequate, but because the infrastructure lacks persistent, shared memory.

This paper has presented a comprehensive architecture for a shared cognitive memory layer that addresses this gap. The architecture provides:

Implementation status (cMCP). Phase 1 of the reference implementation (stages 1a to 1t) is built and tested on a pilot server, with relaxed security; it moves to IT-Labs hardware next. The items marked Phase 2 in this paper (ABAC context rules, hash-chained audit, PII redaction, per-tenant keys, SCIM, multi-tenant hosting) are future development. See Appendix D.

The transition from stateless tools to stateful teammates is not merely a technical upgrade—it is an architectural shift that redefines how organizations deploy, manage, and derive value from AI. The organizations that build this shared memory layer today will be the ones that unlock the full potential of their AI investments tomorrow.


Appendix A: Memory Object Schema

MemoryObject {
  id: UUID
  tenant_id: UUID (RLS-enforced)
  scope: ENUM(personal, user, agent, team, project, client, org, account)
  scope_id: UUID (user_id, agent_id, team_id, etc.)
  memory_type: ENUM(episodic, semantic, procedural, working)

  content: TEXT (encrypted at rest)
  embedding: VECTOR(1536)

  confidence: FLOAT [0.0, 1.0]
  importance: FLOAT [0.0, 1.0]
  occurrence_count: INTEGER

  source_lineage: JSONB (provenance chain)
  policy_composition: JSONB

  sensitivity_label: TEXT
  policy_tags: JSONB

  created_at: TIMESTAMP
  updated_at: TIMESTAMP
  expires_at: TIMESTAMP (TTL)
  superseded_by: UUID (nullable)

  is_current: BOOLEAN
  version: INTEGER
}
Implementation status (cMCP). cMCP implements this as a memories table (tenant column account_id) with versions in memory_versions and lineage in memory_links (derived from, promoted from, contradicts, supersedes). It adds audience label, must-apply flag and validity dates. Embeddings are held by Hindsight, not in this row, and the 1536-dimension vector is not used. Content is not encrypted per tenant in Phase 1; that is a Phase 2 item.

Appendix B: Example Relationship Tuples

SubjectRelationObject
user:alicemember_ofteam:engineering
user:aliceowner_ofmemory:123
agent:code-helperdelegated_byuser:alice
team:engineeringparent_ofteam:backend
user:bobauditor_oftenant:acme
Implementation status (cMCP). In cMCP these tuples are rows in membership, delegation-grant and role tables in PostgreSQL, not a separate graph store.

Appendix C: Glossary

TermDefinition
KV CacheKey-Value cache; the physical memory used during LLM inference.
RLSRow-Level Security; database-level access control.
TTLTime-to-Live; automatic expiration of records.
HNSWHierarchical Navigable Small World; a vector index algorithm.
p9595th percentile latency.
RBACRole-Based Access Control.
ReBACRelationship-Based Access Control.
ABACAttribute-Based Access Control.
RLHFReinforcement Learning from Human Feedback.
SFTSupervised Fine-Tuning.
MoEMixture of Experts.
UGCUser-Generated Content.
AccountThe customer of the memory platform; the tenant, which can own several organizations.
ClientA company or person an organization works for; its memory is walled off from other clients.
cMCPThe reference implementation of this architecture (Appendix D).
HindsightThe open-source memory engine used as the search index in the reference implementation.

Appendix D: Reference implementation (cMCP)

cMCP is the reference implementation of this architecture. Phase 1 (stages 1a to 1f: core memory, projects and sync, grants and bots, account and client levels with promotion, web UI and admin console, integration hub; then, in stages 1g to 1t, automatic capture from AI apps, a space registry, collective and organizational memory, space knowledge, device keys, a bot library, digital workers and guarded risk switches) is built and tested on a pilot server, with relaxed security, and moves to IT-Labs hardware next. Phase 2 (security hardening, compliance, multi-tenant product) is planned and is described in this paper as future development.

ComponentVersionRoleLicence
PostgreSQL18Governed record, row-level security, job queuePostgreSQL Licence
pgvectorcurrent release for PostgreSQL 18Vector storage used by the search indexPostgreSQL Licence
Hindsight0.10.2Memory search index (chunks mode)MIT
Ollama0.35.0Serves the local CPU model for fact extractionMIT
Qwen3 4B Instruct2507Default extraction modelApache-2.0
Memory worker (own code)Phase 1Extraction, indexing, promotion, synthesis, housekeeping jobsOwn code
FastAPI and MCP Python SDK0.142 and 2.2 (Python 3.12)REST service and MCP server (streamable HTTP, OAuth)MIT
Keycloak26Identity: logins, bot identities, tokensApache-2.0
Next.js16Web UI and admin consoleMIT
Valkey8Cache, rate limits, sessionsBSD-3-Clause
OpenBao2.5Connector secrets (Transit encryption)MPL-2.0
Caddy2.11Router behind Apache (host-based routing, rate limits)Apache-2.0
Apache HTTP Serverexisting hostPublic entry on port 443 with TLSApache-2.0

Planned for Phase 2 (not built): ABAC context rules with a policy engine such as Cedar or OPA, a dedicated relationship store such as SpiceDB or OpenFGA if relationship queries become a bottleneck, hash-chained audit, PII detection (Presidio), per-tenant encryption keys, SCIM, a cloud model or GPU for extraction, multi-tenant hosting, Helm and an air-gapped bundle, and the compliance and penetration-test work.