home / skills / basedhardware / omi / context-optimization

context-optimization skill

/.cursor/skills/context-optimization

This skill helps you manage context efficiently using @ mentions, context window optimization, and semantic search for targeted references.

npx playbooks add skill basedhardware/omi --skill context-optimization

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.6 KB
---
name: context-optimization
description: "Effective use of @ mentions, context window optimization, and semantic search strategies. Use for managing context efficiently and providing targeted references."
---

# Context Optimization Skill

Strategies for effective context management: @ mentions, context window optimization, and semantic search.

## When to Use

Use this skill when:
- Managing context window efficiently
- Providing targeted references
- Optimizing @ mention usage
- Using semantic search effectively
- Understanding context limits

## Capabilities

### @ Mentions

- **@Files & Folders**: Reference files or directories
- **@Code**: Reference specific code sections
- **@Docs**: Reference documentation

### Context Optimization

- Context window management
- Strategic @ mention usage
- Let agent gather context when appropriate
- Reference files instead of copying

### Semantic Search

- Natural language queries
- Incremental understanding
- Code discovery
- Pattern finding

## Best Practices

### @ Mentions

**Use for:**
- Specific examples to follow
- Related code patterns
- Configuration files
- Cross-referencing

**Let agent search for:**
- General questions
- Broad exploration
- Discovery tasks
- Understanding flows

### Context Window

1. Use @ mentions selectively
2. Let agent search automatically
3. Reference files, don't copy
4. Break into chunks for large tasks
5. Use Plan Mode for complex features

## Related Resources

- Rule: `.cursor/rules/context-management.mdc`
- Rule: `.cursor/rules/semantic-search.mdc`
- Command: `/semantic-search`
- Agent: `.cursor/skills/context-optimization/agents/context-manager.md`

Overview

This skill teaches efficient context management using @ mentions, context window optimization, and semantic search strategies. It helps agents provide targeted references, minimize redundant data in prompts, and maintain focus when working with large codebases or long transcripts. The goal is to preserve relevant context while staying within token limits.

How this skill works

The skill inspects available files, code sections, and documents and converts them into targeted references via @ mentions rather than embedding full content. It uses semantic search to locate relevant passages with natural-language queries and recommends chunking or Plan Mode for complex or large tasks. The result is concise, incremental context delivery that reduces noise and speeds up retrieval.

When to use it

  • Working with large projects or long transcripts where full-copying exceeds context limits
  • Referencing specific code snippets, configuration files, or documentation without pasting entire files
  • Designing agents that must synthesize incremental findings or iterate on partial results
  • Searching for patterns, related examples, or implementation variants across a codebase
  • When you need targeted, high-relevance evidence for responses or summaries

Best practices

  • Prefer @Files, @Code, and @Docs references over copying full content into the prompt
  • Use semantic search for natural-language lookups and incremental discovery
  • Limit @ mentions to the smallest relevant scope (file sections, functions, paragraphs)
  • Chunk large artifacts and process sequentially to avoid hitting context window limits
  • Enable agent-driven search when the task requires exploration or broad discovery

Example use cases

  • Summarizing a day of wearable-device voice transcriptions by referencing only relevant segments
  • Finding related code patterns across a Flutter project using semantic queries and @Code references
  • Explaining a hardware interface in a BCI or smartglasses repo by linking targeted docs instead of pasting them
  • Iteratively refining a feature plan by letting the agent gather context and propose focused next steps
  • Debugging configuration issues by pointing the agent to specific config files and error snippets

FAQ

When should I use semantic search instead of manual @ mentions?

Use semantic search for broad, natural-language queries or discovery tasks. Use selective @ mentions when you know the exact file or code region to reference.

How do I avoid exceeding the context window with long transcripts?

Chunk transcripts into smaller segments, reference only segments with relevant content, and use semantic search to surface the most pertinent parts before feeding them to the agent.