session-logger

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Session Logger

Session Logger

A skill for automatically saving conversation history to persistent session log files.
一款用于将会话历史自动保存到持久化会话日志文件的Skill。

When This Skill Activates

技能触发时机

This skill activates when you:
  • Say "保存对话信息" or "保存对话"
  • Say "记录会话内容" or "保存session"
  • Say "save session" or "save conversation"
  • Ask to save the current conversation
当你执行以下操作时,该技能会被激活:
  • 说出“保存对话信息”或“保存对话”
  • 说出“记录会话内容”或“保存session”
  • 说出“save session”或“save conversation”
  • 请求保存当前会话

Session File Location

会话文件位置

All sessions are saved to:
sessions/YYYY-MM-DD-{topic}.md
所有会话都会保存至:
sessions/YYYY-MM-DD-{topic}.md

What Gets Logged

日志记录内容

For each session, log:
  1. Metadata
    • Date and duration
    • Context/working directory
    • Main topic
  2. Summary
    • What was accomplished
    • Key decisions made
    • Files created/modified
  3. Actions Taken
    • Checklist of completed tasks
    • Pending follow-ups
  4. Technical Notes
    • Important code snippets
    • Commands used
    • Solutions found
  5. Open Questions
    • Issues to revisit
    • Follow-up tasks
每个会话会记录以下内容:
  1. 元数据
    • 日期和时长
    • 上下文/工作目录
    • 主题
  2. 摘要
    • 完成的工作内容
    • 做出的关键决策
    • 创建/修改的文件
  3. 已执行操作
    • 已完成任务清单
    • 待跟进事项
  4. 技术笔记
    • 重要代码片段
    • 使用的命令
    • 找到的解决方案
  5. 待解决问题
    • 需要回顾的问题
    • 后续任务

Session Template

Session Template

markdown
undefined
markdown
undefined

Session: {Topic}

Session: {Topic}

Date: {YYYY-MM-DD} Duration: {approximate} Context: {project/directory}
Date: {YYYY-MM-DD} Duration: {approximate} Context: {project/directory}

Summary

Summary

{What was accomplished in this session}
{What was accomplished in this session}

Key Decisions

Key Decisions

  1. {Decision 1}
  2. {Decision 2}
  1. {Decision 1}
  2. {Decision 2}

Actions Taken

Actions Taken

  • {Completed action 1}
  • {Completed action 2}
  • {Pending action 3}
  • {Completed action 1}
  • {Completed action 2}
  • {Pending action 3}

Technical Notes

Technical Notes

{Important technical details}
{Important technical details}

Open Questions / Follow-ups

Open Questions / Follow-ups

  • {Question 1}
  • {Question 2}
  • {Question 1}
  • {Question 2}

Related Files

Related Files

  • {file-path}
    - {what changed}
undefined
  • {file-path}
    - {what changed}
undefined

How to Use

使用方法

Option 1: Automatic Logging

选项1:自动记录

Simply say:
"保存对话信息"
The skill will:
  1. Review the conversation history
  2. Extract key information
  3. Create/update the session file
只需说出:
"保存对话信息"
该技能会:
  1. 回顾会话历史
  2. 提取关键信息
  3. 创建/更新会话文件

Option 2: With Topic

选项2:指定主题

Specify the session topic:
"保存对话,主题是 skill-router 创建"
指定会话主题:
"保存对话,主题是 skill-router 创建"

Option 3: Manual Prompt

选项3:手动提示

If auto-extraction misses something, provide details:
"保存对话,重点是:1) 创建了 skill-router,2) 修复了 front matter"
如果自动提取遗漏了内容,可以提供详细信息:
"保存对话,重点是:1) 创建了 skill-router,2) 修复了 front matter"

File Naming

文件命名规则

InputFilename
"保存对话"
YYYY-MM-DD-session.md
"保存对话,主题是 prd"
YYYY-MM-DD-prd.md
"保存今天的讨论"
YYYY-MM-DD-discussion.md
输入内容文件名
"保存对话"
YYYY-MM-DD-session.md
"保存对话,主题是 prd"
YYYY-MM-DD-prd.md
"保存今天的讨论"
YYYY-MM-DD-discussion.md

Session Log Structure

会话日志结构

sessions/
├── README.md                      # This file
├── 2025-01-11-skill-router.md     # Session about skill-router
├── 2025-01-11-prd-planner.md      # Session about PRD planner
└── 2025-01-12-refactoring.md      # Session about refactoring
sessions/
├── README.md                      # This file
├── 2025-01-11-skill-router.md     # Session about skill-router
├── 2025-01-11-prd-planner.md      # Session about PRD planner
└── 2025-01-12-refactoring.md      # Session about refactoring

Privacy Note

隐私说明

Session logs are stored in
sessions/
which is in
.gitignore
.
  • Logs are NOT committed to git
  • Logs contain your actual conversation
  • Safe to include sensitive information
会话日志存储在已添加到
.gitignore
sessions/
目录中:
  • 日志不会提交至git
  • 日志包含实际会话内容
  • 可安全存储敏感信息

Quick Reference

快速参考

You saySkill does
"保存对话信息"Creates session log with today's date
"保存今天的对话"Creates session log
"保存session"Creates session log
"记录会话"Creates session log
用户指令技能操作
"保存对话信息"创建带当日日期的会话日志
"保存今天的对话"创建会话日志
"保存session"创建会话日志
"记录会话"创建会话日志

Best Practices

