# mshcheglov1-ux/corporate-waters-ai-agent architecture

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

- Interactive diagram: https://gitdiagram.com/mshcheglov1-ux/corporate-waters-ai-agent
- Repository: https://github.com/mshcheglov1-ux/corporate-waters-ai-agent

## Overview

Saul is a continuously running personal AI chief of staff. Its primary workflow is Telegram or Slack input handled by the bot, interpreted by the Claude-backed brain, and answered through the messaging interface; the README also documents an HTTP API entry point. Memory, learned skills, identity guidance, scheduled work, and domain tools extend that workflow. Several capabilities are documented but their runtime wiring is unsampled, so only explicit README or excerpt-supported relationships are connected.

Main entry points: [`tools/core/brain.py`](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/brain.py) (Claude brain), [`tools/core/bot.py`](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/bot.py) (Message bot), [`tools/core/file_ingest.py`](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/file_ingest.py) (File ingestion), [`tools/core/db.py`](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/db.py) (SQLite memory store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Agent runtime"]
  node_bot["Message bot<br/>[bot.py]"]
  node_brain["Claude brain<br/>[brain.py]"]
  node_context["Prompt context<br/>[context.py]"]
  node_identity["Identity guidance"]
  node_skills["Procedural skills<br/>[skills.py]"]
  node_api["HTTP API<br/>[api.py]"]
end

subgraph group_memory["Memory and knowledge"]
  node_db[("SQLite memory store<br/>[db.py]")]
  node_embeddings["Embedding model<br/>[embeddings.py]"]
  node_file_ingest["File ingestion<br/>[file_ingest.py]"]
  node_knowledge[("Knowledge graph<br/>[knowledge_graph.py]")]
  node_graph_export["Memory graph export<br/>[kg_graph_cli.py]"]
end

subgraph group_work["Workspace and collaboration"]
  node_calendar["Calendar operations<br/>[calendar.py]"]
  node_gmail["Gmail operations<br/>[gmail.py]"]
  node_slack_tools["Slack integration<br/>[slack.py]"]
end

subgraph group_capabilities["Domain capabilities"]
  node_web["Web fetch stack<br/>[web.py]"]
  node_browser["Stealth browser<br/>[browse.py]"]
  node_recruiting["Recruiting ATS<br/>[huntflow.py]"]
  node_confluence["Confluence integration<br/>[confluence.py]"]
  node_trello["Trello integration<br/>[trello.py]"]
end

subgraph group_operations["Background work"]
  node_heartbeat["Heartbeat jobs<br/>[heartbeat.py]"]
  node_scheduler["Job scheduler<br/>[scheduler.py]"]
  node_review_job["Review triage"]
end

node_telegram(("Telegram users"))
node_slack_users(("Slack coworkers"))
node_http_clients(("HTTP clients"))
node_claude["Claude CLI"]
node_google["Google Workspace"]
node_slack_service["Slack"]
node_websites["Websites"]
node_ats["Huntflow ATS"]
node_atlassian["Atlassian Cloud"]

node_telegram -->|"sends messages"| node_bot
node_slack_users -->|"sends messages"| node_bot
node_http_clients -->|"sends requests"| node_api
node_bot -->|"dispatches messages"| node_brain
node_brain -->|"invokes subprocess"| node_claude
node_brain -.->|"assembles prompts"| node_context
node_brain -.->|"returns answers"| node_bot
node_brain -->|"uses identity"| node_identity
node_brain -->|"injects relevant skills"| node_skills
node_file_ingest -->|"stores chunks"| node_db
node_file_ingest -.->|"creates embeddings"| node_embeddings
node_graph_export -->|"reads memories"| node_db
node_calendar -->|"uses Calendar API"| node_google
node_gmail -->|"uses Gmail API"| node_google
node_slack_tools -->|"calls Slack API"| node_slack_service
node_web -->|"fetches pages"| node_websites
node_browser -->|"browses pages"| node_websites
node_recruiting -->|"uses ATS"| node_ats
node_confluence -->|"calls REST API"| node_atlassian
node_heartbeat -.->|"runs scheduled work"| node_scheduler
node_review_job -->|"reads and replies"| node_slack_service

click node_bot "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/bot.py"
click node_brain "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/brain.py"
click node_context "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/context.py"
click node_skills "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/skills.py"
click node_api "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/api.py"
click node_db "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/db.py"
click node_embeddings "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/embeddings.py"
click node_file_ingest "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/file_ingest.py"
click node_knowledge "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/knowledge/knowledge_graph.py"
click node_graph_export "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/memory/knowledge-graph/kg_graph_cli.py"
click node_calendar "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/google-workspace/calendar.py"
click node_gmail "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/google-workspace/gmail.py"
click node_slack_tools "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/slack/slack.py"
click node_web "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/web-research/web.py"
click node_browser "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/web-research/browse.py"
click node_recruiting "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/recruiting/huntflow.py"
click node_confluence "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/atlassian/confluence.py"
click node_trello "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/trello/trello.py"
click node_heartbeat "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/heartbeat.py"
click node_scheduler "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/scheduler.py"
click node_review_job "https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/automations/mobile_reviews_daily.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_bot,node_brain,node_context,node_identity,node_skills,node_api,node_telegram,node_http_clients toneBlue
class node_db,node_embeddings,node_file_ingest,node_knowledge,node_graph_export toneAmber
class node_calendar,node_gmail,node_slack_tools toneMint
class node_web,node_browser,node_recruiting,node_confluence,node_trello,node_slack_users toneRose
class node_heartbeat,node_scheduler,node_review_job,node_claude,node_google,node_slack_service,node_websites,node_ats,node_atlassian toneIndigo
```

## Components

### Agent runtime

- [Message bot](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/bot.py): `tools/core/bot.py`
- [Claude brain](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/brain.py): `tools/core/brain.py`
- [Prompt context](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/context.py): `tools/core/context.py`
- **Identity guidance**
- [Procedural skills](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/skills.py): `tools/core/skills.py`
- [HTTP API](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/api.py): `tools/core/api.py`

### Memory and knowledge

- [SQLite memory store](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/db.py): `tools/core/db.py`
- [Embedding model](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/embeddings.py): `tools/core/embeddings.py`
- [File ingestion](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/file_ingest.py): `tools/core/file_ingest.py`
- [Knowledge graph](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/knowledge/knowledge_graph.py): `tools/knowledge/knowledge_graph.py`
- [Memory graph export](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/memory/knowledge-graph/kg_graph_cli.py): `memory/knowledge-graph/kg_graph_cli.py`

### Workspace and collaboration

- [Calendar operations](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/google-workspace/calendar.py): `tools/google-workspace/calendar.py`
- [Gmail operations](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/google-workspace/gmail.py): `tools/google-workspace/gmail.py`
- [Slack integration](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/slack/slack.py): `tools/slack/slack.py`

### Domain capabilities

- [Web fetch stack](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/web-research/web.py): `tools/web-research/web.py`
- [Stealth browser](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/web-research/browse.py): `tools/web-research/browse.py`
- [Recruiting ATS](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/recruiting/huntflow.py): `tools/recruiting/huntflow.py`
- [Confluence integration](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/atlassian/confluence.py): `tools/atlassian/confluence.py`
- [Trello integration](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/trello/trello.py): `tools/trello/trello.py`

### Background work

- [Heartbeat jobs](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/heartbeat.py): `tools/core/heartbeat.py`
- [Job scheduler](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/core/scheduler.py): `tools/core/scheduler.py`
- [Review triage](https://github.com/mshcheglov1-ux/corporate-waters-ai-agent/blob/main/tools/automations/mobile_reviews_daily.py): `tools/automations/mobile_reviews_daily.py`

### Other components

- **Telegram users**
- **Slack coworkers**
- **HTTP clients**
- **Claude CLI**
- **Google Workspace**
- **Slack**
- **Websites**
- **Huntflow ATS**
- **Atlassian Cloud**

## Connections

- Telegram users → Message bot: sends messages (evidence: `README.md`)
- Slack coworkers → Message bot: sends messages (evidence: `README.md`)
- HTTP clients → HTTP API: sends requests (evidence: `README.md`)
- Message bot → Claude brain: dispatches messages (evidence: `README.md`)
- Claude brain → Claude CLI: invokes subprocess (evidence: `README.md`)
- Claude brain → Prompt context: assembles prompts
- Claude brain → Message bot: returns answers
- Claude brain → Identity guidance: uses identity (evidence: `README.md`)
- Claude brain → Procedural skills: injects relevant skills (evidence: `README.md`)
- File ingestion → SQLite memory store: stores chunks (evidence: `tools/core/file_ingest.py`)
- File ingestion → Embedding model: creates embeddings
- Memory graph export → SQLite memory store: reads memories (evidence: `memory/knowledge-graph/kg_graph_cli.py`)
- Calendar operations → Google Workspace: uses Calendar API (evidence: `tools/google-workspace/calendar.py`)
- Gmail operations → Google Workspace: uses Gmail API (evidence: `README.md`)
- Slack integration → Slack: calls Slack API (evidence: `tools/slack/slack.py`)
- Web fetch stack → Websites: fetches pages (evidence: `README.md`)
- Stealth browser → Websites: browses pages (evidence: `tools/web-research/browse.py`)
- Recruiting ATS → Huntflow ATS: uses ATS (evidence: `README.md`)
- Confluence integration → Atlassian Cloud: calls REST API (evidence: `tools/atlassian/confluence.py`)
- Heartbeat jobs → Job scheduler: runs scheduled work
- Review triage → Slack: reads and replies (evidence: `tools/automations/mobile_reviews_daily.py`)
