Token导航 LogoToken导航

Agent Skill · 研究检索

session-learning(会话学习)

session-learning 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

session-learning 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描有未通过项,按安装量在研究检索类的 73,675 个 Skill 里排第 30,190。

总安装 2,917周安装 118GitHub Stars 55下载 916核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:session-learning(会话学习)
来源仓库:https://github.com/rysweet/amplihack
仓库路径:skills/session-learning
安装命令:
npx skills add https://github.com/rysweet/amplihack --skill session-learning
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/rysweet/amplihack --skill session-learning

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

session-learning 用于记录任务执行中的错误、用户纠正、经验和能力缺口。适合在 Codex、Claude、Cursor、Gemini CLI 中让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。

安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/session-learning

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/rysweet/amplihack --skill session-learning;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

session-learning 怎么安装?

在终端执行 npx skills add https://github.com/rysweet/amplihack --skill session-learning。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

session-learning 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

session-learning 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

session-learning 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

session-learning 用的人多吗?

公开数据是累计安装 2,917 次,近一周安装 118 次,下载 916 次,GitHub 55 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

session-learning 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
session-learning

会话学习 · 本页

2,91755需要联网MIT未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Session Learning Skill

Purpose

This skill provides cross-session learning by:

  1. Extracting learnings from session transcripts at Stop hook
  2. Storing learnings in structured YAML format (~/.amplihack/.claude/data/learnings/)
  3. Injecting relevant past learnings at SessionStart based on task similarity
  4. Managing learnings via /amplihack:learnings capability

Design Philosophy

Ruthlessly Simple Approach:

  • One YAML file per learning category (not per session)
  • Simple keyword matching for relevance (no complex ML)
  • Complements existing DISCOVERIES.md/PATTERNS.md - doesn't replace them
  • Fail-safe: Never blocks session start or stop

Learning Categories

Learnings are stored in five categories:

CategoryFilePurpose
errorserrors.yamlError patterns and their solutions
workflowsworkflows.yamlWorkflow insights and shortcuts
toolstools.yamlTool usage patterns and gotchas
architecturearchitecture.yamlDesign decisions and trade-offs
debuggingdebugging.yamlDebugging strategies and root causes

YAML Schema

Each learning file follows this structure:

# .claude/data/learnings/errors.yaml
category: errors
last_updated: "2025-11-25T12:00:00Z"
learnings:
  - id: "err-001"
    created: "2025-11-25T12:00:00Z"
    keywords:
      - "import"
      - "module not found"
      - "circular dependency"
    summary: "Circular imports cause 'module not found' errors"
    insight: |
      When module A imports from module B and module B imports from module A,
      Python raises ImportError. Solution: Move shared code to a third module
      or use lazy imports.
    example: |
      # Bad: circular import
      # utils.py imports from models.py
      # models.py imports from utils.py

      # Good: extract shared code
      # shared.py has common functions
      # both utils.py and models.py import from shared.py
    confidence: 0.9
    times_used: 3

When to Use This Skill

Automatic Usage (via hooks):

  • At session stop: Extracts learnings from transcript
  • At session start: Injects relevant learnings based on prompt keywords

Manual Usage:

  • When you want to view/manage learnings
  • When debugging and want to recall past solutions
  • When onboarding to understand project-specific patterns

Learning Extraction Process

Step 1: Analyze Session Transcript

At session stop, scan for:

  1. Error patterns: Errors encountered and how they were solved
  2. Workflow insights: Steps that worked well or poorly
  3. Tool discoveries: New ways of using tools effectively
  4. Architecture decisions: Design choices and their rationale
  5. Debugging strategies: Root cause analysis patterns

Step 2: Extract Structured Learning

For each significant insight:

  1. Generate unique ID based on category and timestamp
  2. Extract keywords from context (3-5 relevant terms)
  3. Create one-sentence summary
  4. Write detailed insight with explanation
  5. Include code example if applicable
  6. Assign confidence score (0.5-1.0)

Step 3: Merge with Existing Learnings

  1. Check for duplicate learnings using keyword overlap
  2. If similar learning exists (>60% keyword match), update confidence
  3. Otherwise, append new learning to category file

Learning Injection Process

Step 1: Extract Task Keywords

From session start prompt, extract:

  • Technical terms (languages, frameworks, tools)
  • Problem indicators (error, fix, debug, implement)
  • Domain keywords (api, database, auth, etc.)

Step 2: Find Relevant Learnings

For each learning category:

  1. Load learnings from YAML
  2. Calculate keyword overlap with task
  3. Rank by overlap_score * confidence * recency_weight
  4. Select top 3 most relevant learnings

Step 3: Inject Context

Format relevant learnings as context:

## Past Learnings Relevant to This Task

### [Category]: [Summary]

## [Insight with example if helpful]

Usage Examples

Example 1: Automatic Extraction

Session: Debugging circular import issue in Neo4j module
Duration: 45 minutes
Resolution: Moved shared types to separate file

