Context manager

From elasticdotventures/_b00t_ · View interactive version

Context manager is an AI agent skill from the GitHub repository elasticdotventures/_b00t_. Context management skill providing discovery, fetching, harvesting, extraction, compression, organization, cleanup, and guided workflows for project context

How to use this skill

Skill file

Context Manager Skill

Purpose: Comprehensive context management operations with clear guidance, lazy loading, and safe operations for discovering, organizing, and maintaining project context.


What I Do

I provide 8 powerful operations for managing context:

  1. DISCOVER - Find context files by topic or path
  2. FETCH - Get external documentation from libraries
  3. HARVEST - Extract context from summary files
  4. EXTRACT - Pull specific information from context
  5. COMPRESS - Reduce large file sizes
  6. ORGANIZE - Restructure context by concern
  7. CLEANUP - Remove stale or temporary files
  8. PROCESS - Guided workflow for context operations

Quick Start

1. Discover Context

bash .opencode/skills/context-manager/router.sh discover authentication

Finds all context files related to authentication patterns.

2. Fetch External Documentation

bash .opencode/skills/context-manager/router.sh fetch "Drizzle ORM" "modular schemas"

Retrieves live documentation from external libraries.

3. Harvest Context

bash .opencode/skills/context-manager/router.sh harvest ANALYSIS.md

Extracts key concepts from summary files into permanent context.

4. Extract Information

bash .opencode/skills/context-manager/router.sh extract code-quality.md "naming conventions"

Pulls specific information from context files.

5. Compress Files

bash .opencode/skills/context-manager/router.sh compress .opencode/context/ 100KB

Reduces large context files to save space.

6. Organize Context

bash .opencode/skills/context-manager/router.sh organize .opencode/context/

Restructures context by concern for better organization.

7. Cleanup Stale Files

bash .opencode/skills/context-manager/router.sh cleanup .tmp/ 7

Removes temporary or old files (older than 7 days).

8. Guided Workflow

bash .opencode/skills/context-manager/router.sh process "organize authentication context" .opencode/context/

Step-by-step guidance for complex context operations.


Operations Reference

Operation 1: DISCOVER

Purpose: Find context files using intelligent discovery or direct search

When to Use:

Syntax:

discover [target]

Examples:

# Discover by topic
./router.sh discover "authentication patterns"

# Discover all context
./router.sh discover "all context files"

# Discover in specific directory
./router.sh discover ".opencode/context/core/"

Output:


Operation 2: FETCH

Purpose: Fetch external documentation using ExternalScout

When to Use:

Syntax:

fetch [libraries] [topics]

Examples:

# Fetch single library
./router.sh fetch "Drizzle ORM" "modular schemas"

# Fetch multiple libraries
./router.sh fetch "Drizzle ORM" "Better Auth" "Next.js" "modular schemas" "integration" "app router"

# Fetch with specific query
./router.sh fetch "Better Auth" "Next.js App Router integration with Drizzle adapter"

Output:


Operation 3: HARVEST

Purpose: Extract context from summary files and create permanent context

When to Use:

Syntax:

harvest [source-file]

Examples:

# Harvest from analysis
./router.sh harvest DEVELOPER_PROFILE_ANALYSIS.md

# Harvest from brainstorm
./router.sh harvest AGENT_NAMING_BRAINSTORM.md

# Harvest from UX analysis
./router.sh harvest UX_ANALYSIS_THREE_MAIN_AGENTS.md

Output:


Operation 4: EXTRACT

Purpose: Extract specific information from context files

When to Use:

Syntax:

extract [file] [what-to-extract]

Examples:

# Extract naming conventions
./router.sh extract code-quality.md "naming conventions"

# Extract test patterns
./router.sh extract test-coverage.md "test patterns"

# Extract all standards
./router.sh extract ".opencode/context/core/" "all standards"

Output:


Operation 5: COMPRESS

Purpose: Compress large context files to save space

When to Use:

Syntax:

compress [target] [size-threshold]

Examples:

# Compress large files
./router.sh compress ".opencode/context/" "100 KB"

# Compress all context
./router.sh compress ".opencode/context/"

# Compress and archive
./router.sh compress ".opencode/context/development/" "50 KB"

Output:


Operation 6: ORGANIZE

