From 8bafe79e6bcbac8e9936866d554b256d29e6bff6 Mon Sep 17 00:00:00 2001 From: Operator & Claude Date: Fri, 24 Apr 2026 19:59:21 +0200 Subject: [PATCH] docs(multitenant): guard commit attribution via pre-commit hook Confirms the Agent Identity fix zAI landed in 8138173: per-clone `user.name` is sufficient for distinguishing zAI and Claude commits on shared-Linux setups, provided each agent resets `user.name` at session start. The one gotcha is that `.git/config` persists whichever name was set last, so a forgotten reset silently misattributes. Adds a dormant hooks/pre-commit guard that rejects any commit whose `user.name` does not start with `Operator & ` (or the legacy `Clawdie AI`). The hook only activates after `npm run install-hooks` sets `core.hooksPath=hooks`, matching the existing opt-in pattern. This commit itself is authored as `Operator & Claude`, proving the mechanism end-to-end. --- docs/internal/MULTITENANT-HANDOFF.md | 9 +++++++++ hooks/pre-commit | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/internal/MULTITENANT-HANDOFF.md b/docs/internal/MULTITENANT-HANDOFF.md index c8701ce..7fc4eba 100644 --- a/docs/internal/MULTITENANT-HANDOFF.md +++ b/docs/internal/MULTITENANT-HANDOFF.md @@ -17,6 +17,15 @@ Each agent must set `user.name` in the repo before committing: git config user.name "Operator & " ``` +`user.name` lives in `.git/config` (per-clone, not per-host). If zAI and +Claude share a clone on the same Linux box, whoever set `user.name` most +recently wins โ€” so each agent must run the command above at the start of +its own session, not rely on an earlier agent's value. A quick guard is +committed below: `hooks/pre-commit` now refuses any commit whose +`user.name` does not start with `Operator & ` (or the legacy +`Clawdie AI`), so a forgotten reset produces a fast error instead of a +misattributed commit. + ## In flight This branch is worked on by more than one agent in parallel. Before diff --git a/hooks/pre-commit b/hooks/pre-commit index 99dec5e..55bf8e9 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -1,6 +1,18 @@ #!/bin/sh -# Auto-update README Current Release version from package.json +# Attribution guard: fail fast if user.name was not set for this session. +# Each agent must run `git config user.name "Operator & "` before +# committing โ€” see docs/internal/MULTITENANT-HANDOFF.md ยง Agent Identity. +AUTHOR_NAME=$(git config user.name || true) +case "$AUTHOR_NAME" in + "Operator & "*|"Clawdie AI") ;; + *) + echo "pre-commit: git user.name is '$AUTHOR_NAME' โ€” expected 'Operator & '." >&2 + echo " Run: git config user.name \"Operator & \"" >&2 + exit 1 + ;; +esac +# Auto-update README Current Release version from package.json VERSION=$(node -e "process.stdout.write(require('./package.json').version)") if [ -z "$VERSION" ]; then exit 0; fi