Loading...
Loading...
Reconstruct and narrate the current development context from contextual commits. Run at session start, when resuming work, or when switching branches. Produces a brief, conversational summary of where things stand.
npx skill4agent add berserkdisruptors/contextual-commits recallrecallrecall authword(word)recall rejected(auth)CURRENT_BRANCH=$(git branch --show-current)
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main")
# Find the actual parent branch, not just the repo default.
# Try upstream tracking branch first (fast path).
BASE_BRANCH=$(git rev-parse --abbrev-ref @{upstream} 2>/dev/null | sed 's|^origin/||')
# If no upstream, find the nearest local branch by commit distance.
if [ -z "$BASE_BRANCH" ]; then
BASE_BRANCH=$(git for-each-ref --format='%(refname:short)' refs/heads/ | while read branch; do
[ "$branch" = "$CURRENT_BRANCH" ] && continue
echo "$(git log --oneline "$branch..$CURRENT_BRANCH" 2>/dev/null | wc -l | tr -d ' ') $branch"
done | sort -n | head -1 | awk '{print $2}')
fi
# Final fallback to default branch.
BASE_BRANCH=${BASE_BRANCH:-$DEFAULT_BRANCH}
UNSTAGED=$(git diff --stat)
STAGED=$(git diff --cached --stat)
BRANCH_COMMITS=$(git log ${BASE_BRANCH}..HEAD --oneline 2>/dev/null | wc -l | tr -d ' ')DEFAULT_BRANCHBASE_BRANCHdevelopBASE_BRANCH# Contextual action lines from all branch commits
git log ${BASE_BRANCH}..HEAD --format="%H%n%s%n%b%n---COMMIT_END---"
# Unstaged changes (what's in progress right now)
git diff --stat
git diff # read the actual diff for key changes
# Staged changes
git diff --cached --stat# Unstaged and staged changes only
git diff --stat
git diff --cached --stat
# Last few commits on the parent branch for project context
git log ${BASE_BRANCH} -10 --format="%H%n%s%n%b%n---COMMIT_END---"# Recent commit history with contextual action lines
git log -20 --format="%H%n%s%n%b%n---COMMIT_END---"# Same as C plus uncommitted changes
git log -20 --format="%H%n%s%n%b%n---COMMIT_END---"
git diff --stat
git diff --cached --stat^(intent|decision|rejected|constraint|learned)\(Branch: feat/google-oauth (4 commits ahead of main, unstaged changes in tests/)
Active intent: Add Google as first social login provider. GitHub and Apple to follow.
Approach: passport.js with /api/auth/callback/:provider convention.
Rejected: auth0-sdk — session model incompatible with redis store.
Constraints:
- Redis session TTL 24h, tokens must refresh within window
- Callback routes must follow existing :provider pattern
Learned: passport-google needs explicit offline_access scope for refresh tokens.
In progress: Integration tests for callback handler (unstaged).Branch: feat/oauth-refresh (2 commits ahead of develop, no uncommitted changes)
Active intent: Implement token refresh for OAuth providers.
Constraint: Must stay compatible with the session store changes on develop.Branch: feat/new-feature (0 commits ahead of develop)
No contextual history on this branch yet.
Staged: 2 files (src/auth/provider.ts, src/auth/types.ts)
Unstaged: none
Recent project activity (from develop):
- Auth: OAuth provider framework merged, Google working
- Payments: Multi-currency support shipped (EUR, GBP alongside USD)Recent project activity:
Auth: OAuth provider framework merged. Google working, GitHub and Apple planned.
- Rejected auth0-sdk (session model incompatible with redis store)
- Constraint: redis session TTL 24h, tokens must refresh within window
Payments: Multi-currency support shipped (USD, EUR, GBP).
- Per-transaction currency, not account-level
- Constraint: Stripe locks currency at PaymentIntent creation
- Learned: presentment ≠ settlement currency in Stripe
What do you want to work on?Branch: main (no contextual commits found in recent history)
Recent activity (from commit subjects):
- auth: 6 commits (OAuth implementation, middleware updates) — 2 days ago
- payments: 4 commits (currency handling, Stripe integration) — last week
- tests: 3 commits — last week
- config: 2 commits
Most recent: feat(auth): implement Google OAuth provider
No explicit intent, decisions, or constraints are captured in commit history.
Using the contextual-commit skill on future commits will surface
the reasoning behind changes that commit subjects alone cannot show.recall <scope>authauthauth-tokensauth-librarygit log --all --grep="(${SCOPE}" --format="%H%n%s%n%b%n---COMMIT_END---"grep -E "^(intent|decision|rejected|constraint|learned)\(${SCOPE}"recall authScope: auth (also found: auth-tokens, auth-library)
intent:
- social login starting with Google, then GitHub and Apple
- original session approach incompatible with redis cluster setup
decision:
- passport.js over auth0-sdk for multi-provider flexibility
- JWT with short expiry + refresh token pattern
rejected:
- auth0-sdk — locks into their session model, incompatible with redis store
- auth-sessions — redis cluster doesn't support session stickiness needed by passport sessions
constraint:
- callback routes must follow /api/auth/callback/:provider pattern per existing convention
- redis 24h TTL means tokens must refresh within that window
learned:
- passport-google needs explicit offline_access scope for refresh tokens
- redis-cluster session affinity requires sticky sessions at load balancer level — too invasiverecall <action>(<scope>)git log --all --grep="${ACTION}(${SCOPE}" --format="%H%n%s%n%b%n---COMMIT_END---"grep "^${ACTION}(${SCOPE}"recall rejected(auth)rejected(auth) across history:
- auth0-sdk — locks into their session model, incompatible with redis store
from: feat(auth): implement Google OAuth provider
- auth-sessions — redis cluster doesn't support session stickiness needed by passport sessions
from: refactor(auth): switch from session-based to JWT tokensrejectedconstraintgit log --all --grep="rejected(${SCOPE}" --format="%b" | grep "^rejected(${SCOPE}"
git log --all --grep="constraint(${SCOPE}" --format="%b" | grep "^constraint(${SCOPE}"rejectedconstraint