codecarbon / webapp
AGENTS.md1.9k starsChanged 15 days agoMITView on GitHub
Scope: everything under webapp/. The repository root has its own AGENTS.md covering the Python package and the API — this file adds to it, and wins where the two disagree about webapp code. 1. Propose before editing. Read the relevant code first, then say what will change and where, and stop for approval. Do not edit on the same turn as the proposal — the review gate is the point, so an unrequested implementation is the failure mode even when…
- Installs packages
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Propose before editing: Read the relevant code first, then say what will change and where, and stop for approval.
- Very specific: line 13
Follow the tests: Check tests/ for coverage of the feature being touched and update it in the same change.
- Very specific: line 17
Sweep the docs: After a change, check the *.md files for anything it invalidates and update them briefly — what is necessary, not a rewrite.
- Distinctive: line 24
Never commit. Never stage: Not with git commit, not with git add, not as a convenience at the end of a task — leave both to the user, every …
- Very specific: line 126
Components, not class-string constants: Never const FOO = "flex items-center …" as a styling layer, and no helpers module of class strings.
- Very specific: line 143
Verify with tsc, eslint, prettier, vitest and vite build, and update any test whose copy changed.
- Distinctive: line 170
A modal that duplicates an existing page: prefer opening in place, and ask before deleting anything.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 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
Webapp agent instructions
Scope: everything under webapp/. The repository root has its own AGENTS.md
covering the Python package and the API — this file adds to it, and wins where
the two disagree about webapp code.
Working agreement
- Propose before editing. Read the relevant code first, then say what will change and where, and stop for approval. Do not edit on the same turn as the proposal — the review gate is the point, so an unrequested implementation is the failure mode even when the change looks obvious.
- Follow the tests. Check
tests/for coverage of the feature being touched and update it in the same change. If nothing covers it but a similar component or page is tested, ask before adding new tests rather than inventing a convention. - Sweep the docs. After a change, check the
*.mdfiles for anything it invalidates and update them briefly — what is necessary, not a rewrite. - Hand over the commit; never make it. See Commits — this one has no exceptions.
Commits
Never commit. Never stage. Not with git commit, not with git add, not as
a convenience at the end of a task — leave both to the user, every time.
Finish instead by giving the commit message as text: medium length, neither a one-liner nor a changelog. Only what matters, not verbose — what changed, and why it matters.
Then ask whether to fold anything already staged into the same message, rather than assuming either way.
Stack
React 19 + Vite + TypeScript, Tailwind v4, Radix primitives, SWR for fetching,
Zod for response schemas, sonner for toasts, react-router-dom v7. pnpm is
the package manager on Node 24, for the supply-chain settings in
pnpm-workspace.yaml. CI and the deployment install with
pnpm install --frozen-lockfile, so commit pnpm-lock.yaml and never a
package-lock.json; never install with npm. @/ resolves to src/.
Layout
src/api/— one module per resource, plusclient.ts(fetch wrapper),schemas.ts(Zod types),swr.ts(hooks),errors.ts.src/components/— kebab-case files.src/components/ui/holds the shared primitives,src/components/icons/the SVG icons.src/pages/— PascalCase, one per route;src/layouts/,src/hooks/,src/helpers/,src/utils/as named.tests/— Vitest + Testing Library, mirroringsrc/.e2e/— Playwright.
Component conventions
There are two generations of UI primitives in src/components/ui/. The
redesign ones — form-field.tsx, modal-header.tsx, primary-button.tsx,
secondary-button.tsx, icon-button.tsx, menu.tsx, tab-nav.tsx,
breadcrumb.tsx — carry the current design. The older shadcn ones —
input.tsx, label.tsx, button.tsx, card.tsx — remain only because
pre-redesign screens still use them. New work uses the redesign layer.
Modals share one shell; copy it rather than restating it:
<Dialog open={isOpen} onOpenChange={handleClose}>
{/* The design's own close control lives in the header, so the shared
corner button is omitted. */}
<DialogContent
hideClose
className="max-w-[560px] gap-0 rounded-none border-2 border-black bg-cc-background p-0 shadow-dialog"
>
<ModalHeader title="Create thing" />
<form className="flex flex-col gap-7 px-6 py-8 sm:px-10 sm:py-10" onSubmit={...}>
<FormField id="thing-name" label="Name" placeholder="Name" required ... />
<div className="flex pt-4">
<PrimaryButton type="submit" disabled={isLoading || !name.trim()}>
Create thing
</PrimaryButton>
</div>
</form>
</DialogContent>
</Dialog>create-project-modal.tsx, create-experiment-modal.tsx and
create-organization-modal.tsx are the reference implementations. Submission
goes through toast.promise; the submit button is disabled while pending and
while the required field is blank, instead of validating on click.
Implementing a Figma design
The task supplies the frame link, and sometimes a note that the screen closely resembles an existing one — verify that claim against the design before leaning on it. Implement every state the design provides in one pass.
The four things that matter most
- Responsive, not pixel-perfect. Frames are 1440x1024 desktop only; there is no mobile design. Don't reproduce absolute coordinates or fixed sizes — one container gutter for horizontal placement, gaps for vertical rhythm, working down to ~320px. Make the mobile calls yourself, coherently.
Ask when the design shows what the app doesn't have. This is a UI redesign, not an architecture redesign. Data with no API field, menus whose contents are undrawn, controls with no defined action — stop and ask rather than inventing endpoints or features. Batch every question into one round before coding, recommendation first.
Decide these yourself instead of asking: contradictory measurements for one edge (pick one, comment why), sizes that differ between two frames of the same component, and elements that are plainly a Figma component default rather than intent. Report what you decided afterwards.
- Extend the redesign; don't start a parallel style. First find out where the redesign stands: read whatever screens and shared primitives already follow it. If nothing does, this is the first page and you are setting the vocabulary — build the recurring treatments as shared components from the start rather than inline, so the next page has something to inherit. If work already exists, take the page shell from it, reuse every primitive that fits, and extend one with a prop rather than forking it; add new shared components only where the design genuinely introduces something the existing set has no answer for. Either way, shared chrome — navigation, account menu — stays in its own components: never rebuild an in-page nav, even where an older frame draws one.
- Components, not class-string constants. Never
const FOO = "flex items-center …"as a styling layer, and no helpers module of class strings. A repeated treatment is a component inui/. Local constants are fine only when two elements inside one component share them.
House style for design work
- Tokens only: the design system's colour and type tokens, and the spacing and radius scales in the Tailwind config. No hardcoded hex or font sizes.
- kebab-case filenames, PascalCase components; pages stay PascalCase.
- Comments are sparse and concise, and explain reasoning only: why a value differs from the design, how an unspecified case was resolved. Never narrate the code or explain routine implementation. No long blocks, no Figma node ids. Wrap at 80 columns.
- Respect
prefers-reduced-motion; tie labels to inputs, keep focus-visible rings, setaria-currenton the current item, give icon-only buttonssr-onlytext. - Verify with
tsc, eslint, prettier, vitest andvite build, and update any test whose copy changed. You cannot see the app running — it needs the API — so state what is unverified rather than implying you checked it.
Known traps — check only the ones the page actually hits
Ignore the rest; none of these are things to go hunting for.
- A
type-*class not taking effect. If a primitive from the underlying component library sets its owntext-*, twMerge keeps both and the utility wins (a 24px title renders at 18px). There, and only there, name the size as a utility; everywhere elsetype-*remains the convention. - Building a dialog: ours are flex-centred and fade + rise in place
(
cc-dialog-*). Don't reintroduce transform centring orslide-in-from-*. - Adding a dropdown to a padded trigger: Radix anchors to the trigger's
box, not its glyph — cancel the padding with
sideOffset/alignOffset. - Gating an SWR key on transient UI state (a menu's
open, say): the data vanishes when it flips and the UI visibly regroups. Latch the condition. - A mutation that refetches while a form is open: key reset effects on ids or fields so the refresh can't clobber in-progress edits.
- Rows in a list: the row text lights as one item on hover, with the actions cell excluded so its small trigger reports its own hitbox, and padding on the link so the whole band is clickable. Follow whatever row the redesign already has.
- Forms: a real
<form>so Enter submits, the primary disabled until the required fields are filled, no closing on failure, transient state reset on open. - A modal that duplicates an existing page: prefer opening in place, and ask before deleting anything.
When the work is done
Report (a) everything that differed from the design and every decision the design didn't specify, grouped and concise, for the PR remarks, and (b) a conventional-commit message, per Commits.
Styling
Design tokens live in tailwind.config.ts and src/globals.css: cc-* colors,
h-control, rounded-field, shadow-dialog, the type-* type classes, and
the rail/gauge/heading spacing. Use them — do not hardcode hex values or
one-off pixel sizes. Merge classes with cn() from @/helpers/utils.
Comments
Components carry a block comment explaining why the thing is shaped the way it is, often citing the Figma frame it comes from. Match that density: explain the decision, not the syntax.
Commands
pnpm install # install, updating pnpm-lock.yaml if package.json changed
pnpm dev # dev server on http://localhost:3000
pnpm test:run # unit tests once (pnpm test watches)
pnpm test:e2e # Playwright
pnpm lint # eslint
pnpm format # prettier --write (4-space indent, from .prettierrc)
pnpm exec tsc --noEmit # typecheck
pnpm build # what the deployment runs, after a frozen installTrending
More talk lately.about the whole repository
Who's talking about mlco2/codecarbon
- @glennstreet.bsky.social“And it’s open source: github.com/mlco2/codeca... #aiethics”Bluesky · Jan 5, 2025 · 4 likes
- A Hacker News story“Show HN: Code Carbon-Estimate and track carbon emissions from ML models training”Hacker News · Dec 1, 2020 · 4 points
- huggingface/transformers“Option to disable CodeCarbon”GitHub · Sep 7, 2023 · 3 reactions
- mlco2/codecarbon-landing-page“Update Team.astro - contributing guidelines”GitHub · Apr 8, 2026 · 1 reactions
- @aminesaboni.bsky.social“Hello, on fait de notre mieux sur github.com/mlco2/codeca... pour être ouverts aux contributions externes, …”Bluesky · Jan 22, 2026 · 1 likes
The biggest 5 of 51 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 51
Talked about on GitHub, Bluesky and Hacker News (51 times).
On GitHub · 46
- Sep 7, 2023Option to disable CodeCarbon — huggingface/transformers3 reactions · 9 comments
- Apr 8, 2026Update Team.astro - contributing guidelines — mlco2/codecarbon-landing-page1 reaction
- Sep 11, 2024GitHub Green Software Project: Request for Feedback — Green-Software-Foundation/community-wg1 reaction · 3 comments
- Apr 22, 2024carbon footprint in report — snakemake/snakemake1 reaction · 4 comments
- Dec 3, 2023Track energy consumption and carbon emissions — Clay-foundation/model1 reaction · 2 comments
41 more on GitHub
- Oct 26, 2026chore(deps): bump the python group with 13 updates — mlops-2627q1-mds-upc/MLOPS_Recommenditos0 reactions · 1 comment
- Oct 19, 2026Bump ecologits from 0.11.2 to 0.11.3 — warmelinks/agent-footprint0 reactions
- Oct 19, 2026chore(deps): bump the python group with 6 updates — gabrielkpo/video-super-resolution-fsrcnn0 reactions
- Oct 16, 2026chore(deps): bump the python-minor-and-patch group with 19 updates — etalab-ia/OpenGateLLM0 reactions
- Oct 5, 2026chore(deps): bump the pip-minor-patch group across 1 directory with 2 updates — betagouv/ComparIA0 reactions · 1 comment
- Sep 30, 2026build(deps): bump the pip-minor-patch group with 2 updates — betagouv/ComparIA0 reactions · 2 comments
- Sep 28, 2026build(deps): bump the ai-service-dependencies group in /apps/ai-service with 12 updates — Amsterdam/brede-welvaart0 reactions
- Aug 18, 2026fix(webapp): show time on time-series axis for multi-day spans — olitreadwell/codecarbon0 reactions
- Aug 4, 2026uv: Dependency Graph fails with "No pyproject.toml found" although repository contains pyproject.toml and uv.lock — dependabot/dependabot-core0 reactions · 3 comments
- Jul 19, 2026build(deps): bump codecarbon from 3.2.8 to 3.2.9 in /engine — BipinChowdary/AquaNavAI0 reactions · 1 comment
- Jun 27, 2026[skill-suggestion] CodeCarbon — stanfish06/skillquarium0 reactions
- Jun 15, 2026python3Packages.codecarbon: 3.2.7 -> 3.2.8 — NixOS/nixpkgs0 reactions · 1 comment
- May 19, 2026python3Packages.codecarbon: 3.2.6 -> 3.2.7 — NixOS/nixpkgs0 reactions · 1 comment
- May 14, 2026Benchmark JAVA rules — green-code-initiative/creedengo-javasays it tested it0 reactions
- May 14, 2026Benchmark Python rules — green-code-initiative/creedengo-pythonsays it tested it0 reactions
- May 14, 2026Benchmark PHP rules — green-code-initiative/creedengo-phpsays it tested it0 reactions
- Mar 31, 2026build(deps): bump codecarbon from 3.2.3 to 3.2.6 — green-code-initiative/EnergyTracer0 reactions
- Mar 24, 2026build(deps): bump codecarbon from 3.2.3 to 3.2.5 — green-code-initiative/EnergyTracer0 reactions · 1 comment
- Feb 23, 2026feat: ps1 script to install codecarbon — mlco2/codecarbon-landing-page0 reactions
- Feb 19, 2026feat: bash script to install codecarbon — mlco2/codecarbon-landing-page0 reactions · 2 comments
- Feb 10, 2026index.html. <!DOCTYPE html> <html> <head> <title>Green Software</title> </head> <body> <h1>أهلاً بك في مشروع البرمجيات الخضراء</h1> <p>هذا التطبيق قيد الإنشاء من الهاتف.</p> </body> </html> — ashraflx71/GreenSoftwareDirectory0 reactions · 1 comment
- Feb 2, 2026Add Python code injection system for remote execution — mlco2/codecarbon-mcp0 reactions
- Aug 27, 2025Category filter does not respect second_path projects — cncf/landscape20 reactions · 2 comments
- Aug 26, 2025Bugfix/issue 873 add gpu UUID support — cianc/codecarbon0 reactions
- Dec 20, 2024New --sample option does not seem to work as documented — vladkens/macmon0 reactions · 3 comments
- Dec 1, 2024Bump the app-dependencies group across 1 directory with 3 updates — mlops-2425q1-mds-upc/MLOps-2425q1-demos0 reactions · 1 comment
- Nov 21, 20242.4_formats_and_performance energy monitoring — EO-College/cubes-and-clouds0 reactions · 3 comments
- Nov 1, 2024Bump the app-dependencies group across 1 directory with 6 updates — MLOps-essi-upc/MLOps2023Course-demo0 reactions · 1 comment
- Sep 20, 2024distutils is deprecated with removal for Python 3.12 — openfisca/openfisca-core0 reactions · 3 comments
- Aug 22, 2024[BUG] ROCm 2.4.0 "terminate called after throwing an instance of 'c10::Error' what(): invalid device pointer: 0x4c44000" — pytorch/pytorch0 reactions · 26 comments
- Aug 22, 2024[BUG] ROCm/WSL "HIP error: no kernel image is available for execution on the device" — huggingface/sentence-transformers0 reactions · 3 comments
- Aug 22, 2024[BUG] AMD ROCm -- HIP out of memory. Tried to allocate... — huggingface/autotrain-advanced0 reactions · 11 comments
- Jul 12, 2024Build PIP package ? — snip3rnick/PyHardwareMonitor0 reactions · 3 comments
- May 25, 2024How to configure it ? — uibcdf/action-build-and-upload-conda-packages0 reactions · 4 comments
- Feb 20, 2024Negative power values — joular/powerjoular0 reactions · 3 comments
- Jan 2, 2024Add codecarbon repository link — DeepSourceCorp/good-first-issue0 reactions · 5 comments
- Oct 30, 2023Integrate Codecarbon into workflow — joshuawe/time-series-robustness0 reactions
- Jul 4, 2023CodeCarbon table fails for latest release — fitbenchmarking/fitbenchmarking0 reactions
- Apr 27, 2023Green cloud computing — bacalhau-project/bacalhau0 reactions
- Apr 22, 2022add codecarbon tracking — davanstrien/flyswot-gym0 reactions
- Feb 5, 2022[references] Add codecarbon integration in training scripts — frgfm/holocron0 reactions
On Bluesky · 3
- Jan 5, 2025And it’s open source: github.com/mlco2/codeca... #aiethics — @glennstreet.bsky.social4 likes and reposts
- Jan 22, 2026Hello, on fait de notre mieux sur github.com/mlco2/codeca... pour être ouverts aux contributions externes, on a même 3 projets menés par… — @aminesaboni.bsky.social1 likes and repost
- Oct 1, 2025You can track your carbon footprint when training #ML models or running any other type of #python code with #codecarbon… — @alexisperrier.bsky.social1 likes and repost
On Hacker News · 2
- Dec 1, 2020Show HN: Code Carbon-Estimate and track carbon emissions from ML models training4 points · 1 comment
- Aug 9, 2021Codecarbon – Track Emissions from Compute1 point
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 28,693 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 repository2 other files it gives its agents.
- webapp/CLAUDE.mdCLAUDE.md
- review-fix-prSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

