Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
camacho avatar

Reflect

  • 628 installs
  • 1 repo stars
  • Updated May 26, 2026
  • camacho/ai-skills

reflect is a post-task agent skill that captures lessons from completed work, updates memory layers, closes linked issues, and confirms phase completion before moving forward.

About

reflect is a phase-gate skill from camacho/ai-skills that developers run after merging a branch or finishing a task to prevent premature completion declarations. The workflow starts by stamping a reflect timestamp into ai-workspace/.last-reflect-ts, then reviews recent git history with git log --oneline -10 and session edits. If a completed plan exists in ai-workspace/plans/ with Outcomes and Learnings filled in, reflect treats that document as the primary source of truth. The skill consolidates corrections and insights into project memory layers, closes linked issues, and enforces Step 8 of the COMMIT checkpoint before the agent declares work done. Developers reach for reflect when agent sessions need structured retrospectives instead of ad-hoc summaries. Escalation to the user happens only at explicit escalation points, keeping routine reflection autonomous while preserving auditability of what changed and why.

  • 8-step mandatory reflection ritual enforced as a phase gate
  • Automatically reviews git history and any completed plan in ai-workspace/plans/
  • Classifies learnings into MEMORY.md (project-specific) versus Basic Memory vault (cross-project)
  • Verifies issue closure via GitHub CLI and warns on open issues
  • Writes timestamp to .last-reflect-ts and escalates only at explicit points

Reflect by the numbers

  • 628 all-time installs (skills.sh)
  • Ranked #655 of 3,282 Productivity & Planning skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/camacho/ai-skills --skill reflect

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs628
repo stars1
Security audit3 / 3 scanners passed
Last updatedMay 26, 2026
Repositorycamacho/ai-skills

How do you capture agent session learnings after merging code?

Capture lessons from completed work, update memory layers, close linked issues, and confirm phase completion before moving forward.

Who is it for?

Developers using ai-workspace plans who want a mandatory retrospective gate after merges or completed tasks.

Skip if: Greenfield scaffolding or pre-merge code review where no completed work exists to reflect on.

When should I use this skill?

User finishes a branch merge, completes a planned task, or needs phase-gate verification before declaring work done.

What you get

Updated memory layers, closed issues, reflect timestamp file, and verified COMMIT checkpoint completion.

  • Memory layer updates
  • Closed issues
  • Reflect timestamp file

By the numbers

  • Reviews last 10 git commits via git log --oneline -10
  • COMMIT checkpoint requires Step 8 to pass

Files

SKILL.mdMarkdownGitHub ↗

Phase gate: COMMIT checkpoint. Do not declare task complete until Step 8 passes.

Execute all steps in order. Escalate to the user only at explicit escalation points.

Step 0 — Mark reflect timestamp

date +%s > "${CLAUDE_PROJECT_DIR}/ai-workspace/.last-reflect-ts"

Step 1 — Review session work

git log --oneline -10

Review recent edits and corrections made during this session. If a completed plan exists in ai-workspace/plans/ (Outcomes & Learnings filled in), use it as the primary source. Otherwise derive learnings directly from git history and session events. Build an explicit inventory of candidate learnings before moving on.

Step 1b — Verify issue closure

Scan commit messages for closing keywords (case-insensitive): closes, close, closed, fixes, fix, fixed, resolves, resolve, resolved followed by #N.

For each issue number found:

gh issue view N --json state --jq '.state'

Warn if any referenced issue is still open. Do not block — warn and continue.

Step 2 — Classify learnings

SignalDestination
References this repo's files, paths, configs, or project conventionsMEMORY.md only
General pattern, tool behavior, or preference applicable across projectsBasic Memory vault only
Both (project-specific instance of a cross-project pattern)Both — cross-reference each entry to the other

Step 2b — Comment learnings on related issues

Plan has `Issue: #N` in frontmatter: post learnings directly as a comment on that issue. No confirmation needed — the link is explicit.

No plan or no Issue field: run gh issue list --state open --json number,title,labels --limit 50, fuzzy-match keywords against open issue titles. Confirm with user before posting to any fuzzy match. A bad auto-comment is worse than a missed one.

Step 3 — Write to MEMORY.md (concurrent write protocol)

MEMORY.md lives on main and may receive concurrent writes. Never write from the current worktree.

REFLECT_DIR="${CLAUDE_SESSION_DIR:-$TMPDIR}/memory-reflect"
[ -d "$REFLECT_DIR" ] && rm -rf "$REFLECT_DIR"
git clone --depth 50 "$(git remote get-url origin)" "$REFLECT_DIR"

Retry loop (max 3 attempts):

