From apex
Capture learnings (problems, decisions, gotchas) from sessions to make future agents more effective
How this skill is triggered — by the user, by Claude, or both
Slash command
/apex:compoundThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
<skill name="apex:compound" phase="any">
This skill can run after any phase or standalone session. It compounds the agent's effectiveness over time.
./apex/tasks/[ID].md future-agent-notes AGENTS.md I'll capture learnings from this session to help future agents.Please provide the task identifier, or I'll try to find the current task from context.
You can find active tasks in ./apex/tasks/ or run with:
/apex:compound [identifier]
Load task file and begin knowledge capture.
Grep: "[keywords]" in apex/tasks// Grep: ".[keywords]" in apex/tasks/.md Grep: ".[keywords]" in apex/tasks/.md Grep: ".[keywords]" in apex/tasks/*.md
</search-strategy>
<if-similar-found>
Display to user:
Found potentially related learnings:
Continue documenting? (These will be linked as related)
Wait for user response before proceeding.
</if-similar-found>
<if-no-similar>
Proceed directly to step 3.
</if-no-similar>
</step>
<step id="3" title="Gather learnings from session">
<instructions>
Review the task file and conversation to identify:
**Problems Encountered**:
- What broke or didn't work as expected?
- What symptoms were observed?
- What was the root cause?
- How was it fixed?
- How can it be prevented in future?
**Decisions Made**:
- What architectural or implementation choices were made?
- What alternatives were considered?
- Why was this choice made over others?
**Gotchas Discovered**:
- What surprised you or was counterintuitive?
- What looked like X but actually was Y?
- What documentation was misleading or missing?
</instructions>
<gathering-prompts>
Ask yourself:
1. "What would have saved time if I knew it at the start?"
2. "What mistake did we make that future agents should avoid?"
3. "What decision required significant thought that future agents can reuse?"
4. "What behavior was unexpected or undocumented?"
</gathering-prompts>
<minimum-threshold>
Only document if there's at least ONE meaningful learning.
If the task was trivial with nothing surprising, say:
"No significant learnings to capture from this session."
</minimum-threshold>
</step>
<step id="4" title="Structure learnings">
<format>
```xml
<future-agent-notes>
<timestamp>[ISO timestamp]</timestamp>
<problems>
<problem>
<what>[Clear description of the problem]</what>
<symptoms>
- [Observable sign 1]
- [Observable sign 2]
</symptoms>
<root-cause>[Why it happened]</root-cause>
<solution>[What fixed it]</solution>
<prevention>[How to avoid in future]</prevention>
</problem>
</problems>
<decisions>
<decision>
<choice>[What we chose]</choice>
<alternatives>[What we considered]</alternatives>
<rationale>[Why this choice - be specific]</rationale>
</decision>
</decisions>
<gotchas>
<gotcha>[Surprising thing - be specific and actionable]</gotcha>
</gotchas>
</future-agent-notes>
- Be specific, not vague ("Missing index on users.organization_id" not "database was slow")
- Include actionable prevention/rationale
- Skip empty sections (don't include `` if no problems)
- Each item should be self-contained and understandable without full context
1. Read current task file
2. Append `` section after `` (or last existing section)
3. Update frontmatter with `related_tasks` if similar tasks were found in step 2
Frontmatter update (if related tasks found):
---
# ... existing frontmatter ...
related_tasks: [task-id-1, task-id-2]
---
Display captured learnings:
```
Learnings captured:
Problems (N):
Decisions (N):
Gotchas (N):
Related tasks linked: [list or "none"]
</confirmation>
</step>
<step id="6" title="Offer promotion to AGENTS.md">
<purpose>
Critical learnings should be "always loaded" context in AGENTS.md.
</purpose>
<promotion-prompt>
Promote any to AGENTS.md? (These become "always loaded" context)
Select (numbers comma-separated, or N for none):
</promotion-prompt>
<selection-handling>
- If "N" or "none": Skip to final step
- If numbers selected: Proceed to promotion
</selection-handling>
</step>
<step id="7" title="Promote to AGENTS.md">
<instructions>
1. Read AGENTS.md fully
2. Find `## Learnings` section (create at end if doesn't exist)
3. Check for duplicates (don't add if similar already exists)
4. Append selected items in condensed format
5. Write updated AGENTS.md
</instructions>
<promotion-format>
```markdown
## Learnings
<!-- Auto-generated by /apex:compound. Do not edit directly. -->
### Problems
- **[Short title]** - [1-2 sentence description with actionable prevention]. (from [task-id], [date])
### Decisions
- **[Choice made]** - [1-2 sentence rationale]. (from [task-id], [date])
### Gotchas
- **[Short title]** - [1-2 sentence explanation]. (from [task-id], [date])
- Group by type (Problems, Decisions, Gotchas)
- Create subsection if doesn't exist
- Append to existing subsection if it exists
- Always include source task and date
Before adding, search for similar content:
```bash
Grep: "[key phrase from learning]" in AGENTS.md
```
If similar exists, skip with message: "Similar learning already in AGENTS.md, skipping."
- Task file read and context gathered
- Existing learnings checked for duplicates
- Meaningful learnings identified (or explicitly none)
- `` section written to task file
- `related_tasks` updated in frontmatter if applicable
- Promotion to AGENTS.md offered
- Selected items promoted with proper format
- Duplicates avoided in AGENTS.md
- After `/apex:ship` completes (ship will prompt you)
- After debugging sessions
- After any significant problem-solving
- After making architectural decisions
- When you discover something surprising
- Anytime knowledge would help future agents
npx claudepluginhub benredmond/apex --plugin apexExtracts 1-3 key learnings (insights, playbooks, corrections, patterns) from completed knowledge work sessions and saves to docs/knowledge/ after approval, duplicate, and stale checks. Use after plans, analysis, or strategy.
Captures post-task learnings, promotes patterns to docs/ADRs, updates workflows/systems from failures and user corrections. Auto-invokes on task completion or 'done'.
Analyzes conversations after significant work or 'reflect' triggers to extract learnings, classify them, and integrate into laws, skills, rules, or documentation via structured tasks.