session-start-dirty-state-triage-with-background-agents
Distinguish real implementation dirt from generated session-state churn when resuming a repo with active overnight/background agents.
Best use case
session-start-dirty-state-triage-with-background-agents is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Distinguish real implementation dirt from generated session-state churn when resuming a repo with active overnight/background agents.
Teams using session-start-dirty-state-triage-with-background-agents should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/session-start-dirty-state-triage-with-background-agents/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How session-start-dirty-state-triage-with-background-agents Compares
| Feature / Agent | session-start-dirty-state-triage-with-background-agents | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Distinguish real implementation dirt from generated session-state churn when resuming a repo with active overnight/background agents.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Session-start dirty-state triage with background agents
Use when a handoff or user asks you to confirm a repo is clean before resuming work, especially in workspace-hub where overnight Codex runs, governance hooks, and provider scorecards may keep the orchestrator repo dirty.
## Why this exists
A plain `git status` can overstate risk. In workspace-hub, dirty state may come from:
- `.Codex/state/*` session and correction logs
- provider scorecard/report outputs under `config/ai-tools/` and `docs/reports/`
- transient directories like `.nightly-results/` or inspection scratch dirs
- an active overnight/background Codex run still writing state
Meanwhile a nested implementation repo (for example `aceengineer-website/`) may still be fully clean and ready.
## Workflow
1. Read the handoff first and extract any mentioned repos, issue numbers, and active parallel-agent warnings.
2. Check git state separately for each repo involved, not just the top-level workspace.
- Example:
- `git status --short --branch` in `workspace-hub`
- `git status --short --branch` in `aceengineer-website`
3. If the top-level repo is dirty, classify the paths:
- generated governance/session state
- generated reports/scorecards
- transient scratch/output dirs
- real source/docs changes affecting the intended task
4. Check for active agent processes before concluding the dirty state is yours to clean up.
- `ps aux | grep -E 'Codex|codex|gemini' | grep -v grep`
- Include interactive shells/agents, not only background jobs: `pwdx <pid>` can reveal an active `Codex` sitting in the repo even after a reboot.
- `process(action='list')` may be empty after reboot because Hermes-tracked background sessions do not survive, while OS-level Codex/Hermes/TUI processes may still exist.
5. Correlate active processes with the dirty paths and any issue-specific overnight work.
- If an overnight agent is actively working an issue, avoid choosing a path that collides with that issue.
- If an active interactive Codex process has cwd in the same repo, treat repo-wide Git mutation as unsafe even if no Hermes background sessions are listed.
6. For post-reboot salvage or stale-lock recovery, preserve state before any mutation:
- create a backup branch at current `HEAD`, e.g. `git branch salvage/post-reboot-YYYYMMDD-HHMMSS HEAD`
- save `git diff --binary`, `git diff --cached --binary`, and `git status --porcelain=v1` outside the repo or under a dated salvage directory
- copy any key handoff/result file explicitly before reset/rebase/stash attempts
- only remove `.git/index.lock` after confirming no live Git/agent process owns it or is working in the repo; a stale lock alone is not permission to mutate when an active Codex cwd is present
7. Report the result precisely:
- which repo is clean
- which repo is dirty
- whether the dirt appears operational/generated vs implementation work
- whether an active background/interactive agent makes the state unsafe to touch
- where salvage artifacts were written if mutation is deferred
8. Recommend the next task based on lowest contention, not just highest priority.
- If safe reconciliation is blocked by an active writer, schedule or hand off a delayed narrow reconciliation job that re-checks process/git state before mutating.
9. For post-reboot recovery where important commits/artifacts exist outside the dirty primary checkout, reconcile from an isolated clean worktree rather than touching the active checkout.
- Create or use a throwaway reconciliation worktree from `origin/main` (for example `/mnt/local-analysis/reconcile-main-YYYYMMDD`).
- Fetch the remote, cherry-pick/rebase only the recovered commits or copy only the recovered handoff/artifact files into that worktree.
- Resolve shared planning-index conflicts there, preserving newer remote rows/status and adding only the missing recovered rows/artifacts.
- Push the reconciled commit(s) from the clean worktree if verification passes.
- Leave the primary dirty checkout untouched while any Codex/Hermes/TUI process has cwd there.
- Separately schedule a delayed cleanup/reconcile job for the primary checkout that re-checks live processes and saves diffs before any reset/stash.
- If the recovery also reveals queued plan-review or implementation work, schedule that as a separate future job from the clean worktree so salvage, restart/review, and future work are decoupled.
## Good output pattern
- `workspace-hub`: not clean; mostly generated state/report churn plus active overnight agent on #2348
- `aceengineer-website`: clean
- Recommendation: choose a non-colliding path like #2357 rather than #2348
## Pitfalls
- Do not say "both repos are clean" just because the implementation repo is clean.
- Do not assume top-level dirt means the user's requested work is blocked.
- Do not ignore active overnight agents; they can explain the churn and create issue-level contention.
- Do not collapse nested repos into one cleanliness judgment.
## Reuse trigger
Apply this whenever a session handoff says "confirm clean git state" and the workspace uses background AI agents, nightly runs, or generated governance artifacts.Related Skills
provider-session-ecosystem-audit-and-exporters
Build and maintain cross-provider session-log audits for Codex, Codex, Hermes, and Gemini, including exporter design, normalization, and behavioral verification.
tax-filing-session-setup-with-github-tracking
Structured workflow for preparing and tracking a tax filing session using prepared documents, task checklist, and GitHub issue cross-referencing
tax-filing-session-setup-with-github-traceability
Structured workflow for setting up a multi-file tax filing session with GitHub issue tracking and prepared-file validation
recover-from-corrupted-git-state
Diagnose and recover from corrupted git states (stale locks, failed rebases, pre-commit hook blocks) during bulk operations
multi-layer-stale-state-debugging
Detect and clear stale state persisting across multiple storage layers (auth files, cache, code logic)
handle-session-overlay-blocking
Technique for dismissing overlay dialogs that freeze rendering and block form interaction in web automation
handle-freetaxusa-session-timeouts
Recover from FreeTaxUSA session timeout dialogs blocking form submission and navigation
extract-skills-from-hermes-sessions
Automatically analyze Codex session transcripts to identify and extract reusable skills using LLM analysis via OpenRouter
extract-skills-from-Codex-sessions
Automatically extract reusable skills from Codex session transcripts using LLM analysis and wire them into a Stop hook
diagnose-dirty-ntfs-mount-errors
Troubleshoot NTFS mount failures by identifying dirty volume flags and driver type
diagnose-and-mount-dirty-ntfs-drives
Troubleshoot and mount NTFS external drives blocked by dirty filesystem flags
clean-worktree-integration-from-dirty-main
Land validated issue work from isolated worktrees when the main checkout is dirty by creating a fresh integration worktree, cherry-picking only implementation commits, re-running combined validation, and preparing push/closeout artifacts.