Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

chore(git): reject meaningless commit subjects at push time and write the message rules into the agent docs

nirholasc652f76dd275
diff --git a/.claude/agents/completionist.md b/.claude/agents/completionist.md
index 2e1b4bccc..5584eabbe 100644
--- a/.claude/agents/completionist.md
+++ b/.claude/agents/completionist.md
@@ -18,6 +18,7 @@ Audit every changed file for:
6. **Docs and changelog.** CLAUDE.md's definition of done requires them, and they are the most commonly skipped step. A new page must be in `data/pages.json` with an `added` date. A new package/worker/service/top-level directory must have a `README.md` in it. A new product surface must have a `STRUCTURE.md` row. A new developer-facing capability (API endpoint, MCP tool, CLI, integration) must be in the relevant `docs/` file. Anything a user would notice needs a `data/changelog.json` entry in plain language. Internal-only chores correctly get none: do not manufacture filler.
7. **Repo hygiene.** Throwaway scripts, logs, or screenshots in the repo root; unused imports; dead code left behind; scratch files that should be gitignored or deleted.
8. **Typography.** The em-dash and en-dash are banned everywhere in this repo, including code comments, docs, UI copy, and commit messages. Flag any in the diff.
+9. **Commit messages.** If the task produced local commits not yet pushed, check their subjects against the "Commit messages" rules in CLAUDE.md (owner directive 2026-08-02): `type(scope): what changed and why a reader would care`, specific to that diff. Flag generic sweep subjects (`chore: sync working tree`, `wip`, `update`, and family) and subjects under 15 characters after the type prefix; the pre-push lint will reject the push anyway, so catching it here saves a failed push later. Neutral revert wording and merge subjects are exempt.
Verification you can run cheaply, and should. Run these before reading anything by hand; they turn categories 1, 2, 7, and 8 into a mechanical answer:
diff --git a/CLAUDE.md b/CLAUDE.md
index 1d592961c..fb8cb3bf6 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -198,7 +198,7 @@ Three subagents live in `.claude/agents/` and encode checklists you would otherw
This file is the operating brain for every agent here, and agents execute what it says verbatim. A stale line in it does not read as stale, it reads as an instruction, and the cost is a wasted session per drift. Treat it as load-bearing code:
-- **`npm run check:rules` enforces the hard rules on the lines you changed** (`scripts/check-rules.mjs`). It reads added lines only, so your change is held to the rules while the legacy around it is left alone: em-dashes, TODO/FIXME comments, not-implemented throws, commented-out code, and `sampleFoo = [...]` fallback arrays all fail it. Because concurrent agents share this worktree, scope it to your own work: `npm run check:rules -- --paths <files you touched>`. It also reads brand-new untracked files, which a bare `git diff` cannot see. It is also enforced mechanically at push time: the pre-push hook (installed into `.git/hooks` by `scripts/setup-git-hooks.mjs`, which `postinstall` runs on every `npm install`) runs it with `--base <remote sha> --head <local sha>` per pushed ref, so it judges exactly the commits leaving the machine and never the shared working tree. Emergency bypass: `SKIP_PUSH_CHECKS=1 git push`. The hook deliberately runs ONLY this diff-scoped check, never `npm run gate` or other worktree-state audits, because those would block a requested push on other agents' in-flight work.
+- **`npm run check:rules` enforces the hard rules on the lines you changed** (`scripts/check-rules.mjs`). It reads added lines only, so your change is held to the rules while the legacy around it is left alone: em-dashes, TODO/FIXME comments, not-implemented throws, commented-out code, and `sampleFoo = [...]` fallback arrays all fail it. Because concurrent agents share this worktree, scope it to your own work: `npm run check:rules -- --paths <files you touched>`. It also reads brand-new untracked files, which a bare `git diff` cannot see. It is also enforced mechanically at push time: the pre-push hook (installed into `.git/hooks` by `scripts/setup-git-hooks.mjs`, which `postinstall` runs on every `npm install`) runs it with `--base <remote sha> --head <local sha>` per pushed ref, so it judges exactly the commits leaving the machine and never the shared working tree. In that push-scoped mode it also lints every pushed commit's subject line against the "Commit messages" rules in the Git section, so a `chore: sync working tree` never lands again. Emergency bypass: `SKIP_PUSH_CHECKS=1 git push`. The hook deliberately runs ONLY this diff-scoped check, never `npm run gate` or other worktree-state audits, because those would block a requested push on other agents' in-flight work.
- **`npm run check:claude` guards it** (`scripts/check-claude-md.mjs`, wired into `npm run gate`). It re-derives the checkable claims from their source of truth on every run: every npm script and repo path named here must exist, the cron count must match `vercel.json`, the deploy runbook must list the real `build:gcp` chain in the real order, the `db:migrate` warning must match what the script actually does, the README-coverage standard must hold, the remotes documented below must be the ones actually configured (a `git push <remote> main` instruction that does not resolve fails exactly when the owner asked to ship), and the em-dash ban must be honored by this file itself. Run it after editing this file.
- **If you change a load-bearing script, update this file in the same change.** Renaming a script, reordering `build:gcp`, adding a cron, or flipping a default is a documentation change too. The guard will catch most of it; do not make it do your job.
- **Never add a claim here you have not verified.** Numbers, dates, and "X is automatic" statements are the ones that rot. If a claim cannot be checked mechanically, prefer wording that stays true (name the source of truth instead of quoting a number from it).
@@ -255,11 +255,21 @@ When the user asks you to push (or to commit + push): `git push threews main`. O
When the user says commit and/or push, execute it right away. Do NOT run the completionist subagent, audits, tests, diff reviews, scans, or any other pre-commit step first. Do NOT ask clarifying questions or pause for confirmation: staging, committing, and pushing IS the explicit approval. Just run the git commands and report the result.
+### Commit messages: describe the diff, every time (owner directive 2026-08-02)
+
+Generic sweep messages took over the log (22 of the 60 commits before 2026-08-02 were literally `chore: sync working tree`), which makes history useless: nobody can tell what shipped, when, or why. The commit message is the only documentation a diff carries forever. Rules:
+
+- **Format: `type(scope): what changed and why a reader would care.`** Match the house style already in the log, e.g. `fix(wallet): tell the owner a wallet is unsignable before they try to withdraw`. Plain language, specific to THIS diff.
+- **Banned: any subject that describes the act of committing instead of the change.** `sync working tree`, `wip`, `update`, `changes`, `misc`, `cleanup`, `checkpoint`, `progress`, and anything in that family, with or without a `chore:` prefix. Also any subject under 15 characters after the type prefix.
+- **Mixed diff? Split it.** If the staged work spans unrelated topics, make one topical commit per topic with explicit paths and an honest message each. Never paper over a mixed sweep with a generic subject. If you truly must commit someone else's stranded work along with yours, the message describes THAT content too (read the diff first).
+- **Enforced mechanically at push time.** The pre-push `check:rules` run also lints the subject of every commit in the pushed range and rejects the push on a violation. Fix with `git commit --amend` (last commit) or a rebase, then push again.
+- **Two exemptions, both deliberate:** merge commits, and the neutral revert wording required by the revert section below. Neutral-on-purpose is not generic-out-of-laziness.
+
### Concurrent agents share this worktree
Other agents may be editing and committing on `main` while you work. Stage explicit paths only (never `git add -A` or `git add .`), and re-check `git status` and `git diff --staged` immediately before committing.
-Assume the other agents do NOT follow that rule. In practice they run `git add -A` sweeps, so **anything you leave uncommitted can be swept into an unrelated commit under someone else's message.** Two consequences: commit your own finished work promptly with explicit paths rather than batching it to the end of a long task, and re-read a file you are editing before each edit if the task spans a while, because the version on disk may no longer be the one you wrote. A file you created can also already be committed by the time you look.
+Assume the other agents do NOT follow that rule. In practice they run `git add -A` sweeps, so **anything you leave uncommitted can be swept into an unrelated commit under someone else's message.** (Since 2026-08-02 a sweep can no longer hide behind a generic subject: the pre-push lint in the "Commit messages" section rejects it, so a sweeper has to read and describe what they swept.) Two consequences: commit your own finished work promptly with explicit paths rather than batching it to the end of a long task, and re-read a file you are editing before each edit if the task spans a while, because the version on disk may no longer be the one you wrote. A file you created can also already be committed by the time you look.
### Revert commit messages: NEVER echo the reverted content
diff --git a/scripts/check-rules.mjs b/scripts/check-rules.mjs
index b9aa89afc..044d9acda 100644
--- a/scripts/check-rules.mjs
+++ b/scripts/check-rules.mjs
@@ -23,6 +23,13 @@
// `git diff HEAD` shows everyone's in-flight work, not yours. Scope to the
// files you touched and you get a verdict on YOUR change.
//
+// In --base mode (the pre-push hook) it ALSO lints the subject line of every
+// commit in base..head. History filled up with "chore: sync working tree"
+// sweeps that say nothing about the diff they carry, which makes the log
+// useless for archaeology. A subject must describe the change: banned generic
+// subjects and sub-15-character subjects fail the push. Merge commits and the
+// deliberately-neutral revert messages CLAUDE.md mandates are exempt.
+//
// Exit 1 on any violation, with file:line and the rule broken.
import { execFileSync } from 'node:child_process';
@@ -121,6 +128,70 @@ const RULES = [
},
];
+// Commit-subject lint, --base mode only: the pre-push hook hands us exactly
+// the commits leaving the machine, so this is the one place a message rule can
+// be enforced without judging other agents' in-flight work. A commit message
+// is the only documentation a diff carries into history; "chore: sync working
+// tree" documents nothing.
+const BANNED_SUBJECTS = new Set([
+ 'sync working tree',
+ 'sync',
+ 'wip',
+ 'update',
+ 'updates',
+ 'change',
+ 'changes',
+ 'misc',
+ 'stuff',
+ 'cleanup',
+ 'clean up',
+ 'minor changes',
+ 'various fixes',
+ 'more work',
+ 'progress',
+ 'checkpoint',
+ 'save work',
+ 'commit',
+ 'work',
+]);
+if (base) {
+ let commits = [];
+ try {
+ commits = git(['log', '--format=%H%x00%s', `${base}..${head}`]).split('\n').filter(Boolean);
+ } catch (err) {
+ console.error(`[check-rules] could not read the commit list (${base}..${head}): ${err.message}`);
+ process.exit(1);
+ }
+ const bad = [];
+ for (const row of commits) {
+ const [sha, subject = ''] = row.split('\0');
+ const s = subject.trim();
+ // Merge commits are machine-written; neutral revert messages are
+ // mandated by CLAUDE.md (never echo the reverted content).
+ if (/^merge /i.test(s)) continue;
+ if (/^(revert previous change|roll back the prior commit)$/i.test(s)) continue;
+ // Strip a conventional-commit prefix so `chore: sync` and `sync` are
+ // judged by the same words.
+ const meat = s.replace(/^[a-z]+(\([^)]*\))?!?:\s*/i, '').trim();
+ if (BANNED_SUBJECTS.has(meat.toLowerCase())) {
+ bad.push({ sha, subject: s, why: 'generic sweep subject, says nothing about the diff' });
+ } else if (meat.length < 15) {
+ bad.push({ sha, subject: s, why: 'subject too short to describe the change (min 15 chars after the type prefix)' });
+ }
+ }
+ if (bad.length) {
+ console.error(`[check-rules] ${bad.length} commit(s) being pushed have a meaningless subject:\n`);
+ for (const b of bad) {
+ console.error(`[check-rules] ${b.sha.slice(0, 9)} "${b.subject}"`);
+ console.error(`[check-rules] ${b.why}`);
+ }
+ console.error('\n[check-rules] CLAUDE.md rule: every commit message describes the actual diff,');
+ console.error('[check-rules] `type(scope): what changed and why a reader would care`.');
+ console.error('[check-rules] Reword with `git commit --amend` (last commit) or a rebase, then push again.');
+ process.exit(1);
+ }
+}
+
let diffArgs;
if (base) diffArgs = ['diff', '--unified=0', `${base}...${head}`];
else if (staged) diffArgs = ['diff', '--unified=0', '--staged'];
diff --git a/tests/setup-git-hooks.test.js b/tests/setup-git-hooks.test.js
index af169317e..c960e9edd 100644
--- a/tests/setup-git-hooks.test.js
+++ b/tests/setup-git-hooks.test.js
@@ -286,9 +286,9 @@ describe('pre-push hook (behavior)', () => {
install(repo);
baseSha = git(repo, ['rev-parse', 'HEAD']).trim();
writeFileSync(join(repo, 'added.js'), 'export const fine = 2;\n');
- cleanSha = commitAll(repo, 'clean change');
+ cleanSha = commitAll(repo, 'feat(test): add a module that follows every hard rule');
writeFileSync(join(repo, 'bad.js'), `${STUB_COMMENT}\nexport const x = 1;\n`);
- dirtySha = commitAll(repo, 'violating change');
+ dirtySha = commitAll(repo, 'feat(test): add a module whose body breaks a hard rule');
});
it('passes a clean push and hands the refs to git-lfs', () => {
@@ -306,6 +306,39 @@ describe('pre-push hook (behavior)', () => {
expect(out).toContain('SKIP_PUSH_CHECKS=1');
});
+ it('blocks a push whose commit subject is a generic sweep message', () => {
+ // The 22-of-60 "chore: sync working tree" era: the message lint rejects
+ // the subject even when the diff itself is clean.
+ writeFileSync(join(repo, 'swept.js'), 'export const swept = 4;\n');
+ const sweepSha = commitAll(repo, 'chore: sync working tree');
+ try {
+ const { code, out } = runHook(repo, `refs/heads/main ${sweepSha} refs/heads/main ${dirtySha}\n`);
+ expect(code).toBe(1);
+ expect(out).toContain('meaningless subject');
+ expect(out).toContain('sync working tree');
+ } finally {
+ git(repo, ['reset', '-q', '--hard', dirtySha]);
+ }
+ });
+
+ it('blocks a subject too short to describe anything, allows a neutral revert', () => {
+ writeFileSync(join(repo, 'short.js'), 'export const s = 5;\n');
+ const shortSha = commitAll(repo, 'fix: tweak');
+ writeFileSync(join(repo, 'short.js'), 'export const s = 6;\n');
+ const revertSha = commitAll(repo, 'Revert previous change');
+ try {
+ const blocked = runHook(repo, `refs/heads/main ${shortSha} refs/heads/main ${dirtySha}\n`);
+ expect(blocked.code).toBe(1);
+ expect(blocked.out).toContain('too short');
+ // The neutral revert wording CLAUDE.md mandates must pass the lint.
+ const allowed = runHook(repo, `refs/heads/main ${revertSha} refs/heads/main ${shortSha}\n`);
+ expect(allowed.out).not.toContain('meaningless subject');
+ expect(allowed.code).toBe(0);
+ } finally {
+ git(repo, ['reset', '-q', '--hard', dirtySha]);
+ }
+ });
+
it('does not run git-lfs when it blocks, so a rejected push uploads nothing', () => {
writeFileSync(join(sandbox, 'lfs-stdin.txt'), 'untouched');
const { code } = runHook(repo, `refs/heads/main ${dirtySha} refs/heads/main ${cleanSha}\n`);