# rudrao2/tara architecture

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

- Interactive diagram: https://gitdiagram.com/rudrao2/tara
- Repository: https://github.com/rudrao2/tara

## Overview

Tara is an AI community manager: members ask questions in chat, Tara consults Notion-backed knowledge and responds; unknowns go to organizers for answers that are relayed and learned. It also detects and tracks member problems, and routes human-needed work through notifications and approvals. Organizers use the web dashboard and phone PWA to review cases, approve actions, and operate the console. The graph preserves these documented capabilities; some subsystems are represented by exact source directories because their implementation was not sampled. Edges reflect shown calls, source-index references, or README statements; unsampled relationships are omitted.

Main entry points: [`src/pipeline.ts`](https://github.com/rudrao2/tara/blob/main/src/pipeline.ts) (Event processing), [`src/core/channels.ts`](https://github.com/rudrao2/tara/blob/main/src/core/channels.ts) (Channel actions), [`src/core/approvals.ts`](https://github.com/rudrao2/tara/blob/main/src/core/approvals.ts) (Action approvals), [`src/agent/community.ts`](https://github.com/rudrao2/tara/blob/main/src/agent/community.ts) (Community agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_channels["Community channels"]
  node_telegram["Telegram adapter<br/>[telegram.ts]"]
  node_slack["Slack adapter<br/>[slack.ts]"]
  node_whatsapp["WhatsApp adapter<br/>[whatsapp.ts]"]
  node_ingest["Message batching<br/>[batcher.ts]"]
  node_pipeline["Event processing<br/>[pipeline.ts]"]
end

subgraph group_agent["Agent and learning"]
  node_community["Community agent<br/>[community.ts]"]
  node_learning["Learning agent<br/>[learn.ts]"]
  node_mood["Mood analysis<br/>[mood.ts]"]
end

subgraph group_operations["Care and operations"]
  node_cases["Member cases<br/>[cases.ts]"]
  node_notify["Human notifications<br/>[notify.ts]"]
  node_scheduler["Care and digest jobs"]
  node_console["Operator console agent<br/>[console.ts]"]
  node_approvals["Action approvals<br/>[approvals.ts]"]
  node_actions["Channel actions<br/>[channels.ts]"]
end

subgraph group_knowledge["Knowledge and safeguards"]
  node_knowledge["Knowledge service<br/>[knowledge.ts]"]
  node_notion[("Notion knowledge base")]
  node_guides["Group guides and timeline"]
  node_guardrails["Execution policies<br/>[policies.ts]"]
  node_runtime["Execution runtime<br/>[exec.ts]"]
  node_store[("SQLite repository<br/>[repo.ts]")]
end

subgraph group_interfaces["Organizer interfaces"]
  node_server["Web API server<br/>[app.ts]"]
  node_dashboard["Organizer dashboard<br/>[App.tsx]"]
  node_phone["Phone PWA<br/>[MobileApp.tsx]"]
  node_push["Phone push<br/>[notify.ts]"]
end

node_members(("Community members"))
node_organizers(("Organizers"))
node_resend["Resend email"]

node_members -->|"message"| node_telegram
node_members -->|"message"| node_slack
node_members -->|"message"| node_whatsapp
node_telegram -.->|"ingests"| node_pipeline
node_slack -.->|"ingests"| node_pipeline
node_whatsapp -->|"emits events"| node_pipeline
node_pipeline -->|"batches messages"| node_ingest
node_pipeline -->|"runs agent"| node_community
node_pipeline -->|"runs learning"| node_learning
node_pipeline -->|"reads mood"| node_mood
node_community -->|"searches knowledge"| node_knowledge
node_learning -->|"writes answers"| node_knowledge
node_knowledge -->|"syncs and writes"| node_notion
node_community -.->|"uses guide context"| node_guides
node_pipeline -->|"updates cases"| node_cases
node_mood -->|"scores members"| node_cases
node_cases -->|"escalates attention"| node_notify
node_notify -->|"sends alerts"| node_push
node_notify -->|"emails organizers"| node_resend
node_scheduler -.->|"runs care sweep"| node_community
node_scheduler -->|"archives digest"| node_knowledge
node_scheduler -->|"emails digest"| node_resend
node_organizers -->|"requests actions"| node_console
node_dashboard -.->|"uses API"| node_server
node_phone -.->|"uses API"| node_server
node_server -->|"serves approval state"| node_approvals
node_console -->|"creates previews"| node_approvals
node_organizers -->|"approves actions"| node_approvals
node_approvals -->|"executes approved actions"| node_actions
node_actions -.->|"sends messages"| node_telegram
node_actions -.->|"sends messages"| node_slack
node_actions -->|"sends messages"| node_whatsapp
node_actions -->|"executes guarded tools"| node_runtime
node_runtime -->|"checks policies"| node_guardrails
node_pipeline -->|"persists conversation state"| node_store
node_cases -->|"stores cases"| node_store
node_approvals -->|"stores approvals"| node_store

click node_telegram "https://github.com/rudrao2/tara/blob/main/src/channels/telegram.ts"
click node_slack "https://github.com/rudrao2/tara/blob/main/src/channels/slack.ts"
click node_whatsapp "https://github.com/rudrao2/tara/blob/main/src/channels/whatsapp.ts"
click node_ingest "https://github.com/rudrao2/tara/blob/main/src/conversation/batcher.ts"
click node_pipeline "https://github.com/rudrao2/tara/blob/main/src/pipeline.ts"
click node_community "https://github.com/rudrao2/tara/blob/main/src/agent/community.ts"
click node_learning "https://github.com/rudrao2/tara/blob/main/src/agent/learn.ts"
click node_mood "https://github.com/rudrao2/tara/blob/main/src/agent/mood.ts"
click node_cases "https://github.com/rudrao2/tara/blob/main/src/core/cases.ts"
click node_notify "https://github.com/rudrao2/tara/blob/main/src/core/notify.ts"
click node_scheduler "https://github.com/rudrao2/tara/tree/main/src/jobs"
click node_console "https://github.com/rudrao2/tara/blob/main/src/agent/console.ts"
click node_approvals "https://github.com/rudrao2/tara/blob/main/src/core/approvals.ts"
click node_actions "https://github.com/rudrao2/tara/blob/main/src/core/channels.ts"
click node_knowledge "https://github.com/rudrao2/tara/blob/main/src/kb/knowledge.ts"
click node_guides "https://github.com/rudrao2/tara/tree/main/src/kb"
click node_guardrails "https://github.com/rudrao2/tara/blob/main/src/swy/policies.ts"
click node_runtime "https://github.com/rudrao2/tara/blob/main/src/swy/exec.ts"
click node_store "https://github.com/rudrao2/tara/blob/main/src/store/repo.ts"
click node_server "https://github.com/rudrao2/tara/blob/main/src/server/app.ts"
click node_dashboard "https://github.com/rudrao2/tara/blob/main/web/src/App.tsx"
click node_phone "https://github.com/rudrao2/tara/blob/main/web/src/mobile/MobileApp.tsx"
click node_push "https://github.com/rudrao2/tara/blob/main/src/core/notify.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_telegram,node_slack,node_whatsapp,node_ingest,node_pipeline toneBlue
class node_community,node_learning,node_mood toneAmber
class node_cases,node_notify,node_scheduler,node_console,node_approvals,node_actions toneMint
class node_knowledge,node_notion,node_guides,node_guardrails,node_runtime,node_store toneRose
class node_server,node_dashboard,node_phone,node_push,node_members,node_organizers,node_resend toneIndigo
```

## Components

### Community channels

- [Telegram adapter](https://github.com/rudrao2/tara/blob/main/src/channels/telegram.ts): `src/channels/telegram.ts`
- [Slack adapter](https://github.com/rudrao2/tara/blob/main/src/channels/slack.ts): `src/channels/slack.ts`
- [WhatsApp adapter](https://github.com/rudrao2/tara/blob/main/src/channels/whatsapp.ts): `src/channels/whatsapp.ts`
- [Message batching](https://github.com/rudrao2/tara/blob/main/src/conversation/batcher.ts): `src/conversation/batcher.ts`
- [Event processing](https://github.com/rudrao2/tara/blob/main/src/pipeline.ts): `src/pipeline.ts`

### Agent and learning

- [Community agent](https://github.com/rudrao2/tara/blob/main/src/agent/community.ts): `src/agent/community.ts`
- [Learning agent](https://github.com/rudrao2/tara/blob/main/src/agent/learn.ts): `src/agent/learn.ts`
- [Mood analysis](https://github.com/rudrao2/tara/blob/main/src/agent/mood.ts): `src/agent/mood.ts`

### Care and operations

- [Member cases](https://github.com/rudrao2/tara/blob/main/src/core/cases.ts): `src/core/cases.ts`
- [Human notifications](https://github.com/rudrao2/tara/blob/main/src/core/notify.ts): `src/core/notify.ts`
- [Care and digest jobs](https://github.com/rudrao2/tara/tree/main/src/jobs): `src/jobs`
- [Operator console agent](https://github.com/rudrao2/tara/blob/main/src/agent/console.ts): `src/agent/console.ts`
- [Action approvals](https://github.com/rudrao2/tara/blob/main/src/core/approvals.ts): `src/core/approvals.ts`
- [Channel actions](https://github.com/rudrao2/tara/blob/main/src/core/channels.ts): `src/core/channels.ts`

### Knowledge and safeguards

- [Knowledge service](https://github.com/rudrao2/tara/blob/main/src/kb/knowledge.ts): `src/kb/knowledge.ts`
- **Notion knowledge base**
- [Group guides and timeline](https://github.com/rudrao2/tara/tree/main/src/kb): `src/kb`
- [Execution policies](https://github.com/rudrao2/tara/blob/main/src/swy/policies.ts): `src/swy/policies.ts`
- [Execution runtime](https://github.com/rudrao2/tara/blob/main/src/swy/exec.ts): `src/swy/exec.ts`
- [SQLite repository](https://github.com/rudrao2/tara/blob/main/src/store/repo.ts): `src/store/repo.ts`

### Organizer interfaces

- [Web API server](https://github.com/rudrao2/tara/blob/main/src/server/app.ts): `src/server/app.ts`
- [Organizer dashboard](https://github.com/rudrao2/tara/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Phone PWA](https://github.com/rudrao2/tara/blob/main/web/src/mobile/MobileApp.tsx): `web/src/mobile/MobileApp.tsx`
- [Phone push](https://github.com/rudrao2/tara/blob/main/src/core/notify.ts): `src/core/notify.ts`

### Other components

- **Community members**
- **Organizers**
- **Resend email**

## Connections

- Community members → Telegram adapter: message
- Community members → Slack adapter: message
- Community members → WhatsApp adapter: message
- Telegram adapter → Event processing: ingests
- Slack adapter → Event processing: ingests
- WhatsApp adapter → Event processing: emits events (evidence: `src/channels/whatsapp.ts`)
- Event processing → Message batching: batches messages (evidence: `src/pipeline.ts`)
- Event processing → Community agent: runs agent (evidence: `src/pipeline.ts`)
- Event processing → Learning agent: runs learning (evidence: `src/pipeline.ts`)
- Event processing → Mood analysis: reads mood (evidence: `src/pipeline.ts`)
- Community agent → Knowledge service: searches knowledge
- Learning agent → Knowledge service: writes answers (evidence: `src/agent/learn.ts`)
- Knowledge service → Notion knowledge base: syncs and writes (evidence: `src/kb/knowledge.ts`)
- Community agent → Group guides and timeline: uses guide context
- Event processing → Member cases: updates cases (evidence: `src/pipeline.ts`)
- Mood analysis → Member cases: scores members (evidence: `src/core/cases.ts`)
- Member cases → Human notifications: escalates attention (evidence: `src/core/cases.ts`)
- Human notifications → Phone push: sends alerts (evidence: `src/core/notify.ts`)
- Human notifications → Resend email: emails organizers
- Care and digest jobs → Community agent: runs care sweep
- Care and digest jobs → Knowledge service: archives digest (evidence: `src/jobs/digest.ts`)
- Care and digest jobs → Resend email: emails digest
- Organizers → Operator console agent: requests actions
- Organizer dashboard → Web API server: uses API
- Phone PWA → Web API server: uses API
- Web API server → Action approvals: serves approval state
- Operator console agent → Action approvals: creates previews (evidence: `src/agent/console.ts`)
- Organizers → Action approvals: approves actions
- Action approvals → Channel actions: executes approved actions (evidence: `src/core/approvals.ts`)
- Channel actions → Telegram adapter: sends messages (evidence: `src/core/channels.ts`)
- Channel actions → Slack adapter: sends messages (evidence: `src/core/channels.ts`)
- Channel actions → WhatsApp adapter: sends messages (evidence: `src/core/channels.ts`)
- Channel actions → Execution runtime: executes guarded tools (evidence: `src/core/channels.ts`)
- Execution runtime → Execution policies: checks policies (evidence: `src/swy/policies.ts`)
- Event processing → SQLite repository: persists conversation state (evidence: `src/pipeline.ts`)
- Member cases → SQLite repository: stores cases (evidence: `src/core/cases.ts`)
- Action approvals → SQLite repository: stores approvals (evidence: `src/core/approvals.ts`)
