feat(hook): let a non-git surface declare its identity via CLAUDE_COORD_REPO

0.6.0 removed the working-directory fallback, which was right, but it left
every non-git working surface with nothing to derive from. The read path
declines silently by design - the hook must never fail a session - so such a
surface simply stops seeing its inbox: no error, no exit code, nothing. That is
the same loss-looks-like-normal shape 0.6.0 set out to remove, reintroduced one
layer up.

The hook now forwards CLAUDE_COORD_REPO verbatim as --repo. This is not the
fallback returning, and the distinction is the whole point: the fallback GUESSED
a name from wherever the session happened to stand, while a declaration is
written down in that directory's settings, readable back, and deletable.
Identity stays a choice someone made.

Forwarding as --repo rather than reimplementing anything means it inherits every
engine rule, including that an explicit override never claims <repo>/.origin -
otherwise a surface borrowing a name would steal the claim from the checkout
that owns it. Both halves are pinned by tests, and the shared test helper now
deletes CLAUDE_COORD_REPO unless a test asks for it, so a value set globally
later cannot silently satisfy the tests that prove the hook resolves nothing on
its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U6EixQo6hpoRCVtiAXdnFs
This commit is contained in:
Kjell Tore Guttormsen 2026-07-27 08:56:31 +02:00
commit 28e7cb42cd
7 changed files with 91 additions and 18 deletions

View file

@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.7.0] - 2026-07-27
### Added
- **`CLAUDE_COORD_REPO` — declaring an identity for a non-git surface.** 0.6.0
removed the working-directory fallback, which was right, but it left every
non-git working surface (`~/repos`, `$HOME`) with nothing to derive from: the
read path declines silently, so such a surface simply stops seeing its inbox,
with no error and no exit code. That is the same loss-looks-like-normal shape
0.6.0 set out to remove. The hook now reads `CLAUDE_COORD_REPO` and forwards
it verbatim as `--repo`, so a directory can *declare* which mailbox it owns:
{ "env": { "CLAUDE_COORD_REPO": "repos" } }
This is not the fallback returning. The fallback guessed a name from wherever
the session happened to stand; a declaration is written down, readable back,
and deletable. Because it forwards as `--repo` it inherits every engine rule,
including that an explicit override never claims `<repo>/.origin` — otherwise
a surface borrowing a name could steal the claim from the checkout that owns
it. Both halves are pinned by tests.
## [0.6.0] - 2026-07-26
### Fixed