# mammut001/pipi-shrimp-agent architecture

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

- Interactive diagram: https://gitdiagram.com/mammut001/pipi-shrimp-agent
- Repository: https://github.com/mammut001/pipi-shrimp-agent

## Overview

Pipi-Shrimp is a local-first AI desktop agent: users submit tasks in the React/Tauri app, the shared agent runtime streams provider responses and coordinates tool use, and results interact with local projects and persisted session state. Separate product branches support visual workflows, browser automation, AutoResearch, document skills, multi-agent collaboration, and Telegram access. README statements support the broad integration map; sampled source additionally shows the chat facade delegating turns to the session runtime and the workflow and AutoResearch entry points. Some internal wiring is unsampled, so those links are omitted.

Main entry points: [`src/App.tsx`](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/App.tsx) (React app surfaces), [`src/core/runtime/queryLoop.ts`](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/core/runtime/queryLoop.ts) (Provider and tool loop), [`src/core/QueryEngine.ts`](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/core/QueryEngine.ts) (Chat turn facade), [`src-tauri/src/tools/registry.rs`](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/tools/registry.rs) (Tool execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop application"]
  node_ui["React app surfaces<br/>[App.tsx]"]
  node_workflow_ui["Workflow surface<br/>[Workflow.tsx]"]
  node_browser_ui["Browser workspace"]
  node_autoresearch_ui["AutoResearch page<br/>[AutoResearch.tsx]"]
end

subgraph group_runtime["Agent runtime"]
  node_chat["Chat turn facade<br/>[QueryEngine.ts]"]
  node_session["Session runtime<br/>[SessionRuntime.ts]"]
  node_query["Provider and tool loop<br/>[queryLoop.ts]"]
  node_config["Provider configuration<br/>[agentConfig.ts]"]
end

subgraph group_capabilities["Product capabilities"]
  node_memory["Project memory<br/>[engine.ts]"]
  node_workflow["Workflow engine<br/>[engine.ts]"]
  node_autoresearch["Experiment loop"]
  node_skills["Document skills<br/>[document.py]"]
  node_swarm["Multi-agent collaboration<br/>[taskManager.ts]"]
end

subgraph group_native["Native services"]
  node_providers["Provider transport<br/>[executor.rs]"]
  node_tools["Tool execution<br/>[registry.rs]"]
  node_database[("SQLite persistence<br/>[database.rs]")]
  node_browser["CDP browser runtime<br/>[manager.rs]"]
  node_mcp["MCP integration<br/>[client.rs]"]
  node_telegram["Telegram access<br/>[telegram.rs]"]
end

node_user(("Desktop user"))
node_local["Local environment"]
node_llm["LLM providers"]

node_user -->|"submits tasks"| node_ui
node_ui -->|"starts chat turns"| node_chat
node_chat -->|"delegates turns"| node_session
node_session -.->|"runs turn loop"| node_query
node_query -->|"resolves configuration"| node_config
node_query -->|"streams requests"| node_llm
node_query -->|"dispatches tools"| node_tools
node_query -.->|"uses context"| node_memory
node_ui -->|"opens workflow"| node_workflow_ui
node_workflow_ui -.->|"starts workflow"| node_workflow
node_workflow -.->|"runs agent turns"| node_chat
node_ui -->|"opens browser workspace"| node_browser_ui
node_browser_ui -.->|"controls browser"| node_browser
node_tools -.->|"uses browser tools"| node_browser
node_ui -->|"opens research"| node_autoresearch_ui
node_autoresearch_ui -->|"starts experiment run"| node_autoresearch
node_autoresearch -.->|"uses agent runtime"| node_chat
node_tools -.->|"invokes document skills"| node_skills
node_ui -.->|"configures MCP"| node_mcp
node_workflow -.->|"coordinates agents"| node_swarm
node_telegram -.->|"provides remote access"| node_chat
node_database -->|"persists project state"| node_local
node_tools -->|"operates on files and shell"| node_local
node_browser -->|"controls desktop browser"| node_local
node_providers -.->|"sends provider requests"| node_llm

click node_ui "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/App.tsx"
click node_chat "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/core/QueryEngine.ts"
click node_session "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/core/runtime/SessionRuntime.ts"
click node_query "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/core/runtime/queryLoop.ts"
click node_config "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/agentConfig.ts"
click node_providers "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/claude/http/executor.rs"
click node_tools "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/tools/registry.rs"
click node_memory "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/contextAnalysis/engine.ts"
click node_database "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/database.rs"
click node_workflow "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/workflowEngine/engine.ts"
click node_workflow_ui "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/pages/Workflow.tsx"
click node_browser "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/browser/session/manager.rs"
click node_browser_ui "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/components/CdpBrowserControllerPanel.tsx"
click node_autoresearch "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/autoresearch/loopEngine.iterationPhase.ts"
click node_autoresearch_ui "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/pages/AutoResearch.tsx"
click node_skills "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/skills/docx/scripts/document.py"
click node_mcp "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/mcp/client.rs"
click node_swarm "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/swarm/taskManager.ts"
click node_telegram "https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/commands/telegram.rs"

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_ui,node_workflow_ui,node_browser_ui,node_autoresearch_ui,node_user toneBlue
class node_chat,node_session,node_query,node_config toneAmber
class node_memory,node_workflow,node_autoresearch,node_skills,node_swarm toneMint
class node_providers,node_tools,node_database,node_browser,node_mcp,node_telegram toneRose
class node_local,node_llm toneIndigo
```

## Components

### Desktop application

- [React app surfaces](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/App.tsx): `src/App.tsx`
- [Workflow surface](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/pages/Workflow.tsx): `src/pages/Workflow.tsx`
- [Browser workspace](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/components/CdpBrowserControllerPanel.tsx): `src/components/CdpBrowserControllerPanel.tsx`
- [AutoResearch page](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/pages/AutoResearch.tsx): `src/pages/AutoResearch.tsx`

### Agent runtime

- [Chat turn facade](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/core/QueryEngine.ts): `src/core/QueryEngine.ts`
- [Session runtime](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/core/runtime/SessionRuntime.ts): `src/core/runtime/SessionRuntime.ts`
- [Provider and tool loop](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/core/runtime/queryLoop.ts): `src/core/runtime/queryLoop.ts`
- [Provider configuration](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/agentConfig.ts): `src/services/agentConfig.ts`

### Product capabilities

- [Project memory](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/contextAnalysis/engine.ts): `src/services/contextAnalysis/engine.ts`
- [Workflow engine](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/workflowEngine/engine.ts): `src/services/workflowEngine/engine.ts`
- [Experiment loop](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/autoresearch/loopEngine.iterationPhase.ts): `src/services/autoresearch/loopEngine.iterationPhase.ts`
- [Document skills](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/skills/docx/scripts/document.py): `src-tauri/skills/docx/scripts/document.py`
- [Multi-agent collaboration](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src/services/swarm/taskManager.ts): `src/services/swarm/taskManager.ts`

### Native services

- [Provider transport](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/claude/http/executor.rs): `src-tauri/src/claude/http/executor.rs`
- [Tool execution](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/tools/registry.rs): `src-tauri/src/tools/registry.rs`
- [SQLite persistence](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/database.rs): `src-tauri/src/database.rs`
- [CDP browser runtime](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/browser/session/manager.rs): `src-tauri/src/browser/session/manager.rs`
- [MCP integration](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/mcp/client.rs): `src-tauri/src/mcp/client.rs`
- [Telegram access](https://github.com/mammut001/pipi-shrimp-agent/blob/main/src-tauri/src/commands/telegram.rs): `src-tauri/src/commands/telegram.rs`

### Other components

- **Desktop user**
- **Local environment**
- **LLM providers**

## Connections

- Desktop user → React app surfaces: submits tasks (evidence: `README.md`)
- React app surfaces → Chat turn facade: starts chat turns (evidence: `README.md`)
- Chat turn facade → Session runtime: delegates turns (evidence: `src/core/QueryEngine.ts`)
- Session runtime → Provider and tool loop: runs turn loop
- Provider and tool loop → Provider configuration: resolves configuration (evidence: `src/core/runtime/queryLoop.ts`)
- Provider and tool loop → LLM providers: streams requests (evidence: `README.md`)
- Provider and tool loop → Tool execution: dispatches tools (evidence: `README.md`)
- Provider and tool loop → Project memory: uses context
- React app surfaces → Workflow surface: opens workflow (evidence: `src/App.tsx`)
- Workflow surface → Workflow engine: starts workflow
- Workflow engine → Chat turn facade: runs agent turns
- React app surfaces → Browser workspace: opens browser workspace (evidence: `src/App.tsx`)
- Browser workspace → CDP browser runtime: controls browser
- Tool execution → CDP browser runtime: uses browser tools
- React app surfaces → AutoResearch page: opens research (evidence: `src/App.tsx`)
- AutoResearch page → Experiment loop: starts experiment run
- Experiment loop → Chat turn facade: uses agent runtime
- Tool execution → Document skills: invokes document skills
- React app surfaces → MCP integration: configures MCP
- Workflow engine → Multi-agent collaboration: coordinates agents
- Telegram access → Chat turn facade: provides remote access
- SQLite persistence → Local environment: persists project state (evidence: `README.md`)
- Tool execution → Local environment: operates on files and shell (evidence: `README.md`)
- CDP browser runtime → Local environment: controls desktop browser (evidence: `README.md`)
- Provider transport → LLM providers: sends provider requests
