# ayushdixit1-av/cloakllm architecture

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

- Interactive diagram: https://gitdiagram.com/ayushdixit1-av/cloakllm
- Repository: https://github.com/ayushdixit1-av/cloakllm

## Overview

CloakLLM is a local credential firewall for Claude Code. Its user workflow begins with CLI commands to audit or scrub existing transcripts and harden Claude settings, then runs Claude Code through a local proxy that cloaks outbound requests and rehydrates inbound streams. The README also documents OpenAI-compatible routes and live status counters. Audit, scrub, and harden implementation details were not sampled, so those links rely on README statements; source-level evidence is limited to the proxy and stream excerpts and their indexed imports.

Main entry points: [`cloakllm/proxy.py`](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/proxy.py) (Local proxy), [`cloakllm/cli.py`](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/cli.py) (CLI commands), [`cloakllm/audit.py`](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/audit.py) (Transcript audit), [`cloakllm/stream.py`](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/stream.py) (SSE rehydrator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and local safeguards"]
  node_cli_entry["CLI commands<br/>[cli.py]"]
  node_audit["Transcript audit<br/>[audit.py]"]
  node_scrub["Transcript scrub<br/>[audit.py]"]
  node_harden["Settings hardening<br/>[cli.py]"]
end

subgraph group_proxy["Live proxy"]
  node_proxy["Local proxy<br/>[proxy.py]"]
  node_stream["SSE rehydrator<br/>[stream.py]"]
end

subgraph group_secrets["Secret handling"]
  node_vault["Secret vault<br/>[secrets.py]"]
end

subgraph group_state["Local state and services"]
  node_events["Proxy event log<br/>[proxy.py]"]
  node_status["Live status<br/>[cli.py]"]
end

node_developer(("Developer"))
node_claude(("Claude Code"))
node_envfiles["Project env files"]
node_transcripts["Claude transcripts"]
node_settings["Claude settings"]
node_anthropic["Anthropic API"]

node_developer -->|"runs commands"| node_cli_entry
node_cli_entry -->|"runs audit"| node_audit
node_cli_entry -->|"runs scrub"| node_scrub
node_cli_entry -->|"runs harden"| node_harden
node_audit -->|"scans"| node_transcripts
node_audit -->|"indexes secrets"| node_envfiles
node_scrub -->|"redacts in place"| node_transcripts
node_harden -->|"injects deny rules"| node_settings
node_developer -->|"starts proxy run"| node_cli_entry
node_cli_entry -->|"launches proxy"| node_proxy
node_claude -->|"sends requests"| node_proxy
node_proxy -->|"returns rehydrated stream"| node_claude
node_proxy -->|"forwards cloaked requests"| node_anthropic
node_proxy -->|"cloaks payloads"| node_vault
node_proxy -->|"rehydrates SSE"| node_stream
node_stream -->|"resolves tokens"| node_vault
node_proxy -->|"writes events"| node_events
node_developer -->|"checks counters"| node_status
node_status -->|"inspects counters"| node_proxy

click node_cli_entry "https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/cli.py"
click node_audit "https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/audit.py"
click node_scrub "https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/audit.py"
click node_harden "https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/cli.py"
click node_proxy "https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/proxy.py"
click node_stream "https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/stream.py"
click node_vault "https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/secrets.py"
click node_events "https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/proxy.py"
click node_status "https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/cli.py"

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_cli_entry,node_audit,node_scrub,node_harden toneBlue
class node_proxy,node_stream toneAmber
class node_vault,node_anthropic toneMint
class node_events,node_status toneRose
class node_developer,node_claude,node_envfiles,node_transcripts,node_settings toneIndigo
```

## Components

### CLI and local safeguards

- [CLI commands](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/cli.py): `cloakllm/cli.py`
- [Transcript audit](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/audit.py): `cloakllm/audit.py`
- [Transcript scrub](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/audit.py): `cloakllm/audit.py`
- [Settings hardening](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/cli.py): `cloakllm/cli.py`

### Live proxy

- [Local proxy](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/proxy.py): `cloakllm/proxy.py`
- [SSE rehydrator](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/stream.py): `cloakllm/stream.py`

### Secret handling

- [Secret vault](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/secrets.py): `cloakllm/secrets.py`

### Local state and services

- [Proxy event log](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/proxy.py): `cloakllm/proxy.py`
- [Live status](https://github.com/ayushdixit1-av/cloakllm/blob/main/cloakllm/cli.py): `cloakllm/cli.py`

### Other components

- **Developer**
- **Claude Code**
- **Project env files**
- **Claude transcripts**
- **Claude settings**
- **Anthropic API**

## Connections

- Developer → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Transcript audit: runs audit (evidence: `README.md`)
- CLI commands → Transcript scrub: runs scrub (evidence: `README.md`)
- CLI commands → Settings hardening: runs harden (evidence: `README.md`)
- Transcript audit → Claude transcripts: scans (evidence: `README.md`)
- Transcript audit → Project env files: indexes secrets (evidence: `README.md`)
- Transcript scrub → Claude transcripts: redacts in place (evidence: `README.md`)
- Settings hardening → Claude settings: injects deny rules (evidence: `README.md`)
- Developer → CLI commands: starts proxy run (evidence: `README.md`)
- CLI commands → Local proxy: launches proxy (evidence: `README.md`)
- Claude Code → Local proxy: sends requests (evidence: `README.md`)
- Local proxy → Claude Code: returns rehydrated stream (evidence: `README.md`)
- Local proxy → Anthropic API: forwards cloaked requests (evidence: `README.md`)
- Local proxy → Secret vault: cloaks payloads (evidence: `cloakllm/proxy.py`)
- Local proxy → SSE rehydrator: rehydrates SSE (evidence: `README.md`)
- SSE rehydrator → Secret vault: resolves tokens (evidence: `cloakllm/stream.py`)
- Local proxy → Proxy event log: writes events (evidence: `cloakllm/proxy.py`)
- Developer → Live status: checks counters (evidence: `README.md`)
- Live status → Local proxy: inspects counters (evidence: `README.md`)
