Use when working with context management context restore
Add this skill
npx mdskills install sickn33/context-management-context-restoreComprehensive framework for semantic context restoration with detailed retrieval strategies and patterns
1---2name: context-management-context-restore3description: "Use when working with context management context restore"4---56# Context Restoration: Advanced Semantic Memory Rehydration78## Use this skill when910- Working on context restoration: advanced semantic memory rehydration tasks or workflows11- Needing guidance, best practices, or checklists for context restoration: advanced semantic memory rehydration1213## Do not use this skill when1415- The task is unrelated to context restoration: advanced semantic memory rehydration16- You need a different domain or tool outside this scope1718## Instructions1920- Clarify goals, constraints, and required inputs.21- Apply relevant best practices and validate outcomes.22- Provide actionable steps and verification.23- If detailed examples are required, open `resources/implementation-playbook.md`.2425## Role Statement2627Expert Context Restoration Specialist focused on intelligent, semantic-aware context retrieval and reconstruction across complex multi-agent AI workflows. Specializes in preserving and reconstructing project knowledge with high fidelity and minimal information loss.2829## Context Overview3031The Context Restoration tool is a sophisticated memory management system designed to:32- Recover and reconstruct project context across distributed AI workflows33- Enable seamless continuity in complex, long-running projects34- Provide intelligent, semantically-aware context rehydration35- Maintain historical knowledge integrity and decision traceability3637## Core Requirements and Arguments3839### Input Parameters40- `context_source`: Primary context storage location (vector database, file system)41- `project_identifier`: Unique project namespace42- `restoration_mode`:43 - `full`: Complete context restoration44 - `incremental`: Partial context update45 - `diff`: Compare and merge context versions46- `token_budget`: Maximum context tokens to restore (default: 8192)47- `relevance_threshold`: Semantic similarity cutoff for context components (default: 0.75)4849## Advanced Context Retrieval Strategies5051### 1. Semantic Vector Search52- Utilize multi-dimensional embedding models for context retrieval53- Employ cosine similarity and vector clustering techniques54- Support multi-modal embedding (text, code, architectural diagrams)5556```python57def semantic_context_retrieve(project_id, query_vector, top_k=5):58 """Semantically retrieve most relevant context vectors"""59 vector_db = VectorDatabase(project_id)60 matching_contexts = vector_db.search(61 query_vector,62 similarity_threshold=0.75,63 max_results=top_k64 )65 return rank_and_filter_contexts(matching_contexts)66```6768### 2. Relevance Filtering and Ranking69- Implement multi-stage relevance scoring70- Consider temporal decay, semantic similarity, and historical impact71- Dynamic weighting of context components7273```python74def rank_context_components(contexts, current_state):75 """Rank context components based on multiple relevance signals"""76 ranked_contexts = []77 for context in contexts:78 relevance_score = calculate_composite_score(79 semantic_similarity=context.semantic_score,80 temporal_relevance=context.age_factor,81 historical_impact=context.decision_weight82 )83 ranked_contexts.append((context, relevance_score))8485 return sorted(ranked_contexts, key=lambda x: x[1], reverse=True)86```8788### 3. Context Rehydration Patterns89- Implement incremental context loading90- Support partial and full context reconstruction91- Manage token budgets dynamically9293```python94def rehydrate_context(project_context, token_budget=8192):95 """Intelligent context rehydration with token budget management"""96 context_components = [97 'project_overview',98 'architectural_decisions',99 'technology_stack',100 'recent_agent_work',101 'known_issues'102 ]103104 prioritized_components = prioritize_components(context_components)105 restored_context = {}106107 current_tokens = 0108 for component in prioritized_components:109 component_tokens = estimate_tokens(component)110 if current_tokens + component_tokens <= token_budget:111 restored_context[component] = load_component(component)112 current_tokens += component_tokens113114 return restored_context115```116117### 4. Session State Reconstruction118- Reconstruct agent workflow state119- Preserve decision trails and reasoning contexts120- Support multi-agent collaboration history121122### 5. Context Merging and Conflict Resolution123- Implement three-way merge strategies124- Detect and resolve semantic conflicts125- Maintain provenance and decision traceability126127### 6. Incremental Context Loading128- Support lazy loading of context components129- Implement context streaming for large projects130- Enable dynamic context expansion131132### 7. Context Validation and Integrity Checks133- Cryptographic context signatures134- Semantic consistency verification135- Version compatibility checks136137### 8. Performance Optimization138- Implement efficient caching mechanisms139- Use probabilistic data structures for context indexing140- Optimize vector search algorithms141142## Reference Workflows143144### Workflow 1: Project Resumption1451. Retrieve most recent project context1462. Validate context against current codebase1473. Selectively restore relevant components1484. Generate resumption summary149150### Workflow 2: Cross-Project Knowledge Transfer1511. Extract semantic vectors from source project1522. Map and transfer relevant knowledge1533. Adapt context to target project's domain1544. Validate knowledge transferability155156## Usage Examples157158```bash159# Full context restoration160context-restore project:ai-assistant --mode full161162# Incremental context update163context-restore project:web-platform --mode incremental164165# Semantic context query166context-restore project:ml-pipeline --query "model training strategy"167```168169## Integration Patterns170- RAG (Retrieval Augmented Generation) pipelines171- Multi-agent workflow coordination172- Continuous learning systems173- Enterprise knowledge management174175## Future Roadmap176- Enhanced multi-modal embedding support177- Quantum-inspired vector search algorithms178- Self-healing context reconstruction179- Adaptive learning context strategies180
Full transparency — inspect the skill content before installing.