~p: Work Loss Prevention
Stop Claude Code sessions from undoing each other's work
Plan — Awaiting Approval
Intent
Intent: Prevent cross-session work loss in Claude Code projects.
Purpose: Every session should build on the last, never tear it down. The artifact trail, code state, and board must be trustworthy across sessions.
What: A set of CLAUDE.md rules, a pre-flight checklist, and file hygiene conventions that any Claude Code session will follow — no external tooling required.
Scope
Changes to the Be system (metal CLAUDE.md) + immediate fixes to bahalaka. Pure convention enforcement — no new tools, no CI, no hooks. Just rules that work because they're in CLAUDE.md and Claude reads them.
Approach — 5 Guards
Guard 1: Session Pre-Flight Checklist
Add to CLAUDE.md: every session that touches code must run a pre-flight before the first edit.
- Read the board. What's Done? What's In Progress? What's Ready? If something is Done, don't touch it unless the user explicitly says to.
- Read telemetry. What was the last command? Did it complete? Is there a null commit hash that needs backfilling?
- Read the index. What artifacts exist? What was the last ship? What version are we on?
- Check for unfinished chains. If the last telemetry entry is a ~b or ~t without a following ~s, flag it: "Previous session built but didn't ship. Want to continue that chain?"
This is 4 file reads. Takes 5 seconds. Prevents 90% of the problem.
Guard 2: Single Source of Truth Rule
Add to project CLAUDE.md: declare the canonical file for each deployable asset.
- For bahalaka:
"source of truth: index.html (root). site/index.html is legacy — do not edit."
- Any project with multiple copies of a file must declare which one is canonical.
- The non-canonical copy should be deleted or clearly marked as dead.
Immediate action for bahalaka: Delete site/index.html or replace it with a redirect comment. One file, one truth.
Guard 3: Stewardship Rule
Add to CLAUDE.md (Be kernel):
"Stewardship rule: You are a steward, not an owner. Never undo, revert, remove, or rewrite code that a previous session committed unless the user explicitly asks you to. If you see something that looks wrong but was committed by a previous session, flag it — don't fix it silently. Previous work is assumed correct until proven otherwise."
This is the single most important guard. It directly addresses the "keeps removing things" problem.
Guard 4: Chain Completion Enforcement
Add to CLAUDE.md chain rules:
- Chain checkpoint: When a chain command completes, log it to telemetry with its commit hash immediately — not later, not in a batch.
- Chain completion flag: The last command in a chain (~S for GO, ~S for HOTFIX) must set
"chain_complete": true in its telemetry entry. If this flag is missing, the chain didn't finish.
- Incomplete chain alert: Pre-flight (Guard 1) checks for incomplete chains and alerts the user before starting new work.
- Telemetry hash is mandatory: A tilde command that commits code MUST backfill its commit hash into telemetry in the same commit. No nulls.
Guard 5: Done Means Done
Strengthen the board rule:
- Items marked Done on the board are frozen. No session may modify the code related to a Done item unless a new board item explicitly targets it (e.g.,
{scroll-to-top style, update in, bahalaka}).
- If a session needs to change something that was already Done, it must create a new board item first. This creates a paper trail.
- Board items include the commit hash when marked Done:
{item} · 3 pts · ~a ✅ (abc1234). This lets the next session verify the work is still in place.
Implementation Order
- Fix bahalaka now: Delete or archive
site/index.html. Add a project CLAUDE.md declaring the source of truth. Backfill all null telemetry commit hashes. 5 pts
- Add Guards 1-3 to Be kernel: Pre-flight checklist, single source of truth convention, stewardship rule. These are text additions to metal CLAUDE.md. 5 pts
- Add Guards 4-5 to Be kernel: Chain completion enforcement, Done-means-Done board rule. 3 pts
- Test with a GO chain on bahalaka: Run Board 5 with the new guards active. Verify that pre-flight runs, chain completes, telemetry has no nulls, and no work is lost. 5 pts
Total: 18 pts across 4 work items.
Constraints
- No external tooling. Everything must work through CLAUDE.md conventions. No hooks, no CI, no scripts. Claude reads CLAUDE.md — that's the enforcement mechanism.
- Backward compatible. Existing projects with Be should work without changes. The guards are additive.
- No overhead on the user. Pre-flight is automatic. The user never types extra commands. They just see better results.
What This Doesn't Solve
- Context window exhaustion. If Claude runs out of context mid-chain, the chain stops. Guards can detect this after the fact but can't prevent it.
- Concurrent sessions. If two Claude sessions edit the same repo at the same time, merge conflicts will happen. Guards help with sequential sessions, not parallel ones.
- User overrides. If the user says "undo that", Claude will undo it. The guards protect against Claude acting on its own, not against explicit instructions.