context-save — команда для Claude Code: сохраняет контекст проекта между сессиями
Слэш-команда записывает состояние проекта и принятые решения, чтобы следующая сессия агента начиналась не с нуля.
/plugin marketplace add wshobson/agents
/plugin install context-management@claude-code-workflowsЧто делает context-save
Команда собирает снимок проекта: структуру, архитектурные решения с обоснованием, граф зависимостей и смысловые теги. Результат складывается в файл, который агент потом читает при возвращении к работе.
Параметры задаются на входе: корень проекта, глубина захвата (minimal, standard, comprehensive), формат хранения (json, markdown, vector) и теги. Хранение в векторе рассчитано на Pinecone, Weaviate или Qdrant, но это отдельная настройка и без неё обойтись можно. Есть оговорка прямо в описании: чувствительные данные придётся исключать вручную, а сам захват отнимает вычислительное время.
Ставится через маркетплейс wshobson/agents как часть набора context-management. Снимки получаются версионируемыми, поэтому сравнивать контекст между сессиями и ловить дрейф проекта можно без сторонних утилит.
Какие задачи решает
- зафиксировать архитектурное решение вместе с причиной, по которой его приняли
- вернуться к проекту через неделю и быстро восстановить ход работы
- передать состояние дел другому агенту или человеку
- сравнить контекст до и после крупного рефакторинга
- сжать накопленные заметки о проекте до читаемого файла
Примеры запросов агенту
- Сохрани контекст проекта в
.context/state.md, глубина standard - Сделай снимок текущего состояния с тегами
authиrefactor - Сохрани решения по архитектуре за сегодня в формате markdown
Как установить context-save
1Через маркетплейс плагинов
/plugin marketplace add wshobson/agents/plugin install context-management@claude-code-workflows2Вручную: положить файлы
.claude/commands/context-save.mdВызов — /context-save. Для всех проектов — ~/.claude/commands/
Вручную: положить файлы
~/.codex/prompts/context-save.mdВызов — /prompts:context-save. В Codex этот формат помечен устаревшим, замена — скиллы
Вручную: положить файлы
.github/prompts/context-save.prompt.mdВручную: положить файлы
.gemini/commands/context-save.tomlGemini хранит команды в TOML: текст запроса — в поле prompt
Вопросы о context-save
Как установить context-save в Claude Code?
Сначала подключите маркетплейс: /plugin marketplace add wshobson/agents, затем установите плагин: /plugin install context-management@claude-code-workflows. Команда появится в .claude/commands/context-save.md.
Что делает context-save?
Собирает состояние проекта: структуру, архитектурные решения с обоснованием, зависимости и теги. Записывает всё в файл, который агент подхватывает в следующей сессии.
Какие форматы хранения поддерживаются?
Структурированный JSON, markdown с frontmatter, Protocol Buffers, MessagePack и YAML с аннотациями. Векторный вариант требует внешней базы вроде Pinecone, Weaviate или Qdrant.
Исходный текст
context-save.md · MIT
---
description: Save project context, decisions, and progress for a later session
---
# Context Save Tool: Intelligent Context Management Specialist
## Role and Purpose
An elite context engineering specialist focused on comprehensive, semantic, and dynamically adaptable context preservation across AI workflows. This tool orchestrates advanced context capture, serialization, and retrieval strategies to maintain institutional knowledge and enable seamless multi-session collaboration.
## Context Management Overview
The Context Save Tool is a sophisticated context engineering solution designed to:
- Capture comprehensive project state and knowledge
- Enable semantic context retrieval
- Support multi-agent workflow coordination
- Preserve architectural decisions and project evolution
- Facilitate intelligent knowledge transfer
## Requirements and Argument Handling
### Input Parameters
- `$PROJECT_ROOT`: Absolute path to project root
- `$CONTEXT_TYPE`: Granularity of context capture (minimal, standard, comprehensive)
- `$STORAGE_FORMAT`: Preferred storage format (json, markdown, vector)
- `$TAGS`: Optional semantic tags for context categorization
## Context Extraction Strategies
### 1. Semantic Information Identification
- Extract high-level architectural patterns
- Capture decision-making rationales
- Identify cross-cutting concerns and dependencies
- Map implicit knowledge structures
### 2. State Serialization Patterns
- Use JSON Schema for structured representation
- Support nested, hierarchical context models
- Implement type-safe serialization
- Enable lossless context reconstruction
### 3. Multi-Session Context Management
- Generate unique context fingerprints
- Support version control for context artifacts
- Implement context drift detection
- Create semantic diff capabilities
### 4. Context Compression Techniques
- Use advanced compression algorithms
- Support lossy and lossless compression modes
- Implement semantic token reduction
- Optimize storage efficiency
### 5. Vector Database Integration
Supported Vector Databases:
- Pinecone
- Weaviate
- Qdrant
Integration Features:
- Semantic embedding generation
- Vector index construction
- Similarity-based context retrieval
- Multi-dimensional knowledge mapping
### 6. Knowledge Graph Construction
- Extract relational metadata
- Create ontological representations
- Support cross-domain knowledge linking
- Enable inference-based context expansion
### 7. Storage Format Selection
Supported Formats:
- Structured JSON
- Markdown with frontmatter
- Protocol Buffers
- MessagePack
- YAML with semantic annotations
## Code Examples
### 1. Context Extraction
```python
def extract_project_context(project_root, context_type='standard'):
context = {
'project_metadata': extract_project_metadata(project_root),
'architectural_decisions': analyze_architecture(project_root),
'dependency_graph': build_dependency_graph(project_root),
'semantic_tags': generate_semantic_tags(project_root)
}
return context
```
### 2. State Serialization Schema
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"project_name": { "type": "string" },
"version": { "type": "string" },
"context_fingerprint": { "type": "string" },
"captured_at": { "type": "string", "format": "date-time" },
"architectural_decisions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"decision_type": { "type": "string" },
"rationale": { "type": "string" },
"impact_score": { "type": "number" }
}
}
}
}
}
```
### 3. Context Compression Algorithm
```python
def compress_context(context, compression_level='standard'):
strategies = {
'minimal': remove_redundant_tokens,
'standard': semantic_compression,
'comprehensive': advanced_vector_compression
}
compressor = strategies.get(compression_level, semantic_compression)
return compressor(context)
```
## Reference Workflows
### Workflow 1: Project Onboarding Context Capture
1. Analyze project structure
2. Extract architectural decisions
3. Generate semantic embeddings
4. Store in vector database
5. Create markdown summary
### Workflow 2: Long-Running Session Context Management
1. Periodically capture context snapshots
2. Detect significant architectural changes
3. Version and archive context
4. Enable selective context restoration
## Advanced Integration Capabilities
- Real-time context synchronization
- Cross-platform context portability
- Compliance with enterprise knowledge management standards
- Support for multi-modal context representation
## Limitations and Considerations
- Sensitive information must be explicitly excluded
- Context capture has computational overhead
- Requires careful configuration for optimal performance
## Future Roadmap
- Improved ML-driven context compression
- Enhanced cross-domain knowledge transfer
- Real-time collaborative context editing
- Predictive context recommendation systems
© Seth Hobson · MIT · wshobson/agents