最佳实践

  1. Save at key milestones: After completing a feature, fixing a bug, etc.
  2. Be specific with topics: Helps when searching later
  3. Include code snippets: Save important solutions
  4. Track decisions: Why did you choose X over Y?
  5. List pending items: What to do next time
  1. 关键节点保存:完成功能开发、修复bug等节点后保存
  2. 明确主题:便于后续搜索
  3. 包含代码片段:保存重要解决方案
  4. 记录决策过程:说明选择方案的原因
  5. 列出待办事项:记录下次需完成的任务

Rich Content Extraction (for Self-Improving Agent)

富内容提取(用于自改进Agent)

When triggered by other skills via hooks, session-logger extracts structured data for learning:
当被其他技能通过钩子触发时,session-logger会提取结构化数据用于学习:

Skill Context Capture

技能上下文捕获

When a skill completes, capture:
markdown
undefined
当某个技能完成时,捕获以下内容:
markdown
undefined

Skill Execution Context

Skill Execution Context

Skill: {skill-name} Trigger: {user-invoked | hook-triggered | auto-triggered} Status: {completed | error | partial} Duration: {approximate time}
Skill: {skill-name} Trigger: {user-invoked | hook-triggered | auto-triggered} Status: {completed | error | partial} Duration: {approximate time}

Input Context

Input Context

  • User request: {original request}
  • Files involved: {list of files}
  • Codebase patterns detected: {patterns}
  • User request: {original request}
  • Files involved: {list of files}
  • Codebase patterns detected: {patterns}

Output Summary

Output Summary

  • Actions taken: {list}
  • Files modified: {list with changes}
  • Decisions made: {key decisions}
  • Actions taken: {list}
  • Files modified: {list with changes}
  • Decisions made: {key decisions}

Learning Signals

Learning Signals

  • What worked well: {successes}
  • What could improve: {areas for improvement}
  • Patterns discovered: {new patterns}
  • Errors encountered: {errors and resolutions}
undefined
  • What worked well: {successes}
  • What could improve: {areas for improvement}
  • Patterns discovered: {new patterns}
  • Errors encountered: {errors and resolutions}
undefined

Error Context Capture

错误上下文捕获

When a skill encounters errors:
markdown
undefined
当技能遇到错误时:
markdown
undefined

Error Context

Error Context

Error Type: {type} Error Message: {message} Stack Trace: {if available}
Error Type: {type} Error Message: {message} Stack Trace: {if available}

Resolution Attempted

Resolution Attempted

  • Approach: {what was tried}
  • Result: {success/failure}
  • Root cause: {if identified}
  • Approach: {what was tried}
  • Result: {success/failure}
  • Root cause: {if identified}

Prevention Notes

Prevention Notes

  • How to avoid: {prevention strategy}
  • Related patterns: {similar issues}
undefined
  • How to avoid: {prevention strategy}
  • Related patterns: {similar issues}
undefined

Pattern Extraction

模式提取

Extract reusable patterns for the self-improving-agent:
markdown
undefined
为自改进Agent提取可复用模式:
markdown
undefined

Extracted Patterns

Extracted Patterns

Code Patterns

Code Patterns

  • Pattern name: {name}
  • Context: {when to use}
  • Example: {code snippet}
  • Pattern name: {name}
  • Context: {when to use}
  • Example: {code snippet}

Workflow Patterns

Workflow Patterns

  • Trigger: {what initiates}
  • Steps: {sequence}
  • Outcome: {expected result}
  • Trigger: {what initiates}
  • Steps: {sequence}
  • Outcome: {expected result}

Anti-Patterns

Anti-Patterns

  • Pattern: {what to avoid}
  • Why: {reason}
  • Alternative: {better approach}
undefined
  • Pattern: {what to avoid}
  • Why: {reason}
  • Alternative: {better approach}
undefined

Structured Data Format

结构化数据格式

For machine-readable extraction, use YAML front matter in session logs:
yaml
---
session_type: skill_execution
skill_name: code-reviewer
trigger_source: hook
status: completed
files_modified:
  - path: src/utils.ts
    changes: refactored error handling
patterns_learned:
  - name: error-boundary-pattern
    category: error-handling
    confidence: high
errors_encountered: []
learning_signals:
  successes:
    - "Identified code smell in utils.ts"
  improvements:
    - "Could have suggested more specific refactoring"
---
为便于机器读取提取,在会话日志中使用YAML前置元数据:
yaml
---
session_type: skill_execution
skill_name: code-reviewer
trigger_source: hook
status: completed
files_modified:
  - path: src/utils.ts
    changes: refactored error handling
patterns_learned:
  - name: error-boundary-pattern
    category: error-handling
    confidence: high
errors_encountered: []
learning_signals:
  successes:
    - "Identified code smell in utils.ts"
  improvements:
    - "Could have suggested more specific refactoring"
---

Integration with Self-Improving Agent

与自改进Agent的集成

When triggered by
self-improving-agent
:
  1. Extract episodic memory: Capture the full context of what happened
  2. Identify semantic patterns: Tag reusable knowledge
  3. Update working memory: Note immediate follow-ups needed
  4. Signal completion: Write trigger file if skill chaining is needed
当被
self-improving-agent
触发时:
  1. 提取情景记忆:捕获事件发生的完整上下文
  2. 识别语义模式:标记可复用知识
  3. 更新工作记忆:记录需立即跟进的事项
  4. 发送完成信号:若需技能链式调用则写入触发文件

Auto-Trigger Behavior

自动触发行为

When invoked via hooks with
mode: auto
:
  • Silently create/update session log
  • Extract structured data without user interaction
  • Append to existing session if same day/topic
  • Create new session if context differs significantly
当通过钩子以
mode: auto
模式调用时:
  • 静默创建/更新会话日志
  • 无需用户交互即可提取结构化数据
  • 若为同一天/同一主题则追加至现有会话
  • 若上下文差异较大则创建新会话