Claude Code First, specification version 0.1.0. The plain-language guide
Version 0.1.0. Level 2. Best evidence grade R3/S3.
CS-3 A commit-time hook stages only what it wrote
A hook that writes into a file while a commit is made SHOULD compute its change against the committed file and stage only that change.
| Field | Value |
|---|---|
| Keyword | SHOULD |
| Level | 2 |
| Checked | by judgement |
| Findings | F201, F301 |
| Harness facts | none |
| Threat | internal: both failures are of one hook in one project |
| Status | active |
Rationale: roadkeep's version-bump hook staged two whole files, so "an unrelated edit to either rides into the next commit" [roadkeep@91754240:docs/CHANGELOG.md#L572], and did so with an edit another session had made; the fix is that "It stages only what it wrote (RK320)." [roadkeep@91754240:.githooks/pre-commit#L15] (F201, R2/S2). The same hook, reading the working copy rather than what was committed, "re-armed itself for ever", and was "measured over eight commits, the checkout reaching 0.1.392 while HEAD said 0.1.388" [roadkeep@91754240:.githooks/pre-commit#L22] without blocking anything (F301). A file that every commit touches, such as a version, is where concurrent sessions meet, so the hook's change is computed from the committed state and staged alone. Both failures are one hook's, in one project, so the keyword is SHOULD.