Skip to content

yeaight7/agent-powerups / plugins/dev-vitals/skills/context-retrieval-loop

context-retrieval-loop

Verified

Use when starting work in an unfamiliar area of a codebase, spawning a subagent that needs targeted file context, a first search pass missed the relevant file, or the file scope of a task is unclear.

Context Retrieval Loop

Gather the right codebase context before making changes or spawning subagents.

When to Use

  • Starting work in an unfamiliar area
  • Spawning a subagent that needs targeted file context
  • First search pass returned nothing useful

The 3-Cycle Loop

Cycle 1 — Broad Search

rg "<primary-keyword>" --type ts --type js -l
find . -name "*<keyword>*" -not -path "*/node_modules/*"

Stop here if 3+ directly relevant files found.

Cycle 2 — Exact Source and Tests

Read the most relevant files from Cycle 1. Then find:

rg "<filename-stem>" --glob "*.test.*" --glob "*.spec.*" -l
rg "import.*<module-name>" -l

Stop here if you can describe the change and its blast radius.

Cycle 3 — Docs and Setup

ls docs/ README.md AGENTS.md CLAUDE.md .claude/ 2>/dev/null
rg "<keyword>" .env.example *.config.* 2>/dev/null

Stopping Conditions

Stop when: 3+ high-relevance files understood, OR Cycle 3 complete, OR new cycles return only files already seen.

Output

Context gathered:
  <file-path> — <one-line reason>

Missing context (if any):
  <what is still unclear>

State gaps explicitly. Do not proceed with guesses when a known gap exists.

Integration with Subagents

Pass file paths to subagents, not file contents:

Relevant files: src/auth/tokens.ts, src/auth/session.ts, src/auth/tokens.test.ts

Verification

  • The loop stopped at a stopping condition — never past 3 cycles
  • Every gathered file is listed with a one-line relevance reason
  • Missing context is stated explicitly — no proceeding on guesses when a gap is known
  • Subagents received file paths, not inlined file contents
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 321kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 321kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 321kUpdated Claude CodeCodexVerifiedInstall