# chaillme/prevert architecture

> Architecture diagram of the GitHub repository chaillme/prevert, 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/chaillme/prevert
- Repository: https://github.com/chaillme/prevert

## Overview

Prevert is a small Claude Code plugin that adds a prompt-improvement button. The user clicks it; the handler reads the draft, asks Sonnet to rewrite it, then replaces the draft without sending it. A busy flag controls the displayed status. The runtime evidence is concentrated in hooks/register.tsx; the README documents the user-facing behavior, but the excerpts do not show how Claude Code loads the registration.

Main entry points: [`hooks/register.tsx`](https://github.com/chaillme/prevert/blob/main/hooks/register.tsx) (Prompt handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Plugin runtime"]
  node_handler["Prompt handler<br/>[register.tsx]"]
  node_busy["Busy flag<br/>[register.tsx]"]
end

node_user(("User"))
node_draft["Prompt draft"]
node_sonnet["Sonnet model"]
node_host["Claude Code UI"]

node_user -->|"clicks button"| node_handler
node_handler -->|"reads and replaces"| node_draft
node_handler -->|"requests rewrite"| node_sonnet
node_sonnet -->|"returns rewrite"| node_handler
node_handler -->|"updates state"| node_busy
node_handler -->|"renders UI and toasts"| node_host

click node_handler "https://github.com/chaillme/prevert/blob/main/hooks/register.tsx"
click node_busy "https://github.com/chaillme/prevert/blob/main/hooks/register.tsx"

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_handler,node_busy,node_user,node_host toneBlue
class node_draft,node_sonnet toneIndigo
```

## Components

### Plugin runtime

- [Prompt handler](https://github.com/chaillme/prevert/blob/main/hooks/register.tsx): `hooks/register.tsx`
- [Busy flag](https://github.com/chaillme/prevert/blob/main/hooks/register.tsx): `hooks/register.tsx`

### Other components

- **User**
- **Prompt draft**
- **Sonnet model**
- **Claude Code UI**

## Connections

- User → Prompt handler: clicks button (evidence: `hooks/register.tsx`)
- Prompt handler → Prompt draft: reads and replaces (evidence: `hooks/register.tsx`)
- Prompt handler → Sonnet model: requests rewrite (evidence: `hooks/register.tsx`)
- Sonnet model → Prompt handler: returns rewrite (evidence: `hooks/register.tsx`)
- Prompt handler → Busy flag: updates state (evidence: `hooks/register.tsx`)
- Prompt handler → Claude Code UI: renders UI and toasts (evidence: `hooks/register.tsx`)
