-
Create or reuse a tracking task folder in context/daily/YYYY-MM-DD/....
Record the user request, scope, and running checklist in status.md. For complex cleanup, create a goal so progress can survive context shifts.
-
Inventory both repositories before changing anything.
Use git status --porcelain=v1 -uall for the local VM checkout. For the Mac, use the configured SSH alias, usually:
ssh sourya-mac 'cd ~/pro/personal_os && git status --porcelain=v1 -uall'
Save inventories, grouped summaries, and any helper scripts under the active task's task-progress-artifacts/scratchpad/.
-
Group dirty paths by ownership.
Treat context/daily/<date>/<task-slug>/... as task-owned. Treat root files such as .gitignore, CLAUDE.md, scripts/, output/, and root task-progress-artifacts/ as non-task work requiring separate review. Use task metadata, transcripts, and zellij listings to decide whether a live owner exists.
-
Delegate only to clearly reachable owners.
When a task has an active, unambiguous zellij/Codex owner, use $cross-session-message preview-first, then send a bounded commit instruction with --execute --submit enter. Record target session, tab, task group, and requested commit message. If the session is missing, ambiguous, ended, or is just a shell/gitui workspace, this cleanup session owns the commit.
-
Keep the git index safe.
All sessions in a shared checkout share one index. Before staging, confirm git diff --cached --name-only is empty or contains only the scope you intend. If another session is working, prefer waiting or rechecking over committing a mixed index.
-
Stage explicitly and commit logically.
Use pathspec files or explicit paths. Split commits by natural scope, for example delegated task artifacts, orphaned backlog artifacts, non-task utilities, Mac artifacts, and cleanup-skill/tracking files. Do not use broad git add . unless the status output has already been reduced to the exact intended scope.
-
Use curated-only handling for bulk artifacts.
Commit status files, user inputs, small scripts, summaries, reports, screenshots, and other human-reviewable evidence. Leave generated checkouts, caches, archives, model weights, databases, extracted text dumps, dependency folders, and sensitive-looking scratch files local-only by adding exact paths to .git/info/exclude. Prefer .git/info/exclude over .gitignore for one-machine task leftovers.
-
Run staged safety checks before every commit.
At minimum run:
git diff --cached --name-only
git diff --cached --check
Also scan staged text for obvious secret material without printing values: private-key blocks, AWS access keys, GitHub tokens, OpenAI-style keys, and Google API keys. If a scan hits, unstage and exclude or inspect the file. Generic variable names such as API_KEY= are not by themselves a secret.
-
Preserve archival artifacts unless they are unsafe.
If git diff --cached --check reports whitespace in captured logs, HTML, CSVs, or model output, record that and commit as-is when the secret scan is clean. Do not rewrite archived evidence merely to satisfy whitespace checks.
-
Commit tooling fixes separately in the owning repo.
If a helper or skill bug blocks the cleanup, fix and commit the narrow tooling change in its own repository. Leave unrelated dirty files in that repo untouched.
-
Reconcile committed histories with the remote by default.
Fetch on every participating machine before pushing. Compare origin/main, the canonical GCP main, and the Mac main. Never force-push or overwrite one machine's commits merely because the other machine is canonical.
If committed histories diverge, preserve each head with an explicit temporary branch or ref, then merge them from a clean checkout. A short-lived merge worktree is an allowed exception to the normal Personal OS no-worktree default when the real checkouts contain substantial preserved dirt. State the exception before creating it. Resolve conflicts from task ownership, chronology, and saved evidence. Do not guess through a material content conflict.
-
Preserve local dirt while updating real checkouts.
Before fast-forwarding a dirty checkout, compute the exact intersection between incoming changed paths and current dirty paths. Prefer an exact-path stash for only that intersection. Record the stash ref, update the checkout, then reapply the stash and verify that no local work disappeared. Avoid stashing large unrelated scratch trees when they do not overlap the incoming history.
-
Push and pull unless the user opts out.
Push the reconciled canonical main to origin/main, then fetch and fast-forward the VM and Mac checkouts so their committed histories match the remote. Do not push temporary reconciliation branches unless needed for safe transport; delete them after successful verification when doing so is safe. If credentials or branch protection block synchronization, report the exact blocker.
-
Verify and report final state.
Re-run status and divergence checks on VM, Mac, and remote. Confirm commits created, conflict resolutions, restored local changes, deliberately local-only paths, and any remaining issues.