diff --git a/.gitignore b/.gitignore index e6fe104..be618c5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,7 @@ gitea-mcp*.json .vscode/ graphify-out/ branches/ +# Throwaway agent commit helpers (delete after MCP commit; see docs/llm-workflow-runbooks.md) +/_encode_*.py +/_emit_*.py +/_inline_*.py diff --git a/docs/llm-workflow-runbooks.md b/docs/llm-workflow-runbooks.md index 1b04cb3..cb19db2 100644 --- a/docs/llm-workflow-runbooks.md +++ b/docs/llm-workflow-runbooks.md @@ -370,6 +370,26 @@ git branch -d fix/issue-123-example All three helpers accept `--dry-run` to print the exact commands/paths without touching anything. +### Agent temp artifact cleanup (#261) + +Failed or exploratory agent runs sometimes leave throwaway helper scripts in the +repo root (for example `_encode_commit_payload.py`, `_emit_payload.py`, +`_inline_commit.py`). These files are **not** part of any issue scope. They +pollute `git status`, break `gitea_lock_issue`, and can trigger preflight +fail-closed gates if created before `gitea_whoami`. + +**After every MCP commit attempt** (success or abort): + +1. Delete any root-level `_encode_*.py`, `_emit_*.py`, or `_inline_*.py` helpers + the agent created for payload preparation. +2. Run `git status --porcelain` in the **author worktree** and confirm no + unexpected tracked or untracked files remain before `gitea_lock_issue`. +3. Do not commit these helpers; stage only issue-scoped paths (`git add `). + +The repo `.gitignore` ignores these patterns so accidental leftovers stay +untracked. Ignored files still block issue-lock if they appear as tracked edits — +delete them instead of leaving them in the tree. + ### Create an issue / child issues - **Profile:** issue-manager or author (any profile allowed to create issues). diff --git a/skills/llm-project-workflow/templates/worktree-cleanup.md b/skills/llm-project-workflow/templates/worktree-cleanup.md index a9ffa95..9d6a178 100644 --- a/skills/llm-project-workflow/templates/worktree-cleanup.md +++ b/skills/llm-project-workflow/templates/worktree-cleanup.md @@ -20,6 +20,8 @@ Steps: (removes branches/-issue--; refuses if dirty; git branch -d is safe-delete only — fails on unmerged.) 5. Delete the remote branch if the merge did not already remove it. +5b. Delete any throwaway agent helpers (`_encode_*.py`, `_emit_*.py`, `_inline_*.py`) + left in the author worktree (see docs/llm-workflow-runbooks.md § Agent temp artifact cleanup). 6. From the main checkout: git fetch --prune; git checkout master; git reset --hard /master ONLY if local master safely matches remote. 7. Confirm main checkout clean and current (git status; 0 0 vs /master).