# itrejomx/chatgpt-limits architecture

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

- Interactive diagram: https://gitdiagram.com/itrejomx/chatgpt-limits
- Repository: https://github.com/itrejomx/chatgpt-limits

## Overview

This is a Hermes plugin for querying the signed-in user’s account limits, primarily for ChatGPT/Codex. Its workflow starts through a Hermes tool, slash command, or CLI command; the plugin fetches a usage snapshot through Hermes’s account-usage code and formats it as terminal, chat-friendly, or JSON output. The README also documents a bundled skill and reuse of Hermes OAuth state and its usage API. The Hermes implementation is outside this repository, so its internal stages are represented only where the README supports them.

Main entry points: [`tools.py`](https://github.com/itrejomx/chatgpt-limits/blob/main/tools.py) (Limits handler), [`__init__.py`](https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py) (Plugin registration), [`schemas.py`](https://github.com/itrejomx/chatgpt-limits/blob/main/schemas.py) (Tool schema), [`skills/chatgpt-limits/SKILL.md`](https://github.com/itrejomx/chatgpt-limits/blob/main/skills/chatgpt-limits/SKILL.md) (Bundled skill)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entrypoints["Plugin entrypoints"]
  node_plugin_registration["Plugin registration<br/>[__init__.py]"]
  node_tool_schema["Tool schema<br/>[schemas.py]"]
  node_slash_commands["Slash commands<br/>[__init__.py]"]
  node_cli_command["CLI command<br/>[__init__.py]"]
  node_bundled_skill["Bundled skill<br/>[SKILL.md]"]
end

subgraph group_execution["Usage retrieval"]
  node_tool_handler["Limits handler<br/>[tools.py]"]
  node_account_usage["Account usage"]
  node_oauth_state[("Hermes OAuth state")]
  node_usage_api["Codex usage API"]
end

subgraph group_presentation["Output and guidance"]
  node_snapshot_conversion["Snapshot conversion<br/>[tools.py]"]
  node_chat_formatting["Chat formatting<br/>[__init__.py]"]
  node_cli_formatting["CLI formatting<br/>[__init__.py]"]
  node_json_output["JSON output<br/>[__init__.py]"]
end

node_user(("User"))
node_hermes["Hermes runtime"]

node_user -->|"invokes"| node_slash_commands
node_user -->|"runs"| node_cli_command
node_hermes -.->|"loads"| node_plugin_registration
node_plugin_registration -->|"registers"| node_tool_schema
node_plugin_registration -->|"registers"| node_tool_handler
node_plugin_registration -->|"registers"| node_bundled_skill
node_slash_commands -->|"calls"| node_tool_handler
node_cli_command -->|"calls"| node_tool_handler
node_hermes -.->|"invokes"| node_tool_handler
node_tool_handler -->|"fetches snapshot"| node_account_usage
node_account_usage -->|"reads credentials"| node_oauth_state
node_account_usage -->|"queries limits"| node_usage_api
node_tool_handler -->|"converts"| node_snapshot_conversion
node_snapshot_conversion -->|"renders lines"| node_account_usage
node_slash_commands -->|"formats chat"| node_chat_formatting
node_cli_command -->|"formats terminal"| node_cli_formatting
node_slash_commands -->|"renders JSON"| node_json_output
node_cli_command -->|"renders JSON"| node_json_output

click node_plugin_registration "https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py"
click node_tool_schema "https://github.com/itrejomx/chatgpt-limits/blob/main/schemas.py"
click node_slash_commands "https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py"
click node_cli_command "https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py"
click node_bundled_skill "https://github.com/itrejomx/chatgpt-limits/blob/main/skills/chatgpt-limits/SKILL.md"
click node_tool_handler "https://github.com/itrejomx/chatgpt-limits/blob/main/tools.py"
click node_snapshot_conversion "https://github.com/itrejomx/chatgpt-limits/blob/main/tools.py"
click node_chat_formatting "https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py"
click node_cli_formatting "https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py"
click node_json_output "https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.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_plugin_registration,node_tool_schema,node_slash_commands,node_cli_command,node_bundled_skill,node_user toneBlue
class node_tool_handler,node_account_usage,node_oauth_state,node_usage_api toneAmber
class node_snapshot_conversion,node_chat_formatting,node_cli_formatting,node_json_output toneMint
class node_hermes toneIndigo
```

## Components

### Plugin entrypoints

- [Plugin registration](https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py): `__init__.py`
- [Tool schema](https://github.com/itrejomx/chatgpt-limits/blob/main/schemas.py): `schemas.py`
- [Slash commands](https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py): `__init__.py`
- [CLI command](https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py): `__init__.py`
- [Bundled skill](https://github.com/itrejomx/chatgpt-limits/blob/main/skills/chatgpt-limits/SKILL.md): `skills/chatgpt-limits/SKILL.md`

### Usage retrieval

- [Limits handler](https://github.com/itrejomx/chatgpt-limits/blob/main/tools.py): `tools.py`
- **Account usage**
- **Hermes OAuth state**
- **Codex usage API**

### Output and guidance

- [Snapshot conversion](https://github.com/itrejomx/chatgpt-limits/blob/main/tools.py): `tools.py`
- [Chat formatting](https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py): `__init__.py`
- [CLI formatting](https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py): `__init__.py`
- [JSON output](https://github.com/itrejomx/chatgpt-limits/blob/main/__init__.py): `__init__.py`

### Other components

- **User**
- **Hermes runtime**

## Connections

- User → Slash commands: invokes (evidence: `README.md`)
- User → CLI command: runs (evidence: `README.md`)
- Hermes runtime → Plugin registration: loads
- Plugin registration → Tool schema: registers (evidence: `__init__.py`)
- Plugin registration → Limits handler: registers (evidence: `__init__.py`)
- Plugin registration → Bundled skill: registers (evidence: `__init__.py`)
- Slash commands → Limits handler: calls (evidence: `__init__.py`)
- CLI command → Limits handler: calls (evidence: `__init__.py`)
- Hermes runtime → Limits handler: invokes
- Limits handler → Account usage: fetches snapshot (evidence: `tools.py`)
- Account usage → Hermes OAuth state: reads credentials (evidence: `README.md`)
- Account usage → Codex usage API: queries limits (evidence: `README.md`)
- Limits handler → Snapshot conversion: converts (evidence: `tools.py`)
- Snapshot conversion → Account usage: renders lines (evidence: `tools.py`)
- Slash commands → Chat formatting: formats chat (evidence: `__init__.py`)
- CLI command → CLI formatting: formats terminal (evidence: `__init__.py`)
- Slash commands → JSON output: renders JSON (evidence: `__init__.py`)
- CLI command → JSON output: renders JSON (evidence: `__init__.py`)
