agentleFS
vzakusylovzakusylo/victron/CLAUDE.md

victron

CLAUDE.md4 starsChanged 13 days agoMITView on GitHub

Node-RED control for a Victron Cerbo GX (Venus OS): battery / grid control under Norwegian capacity tariffs, a Tuya heat pump with boiler (DHW), room sensors and the dashboards. The live GX runs flows.json; everything else is source, tools, tests and docs. camera-ai/ is a separate project with its own README and PLAN. 1. git fetch origin; master tip and d# / i# (node tools/flows.js version); what the GX runs (last Deploy GX code run). 2. Open PRs and checks:…

The file

We split this CLAUDE.md into the rules it gives an agent

8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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
  1. Very specific:

    Self-improvement: when the process costs time or fails, fix it, then update the rule (this file, the guide, docs/agent-workflow.md, …

    line 16
  2. Very specific:

    Branches and PRs: every change on its own branch from a fresh origin/master, in its own worktree, PR into master.

    line 62
  3. Very specific:

    Tasks live only in BACKLOG.md: add the task before the branch, set "in progress" with branch / PR, move to Done with PR and d# in the …

    line 68
  4. Very specific:

    Live GX, secrets, real backups: never touch without an explicit owner request.

    line 74
  5. Distinctive:

    Every report ends with the branch name.

    line 94
  6. Very specific:

    Write .copilot-brief-<branch>.md in that worktree (goal, context, steps, tests, delivery: PR, then auto-merge after review feedback is …

    line 107
  7. Very specific:

    After the PR merges: herdr-task.ps1 close <branch>.

    line 110
  8. Very specific:

    Test GX takes ~70 min (slowest file).

    line 127

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md: working in this repository

Node-RED control for a Victron Cerbo GX (Venus OS): battery / grid control under Norwegian capacity tariffs, a Tuya heat pump with boiler (DHW), room sensors and the dashboards. The live GX runs flows.json; everything else is source, tools, tests and docs. camera-ai/ is a separate project with its own README and PLAN.

Start of every session (before any work)

  1. git fetch origin; master tip and d# / i# (node tools/flows.js version); what the GX runs (last Deploy GX code run).
  2. Open PRs and checks: gh pr list --state open, gh pr checks <N>.
  3. Herdr: herdr status → running, else start herdr in its own terminal tab via run_in_terminal so Claude can read_terminal it (never restart a running server without the owner). herdr agent list, then read every worker.
  4. BACKLOG.md: in progress / next. Then tell the owner in a few lines what is running.

Full rules (from Claude's memory and the owner's decisions): docs/claude-operating-guide.md. Self-improvement: when the process costs time or fails, fix it, then update the rule (this file, the guide, docs/agent-workflow.md, .github/copilot-instructions.md, a skill or memory) in the same session and add a line to docs/agent-process-log.md, the dated log of what is going on.

Where things are

PathWhat
NN Name.js / NN Name.html (root)Source of every function node / dashboard template. Edit these, never flows.json by hand.
NN Name.init.jsThe node's "On Start" code
lib/heat-pump/*.js, lib/grid/*.jsPulled in by // #include lib/…js at build time (tools/includes.js): same scope as the node, not modules. A library may serve multiple sources only with //! @shared in its header. //! header lines are not embedded.
flows.jsonBuilt from the NN sources by tools/flows.js sync; the tab label carries the version d#<n>
tests/*.test.jsUnit tests (node:test); tests/harness.js loads a node with fake flow / context
tools/flows.jssync, check, bump
tools/test-gx/Test GX: Venus simulator + Node-RED in Docker, scenario runner, scenarios/*.yml
tools/gx/, scripts/gx-*.ps1Deploy tooling (compare, gate, deploy)
.github/workflows/check, pr-tests, test-gx (scenarios), claude-code-review, deploy-gx-code, deploy-victron
config/Device configs and install notes (serialbattery, MultiPlus)
docs/How things work (design, deploy, Test GX). docs/archive/ = old handoffs, read only
BACKLOG.mdThe one file for tasks, plans, test plans, open PRs, deploy state and progress

Big nodes: 40 Heat pump automations.js (header, state, load, ui, tick; the parts are in lib/heat-pump/: curves, heating-decide, dhw-helpers, dhw-tick, heating-tick, kick) and 01 Battery + Grid Controller.js (main flow; lib/grid/constants, lib/grid/helpers). Read the header comment of the node first: it lists every d# change. A lib edit is a change of that node: sync bumps d# and it deploys like any flow change.

Commands

node tools/flows.js sync          # after editing NN sources: rebuild flows.json, bump d# once
node tools/flows.js check         # sources and flows.json in sync (CI runs this)
node tools/flows.js version       # d#N · i#M
node tools/infra-version.js bump "Short description"  # once per infrastructure branch; optional PR number after description
node tools/infra-version.js check # compare against the merge base with origin/master
node --test "tests/*.test.js"     # all unit tests
node --test tests/heat-curve-follow.test.js   # one file
.\tools\test-gx\up.ps1 -Sim emu   # local Test GX stack (Docker); .\up.ps1 -Down to stop
node tools/test-gx/run-scenarios.js --file heating-review.yml   # scenarios of one file against the local stack

Rules

  1. Every flow change: edit the NN source, node tools/flows.js sync (bumps d#), check, unit tests. Never hand-edit flows.json. If master moved, merge it, sync again.
  2. A unit test for every new or changed decision. Pure decisions (e.g. heatDecide) are tested directly; behaviour through tests/harness.js with ticks. A test must fail without the change.
  3. Branches and PRs: every change on its own branch from a fresh origin/master, in its own worktree, PR into master. Address all review feedback and resolve every thread before enabling auto-merge with gh pr merge <N> --auto --merge. master requires check, tests, secret-files, review, scenarios. Never push to master directly; merge commits. One open PR at a time: rebase the branch on origin/master right before opening its PR (force-with-lease only for that); see the operating guide §2a.
  4. Tasks live only in BACKLOG.md: add the task before the branch, set "in progress" with branch / PR, move to Done with PR and d# in the same PR as the work.
  5. Deploys: a green Test GX run on a master push deploys that commit to the live GX automatically (deploy-gx-code.yml, env victron-gx-auto). Manual: Actions → Deploy GX code, dry run then apply, owner approval. The whole-flow deploy stops on drift from the recorded common Git baseline. Review field names with tools/gx/compare.js; use the manual-only overwrite_drift only after the owner approves replacing the drift.
  6. Live GX, secrets, real backups: never touch without an explicit owner request. Real backups and keys stay outside the repo and the Docker image. secret-files CI blocks private hosts / keys.
  7. Test GX work does not change production sources. A bug found by a scenario is marked expected_fail; the fix gets its own PR. New scenario file → add it to the files matrix in test-gx.yml (a unit test checks this).
  8. English in code, docs, commits and PRs.
  9. Owner's own rules (in the owner's global CLAUDE.md) win: e.g. commits / pushes only when asked in that session.
  10. Every infrastructure change bumps i# once per PR: tools/, scripts/, .github/workflows/, tests/, .claude/skills/, CLAUDE.md, docs/claude-operating-guide.md, docs/agent-workflow.md and .github/copilot-instructions.md. Production-only and other docs-only changes (including BACKLOG.md) do not bump i#. sync still changes only d#. If a concurrent bump lands, merge master, keep its ledger history, and regenerate your single bump.

Agents

Claude plans, reviews and may implement when the owner asks; GitHub Copilot CLI implements from a brief file. Claude picks a Copilot worker tier per task with tools/herdr/herdr-task.ps1 and new <branch> -Tier <tier>. The repo's tools/herdr/models.json defines the tiers; the owner's skill copy is kept in sync. New workers use low reasoning effort unless the tier specifies otherwise; -Model and -Effort override the tier. One agent per worktree. Copilot's rules: .github/copilot-instructions.md. Every report ends with the branch name.

Every new Copilot task runs as a Herdr worker (since 2026-11-21), so Claude can send corrections and ask for progress instead of the owner relaying text:

  1. herdr status must say running (else start herdr in its own terminal; never restart a running server without the owner: it kills all workers).
  2. From the main checkout, run .\tools\herdr\herdr-task.ps1 new <branch> -Repo (Get-Location).Path -Base origin/master -Tier <tier> → worktree ~\.herdr\worktrees\victron\<branch>, Copilot with --allow-all as agent w-<branch>. Check the status bar shows the intended model; an unknown model ID falls back to Copilot's default. Without --allow-all the worker stops at a permission prompt for every command and nobody can answer it through the harness (21 Nov: a worker waited 6 min on git fetch). Check the first read after send: a "Do you want to run this command?" box means it was started without it; close and start it again with the current script.
  3. Write .copilot-brief-<branch>.md in that worktree (goal, context, steps, tests, delivery: PR, then auto-merge after review feedback is addressed and threads are resolved).
  4. herdr-task.ps1 send <branch> "Read .copilot-brief-<branch>.md and do all of it."; later send for corrections / "progress?", read <branch> to look without interrupting, wait <branch> until idle / blocked.
  5. After the PR merges: herdr-task.ps1 close <branch>. The owner's herdr-worker skill (~\.claude\skills\herdr-worker\) also provides the launcher. A plain copilot --allow-all --model gpt-6.2-sol --reasoning-effort low -i 'Read <brief> and do it' in a terminal is the standard-tier fallback when Herdr is not available; then nobody can type into it except the owner.

Project skills (.claude/skills/): ship-pr (sync, test, backlog, PR, review before auto-merge), test-gx-local (Docker scenarios), deploy-gx (dry run, GX-only lines, apply, confirm), victron-status (live status via MCP), gx-reach (GX reachable + NR1 baseline command), claude-review-token (owner-run rotation of the Claude review secret), loop-token (rotate the Windows dev loop's GitHub token: Claude prepares the page, the owner generates and pastes it into tools/dev-loop/rotate-token.ps1; loop cycles failing with "error connecting to api.github.com" can mean a bad token). Only the Windows loop runs, never the Omarchy one.

The review check fails when the Claude review finds a failing test or a High / Critical problem (verdict gate in claude-code-review.yml); fix it and push, or comment @claude review to re-run. .github/CODEOWNERS requests the owner's review on live-control, CI and deploy files.

Gotchas

  • flows.json is ~1 MB: search it with node tools/flows.js or grep the NN sources instead.
  • The fixture test compares new dotted strings with committed HEAD; it fails until a change is committed.
  • Test GX takes ~70 min (slowest file); scenarios run at their faketime rate (@… x60).
  • Files in docs/archive/ and the *-handoff*.md docs are history, not current instructions.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.