mcpField
C
compound-learnings

compound-learnings

github.com/majesticlabs-devAgent workflows5065 installsUpdated 7w ago
Repository

About compound-learnings

A skill for finding recurring patterns across Git history, pull requests, handoffs, and existing learnings. It applies frequency thresholds and artifact criteria to turn repeated lessons into actionable recommendations.

Key features

  1. 01Scan Git, PR, and handoff records
  2. 02Consolidate semantically similar patterns
  3. 03Apply occurrence-based thresholds
  4. 04Recommend artifact types
  5. 05Check recommendations for quality

Use cases

  1. 01Reviewing project history for repeated fixes
  2. 02Deciding whether a pattern merits a reusable artifact
  3. 03Preparing cross-session learning recommendations

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/majesticlabs-dev/majestic-marketplace --skill compound-learnings

After installing, type/compound-learningsin Claude Code to confirm it loaded.

Details

From the project README

Compound Learnings

Transform recurring patterns into durable artifacts. Use frequency-based thresholds to distinguish noise from signal.

Data Sources

Scan these locations for patterns:

SourceCommand/PathWhat to Extract
Git commitsgit log --oneline -100Repeated fix types, refactor patterns
Git commit bodiesgit log -50 --format="%B---"Lessons in commit descriptions
PR descriptionsgh pr list --state merged -L 20Decisions, learnings
Handoffs$MAIN_WORKTREE/.agents/handoffs/*.mdPatterns, What Worked/Failed
Key LearningsCLAUDE.md (Key Learnings section)Existing encoded patterns

Note: Session ledger (.agents/session_ledger.md) is for Skill("reflect") only - ephemeral per-session state.

Pattern Extraction

Step 1: Gather Raw Patterns
# Git patterns (look for repeated prefixes/types)
git log --oneline -100 | cut -d' ' -f2- | sort | uniq -c | sort -rn

# Handoff patterns
grep -h "^- " .agents/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
OccurrencesActionRationale
1SkipCould be noise, one-off incident
2NoteEmerging pattern, watch for recurrence
3+RecommendClear pattern, suggest artifact
4+Strong recommendEncode 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 file/context patterns?
  YES → SKILL (probabilistic, Claude MAY follow)
    Is enforcement critical (must happen every time)?
      YES → Consider HOOK instead (deterministic)
  NO ↓

Is it a simple rule or convention?
  YES → RULE (add to CLAUDE.md or .agents/lessons/)
    Project-specific? → .agents/lessons/ (with workflow_phase: review)
    Universal? → CLAUDE.md
  NO ↓

Does it enhance an existing agent's behavior?
  YES → AGENT UPDATE (modify existing agent)
  NO → Likely doesn't need encoding
Quick Reference
ArtifactWhen to UseExample
RuleSimple convention, always applies"Use kebab-case for file names"
SkillKnowledge/context for specific work"Stimulus controller patterns"
HookMust enforce behavior deterministically"Run linter before commit"
CommandUser-invoked workflow with arguments"/deploy --env staging"
AgentAutonomous task, returns report"security-review agent"

Output Format

Present findings as:

## Compound Learnings Analysis

### Strong Signal (4+ occurrences)
| Pattern | Count | Recommended Artifact | Rationale |
|---------|-------|---------------------|-----------|
| ... | ... | ... | ... |

### Emerging Patterns (2-3 occurrences)
| Pattern | Count | Potential Artifact | Notes |
|---------|-------|-------------------|-------|
| ... | ... | ... | ... |

### Recommended Actions
1. **[Artifact Type]**: `name` - description
   - Draft: [brief template or content]

Quality Checks

Before recommending an artifact, verify:

  • Generality: Applies beyond the specific incidents where it was observed
  • Specificity: Concrete enough to act on (not vague advice)
  • Uniqueness: Doesn't duplicate existing CLAUDE.md rules or skills
  • Correct Type: Matches the categorization decision tree

Integration with learn

When invoked from Skill("learn"):

  1. Locate main worktree for centralized handoffs
  2. Gather patterns from git, PRs, and handoffs
  3. Consolidate and count frequencies
  4. Apply thresholds
  5. Categorize recommended artifacts
  6. Present findings with draft content
  7. If approved, create artifacts using appropriate tools

Note: Skill("reflect") is for single-session analysis. Skill("learn") is for cross-session compound learning.

Comments

Markdown supported