# mandavavasanth/voicespec architecture

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

- Interactive diagram: https://gitdiagram.com/mandavavasanth/voicespec
- Repository: https://github.com/mandavavasanth/voicespec

## Overview

VoiceSpec turns a pasted discovery transcript into a structured, evidence-linked product specification, then lets users edit and export it. The primary flow runs from the transcript workspace through the generate API and pipeline, which normalizes and segments input, calls Gemini or deterministic demo/fallback generation, then grounds evidence and checks integrity. The spec and transcript panes support provenance highlighting; toolbar actions provide Markdown, agent-prompt, GitHub-script, and per-task issue-body exports. Relationships reflect the README, SOURCE INDEX, and shown excerpts; unsampled implementations are represented only where documented or indexed.

Main entry points: [`lib/pipeline.ts`](https://github.com/mandavavasanth/voicespec/blob/main/lib/pipeline.ts) (Pipeline orchestrator), [`app/page.tsx`](https://github.com/mandavavasanth/voicespec/blob/main/app/page.tsx) (Workspace shell), [`components/Toolbar.tsx`](https://github.com/mandavavasanth/voicespec/blob/main/components/Toolbar.tsx) (Export toolbar), [`components/TranscriptPane.tsx`](https://github.com/mandavavasanth/voicespec/blob/main/components/TranscriptPane.tsx) (Transcript editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Specification workspace"]
  node_workspace["Workspace shell<br/>[page.tsx]"]
  node_transcript_ui["Transcript editor<br/>[TranscriptPane.tsx]"]
  node_spec_ui["Specification view<br/>[SpecPane.tsx]"]
  node_section_card["Editable section cards<br/>[SectionCard.tsx]"]
  node_provenance_ui["Provenance thread"]
  node_toolbar["Export toolbar<br/>[Toolbar.tsx]"]
  node_state["Client state<br/>[store.ts]"]
end

subgraph group_generation["Generation pipeline"]
  node_generate_api["Generate API<br/>[route.ts]"]
  node_pipeline["Pipeline orchestrator<br/>[pipeline.ts]"]
  node_normalize["Transcript normalization<br/>[normalize.ts]"]
  node_segment["Sentence segmentation<br/>[segment.ts]"]
  node_prompt["Prompt construction<br/>[prompt.ts]"]
  node_gemini["Gemini generation<br/>[gemini.ts]"]
  node_fallback["Demo and fallback specs<br/>[fallback.ts]"]
end

subgraph group_grounding["Evidence and validation"]
  node_schema["Specification schema<br/>[schema.ts]"]
  node_provenance["Evidence grounding<br/>[provenance.ts]"]
  node_integrity["Integrity checks<br/>[integrity.ts]"]
  node_evidence_index["Evidence index<br/>[evidence-index.ts]"]
end

subgraph group_exports["Exports"]
  node_markdown["Markdown export<br/>[markdown.ts]"]
  node_agent_prompt["Agent prompt export<br/>[agent-prompt.ts]"]
  node_github_export["GitHub script export<br/>[github-export.ts]"]
end

node_user(("Product user"))
node_google{{"Google Gemini"}}

node_user -->|"enters transcript"| node_transcript_ui
node_workspace -->|"renders"| node_transcript_ui
node_workspace -->|"renders"| node_spec_ui
node_workspace -->|"renders"| node_provenance_ui
node_workspace -->|"renders"| node_toolbar
node_transcript_ui -->|"uses state"| node_state
node_spec_ui -->|"renders"| node_section_card
node_spec_ui -->|"uses state"| node_state
node_provenance_ui -->|"indexes evidence"| node_evidence_index
node_transcript_ui -->|"highlights evidence"| node_evidence_index
node_state -->|"posts transcript"| node_generate_api
node_generate_api -->|"runs"| node_pipeline
node_pipeline -->|"normalizes"| node_normalize
node_pipeline -->|"segments"| node_segment
node_pipeline -->|"builds prompt"| node_prompt
node_pipeline -->|"requests spec"| node_gemini
node_gemini -->|"calls API"| node_google
node_pipeline -->|"generates fallback"| node_fallback
node_pipeline -->|"verifies evidence"| node_provenance
node_pipeline -->|"checks integrity"| node_integrity
node_pipeline -->|"uses spec type"| node_schema
node_toolbar -->|"exports Markdown"| node_markdown
node_toolbar -->|"builds agent prompt"| node_agent_prompt
node_toolbar -->|"builds GitHub script"| node_github_export
node_agent_prompt -->|"uses spec type"| node_schema
node_markdown -->|"uses spec type"| node_schema
node_github_export -->|"uses spec type"| node_schema

click node_workspace "https://github.com/mandavavasanth/voicespec/blob/main/app/page.tsx"
click node_transcript_ui "https://github.com/mandavavasanth/voicespec/blob/main/components/TranscriptPane.tsx"
click node_spec_ui "https://github.com/mandavavasanth/voicespec/blob/main/components/SpecPane.tsx"
click node_section_card "https://github.com/mandavavasanth/voicespec/blob/main/components/SectionCard.tsx"
click node_provenance_ui "https://github.com/mandavavasanth/voicespec/blob/main/components/ProvenanceThread.tsx"
click node_toolbar "https://github.com/mandavavasanth/voicespec/blob/main/components/Toolbar.tsx"
click node_state "https://github.com/mandavavasanth/voicespec/blob/main/lib/store.ts"
click node_generate_api "https://github.com/mandavavasanth/voicespec/blob/main/app/api/generate/route.ts"
click node_pipeline "https://github.com/mandavavasanth/voicespec/blob/main/lib/pipeline.ts"
click node_normalize "https://github.com/mandavavasanth/voicespec/blob/main/lib/normalize.ts"
click node_segment "https://github.com/mandavavasanth/voicespec/blob/main/lib/segment.ts"
click node_prompt "https://github.com/mandavavasanth/voicespec/blob/main/lib/prompt.ts"
click node_gemini "https://github.com/mandavavasanth/voicespec/blob/main/lib/gemini.ts"
click node_fallback "https://github.com/mandavavasanth/voicespec/blob/main/lib/fallback.ts"
click node_schema "https://github.com/mandavavasanth/voicespec/blob/main/lib/schema.ts"
click node_provenance "https://github.com/mandavavasanth/voicespec/blob/main/lib/provenance.ts"
click node_integrity "https://github.com/mandavavasanth/voicespec/blob/main/lib/integrity.ts"
click node_markdown "https://github.com/mandavavasanth/voicespec/blob/main/lib/markdown.ts"
click node_agent_prompt "https://github.com/mandavavasanth/voicespec/blob/main/lib/agent-prompt.ts"
click node_github_export "https://github.com/mandavavasanth/voicespec/blob/main/lib/github-export.ts"
click node_evidence_index "https://github.com/mandavavasanth/voicespec/blob/main/lib/evidence-index.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_workspace,node_transcript_ui,node_spec_ui,node_section_card,node_provenance_ui,node_toolbar,node_state,node_user toneBlue
class node_generate_api,node_pipeline,node_normalize,node_segment,node_prompt,node_gemini,node_fallback toneAmber
class node_schema,node_provenance,node_integrity,node_evidence_index toneMint
class node_markdown,node_agent_prompt,node_github_export toneRose
class node_google toneIndigo
```

## Components

### Specification workspace

- [Workspace shell](https://github.com/mandavavasanth/voicespec/blob/main/app/page.tsx): `app/page.tsx`
- [Transcript editor](https://github.com/mandavavasanth/voicespec/blob/main/components/TranscriptPane.tsx): `components/TranscriptPane.tsx`
- [Specification view](https://github.com/mandavavasanth/voicespec/blob/main/components/SpecPane.tsx): `components/SpecPane.tsx`
- [Editable section cards](https://github.com/mandavavasanth/voicespec/blob/main/components/SectionCard.tsx): `components/SectionCard.tsx`
- [Provenance thread](https://github.com/mandavavasanth/voicespec/blob/main/components/ProvenanceThread.tsx): `components/ProvenanceThread.tsx`
- [Export toolbar](https://github.com/mandavavasanth/voicespec/blob/main/components/Toolbar.tsx): `components/Toolbar.tsx`
- [Client state](https://github.com/mandavavasanth/voicespec/blob/main/lib/store.ts): `lib/store.ts`

### Generation pipeline

- [Generate API](https://github.com/mandavavasanth/voicespec/blob/main/app/api/generate/route.ts): `app/api/generate/route.ts`
- [Pipeline orchestrator](https://github.com/mandavavasanth/voicespec/blob/main/lib/pipeline.ts): `lib/pipeline.ts`
- [Transcript normalization](https://github.com/mandavavasanth/voicespec/blob/main/lib/normalize.ts): `lib/normalize.ts`
- [Sentence segmentation](https://github.com/mandavavasanth/voicespec/blob/main/lib/segment.ts): `lib/segment.ts`
- [Prompt construction](https://github.com/mandavavasanth/voicespec/blob/main/lib/prompt.ts): `lib/prompt.ts`
- [Gemini generation](https://github.com/mandavavasanth/voicespec/blob/main/lib/gemini.ts): `lib/gemini.ts`
- [Demo and fallback specs](https://github.com/mandavavasanth/voicespec/blob/main/lib/fallback.ts): `lib/fallback.ts`

### Evidence and validation

- [Specification schema](https://github.com/mandavavasanth/voicespec/blob/main/lib/schema.ts): `lib/schema.ts`
- [Evidence grounding](https://github.com/mandavavasanth/voicespec/blob/main/lib/provenance.ts): `lib/provenance.ts`
- [Integrity checks](https://github.com/mandavavasanth/voicespec/blob/main/lib/integrity.ts): `lib/integrity.ts`
- [Evidence index](https://github.com/mandavavasanth/voicespec/blob/main/lib/evidence-index.ts): `lib/evidence-index.ts`

### Exports

- [Markdown export](https://github.com/mandavavasanth/voicespec/blob/main/lib/markdown.ts): `lib/markdown.ts`
- [Agent prompt export](https://github.com/mandavavasanth/voicespec/blob/main/lib/agent-prompt.ts): `lib/agent-prompt.ts`
- [GitHub script export](https://github.com/mandavavasanth/voicespec/blob/main/lib/github-export.ts): `lib/github-export.ts`

### Other components

- **Product user**
- **Google Gemini**

## Connections

- Product user → Transcript editor: enters transcript (evidence: `README.md`)
- Workspace shell → Transcript editor: renders (evidence: `app/page.tsx`)
- Workspace shell → Specification view: renders (evidence: `app/page.tsx`)
- Workspace shell → Provenance thread: renders (evidence: `app/page.tsx`)
- Workspace shell → Export toolbar: renders (evidence: `app/page.tsx`)
- Transcript editor → Client state: uses state (evidence: `components/TranscriptPane.tsx`)
- Specification view → Editable section cards: renders (evidence: `components/SpecPane.tsx`)
- Specification view → Client state: uses state (evidence: `components/SpecPane.tsx`)
- Provenance thread → Evidence index: indexes evidence (evidence: `components/ProvenanceThread.tsx`)
- Transcript editor → Evidence index: highlights evidence (evidence: `components/TranscriptPane.tsx`)
- Client state → Generate API: posts transcript (evidence: `lib/store.ts`)
- Generate API → Pipeline orchestrator: runs (evidence: `app/api/generate/route.ts`)
- Pipeline orchestrator → Transcript normalization: normalizes (evidence: `lib/pipeline.ts`)
- Pipeline orchestrator → Sentence segmentation: segments (evidence: `lib/pipeline.ts`)
- Pipeline orchestrator → Prompt construction: builds prompt (evidence: `lib/pipeline.ts`)
- Pipeline orchestrator → Gemini generation: requests spec (evidence: `lib/pipeline.ts`)
- Gemini generation → Google Gemini: calls API (evidence: `README.md`)
- Pipeline orchestrator → Demo and fallback specs: generates fallback (evidence: `lib/pipeline.ts`)
- Pipeline orchestrator → Evidence grounding: verifies evidence (evidence: `lib/pipeline.ts`)
- Pipeline orchestrator → Integrity checks: checks integrity (evidence: `lib/pipeline.ts`)
- Pipeline orchestrator → Specification schema: uses spec type (evidence: `lib/pipeline.ts`)
- Export toolbar → Markdown export: exports Markdown (evidence: `components/Toolbar.tsx`)
- Export toolbar → Agent prompt export: builds agent prompt (evidence: `components/Toolbar.tsx`)
- Export toolbar → GitHub script export: builds GitHub script (evidence: `components/Toolbar.tsx`)
- Agent prompt export → Specification schema: uses spec type (evidence: `lib/agent-prompt.ts`)
- Markdown export → Specification schema: uses spec type (evidence: `lib/markdown.ts`)
- GitHub script export → Specification schema: uses spec type (evidence: `lib/github-export.ts`)
