基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/jmagly/aiwg --skill cross-task-learner命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
WCAG accessibility analysis for color palettes including contrast ratios, compliance checking, and remediation suggestions. Use when user needs to verify colors meet accessibility standards.
Generate, analyze, compare, export, and suggest color palettes using color theory. Use when user asks about colors, palettes, color schemes, or needs help choosing colors for a project.
Research current color trends from Pantone, architecture, film, and design. Use when user asks about trending colors, popular palettes, or wants research-backed color inspiration.
| 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"] |
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
This skill provides two core capabilities:
| 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 |
From REF-013 MetaGPT:
aiwg ralph-extract-patterns {loop_id}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,
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"
# 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
aiwg ralph-inject-patterns {loop_id}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
Input (loop ralph-fix-validation-b2c3d4e5 starting):
task: "Fix TypeScript type errors in user validation"
category: "debugging"
Patterns Retrieved:
retrieved_patterns:
error_patterns:
- pattern_id: "pat-error-null-check-015"
relevance: 0.95
success_rate: 1.0
usage_count: 1
- pattern_id: "pat-error-type-mismatch-003"
relevance: 0.88
success_rate: 0.94
usage_count: 18
success_patterns:
- pattern_id: "pat-success-type-fixing-002"
relevance: 0.92
success_rate: 0.87
average_iterations: 2.8
anti_patterns:
- pattern_id: "pat-anti-premature-optimization-001"
relevance: 0.65
failure_rate: 0.85
Injected Context (top 5 patterns):
## Cross-Loop Learning Context
Patterns from previous loops that may help with this task:
### Error Patterns
1. **TypeError: null property access** (100% success, 1 use)
- Error: "Cannot read property '.*' of null"
- Fix: Add null check before property access
- Template:
```typescript
if ({{variable}} == null) {
throw new ValidationError("{{message}}");
}
```
- Source: ralph-fix-auth-a1b2c3d4
2. **TypeError: type mismatch** (94% success, 18 uses)
- Error: "Type 'X' is not assignable to type 'Y'"
- Fix: Update interface definition or add type assertion
- Source: 18 previous loops
### Success Patterns
1. **Type error fixing approach** (87% success, avg 2.8 iterations)
- Steps:
1. Run tsc --noEmit to see all errors
2. Group errors by file/type
3. Fix interface definitions first
4. Fix usages second
5. Verify with tsc again
- Source: 12 successful loops
### Anti-Patterns to Avoid
1. **Premature optimization** (85% failure rate)
- Don't optimize before tests pass
- Complete primary task first
- Better alternative: pat-success-refactor-module-002
ralph:
cross_loop_learning:
injection:
enabled: true
top_k_patterns: 5
min_success_rate: 0.6
max_patterns_injected: 10
include_error_patterns: true
include_success_patterns: true
include_anti_patterns: true
include_code_templates: true
All patterns now track their source loop IDs:
pattern:
pattern_id: "pat-error-null-check-015"
source_loops:
- loop_id: "ralph-fix-auth-a1b2c3d4"
timestamp: "2026-02-02T15:00:00Z"
contributed_by: "software-implementer"
- loop_id: "ralph-fix-validation-b2c3d4e5"
timestamp: "2026-02-02T16:30:00Z"
contributed_by: "debugger"
Patterns aggregate learnings from multiple loops:
Example: Pattern seen in 3 loops
pattern_id: "pat-error-type-mismatch-003"
source_loops: [ralph-a, ralph-b, ralph-c]
usage_count: 18 # Total across all loops
success_rate: 0.94 # Aggregated success rate (17/18)
effectiveness_trend:
- timestamp: "2026-02-01T10:00:00Z"
success_rate_snapshot: 1.0
sample_size: 1
source_loop: "ralph-a"
- timestamp: "2026-02-01T14:00:00Z"
success_rate_snapshot: 0.90
sample_size: 10
source_loops: ["ralph-a", "ralph-b"]
- timestamp: "2026-02-02T15:00:00Z"
success_rate_snapshot: 0.94
sample_size: 18
source_loops: ["ralph-a", "ralph-b", "ralph-c"]
When a loop uses a pattern, it updates the shared registry:
on_pattern_application:
1_increment_usage_count:
- pattern.usage_count += 1
2_update_success_rate:
- If application succeeded:
pattern.successful_applications += 1
- Else:
pattern.failed_applications += 1
- pattern.success_rate = successful / (successful + failed)
3_update_effectiveness_trend:
- Add new snapshot with current success rate and sample size
4_add_source_loop:
- If loop_id not in source_loops:
pattern.source_loops.append({
loop_id: current_loop_id,
timestamp: now,
contributed_by: current_agent
})
5_update_last_used:
- pattern.last_used = now
Patterns maintain full lineage across loops:
Pattern: pat-error-null-check-015
Discovered: ralph-fix-auth-a1b2c3d4 (2026-02-02T15:00:00Z)
Applied: ralph-fix-validation-b2c3d4e5 (2026-02-02T16:30:00Z) ✓
Applied: ralph-fix-user-c3d4e5f6 (2026-02-02T18:00:00Z) ✓
Applied: ralph-fix-api-d4e5f6a7 (2026-02-02T19:15:00Z) ✗
Success rate: 75% (3/4)
All metrics now support multi-loop aggregation:
effectiveness_metrics:
total_patterns: 47
patterns_by_type:
error_patterns: 24
success_patterns: 15
anti_patterns: 5
code_templates: 3
pattern_usage_stats:
total_applications: 156
successful_applications: 142
failed_applications: 14
overall_success_rate: 0.91
cross_loop_benefit:
loops_with_pattern_injection: 23
loops_without_pattern_injection: 8
average_iterations_with: 3.2
average_iterations_without: 5.1
improvement_percentage: 37.3 # (5.1 - 3.2) / 5.1 * 100
last_updated: "2026-02-02T20:00:00Z"
Each loop tracks which patterns it used:
loop_state:
loop_id: "ralph-fix-validation-b2c3d4e5"
cross_loop_learning:
injected_patterns:
- pattern_id: "pat-error-null-check-015"
applied: true
successful: true
iteration_used: 2
- pattern_id: "pat-error-type-mismatch-003"
applied: true
successful: true
iteration_used: 4
extracted_patterns:
- pattern_id: "pat-error-optional-types-016"
new: true
success_rate: 1.0
improvement_estimate:
baseline_iterations: 6 # Estimated without patterns
actual_iterations: 4
improvement: 33.3%
.aiwg/ralph/
├── shared/ # Cross-loop shared state
│ ├── patterns/
│ │ ├── error-patterns.json # Error → fix patterns
│ │ ├── success-patterns.json # Success approaches
│ │ ├── anti-patterns.json # Failure patterns
│ │ └── code-templates.json # Reusable code
│ ├── archive/ # Pruned patterns
│ │ ├── 2026-01-patterns.json
│ │ └── 2026-02-patterns.json
│ └── effectiveness-metrics.json # Cross-loop metrics
│
├── memory/ # Cross-task memory
│ ├── task-index.json # Semantic task index
│ ├── embeddings/ # Task embeddings
│ ├── reflections/ # Reflexion-style reflections
│ └── patterns/ # Patterns integrated here too
│
└── loops/ # Per-loop state
├── ralph-fix-auth-a1b2c3d4/
│ ├── state.json # Includes pattern usage
│ └── analytics/
│ └── analytics.json # Pattern effectiveness
└── ralph-fix-validation-b2c3d4e5/
└── ...
# Extract from completed loop
aiwg ralph-extract-patterns ralph-fix-auth-a1b2c3d4
# Extract from all completed loops
aiwg ralph-extract-patterns --all
# Extract specific pattern types only
aiwg ralph-extract-patterns ralph-fix-auth-a1b2c3d4 --types error,success
# Inject patterns into running loop
aiwg ralph-inject-patterns ralph-current-loop-e5f6a7b8
# Inject with custom filters
aiwg ralph-inject-patterns ralph-current-loop-e5f6a7b8 \
--min-success-rate 0.8 \
--top-k 10
# List all patterns
aiwg ralph-patterns list
# Filter by type
aiwg ralph-patterns list --type error
# Filter by success rate
aiwg ralph-patterns list --min-success-rate 0.8
# Filter by source loop
aiwg ralph-patterns list --from-loop ralph-fix-auth-a1b2c3d4
aiwg ralph-patterns show pat-error-null-check-015
Output:
Pattern: pat-error-null-check-015
Type: Error Pattern
Created: 2026-02-02T15:00:00Z
Last Used: 2026-02-02T19:15:00Z
Effectiveness:
Success Rate: 75% (3/4 applications)
Usage Count: 4
Average Impact: -2.0 iterations
Source Loops:
- ralph-fix-auth-a1b2c3d4 (discovered)
- ralph-fix-validation-b2c3d4e5 (applied successfully)
- ralph-fix-user-c3d4e5f6 (applied successfully)
- ralph-fix-api-d4e5f6a7 (applied, failed)
Error Signature:
Type: TypeError
Pattern: "Cannot read property '.*' of null"
Fix Approach:
Category: add_null_check
Template: |
if ({{variable}} == null) {
throw new ValidationError("{{message}}");
}
Tags: typescript, null-safety, validation
# Dry run
aiwg ralph-patterns prune --dry-run
# Prune low-success patterns
aiwg ralph-patterns prune --min-success-rate 0.5
# Prune old unused patterns
aiwg ralph-patterns prune --max-age-days 90
Patterns complement reflections:
Both are injected into new loop context.
Patterns inform test execution:
Agent loop skill triggers pattern extraction/injection:
Don't prune patterns too early. Allow 5-10 uses before evaluating:
min_usage_count_for_evaluation: 5
Use standardized tags:
typescript, python, goauth, validation, testingnull-safety, async, error-handlingRegularly review low-success patterns:
aiwg ralph-patterns list --min-success-rate 0.0 --max-success-rate 0.6
Export/import patterns for team-wide learning:
# Export team patterns
aiwg ralph-patterns export --output team-patterns.json
# Import on teammate's machine
aiwg ralph-patterns import --input team-patterns.json
Symptom: Loop doesn't receive relevant pattern
Causes:
Fix:
# Check pattern
aiwg ralph-patterns show {pattern_id}
# Lower threshold
aiwg ralph "task" --min-pattern-success-rate 0.5
# Check config
grep -A10 "cross_loop_learning:" aiwg.yml
Symptom: Loop completed but no patterns added
Causes:
Fix:
# Extract manually
aiwg ralph-extract-patterns {loop_id}
# Enable auto-extraction
# In aiwg.yml:
ralph:
cross_loop_learning:
extraction:
auto_extract_on_completion: true
@$AIWG_ROOT/${CLAUDE_PLUGIN_ROOT}/schemas/shared-patterns.yaml - Pattern schema@$AIWG_ROOT/${CLAUDE_PLUGIN_ROOT}/schemas/cross-task-memory.yaml - Cross-task memory@$AIWG_ROOT/${CLAUDE_PLUGIN_ROOT}/docs/cross-loop-learning.md - Full documentation.aiwg/research/paper-analysis/REF-013-aiwg-analysis.md - MetaGPT researchralph skill - Iterative loop executoragent-loop skill - Detects iterative loop requests