# 0xdave1/triggerly architecture

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

- Interactive diagram: https://gitdiagram.com/0xdave1/triggerly
- Repository: https://github.com/0xdave1/triggerly

## Overview

Triggerly is a privacy-first, confirmation-based assistant with an Expo client and NestJS/PostgreSQL backend. Its primary flow is a user request in chat, classification and plan creation, user review, then execution of confirmed items through capability services. Other product branches include reminders and triggers, memory and ledgers, live-context alerts, briefings, actions, voice, and privacy controls. The AI worker exposes separate analysis endpoints. Some subsystem links are based on README descriptions; unsampled implementation details are represented only at their supported directory paths.

Main entry points: [`backend/src/agent/agent-orchestrator.service.ts`](https://github.com/0xdave1/triggerly/blob/main/backend/src/agent/agent-orchestrator.service.ts) (Agent orchestration), [`backend/src/prisma/prisma.service.ts`](https://github.com/0xdave1/triggerly/blob/main/backend/src/prisma/prisma.service.ts) (PostgreSQL data), [`backend/src/chat`](https://github.com/0xdave1/triggerly/tree/main/backend/src/chat) (Chat handling), [`src/components/chat/ChatScreen.tsx`](https://github.com/0xdave1/triggerly/blob/main/src/components/chat/ChatScreen.tsx) (Chat surface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Assistant client"]
  node_chat_ui["Chat surface<br/>[ChatScreen.tsx]"]
  node_chat_api["Chat API client<br/>[api.ts]"]
  node_api_client["API transport<br/>[apiClient.ts]"]
end

subgraph group_conversation["Conversation and planning"]
  node_chat_backend["Chat handling"]
  node_agent["Agent orchestration"]
  node_planner["Plan generation"]
  node_tool_registry["Tool dispatch"]
  node_ai_service["AI services"]
end

subgraph group_capabilities["User capabilities"]
  node_reminders["Reminders and triggers"]
  node_memory["Memory and ledgers"]
  node_live_context["Live context"]
  node_actions["Prepared actions"]
  node_briefings["Briefings"]
  node_voice["Voice settings"]
  node_privacy["Privacy controls"]
end

subgraph group_platform["Backend platform"]
  node_auth["Authentication"]
  node_postgres[("PostgreSQL data<br/>[prisma.service.ts]")]
end

subgraph group_analysis["AI analysis"]
  node_ai_worker["AI worker API<br/>[main.py]"]
  node_worker_heuristics["Worker heuristics<br/>[heuristics.py]"]
end

node_user(("User"))

node_user -->|"sends request"| node_chat_ui
node_chat_ui -->|"submits message"| node_chat_api
node_chat_api -.->|"uses transport"| node_api_client
node_api_client -->|"calls API"| node_chat_backend
node_chat_backend -->|"creates task run"| node_agent
node_chat_backend -->|"classifies message"| node_ai_service
node_agent -->|"requests plan"| node_planner
node_agent -->|"dispatches tools"| node_tool_registry
node_agent -->|"executes confirmed items"| node_reminders
node_agent -->|"executes confirmed items"| node_memory
node_agent -->|"executes confirmed items"| node_live_context
node_agent -->|"executes confirmed items"| node_actions
node_agent -->|"checks capability gates"| node_privacy
node_reminders -.->|"persists user data"| node_postgres
node_memory -->|"stores approved facts"| node_postgres
node_live_context -->|"stores triggers and logs"| node_postgres
node_briefings -->|"uses preferences"| node_postgres
node_voice -.->|"stores settings"| node_postgres
node_auth -.->|"persists accounts"| node_postgres
node_ai_worker -->|"calls analysis functions"| node_worker_heuristics

click node_chat_ui "https://github.com/0xdave1/triggerly/blob/main/src/components/chat/ChatScreen.tsx"
click node_chat_api "https://github.com/0xdave1/triggerly/blob/main/src/features/chat/api.ts"
click node_api_client "https://github.com/0xdave1/triggerly/blob/main/src/lib/apiClient.ts"
click node_chat_backend "https://github.com/0xdave1/triggerly/tree/main/backend/src/chat"
click node_agent "https://github.com/0xdave1/triggerly/blob/main/backend/src/agent/agent-orchestrator.service.ts"
click node_planner "https://github.com/0xdave1/triggerly/blob/main/backend/src/agent/agent-planner.service.ts"
click node_tool_registry "https://github.com/0xdave1/triggerly/blob/main/backend/src/agent/tools/tool-registry.service.ts"
click node_ai_service "https://github.com/0xdave1/triggerly/tree/main/backend/src/ai"
click node_reminders "https://github.com/0xdave1/triggerly/tree/main/backend/src/reminders"
click node_memory "https://github.com/0xdave1/triggerly/tree/main/backend/src/memory"
click node_live_context "https://github.com/0xdave1/triggerly/blob/main/backend/src/live-context/live-context.service.ts"
click node_actions "https://github.com/0xdave1/triggerly/tree/main/backend/src/action-prompts"
click node_briefings "https://github.com/0xdave1/triggerly/tree/main/backend/src/briefings"
click node_voice "https://github.com/0xdave1/triggerly/tree/main/backend/src/voice"
click node_privacy "https://github.com/0xdave1/triggerly/tree/main/backend/src/privacy"
click node_auth "https://github.com/0xdave1/triggerly/tree/main/backend/src/auth"
click node_postgres "https://github.com/0xdave1/triggerly/blob/main/backend/src/prisma/prisma.service.ts"
click node_ai_worker "https://github.com/0xdave1/triggerly/blob/main/ai-worker/app/main.py"
click node_worker_heuristics "https://github.com/0xdave1/triggerly/blob/main/ai-worker/app/heuristics.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_chat_ui,node_chat_api,node_api_client,node_user toneBlue
class node_chat_backend,node_agent,node_planner,node_tool_registry,node_ai_service toneAmber
class node_reminders,node_memory,node_live_context,node_actions,node_briefings,node_voice,node_privacy toneMint
class node_auth,node_postgres toneRose
class node_ai_worker,node_worker_heuristics toneIndigo
```

## Components

### Assistant client

- [Chat surface](https://github.com/0xdave1/triggerly/blob/main/src/components/chat/ChatScreen.tsx): `src/components/chat/ChatScreen.tsx`
- [Chat API client](https://github.com/0xdave1/triggerly/blob/main/src/features/chat/api.ts): `src/features/chat/api.ts`
- [API transport](https://github.com/0xdave1/triggerly/blob/main/src/lib/apiClient.ts): `src/lib/apiClient.ts`

### Conversation and planning

- [Chat handling](https://github.com/0xdave1/triggerly/tree/main/backend/src/chat): `backend/src/chat`
- [Agent orchestration](https://github.com/0xdave1/triggerly/blob/main/backend/src/agent/agent-orchestrator.service.ts): `backend/src/agent/agent-orchestrator.service.ts`
- [Plan generation](https://github.com/0xdave1/triggerly/blob/main/backend/src/agent/agent-planner.service.ts): `backend/src/agent/agent-planner.service.ts`
- [Tool dispatch](https://github.com/0xdave1/triggerly/blob/main/backend/src/agent/tools/tool-registry.service.ts): `backend/src/agent/tools/tool-registry.service.ts`
- [AI services](https://github.com/0xdave1/triggerly/tree/main/backend/src/ai): `backend/src/ai`

### User capabilities

- [Reminders and triggers](https://github.com/0xdave1/triggerly/tree/main/backend/src/reminders): `backend/src/reminders`
- [Memory and ledgers](https://github.com/0xdave1/triggerly/tree/main/backend/src/memory): `backend/src/memory`
- [Live context](https://github.com/0xdave1/triggerly/blob/main/backend/src/live-context/live-context.service.ts): `backend/src/live-context/live-context.service.ts`
- [Prepared actions](https://github.com/0xdave1/triggerly/tree/main/backend/src/action-prompts): `backend/src/action-prompts`
- [Briefings](https://github.com/0xdave1/triggerly/tree/main/backend/src/briefings): `backend/src/briefings`
- [Voice settings](https://github.com/0xdave1/triggerly/tree/main/backend/src/voice): `backend/src/voice`
- [Privacy controls](https://github.com/0xdave1/triggerly/tree/main/backend/src/privacy): `backend/src/privacy`

### Backend platform

- [Authentication](https://github.com/0xdave1/triggerly/tree/main/backend/src/auth): `backend/src/auth`
- [PostgreSQL data](https://github.com/0xdave1/triggerly/blob/main/backend/src/prisma/prisma.service.ts): `backend/src/prisma/prisma.service.ts`

### AI analysis

- [AI worker API](https://github.com/0xdave1/triggerly/blob/main/ai-worker/app/main.py): `ai-worker/app/main.py`
- [Worker heuristics](https://github.com/0xdave1/triggerly/blob/main/ai-worker/app/heuristics.py): `ai-worker/app/heuristics.py`

### Other components

- **User**

## Connections

- User → Chat surface: sends request
- Chat surface → Chat API client: submits message
- Chat API client → API transport: uses transport
- API transport → Chat handling: calls API
- Chat handling → Agent orchestration: creates task run
- Chat handling → AI services: classifies message
- Agent orchestration → Plan generation: requests plan (evidence: `backend/src/agent/agent-orchestrator.service.ts`)
- Agent orchestration → Tool dispatch: dispatches tools (evidence: `backend/src/agent/agent-orchestrator.service.ts`)
- Agent orchestration → Reminders and triggers: executes confirmed items (evidence: `backend/src/agent/agent-orchestrator.service.ts`)
- Agent orchestration → Memory and ledgers: executes confirmed items (evidence: `backend/src/agent/agent-orchestrator.service.ts`)
- Agent orchestration → Live context: executes confirmed items (evidence: `backend/src/agent/agent-orchestrator.service.ts`)
- Agent orchestration → Prepared actions: executes confirmed items (evidence: `backend/src/agent/agent-orchestrator.service.ts`)
- Agent orchestration → Privacy controls: checks capability gates (evidence: `backend/src/agent/agent-orchestrator.service.ts`)
- Reminders and triggers → PostgreSQL data: persists user data
- Memory and ledgers → PostgreSQL data: stores approved facts
- Live context → PostgreSQL data: stores triggers and logs (evidence: `backend/src/live-context/live-context.service.ts`)
- Briefings → PostgreSQL data: uses preferences
- Voice settings → PostgreSQL data: stores settings
- Authentication → PostgreSQL data: persists accounts
- AI worker API → Worker heuristics: calls analysis functions (evidence: `ai-worker/app/main.py`)
