---
schema: "1.0"
name: creative-memory
version: "1.0.0"
description: Creative project memory management system — Three-tier memory architecture / Knowledge base maintenance / Summary generation
domain: creative
triggers:
  keywords:
    primary: [creative-memory, memory, knowledge-base, recall]
    secondary: [update, summarize, query]
  context_boost: [memory, knowledge, recall, context]
  context_penalty: [code, api, database]
  priority: medium
dependencies:
  software-skills: []
author: ai-novel-system
---

# Creative Memory Management Skill

## Overview

Manages a three-tier memory architecture for creative projects, ensuring consistency and continuity across long-form creative work.

## Role

You are the memory management system for creative projects. Your purpose is to:

1. Maintain a three-tier memory architecture (short-term, mid-term, long-term)
2. Provide fast retrieval of project knowledge and context
3. Generate periodic summaries to compress information
4. Keep knowledge base organized and up-to-date
5. Track consistency across the creative work

You do NOT generate creative content directly. You support the creative process by managing context and knowledge.

## Prerequisites (Domain Loading)

Before executing any memory operations, you MUST follow this initialization sequence:

1. **Read project config**: Read `.creative/config.yaml` to get the `domain` value
2. **Validate initialization**: If config doesn't exist, prompt user to run `/creative-init`
3. **Determine PLUGIN_ROOT**: Based on the Skill header's `Base directory`:
   - PLUGIN_ROOT = Base directory with `/skills/creative-memory` removed
   - Example: `/Users/user/.claude/skill-cache/novel/skills/creative-memory` → `/Users/user/.claude/skill-cache/novel`
4. **Set DOMAIN_DIR**: `$PLUGIN_ROOT/shared/domains/{domain}/`
5. **Load domain configuration**: Read `$DOMAIN_DIR/domain.yaml` to get memory configuration and paths
6. **Load domain guide**: Read `$DOMAIN_DIR/memory-guide.md` to get domain-specific memory strategies, formats, and templates
7. **Execute**: Follow the domain guide's specifications for all memory operations

## Three-Tier Memory System

### 1. Short-Term Memory

**Purpose**: Recent context for immediate reference
**Maintenance**: Automatic updates during content generation
**Retention**: Configurable (typically last 10-20 units)
**Format**: Defined by domain guide

### 2. Mid-Term Memory

**Purpose**: Periodic summaries that bridge between sessions
**Maintenance**: Generated automatically or on demand
**Retention**: All summaries kept permanently
**Format**: Defined by domain guide

### 3. Long-Term Memory

**Purpose**: Persistent knowledge base of core project elements
**Maintenance**: Manual updates, curated over time
**Retention**: Permanent, archived when obsolete
**Format**: Defined by domain guide

## Core Functions

### 1. Query Memory (`/creative-memory query [keyword]`)

**Purpose**: Fast retrieval of knowledge base information

**Usage**:
```
/creative-memory query [keyword or phrase]
```

**Execution Flow**:
1. Load domain configuration
2. Use Grep to search memory directories (paths from domain config)
3. Return matching passages with source files
4. Sort results by relevance
5. Display context (configurable lines before/after)
6. Format output according to domain guide

**Output**: Formatted according to domain guide specifications

### 2. Generate Summary (`/creative-memory summarize`)

**Purpose**: Generate structured summary of recent work

**Execution Flow**:
1. Load domain configuration and guide
2. Determine summary scope (from domain config)
3. Read recent content units
4. Analyze using domain-specific criteria
5. Generate structured summary (format from domain guide)
6. Write to mid-term memory location
7. Update summary index if configured

**AI Prompting**: Use templates from domain guide

### 3. Update Knowledge (`/creative-memory update [type] [name]`)

**Purpose**: Update existing knowledge base entries based on recent work

**Execution Flow**:
1. Load domain guide for supported types
2. Read existing knowledge file
3. Read short-term memory for relevant context
4. Analyze changes using domain-specific checklist
5. Update metadata (timestamps, status)
6. Append new information to appropriate sections
7. Write back to file
8. Verify YAML frontmatter validity

**Validation**: Use update checklists from domain guide

### 4. Add Knowledge (`/creative-memory add [type] [name]`)

**Purpose**: Create new knowledge base entries from templates

**Execution Flow**:
1. Load domain guide for supported types
2. Validate type is supported
3. Select appropriate template
4. Generate file with YAML frontmatter and structure
5. Write to knowledge base (path from domain config)
6. Display file path for user editing
7. Optionally open in editor

**Templates**: Provided by domain guide

### 5. Memory Statistics (`/creative-memory stats`)

**Purpose**: View knowledge base usage and health metrics

**Execution Flow**:
1. Load domain configuration
2. Scan all three memory tiers
3. Count files, calculate sizes
4. Check update timestamps
5. Identify maintenance issues
6. Generate health report
7. Display statistics

**Output Format**: Defined by domain guide

## Workflow Integration

This skill is designed to work alongside other creative skills:

- **Initialization skills**: Provide initial knowledge base structure
- **Content generation skills**: Consume memory for context, update short-term memory after generation
- **Quality check skills**: Validate consistency against knowledge base

Refer to domain guide for specific integration patterns.

## Error Handling

### Domain Not Loaded
- Verify `.creative/config.yaml` exists
- Check `domain` field is set
- Confirm domain guide exists at expected path

### Knowledge File Issues
- Validate YAML frontmatter syntax
- Check file permissions
- Ensure directory structure matches config

### Search Results Issues
- Adjust keyword specificity
- Use regex patterns for complex queries
- Check search paths in domain config

## Best Practices

### Memory Maintenance Rhythm
Follow the maintenance schedule defined in domain guide.

### Knowledge Organization
- **Single source of truth**: Each fact defined in one canonical place
- **Cross-referencing**: Use metadata fields to link related items
- **Status tracking**: Mark items as active/archived/deprecated
- **Version control**: Update timestamps on significant changes

### Query Efficiency
- Use structured metadata for categorical searches
- Tag items consistently
- Avoid overly complex nested structures

### Summary Quality
- Focus on changes, not repetition
- Maintain objective tone
- Record causal relationships
- Track unresolved issues

## Advanced Usage

Consult the domain-specific guide for:
- Detailed format specifications
- Domain-specific templates
- Custom metadata schemas
- Integration patterns
- Troubleshooting guides

---

**Version**: 1.0.0
**Last Updated**: 2026-02-07
**Author**: ai-novel-system
