Skip to content

chore(hooks): GSTACK checkpoint guard rejects ~15% of real session journals #326

Description

@gnanirahulnutakki

The pre-commit GSTACK checkpoint guard (architect/tools/gstack-checkpoint-guard.sh in the agent vault) is stricter than the journal convention actually in use. It blocked commits on several review-ready PRs during the #298#322 integration pass.

Measurement

Counting every *journal*.md under architect/sessions/ against the guard's seven required patterns, as of 2026-07-16:

journals passing guard: 394
journals failing guard:  70
total:                  464

So ~15% of real journals cannot host a commit. Per-marker:

missing type: session-journal    in   3 journals
missing ## [G] Goal$             in  62 journals
missing ## [S] Structure$        in  66 journals
missing ## [A] Apply Mandates$   in  68 journals
missing ## [T] Trace$            in  66 journals
missing ## [C] Continuous$       in  66 journals
missing ## Checkpoint Ledger$    in  67 journals

Root cause

The guard greps $-anchored exact headings, but the convention permits a descriptive qualifier after the gear tag, and the ledger heading's case is unstable. The canonical forms dominate (~400 journals each), with a long tail of legitimate variants:

402 ## [G] Goal              |   6 ## [S] Verified entry state
399 ## [C] Continuous        |   5 ## Checkpoint ledger          <- case only
399 ## Checkpoint Ledger     |   4 ## [A] Plan and success criteria
398 ## [T] Trace             |   3 ## [C] Current checkpoint
398 ## [S] Structure         |   3 ## [R] Primary-source decision
396 ## [A] Apply Mandates    |   2 ## [T] Trace (unit 3)

Note ## Checkpoint ledger vs ## Checkpoint Ledger is a pure case mismatch, and ## [T] Trace (unit 3) fails only because of the $ anchor. Neither indicates a missing section.

Some journals also legitimately lack a gear entirely (e.g. a security-patch lane with two [S] sections and no [T]), so the required-set assumption is itself questionable.

Why this matters

The guard's stated purpose is ensuring work is checkpointed. Rejecting a journal that has a Checkpoint Ledger because the "l" is lowercase does not serve that purpose — it just pushes toward --no-verify, which defeats the guard entirely. That is the real risk here: a guard that misfires 15% of the time trains people to bypass it.

Suggested fix

Relax the patterns to match the convention rather than a subset of it:

  • Anchor on the gear tag, not the full heading: ^## \[G\], ^## \[S\], etc. — drop the trailing $ so qualifiers are allowed.
  • Make the ledger check case-insensitive: grep -Eqi '^## checkpoint ledger'.
  • Reconsider whether all six gears must be present, given lanes that legitimately omit one.

Then re-run the count above; it should reach ~464/464 without touching a single journal.

Note on this integration pass

Five journals were edited to unblock merges (issues #300/#310/#311/#312/#319 lanes): headings renamed to the canonical marker with the author's original wording preserved as a lead line, plus a [T] Trace section added where genuinely absent recording that session's integration work. No journal content was rewritten or removed, and no commit used --no-verify. Those five are now consistent with the ~400 that already pass, but the guard is what should change — not the remaining 70 journals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions