# deep4211/autonomiq architecture

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

- Interactive diagram: https://gitdiagram.com/deep4211/autonomiq
- Repository: https://github.com/deep4211/autonomiq

## Overview

AutonomIQ simulates an autonomous company: the founder sets goals, budget, and risk limits; agents plan and run weekly business cycles; the founder reviews escalations and results. The graph preserves the documented setup, operating, governance, continuity, reporting, and analytics capabilities. Several page and engine modules are represented by their exact paths but were not excerpted; those links are included only where README statements or the SOURCE INDEX support them.

Main entry points: [`src/lib/state.ts`](https://github.com/deep4211/autonomiq/blob/main/src/lib/state.ts) (State assembly), [`src/app/api`](https://github.com/deep4211/autonomiq/tree/main/src/app/api) (Company API), [`src/lib/engine/cycle.ts`](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/cycle.ts) (Weekly cycle), [`src/lib/db/repository.ts`](https://github.com/deep4211/autonomiq/blob/main/src/lib/db/repository.ts) (Company repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Founder experience"]
  node_setup["Founder setup<br/>[page.tsx]"]
  node_command["Command center<br/>[page.tsx]"]
  node_work_views["Work views<br/>[page.tsx]"]
  node_org_view["Agent org chart<br/>[page.tsx]"]
  node_feed_view["Decision feed<br/>[page.tsx]"]
  node_kpi_view["Revenue and KPIs<br/>[page.tsx]"]
  node_budget_view["Budget view<br/>[page.tsx]"]
  node_charts["Charts<br/>[index.tsx]"]
  node_provider["Company client"]
end

subgraph group_governance["Company governance"]
  node_approval_view["Approval center<br/>[page.tsx]"]
  node_audit_view["Audit trail<br/>[page.tsx]"]
  node_directives["Strategy directives<br/>[route.ts]"]
  node_policies["Approval policies<br/>[route.ts]"]
  node_guardrails["Guardrail checks<br/>[guardrails.ts]"]
end

subgraph group_operations["Autonomous operations"]
  node_cycle["Weekly cycle<br/>[cycle.ts]"]
  node_planning["Task planning<br/>[planning.ts]"]
  node_execution["Task execution<br/>[execution.ts]"]
  node_funnel["Revenue funnel<br/>[funnel.ts]"]
  node_market_learning["Market and learning<br/>[market.ts]"]
  node_llm["Language provider<br/>[provider.ts]"]
end

subgraph group_continuity["Business continuity"]
  node_bootstrap["Company bootstrap<br/>[bootstrap.ts]"]
  node_continuity["Quarter and fork<br/>[continuity.ts]"]
  node_seed["Demo seeding<br/>[demo.ts]"]
end

subgraph group_platform["State and reporting"]
  node_api["Company API"]
  node_state["State assembly<br/>[state.ts]"]
  node_repository[("Company repository<br/>[repository.ts]")]
  node_database[("SQLite database<br/>[client.ts]")]
  node_boardpack["Board pack<br/>[boardPack.ts]"]
  node_scoring["Derived metrics<br/>[scoring.ts]"]
end

node_founder(("Founder"))

node_founder -->|"sets goals"| node_setup
node_setup -->|"submits setup"| node_api
node_api -->|"bootstraps company"| node_bootstrap
node_founder -->|"monitors company"| node_command
node_founder -->|"reviews escalations"| node_approval_view
node_founder -->|"issues directives"| node_directives
node_founder -->|"delegates approvals"| node_policies
node_founder -->|"runs next cycle"| node_cycle
node_api -->|"runs cycle"| node_cycle
node_cycle -->|"plans tasks"| node_planning
node_cycle -->|"executes tasks"| node_execution
node_cycle -->|"resolves directives"| node_directives
node_planning -->|"uses funnel"| node_funnel
node_cycle -.->|"gets language provider"| node_llm
node_cycle -.->|"checks guardrails"| node_guardrails
node_cycle -.->|"updates business model"| node_market_learning
node_api -->|"forks company"| node_continuity
node_api -->|"starts quarter"| node_continuity
node_seed -->|"seeds company"| node_bootstrap
node_seed -->|"runs seed cycles"| node_cycle
node_api -->|"reads and writes"| node_repository
node_api -->|"loads snapshot"| node_state
node_state -->|"loads records"| node_repository
node_state -->|"computes metrics"| node_scoring
node_repository -->|"uses database client"| node_database
node_api -->|"builds board pack"| node_boardpack
node_boardpack -.->|"reads audit history"| node_repository
node_provider -.->|"requests state"| node_api
node_command -.->|"renders snapshot"| node_state
node_work_views -.->|"renders tasks"| node_state
node_org_view -.->|"renders agents"| node_state
node_feed_view -.->|"renders decisions"| node_state
node_kpi_view -.->|"renders metrics"| node_state
node_budget_view -.->|"renders budget"| node_state
node_approval_view -.->|"renders approvals"| node_state
node_audit_view -.->|"renders audit"| node_state
node_charts -.->|"visualizes revenue"| node_command

click node_setup "https://github.com/deep4211/autonomiq/blob/main/src/app/setup/page.tsx"
click node_command "https://github.com/deep4211/autonomiq/blob/main/src/app/dashboard/page.tsx"
click node_work_views "https://github.com/deep4211/autonomiq/blob/main/src/app/tasks/page.tsx"
click node_org_view "https://github.com/deep4211/autonomiq/blob/main/src/app/org/page.tsx"
click node_feed_view "https://github.com/deep4211/autonomiq/blob/main/src/app/feed/page.tsx"
click node_kpi_view "https://github.com/deep4211/autonomiq/blob/main/src/app/kpi/page.tsx"
click node_budget_view "https://github.com/deep4211/autonomiq/blob/main/src/app/budget/page.tsx"
click node_approval_view "https://github.com/deep4211/autonomiq/blob/main/src/app/approvals/page.tsx"
click node_audit_view "https://github.com/deep4211/autonomiq/blob/main/src/app/audit/page.tsx"
click node_directives "https://github.com/deep4211/autonomiq/blob/main/src/app/api/directives/route.ts"
click node_policies "https://github.com/deep4211/autonomiq/blob/main/src/app/api/policies/route.ts"
click node_api "https://github.com/deep4211/autonomiq/tree/main/src/app/api"
click node_cycle "https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/cycle.ts"
click node_planning "https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/planning.ts"
click node_execution "https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/execution.ts"
click node_funnel "https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/funnel.ts"
click node_guardrails "https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/guardrails.ts"
click node_market_learning "https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/market.ts"
click node_llm "https://github.com/deep4211/autonomiq/blob/main/src/lib/llm/provider.ts"
click node_bootstrap "https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/bootstrap.ts"
click node_continuity "https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/continuity.ts"
click node_seed "https://github.com/deep4211/autonomiq/blob/main/src/lib/seed/demo.ts"
click node_state "https://github.com/deep4211/autonomiq/blob/main/src/lib/state.ts"
click node_repository "https://github.com/deep4211/autonomiq/blob/main/src/lib/db/repository.ts"
click node_database "https://github.com/deep4211/autonomiq/blob/main/src/lib/db/client.ts"
click node_boardpack "https://github.com/deep4211/autonomiq/blob/main/src/lib/reporting/boardPack.ts"
click node_scoring "https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/scoring.ts"
click node_charts "https://github.com/deep4211/autonomiq/blob/main/src/components/charts/index.tsx"
click node_provider "https://github.com/deep4211/autonomiq/blob/main/src/components/providers/CompanyProvider.tsx"

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_setup,node_command,node_work_views,node_org_view,node_feed_view,node_kpi_view,node_budget_view,node_charts,node_provider toneBlue
class node_approval_view,node_audit_view,node_directives,node_policies,node_guardrails toneAmber
class node_cycle,node_planning,node_execution,node_funnel,node_market_learning,node_llm toneMint
class node_bootstrap,node_continuity,node_seed toneRose
class node_api,node_state,node_repository,node_database,node_boardpack,node_scoring,node_founder toneIndigo
```

## Components

### Founder experience

- [Founder setup](https://github.com/deep4211/autonomiq/blob/main/src/app/setup/page.tsx): `src/app/setup/page.tsx`
- [Command center](https://github.com/deep4211/autonomiq/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Work views](https://github.com/deep4211/autonomiq/blob/main/src/app/tasks/page.tsx): `src/app/tasks/page.tsx`
- [Agent org chart](https://github.com/deep4211/autonomiq/blob/main/src/app/org/page.tsx): `src/app/org/page.tsx`
- [Decision feed](https://github.com/deep4211/autonomiq/blob/main/src/app/feed/page.tsx): `src/app/feed/page.tsx`
- [Revenue and KPIs](https://github.com/deep4211/autonomiq/blob/main/src/app/kpi/page.tsx): `src/app/kpi/page.tsx`
- [Budget view](https://github.com/deep4211/autonomiq/blob/main/src/app/budget/page.tsx): `src/app/budget/page.tsx`
- [Charts](https://github.com/deep4211/autonomiq/blob/main/src/components/charts/index.tsx): `src/components/charts/index.tsx`
- [Company client](https://github.com/deep4211/autonomiq/blob/main/src/components/providers/CompanyProvider.tsx): `src/components/providers/CompanyProvider.tsx`

### Company governance

- [Approval center](https://github.com/deep4211/autonomiq/blob/main/src/app/approvals/page.tsx): `src/app/approvals/page.tsx`
- [Audit trail](https://github.com/deep4211/autonomiq/blob/main/src/app/audit/page.tsx): `src/app/audit/page.tsx`
- [Strategy directives](https://github.com/deep4211/autonomiq/blob/main/src/app/api/directives/route.ts): `src/app/api/directives/route.ts`
- [Approval policies](https://github.com/deep4211/autonomiq/blob/main/src/app/api/policies/route.ts): `src/app/api/policies/route.ts`
- [Guardrail checks](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/guardrails.ts): `src/lib/engine/guardrails.ts`

### Autonomous operations

- [Weekly cycle](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/cycle.ts): `src/lib/engine/cycle.ts`
- [Task planning](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/planning.ts): `src/lib/engine/planning.ts`
- [Task execution](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/execution.ts): `src/lib/engine/execution.ts`
- [Revenue funnel](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/funnel.ts): `src/lib/engine/funnel.ts`
- [Market and learning](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/market.ts): `src/lib/engine/market.ts`
- [Language provider](https://github.com/deep4211/autonomiq/blob/main/src/lib/llm/provider.ts): `src/lib/llm/provider.ts`

### Business continuity

- [Company bootstrap](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/bootstrap.ts): `src/lib/engine/bootstrap.ts`
- [Quarter and fork](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/continuity.ts): `src/lib/engine/continuity.ts`
- [Demo seeding](https://github.com/deep4211/autonomiq/blob/main/src/lib/seed/demo.ts): `src/lib/seed/demo.ts`

### State and reporting

- [Company API](https://github.com/deep4211/autonomiq/tree/main/src/app/api): `src/app/api`
- [State assembly](https://github.com/deep4211/autonomiq/blob/main/src/lib/state.ts): `src/lib/state.ts`
- [Company repository](https://github.com/deep4211/autonomiq/blob/main/src/lib/db/repository.ts): `src/lib/db/repository.ts`
- [SQLite database](https://github.com/deep4211/autonomiq/blob/main/src/lib/db/client.ts): `src/lib/db/client.ts`
- [Board pack](https://github.com/deep4211/autonomiq/blob/main/src/lib/reporting/boardPack.ts): `src/lib/reporting/boardPack.ts`
- [Derived metrics](https://github.com/deep4211/autonomiq/blob/main/src/lib/engine/scoring.ts): `src/lib/engine/scoring.ts`

### Other components

- **Founder**

## Connections

- Founder → Founder setup: sets goals (evidence: `README.md`)
- Founder setup → Company API: submits setup (evidence: `README.md`)
- Company API → Company bootstrap: bootstraps company (evidence: `src/app/api/company/route.ts`)
- Founder → Command center: monitors company (evidence: `README.md`)
- Founder → Approval center: reviews escalations (evidence: `README.md`)
- Founder → Strategy directives: issues directives (evidence: `README.md`)
- Founder → Approval policies: delegates approvals (evidence: `README.md`)
- Founder → Weekly cycle: runs next cycle (evidence: `README.md`)
- Company API → Weekly cycle: runs cycle (evidence: `src/app/api/cycle/route.ts`)
- Weekly cycle → Task planning: plans tasks (evidence: `src/lib/engine/cycle.ts`)
- Weekly cycle → Task execution: executes tasks (evidence: `src/lib/engine/cycle.ts`)
- Weekly cycle → Strategy directives: resolves directives (evidence: `src/lib/engine/cycle.ts`)
- Task planning → Revenue funnel: uses funnel (evidence: `src/lib/engine/planning.ts`)
- Weekly cycle → Language provider: gets language provider (evidence: `src/lib/engine/cycle.ts`)
- Weekly cycle → Guardrail checks: checks guardrails (evidence: `src/lib/engine/cycle.ts`)
- Weekly cycle → Market and learning: updates business model (evidence: `README.md`)
- Company API → Quarter and fork: forks company (evidence: `src/app/api/fork/route.ts`)
- Company API → Quarter and fork: starts quarter (evidence: `src/app/api/quarter/route.ts`)
- Demo seeding → Company bootstrap: seeds company (evidence: `src/lib/seed/demo.ts`)
- Demo seeding → Weekly cycle: runs seed cycles (evidence: `src/lib/seed/demo.ts`)
- Company API → Company repository: reads and writes (evidence: `src/app/api/approvals/[id]/route.ts`)
- Company API → State assembly: loads snapshot (evidence: `src/app/api/companies/route.ts`)
- State assembly → Company repository: loads records (evidence: `src/lib/state.ts`)
- State assembly → Derived metrics: computes metrics (evidence: `src/lib/state.ts`)
- Company repository → SQLite database: uses database client (evidence: `src/lib/db/repository.ts`)
- Company API → Board pack: builds board pack (evidence: `src/app/api/board-pack/route.ts`)
- Board pack → Company repository: reads audit history
- Company client → Company API: requests state (evidence: `src/components/providers/CompanyProvider.tsx`)
- Command center → State assembly: renders snapshot (evidence: `README.md`)
- Work views → State assembly: renders tasks (evidence: `README.md`)
- Agent org chart → State assembly: renders agents (evidence: `README.md`)
- Decision feed → State assembly: renders decisions (evidence: `README.md`)
- Revenue and KPIs → State assembly: renders metrics (evidence: `README.md`)
- Budget view → State assembly: renders budget (evidence: `README.md`)
- Approval center → State assembly: renders approvals (evidence: `README.md`)
- Audit trail → State assembly: renders audit (evidence: `README.md`)
- Charts → Command center: visualizes revenue (evidence: `README.md`)
