reflection-injection
Inject relevant past reflections into agent context at iteration start so agents learn from prior mistakes without repeating them
Best use case
reflection-injection is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
It is a strong fit for teams already working in Codex.
Inject relevant past reflections into agent context at iteration start so agents learn from prior mistakes without repeating them
Teams using reflection-injection should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/reflection-injection/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How reflection-injection Compares
| Feature / Agent | reflection-injection | Standard Approach |
|---|---|---|
| Platform Support | Codex | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Inject relevant past reflections into agent context at iteration start so agents learn from prior mistakes without repeating them
Which AI agents support this skill?
This skill is designed for Codex.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
SKILL.md Source
# reflection-injection
Automatically inject relevant past reflections into agent context when starting new iterations or retrying after failures.
## Triggers
Alternate expressions and non-obvious activations (primary phrases are matched automatically from the skill description):
- "inject reflection" → explicit reflection injection shorthand
- "add metacognition" → metacognitive step insertion
## Purpose
This skill implements the Reflexion episodic memory injection pattern. Before each iteration, it loads relevant past reflections and injects them into the agent's context, enabling learning from past mistakes without repeating them.
## Behavior
When triggered, this skill:
1. **Load reflection history**:
- Read `.aiwg/ralph/reflections/loops/` for current loop reflections
- Read `.aiwg/ralph/reflections/patterns/` for cross-loop patterns
- Apply sliding window: k=5 most recent reflections
2. **Filter for relevance**:
- Match reflections by task type similarity
- Match by error type if retrying after failure
- Match by file/module if working on specific code
3. **Format for injection**:
- Convert reflections to natural language summary
- Use @$AIWG_ROOT/agentic/code/addons/ralph/templates/self-reflection-prompt.md template
- Prepend to agent context
4. **Track usage**:
- Record which reflections were injected
- Track whether injected reflections led to success
- Update pattern effectiveness scores
## Activation Conditions
```yaml
activation:
always_active_for:
- ralph-loop-orchestrator
- ralph-verifier
triggered_by:
- ralph_iteration_start
- agent_retry_after_failure
- explicit_user_request
skip_when:
- no_reflection_history: true
- first_iteration_of_first_loop: true
```
## Integration
This skill uses:
- `project-awareness`: Context for relevance filtering
- Agent Loop Orchestrator: Provides iteration state
- Reflection memory at `.aiwg/ralph/reflections/`
## References
- @$AIWG_ROOT/agentic/code/addons/ralph/schemas/reflection-memory.json - Schema
- @$AIWG_ROOT/agentic/code/addons/ralph/docs/reflection-memory-guide.md - Guide
- @$AIWG_ROOT/agentic/code/addons/ralph/templates/self-reflection-prompt.md - Prompt template
- @.aiwg/research/findings/REF-021-reflexion.md - Research foundationRelated Skills
aiwg-orchestrate
Route structured artifact work to AIWG workflows via MCP with zero parent context cost
venv-manager
Create, manage, and validate Python virtual environments. Use for project isolation and dependency management.
pytest-runner
Execute Python tests with pytest, supporting fixtures, markers, coverage, and parallel execution. Use for Python test automation.
vitest-runner
Execute JavaScript/TypeScript tests with Vitest, supporting coverage, watch mode, and parallel execution. Use for JS/TS test automation.
eslint-checker
Run ESLint for JavaScript/TypeScript code quality and style enforcement. Use for static analysis and auto-fixing.
repo-analyzer
Analyze GitHub repositories for structure, documentation, dependencies, and contribution patterns. Use for codebase understanding and health assessment.
pr-reviewer
Review GitHub pull requests for code quality, security, and best practices. Use for automated PR feedback and approval workflows.
YouTube Acquisition
yt-dlp patterns for acquiring content from YouTube and video platforms
Quality Filtering
Accept/reject logic and quality scoring heuristics for media content
Provenance Tracking
W3C PROV-O patterns for tracking media derivation chains and production history
Metadata Tagging
opustags and ffmpeg patterns for applying metadata to audio and video files
Audio Extraction
ffmpeg patterns for extracting audio from video files and transcoding between formats