# ayushdixit1-av/credcloak architecture

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

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

## Overview

CredCloak is a local credential firewall for Claude Code. Its principal live workflow starts the CLI-managed proxy, cloaks secrets in outbound requests using a project-loaded vault, forwards allowed traffic upstream, and rehydrates response streams before they return to the child process. Separate CLI workflows audit and scrub historical transcripts, harden Claude settings, and report proxy activity. The graph preserves these distinct capabilities; proxy-to-stream and proxy-to-upstream details are documented, while unsampled implementation links are not inferred beyond the available references.

Main entry points: [`credcloak/proxy.py`](https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/proxy.py) (Cloaking proxy), [`credcloak/cli.py`](https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/cli.py) (CLI commands), [`credcloak/secrets.py`](https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/secrets.py) (Secret vault), [`credcloak/audit.py`](https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/audit.py) (Transcript audit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_status["Status reporting<br/>[cli.py]"]
end

subgraph group_history["Transcript protection"]
  node_audit["Transcript audit<br/>[audit.py]"]
  node_scrub["Transcript scrub<br/>[audit.py]"]
  node_harden["Settings hardening<br/>[audit.py]"]
end

subgraph group_live["Live proxy"]
  node_proxy["Cloaking proxy<br/>[proxy.py]"]
  node_stream["Stream rehydrator<br/>[stream.py]"]
  node_eventlog[("Event log<br/>[proxy.py]")]
end

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

node_developer(("Developer"))
node_claude(("Claude Code child"))
node_anthropic{{"Anthropic API"}}
node_transcripts[("Claude transcripts")]
node_settings["Claude settings"]

node_developer -->|"runs commands"| node_cli
node_cli -->|"runs audit"| node_audit
node_cli -->|"runs scrub"| node_scrub
node_cli -->|"runs harden"| node_harden
node_cli -->|"runs status"| node_status
node_audit -->|"loads secrets"| node_vault
node_scrub -->|"loads secrets"| node_vault
node_audit -->|"scans"| node_transcripts
node_scrub -->|"redacts"| node_transcripts
node_harden -->|"updates rules"| node_settings
node_cli -->|"loads project secrets"| node_vault
node_cli -->|"starts proxy"| node_proxy
node_claude -->|"sends requests"| node_proxy
node_proxy -->|"cloaks secrets"| node_vault
node_proxy -->|"forwards requests"| node_anthropic
node_anthropic -->|"streams responses"| node_proxy
node_proxy -->|"rehydrates streams"| node_stream
node_stream -->|"resolves tokens"| node_vault
node_proxy -->|"writes events"| node_eventlog
node_status -->|"reads events"| node_eventlog
node_proxy -->|"returns restored stream"| node_claude

click node_cli "https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/cli.py"
click node_audit "https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/audit.py"
click node_scrub "https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/audit.py"
click node_harden "https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/audit.py"
click node_status "https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/cli.py"
click node_vault "https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/secrets.py"
click node_proxy "https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/proxy.py"
click node_stream "https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/stream.py"
click node_eventlog "https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/proxy.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,node_status toneBlue
class node_audit,node_scrub,node_harden,node_transcripts toneAmber
class node_proxy,node_stream,node_eventlog,node_anthropic toneMint
class node_vault toneRose
class node_developer,node_claude,node_settings toneIndigo
```

## Components

### CLI workflows

- [CLI commands](https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/cli.py): `credcloak/cli.py`
- [Status reporting](https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/cli.py): `credcloak/cli.py`

### Transcript protection

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

### Live proxy

- [Cloaking proxy](https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/proxy.py): `credcloak/proxy.py`
- [Stream rehydrator](https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/stream.py): `credcloak/stream.py`
- [Event log](https://github.com/ayushdixit1-av/credcloak/blob/main/credcloak/proxy.py): `credcloak/proxy.py`

### Secret handling

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

### Other components

- **Developer**
- **Claude Code child**
- **Anthropic API**
- **Claude transcripts**
- **Claude settings**

## Connections

- Developer → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Transcript audit: runs audit (evidence: `credcloak/cli.py`)
- CLI commands → Transcript scrub: runs scrub (evidence: `credcloak/cli.py`)
- CLI commands → Settings hardening: runs harden (evidence: `credcloak/cli.py`)
- CLI commands → Status reporting: runs status (evidence: `credcloak/cli.py`)
- Transcript audit → Secret vault: loads secrets (evidence: `credcloak/audit.py`)
- Transcript scrub → Secret vault: loads secrets (evidence: `credcloak/audit.py`)
- Transcript audit → Claude transcripts: scans (evidence: `credcloak/audit.py`)
- Transcript scrub → Claude transcripts: redacts (evidence: `credcloak/audit.py`)
- Settings hardening → Claude settings: updates rules (evidence: `credcloak/audit.py`)
- CLI commands → Secret vault: loads project secrets (evidence: `credcloak/cli.py`)
- CLI commands → Cloaking proxy: starts proxy (evidence: `credcloak/cli.py`)
- Claude Code child → Cloaking proxy: sends requests (evidence: `README.md`)
- Cloaking proxy → Secret vault: cloaks secrets (evidence: `README.md`)
- Cloaking proxy → Anthropic API: forwards requests (evidence: `README.md`)
- Anthropic API → Cloaking proxy: streams responses (evidence: `README.md`)
- Cloaking proxy → Stream rehydrator: rehydrates streams (evidence: `README.md`)
- Stream rehydrator → Secret vault: resolves tokens (evidence: `credcloak/stream.py`)
- Cloaking proxy → Event log: writes events (evidence: `credcloak/proxy.py`)
- Status reporting → Event log: reads events (evidence: `credcloak/cli.py`)
- Cloaking proxy → Claude Code child: returns restored stream (evidence: `README.md`)