1. Read $REFLECT_DIR/ai-workspace/MEMORY.md as it exists now. 2. Re-derive entries from the current file state — skip anything already present, avoid duplicates. Do not auto-merge. Do not replay old diffs. 3. Add new entries. Prune entries older than 30 days. Keep under 200 lines — if over, summarize the oldest section (never silently delete). 4. Commit and push:

git -C "$REFLECT_DIR" add ai-workspace/MEMORY.md
git -C "$REFLECT_DIR" commit -m "reflect: update MEMORY.md [$(date +%Y-%m-%d)]

Co-Authored-By: Claude <model>"
git -C "$REFLECT_DIR" push

5. On non-fast-forward rejection: git -C "$REFLECT_DIR" pull --rebase, return to step 1. 6. After 3 failures, stop and escalate — do not proceed:

MEMORY.md write failed after 3 retries. Manual merge required at $REFLECT_DIR/ai-workspace/MEMORY.md.

Propagate to primary worktree

After successful push, bring the primary worktree's main up to date so other agents see the new MEMORY.md immediately:

PRIMARY="$(git worktree list --porcelain | grep -m1 '^worktree ' | sed 's/^worktree //')"
CURRENT=$(git -C "$PRIMARY" branch --show-current)
if [ "$CURRENT" = "main" ]; then
  # WIP commit if dirty
  if [ -n "$(git -C "$PRIMARY" status --porcelain)" ]; then
    git -C "$PRIMARY" add -u
    git -C "$PRIMARY" commit -m "wip: preserve local state before reflect sync"
    WIP=1
  fi
  git -C "$PRIMARY" fetch origin main
  git -C "$PRIMARY" merge --ff-only origin/main || echo "Primary diverged — manual pull needed"
  # Restore WIP
  [ "${WIP:-}" = "1" ] && git -C "$PRIMARY" reset --soft HEAD~1
fi

If primary is not on main, skip propagation — the next git pull will pick it up.

Step 4 — Write to Basic Memory vault

Use mcp__basic-memory__search_notes first to avoid duplicates, then mcp__basic-memory__write_note or mcp__basic-memory__edit_note. Use [[wiki-links]] for connections. Tag every note with the current project name.

If Basic Memory MCP is not connected, log the skip in the output summary and continue. Do not block.

Step 5 — ADR check

If a significant architectural decision, convention, or recurring pattern emerged, prompt:

Should this become an ADR? Candidate: "<pattern summary>". (y/n)

If yes: create ai-workspace/decisions/ADR-NNN-<slug>.md using the template at ai-workspace/decisions/TEMPLATE.md. Increment the highest existing ADR number.

Step 6 — Create issues from surfaced work

Check for duplicates first (open and recently closed):

gh issue list --state open --limit 100 --json number,title
gh issue list --state closed --limit 20 --json number,title

Source (a) — Reflect TODOs: gotchas, follow-ups, technical debt surfaced during Steps 1–5. Create a GitHub issue for each with no duplicate.

Source (b) — Scratchpad (ai-workspace/scratchpad.md): for each line matching - [ ] ... → create issue → rewrite as - [x] → #N. Leave plain bullets untouched — they are reference notes.

Step 7 — Finalize plan

Rename the active plan to .done.md. Verify Outcomes & Learnings is filled in first.

mv ai-workspace/plans/<name>.md ai-workspace/plans/<name>.done.md

This commit can go on the primary worktree — .done.md plan files are in the allowlist (see task-branches.md). Skip if no active plan.

Step 8 — Phase gate

Read .branch-context.md:

  • MEMORY.md not updated + .branch-context.md had content → soft block: warn and do not declare task complete until resolved.
  • .branch-context.md missing or empty → warn but do not block.

Output summary

LayerAction
MEMORY.mdN entries added, N pruned (X lines total)
Basic MemoryN notes written/updated (or: skipped — MCP unavailable)
Issues closed#N, #N (verified) / #N still open (warned)
Issues created#N "<title>", #N "<title>"
Issues commented#N
ADRCreated ADR-NNN / Skipped
PlanFinalized <name>.done.md / None
Phase gateMEMORY.md updated: yes/no — .branch-context.md: found/missing

Related skills

How it compares

Use reflect for structured post-merge retrospectives instead of informal session summaries that skip memory updates and issue closure.

FAQ

When should reflect run in the workflow?

reflect runs after merging a branch or completing a task. The skill must not declare work complete until COMMIT checkpoint Step 8 passes and learnings are written to memory layers.

What files does reflect update?

reflect stamps ai-workspace/.last-reflect-ts with a Unix timestamp, reads completed plans from ai-workspace/plans/, reviews recent git history, and updates project memory layers while closing linked issues.

Is Reflect safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.