# som007-builds/indigent-dev architecture

> Architecture diagram of the GitHub repository som007-builds/indigent-dev, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/som007-builds/indigent-dev
- Repository: https://github.com/som007-builds/indigent-dev

## Overview

Indigent is a sovereignty-first industrial engineering AI workbench: users submit tasks, the bounded agent routes inference and evidence/tool work, verifies results, and gates artifacts for approval. The frontend streams task updates through its API client and proxy to the backend; task and knowledge APIs expose persisted work and ingestion. README capabilities are included even where their implementation was not sampled; those links reflect documented architecture, not inspected call sites. Detailed wiring beyond the excerpts is therefore intentionally limited.

Main entry points: [`app/agent/orchestrator.py`](https://github.com/som007-builds/indigent-dev/blob/main/app/agent/orchestrator.py) (Bounded Agent), [`app/core/taskrunner.py`](https://github.com/som007-builds/indigent-dev/blob/main/app/core/taskrunner.py) (Task Runner), [`frontend/ai-harness-sih-main/app/api/[...path]/route.ts`](https://github.com/som007-builds/indigent-dev/blob/main/frontend/ai-harness-sih-main/app/api/%5B...path%5D/route.ts) (Streaming Proxy), [`app/api/tasks.py`](https://github.com/som007-builds/indigent-dev/blob/main/app/api/tasks.py) (Tasks API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Workbench"]
  node_workbench["Workbench UI<br/>[page.tsx]"]
  node_api_client["API Client<br/>[api-client.ts]"]
  node_proxy["Streaming Proxy<br/>[route.ts]"]
end

subgraph group_control["Task Control"]
  node_api_chat["Chat API<br/>[chat.py]"]
  node_taskrunner["Task Runner<br/>[taskrunner.py]"]
  node_orchestrator["Bounded Agent<br/>[orchestrator.py]"]
end

subgraph group_models["Inference Control"]
  node_router["Model Router<br/>[router.py]"]
  node_resources["Resource Manager"]
  node_providers["Inference Providers"]
end

subgraph group_evidence["Evidence and Tools"]
  node_api_knowledge["Knowledge API<br/>[knowledge.py]"]
  node_policy["Policy Validator<br/>[validator.py]"]
  node_retrieval["Evidence Retrieval<br/>[retrieval.py]"]
  node_rag_ingest["Document Ingestion<br/>[production.py]"]
  node_vector_store[("Vector Store<br/>[store.py]")]
  node_coding["Coding Agent<br/>[coding.py]"]
  node_pid["P&amp;ID Pipeline<br/>[pipeline.py]"]
  node_runtime["Tool Runtime<br/>[executor.py]"]
end

subgraph group_records["Artifacts and Records"]
  node_api_tasks["Tasks API<br/>[tasks.py]"]
  node_verification["Verification<br/>[verification.py]"]
  node_citation["Citation Checks<br/>[citation.py]"]
  node_artifact_gen["Artifact Generation<br/>[artifacts.py]"]
  node_artifact_validation["Artifact Validation<br/>[validator.py]"]
  node_approval["Human Approval<br/>[tasks.py]"]
  node_repo[("Task Repository<br/>[repo.py]")]
  node_events["Task Events<br/>[events.py]"]
  node_database[("Application Database<br/>[db.py]")]
end

node_user(("Engineer"))
node_ollama["Ollama"]
node_groq["Groq"]

node_user -->|"submits task"| node_workbench
node_workbench -->|"requests"| node_api_client
node_api_client -->|"sends API calls"| node_proxy
node_proxy -->|"forwards chat"| node_api_chat
node_proxy -->|"forwards uploads"| node_api_knowledge
node_proxy -->|"forwards task calls"| node_api_tasks
node_api_chat -->|"starts task"| node_taskrunner
node_api_knowledge -->|"ingests documents"| node_rag_ingest
node_api_tasks -->|"approves task"| node_taskrunner
node_api_tasks -->|"reads task data"| node_repo
node_api_tasks -->|"subscribes events"| node_events
node_taskrunner -->|"runs agent"| node_orchestrator
node_taskrunner -->|"persists task"| node_repo
node_taskrunner -->|"publishes updates"| node_events
node_orchestrator -->|"routes inference"| node_router
node_orchestrator -->|"checks tool proposal"| node_policy
node_orchestrator -->|"retrieves evidence"| node_retrieval
node_orchestrator -->|"delegates coding"| node_coding
node_orchestrator -->|"requests P&amp;ID analysis"| node_pid
node_orchestrator -->|"executes authorized tools"| node_runtime
node_orchestrator -->|"verifies results"| node_verification
node_orchestrator -->|"creates artifacts"| node_artifact_gen
node_orchestrator -->|"validates artifacts"| node_artifact_validation
node_orchestrator -->|"requests approval"| node_approval
node_router -->|"checks capacity"| node_resources
node_router -->|"selects provider"| node_providers
node_providers -->|"calls local inference"| node_ollama
node_providers -.->|"calls configured inference"| node_groq
node_retrieval -->|"searches evidence"| node_vector_store
node_rag_ingest -->|"stores chunks"| node_vector_store
node_verification -->|"checks citations"| node_citation
node_artifact_gen -->|"records artifacts"| node_repo
node_repo -->|"reads and writes"| node_database
node_events -->|"persists events"| node_database

click node_workbench "https://github.com/som007-builds/indigent-dev/blob/main/frontend/ai-harness-sih-main/app/page.tsx"
click node_api_client "https://github.com/som007-builds/indigent-dev/blob/main/frontend/ai-harness-sih-main/lib/api-client.ts"
click node_proxy "https://github.com/som007-builds/indigent-dev/blob/main/frontend/ai-harness-sih-main/app/api/%5B...path%5D/route.ts"
click node_api_chat "https://github.com/som007-builds/indigent-dev/blob/main/app/api/chat.py"
click node_api_knowledge "https://github.com/som007-builds/indigent-dev/blob/main/app/api/knowledge.py"
click node_api_tasks "https://github.com/som007-builds/indigent-dev/blob/main/app/api/tasks.py"
click node_taskrunner "https://github.com/som007-builds/indigent-dev/blob/main/app/core/taskrunner.py"
click node_orchestrator "https://github.com/som007-builds/indigent-dev/blob/main/app/agent/orchestrator.py"
click node_router "https://github.com/som007-builds/indigent-dev/blob/main/app/agent/router.py"
click node_resources "https://github.com/som007-builds/indigent-dev/blob/main/app/agent/resource_manager.py"
click node_providers "https://github.com/som007-builds/indigent-dev/tree/main/app/providers"
click node_policy "https://github.com/som007-builds/indigent-dev/blob/main/app/policy/validator.py"
click node_retrieval "https://github.com/som007-builds/indigent-dev/blob/main/app/rag/retrieval.py"
click node_rag_ingest "https://github.com/som007-builds/indigent-dev/blob/main/app/rag/production.py"
click node_vector_store "https://github.com/som007-builds/indigent-dev/blob/main/app/rag/store.py"
click node_coding "https://github.com/som007-builds/indigent-dev/blob/main/app/agent/coding.py"
click node_pid "https://github.com/som007-builds/indigent-dev/blob/main/app/pid_ml/pipeline.py"
click node_runtime "https://github.com/som007-builds/indigent-dev/blob/main/app/runtime/executor.py"
click node_verification "https://github.com/som007-builds/indigent-dev/blob/main/app/agent/verification.py"
click node_citation "https://github.com/som007-builds/indigent-dev/blob/main/app/rag/verification/citation.py"
click node_artifact_gen "https://github.com/som007-builds/indigent-dev/blob/main/app/core/artifacts.py"
click node_artifact_validation "https://github.com/som007-builds/indigent-dev/blob/main/app/artifact_validation/validator.py"
click node_approval "https://github.com/som007-builds/indigent-dev/blob/main/app/api/tasks.py"
click node_repo "https://github.com/som007-builds/indigent-dev/blob/main/app/core/repo.py"
click node_events "https://github.com/som007-builds/indigent-dev/blob/main/app/core/events.py"
click node_database "https://github.com/som007-builds/indigent-dev/blob/main/app/core/db.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_workbench,node_api_client,node_proxy toneBlue
class node_api_chat,node_taskrunner,node_orchestrator toneAmber
class node_router,node_resources,node_providers toneMint
class node_api_knowledge,node_policy,node_retrieval,node_rag_ingest,node_vector_store,node_coding,node_pid,node_runtime toneRose
class node_api_tasks,node_verification,node_citation,node_artifact_gen,node_artifact_validation,node_approval,node_repo,node_events,node_database,node_user,node_ollama,node_groq toneIndigo
```

## Components

### Workbench

- [Workbench UI](https://github.com/som007-builds/indigent-dev/blob/main/frontend/ai-harness-sih-main/app/page.tsx): `frontend/ai-harness-sih-main/app/page.tsx`
- [API Client](https://github.com/som007-builds/indigent-dev/blob/main/frontend/ai-harness-sih-main/lib/api-client.ts): `frontend/ai-harness-sih-main/lib/api-client.ts`
- [Streaming Proxy](https://github.com/som007-builds/indigent-dev/blob/main/frontend/ai-harness-sih-main/app/api/%5B...path%5D/route.ts): `frontend/ai-harness-sih-main/app/api/[...path]/route.ts`

### Task Control

- [Chat API](https://github.com/som007-builds/indigent-dev/blob/main/app/api/chat.py): `app/api/chat.py`
- [Task Runner](https://github.com/som007-builds/indigent-dev/blob/main/app/core/taskrunner.py): `app/core/taskrunner.py`
- [Bounded Agent](https://github.com/som007-builds/indigent-dev/blob/main/app/agent/orchestrator.py): `app/agent/orchestrator.py`

### Inference Control

- [Model Router](https://github.com/som007-builds/indigent-dev/blob/main/app/agent/router.py): `app/agent/router.py`
- [Resource Manager](https://github.com/som007-builds/indigent-dev/blob/main/app/agent/resource_manager.py): `app/agent/resource_manager.py`
- [Inference Providers](https://github.com/som007-builds/indigent-dev/tree/main/app/providers): `app/providers`

### Evidence and Tools

- [Knowledge API](https://github.com/som007-builds/indigent-dev/blob/main/app/api/knowledge.py): `app/api/knowledge.py`
- [Policy Validator](https://github.com/som007-builds/indigent-dev/blob/main/app/policy/validator.py): `app/policy/validator.py`
- [Evidence Retrieval](https://github.com/som007-builds/indigent-dev/blob/main/app/rag/retrieval.py): `app/rag/retrieval.py`
- [Document Ingestion](https://github.com/som007-builds/indigent-dev/blob/main/app/rag/production.py): `app/rag/production.py`
- [Vector Store](https://github.com/som007-builds/indigent-dev/blob/main/app/rag/store.py): `app/rag/store.py`
- [Coding Agent](https://github.com/som007-builds/indigent-dev/blob/main/app/agent/coding.py): `app/agent/coding.py`
- [P&ID Pipeline](https://github.com/som007-builds/indigent-dev/blob/main/app/pid_ml/pipeline.py): `app/pid_ml/pipeline.py`
- [Tool Runtime](https://github.com/som007-builds/indigent-dev/blob/main/app/runtime/executor.py): `app/runtime/executor.py`

### Artifacts and Records

- [Tasks API](https://github.com/som007-builds/indigent-dev/blob/main/app/api/tasks.py): `app/api/tasks.py`
- [Verification](https://github.com/som007-builds/indigent-dev/blob/main/app/agent/verification.py): `app/agent/verification.py`
- [Citation Checks](https://github.com/som007-builds/indigent-dev/blob/main/app/rag/verification/citation.py): `app/rag/verification/citation.py`
- [Artifact Generation](https://github.com/som007-builds/indigent-dev/blob/main/app/core/artifacts.py): `app/core/artifacts.py`
- [Artifact Validation](https://github.com/som007-builds/indigent-dev/blob/main/app/artifact_validation/validator.py): `app/artifact_validation/validator.py`
- [Human Approval](https://github.com/som007-builds/indigent-dev/blob/main/app/api/tasks.py): `app/api/tasks.py`
- [Task Repository](https://github.com/som007-builds/indigent-dev/blob/main/app/core/repo.py): `app/core/repo.py`
- [Task Events](https://github.com/som007-builds/indigent-dev/blob/main/app/core/events.py): `app/core/events.py`
- [Application Database](https://github.com/som007-builds/indigent-dev/blob/main/app/core/db.py): `app/core/db.py`

### Other components

- **Engineer**
- **Ollama**
- **Groq**

## Connections

- Engineer → Workbench UI: submits task
- Workbench UI → API Client: requests
- API Client → Streaming Proxy: sends API calls
- Streaming Proxy → Chat API: forwards chat
- Streaming Proxy → Knowledge API: forwards uploads
- Streaming Proxy → Tasks API: forwards task calls
- Chat API → Task Runner: starts task
- Knowledge API → Document Ingestion: ingests documents
- Tasks API → Task Runner: approves task
- Tasks API → Task Repository: reads task data
- Tasks API → Task Events: subscribes events
- Task Runner → Bounded Agent: runs agent
- Task Runner → Task Repository: persists task
- Task Runner → Task Events: publishes updates
- Bounded Agent → Model Router: routes inference
- Bounded Agent → Policy Validator: checks tool proposal
- Bounded Agent → Evidence Retrieval: retrieves evidence
- Bounded Agent → Coding Agent: delegates coding
- Bounded Agent → P&ID Pipeline: requests P&ID analysis
- Bounded Agent → Tool Runtime: executes authorized tools
- Bounded Agent → Verification: verifies results
- Bounded Agent → Artifact Generation: creates artifacts
- Bounded Agent → Artifact Validation: validates artifacts
- Bounded Agent → Human Approval: requests approval
- Model Router → Resource Manager: checks capacity
- Model Router → Inference Providers: selects provider
- Inference Providers → Ollama: calls local inference
- Inference Providers → Groq: calls configured inference
- Evidence Retrieval → Vector Store: searches evidence
- Document Ingestion → Vector Store: stores chunks
- Verification → Citation Checks: checks citations
- Artifact Generation → Task Repository: records artifacts
- Task Repository → Application Database: reads and writes
- Task Events → Application Database: persists events
