# mikeybeez/ollama_agents architecture

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

- Interactive diagram: https://gitdiagram.com/mikeybeez/ollama_agents
- Repository: https://github.com/mikeybeez/ollama_agents

## Overview

Ollama_Agents is an interactive Ollama-powered assistant with configurable agent personalities, web research, conversation memory, and a JSON/SQLite graph knowledgebase. Its user-facing workflow is to enter a prompt or slash command, have an agent combine model reasoning with context and research, and receive a response that can update history and knowledge. The graph preserves documented capabilities such as multi-agent use, fact-checking, knowledge trees, and user profiling, but their exact runtime wiring is not always visible in the excerpts. Arrows use explicit README statements or SOURCE INDEX references; unsampled subsystem links are omitted or marked unverified.

Main entry points: [`src/modules/ollama_client.py`](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/ollama_client.py) (Ollama client), [`src/agents/debug_agent_v2.py`](https://github.com/mikeybeez/ollama_agents/blob/main/src/agents/debug_agent_v2.py) (Debug agent), [`src/modules/cognitive_engine.py`](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/cognitive_engine.py) (Cognitive processing), [`src/modules/save_history.py`](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/save_history.py) (History and memory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User Interaction"]
  node_input["Interactive input<br/>[input.py]"]
  node_commands["Slash commands<br/>[slash_commands.py]"]
  node_main["CLI entry point<br/>[main.py]"]
end

subgraph group_agents["Agents and Reasoning"]
  node_agent["Debug agent<br/>[debug_agent_v2.py]"]
  node_multiagent["Agent switching<br/>[multi_agent.py]"]
  node_cognition["Cognitive processing"]
  node_agenttools["Agent tools<br/>[agent_tools.py]"]
  node_causal["Causal reasoning"]
  node_hypothesis["Hypothesis testing"]
  node_advreason["Advanced reasoning"]
  node_planning["Planning engine"]
  node_research["Research tools<br/>[research_tools.py]"]
end

subgraph group_knowledge["Knowledge and Memory"]
  node_context["Context management"]
  node_memorysearch["Memory search<br/>[memory_search.py]"]
  node_history["History and memory<br/>[save_history.py]"]
  node_knowledge["Knowledge management"]
  node_graph[("Graph knowledgebase<br/>[kb_graph.py]")]
  node_extraction["Knowledge extraction<br/>[main.py]"]
end

subgraph group_services["Models and Services"]
  node_ollama["Ollama client<br/>[ollama_client.py]"]
  node_ddg["DuckDuckGo search<br/>[ddg_search.py]"]
  node_ollama_service(("Ollama service"))
  node_web(("DuckDuckGo"))
end

subgraph group_foundation["Configuration and Runtime"]
  node_config["Assistant configuration<br/>[config.py]"]
  node_logging["Logging<br/>[logging_setup.py]"]
end

node_user(("Assistant user"))

node_user -->|"enters prompts"| node_input
node_input -->|"dispatches commands"| node_commands
node_user -->|"uses debug mode"| node_agent
node_agent -->|"reads input"| node_input
node_agent -->|"uses commands"| node_commands
node_agent -->|"uses tools"| node_agenttools
node_agent -->|"calls model"| node_ollama
node_agent -->|"uses search"| node_ddg
node_agent -->|"uses graph"| node_graph
node_agent -->|"uses reasoning"| node_causal
node_agent -->|"tests hypotheses"| node_hypothesis
node_agent -->|"saves history"| node_history
node_user -->|"switches agents"| node_multiagent
node_cognition -->|"analyzes and responds"| node_agenttools
node_cognition -->|"processes queries"| node_knowledge
node_cognition -->|"gathers and updates"| node_context
node_cognition -->|"searches memories"| node_memorysearch
node_cognition -.->|"researches queries"| node_research
node_cognition -.->|"generates responses"| node_ollama
node_context -->|"searches memories"| node_memorysearch
node_context -->|"updates context"| node_ollama
node_research -->|"searches web"| node_ddg
node_research -->|"summarizes results"| node_ollama
node_ollama -->|"requests generation"| node_ollama_service
node_ollama -->|"saves interaction"| node_history
node_ddg -->|"runs search"| node_web
node_history -->|"writes memory edges"| node_graph
node_knowledge -->|"uses graph"| node_graph
node_extraction -->|"analyzes topics"| node_ollama
node_advreason -->|"calls model"| node_ollama
node_planning -->|"calls model"| node_ollama
node_agenttools -->|"generates prompts"| node_ollama
node_causal -->|"calls model"| node_ollama
node_hypothesis -->|"calls model"| node_ollama
node_config -->|"sets memory paths"| node_history
node_config -->|"sets log settings"| node_logging
node_main -->|"sets up logging"| node_logging

click node_input "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/input.py"
click node_commands "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/slash_commands.py"
click node_main "https://github.com/mikeybeez/ollama_agents/blob/main/src/main.py"
click node_agent "https://github.com/mikeybeez/ollama_agents/blob/main/src/agents/debug_agent_v2.py"
click node_multiagent "https://github.com/mikeybeez/ollama_agents/blob/main/src/agents/multi_agent.py"
click node_cognition "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/cognitive_engine.py"
click node_agenttools "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/agent_tools.py"
click node_causal "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/causal_reasoning.py"
click node_hypothesis "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/hypothesis_testing.py"
click node_advreason "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/adv_reasoning_engine.py"
click node_planning "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/adv_planning_engine.py"
click node_research "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/research_tools.py"
click node_context "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/context_management.py"
click node_memorysearch "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/memory_search.py"
click node_history "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/save_history.py"
click node_knowledge "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/knowledge_management.py"
click node_graph "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/kb_graph.py"
click node_extraction "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/knowledge_extraction/main.py"
click node_ollama "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/ollama_client.py"
click node_ddg "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/ddg_search.py"
click node_config "https://github.com/mikeybeez/ollama_agents/blob/main/config.py"
click node_logging "https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/logging_setup.py"

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_input,node_commands,node_main,node_user toneBlue
class node_agent,node_multiagent,node_cognition,node_agenttools,node_causal,node_hypothesis,node_advreason,node_planning,node_research toneAmber
class node_context,node_memorysearch,node_history,node_knowledge,node_graph,node_extraction toneMint
class node_ollama,node_ddg,node_ollama_service,node_web toneRose
class node_config,node_logging toneIndigo
```

## Components

### User Interaction

- [Interactive input](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/input.py): `src/modules/input.py`
- [Slash commands](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/slash_commands.py): `src/modules/slash_commands.py`
- [CLI entry point](https://github.com/mikeybeez/ollama_agents/blob/main/src/main.py): `src/main.py`

### Agents and Reasoning

- [Debug agent](https://github.com/mikeybeez/ollama_agents/blob/main/src/agents/debug_agent_v2.py): `src/agents/debug_agent_v2.py`
- [Agent switching](https://github.com/mikeybeez/ollama_agents/blob/main/src/agents/multi_agent.py): `src/agents/multi_agent.py`
- [Cognitive processing](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/cognitive_engine.py): `src/modules/cognitive_engine.py`
- [Agent tools](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/agent_tools.py): `src/modules/agent_tools.py`
- [Causal reasoning](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/causal_reasoning.py): `src/modules/causal_reasoning.py`
- [Hypothesis testing](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/hypothesis_testing.py): `src/modules/hypothesis_testing.py`
- [Advanced reasoning](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/adv_reasoning_engine.py): `src/modules/adv_reasoning_engine.py`
- [Planning engine](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/adv_planning_engine.py): `src/modules/adv_planning_engine.py`
- [Research tools](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/research_tools.py): `src/modules/research_tools.py`

### Knowledge and Memory

- [Context management](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/context_management.py): `src/modules/context_management.py`
- [Memory search](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/memory_search.py): `src/modules/memory_search.py`
- [History and memory](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/save_history.py): `src/modules/save_history.py`
- [Knowledge management](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/knowledge_management.py): `src/modules/knowledge_management.py`
- [Graph knowledgebase](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/kb_graph.py): `src/modules/kb_graph.py`
- [Knowledge extraction](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/knowledge_extraction/main.py): `src/modules/knowledge_extraction/main.py`

### Models and Services

- [Ollama client](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/ollama_client.py): `src/modules/ollama_client.py`
- [DuckDuckGo search](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/ddg_search.py): `src/modules/ddg_search.py`
- **Ollama service**
- **DuckDuckGo**

### Configuration and Runtime

- [Assistant configuration](https://github.com/mikeybeez/ollama_agents/blob/main/config.py): `config.py`
- [Logging](https://github.com/mikeybeez/ollama_agents/blob/main/src/modules/logging_setup.py): `src/modules/logging_setup.py`

### Other components

- **Assistant user**

## Connections

- Assistant user → Interactive input: enters prompts (evidence: `README.md`)
- Interactive input → Slash commands: dispatches commands (evidence: `src/modules/input.py`)
- Assistant user → Debug agent: uses debug mode (evidence: `README.md`)
- Debug agent → Interactive input: reads input (evidence: `src/agents/debug_agent_v2.py`)
- Debug agent → Slash commands: uses commands (evidence: `src/agents/debug_agent_v2.py`)
- Debug agent → Agent tools: uses tools (evidence: `src/agents/debug_agent_v2.py`)
- Debug agent → Ollama client: calls model (evidence: `src/agents/debug_agent_v2.py`)
- Debug agent → DuckDuckGo search: uses search (evidence: `src/agents/debug_agent_v2.py`)
- Debug agent → Graph knowledgebase: uses graph (evidence: `src/agents/debug_agent_v2.py`)
- Debug agent → Causal reasoning: uses reasoning (evidence: `src/agents/debug_agent_v2.py`)
- Debug agent → Hypothesis testing: tests hypotheses (evidence: `src/agents/debug_agent_v2.py`)
- Debug agent → History and memory: saves history (evidence: `src/agents/debug_agent_v2.py`)
- Assistant user → Agent switching: switches agents (evidence: `README.md`)
- Cognitive processing → Agent tools: analyzes and responds (evidence: `src/modules/cognitive_engine.py`)
- Cognitive processing → Knowledge management: processes queries (evidence: `src/modules/cognitive_engine.py`)
- Cognitive processing → Context management: gathers and updates (evidence: `src/modules/cognitive_engine.py`)
- Cognitive processing → Memory search: searches memories (evidence: `src/modules/cognitive_engine.py`)
- Cognitive processing → Research tools: researches queries (evidence: `src/modules/cognitive_engine.py`)
- Cognitive processing → Ollama client: generates responses (evidence: `src/modules/cognitive_engine.py`)
- Context management → Memory search: searches memories (evidence: `src/modules/context_management.py`)
- Context management → Ollama client: updates context (evidence: `src/modules/context_management.py`)
- Research tools → DuckDuckGo search: searches web (evidence: `src/modules/research_tools.py`)
- Research tools → Ollama client: summarizes results (evidence: `src/modules/research_tools.py`)
- Ollama client → Ollama service: requests generation (evidence: `src/modules/ollama_client.py`)
- Ollama client → History and memory: saves interaction (evidence: `src/modules/ollama_client.py`)
- DuckDuckGo search → DuckDuckGo: runs search (evidence: `src/modules/ddg_search.py`)
- History and memory → Graph knowledgebase: writes memory edges (evidence: `src/modules/save_history.py`)
- Knowledge management → Graph knowledgebase: uses graph (evidence: `src/modules/knowledge_management.py`)
- Knowledge extraction → Ollama client: analyzes topics
- Advanced reasoning → Ollama client: calls model (evidence: `src/modules/adv_reasoning_engine.py`)
- Planning engine → Ollama client: calls model (evidence: `src/modules/adv_planning_engine.py`)
- Agent tools → Ollama client: generates prompts (evidence: `src/modules/agent_tools.py`)
- Causal reasoning → Ollama client: calls model (evidence: `src/modules/causal_reasoning.py`)
- Hypothesis testing → Ollama client: calls model (evidence: `src/modules/hypothesis_testing.py`)
- Assistant configuration → History and memory: sets memory paths (evidence: `src/modules/save_history.py`)
- Assistant configuration → Logging: sets log settings (evidence: `src/modules/logging_setup.py`)
- CLI entry point → Logging: sets up logging (evidence: `src/main.py`)
