thermal AGENTS.md

A set of coding and architecture rules for Thermal, a terminal tool that reads activity data from AI coding assistants and displays heatmaps and leaderboards. It covers the project's structure, loaders, metrics, rendering, and build conventions.

In plain words
What is it for?
Use it when modifying Thermal's data loaders, heatmap calculations, terminal display, versioning, or self-update code.
Why use it?
It gives coding agents the project's required standards and known constraints before they change the code.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/jadmadi/thermal/agents-md
Clone the repo
git clone --depth 1 https://github.com/jadmadi/thermal

Made for: Codex, OpenCode.

Per session 1,925 This file is loaded in full into every session.
When invoked 1,925 The same file — it is already loaded in full.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01925 $0.01925
Opus 5 $0.00962 $0.00962
Sonnet 5 $0.00385 $0.00385
Haiku 4.5 $0.00193 $0.00193

Measured yesterday against content hash 84c574a3a307, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

thermal AGENTS.md scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

* The `.github/workflows/release.yml` workflow triggers on `push: tags: ["v*"]`. It installs `upx` (`sudo apt-get install -y upx`) and runs GoReleaser (`goreleaser/goreleaser-action@v6`) to cross-compile across 5 OS/Arch
AGENTS.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md — Thermal Coding Standards & Architecture Guide

This document defines the architectural conventions, coding standards, loader requirements, build quirks, and historical lessons for Thermal (github.com/jadmadi/thermal). Any AI coding assistant (Claude Code, Gemini CLI, Devin, OpenCode, Cursor, etc.) working on this repository MUST read and adhere to these standards.


1. Project Purpose & Architecture

Thermal (thermal) is a high-performance, zero-allocation terminal contribution heatmap and leaderboard tool for AI coding assistants. It scans local databases and session transcripts across multiple AI tools, calculates activity and token metrics, and renders beautiful terminal heatmaps.

Directory Structure

thermal/
├── cmd/thermal/         # Main CLI entrypoint (main.go, upgrade.go for self-update mechanism)
├── internal/loaders/    # Tool-specific ingestion engines and incremental delta-cache
├── internal/thermal/    # Heatmap algorithms, streak calculation, and time parsing
├── internal/render/     # Terminal formatting, color palettes, dashboard & leaderboard UI
├── internal/version/    # SemVer constants and ldflag injection targets
├── build.sh             # Local multi-target build and UPX compression script
└── .goreleaser.yml      # Automated GitHub Actions release configuration

2. Core Coding & Architectural Standards

A. Read-Only Data Ingestion (internal/loaders/)

  1. Never Modify User Data: All SQLite connections MUST open in strictly read-only mode using URI parameters:
    db, err := sql.Open("sqlite", "file:"+dbPath+"?mode=ro")
    
  2. Memory-Mapped I/O: Immediately after opening any SQLite database, execute PRAGMA mmap_size to enable memory mapping for instant scanning of multi-gigabyte files:
    db.Exec("PRAGMA mmap_size=268435456") // 256MB mmap window
    
  3. Robust Time Parsing (parseSessionTime): AI tool timestamps vary wildly across tools and versions (RFC3339 strings, Unix seconds, milliseconds, microseconds, SQLite strings). Always use robust multi-format parsing or time_test.go utilities. Never assume a single fixed format.
  4. Incremental Delta Caching (cache.go): For large databases (Devin, OpenCode, MiMoCode, Codex) and multi-file scanners (command-code, Agy), use the LoadOrScanWithCache mechanism (~/.cache/thermal/<tool>.json). Store exact file modification times (mod_time), sizes (size), or max seen transaction IDs so subsequent invocations take under 10ms.
  5. Concurrency Safety: Multi-file, directory, and JSONL log scanners (command-code, Codex rollout logs, Agy overview logs) must use bounded worker pools (sync.WaitGroup or semaphore channels capped at ~16 workers) with thread-safe aggregation (sync.Mutex). Never spawn unbounded goroutines over thousands of files.

Read the full file on GitHub · 110 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 110 lines · 1,925 tokens per session scan B 84c574a3a307

Subscribe to this mod's changes

thermal AGENTS.md is an instructions file published in the GitHub repository jadmadi/thermal (1 stars, last pushed 1mo ago), licensed MIT. It adds 1,925 tokens to every session, about $0.0096 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.