js-skills-sh

conversation-memory

0
0
# Install this skill:
npx skills add js-skills-sh/conversation-memory-skill --skill "conversation-memory"

Install specific skill from multi-skill repository

# Description

>

# SKILL.md


name: conversation-memory
description: >
Conversation memory management. Triggered when the user says "save memory", "remember this conversation", "save it", "save conversation", "find previous discussion", "view history", "show previous memories".


Conversation Memory Skill

Save conversation context as recallable memory files, enabling persistence and automatic recall of conversations.

Active Memories

See ../../data/conversation-memory/memories/index.md for the active memory collection.

Note: Memory data is stored in the .claude/data/conversation-memory/ directory, separate from the skill code.

Trigger Scenarios

Save Memory

Triggered when the user says:

  • "Save memory"
  • "Remember this conversation"
  • "Save it"
  • "Save conversation"
  • "Save context"

Save Process (Important)

When saving a memory, you must first generate the title and summary, then call the save command:

Step 1: Generate Title and Summary

Analyze the current conversation and generate complete summary content:

  • Title: Concise topic of the conversation (will be displayed in the index)
  • Summary: Complete conversation summary, should include:
  • Conversation background and main issues
  • Core content discussed
  • Key decisions and conclusions
  • Important technical details or code changes

Step 2: Write Summary File

Write the title and summary to a temporary file, format requirements:

# Title Content

Complete summary text (including main content, key decisions, important conclusions, etc.)

File path: .claude/data/conversation-memory/temp/summary.md

Summary File Example:

# Memory Index Timing Issue Fix

This conversation discussed the timing issue where memory index content was blank during save.

## Main Content

1. Analyzed the root cause: placeholder summary written first, then index rebuilt
2. Determined the improvement plan: generate summary first, then save in one step
3. Modified related code: save_memory.js, MemoryService, MemoryManager

## Key Decisions

- Use --summary-file to pass summary, avoiding command-line escaping issues
- First line of summary file serves as title, subsequent content as complete summary
- Summary is required to ensure index content is always complete

## Important Conclusions

- Changed save memory flow to "generate summary first, then save"
- Index automatically rebuilds, new memories appear at the top

Step 3: Call Save Command

node scripts/save_memory.js --summary-file ../../data/conversation-memory/temp/summary.md

Notes:
- First line of summary file must be the title (starting with #)
- Title will be displayed in the index, formatted as [mem-xxx] Title
- Temporary summary file can be deleted after successful save

View History

Triggered when the user says:

  • "View previous conversation"
  • "Find last discussion"
  • "Restore memory mem-xxx"
  • "Show history"

Saved Content

System saves to .claude/data/conversation-memory/memories/active/mem-{timestamp}/:

mem-{timestamp}/
β”œβ”€β”€ summary.md      # Conversation summary (title + metadata + full summary)
β”œβ”€β”€ conversation.md # Complete original conversation record (readable format)
└── messages.json   # Raw message data (for viewing history)

summary.md Structure:

# Conversation Memory: Title

## Metadata

- **Time**: 2026-01-18 19:00:00
- **Duration**: ~5 minutes
- **Conversation Rounds**: 10 rounds
- **Keywords**: keyword1, keyword2
- **conversationId**: conv-xxx
- **sessionId**: xxx...

## Summary

(User-provided complete summary content, including main content, key decisions, important conclusions, etc.)

## Source

For full original conversation, see [conversation.md](conversation.md)

Index Structure (index.md):

Index file contains directory and all memory summaries, with newest memories at the top:

# Conversation Memory Index

## Directory

- [mem-20260118-190000] Memory Index Timing Issue Fix
- [mem-20260118-180000] Project Architecture Discussion

---

## mem-20260118-190000

(Complete summary.md content)

Recall Mechanism

When user says "find previous discussion about xxx":

node scripts/activate_memory.js --search <keyword>

View History Process

When user requests to view history:

List viewable memories:

node scripts/restore_memory.js --list       # List active memories
node scripts/restore_memory.js --list-all   # Include archived memories

The list shows each memory's conversationId (if available), with fragment count noted for multiple fragments from the same conversation.

View specific memory fragment:

node scripts/restore_memory.js <memory-id>

View complete conversation:

The same conversation round may be saved multiple times as multiple memory fragments. Use the --conversation option to merge and view:

node scripts/restore_memory.js --conversation <conversation-id>

Example:

node scripts/restore_memory.js --conversation conv-20260118-160000

Activation Mechanism

When an archived memory is recalled, it needs to be activated:

node scripts/activate_memory.js <memory-name>

Activation operation (requires app running):

  • Moves memory from memories/archive/ back to memories/active/

Archive Mechanism

Automatic Archive Rules

  • Memories inactive for more than 14 days will be archived
  • Keep active/ count <= 20
  • When total tokens exceed limit, archive oldest memories

Execute Archive

node scripts/archive_old_memories.js

After archiving, the index is automatically updated via backend API.

Storage Locations

Skill code and data are stored separately:

.claude/
β”œβ”€β”€ skills/conversation-memory/    # Skill code (this directory)
β”‚   β”œβ”€β”€ SKILL.md                   # This file (skill definition)
β”‚   β”œβ”€β”€ scripts/                   # Management scripts (require app running)
β”‚   β”‚   β”œβ”€β”€ paths.js               # Path resolution utility
β”‚   β”‚   β”œβ”€β”€ save_memory.js         # Save memory (requires summary)
β”‚   β”‚   β”œβ”€β”€ activate_memory.js     # Activate/search memory
β”‚   β”‚   β”œβ”€β”€ restore_memory.js      # View history
β”‚   β”‚   β”œβ”€β”€ archive_old_memories.js # Archive memories
β”‚   β”‚   └── update_index.js        # Update index (calls backend API)
β”‚   └── references/                # Template files
β”‚       β”œβ”€β”€ summary_template.md
β”‚       └── conversation_template.md
β”‚
└── data/conversation-memory/      # Data directory (separate from skill)
    β”œβ”€β”€ temp/                      # Temporary file directory (for summary)
    β”‚   └── summary.md             # Temporary summary file
    └── memories/                  # Memory storage
        β”œβ”€β”€ index.md               # Active memory summary collection
        β”œβ”€β”€ active/                # Active memories
        β”‚   └── mem-xxx/
        β”‚       β”œβ”€β”€ summary.md
        β”‚       β”œβ”€β”€ conversation.md
        β”‚       └── messages.json
        └── archive/               # Archived memories

Notes

  • Title and summary are required: First line of summary file must be title (starting with #), title will be displayed in index
  • Index auto-updates: Index automatically rebuilds after successful save, new memories at the top
  • Scripts require app: Scripts in scripts/ directory require DeepSeek Cowork app to be running
  • View compatibility: Only newly saved memories (containing messages.json) support viewing complete messages
  • Temporary files: Temporary temp/summary.md file can be deleted after successful save

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.