Skip to content

docs(learnings): record L9 governance git/memory-lock gotchas - #194

Closed
cryptoxdog wants to merge 1 commit into
mainfrom
claude/l9-ci-core-pr-validate-4u7b35
Closed

docs(learnings): record L9 governance git/memory-lock gotchas#194
cryptoxdog wants to merge 1 commit into
mainfrom
claude/l9-ci-core-pr-validate-4u7b35

Conversation

@cryptoxdog

Copy link
Copy Markdown
Collaborator

What

Append two cross-repo governance lessons to .claude/rules/learnings.md, in the file's documented - **[date] Category: description** — explanation format. 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):

  1. The compound git add && git commit trap — the L9 memory-lock PreToolUse gate denies a compound Bash git add && git commit as a single unit, so git add never 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 with git show HEAD:<path> after every governed commit.
  2. Lock session / state-root binding — a lock acquired via the memory_lock.py CLI must match the gate's real CLAUDE_CODE_SESSION_ID and CLAUDE_PROJECT_DIR (=/home/user); a manual run with no hook event writes session_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

  • One file changed: .claude/rules/learnings.md (+2 lines).
  • Single commit above main.

Generated by Claude Code

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
Copilot AI lite review requested due to automatic review settings August 5, 2026 01:08
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR reviewable size is within recommended limits

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

L9 Audit Harness Report

  • Generated: 2026-08-05T01:09:00.575010+00:00
  • Repo root: /home/runner/work/Cognitive.Engine.Graphs/Cognitive.Engine.Graphs
  • Overall result: ✅ PASSED
  • Exit code: 0

Step Results

Step Status Exit Code Notes
Architecture Audit ✅ Passed 0
Spec Coverage ✅ Passed 0
Contract Wiring ✅ Passed 0

Architecture Audit Findings

Severity Count
🔴 CRITICAL 0
🟠 HIGH 0
🟡 MEDIUM 25
🔵 LOW 0

See artifacts/audit_report.md for full details.

Spec Coverage

  • ✅ Implemented: 37
  • ⚠️ Partial: 9
  • ❌ Missing: 0
  • Total features: 46
Category Implemented Partial Missing Total
gates 10 0 0 10
scoring 7 0 0 7
v1.1_node 2 0 0 2
v1.1_edge 2 0 0 2
v1.1_action 0 2 0 2
v1.1_scoring 1 1 0 2
action_handler 0 6 0 6
gds_algorithm 5 0 0 5
research_pattern 10 0 0 10

See artifacts/coverage_report.md for full details.

Next Steps

All checks passed. Safe to merge.

@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 commit can 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.

Comment thread .claude/rules/learnings.md
@cryptoxdog

Copy link
Copy Markdown
Collaborator Author

This belongs elsewhere in the https://github.com/Quantum-L9/Cursor-Governance learnings not .claude

Copy link
Copy Markdown
Collaborator Author

Agreed — this is a governance-wide gate lesson, not a CEG concern. Relocating it to Quantum-L9/Cursor-Governance (the canonical lessons DB, learning/failures/repeated-mistakes.md) and backing out this misplacement. Closing this PR and removing the .claude/rules/learnings.md change from CEG.

(For the record, the failing Baseline Ratchet / Required Tests here is unrelated to this docs change: tests/test_handlers.py::test_match_returns_structure fails because handle_match's early-return path omits query_id while the full-path response includes it — a pre-existing main-side issue the ratchet surfaced after the quarantine ledger was emptied in 8be58df. Not fixing it here since this PR is being closed; happy to open a separate fix PR if useful.)


Generated by Claude Code

@cryptoxdog cryptoxdog closed this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants