From agentic-systems
Deterministic 3-cycle loop for gathering codebase context before acting. Broad search → exact source and tests → target-specific docs and setup. Stop after enough context or report what is still missing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agentic-systems:context-retrieval-loopThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Gather the right codebase context before making changes or spawning subagents. Prevents acting on incomplete information.
Gather the right codebase context before making changes or spawning subagents. Prevents acting on incomplete information.
Each cycle builds on the previous. Stop early when you have enough context. Do not exceed 3 cycles.
# Find files by keyword
rg "<primary-keyword>" --type ts --type js -l
rg "<primary-keyword>" --glob "*.py" -l
# Find by filename pattern
find . -name "*<keyword>*" -not -path "*/node_modules/*" -not -path "*/.git/*"
Collect: file paths, key terms, naming conventions seen.
Stop here if: 3 or more directly relevant files found with no critical gaps.
Read the most relevant files from Cycle 1 in full. Then:
# Find tests for those files
rg "<filename-stem>" --glob "*.test.*" --glob "*.spec.*" -l
rg "import.*<module-name>" -l
# Find call sites
rg "<function-name>|<class-name>" --type ts --type js -l
Collect: imports used, function signatures, test patterns, adjacent files referenced.
Stop here if: You can describe the change needed and its blast radius.
# Check project-specific docs
ls docs/ README.md AGENTS.md CLAUDE.md .claude/ 2>/dev/null
# Check config for feature flags, env vars, or schema
rg "<keyword>" .env.example *.config.* *.toml *.yaml -l 2>/dev/null
Collect: configuration constraints, environment requirements, anything that would block a change.
Stop the loop (whichever comes first):
After the loop, report:
Context gathered:
<file-path> — <one-line reason for relevance>
...
Missing context (if any):
<what is still unclear and why it matters>
If context is missing, state it explicitly. Do not proceed with guesses when a known gap exists.
When dispatching a subagent, pass only the gathered file list — not the full conversation context:
Relevant files for this task:
src/auth/tokens.ts — contains TokenService used by the bug
src/auth/session.ts — session state management
src/auth/tokens.test.ts — existing test patterns
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub yeaight7/agent-powerups --plugin agentic-systems