Extracted Learning:
- Category: errors
- Keywords: [import, circular, neo4j, type]
- Summary: Circular imports in Neo4j types cause ImportError
- Insight: When Neo4jNode imports from connection.py which imports
  Node types, move types to separate types.py module
- Example: types.py with dataclasses, connection.py imports from types.py

Example 2: Automatic Injection

Session Start Prompt: "Fix the import error in the memory module"

Matched Learnings:
1. errors/err-001: "Circular imports cause 'module not found' errors" (85% match)
2. debugging/dbg-003: "Use `python -c` to isolate import issues" (60% match)

Injected Context:
## Past Learnings Relevant to This Task

### Errors: Circular imports cause 'module not found' errors
When module A imports from module B and B imports from A, Python raises
ImportError. Solution: Move shared code to a third module or use lazy imports.
---

Example 3: Manual Management

User: Show me what I've learned about testing

Claude (using this skill):
1. Reads .claude/data/learnings/workflows.yaml
2. Filters learnings with keywords containing "test"
3. Displays formatted list with summaries and examples

Keyword Matching Algorithm

Simple but effective matching:

def calculate_relevance(task_keywords: set, learning_keywords: set) -> float:
    """Calculate relevance score between 0 and 1."""
    if not task_keywords or not learning_keywords:
        return 0.0

    # Count overlapping keywords
    overlap = task_keywords & learning_keywords

    # Score: overlap / min(task, learning) to not penalize short queries
    return len(overlap) / min(len(task_keywords), len(learning_keywords))

Integration Points

With Stop Hook

The stop hook can call this skill to extract learnings:

  1. Parse transcript for significant events
  2. Identify error patterns, solutions, insights
  3. Store in appropriate category YAML
  4. Log extraction summary

With Session Start Hook

The session start hook can inject relevant learnings:

  1. Parse initial prompt for keywords
  2. Find matching learnings across categories
  3. Format as context injection
  4. Include in session context

With /amplihack:learnings Command

Command interface for learning management:

  • /amplihack:learnings show [category] - Display learnings
  • /amplihack:learnings search <query> - Search across all categories
  • /amplihack:learnings add - Manually add a learning
  • /amplihack:learnings stats - Show learning statistics

Quality Guidelines

When to Extract

Extract a learning when:

  • Solving a problem that took >10 minutes
  • Discovering non-obvious tool behavior
  • Finding a pattern that applies broadly
  • Making an architecture decision with trade-offs

When NOT to Extract

Skip extraction when:

  • Issue was trivial typo or syntax error
  • Solution is already in DISCOVERIES.md or PATTERNS.md
  • Insight is too project-specific to reuse
  • Confidence is low (<0.5)

Learning Quality Checklist

  • Keywords are specific and searchable
  • Summary is one clear sentence
  • Insight explains WHY, not just WHAT
  • Example is minimal and runnable
  • Confidence reflects actual certainty

File Locations

.claude/
  data/
    learnings/
      errors.yaml        # Error patterns and solutions
      workflows.yaml     # Workflow insights
      tools.yaml         # Tool usage patterns
      architecture.yaml  # Design decisions
      debugging.yaml     # Debugging strategies
      _stats.yaml        # Usage statistics (auto-generated)

Comparison with Existing Systems

FeatureDISCOVERIES.mdPATTERNS.mdSession Learning
FormatMarkdownMarkdownYAML
AudienceHumansHumansAgents + Humans
StorageSingle fileSingle filePer-category files
MatchingManual readManual readKeyword-based auto
InjectionManualManualAutomatic
ScopeMajor discoveriesProven patternsAny useful insight

Complementary Use:

  • Use DISCOVERIES.md for major, well-documented discoveries
  • Use PATTERNS.md for proven, reusable patterns with code
  • Use Session Learning for quick insights that help future sessions

Error Handling

YAML Parsing Errors

If a learning file becomes corrupted or invalid:

import yaml
from pathlib import Path

def safe_load_learnings(filepath: Path) -> dict:
    """Load learnings with graceful error handling."""
    try:
        content = filepath.read_text()
        data = yaml.safe_load(content)
        if not isinstance(data, dict) or "learnings" not in data:
            print(f"Warning: Invalid structure in {filepath}, using empty learnings")
            return {"category": filepath.stem, "learnings": []}
        return data
    except yaml.YAMLError as e:
        print(f"Warning: YAML error in {filepath}: {e}")
        # Create backup before recovery
        backup = filepath.with_suffix(".yaml.bak")
        filepath.rename(backup)
        print(f"Backed up corrupted file to {backup}")
        return {"category": filepath.stem, "learnings": []}
    except Exception as e:
        print(f"Warning: Could not read {filepath}: {e}")
        return {"category": filepath.stem, "learnings": []}

Missing Files

If the learnings directory doesn't exist, create it:

def ensure_learnings_directory():
    """Create learnings directory and empty files if missing."""
    learnings_dir = Path(".claude/data/learnings")
    learnings_dir.mkdir(parents=True, exist_ok=True)

    categories = ["errors", "workflows", "tools", "architecture", "debugging"]
    for cat in categories:
        filepath = learnings_dir / f"{cat}.yaml"
        if not filepath.exists():
            filepath.write_text(f"category: {cat}\nlearnings: []\n")

