# yasinyilmaz/ai-stegcloak architecture

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

- Interactive diagram: https://gitdiagram.com/yasinyilmaz/ai-stegcloak
- Repository: https://github.com/yasinyilmaz/ai-stegcloak
- Video tour (about a minute): https://gitdiagram.com/yasinyilmaz/ai-stegcloak/video

## Overview

AI StegCloak adds invisible, response-specific provenance marks to generated text, then checks copied text for surviving evidence. The main workflow runs from the browser interface through the HTTP API to the watermark service: minting embeds marks and records provenance data; detection compares extracted marks and content fingerprints against those records. The README also describes provider-side integration and partial-copy detection. The graph reflects the sampled server and watermark modules; unsampled UI markup is represented only by its exact tree path.

Main entry points: [`src/watermark/service.js`](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/service.js) (Watermark service), [`public/app.js`](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/public/app.js) (Browser app), [`src/server.js`](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/server.js) (HTTP server), [`public/index.html`](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/public/index.html) (Web page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Browser interface"]
  node_ui["Browser app<br/>[app.js]"]
  node_page["Web page<br/>[index.html]"]
end

subgraph group_api["HTTP API"]
  node_server["HTTP server<br/>[server.js]"]
end

subgraph group_watermark["Watermark processing"]
  node_service["Watermark service<br/>[service.js]"]
  node_text["Text tagging<br/>[text.js]"]
  node_alphabet["Symbol encoding<br/>[alphabet.js]"]
  node_fingerprint["Content fingerprint<br/>[fingerprint.js]"]
  node_evidence["Evidence scoring<br/>[evidence.js]"]
end

subgraph group_registry["Watermark registry"]
  node_store[("Memory registry<br/>[memory-store.js]")]
end

node_user(("User"))
node_ai(("AI provider"))

node_user -->|"uses"| node_ui
node_ai -.->|"provides text"| node_ui
node_server -->|"serves"| node_page
node_page -->|"loads"| node_ui
node_ui -->|"POSTs mint/detect"| node_server
node_server -->|"invokes"| node_service
node_server -->|"reads health"| node_store
node_service -->|"tags / extracts"| node_text
node_service -->|"counts marks"| node_alphabet
node_service -->|"fingerprints text"| node_fingerprint
node_service -->|"scores sequences"| node_evidence
node_text -->|"encodes / decodes"| node_alphabet
node_service -->|"saves / lists records"| node_store
node_service -->|"checks containment"| node_fingerprint
node_ui -->|"shows results"| node_user

click node_ui "https://github.com/yasinyilmaz/ai-stegcloak/blob/main/public/app.js"
click node_page "https://github.com/yasinyilmaz/ai-stegcloak/blob/main/public/index.html"
click node_server "https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/server.js"
click node_service "https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/service.js"
click node_text "https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/text.js"
click node_alphabet "https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/alphabet.js"
click node_fingerprint "https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/fingerprint.js"
click node_evidence "https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/evidence.js"
click node_store "https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/store/memory-store.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_ui,node_page,node_user toneBlue
class node_server toneAmber
class node_service,node_text,node_alphabet,node_fingerprint,node_evidence toneMint
class node_store toneRose
class node_ai toneIndigo
```

## Components

### Browser interface

- [Browser app](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/public/app.js): `public/app.js`
- [Web page](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/public/index.html): `public/index.html`

### HTTP API

- [HTTP server](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/server.js): `src/server.js`

### Watermark processing

- [Watermark service](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/service.js): `src/watermark/service.js`
- [Text tagging](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/text.js): `src/watermark/text.js`
- [Symbol encoding](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/alphabet.js): `src/watermark/alphabet.js`
- [Content fingerprint](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/fingerprint.js): `src/watermark/fingerprint.js`
- [Evidence scoring](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/watermark/evidence.js): `src/watermark/evidence.js`

### Watermark registry

- [Memory registry](https://github.com/yasinyilmaz/ai-stegcloak/blob/main/src/store/memory-store.js): `src/store/memory-store.js`

### Other components

- **User**
- **AI provider**

## Connections

- User → Browser app: uses
- AI provider → Browser app: provides text
- HTTP server → Web page: serves
- Web page → Browser app: loads
- Browser app → HTTP server: POSTs mint/detect
- HTTP server → Watermark service: invokes
- HTTP server → Memory registry: reads health
- Watermark service → Text tagging: tags / extracts
- Watermark service → Symbol encoding: counts marks
- Watermark service → Content fingerprint: fingerprints text
- Watermark service → Evidence scoring: scores sequences
- Text tagging → Symbol encoding: encodes / decodes
- Watermark service → Memory registry: saves / lists records
- Watermark service → Content fingerprint: checks containment
- Browser app → User: shows results
