feat(#63): SessionStart drift banner — show when fork is behind upstream#64
Merged
Conversation
PRD-0002 change #2. Compounds with /update (#58): banner tells you when to sync, skill does the sync. What the hook does: - SessionStart: runs `git fetch upstream --quiet` (timeout 5s) - Caches last-fetch time in .claude/session/last-upstream-fetch, skips re-fetch if within 10 minutes - Counts `git rev-list main..upstream/main` - If behind, prints one line to stdout; silent otherwise Silent exit paths (no output, no startup noise): - Not a git repo - No `upstream` remote (upstream repo itself, or fork that hasn't configured one yet) - Fetch fails (offline / hosting down / auth) - Fork is up-to-date Banner: ApexStack: 12 commits behind upstream/main. Run /update to sync. Singular/plural ("1 commit" vs "N commits") handled inline. Verified end-to-end against the ops fork (workspace/apexstack/ here has no upstream → silent; ops repo at project root has upstream and is 1 commit behind after #58 merged → banner fires correctly). Also: - .claude/settings.json: hook wired into SessionStart alongside onboarding-check.sh - CLAUDE.md: hook count 15 → 16 - docs/multi-project.md: new "How you know it's time" subsection in the Upgrades section - .claude/hooks/README.md: hook documented as 4a Closes #63
atlas-apex
commented
Apr 17, 2026
atlas-apex
left a comment
Collaborator
Author
There was a problem hiding this comment.
Code Review: PR #64
Commit: 9cdad01573726175c71a9dde8fa9649b3766f59b
Summary
Adds SessionStart hook check-upstream-drift.sh that prints a one-line banner when the fork is behind upstream/<default-branch>. Companion to /update (#61). Silent on network failure, no upstream remote, or up-to-date. 10-min fetch cache.
Checklist
- Architecture & Design: Pass — clean bail-out ladder, single responsibility
- Code Quality: Pass — defensive shell (
2>/dev/null,|| exit 0),timeout 5caps worst case, singular/plural correct - Testing: Pass — PR body documents three verified scenarios (no upstream / behind / cache hit)
- Security: Pass — no secrets, no command-injection surface
- Performance: Pass — cache keeps cold-path < 200ms; worst case bounded at ~5s
- PR Description & Glossary: Pass — 4 terms (upstream drift, fetch cache, SessionStart, default branch)
- AgDR: N/A — mechanical implementation of PRD-0002 change #2, no new tech decisions
Notes (non-blocking)
- Default-branch fallback to
mainiforigin/HEADunset is reasonable; amasterrepo withoutorigin/HEADset would silently compare wrong refs andrev-listexits → silent. Acceptable for v1. - Settings.json ordering correct: onboarding reminder fires first (fresh clones have no
upstream→ drift hook silent). - Hook count bumped 15→16 in CLAUDE.md, consistent with README section 4a.
Verdict
APPROVED (submitted as comment — cannot self-approve)
Rex marker written at .claude/session/reviews/64-rex.approved (41 bytes, matches #61 format).
Reviewed by Rex (Code Reviewer Agent)
Reviewed commit: 9cdad01573726175c71a9dde8fa9649b3766f59b
me2resh
approved these changes
Apr 17, 2026
osama-abu-baker
pushed a commit
to osama-abu-baker/apexyard
that referenced
this pull request
Jun 3, 2026
…d upstream (me2resh#64) PRD-0002 change #2. Compounds with /update (me2resh#58): banner tells you when to sync, skill does the sync. What the hook does: - SessionStart: runs `git fetch upstream --quiet` (timeout 5s) - Caches last-fetch time in .claude/session/last-upstream-fetch, skips re-fetch if within 10 minutes - Counts `git rev-list main..upstream/main` - If behind, prints one line to stdout; silent otherwise Silent exit paths (no output, no startup noise): - Not a git repo - No `upstream` remote (upstream repo itself, or fork that hasn't configured one yet) - Fetch fails (offline / hosting down / auth) - Fork is up-to-date Banner: ApexStack: 12 commits behind upstream/main. Run /update to sync. Singular/plural ("1 commit" vs "N commits") handled inline. Verified end-to-end against the ops fork (workspace/apexstack/ here has no upstream → silent; ops repo at project root has upstream and is 1 commit behind after me2resh#58 merged → banner fires correctly). Also: - .claude/settings.json: hook wired into SessionStart alongside onboarding-check.sh - CLAUDE.md: hook count 15 → 16 - docs/multi-project.md: new "How you know it's time" subsection in the Upgrades section - .claude/hooks/README.md: hook documented as 4a Closes me2resh#63 Co-authored-by: me2resh <ahmed.abdelaliem@gmail.com>
mosta7il
pushed a commit
to mosta7il/apexyard
that referenced
this pull request
Jun 8, 2026
…d upstream (me2resh#64) PRD-0002 change me2resh#2. Compounds with /update (me2resh#58): banner tells you when to sync, skill does the sync. What the hook does: - SessionStart: runs `git fetch upstream --quiet` (timeout 5s) - Caches last-fetch time in .claude/session/last-upstream-fetch, skips re-fetch if within 10 minutes - Counts `git rev-list main..upstream/main` - If behind, prints one line to stdout; silent otherwise Silent exit paths (no output, no startup noise): - Not a git repo - No `upstream` remote (upstream repo itself, or fork that hasn't configured one yet) - Fetch fails (offline / hosting down / auth) - Fork is up-to-date Banner: ApexStack: 12 commits behind upstream/main. Run /update to sync. Singular/plural ("1 commit" vs "N commits") handled inline. Verified end-to-end against the ops fork (workspace/apexstack/ here has no upstream → silent; ops repo at project root has upstream and is 1 commit behind after me2resh#58 merged → banner fires correctly). Also: - .claude/settings.json: hook wired into SessionStart alongside onboarding-check.sh - CLAUDE.md: hook count 15 → 16 - docs/multi-project.md: new "How you know it's time" subsection in the Upgrades section - .claude/hooks/README.md: hook documented as 4a Closes me2resh#63 Co-authored-by: me2resh <ahmed.abdelaliem@gmail.com>
This was referenced Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SessionStart hook that prints a one-line banner when the fork is behind upstream
me2resh/apexstack. Silent on network failure, silent if noupstreamremote, silent when up-to-date. Runs once per 10 minutes via a session cache.Ships PRD-0002 change #2. Compounds with #58 (
/update): banner tells you when to sync, skill does the sync.What changed
.claude/hooks/check-upstream-drift.sh— new hook (2.5 KB). Handles remote detection, fetch caching, default-branch resolution (main/master), and singular/plural output..claude/settings.json— wires the hook into SessionStart alongsideonboarding-check.sh.CLAUDE.md— hook count 15 → 16, brief reference.docs/multi-project.md— new "How you know it's time" subsection in the Upgrades section..claude/hooks/README.md— hook documented as section 4a.Testing
Verified end-to-end:
upstreamremote) → exits silent, no output~/apexstack(has upstream, 1 commit behind after [Feature] /update command to sync ApexStack fork from upstream #58 merged) → prints:.claude/session/last-upstream-fetchis a single timestamp, gitignoredGlossary
me2resh/apexstackin commits. Problem #1 in PRD-0002..claude/session/last-upstream-fetchholds a Unix timestamp so the hook skips the network call if run within the last 10 minutes. Session state, gitignored.refs/remotes/origin/HEAD. Usuallymain, sometimesmaster.Related
/updateskill) which landed in feat(#58): /update skill for syncing ops fork with upstream #61local/overlay + hook kill-switch) and feat(#100): animated /idea shell demo in the hero #5 (CHANGELOG + tagged releases) remain