# spaceofclaudemalot/origin architecture

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

- Interactive diagram: https://gitdiagram.com/spaceofclaudemalot/origin
- Repository: https://github.com/spaceofclaudemalot/origin

## Overview

TextOrigin AI is a local Chrome extension for reviewing stylistic signals associated with AI-generated text. The popup analyzes selected text through the extension’s background workflow; users can open the resulting text in a built-in editor, where live analysis marks signals and invisible characters. The editor also supports document management and Word/PDF export. Analysis proceeds through text segmentation, family-specific detectors, and score aggregation. Several UI and background modules were not sampled, so those connections are shown only where documented or marked unverified.

Main entry points: [`extension/src/analysis/service.ts`](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/analysis/service.ts) (Detector assembly), [`extension/src/services/detector.ts`](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/services/detector.ts) (Detector service), [`extension/src/editor/EditorApp.tsx`](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/EditorApp.tsx) (Editor workspace), [`extension/src/editor/useLiveAnalysis.ts`](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/useLiveAnalysis.ts) (Live analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_popup["Popup<br/>[index.tsx]"]
  node_worker["Background worker<br/>[index.ts]"]
end

subgraph group_analysis["Analysis pipeline"]
  node_segmentation["Text segmentation<br/>[segment.ts]"]
  node_factory["Detector assembly<br/>[service.ts]"]
  node_detector_service["Detector service<br/>[detector.ts]"]
  node_lexical["Vocabulary signals<br/>[lexical.ts]"]
  node_connectors["Connector signals<br/>[connectors.ts]"]
  node_stereotypes["Phrasing patterns<br/>[stereotypes.ts]"]
  node_rhythm["Sentence rhythm<br/>[rhythm.ts]"]
  node_paragraphs["Paragraph regularity<br/>[paragraphs.ts]"]
  node_invisibles["Invisible characters<br/>[invisibles.ts]"]
  node_score["Score aggregation<br/>[scoring.ts]"]
  node_thresholds["Signal thresholds<br/>[thresholds.ts]"]
end

subgraph group_editor["Editor and documents"]
  node_editor_entry["Editor startup<br/>[main.tsx]"]
  node_editor_app["Editor workspace<br/>[EditorApp.tsx]"]
  node_live_analysis["Live analysis<br/>[useLiveAnalysis.ts]"]
  node_markers["Text markers<br/>[AiMarkers.ts]"]
  node_invisible_marks["Invisible marks<br/>[InvisibleMarks.ts]"]
  node_documents[("Document storage<br/>[documents.ts]")]
  node_backup["Document backup<br/>[backup.ts]"]
  node_export["Document export<br/>[toDocx.ts]"]
end

subgraph group_shared["Shared capabilities"]
  node_languages["English and French<br/>[core.ts]"]
  node_language_data["Translation dictionaries<br/>[fr.ts]"]
  node_feedback["Feedback action<br/>[feedback.ts]"]
end

node_user(("User"))

node_user -->|"analyzes selection"| node_popup
node_popup -->|"requests analysis"| node_worker
node_worker -.->|"dispatches analysis"| node_detector_service
node_detector_service -->|"segments text"| node_segmentation
node_factory -->|"registers detectors"| node_detector_service
node_factory -->|"registers"| node_lexical
node_factory -->|"registers"| node_connectors
node_factory -->|"registers"| node_stereotypes
node_factory -->|"registers"| node_rhythm
node_factory -->|"registers"| node_paragraphs
node_detector_service -->|"checks characters"| node_invisibles
node_detector_service -->|"aggregates signals"| node_score
node_score -->|"uses thresholds"| node_thresholds
node_editor_entry -->|"renders"| node_editor_app
node_editor_app -.->|"starts live review"| node_live_analysis
node_live_analysis -->|"creates service"| node_factory
node_live_analysis -->|"dispatches detections"| node_markers
node_live_analysis -->|"dispatches findings"| node_invisible_marks
node_editor_app -.->|"manages documents"| node_documents
node_documents -->|"clears backup"| node_backup
node_editor_app -.->|"exports document"| node_export
node_editor_entry -->|"initializes language"| node_languages
node_languages -->|"loads dictionaries"| node_language_data
node_user -->|"opens feedback"| node_feedback

click node_popup "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/popup/index.tsx"
click node_worker "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/background/index.ts"
click node_segmentation "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/analysis/segment.ts"
click node_factory "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/analysis/service.ts"
click node_detector_service "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/services/detector.ts"
click node_lexical "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/lexical.ts"
click node_connectors "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/connectors.ts"
click node_stereotypes "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/stereotypes.ts"
click node_rhythm "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/rhythm.ts"
click node_paragraphs "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/paragraphs.ts"
click node_invisibles "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/invisibles.ts"
click node_score "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/analysis/scoring.ts"
click node_thresholds "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/analysis/thresholds.ts"
click node_editor_entry "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/main.tsx"
click node_editor_app "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/EditorApp.tsx"
click node_live_analysis "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/useLiveAnalysis.ts"
click node_markers "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/extensions/AiMarkers.ts"
click node_invisible_marks "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/extensions/InvisibleMarks.ts"
click node_documents "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/storage/documents.ts"
click node_backup "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/storage/backup.ts"
click node_export "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/export/toDocx.ts"
click node_languages "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/i18n/core.ts"
click node_language_data "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/i18n/fr.ts"
click node_feedback "https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/ui/feedback.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_popup,node_worker,node_user toneBlue
class node_segmentation,node_factory,node_detector_service,node_lexical,node_connectors,node_stereotypes,node_rhythm,node_paragraphs,node_invisibles,node_score,node_thresholds toneAmber
class node_editor_entry,node_editor_app,node_live_analysis,node_markers,node_invisible_marks,node_documents,node_backup,node_export toneMint
class node_languages,node_language_data,node_feedback toneRose
```

## Components

### User entry points

- [Popup](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/popup/index.tsx): `extension/src/popup/index.tsx`
- [Background worker](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/background/index.ts): `extension/src/background/index.ts`

### Analysis pipeline

- [Text segmentation](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/analysis/segment.ts): `extension/src/analysis/segment.ts`
- [Detector assembly](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/analysis/service.ts): `extension/src/analysis/service.ts`
- [Detector service](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/services/detector.ts): `extension/src/services/detector.ts`
- [Vocabulary signals](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/lexical.ts): `extension/src/detectors/lexical.ts`
- [Connector signals](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/connectors.ts): `extension/src/detectors/connectors.ts`
- [Phrasing patterns](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/stereotypes.ts): `extension/src/detectors/stereotypes.ts`
- [Sentence rhythm](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/rhythm.ts): `extension/src/detectors/rhythm.ts`
- [Paragraph regularity](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/paragraphs.ts): `extension/src/detectors/paragraphs.ts`
- [Invisible characters](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/detectors/invisibles.ts): `extension/src/detectors/invisibles.ts`
- [Score aggregation](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/analysis/scoring.ts): `extension/src/analysis/scoring.ts`
- [Signal thresholds](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/analysis/thresholds.ts): `extension/src/analysis/thresholds.ts`

### Editor and documents

- [Editor startup](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/main.tsx): `extension/src/editor/main.tsx`
- [Editor workspace](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/EditorApp.tsx): `extension/src/editor/EditorApp.tsx`
- [Live analysis](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/useLiveAnalysis.ts): `extension/src/editor/useLiveAnalysis.ts`
- [Text markers](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/extensions/AiMarkers.ts): `extension/src/editor/extensions/AiMarkers.ts`
- [Invisible marks](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/editor/extensions/InvisibleMarks.ts): `extension/src/editor/extensions/InvisibleMarks.ts`
- [Document storage](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/storage/documents.ts): `extension/src/storage/documents.ts`
- [Document backup](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/storage/backup.ts): `extension/src/storage/backup.ts`
- [Document export](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/export/toDocx.ts): `extension/src/export/toDocx.ts`

### Shared capabilities

- [English and French](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/i18n/core.ts): `extension/src/i18n/core.ts`
- [Translation dictionaries](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/i18n/fr.ts): `extension/src/i18n/fr.ts`
- [Feedback action](https://github.com/spaceofclaudemalot/origin/blob/master/extension/src/ui/feedback.ts): `extension/src/ui/feedback.ts`

### Other components

- **User**

## Connections

- User → Popup: analyzes selection (evidence: `README.md`)
- Popup → Background worker: requests analysis (evidence: `extension/src/popup/index.tsx`)
- Background worker → Detector service: dispatches analysis
- Detector service → Text segmentation: segments text (evidence: `extension/src/services/detector.ts`)
- Detector assembly → Detector service: registers detectors (evidence: `extension/src/analysis/service.ts`)
- Detector assembly → Vocabulary signals: registers (evidence: `extension/src/analysis/service.ts`)
- Detector assembly → Connector signals: registers (evidence: `extension/src/analysis/service.ts`)
- Detector assembly → Phrasing patterns: registers (evidence: `extension/src/analysis/service.ts`)
- Detector assembly → Sentence rhythm: registers (evidence: `extension/src/analysis/service.ts`)
- Detector assembly → Paragraph regularity: registers (evidence: `extension/src/analysis/service.ts`)
- Detector service → Invisible characters: checks characters (evidence: `extension/src/services/detector.ts`)
- Detector service → Score aggregation: aggregates signals (evidence: `extension/src/services/detector.ts`)
- Score aggregation → Signal thresholds: uses thresholds (evidence: `extension/src/analysis/scoring.ts`)
- Editor startup → Editor workspace: renders (evidence: `extension/src/editor/main.tsx`)
- Editor workspace → Live analysis: starts live review
- Live analysis → Detector assembly: creates service (evidence: `extension/src/editor/useLiveAnalysis.ts`)
- Live analysis → Text markers: dispatches detections (evidence: `extension/src/editor/useLiveAnalysis.ts`)
- Live analysis → Invisible marks: dispatches findings (evidence: `extension/src/editor/useLiveAnalysis.ts`)
- Editor workspace → Document storage: manages documents
- Document storage → Document backup: clears backup (evidence: `extension/src/storage/documents.ts`)
- Editor workspace → Document export: exports document
- Editor startup → English and French: initializes language (evidence: `extension/src/editor/main.tsx`)
- English and French → Translation dictionaries: loads dictionaries (evidence: `extension/src/i18n/core.ts`)
- User → Feedback action: opens feedback (evidence: `README.md`)
