/cross-task-learner
Enable agent loops to learn from similar past tasks and share patterns across loops
$ npx -y skills add jmagly/aiwg --skill cross-task-learner --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/cross-task-learner
Context preview
The summary Claude sees to decide when to auto-load this skill.
Enable agent loops to learn from similar past tasks and share patterns across loops
SKILL.md
cross-task-learner.SKILL.mdnamespace: aiwg
name: cross-task-learner
description: Enable agent loops to learn from similar past tasks and share patterns across loops
version: 2.0.0
capabilities:
- semantic_task_matching
- pattern_extraction
- pattern_injection
- cross_loop_learning
platforms: [all]
Cross-Task Learner Skill
Enable agent loops to learn from similar past tasks and share discovered patterns across multiple concurrent or sequential loops.
**Research Foundation**: REF-013 MetaGPT - 159% improvement with shared state
**Version 2.0**: Multi-loop awareness with loop_id tracking
---
Overview
This skill provides two core capabilities:
1. **Pattern Extraction** - On loop completion, extract reusable patterns from execution history 2. **Pattern Injection** - On loop start, inject relevant patterns from previous loops
Benefits
| Benefit | Impact | |---------|--------| | Faster resolution | Patterns eliminate redundant debugging | | Higher success rates | Proven approaches applied automatically | | Accumulated wisdom | System gets smarter over time | | Anti-pattern detection | Failed approaches flagged and avoided |
Research Basis
From REF-013 MetaGPT:
- **159% improvement** with shared state across agents
- **Publish-subscribe pattern** enables knowledge sharing
- **Structured outputs** become inputs for other agents
- **Memory persistence** critical for cross-session learning
---
Pattern Extraction (On Loop Completion)
Trigger
- Agent loop completion (success, partial, or failure)
- Manual extraction request via `aiwg ralph-extract-patterns {loop_id}`
Process
extraction_steps:
1_analyze_loop_history:
- Load loop state from .aiwg/ralph/loops/{loop_id}/state.json
- Load iteration analytics
- Load debug memory
- Load reflection history
2_identify_error_fix_pairs:
- Scan iterations for test failures
- Identify fixes that resolved errors
- Extract error signature + fix approach
- Compute initial success rate (1.0 for first occurrence)
3_identify_successful_approaches:
- Analyze task category (testing, debugging, refactoring, etc.)
- Extract step sequence that led to success
- Note tools used and iteration count
- Identify preconditions and benefits
4_identify_failure_patterns:
- Detect repeated same errors (anti-patterns)
- Note approaches that led to scope creep
- Flag patterns that caused quality degradation
- Record better alternatives if discovered
5_extract_code_templates:
- Identify successful code changes
- Generalize with placeholders
- Document use case and placeholders
- Tag by language and purpose
6_check_for_duplicates:
- Compare against existing patterns in registry
- Merge if >80% similar
- Update usage count and success rate if duplicate
7_store_in_registry:
- Add to .aiwg/ralph/shared/patterns/{type}-patterns.json
- Update patterns index for semantic search
- Link to source loop_id
8_update_effectiveness_metrics:
- Increment pattern counts
- Update cross-loop benefit statistics
- Log extraction eventExample Extraction
**Input** (from loop `ralph-fix-auth-a1b2c3d4`):
iteration_2:
error:
type: "TypeError"
message: "Cannot read property 'email' of null"
location: "src/auth/validate.ts:42"
iteration_3:
fix_applied:
description: "Added null check for user object"
diff: |
+ if (user == null) {
+ throw new ValidationError("User is required");
+ }
test_results:
passed: 12
failed: 0**Output** (extracted pattern):
pattern_id: "pat-error-null-check-015"
type: "error_pattern"
error_signature:
error_type: "TypeError"
error_pattern: "Cannot read property '.*' of null"
error_location_hints:
- "*.ts:validate*"
fix_approach:
description: "Add null check before property access"
fix_category: "add_null_check"
code_template: |
if ({{variable}} == null) {
throw new ValidationError("{{message}}");
}
code_template_language: "typescript"
source_loops:
- loop_id: "ralph-fix-auth-a1b2c3d4"
timestamp: "2026-02-02T15:00:00Z"
contributed_by: "software-implementer"
success_rate: 1.0
usage_count: 1
first_discovered: "2026-02-02T15:00:00Z"
last_used: "2026-02-02T15:00:00Z"
tags:
- "typescript"
- "null-safety"
- "validation"Configuration
# In aiwg.yml or .aiwg/config.yml
ralph:
cross_loop_learning:
extraction:
enabled: true
auto_extract_on_completion: true
min_success_rate_threshold: 0.6
min_usage_count_for_evaluation: 3
extract_code_templates: true
merge_similar_patterns: true
similarity_threshold: 0.80---
Pattern Injection (On Loop Start)
Trigger
- Agent loop start
- Manual injection request via `aiwg ralph-inject-patterns {loop_id}`
Process
injection_steps:
1_analyze_task_description:
- Extract task text
- Identify task category (testing, debugging, refactoring, etc.)
- Generate task embedding for semantic matching
2_search_error_patterns:
- Query error patterns by task category
- Match error signatures to likely error types
- Filter by min success rate (default 0.6)
- Sort by effectiveness
3_search_success_patterns:
- Query success patterns by task category match
- Use semantic similarity on task description
- Filter by min success rate
- Sort by average iterations (lower is better)
4_search_anti_patterns:
- Query anti-patterns by task category
- Identify failure modes to avoid
- Include better alternatives
5_search_code_templates:
- Query templates by language and task type
- Filter by success rate
- Sort by usage count
6_filter_and_rank:
- Combine all pattern types
- Remove duplicates
- Rank by relevance × effectiveness
- Take top-k (default k=5)
7_inject_into_context:
- Format patterns forRead more
namespace: aiwg name: cross-task-learner description: Enable agent loops to learn from similar past tasks and share patterns across loops version: 2.0.0 capabilities: - semantic_task_matching - pattern_extraction - pattern_injection - cross_loop_learning platforms: [all]
Cross-Task Learner Skill
Enable agent loops to learn from similar past tasks and share discovered patterns across multiple concurrent or sequential loops.
**Research Foundation**: REF-013 MetaGPT - 159% improvement with shared state
**Version 2.0**: Multi-loop awareness with loop_id tracking
---
Overview
This skill provides two core capabilities:
1. **Pattern Extraction** - On loop completion, extract reusable patterns from execution history 2. **Pattern Injection** - On loop start, inject relevant patterns from previous loops
Benefits
| Benefit | Impact | |---------|--------| | Faster resolution | Patterns eliminate redundant debugging | | Higher success rates | Proven approaches applied automatically | | Accumulated wisdom | System gets smarter over time | | Anti-pattern detection | Failed approaches flagged and avoided |
Research Basis
From REF-013 MetaGPT:
- **159% improvement** with shared state across agents
- **Publish-subscribe pattern** enables knowledge sharing
- **Structured outputs** become inputs for other agents
- **Memory persistence** critical for cross-session learning
---
Pattern Extraction (On Loop Completion)
Trigger
- Agent loop completion (success, partial, or failure)
- Manual extraction request via `aiwg ralph-extract-patterns {loop_id}`
Process
extraction_steps:
1_analyze_loop_history:
- Load loop state from .aiwg/ralph/loops/{loop_id}/state.json
- Load iteration analytics
- Load debug memory
- Load reflection history
2_identify_error_fix_pairs:
- Scan iterations for test failures
- Identify fixes that resolved errors
- Extract error signature + fix approach
- Compute initial success rate (1.0 for first occurrence)
3_identify_successful_approaches:
- Analyze task category (testing, debugging, refactoring, etc.)
- Extract step sequence that led to success
- Note tools used and iteration count
- Identify preconditions and benefits
4_identify_failure_patterns:
- Detect repeated same errors (anti-patterns)
- Note approaches that led to scope creep
- Flag patterns that caused quality degradation
- Record better alternatives if discovered
5_extract_code_templates:
- Identify successful code changes
- Generalize with placeholders
- Document use case and placeholders
- Tag by language and purpose
6_check_for_duplicates:
- Compare against existing patterns in registry
- Merge if >80% similar
- Update usage count and success rate if duplicate
7_store_in_registry:
- Add to .aiwg/ralph/shared/patterns/{type}-patterns.json
- Update patterns index for semantic search
- Link to source loop_id
8_update_effectiveness_metrics:
- Increment pattern counts
- Update cross-loop benefit statistics
- Log extraction eventExample Extraction
**Input** (from loop `ralph-fix-auth-a1b2c3d4`):
iteration_2:
error:
type: "TypeError"
message: "Cannot read property 'email' of null"
location: "src/auth/validate.ts:42"
iteration_3:
fix_applied:
description: "Added null check for user object"
diff: |
+ if (user == null) {
+ throw new ValidationError("User is required");
+ }
test_results:
passed: 12
failed: 0**Output** (extracted pattern):
pattern_id: "pat-error-null-check-015"
type: "error_pattern"
error_signature:
error_type: "TypeError"
error_pattern: "Cannot read property '.*' of null"
error_location_hints:
- "*.ts:validate*"
fix_approach:
description: "Add null check before property access"
fix_category: "add_null_check"
code_template: |
if ({{variable}} == null) {
throw new ValidationError("{{message}}");
}
code_template_language: "typescript"
source_loops:
- loop_id: "ralph-fix-auth-a1b2c3d4"
timestamp: "2026-02-02T15:00:00Z"
contributed_by: "software-implementer"
success_rate: 1.0
usage_count: 1
first_discovered: "2026-02-02T15:00:00Z"
last_used: "2026-02-02T15:00:00Z"
tags:
- "typescript"
- "null-safety"
- "validation"Configuration
# In aiwg.yml or .aiwg/config.yml
ralph:
cross_loop_learning:
extraction:
enabled: true
auto_extract_on_completion: true
min_success_rate_threshold: 0.6
min_usage_count_for_evaluation: 3
extract_code_templates: true
merge_similar_patterns: true
similarity_threshold: 0.80---
Pattern Injection (On Loop Start)
Trigger
- Agent loop start
- Manual injection request via `aiwg ralph-inject-patterns {loop_id}`
Process
injection_steps:
1_analyze_task_description:
- Extract task text
- Identify task category (testing, debugging, refactoring, etc.)
- Generate task embedding for semantic matching
2_search_error_patterns:
- Query error patterns by task category
- Match error signatures to likely error types
- Filter by min success rate (default 0.6)
- Sort by effectiveness
3_search_success_patterns:
- Query success patterns by task category match
- Use semantic similarity on task description
- Filter by min success rate
- Sort by average iterations (lower is better)
4_search_anti_patterns:
- Query anti-patterns by task category
- Identify failure modes to avoid
- Include better alternatives
5_search_code_templates:
- Query templates by language and task type
- Filter by success rate
- Sort by usage count
6_filter_and_rank:
- Combine all pattern types
- Remove duplicates
- Rank by relevance × effectiveness
- Take top-k (default k=5)
7_inject_into_context:
- Format patterns forMulti-agent AI framework for Claude Code, Copilot, Cursor, Warp, and 6 more platforms 200+ agents, 109+ CLI commands, 400+ deployable agent/skill/command/rule artifacts, 8 core frameworks, 32 addons, and a 40-plugin Claude Code marketplace.
Repo: jmagly/aiwg
Other skills on aiwg.
- /agent-loop-ext
Crash-resilient external agent loop with state persistence and CI/CD integration
Open skill - /agent-loop
Detect requests for iterative autonomous agent loops and route to the appropriate loop executor
Open skill - /auto-test-execution
Automatically execute tests when code-generating agents modify source files, enforcing the execute-before-return pattern
Open skill - /debug-memory
Query and manage the executable feedback debug memory
Open skill - /execute-feedback
Execute tests on generated code and iterate until passing
Open skill - /infer-completion-criteria
Infer measurable completion criteria for an agent-loop task from project docs, code, and AIWG standards when the user has not supplied --completion explicitly
Open skill

