docs(learnings): record L9 governance git/memory-lock gotchas - #194
docs(learnings): record L9 governance git/memory-lock gotchas#194cryptoxdog wants to merge 1 commit into
Conversation
Capture two cross-repo governance lessons discovered during L9 CI work: - the memory-lock PreToolUse gate denies a compound 'git add && git commit' as one unit, silently dropping the add so the commit diverges from the working tree; stage separately and verify with git show HEAD:<path>. - a manually acquired phase-lock must bind to the real CLAUDE_CODE_SESSION_ID and CLAUDE_PROJECT_DIR=/home/user, or the gate ignores it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kyV5nvej1DZoDpxXKmtW3
|
✅ PR reviewable size is within recommended limits |
L9 Audit Harness Report
Step Results
Architecture Audit Findings
See Spec Coverage
See Next StepsAll checks passed. Safe to merge. |
|
There was a problem hiding this comment.
Pull request overview
This PR appends two governance “learnings” entries to .claude/rules/learnings.md to capture operational gotchas around the L9 memory-lock gate, helping future agent sessions avoid subtle git/lock pitfalls.
Changes:
- Documented a git workflow pitfall where a lock-gated compound
git add && git commitcan result in committing only previously staged changes. - Documented a memory-lock pitfall where manually acquired locks may be ignored if the session/state-root context doesn’t match the hook environment.
|
This belongs elsewhere in the https://github.com/Quantum-L9/Cursor-Governance learnings not .claude |
|
Agreed — this is a governance-wide gate lesson, not a CEG concern. Relocating it to (For the record, the failing Generated by Claude Code |



What
Append two cross-repo governance lessons to
.claude/rules/learnings.md, in the file's documented- **[date] Category: description** — explanationformat. Docs-only; no code or contract changes.Why
These gotchas surfaced during L9 CI work and cost real debugging time; recording them helps future agent sessions in any governed repo (the memory-lock gate applies to CEG too):
git add && git committrap — the L9 memory-lock PreToolUse gate denies a compound Bashgit add && git commitas a single unit, sogit addnever runs and only previously-staged changes commit. The result is a commit that silently diverges from the validated working tree. Fix: stage in a separate Bash call from the lock-gated commit, and verify withgit show HEAD:<path>after every governed commit.memory_lock.pyCLI must match the gate's realCLAUDE_CODE_SESSION_IDandCLAUDE_PROJECT_DIR(=/home/user); a manual run with no hook event writessession_id="unknown-session"and anchors state at the cwd fallback, so the gate ignores it. Locks also carry a short TTL — re-acquire before each governed write.Scope
.claude/rules/learnings.md(+2 lines).main.Generated by Claude Code