# tianbuyu-wwx/dsh-formatforge architecture

> Architecture diagram of the GitHub repository tianbuyu-wwx/dsh-formatforge, 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/tianbuyu-wwx/dsh-formatforge
- Repository: https://github.com/tianbuyu-wwx/dsh-formatforge

## Overview

DSH-FormatForge is a DeepSeek Harness plugin and Python conversion engine: users submit files through chat tools, CLI, or browser drag-and-drop; the engine detects and parses formats, produces structured output and quality/enhancement metadata, and can place artifacts in a searchable inbox. The graph preserves the documented batch, diff, format-listing, panel, and inbox-index capabilities. Some subsystem details are documented but unsampled; those links are identified by README evidence rather than implying source inspection.

Main entry points: [`formatforge/__main__.py`](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/__main__.py) (CLI entry point), [`core/pipeline_steps.py`](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/pipeline_steps.py) (Pipeline steps), [`packages/dsh-formatforge/services/inbox-watcher.mjs`](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/inbox-watcher.mjs) (Inbox watcher), [`core/pipeline.py`](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/pipeline.py) (Conversion pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Harness plugin"]
  node_plugin_entry["Plugin registration<br/>[index.mjs]"]
  node_drag_drop["Drag-and-drop client<br/>[client.source.js]"]
  node_upload["Upload route<br/>[upload.mjs]"]
  node_api["Inbox API<br/>[api.mjs]"]
  node_tool_translate["Translate tool<br/>[translate.mjs]"]
  node_tool_result["Result tool<br/>[result.mjs]"]
  node_runner["Python runner<br/>[python-runner.mjs]"]
  node_watcher["Inbox watcher<br/>[inbox-watcher.mjs]"]
  node_notify["Session notification<br/>[notify.mjs]"]
  node_panel["Inbox panel<br/>[panel.source.js]"]
end

subgraph group_engine["Conversion engine"]
  node_pipeline["Conversion pipeline<br/>[pipeline.py]"]
  node_steps["Pipeline steps<br/>[pipeline_steps.py]"]
  node_decision["Strategy selection<br/>[decision_engine.py]"]
  node_strategies["Conversion strategies"]
  node_quality["Quality reporting<br/>[quality_report.py]"]
  node_models["Document models<br/>[models.py]"]
end

subgraph group_parsing["Parsing and enrichment"]
  node_detector["Format detection<br/>[format_detector.py]"]
  node_adapters["Input adapters<br/>[input_adapters.py]"]
  node_parser_registry["Parser registry<br/>[file_parser.py]"]
  node_parsers["Format parsers"]
  node_ocr["OCR engine<br/>[ocr_engine.py]"]
  node_pdf_enhance["PDF enrichment<br/>[pdf_enhance.py]"]
  node_table_semantics["Table semantics<br/>[table_semantics.py]"]
  node_enhance["Enhancement hints<br/>[enhance.py]"]
end

subgraph group_inbox["Inbox and discovery"]
  node_inbox_cli["Inbox commands<br/>[inbox.py]"]
  node_guard["Artifact output guard<br/>[output_guard.py]"]
  node_db[("Inbox index database<br/>[inbox-db.mjs]")]
  node_paths["Inbox paths<br/>[ff-paths.mjs]"]
end

subgraph group_commands["CLI capabilities"]
  node_cli["CLI entry point<br/>[__main__.py]"]
  node_batch["Batch conversion<br/>[batch.py]"]
  node_diff["Artifact diff<br/>[diff.py]"]
  node_formats["Format catalog"]
end

node_user(("Harness user"))
node_harness(("DeepSeek Harness"))

node_user -->|"submits files"| node_harness
node_harness -->|"invokes tool"| node_tool_translate
node_user -->|"drops file"| node_drag_drop
node_drag_drop -->|"uploads file"| node_upload
node_upload -->|"places in inbox"| node_watcher
node_tool_translate -.->|"runs conversion"| node_runner
node_watcher -.->|"converts inbox file"| node_runner
node_runner -->|"invokes module"| node_cli
node_cli -->|"runs pipeline"| node_pipeline
node_pipeline -->|"executes steps"| node_steps
node_steps -->|"reads input"| node_adapters
node_steps -->|"detects format"| node_detector
node_steps -->|"parses input"| node_parser_registry
node_parser_registry -->|"dispatches parser"| node_parsers
node_steps -->|"chooses conversion"| node_decision
node_steps -->|"converts content"| node_strategies
node_steps -->|"extracts scanned text"| node_ocr
node_parsers -->|"enriches PDF"| node_pdf_enhance
node_parsers -->|"normalizes tables"| node_table_semantics
node_pipeline -->|"carries pipeline state"| node_models
node_cli -->|"adds quality report"| node_quality
node_cli -.->|"returns enhancement hint"| node_enhance
node_cli -->|"dispatches batch"| node_batch
node_cli -->|"dispatches diff"| node_diff
node_cli -->|"lists capabilities"| node_formats
node_cli -->|"runs inbox commands"| node_inbox_cli
node_inbox_cli -.->|"updates index"| node_db
node_guard -->|"writes artifacts"| node_inbox_cli
node_api -->|"queries index"| node_db
node_api -->|"resolves inbox"| node_paths
node_watcher -->|"resolves inbox"| node_paths
node_watcher -.->|"notifies session"| node_notify
node_harness -->|"opens inbox panel"| node_panel
node_panel -->|"requests inbox data"| node_api
node_tool_result -->|"searches artifacts"| node_db
node_harness -->|"requests results"| node_tool_result

click node_plugin_entry "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/index.mjs"
click node_drag_drop "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/lib/client.source.js"
click node_upload "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/http/upload.mjs"
click node_api "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/http/api.mjs"
click node_tool_translate "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/tools/translate.mjs"
click node_tool_result "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/tools/result.mjs"
click node_runner "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/python-runner.mjs"
click node_watcher "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/inbox-watcher.mjs"
click node_notify "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/notify.mjs"
click node_panel "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/lib/panel.source.js"
click node_cli "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/__main__.py"
click node_batch "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/batch.py"
click node_diff "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/diff.py"
click node_formats "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/format_capabilities.py"
click node_pipeline "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/pipeline.py"
click node_steps "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/pipeline_steps.py"
click node_decision "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/decision_engine.py"
click node_strategies "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/conversion_strategies.py"
click node_quality "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/quality_report.py"
click node_models "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/models.py"
click node_detector "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/format_detector.py"
click node_adapters "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/input_adapters.py"
click node_parser_registry "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/file_parser.py"
click node_parsers "https://github.com/tianbuyu-wwx/dsh-formatforge/tree/main/parsers"
click node_ocr "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/ocr_engine.py"
click node_pdf_enhance "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/pdf_enhance.py"
click node_table_semantics "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/table_semantics.py"
click node_enhance "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/enhance.py"
click node_inbox_cli "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/inbox.py"
click node_guard "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/output_guard.py"
click node_db "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/inbox-db.mjs"
click node_paths "https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/ff-paths.mjs"

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_plugin_entry,node_drag_drop,node_upload,node_api,node_tool_translate,node_tool_result,node_runner,node_watcher,node_notify,node_panel,node_user toneBlue
class node_pipeline,node_steps,node_decision,node_strategies,node_quality,node_models toneAmber
class node_detector,node_adapters,node_parser_registry,node_parsers,node_ocr,node_pdf_enhance,node_table_semantics,node_enhance toneMint
class node_inbox_cli,node_guard,node_db,node_paths toneRose
class node_cli,node_batch,node_diff,node_formats,node_harness toneIndigo
```

## Components

### Harness plugin

- [Plugin registration](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/index.mjs): `packages/dsh-formatforge/index.mjs`
- [Drag-and-drop client](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/lib/client.source.js): `packages/dsh-formatforge/lib/client.source.js`
- [Upload route](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/http/upload.mjs): `packages/dsh-formatforge/http/upload.mjs`
- [Inbox API](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/http/api.mjs): `packages/dsh-formatforge/http/api.mjs`
- [Translate tool](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/tools/translate.mjs): `packages/dsh-formatforge/tools/translate.mjs`
- [Result tool](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/tools/result.mjs): `packages/dsh-formatforge/tools/result.mjs`
- [Python runner](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/python-runner.mjs): `packages/dsh-formatforge/services/python-runner.mjs`
- [Inbox watcher](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/inbox-watcher.mjs): `packages/dsh-formatforge/services/inbox-watcher.mjs`
- [Session notification](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/notify.mjs): `packages/dsh-formatforge/services/notify.mjs`
- [Inbox panel](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/lib/panel.source.js): `packages/dsh-formatforge/lib/panel.source.js`

### Conversion engine

- [Conversion pipeline](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/pipeline.py): `core/pipeline.py`
- [Pipeline steps](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/pipeline_steps.py): `core/pipeline_steps.py`
- [Strategy selection](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/decision_engine.py): `core/decision_engine.py`
- [Conversion strategies](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/conversion_strategies.py): `core/conversion_strategies.py`
- [Quality reporting](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/quality_report.py): `core/quality_report.py`
- [Document models](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/models.py): `core/models.py`

### Parsing and enrichment

- [Format detection](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/format_detector.py): `core/format_detector.py`
- [Input adapters](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/input_adapters.py): `core/input_adapters.py`
- [Parser registry](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/file_parser.py): `core/file_parser.py`
- [Format parsers](https://github.com/tianbuyu-wwx/dsh-formatforge/tree/main/parsers): `parsers`
- [OCR engine](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/ocr_engine.py): `core/ocr_engine.py`
- [PDF enrichment](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/pdf_enhance.py): `core/pdf_enhance.py`
- [Table semantics](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/table_semantics.py): `core/table_semantics.py`
- [Enhancement hints](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/enhance.py): `core/enhance.py`

### Inbox and discovery

- [Inbox commands](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/inbox.py): `formatforge/inbox.py`
- [Artifact output guard](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/output_guard.py): `formatforge/output_guard.py`
- [Inbox index database](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/inbox-db.mjs): `packages/dsh-formatforge/services/inbox-db.mjs`
- [Inbox paths](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/packages/dsh-formatforge/services/ff-paths.mjs): `packages/dsh-formatforge/services/ff-paths.mjs`

### CLI capabilities

- [CLI entry point](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/__main__.py): `formatforge/__main__.py`
- [Batch conversion](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/batch.py): `formatforge/batch.py`
- [Artifact diff](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/formatforge/diff.py): `formatforge/diff.py`
- [Format catalog](https://github.com/tianbuyu-wwx/dsh-formatforge/blob/main/core/format_capabilities.py): `core/format_capabilities.py`

### Other components

- **Harness user**
- **DeepSeek Harness**

## Connections

- Harness user → DeepSeek Harness: submits files (evidence: `README.md`)
- DeepSeek Harness → Translate tool: invokes tool (evidence: `README.md`)
- Harness user → Drag-and-drop client: drops file (evidence: `README.md`)
- Drag-and-drop client → Upload route: uploads file (evidence: `README.md`)
- Upload route → Inbox watcher: places in inbox (evidence: `README.md`)
- Translate tool → Python runner: runs conversion
- Inbox watcher → Python runner: converts inbox file (evidence: `packages/dsh-formatforge/services/inbox-watcher.mjs`)
- Python runner → CLI entry point: invokes module (evidence: `packages/dsh-formatforge/services/python-runner.mjs`)
- CLI entry point → Conversion pipeline: runs pipeline (evidence: `formatforge/__main__.py`)
- Conversion pipeline → Pipeline steps: executes steps (evidence: `core/pipeline.py`)
- Pipeline steps → Input adapters: reads input (evidence: `core/pipeline_steps.py`)
- Pipeline steps → Format detection: detects format (evidence: `core/pipeline_steps.py`)
- Pipeline steps → Parser registry: parses input (evidence: `core/pipeline_steps.py`)
- Parser registry → Format parsers: dispatches parser (evidence: `core/file_parser.py`)
- Pipeline steps → Strategy selection: chooses conversion (evidence: `core/pipeline_steps.py`)
- Pipeline steps → Conversion strategies: converts content (evidence: `core/pipeline_steps.py`)
- Pipeline steps → OCR engine: extracts scanned text (evidence: `core/pipeline_steps.py`)
- Format parsers → PDF enrichment: enriches PDF (evidence: `parsers/pdf_parser.py`)
- Format parsers → Table semantics: normalizes tables (evidence: `parsers/pdf_parser.py`)
- Conversion pipeline → Document models: carries pipeline state (evidence: `core/pipeline.py`)
- CLI entry point → Quality reporting: adds quality report (evidence: `formatforge/__main__.py`)
- CLI entry point → Enhancement hints: returns enhancement hint
- CLI entry point → Batch conversion: dispatches batch (evidence: `formatforge/__main__.py`)
- CLI entry point → Artifact diff: dispatches diff (evidence: `formatforge/__main__.py`)
- CLI entry point → Format catalog: lists capabilities (evidence: `formatforge/__main__.py`)
- CLI entry point → Inbox commands: runs inbox commands (evidence: `formatforge/__main__.py`)
- Inbox commands → Inbox index database: updates index
- Artifact output guard → Inbox commands: writes artifacts (evidence: `formatforge/output_guard.py`)
- Inbox API → Inbox index database: queries index (evidence: `packages/dsh-formatforge/http/api.mjs`)
- Inbox API → Inbox paths: resolves inbox (evidence: `packages/dsh-formatforge/http/api.mjs`)
- Inbox watcher → Inbox paths: resolves inbox (evidence: `packages/dsh-formatforge/services/inbox-watcher.mjs`)
- Inbox watcher → Session notification: notifies session
- DeepSeek Harness → Inbox panel: opens inbox panel (evidence: `README.md`)
- Inbox panel → Inbox API: requests inbox data (evidence: `README.md`)
- Result tool → Inbox index database: searches artifacts (evidence: `packages/dsh-formatforge/tools/result.mjs`)
- DeepSeek Harness → Result tool: requests results (evidence: `README.md`)