Purpose: Reorganize context files by concern (what you're doing) rather than function

When to Use:

Syntax:

organize [target]

Examples:

# Organize by concern
./router.sh organize ".opencode/context/"

# Organize specific topic
./router.sh organize ".opencode/context/development/"

Output:


Operation 7: CLEANUP

Purpose: Clean up stale, temporary, or unused context files

When to Use:

Syntax:

cleanup [target] [older-than-days]

Examples:

# Cleanup .tmp directory
./router.sh cleanup ".tmp/"

# Cleanup old external context
./router.sh cleanup ".tmp/external-context/" "7"

# Cleanup stale sessions
./router.sh cleanup ".tmp/sessions/" "3"

Output:


Operation 8: PROCESS

Purpose: Provide guided workflow for processing context

When to Use:

Syntax:

process [goal] [scope]

Examples:

# Process authentication context
./router.sh process "organize authentication context" ".opencode/context/development/"

# Process all development context
./router.sh process "organize all development context" ".opencode/context/development/"

# Process external context
./router.sh process "fetch, persist, and reference external context" ".tmp/external-context/"

Output:


Common Workflows

Workflow 1: Discover & Extract

1. discover context for: "authentication"
   → Find all auth-related context

2. extract from: "security-patterns.md" what: "auth patterns"
   → Get specific patterns

3. Show results
   → Ready to use in session

Workflow 2: Fetch & Reference

1. fetch external docs for: "Drizzle ORM"
   → Get live documentation

2. Show file paths
   → .tmp/external-context/drizzle-orm/...

3. Reference in session context
   → Add to "## External Context Fetched"

4. Pass to subagents
   → Include in subtask JSONs

Workflow 3: Harvest & Organize

1. harvest context from: "ANALYSIS.md"
   → Extract key concepts

2. organize context by: "concern"
   → Restructure for clarity

3. Update documentation
   → Show new structure

4. Delete original summary
   → Clean up temporary files

Workflow 4: Cleanup & Maintain

1. cleanup .tmp/ directory
   → Remove temporary files

2. cleanup external context older than: "7 days"
   → Remove stale external docs

3. Show space freed
   → Provide statistics

4. Update manifest
   → Keep tracking accurate

Key Principles

1. Lazy Loading

2. Clear Guidance

3. Context Reference

4. Safe Operations


File Structure

.opencode/skills/context-manager/
├── SKILL.md                          # This file
├── router.sh                         # CLI router (entry point)
├── CONTEXT_SKILL_QUICK_START.md      # Quick start guide
├── context-manager.md                # Detailed operation guide
└── navigation.md                     # Navigation index

Integration Points

With ContextScout

With ExternalScout

With TaskManager

With Other Subagents


Success Criteria

You succeed when:

✅ Context files are discovered efficiently

✅ External documentation is fetched and persisted

✅ Context is harvested from summaries

✅ Key information is extracted clearly

✅ Large files are compressed safely

✅ Context is organized by concern

✅ Stale files are cleaned up safely

✅ User has clear guidance at each step

✅ All operations are reversible

✅ Documentation is updated


Tips & Best Practices

1. Regular Discovery

Run discover operations regularly to understand your context structure and identify gaps.

2. Organize by Concern

Organize context by what you're doing (authentication, testing, etc.) not by function (standards, guides).

3. Lazy Load External Docs

Fetch external documentation only when needed, not preemptively.

4. Harvest Summaries

Convert temporary analysis documents into permanent context using harvest.

5. Regular Cleanup

Schedule regular cleanup operations to remove stale temporary files.

6. Validate After Changes

Always validate context integrity after making changes.

7. Document Organization

Keep navigation.md files up-to-date as you organize context.

8. Reference Standards

When extracting context, always cite the source files.


Troubleshooting

"Context files not found"

Run discover all context files to see what exists and where.

"External docs failed to fetch"

Check that the library name is correct and ExternalScout is available.

"Harvest created empty file"

The source file may not have enough high-signal content. Review and add manually.

"Organization failed"

Check that all referenced files exist and navigation.md is valid.

"Cleanup removed too much"

Check the backup at .backup/cleanup-{date}.tar.gz for recovery.


Context Manager Skill - Discover, organize, and maintain your project context!

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.