Context Restoration: Advanced Semantic Memory Rehydration
Use this skill when
- Working on context restoration: advanced semantic memory rehydration tasks or workflows
- Needing guidance, best practices, or checklists for context restoration: advanced semantic memory rehydration
Do not use this skill when
- The task is unrelated to context restoration: advanced semantic memory rehydration
- You need a different domain or tool outside this scope
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.
Role Statement
Expert 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.
Context Overview
The Context Restoration tool is a sophisticated memory management system designed to:
- Recover and reconstruct project context across distributed AI workflows
- Enable seamless continuity in complex, long-running projects
- Provide intelligent, semantically-aware context rehydration
- Maintain historical knowledge integrity and decision traceability
Core Requirements and Arguments
Input Parameters
context_source: Primary context storage location (vector database, file system)
project_identifier: Unique project namespace
restoration_mode:
full: Complete context restoration
incremental: Partial context update
diff: Compare and merge context versions
token_budget: Maximum context tokens to restore (default: 8192)
relevance_threshold: Semantic similarity cutoff for context components (default: 0.75)
Advanced Context Retrieval Strategies
1. Semantic Vector Search
- Utilize multi-dimensional embedding models for context retrieval
- Employ cosine similarity and vector clustering techniques
- Support multi-modal embedding (text, code, architectural diagrams)
def semantic_context_retrieve(project_id, query_vector, top_k=5):
"""Semantically retrieve most relevant context vectors"""
vector_db = VectorDatabase(project_id)
matching_contexts = vector_db.search(
query_vector,
similarity_threshold=0.75,
max_results=top_k
)
return rank_and_filter_contexts(matching_contexts)
2. Relevance Filtering and Ranking
- Implement multi-stage relevance scoring
- Consider temporal decay, semantic similarity, and historical impact
- Dynamic weighting of context components
def rank_context_components(contexts, current_state):
"""Rank context components based on multiple relevance signals"""
ranked_contexts = []
for context in contexts:
relevance_score = calculate_composite_score(
semantic_similarity=context.semantic_score,
temporal_relevance=context.age_factor,
historical_impact=context.decision_weight
)
ranked_contexts.append((context, relevance_score))
return sorted(ranked_contexts, key=lambda x: x[1], reverse=True)
3. Context Rehydration Patterns
- Implement incremental context loading
- Support partial and full context reconstruction
- Manage token budgets dynamically
def rehydrate_context(project_context, token_budget=8192):
"""Intelligent context rehydration with token budget management"""
context_components = [
'project_overview',
'architectural_decisions',
'technology_stack',
'recent_agent_work',
'known_issues'
]
prioritized_components = prioritize_components(context_components)
restored_context = {}
current_tokens = 0
for component in prioritized_components:
component_tokens = estimate_tokens(component)
if current_tokens + component_tokens <= token_budget:
restored_context[component] = load_component(component)
current_tokens += component_tokens
return restored_context
4. Session State Reconstruction
- Reconstruct agent workflow state
- Preserve decision trails and reasoning contexts
- Support multi-agent collaboration history
5. Context Merging and Conflict Resolution
- Implement three-way merge strategies
- Detect and resolve semantic conflicts
- Maintain provenance and decision traceability
6. Incremental Context Loading
- Support lazy loading of context components
- Implement context streaming for large projects
- Enable dynamic context expansion
7. Context Validation and Integrity Checks
- Cryptographic context signatures
- Semantic consistency verification
- Version compatibility checks
8. Performance Optimization
- Implement efficient caching mechanisms
- Use probabilistic data structures for context indexing
- Optimize vector search algorithms
Reference Workflows
Workflow 1: Project Resumption
- Retrieve most recent project context
- Validate context against current codebase
- Selectively restore relevant components
- Generate resumption summary
Workflow 2: Cross-Project Knowledge Transfer
- Extract semantic vectors from source project
- Map and transfer relevant knowledge
- Adapt context to target project's domain
- Validate knowledge transferability
Usage Examples
# Full context restoration
context-restore project:ai-assistant --mode full
# Incremental context update
context-restore project:web-platform --mode incremental
# Semantic context query
context-restore project:ml-pipeline --query "model training strategy"
Integration Patterns
- RAG (Retrieval Augmented Generation) pipelines
- Multi-agent workflow coordination
- Continuous learning systems
- Enterprise knowledge management
Future Roadmap
- Enhanced multi-modal embedding support
- Quantum-inspired vector search algorithms
- Self-healing context reconstruction
- Adaptive learning context strategies
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---
2name: code-refactoring-context-restore
3description: "Use when working with code refactoring context restore"
4version: 1.0.0
5author:
6 name: "sickn33 / Antigravity Community"
7 github: sickn33
8tags: [code, refactoring, context, restore, development]
9category: development
10platforms: [macos, linux, windows]
11license: MIT
12metadata:
13 hermes:
14 source: https://skillmd.com/skills/nous-hermeshub/code-refactoring-context-restore
15 upstream: "antigravity-awesome-skills"
16 risk: "unknown"
17 date_added: "2026-02-27"
18 original_author: "Antigravity Community"
19---
20
21# Context Restoration: Advanced Semantic Memory Rehydration
22
23## Use this skill when
24
25- Working on context restoration: advanced semantic memory rehydration tasks or workflows
26- Needing guidance, best practices, or checklists for context restoration: advanced semantic memory rehydration
27
28## Do not use this skill when
29
30- The task is unrelated to context restoration: advanced semantic memory rehydration
31- You need a different domain or tool outside this scope
32
33## Instructions
34
35- Clarify goals, constraints, and required inputs.
36- Apply relevant best practices and validate outcomes.
37- Provide actionable steps and verification.
38- If detailed examples are required, open `resources/implementation-playbook.md`.
39
40## Role Statement
41
42Expert 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.
43
44## Context Overview
45
46The Context Restoration tool is a sophisticated memory management system designed to:
47- Recover and reconstruct project context across distributed AI workflows
48- Enable seamless continuity in complex, long-running projects
49- Provide intelligent, semantically-aware context rehydration
50- Maintain historical knowledge integrity and decision traceability
51
52## Core Requirements and Arguments
53
54### Input Parameters
55- `context_source`: Primary context storage location (vector database, file system)
56- `project_identifier`: Unique project namespace
57- `restoration_mode`:
58 - `full`: Complete context restoration
59 - `incremental`: Partial context update
60 - `diff`: Compare and merge context versions
61- `token_budget`: Maximum context tokens to restore (default: 8192)
62- `relevance_threshold`: Semantic similarity cutoff for context components (default: 0.75)
63
64## Advanced Context Retrieval Strategies
65
66### 1. Semantic Vector Search
67- Utilize multi-dimensional embedding models for context retrieval
68- Employ cosine similarity and vector clustering techniques
69- Support multi-modal embedding (text, code, architectural diagrams)
70
71```python
72def semantic_context_retrieve(project_id, query_vector, top_k=5):
73 """Semantically retrieve most relevant context vectors"""
74 vector_db = VectorDatabase(project_id)
75 matching_contexts = vector_db.search(
76 query_vector,
77 similarity_threshold=0.75,
78 max_results=top_k
79 )
80 return rank_and_filter_contexts(matching_contexts)
81```
82
83### 2. Relevance Filtering and Ranking
84- Implement multi-stage relevance scoring
85- Consider temporal decay, semantic similarity, and historical impact
86- Dynamic weighting of context components
87
88```python
89def rank_context_components(contexts, current_state):
90 """Rank context components based on multiple relevance signals"""
91 ranked_contexts = []
92 for context in contexts:
93 relevance_score = calculate_composite_score(
94 semantic_similarity=context.semantic_score,
95 temporal_relevance=context.age_factor,
96 historical_impact=context.decision_weight
97 )
98 ranked_contexts.append((context, relevance_score))
99
100 return sorted(ranked_contexts, key=lambda x: x[1], reverse=True)
101```
102
103### 3. Context Rehydration Patterns
104- Implement incremental context loading
105- Support partial and full context reconstruction
106- Manage token budgets dynamically
107
108```python
109def rehydrate_context(project_context, token_budget=8192):
110 """Intelligent context rehydration with token budget management"""
111 context_components = [
112 'project_overview',
113 'architectural_decisions',
114 'technology_stack',
115 'recent_agent_work',
116 'known_issues'
117 ]
118
119 prioritized_components = prioritize_components(context_components)
120 restored_context = {}
121
122 current_tokens = 0
123 for component in prioritized_components:
124 component_tokens = estimate_tokens(component)
125 if current_tokens + component_tokens <= token_budget:
126 restored_context[component] = load_component(component)
127 current_tokens += component_tokens
128
129 return restored_context
130```
131
132### 4. Session State Reconstruction
133- Reconstruct agent workflow state
134- Preserve decision trails and reasoning contexts
135- Support multi-agent collaboration history
136
137### 5. Context Merging and Conflict Resolution
138- Implement three-way merge strategies
139- Detect and resolve semantic conflicts
140- Maintain provenance and decision traceability
141
142### 6. Incremental Context Loading
143- Support lazy loading of context components
144- Implement context streaming for large projects
145- Enable dynamic context expansion
146
147### 7. Context Validation and Integrity Checks
148- Cryptographic context signatures
149- Semantic consistency verification
150- Version compatibility checks
151
152### 8. Performance Optimization
153- Implement efficient caching mechanisms
154- Use probabilistic data structures for context indexing
155- Optimize vector search algorithms
156
157## Reference Workflows
158
159### Workflow 1: Project Resumption
1601. Retrieve most recent project context
1612. Validate context against current codebase
1623. Selectively restore relevant components
1634. Generate resumption summary
164
165### Workflow 2: Cross-Project Knowledge Transfer
1661. Extract semantic vectors from source project
1672. Map and transfer relevant knowledge
1683. Adapt context to target project's domain
1694. Validate knowledge transferability
170
171## Usage Examples
172
173```bash
174# Full context restoration
175context-restore project:ai-assistant --mode full
176
177# Incremental context update
178context-restore project:web-platform --mode incremental
179
180# Semantic context query
181context-restore project:ml-pipeline --query "model training strategy"
182```
183
184## Integration Patterns
185- RAG (Retrieval Augmented Generation) pipelines
186- Multi-agent workflow coordination
187- Continuous learning systems
188- Enterprise knowledge management
189
190## Future Roadmap
191- Enhanced multi-modal embedding support
192- Quantum-inspired vector search algorithms
193- Self-healing context reconstruction
194- Adaptive learning context strategies
195
196## Limitations
197- Use this skill only when the task clearly matches the scope described above.
198- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
199- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.