Pre-spawn freshness hook — auto-fetch main before agent spawn #193
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/claude-custom#193
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Standalone — scoped during worktree lifecycle enforcement brainstorm (2026-03-28).
Spec:
pal-e-platform/docs/superpowers/specs/2026-03-28-worktree-lifecycle-enforcement-design.mdPlan:
pal-e-platform/docs/superpowers/plans/2026-03-28-worktree-lifecycle-enforcement.md— Task 1Repo
forgejo_admin/claude-customUser Story
As a session operator,
I want local main to be automatically fresh before every agent spawn,
So that worktrees never branch from stale code.
Context
Claude Code's
isolation: worktreebranches from local HEAD. If local main is behind remote, the worktree starts with stale code. Incident 2026-03-06: agent PR would have destroyed production resources (40K+ tokens wasted, caught in review). Current mitigation is discipline-based (Betty Sue must remembergit fetch && git pull). This doesn't scale. Hook enforcement eliminates the discipline dependency.File Targets
Files the agent should create:
hooks/pre-spawn-freshness.sh— new PreToolUse hookFiles the agent should modify:
settings.json— add hook to PreToolUse Task matcher alongsidecheck-agent-spawn.shFiles the agent should NOT touch:
hooks/check-agent-spawn.sh— existing hook, must not be alteredAcceptance Criteria
forgejoif exists, elseorigin)git update-ref[pre-spawn-freshness] Updated local main to <sha>promptfield)Test Expectations
prompt), verify silent exit 0echo '{"tool_input":{"prompt":"test","subagent_type":"dev"},"cwd":"/home/ldraney/claude-custom"}' | bash hooks/pre-spawn-freshness.shConstraints
check-agent-spawn.sh(runs on same matcher)set -euo pipefailfor correctnessChecklist
Related
project-pal-e-agency— agent infrastructure projectworktree-workflow— SOP this enforcesScope Review: READY
Review note:
review-507-2026-03-27Ticket is well-scoped: all template sections present, traceability complete (story:pm-scope, arch:worktree, issue open), file targets verified against codebase, 2 files / 1 repo / ~30 lines of new code following established
update-refpattern frompost-merge-rebase.sh. No decomposition needed.