# framerslab/agentos architecture

> Architecture diagram of the GitHub repository framerslab/agentos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/framerslab/agentos
- Repository: https://github.com/framerslab/agentos

## Overview

AgentOS is a TypeScript framework for conversational agents with persistent cognitive memory, multi-agent orchestration, configurable LLM providers, and runtime tool creation. A user configures an agent, opens a session, and sends or streams turns; the runtime prepares context and invokes model/tool capabilities, with session history and optional memory supporting later turns. Separate branches cover retrieval-augmented generation, capability discovery, voice, guardrails, and provenance. The README documents these capabilities; sampled excerpts show only parts of turn preparation, ingestion routing, discovery, embeddings, and tool-forge orchestration, so uncertain internal links are omitted.

Main entry points: [`src/api/agent.ts`](https://github.com/framerslab/agentos/blob/master/src/api/agent.ts) (Agent API), [`src/cognition/memory/CognitiveMemoryManager.ts`](https://github.com/framerslab/agentos/blob/master/src/cognition/memory/CognitiveMemoryManager.ts) (Cognitive memory), [`src/api/runtime/TurnExecutionPipeline.ts`](https://github.com/framerslab/agentos/blob/master/src/api/runtime/TurnExecutionPipeline.ts) (Turn preparation), [`src/core/llm/providers/AIModelProviderManager.ts`](https://github.com/framerslab/agentos/blob/master/src/core/llm/providers/AIModelProviderManager.ts) (Provider manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent_runtime["Agent runtime"]
  node_agent_api["Agent API<br/>[agent.ts]"]
  node_turn_pipeline["Turn preparation"]
  node_gmi["GMI substrate<br/>[IGMI.ts]"]
  node_provider_manager["Provider manager"]
  node_provider_contract["LLM providers<br/>[IProvider.ts]"]
  node_conversation_store[("Conversation storage")]
end

subgraph group_cognition_memory["Cognition and memory"]
  node_memory_system["Cognitive memory"]
  node_memory_retrieval["Memory retrieval<br/>[HybridRetriever.ts]"]
  node_memory_graph[("Memory graph")]
  node_memory_archive[("Memory archive")]
  node_rag["RAG retrieval"]
  node_ingest_router["Content ingestion<br/>[IngestRouter.ts]"]
  node_query_router["Query routing<br/>[QueryRouter.ts]"]
end

subgraph group_capabilities["Capabilities and tools"]
  node_discovery["Capability discovery"]
  node_forge_engine["Tool forge"]
  node_tool_registry[("Forged tool registry")]
  node_agency["Multi-agent agency<br/>[AgencyRegistry.ts]"]
end

subgraph group_integrations_safety["Integrations and safety"]
  node_voice["Voice pipeline"]
  node_guardrails["Guardrails"]
  node_provenance[("Provenance ledger")]
end

node_user(("Agent user"))

node_user -->|"configures and sends"| node_agent_api
node_agent_api -.->|"runs turns"| node_turn_pipeline
node_turn_pipeline -->|"acquires GMI"| node_gmi
node_agent_api -->|"records session history"| node_conversation_store
node_agent_api -.->|"dispatches model calls"| node_provider_manager
node_provider_manager -->|"selects providers"| node_provider_contract
node_agent_api -->|"uses optional memory"| node_memory_system
node_memory_system -.->|"retrieves memories"| node_memory_retrieval
node_memory_system -.->|"persists memories"| node_memory_archive
node_memory_retrieval -.->|"queries graph"| node_memory_graph
node_user -.->|"submits content"| node_ingest_router
node_ingest_router -.->|"routes ingestion"| node_memory_system
node_user -.->|"asks questions"| node_query_router
node_query_router -.->|"retrieves context"| node_rag
node_agent_api -.->|"discovers capabilities"| node_discovery
node_discovery -.->|"indexes tools"| node_tool_registry
node_agent_api -->|"requests tool forging"| node_forge_engine
node_forge_engine -->|"registers approved tools"| node_tool_registry
node_agent_api -->|"orchestrates agents"| node_agency
node_user -->|"uses voice interface"| node_voice
node_agent_api -->|"applies optional guardrails"| node_guardrails
node_agent_api -.->|"records signed events"| node_provenance

click node_agent_api "https://github.com/framerslab/agentos/blob/master/src/api/agent.ts"
click node_turn_pipeline "https://github.com/framerslab/agentos/blob/master/src/api/runtime/TurnExecutionPipeline.ts"
click node_gmi "https://github.com/framerslab/agentos/blob/master/src/cognition/substrate/IGMI.ts"
click node_provider_manager "https://github.com/framerslab/agentos/blob/master/src/core/llm/providers/AIModelProviderManager.ts"
click node_provider_contract "https://github.com/framerslab/agentos/blob/master/src/core/llm/providers/IProvider.ts"
click node_conversation_store "https://github.com/framerslab/agentos/blob/master/src/core/storage/SqlStorageAdapter.ts"
click node_memory_system "https://github.com/framerslab/agentos/blob/master/src/cognition/memory/CognitiveMemoryManager.ts"
click node_memory_retrieval "https://github.com/framerslab/agentos/blob/master/src/cognition/memory/retrieval/hybrid/HybridRetriever.ts"
click node_memory_graph "https://github.com/framerslab/agentos/blob/master/src/cognition/memory/retrieval/graph/GraphologyMemoryGraph.ts"
click node_memory_archive "https://github.com/framerslab/agentos/blob/master/src/cognition/memory/archive/SqlStorageMemoryArchive.ts"
click node_rag "https://github.com/framerslab/agentos/blob/master/src/cognition/rag/unified/UnifiedRetriever.ts"
click node_ingest_router "https://github.com/framerslab/agentos/blob/master/src/orchestration/pipeline/ingest/IngestRouter.ts"
click node_query_router "https://github.com/framerslab/agentos/blob/master/src/orchestration/pipeline/query/QueryRouter.ts"
click node_discovery "https://github.com/framerslab/agentos/blob/master/src/cognition/discovery/CapabilityDiscoveryEngine.ts"
click node_forge_engine "https://github.com/framerslab/agentos/blob/master/src/cognition/emergent/EmergentCapabilityEngine.ts"
click node_tool_registry "https://github.com/framerslab/agentos/blob/master/src/cognition/emergent/EmergentToolRegistry.ts"
click node_agency "https://github.com/framerslab/agentos/blob/master/src/agents/agency/AgencyRegistry.ts"
click node_voice "https://github.com/framerslab/agentos/blob/master/src/io/voice-pipeline/VoicePipelineOrchestrator.ts"
click node_guardrails "https://github.com/framerslab/agentos/blob/master/src/safety/guardrails/IGuardrailService.ts"
click node_provenance "https://github.com/framerslab/agentos/blob/master/src/safety/provenance/ledger/SignedEventLedger.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_agent_api,node_turn_pipeline,node_gmi,node_provider_manager,node_provider_contract,node_conversation_store,node_user toneBlue
class node_memory_system,node_memory_retrieval,node_memory_graph,node_memory_archive,node_rag,node_ingest_router,node_query_router toneAmber
class node_discovery,node_forge_engine,node_tool_registry,node_agency toneMint
class node_voice,node_guardrails,node_provenance toneRose
```

## Components

### Agent runtime

- [Agent API](https://github.com/framerslab/agentos/blob/master/src/api/agent.ts): `src/api/agent.ts`
- [Turn preparation](https://github.com/framerslab/agentos/blob/master/src/api/runtime/TurnExecutionPipeline.ts): `src/api/runtime/TurnExecutionPipeline.ts`
- [GMI substrate](https://github.com/framerslab/agentos/blob/master/src/cognition/substrate/IGMI.ts): `src/cognition/substrate/IGMI.ts`
- [Provider manager](https://github.com/framerslab/agentos/blob/master/src/core/llm/providers/AIModelProviderManager.ts): `src/core/llm/providers/AIModelProviderManager.ts`
- [LLM providers](https://github.com/framerslab/agentos/blob/master/src/core/llm/providers/IProvider.ts): `src/core/llm/providers/IProvider.ts`
- [Conversation storage](https://github.com/framerslab/agentos/blob/master/src/core/storage/SqlStorageAdapter.ts): `src/core/storage/SqlStorageAdapter.ts`

### Cognition and memory

- [Cognitive memory](https://github.com/framerslab/agentos/blob/master/src/cognition/memory/CognitiveMemoryManager.ts): `src/cognition/memory/CognitiveMemoryManager.ts`
- [Memory retrieval](https://github.com/framerslab/agentos/blob/master/src/cognition/memory/retrieval/hybrid/HybridRetriever.ts): `src/cognition/memory/retrieval/hybrid/HybridRetriever.ts`
- [Memory graph](https://github.com/framerslab/agentos/blob/master/src/cognition/memory/retrieval/graph/GraphologyMemoryGraph.ts): `src/cognition/memory/retrieval/graph/GraphologyMemoryGraph.ts`
- [Memory archive](https://github.com/framerslab/agentos/blob/master/src/cognition/memory/archive/SqlStorageMemoryArchive.ts): `src/cognition/memory/archive/SqlStorageMemoryArchive.ts`
- [RAG retrieval](https://github.com/framerslab/agentos/blob/master/src/cognition/rag/unified/UnifiedRetriever.ts): `src/cognition/rag/unified/UnifiedRetriever.ts`
- [Content ingestion](https://github.com/framerslab/agentos/blob/master/src/orchestration/pipeline/ingest/IngestRouter.ts): `src/orchestration/pipeline/ingest/IngestRouter.ts`
- [Query routing](https://github.com/framerslab/agentos/blob/master/src/orchestration/pipeline/query/QueryRouter.ts): `src/orchestration/pipeline/query/QueryRouter.ts`

### Capabilities and tools

- [Capability discovery](https://github.com/framerslab/agentos/blob/master/src/cognition/discovery/CapabilityDiscoveryEngine.ts): `src/cognition/discovery/CapabilityDiscoveryEngine.ts`
- [Tool forge](https://github.com/framerslab/agentos/blob/master/src/cognition/emergent/EmergentCapabilityEngine.ts): `src/cognition/emergent/EmergentCapabilityEngine.ts`
- [Forged tool registry](https://github.com/framerslab/agentos/blob/master/src/cognition/emergent/EmergentToolRegistry.ts): `src/cognition/emergent/EmergentToolRegistry.ts`
- [Multi-agent agency](https://github.com/framerslab/agentos/blob/master/src/agents/agency/AgencyRegistry.ts): `src/agents/agency/AgencyRegistry.ts`

### Integrations and safety

- [Voice pipeline](https://github.com/framerslab/agentos/blob/master/src/io/voice-pipeline/VoicePipelineOrchestrator.ts): `src/io/voice-pipeline/VoicePipelineOrchestrator.ts`
- [Guardrails](https://github.com/framerslab/agentos/blob/master/src/safety/guardrails/IGuardrailService.ts): `src/safety/guardrails/IGuardrailService.ts`
- [Provenance ledger](https://github.com/framerslab/agentos/blob/master/src/safety/provenance/ledger/SignedEventLedger.ts): `src/safety/provenance/ledger/SignedEventLedger.ts`

### Other components

- **Agent user**

## Connections

- Agent user → Agent API: configures and sends (evidence: `README.md`)
- Agent API → Turn preparation: runs turns
- Turn preparation → GMI substrate: acquires GMI (evidence: `src/api/runtime/TurnExecutionPipeline.ts`)
- Agent API → Conversation storage: records session history (evidence: `README.md`)
- Agent API → Provider manager: dispatches model calls
- Provider manager → LLM providers: selects providers (evidence: `src/core/llm/providers/AIModelProviderManager.ts`)
- Agent API → Cognitive memory: uses optional memory (evidence: `README.md`)
- Cognitive memory → Memory retrieval: retrieves memories
- Cognitive memory → Memory archive: persists memories
- Memory retrieval → Memory graph: queries graph
- Agent user → Content ingestion: submits content
- Content ingestion → Cognitive memory: routes ingestion
- Agent user → Query routing: asks questions
- Query routing → RAG retrieval: retrieves context (evidence: `src/orchestration/pipeline/query/QueryRouter.ts`)
- Agent API → Capability discovery: discovers capabilities
- Capability discovery → Forged tool registry: indexes tools
- Agent API → Tool forge: requests tool forging (evidence: `README.md`)
- Tool forge → Forged tool registry: registers approved tools (evidence: `src/cognition/emergent/EmergentCapabilityEngine.ts`)
- Agent API → Multi-agent agency: orchestrates agents (evidence: `README.md`)
- Agent user → Voice pipeline: uses voice interface (evidence: `README.md`)
- Agent API → Guardrails: applies optional guardrails (evidence: `README.md`)
- Agent API → Provenance ledger: records signed events
