Spaces:
Sleeping
Sleeping
Burnmydays Claude Opus 4.8 (1M context) commited on
Commit ·
f2a7d8a
1
Parent(s): b60e583
docs: add AGENTS.md — agent/dev guide (architecture, frozen invariants, conventions)
Browse filesPublic-safe guide for AI agents + humans: what the project is, run commands, per-file
architecture, frozen invariants (SEED numbers, Υ formula, Υ=18436.98), conventions
(no secrets in repo, Supabase new-tables-only, separate Claude/Codex), metric defs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AGENTS.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AGENTS.md — MO§ES SigRank
|
| 2 |
+
|
| 3 |
+
Guidance for AI coding agents (and humans) working in this repo. Read this before editing.
|
| 4 |
+
|
| 5 |
+
## What this is
|
| 6 |
+
**SIGRANK** (powered by MO§ES™) is a Gradio Space that ranks AI coding operators by
|
| 7 |
+
**architecture, not volume**. The core metric is **Υ = (Cache · Output) / Input²** — squaring
|
| 8 |
+
input punishes wasteful prompting while rewarding cache reuse and real output. Volume can't buy rank.
|
| 9 |
+
|
| 10 |
+
Live Space: `huggingface.co/spaces/burnmydays/sigrank`
|
| 11 |
+
|
| 12 |
+
## Run it
|
| 13 |
+
```bash
|
| 14 |
+
pip install -r requirements.txt
|
| 15 |
+
python app.py # launches the Gradio UI on :7860
|
| 16 |
+
python sigrank.py --help # local-first CLI importer (reads your own ccusage usage)
|
| 17 |
+
python metrics.py # prints the SEED corpus metrics (sanity check)
|
| 18 |
+
python -m pytest test_metrics.py # metric invariant tests
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
## Architecture (one job per file)
|
| 22 |
+
- `metrics.py` — the metric engine. `compute(i, o, cw, cr)` → full ledger (Υ, SNR, leverage,
|
| 23 |
+
velocity, 10x DEV, $/1M). Also holds the `SEED` corpus (MO§ES + wild operators from tokscale.ai).
|
| 24 |
+
- `ingest.py` — parsers. ccusage (Claude) and Codex JSON shapes → four token pillars. Codex input
|
| 25 |
+
is *estimated* (no native input field); see `_codex_input_estimate`.
|
| 26 |
+
- `app.py` — the Gradio UI. Tabs: **Home / Create / Leaders / VS / Reports**. Board rendering
|
| 27 |
+
(`board_html`), operator cards (`card_html`), compare (`compare_html`), insights (`insights_html`),
|
| 28 |
+
Home landing (`metric_features_html`, `home_html`).
|
| 29 |
+
- `theme.py` — all custom CSS (dark/gold). Mobile rules live in `@media (max-width: 700px)` blocks.
|
| 30 |
+
- `db.py` — optional Supabase persistence; falls back to `metrics.SEED` when unconfigured (works offline).
|
| 31 |
+
- `narrate.py` — optional MiniCPM-0.5B prose "operator reads" via `@spaces.GPU`; degrades to a
|
| 32 |
+
template when no GPU/torch (so the app runs fine on CPU).
|
| 33 |
+
- `sigrank.py` / `sigrank` — local-first CLI: reads your real ccusage usage on your machine, prints
|
| 34 |
+
your operator read, optional `--submit` to the board.
|
| 35 |
+
|
| 36 |
+
## Frozen invariants — DO NOT CHANGE without explicit instruction
|
| 37 |
+
- **`metrics.py` `SEED` numbers** — the canonical corpus. MO§ES row = `(1_251_211, 11_296_121,
|
| 38 |
+
128_196_310, 2_555_179_769)`. Changing these breaks the published leaderboard + tests.
|
| 39 |
+
- **The Υ formula** `(cache_read · output) / input²` and the telescoping identity
|
| 40 |
+
(10x DEV = log₁₀(leverage), Υ = leverage × velocity). `test_metrics.py` locks these.
|
| 41 |
+
- MO§ES Υ must print **18436.98**.
|
| 42 |
+
|
| 43 |
+
## Conventions
|
| 44 |
+
- **No secrets in the repo.** Keys live only in `SECRETS.local.md` (gitignored) and HF Space
|
| 45 |
+
Secrets. Never commit tokens/keys.
|
| 46 |
+
- **Supabase: new tables only.** Do not alter existing tables; SigRank uses its own.
|
| 47 |
+
- **Claude and Codex are measured separately** — never combine providers in one reading.
|
| 48 |
+
- **Deploy** by pushing to the Space git remote; the HF Space is the live deliverable. CI/tests
|
| 49 |
+
should stay green (`pytest`, `python -c "import app; app._build_demo()"`).
|
| 50 |
+
- Match the surrounding code style; keep changes minimal and verifiable.
|
| 51 |
+
|
| 52 |
+
## Metric definitions (match `metrics.compute` exactly)
|
| 53 |
+
- **Υ yield** = (cache_read · output) / input² — the rank metric.
|
| 54 |
+
- **SNR** = output / (input + output) — signal vs. noise.
|
| 55 |
+
- **leverage** = cache_read / input — cache reuse amplification.
|
| 56 |
+
- **velocity** = output / input — throughput.
|
| 57 |
+
- **10x DEV** = log₁₀(transmission × commitment × reuse) = log₁₀(leverage).
|
| 58 |
+
- **$/1M** = blended cost per million tokens across all states.
|