# AGENTS.md — Guide for AI agents This file helps AI coding agents and LLM tooling understand and work with this repository quickly. ## What this repo is `llmtrim-stats-plugin` is a **packaged Cordis plugin for DeepSeek Harness (DSH)** that shows live savings from the [llmtrim](https://github.com/fkiene/llmtrim) compression interceptor in the DSH Web UI. The host half runs `llmtrim status --json` via the `subprocess` service and serves the reshaped snapshot over `GET /llmtrim-stats/api`; it also owns the `llmtrim-stats` settings namespace (`{mode, staticStats}`) written via `PUT /llmtrim-stats/config`. The client bundle renders a settings dashboard (incl. four money cards and the carousel config) plus a configurable rotating-or-static carousel strip under the composer. It is a real profile-bundled plugin: `dsh.bundle` (`cordis.patch.yml`) mounts the host half, and the `dsh.client` declaration + `exports["./client"]` register the browser half — install once with `dsh plugin add`, loads on every DSH boot, no cordis_define. ## Repository layout | Path | Role | | --- | --- | | `src/index.ts` | Host half: `subprocess.resolveExecutable('llmtrim')` (fallback `LLMTRIM_BIN` → npm win32-x64 path), `spawn llmtrim status --json`, reshape `daemon/totals/money/cost/byModel` + `computeSavedWeekUsd` (this-week token share × lifetime saved, from daily `by_period` keys), `llmtrim-stats` settings namespace (`{mode, staticStats}`, schemastery schema), `webServer` routes `GET /llmtrim-stats/api` + `PUT /llmtrim-stats/config`. | | `src/client/index.tsx` | Client bundle: single 5s poller `fetch('/llmtrim-stats/api')`, settings dashboard (`settings.section` id `llmtrim-stats`) incl. four money cards + carousel config (Rotating/Static radios + 9 stat checkboxes), configurable dock carousel (`conversation.composer.dock` id `llmtrim-carousel`, 4s cycle), `