Fail-Safe Principle

The learning system follows fail-safe design:

  • Never blocks session start: If injection fails, session continues normally
  • Never blocks session stop: If extraction fails, session ends normally
  • Logs warnings but continues: Errors are logged, not raised
  • Creates backups before modifications: Corrupt files are preserved

Hook Integration

Stop Hook: Learning Extraction

Add learning extraction to your stop hook:

# .claude/tools/amplihack/hooks/stop_hook.py

async def extract_session_learnings(transcript: str, session_id: str):
    """Extract learnings from session transcript at stop."""
    from pathlib import Path
    import yaml
    from datetime import datetime

    # Only extract if session was substantive (not just a quick question)
    if len(transcript) < 1000:
        return

    # Use Claude to extract insights (simplified example)
    extraction_prompt = f"""
    Analyze this session transcript and extract any reusable learnings.

    Categories:
    - errors: Error patterns and solutions
    - workflows: Process improvements
    - tools: Tool usage insights
    - architecture: Design decisions
    - debugging: Debug strategies

    For each learning, provide:
    - category (one of the above)
    - keywords (3-5 searchable terms)
    - summary (one sentence)
    - insight (detailed explanation)
    - example (code if applicable)
    - confidence (0.5-1.0)

    Transcript:
    {transcript[:5000]}  # Truncate for token limits
    """

    # ... call Claude to extract ...
    # ... parse response and add to appropriate YAML files ...

def on_stop(session_data: dict):
    """Stop hook entry point."""
    # ... other stop hook logic ...

    # Extract learnings (non-blocking)
    try:
        import asyncio
        asyncio.create_task(
            extract_session_learnings(
                session_data.get("transcript", ""),
                session_data.get("session_id", "")
            )
        )
    except Exception as e:
        print(f"Learning extraction failed (non-blocking): {e}")

Session Start Hook: Learning Injection

Add learning injection to your session start hook:

# .claude/tools/amplihack/hooks/session_start_hook.py

def inject_relevant_learnings(initial_prompt: str) -> str:
    """Find and format relevant learnings for injection."""
    from pathlib import Path
    import yaml

    learnings_dir = Path(".claude/data/learnings")
    if not learnings_dir.exists():
        return ""

    # Extract keywords from prompt
    prompt_lower = initial_prompt.lower()
    task_keywords = set()
    for word in prompt_lower.split():
        if len(word) > 3:  # Skip short words
            task_keywords.add(word.strip(".,!?"))

    # Find matching learnings
    matches = []
    for yaml_file in learnings_dir.glob("*.yaml"):
        if yaml_file.name.startswith("_"):
            continue  # Skip _stats.yaml

        try:
            data = yaml.safe_load(yaml_file.read_text())
            for learning in data.get("learnings", []):
                learning_keywords = set(k.lower() for k in learning.get("keywords", []))
                overlap = task_keywords & learning_keywords
                if overlap:
                    score = len(overlap) * learning.get("confidence", 0.5)
                    matches.append((score, learning))
        except Exception:
            continue

    # Return top 3 matches
    matches.sort(key=lambda x: x[0], reverse=True)
    if not matches:
        return ""

    context = "## Past Learnings Relevant to This Task\n\n"
    for score, learning in matches[:3]:
        context += f"### {learning.get('summary', 'Insight')}\n"
        context += f"{learning.get('insight', '')}\n\n"

    return context

def on_session_start(session_data: dict) -> dict:
    """Session start hook entry point."""
    initial_prompt = session_data.get("prompt", "")

    # Inject relevant learnings
    try:
        learning_context = inject_relevant_learnings(initial_prompt)
        if learning_context:
            session_data["injected_context"] = learning_context
    except Exception as e:
        print(f"Learning injection failed (non-blocking): {e}")

    return session_data

Limitations

  1. Keyword matching is imperfect - May miss relevant learnings or match irrelevant ones
  2. No semantic understanding - Can't match conceptually similar but differently-worded insights
  3. Storage is local - Learnings don't sync across machines
  4. Manual cleanup needed - Old/wrong learnings should be periodically reviewed

Future Improvements

If needed, consider:

  • Embedding-based similarity for better matching
  • Cross-machine sync via git
  • Automatic confidence decay over time
  • Integration with Neo4j for graph-based learning relationships

Success Metrics

Track effectiveness:

  • Injection rate: % of sessions with relevant learning injected
  • Usage rate: How often injected learnings help solve problems
  • Growth rate: New learnings per week
  • Quality: User feedback on learning relevance

平台分布

Claude Code

28.57%
按下载量换算262

OpenCode

25.58%
按下载量换算234

Antigravity

19.03%
按下载量换算174

Gemini CLI

13.16%
按下载量换算121

windsurf

8.08%
按下载量换算74

Cursor

3.83%
按下载量换算35

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills