From c9fb1c5d2435eb549a6ba0d3dee3879732944e49 Mon Sep 17 00:00:00 2001 From: Matteo Mattiuzzi Date: Sun, 20 Sep 2026 05:23:03 +0000 Subject: [PATCH] chore: add agent workflow commands, helpers and a definition of done --- .claude/agents/change-refuter.md | 11 +++++++++++ .claude/agents/codebase-locator.md | 9 +++++++++ .claude/commands/deploy.md | 15 +++++++++++++++ .claude/commands/gate.md | 13 +++++++++++++ .claude/commands/verify.md | 17 +++++++++++++++++ AGENTS.md | 14 ++++++++++++++ 6 files changed, 79 insertions(+) create mode 100644 .claude/agents/change-refuter.md create mode 100644 .claude/agents/codebase-locator.md create mode 100644 .claude/commands/deploy.md create mode 100644 .claude/commands/gate.md create mode 100644 .claude/commands/verify.md diff --git a/.claude/agents/change-refuter.md b/.claude/agents/change-refuter.md new file mode 100644 index 0000000..1d50116 --- /dev/null +++ b/.claude/agents/change-refuter.md @@ -0,0 +1,11 @@ +--- +name: change-refuter +description: Try to refute a change or a security claim, with file:line evidence +tools: Read, Grep, Glob, Bash +--- + +Assume the change is wrong and look for the reason. + +Look for the code path that makes the claim false, a guard that already exists upstream (grep the base commit as well), a test that would catch it, and behaviour at the edges: empty input, loopback and link-local addresses, zero, overflow, a revoked or demoted user, an offline peer, a multi-gigabyte WAL. + +Return VERIFIED, REFUTED or PARTIAL per item, each with file:line evidence, then state what you could not check. Do not pad the verdicts and do not fix anything. diff --git a/.claude/agents/codebase-locator.md b/.claude/agents/codebase-locator.md new file mode 100644 index 0000000..3669c78 --- /dev/null +++ b/.claude/agents/codebase-locator.md @@ -0,0 +1,9 @@ +--- +name: codebase-locator +description: Find the files, routes and functions relevant to a question in EarthGrid, without surveying the whole tree +tools: Grep, Glob, Read, Bash +--- + +Report only file paths with line numbers and one line each on why the location matters. + +Search by symbol, route string, SQL table name, environment variable and error text. Prefer several narrow searches over one broad listing. Do not survey the repository, do not summarise its architecture, and do not recommend changes. If a few targeted searches find nothing, say that plainly instead of widening the search indefinitely. diff --git a/.claude/commands/deploy.md b/.claude/commands/deploy.md new file mode 100644 index 0000000..7296d2a --- /dev/null +++ b/.claude/commands/deploy.md @@ -0,0 +1,15 @@ +--- +description: Build and deploy EarthGrid on nucleus, with the stop-copy-start sequence and verification +allowed-tools: Bash +--- + +Never copy over a running binary: the copy fails and the service restarts on the old one. + +1. `cd ~/dev/EarthGrid` on nucleus and confirm HEAD (`git log --oneline -1`) is the commit you intend to ship. +2. `export PATH="$HOME/.cargo/bin:$PATH"; cd earthgrid-core; cargo build --release` +3. `cp -a ~/.cargo/bin/earthgrid ~/.cargo/bin/earthgrid.bak-` +4. `export XDG_RUNTIME_DIR=/run/user/$(id -u); systemctl --user stop earthgrid; sleep 2; cp target/release/earthgrid ~/.cargo/bin/earthgrid; systemctl --user start earthgrid` +5. Wait for `ss -tln | grep 8400` before judging anything. A warm restart binds in about 25 s; a cold one replays the WAL and takes 3 to 4 minutes with the main thread in D state. Do not kill it and do not reset anything. +6. Verify, and report each result: `md5sum ~/.cargo/bin/earthgrid` against the build output; `curl localhost:8400/health`; `curl -L localhost:8400/dashboard`; `curl localhost:8400/api/beacon/nodes` still listing the nodes. For a UI change, grep the deployed binary for a string the change introduced, because the assets are embedded. + +The Lenovo is a second node and is deployed by hand the same way. diff --git a/.claude/commands/gate.md b/.claude/commands/gate.md new file mode 100644 index 0000000..128b84c --- /dev/null +++ b/.claude/commands/gate.md @@ -0,0 +1,13 @@ +--- +description: Run the EarthGrid gate - release build, tests, and a syntax check on the embedded HTML +allowed-tools: Bash +--- + +Run these in order from `earthgrid-core/` and stop at the first failure. Report raw output, never a summary of it. + +1. `export PATH="$HOME/.cargo/bin:$PATH"; cargo build --release` - must end with 0 errors and 0 warnings. +2. `cargo test` - quote the exact `test result:` line, including ignored counts. +3. `ui.html` and `beacon.html` are `include_str!` assets, so cargo cannot see a JavaScript syntax error in them. Extract every `