Extract patterns from git history and session files, recommend artifacts (skill/rule/hook/agent) based on frequency thresholds
View on GitHubmajesticlabs-dev/majestic-marketplace
majestic-tools
plugins/majestic-tools/skills/compound-learnings/SKILL.md
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/majesticlabs-dev/majestic-marketplace/blob/main/plugins/majestic-tools/skills/compound-learnings/SKILL.md -a claude-code --skill compound-learningsInstallation paths:
.claude/skills/compound-learnings/# Compound Learnings
Transform recurring patterns into durable artifacts. Use frequency-based thresholds to distinguish noise from signal.
## Data Sources
Scan these locations for patterns:
| Source | Command/Path | What to Extract |
|--------|--------------|-----------------|
| Git commits | `git log --oneline -100` | Repeated fix types, refactor patterns |
| Git commit bodies | `git log -50 --format="%B---"` | Lessons in commit descriptions |
| PR descriptions | `gh pr list --state merged -L 20` | Decisions, learnings |
| Handoffs | `$MAIN_WORKTREE/.agents-os/handoffs/*.md` | Patterns, What Worked/Failed |
| Key Learnings | `CLAUDE.md` (Key Learnings section) | Existing encoded patterns |
**Note:** Session ledger (`.agents-os/session_ledger.md`) is for `/reflect` only - ephemeral per-session state.
## Pattern Extraction
### Step 1: Gather Raw Patterns
```bash
# Git patterns (look for repeated prefixes/types)
git log --oneline -100 | cut -d' ' -f2- | sort | uniq -c | sort -rn
# Handoff patterns
grep -h "^- " .agents-os/handoffs/*.md 2>/dev/null | sort | uniq -c | sort -rn
```
### Step 2: Consolidate Similar Patterns
Before counting, normalize patterns:
- "Always validate X" + "Validate X before Y" → "Validate X"
- "Don't use Z" + "Avoid Z" + "Z causes issues" → "Avoid Z"
Group by semantic meaning, not exact wording.
### Step 3: Apply Frequency Thresholds
| Occurrences | Action | Rationale |
|-------------|--------|-----------|
| 1 | Skip | Could be noise, one-off incident |
| 2 | Note | Emerging pattern, watch for recurrence |
| 3+ | Recommend | Clear pattern, suggest artifact |
| 4+ | Strong recommend | Encode immediately |
## Artifact Categorization
Use this decision tree to determine artifact type:
```
Is it a sequential workflow with distinct phases?
YES → Consider COMMAND (user-invoked) or AGENT (autonomous)
Does it need user interaction during execution?
YES → COMMAND
NO → AGENT
NO ↓
Should it trigger automatically on fil