context-management-context-save

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Context Save Tool: Intelligent Context Management Specialist

Context Save Tool:智能上下文管理专家

Use this skill when

适用场景

  • Working on context save tool: intelligent context management specialist tasks or workflows
  • Needing guidance, best practices, or checklists for context save tool: intelligent context management specialist
  • 处理Context Save Tool:智能上下文管理专家相关任务或工作流时
  • 需要Context Save Tool:智能上下文管理专家的指导、最佳实践或检查清单时

Do not use this skill when

不适用场景

  • The task is unrelated to context save tool: intelligent context management specialist
  • You need a different domain or tool outside this scope
  • 任务与Context Save Tool:智能上下文管理专家无关时
  • 需要该范围之外的其他领域或工具时

Instructions

操作说明

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.
  • If detailed examples are required, open
    resources/implementation-playbook.md
    .
  • 明确目标、约束条件和所需输入。
  • 应用相关最佳实践并验证结果。
  • 提供可执行步骤和验证方法。
  • 如需详细示例,请打开
    resources/implementation-playbook.md

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.
作为精英上下文工程专家,专注于在AI工作流中实现全面、语义化且动态适配的上下文保存。该工具统筹高级上下文捕获、序列化与检索策略,以维护机构知识并实现无缝的多会话协作。

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
Context Save Tool是一款复杂的上下文工程解决方案,旨在:
  • 捕获全面的项目状态与知识
  • 实现语义化上下文检索
  • 支持多Agent工作流协调
  • 保留架构决策与项目演进轨迹
  • 促进智能知识转移

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
  • $PROJECT_ROOT
    :项目根目录的绝对路径
  • $CONTEXT_TYPE
    :上下文捕获的粒度(minimal、standard、comprehensive)
  • $STORAGE_FORMAT
    :首选存储格式(json、markdown、vector)
  • $TAGS
    :用于上下文分类的可选语义标签

Context Extraction Strategies

上下文提取策略

1. Semantic Information Identification

1. 语义信息识别

  • Extract high-level architectural patterns
  • Capture decision-making rationales
  • Identify cross-cutting concerns and dependencies
  • Map implicit knowledge structures
  • 提取高层架构模式
  • 捕获决策背后的推理逻辑
  • 识别横切关注点与依赖关系
  • 映射隐性知识结构

2. State Serialization Patterns

2. 状态序列化模式

  • Use JSON Schema for structured representation
  • Support nested, hierarchical context models
  • Implement type-safe serialization
  • Enable lossless context reconstruction
  • 使用JSON Schema进行结构化表示
  • 支持嵌套、分层上下文模型
  • 实现类型安全的序列化
  • 支持无损上下文重构

3. Multi-Session Context Management

3. 多会话上下文管理

  • Generate unique context fingerprints
  • Support version control for context artifacts
  • Implement context drift detection
  • Create semantic diff capabilities
  • 生成唯一的上下文指纹
  • 支持上下文工件的版本控制
  • 实现上下文漂移检测
  • 提供语义差异对比功能

4. Context Compression Techniques

4. 上下文压缩技术

  • Use advanced compression algorithms
  • Support lossy and lossless compression modes
  • Implement semantic token reduction
  • Optimize storage efficiency
  • 使用高级压缩算法
  • 支持有损与无损压缩模式
  • 实现语义令牌精简
  • 优化存储效率

5. Vector Database Integration

5. 向量数据库集成

Supported Vector Databases:
  • Pinecone
  • Weaviate
  • Qdrant
Integration Features:
  • Semantic embedding generation
  • Vector index construction
  • Similarity-based context retrieval
  • Multi-dimensional knowledge mapping
支持的向量数据库:
  • Pinecone
  • Weaviate
  • Qdrant
集成特性:
  • 语义嵌入生成
  • 向量索引构建
  • 基于相似度的上下文检索
  • 多维知识映射

6. Knowledge Graph Construction

6. 知识图谱构建

  • Extract relational metadata
  • Create ontological representations
  • Support cross-domain knowledge linking
  • Enable inference-based context expansion
  • 提取关系型元数据
  • 创建本体论表示
  • 支持跨领域知识关联
  • 实现基于推理的上下文扩展

7. Storage Format Selection

7. 存储格式选择

Supported Formats:
  • Structured JSON
  • Markdown with frontmatter
  • Protocol Buffers
  • MessagePack
  • YAML with semantic annotations
支持的格式:
  • 结构化JSON
  • 带前置元数据的Markdown
  • Protocol Buffers
  • MessagePack
  • 带语义注释的YAML

Code Examples

代码示例

1. Context Extraction

1. 上下文提取

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
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

2. 状态序列化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"}
        }
      }
    }
  }
}
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

3. 上下文压缩算法

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)
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:项目入职上下文捕获

  1. Analyze project structure
  2. Extract architectural decisions
  3. Generate semantic embeddings
  4. Store in vector database
  5. Create markdown summary
  1. 分析项目结构
  2. 提取架构决策
  3. 生成语义嵌入
  4. 存储至向量数据库
  5. 创建Markdown摘要

Workflow 2: Long-Running Session Context Management

工作流2:长会话上下文管理

  1. Periodically capture context snapshots
  2. Detect significant architectural changes
  3. Version and archive context
  4. Enable selective context restoration
  1. 定期捕获上下文快照
  2. 检测重大架构变更
  3. 为上下文打版本并归档
  4. 支持选择性上下文恢复

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
  • 改进基于ML的上下文压缩
  • 增强跨领域知识转移
  • 实时协作式上下文编辑
  • 预测性上下文推荐系统