tokenmaxxing
AGENTS.md88 starsChanged 44 days agoMITView on GitHub
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,700 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- release-cliSkill
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 5
Prefer native Effect errors over plain JavaScript Error subclasses in Effect code.
- Very specific: line 6
Use Data.TaggedError for internal typed errors that stay inside the Effect error channel.
- Very specific: line 7
Use Schema.TaggedError when an error is part of a public schema or wire contract.
- Very specific: line 8
Avoid throw for expected domain failures.
- Distinctive: line 12
Prefer local declarations first and grouped exports at the end of each authored source file.
- Very specific: line 13
Use export { ... } for runtime values and export type { ...
- Very specific: line 14
Put default exports at the end too, using a named local value before export default name;.
- Distinctive: line 15
Do not hand-edit generated files just to satisfy this style rule.
- Very specific: line 26
Keep bun run test output clean.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Repository Instructions
Effect Error Style
- Prefer native Effect errors over plain JavaScript
Errorsubclasses in Effect code. - Use
Data.TaggedErrorfor internal typed errors that stay inside the Effect error channel. - Use
Schema.TaggedErrorwhen an error is part of a public schema or wire contract. - Avoid
throwfor expected domain failures; returnEffect.fail(...)with a typed error instead.
Export Style
- Prefer local declarations first and grouped exports at the end of each authored source file.
- Use
export { ... }for runtime values andexport type { ... }for type-only exports. - Put default exports at the end too, using a named local value before
export default name;. - Do not hand-edit generated files just to satisfy this style rule.
Conventions
- Daily usage rows are keyed
(deviceId, date, source, model)and upserted; sync must stay idempotent. - Cost is frozen at first upload unless the usage (token counts) changes: the
usage_daysupsert keeps the storedcost_usdwhen all token columns match (ccusage re-prices unmarked Codex history with the device's current speed tier), takes the incoming cost when any token count differs, and prices a row stored at 0. Fixing already-stored cost means editing D1 directly; re-ingesting payloads with the same tokens is a no-op for cost. - Only a parser change may lower a re-sent day. Each raw-ingested
usage_daysrow recordscounted_by, the serverPARSER_VERSIONthat produced it. A re-sent (device, day, source) is kept when every stored row has the currentcounted_byand the uploading owner, and the stored total is higher than the re-count. Kept means never lowered or pruned, though models that are new or grew are still taken. A lower re-count from the same parser means the device lost logs (deleted or pruned, a narrower source root, a full re-sync past Claude Code's 30-day cleanup), not a correction. The decision is per whole day, so a model relabeled without a loss is still replaced and pruned. Any other re-send replaces the day as before. So a correction that has to lower or drop stored usage ships as aPARSER_VERSIONbump, also when it comes from a ccusage or CLI-side counting fix. A bump is required for any server change to the rows a report yields (parsing, model labels, plausibility limits). A bump re-counts every device's trailing window once, losses included. The structured/usage/syncpath writes NULL, which is always replaced. Known gaps: a timezone change moves usage near midnight into the next day while the earlier day keeps its higher count, and two concurrent ingests from one device can race the check. datecolumns are opaqueYYYY-MM-DDstrings (ccusage local-time buckets); never parse them into Date objects for bucketing. Do day arithmetic withshiftDayKey/utcDayKeyfrom@tokenmaxxing/api-contract(API windows live inapps/api/src/date-keys.ts).- Published CLIs bundle a frozen contract.
packages/api-contract/fixtures/(recorded CLI requests + the CLI endpoint OpenAPI slice) is a compatibility contract: review diffs there as breaking-change reviews, and add alegacy/fixture before changing a shape a released CLI sends. Responses go the other way:apps/api/src/http/cli-compat.test.tsdecodes every replayed response and typed CLI error with frozen copies of the released CLI decoders, so fields may be added but never dropped, renamed or retyped, and error_tags never change.fixtures/full-api.openapi.jsonsnapshots the whole API as a review aid; only the CLI slice is frozen. - CLI tokens (
tmx_prefix) never expire; revocation (revokedAt) is the only kill switch. - D1 caps a statement at 100 bound parameters, and the sqlite test harness (
apps/api/src/testing/sqlite-d1.ts) enforces it. Never bind an unbounded list: chunk it, or pass it as one JSON parameter throughjson_each. - Keep
bun run testoutput clean. A test that exercises a logging path captures and asserts the log (makeTestLoggerinapps/api/src/testing/logger.ts;vi.spyOn(console, ...)outside Effect) instead of letting it print.makeTestAppalready captures intoapp.logs. Captured Effect logs are replayed when a test fails.
Reference Repos
.repos/holds upstream source as git submodules, for reading how a dependency actually behaves. It is read-only: never edit, import from, or build it (lint, format and tests already ignore it)..repos/effect-smoland.repos/alchemy-effectare pinned to the release tags matching the catalog versions in the rootpackage.json(effect@XandvXtags). When bumpingeffectoralchemyin the catalog, move the submodule to the matching tag in the same PR:git -C .repos/effect-smol fetch --tags && git -C .repos/effect-smol checkout effect@X, then stage.repos/effect-smol. Don't usegit submodule update --remote..repos/opencodeis not a dependency; it tracks upstreamdevas a reference for OpenCode's data and CLI patterns.- Fetch them with
git submodule update --init .repos/<name>. If a checkout is missing, stale or disagrees with the installed version,node_modulesis the source of truth.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

