# xqpsec/dsh-jailbreak architecture

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

- Interactive diagram: https://gitdiagram.com/xqpsec/dsh-jailbreak
- Repository: https://github.com/xqpsec/dsh-jailbreak

## Overview

This repository is a DeepSeek Harness plugin for rewriting outbound LLM request bodies, with a standalone portable kernel and optional HTTP proxy. The main user-to-result path is a host request passing through the plugin’s request-boundary transform before reaching the model; the README documents support for OpenAI, Anthropic, Responses, and Gemini request shapes. A separate evaluation and legacy-research branch measures the kernel and preserves older strategy experiments. The graph includes documented capabilities and indexed core modules; several implementation links are omitted because their source was not excerpted.

Main entry points: [`lib/routes.js`](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/routes.js) (HTTP routes), [`lib/kernel.js`](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/kernel.js) (Portable kernel), [`lib/proxy.js`](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/proxy.js) (Kernel proxy), [`lib/profile.js`](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/profile.js) (Model profiling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Plugin Integration"]
  node_host["DSH host"]
  node_plugin["Plugin entry<br/>[index.js]"]
  node_client["Control panel<br/>[client.js]"]
  node_routes["HTTP routes<br/>[routes.js]"]
  node_doctor["Installation diagnostics<br/>[doctor.js]"]
end

subgraph group_kernel["Request Transform"]
  node_proxy["Kernel proxy<br/>[proxy.js]"]
  node_kernelcore["Portable kernel<br/>[kernel.js]"]
  node_protocol["Protocol adapters<br/>[protocol.js]"]
  node_endpoint["Endpoint handling<br/>[endpoint.js]"]
  node_anthropic["Anthropic handling<br/>[anthropic.js]"]
end

subgraph group_research["Research Features"]
  node_gate["Scope gate<br/>[gate.js]"]
  node_hub["Research hub<br/>[hub.js]"]
  node_arms["Strategy arms<br/>[arm.js]"]
  node_engine["Search engine<br/>[engine.js]"]
  node_profile["Model profiling<br/>[profile.js]"]
  node_taxonomy["Target taxonomy<br/>[taxonomy.js]"]
  node_render["Prompt rendering<br/>[render.js]"]
  node_hcot["Legacy H-CoT<br/>[hcot.js]"]
  node_live["Live transport<br/>[live.js]"]
  node_presets["Prompt presets<br/>[presets.js]"]
  node_judge["Response judge<br/>[judge.js]"]
end

subgraph group_evaluation["Evaluation"]
  node_evalkernel["Kernel A/B evaluation<br/>[kernel-ab.mjs]"]
  node_evalbenign["Benign regression<br/>[kernel-benign.mjs]"]
  node_evalredteam["Red-team evaluation<br/>[kernel-redteam.mjs]"]
  node_evalladder["Retry evaluation"]
  node_evalbaseline["Legacy baseline<br/>[run-baseline.mjs]"]
end

node_user(("DSH user"))

node_user -->|"submits request"| node_host
node_host -->|"loads plugin"| node_plugin
node_plugin -->|"rewrites request"| node_kernelcore
node_kernelcore -->|"returns transformed body"| node_host
node_client -->|"calls API"| node_routes
node_routes -->|"serves research data"| node_hub
node_routes -->|"loads and lists"| node_presets
node_routes -->|"routes gate operations"| node_gate
node_routes -->|"routes arm operations"| node_arms
node_routes -->|"routes live operations"| node_live
node_proxy -->|"transforms requests"| node_kernelcore
node_proxy -->|"retries next rung"| node_proxy
node_profile -->|"uses rendering"| node_render
node_profile -->|"uses taxonomy"| node_taxonomy
node_evalkernel -->|"transforms variants"| node_kernelcore
node_evalbenign -->|"transforms variants"| node_kernelcore
node_evalredteam -->|"transforms variants"| node_kernelcore
node_evalladder -->|"tests proxy"| node_proxy
node_evalbaseline -->|"builds legacy prompts"| node_hcot
node_evalbaseline -->|"scores responses"| node_judge

click node_plugin "https://github.com/xqpsec/dsh-jailbreak/blob/main/index.js"
click node_client "https://github.com/xqpsec/dsh-jailbreak/blob/main/client.js"
click node_routes "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/routes.js"
click node_doctor "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/doctor.js"
click node_proxy "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/proxy.js"
click node_kernelcore "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/kernel.js"
click node_protocol "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/protocol.js"
click node_endpoint "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/endpoint.js"
click node_anthropic "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/anthropic.js"
click node_gate "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/gate.js"
click node_hub "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/hub.js"
click node_arms "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/arm.js"
click node_engine "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/engine.js"
click node_profile "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/profile.js"
click node_taxonomy "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/taxonomy.js"
click node_render "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/render.js"
click node_hcot "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/hcot.js"
click node_live "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/live.js"
click node_presets "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/presets.js"
click node_evalkernel "https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/kernel-ab.mjs"
click node_evalbenign "https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/kernel-benign.mjs"
click node_evalredteam "https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/kernel-redteam.mjs"
click node_evalladder "https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/kernel-ladder-e2e.mjs"
click node_evalbaseline "https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/run-baseline.mjs"
click node_judge "https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/judge.js"

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_host,node_plugin,node_client,node_routes,node_doctor,node_user toneBlue
class node_proxy,node_kernelcore,node_protocol,node_endpoint,node_anthropic toneAmber
class node_gate,node_hub,node_arms,node_engine,node_profile,node_taxonomy,node_render,node_hcot,node_live,node_presets,node_judge toneMint
class node_evalkernel,node_evalbenign,node_evalredteam,node_evalladder,node_evalbaseline toneRose
```

## Components

### Plugin Integration

- **DSH host**
- [Plugin entry](https://github.com/xqpsec/dsh-jailbreak/blob/main/index.js): `index.js`
- [Control panel](https://github.com/xqpsec/dsh-jailbreak/blob/main/client.js): `client.js`
- [HTTP routes](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/routes.js): `lib/routes.js`
- [Installation diagnostics](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/doctor.js): `lib/doctor.js`

### Request Transform

- [Kernel proxy](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/proxy.js): `lib/proxy.js`
- [Portable kernel](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/kernel.js): `lib/kernel.js`
- [Protocol adapters](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/protocol.js): `lib/protocol.js`
- [Endpoint handling](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/endpoint.js): `lib/endpoint.js`
- [Anthropic handling](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/anthropic.js): `lib/anthropic.js`

### Research Features

- [Scope gate](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/gate.js): `lib/gate.js`
- [Research hub](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/hub.js): `lib/hub.js`
- [Strategy arms](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/arm.js): `lib/arm.js`
- [Search engine](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/engine.js): `lib/engine.js`
- [Model profiling](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/profile.js): `lib/profile.js`
- [Target taxonomy](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/taxonomy.js): `lib/taxonomy.js`
- [Prompt rendering](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/render.js): `lib/render.js`
- [Legacy H-CoT](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/hcot.js): `lib/hcot.js`
- [Live transport](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/live.js): `lib/live.js`
- [Prompt presets](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/presets.js): `lib/presets.js`
- [Response judge](https://github.com/xqpsec/dsh-jailbreak/blob/main/lib/judge.js): `lib/judge.js`

### Evaluation

- [Kernel A/B evaluation](https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/kernel-ab.mjs): `eval/kernel-ab.mjs`
- [Benign regression](https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/kernel-benign.mjs): `eval/kernel-benign.mjs`
- [Red-team evaluation](https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/kernel-redteam.mjs): `eval/kernel-redteam.mjs`
- [Retry evaluation](https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/kernel-ladder-e2e.mjs): `eval/kernel-ladder-e2e.mjs`
- [Legacy baseline](https://github.com/xqpsec/dsh-jailbreak/blob/main/eval/run-baseline.mjs): `eval/run-baseline.mjs`

### Other components

- **DSH user**

## Connections

- DSH user → DSH host: submits request (evidence: `README.md`)
- DSH host → Plugin entry: loads plugin (evidence: `README.md`)
- Plugin entry → Portable kernel: rewrites request (evidence: `README.md`)
- Portable kernel → DSH host: returns transformed body (evidence: `README.md`)
- Control panel → HTTP routes: calls API (evidence: `lib/routes.js`)
- HTTP routes → Research hub: serves research data (evidence: `lib/routes.js`)
- HTTP routes → Prompt presets: loads and lists (evidence: `lib/routes.js`)
- HTTP routes → Scope gate: routes gate operations (evidence: `lib/routes.js`)
- HTTP routes → Strategy arms: routes arm operations (evidence: `lib/routes.js`)
- HTTP routes → Live transport: routes live operations (evidence: `lib/routes.js`)
- Kernel proxy → Portable kernel: transforms requests (evidence: `README.md`)
- Kernel proxy → Kernel proxy: retries next rung (evidence: `README.md`)
- Model profiling → Prompt rendering: uses rendering (evidence: `lib/profile.js`)
- Model profiling → Target taxonomy: uses taxonomy (evidence: `lib/profile.js`)
- Kernel A/B evaluation → Portable kernel: transforms variants (evidence: `eval/kernel-ab.mjs`)
- Benign regression → Portable kernel: transforms variants (evidence: `eval/kernel-benign.mjs`)
- Red-team evaluation → Portable kernel: transforms variants (evidence: `eval/kernel-redteam.mjs`)
- Retry evaluation → Kernel proxy: tests proxy (evidence: `eval/kernel-ladder-e2e.mjs`)
- Legacy baseline → Legacy H-CoT: builds legacy prompts (evidence: `eval/run-baseline.mjs`)
- Legacy baseline → Response judge: scores responses (evidence: `eval/run-baseline.mjs`)
