memory-retrieve
Retrieve and apply memories based on context and queries
What this skill does
# Memory Retrieve Skill
Load and apply relevant memories at session start and during conversations.
## Context Loading at Session Start
```python
from memory_lib import load_session_context
# Load all relevant context for current session
context = load_session_context("/path/to/project")
# Access different memory categories
context['global_memories'] # All global memories
context['project_memories'] # Project-specific memories
context['recent_memories'] # Recently accessed memories
context['high_confidence_memories'] # Confidence > 0.8
```
## Retrieving Relevant Memories
```python
from memory_lib import search_memories, load_session_context
# Get current project context
context = load_session_context(".")
project_hash = context.get('project_hash')
# Search for relevant memories
relevant = search_memories(
query="user is asking about testing",
project_hash=project_hash,
limit=5,
min_confidence=0.5
)
# Apply the most relevant memories
for memory in relevant:
apply_memory(memory)
```
## Formatting Memories for Display
```python
def format_memory_for_display(memory):
"""Format a single memory for display."""
content = memory['content']
meta = memory['metadata']
output = f"### {content['title']}\n"
output += f"**Confidence:** {meta['confidence']:.0%}\n"
output += f"**Scope:** {memory['scope']['type']}\n\n"
output += f"{content['description']}\n\n"
output += f"**Action:** {content['action']}\n"
if content.get('examples'):
output += "\n**Examples:**\n"
for ex in content['examples']:
output += f"- {ex}\n"
return output
def format_memories_for_context(memories):
"""Format multiple memories for injection into context."""
if not memories:
return ""
output = "## Relevant Memories\n\n"
for memory in memories:
output += format_memory_for_display(memory)
output += "\n---\n\n"
return output
```
## Applying High-Confidence Memories
```python
def apply_high_confidence_memories(context):
"""
Automatically apply memories with confidence > 0.8
"""
high_confidence = context.get('high_confidence_memories', [])
if not high_confidence:
return
print(f"Applying {len(high_confidence)} high-confidence memories:")
for memory in high_confidence:
print(f" โ {memory['content']['title']} ({memory['metadata']['confidence']:.0%})")
# Memory is automatically incorporated into behavior
```
## Session Start Workflow
```python
def on_session_start(project_path=None):
"""
Complete workflow for session start memory loading.
"""
# 1. Load context
context = load_session_context(project_path or ".")
# 2. Greet with context
session_count = get_session_count()
print(f"Back to project. {len(context['project_memories'])} project memories loaded.")
# 3. Apply high-confidence memories
if context['high_confidence_memories']:
apply_high_confidence_memories(context)
# 4. Check for evolution opportunities
check_evolution_status()
return context
def get_session_count():
"""Get total session count from config."""
from memory_lib import load_config
config = load_config()
return config['identity']['session_count']
def check_evolution_status():
"""Check if any memory domains are ready for evolution."""
from memory_lib import load_index
import json
index = load_index()
# Count memories by tag
tag_counts = {}
for entry in index['memories']['global']:
memory = load_memory(entry['id'])
if memory:
for tag in memory.get('tags', []):
tag_counts[tag] = tag_counts.get(tag, 0) + 1
# Check for clustering (5+ in same tag)
ready_for_evolution = [tag for tag, count in tag_counts.items() if count >= 5]
if ready_for_evolution:
print(f"\n๐ Memory clustering detected in: {', '.join(ready_for_evolution)}")
print("Run 'ccmem analyze' to evolve capabilities.")
```
## Searching During Conversation
```python
def get_relevant_memories_for_query(query, context):
"""
Get memories relevant to a user query.
"""
from memory_lib import search_memories
# Search with context
memories = search_memories(
query=query,
project_hash=context.get('project_hash'),
limit=3,
min_confidence=0.6
)
# Format for display
if memories:
return format_memories_for_context(memories)
return None
```
## Integration Example
```python
# At session start
context = on_session_start("/Users/elche/project")
# Store context for later use
session_context = context
# Later, when user asks something
user_query = "How do I install dependencies?"
relevant = get_relevant_memories_for_query(user_query, session_context)
if relevant:
print("Based on your preferences:")
print(relevant)
```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.