= ({ ... }) => {
+ // Real example from your project
+};
+
+## Bad ❌
+export const Button = (props) => {
+ // Generic example
+};
+```
+
+### 3. Be Specific
+
+```markdown
+## Good ✅
+All API endpoints must:
+- Validate input with Zod
+- Return { success, data, error }
+- Log with console.error for errors
+- Use 400 for validation, 401 for auth, 500 for server
+
+## Bad ❌
+All API endpoints should be good
+```
+
+### 4. Update Regularly
+
+When you change patterns:
+1. Update `project-context.md`
+2. Agents will use new patterns immediately
+3. No need to restart anything
+
+---
+
+## Troubleshooting
+
+### Problem: Agent isn't following my patterns
+
+**Solution**:
+1. Check that `project-context.md` exists
+2. Verify the pattern is clearly written
+3. Include a real example
+4. Ask agent to "follow project patterns"
+
+### Problem: Agent uses old patterns
+
+**Solution**:
+1. Update `project-context.md`
+2. Restart the agent
+3. Ask agent to "load latest context"
+
+### Problem: Pattern is too complex
+
+**Solution**:
+1. Break into smaller patterns
+2. Include step-by-step example
+3. Add comments explaining why
+
+### Problem: Agent creates code that doesn't match
+
+**Solution**:
+1. Check if pattern is in `project-context.md`
+2. Verify pattern is specific enough
+3. Ask agent to "review against project patterns"
+4. Provide feedback to refine pattern
+
+---
+
+## Advanced: Context Hierarchy
+
+Agents load context in this order:
+
+1. **Core Standards** (universal patterns)
+ - `core/standards/code-quality.md`
+ - `core/standards/security-patterns.md`
+
+2. **Workflows** (how to do things)
+ - `core/workflows/design-iteration.md`
+ - `core/workflows/external-libraries.md`
+
+3. **Domain-Specific** (language/framework)
+ - `development/[language]/patterns.md`
+ - `ui/web/react-patterns.md`
+
+4. **Project-Specific** (YOUR patterns) ← Most important!
+ - `project/project-context.md`
+
+**Project context overrides everything else!**
+
+---
+
+## Summary
+
+**Context is your secret weapon** for AI-assisted development:
+
+✅ **Automatic pattern following** - No manual configuration
+✅ **Consistent code** - All code matches your style
+✅ **Team alignment** - Everyone follows same patterns
+✅ **Easy updates** - Change patterns once, agents use everywhere
+✅ **Living documentation** - Patterns stay in sync with code
+
+**Get started**:
+1. Edit `~/.opencode/context/project/project-context.md`
+2. Add your patterns with examples
+3. Ask agents to create code
+4. Watch them follow your patterns automatically!
+
+---
+
+## Next Steps
+
+1. **Review** your current coding patterns
+2. **Document** them in `project-context.md`
+3. **Include** real examples from your project
+4. **Test** by asking agents to create code
+5. **Refine** patterns based on results
+
+Your agents will become better and better as your context improves!
diff --git a/QUICK_START.md b/QUICK_START.md
deleted file mode 100644
index 2200a4e..0000000
--- a/QUICK_START.md
+++ /dev/null
@@ -1,299 +0,0 @@
-# 🚀 OpenCode Agents - Quick Start
-
-
-
-## 📋 Available Agents
-
-- **openagent** - Full-featured development agent (22+ tests)
- - Developer tests: Code, docs, tests, delegation
- - Context loading tests: Standards, patterns, workflows
- - Business tests: Conversations, data analysis
- - Edge cases: Approval gates, negative tests
-
-- **opencoder** - Specialized coding agent (4+ tests)
- - Developer tests: Bash execution, file operations
- - Multi-tool workflows
-
----
-
-## 🧪 Running Tests
-
-### Test All Agents
-```bash
-npm test # All agents, all tests (default)
-npm run test:all # Explicit all agents
-```
-
-### Test Specific Agent
-```bash
-npm run test:openagent # OpenAgent only
-npm run test:opencoder # OpenCoder only
-```
-
-### Test with Different Models
-
-#### OpenAgent
-```bash
-npm run test:openagent:grok # Grok (free tier, fast)
-npm run test:openagent:claude # Claude Sonnet 4.5 (best quality)
-npm run test:openagent:gpt4 # GPT-4 Turbo (OpenAI)
-```
-
-#### OpenCoder
-```bash
-npm run test:opencoder:grok # Grok (free tier, fast)
-npm run test:opencoder:claude # Claude Sonnet 4.5 (best quality)
-npm run test:opencoder:gpt4 # GPT-4 Turbo (OpenAI)
-```
-
-#### All Agents
-```bash
-npm run test:all:grok # All agents with Grok
-npm run test:all:claude # All agents with Claude
-npm run test:all:gpt4 # All agents with GPT-4
-```
-
----
-
-## 🎯 Test Specific Categories
-
-### OpenAgent Categories
-```bash
-npm run test:openagent:developer # Developer tests (code, docs, tests)
-npm run test:openagent:context # Context loading tests
-npm run test:openagent:business # Business/conversation tests
-```
-
-### OpenCoder Categories
-```bash
-npm run test:opencoder:developer # Developer tests
-npm run test:opencoder:bash # Bash execution tests
-```
-
-### Custom Patterns
-```bash
-npm run test:pattern -- "developer/*.yaml" # All developer tests
-npm run test:pattern -- "context-loading/*.yaml" # Context tests
-npm run test:pattern -- "edge-case/*.yaml" # Edge cases
-npm run test:openagent -- --pattern="developer/ctx-*" # OpenAgent context tests
-```
-
----
-
-## 📊 View Results
-
-### Dashboard (Recommended)
-```bash
-npm run dashboard # Launch interactive dashboard
-npm run dashboard:open # Launch and auto-open browser
-```
-
-The dashboard provides:
-- ✅ Real-time test results visualization
-- ✅ Filter by agent, category, status
-- ✅ Detailed violation tracking
-- ✅ CSV export functionality
-- ✅ Historical results tracking
-
-### Command Line
-```bash
-npm run results:openagent # Recent OpenAgent results
-npm run results:opencoder # Recent OpenCoder results
-npm run results:latest # Latest test summary (JSON)
-```
-
----
-
-## 🐛 Debug Mode
-
-```bash
-npm run test:debug # Run with debug output
-npm run test:openagent -- --debug # Debug OpenAgent tests
-npm run test:opencoder -- --debug # Debug OpenCoder tests
-```
-
-Debug mode shows:
-- Detailed event logging
-- Tool call details
-- Session information
-- Evaluation progress
-
----
-
-## 🔧 Development
-
-```bash
-npm run dev:setup # Install dependencies
-npm run dev:build # Build framework
-npm run dev:test # Run unit tests
-npm run dev:clean # Clean and reinstall
-```
-
----
-
-## 📈 Version Management
-
-```bash
-npm run version # Show current version
-npm run version:bump alpha # Bump alpha version
-npm run version:bump beta # Bump to beta
-npm run version:bump rc # Bump to release candidate
-```
-
----
-
-## 📁 Test Structure
-
-```
-evals/agents/
-├── openagent/tests/
-│ ├── developer/ # Code, docs, tests (12 tests)
-│ │ ├── ctx-code-001.yaml
-│ │ ├── ctx-docs-001.yaml
-│ │ ├── ctx-tests-001.yaml
-│ │ ├── ctx-delegation-001.yaml
-│ │ └── ...
-│ ├── context-loading/ # Context loading (5 tests)
-│ │ ├── ctx-simple-coding-standards.yaml
-│ │ ├── ctx-simple-documentation-format.yaml
-│ │ └── ...
-│ ├── business/ # Conversations (2 tests)
-│ │ ├── conv-simple-001.yaml
-│ │ └── data-analysis.yaml
-│ └── edge-case/ # Edge cases (3 tests)
-│ ├── just-do-it.yaml
-│ ├── missing-approval-negative.yaml
-│ └── no-approval-negative.yaml
-│
-└── opencoder/tests/
- └── developer/ # Bash, file ops (4 tests)
- ├── bash-execution-001.yaml
- ├── file-read-001.yaml
- ├── multi-tool-001.yaml
- └── simple-bash-test.yaml
-```
-
----
-
-## 💡 Common Workflows
-
-### Quick Test (Free Tier)
-```bash
-npm run test:openagent:grok # Fast, free
-npm run test:opencoder:grok # Fast, free
-```
-
-### Quality Test (Best Model)
-```bash
-npm run test:openagent:claude # Best quality
-npm run test:opencoder:claude # Best quality
-```
-
-### Full Test Suite
-```bash
-npm run test:all:claude # All agents, best model
-```
-
-### Continuous Development
-```bash
-# 1. Run tests in debug mode
-npm run test:openagent:developer -- --debug
-
-# 2. View results in dashboard
-npm run dashboard:open
-
-# 3. Iterate on agent prompts
-# Edit .opencode/agent/core/openagent.md
-
-# 4. Re-run tests
-npm run test:openagent:developer
-```
-
-### CI/CD Smoke Tests
-```bash
-npm run test:ci # Fast smoke tests for both agents
-npm run test:ci:openagent # OpenAgent smoke test
-npm run test:ci:opencoder # OpenCoder smoke test
-```
-
----
-
-## 🎯 Test Results
-
-After running tests, results are saved to:
-- `evals/results/latest.json` - Latest test run
-- `evals/results/history/YYYY-MM/DD-HHMMSS-{agent}.json` - Historical results
-
-View in dashboard: `npm run dashboard:open`
-
----
-
-## 🔍 Understanding Test Results
-
-### Test Status
-- ✅ **PASSED** - All checks passed, no violations
-- ❌ **FAILED** - Test failed (execution error or violations)
-
-### Evaluators
-Tests are evaluated by multiple evaluators:
-- **approval-gate** - Checks if agent requested approval when required
-- **context-loading** - Validates context files were loaded before execution
-- **delegation** - Checks if agent delegated to subagents appropriately
-- **tool-usage** - Validates correct tool usage
-- **behavior** - Checks if agent performed expected actions
-
-### Violations
-- **Error** - Critical issues that cause test failure
-- **Warning** - Non-critical issues
-- **Info** - Informational messages
-
----
-
-## 📚 Additional Resources
-
-- [README.md](README.md) - Project overview
-- [CHANGELOG.md](CHANGELOG.md) - Version history
-
----
-
-## 🆘 Troubleshooting
-
-### Tests not running?
-```bash
-# Ensure dependencies are installed
-npm run dev:setup
-
-# Build the framework
-npm run dev:build
-```
-
-### Dashboard not loading?
-```bash
-# Check if results exist
-ls -la evals/results/
-
-# Try launching manually
-cd evals/results && ./serve.sh
-```
-
-### Version mismatch?
-```bash
-# Check current version
-npm run version
-
-# Sync VERSION file with package.json
-npm run version > VERSION
-```
-
----
-
-## 🎉 Getting Help
-
-- Review test examples in `evals/agents/*/tests/`
-- Run tests in debug mode: `npm run test:debug`
-- View results dashboard: `npm run dashboard:open`
-
----
-
-**Current Version:** 0.1.0-alpha.1
-**Last Updated:** 2025-11-26
diff --git a/README.md b/README.md
index 64c7522..9262c09 100644
--- a/README.md
+++ b/README.md
@@ -1,31 +1,64 @@
-# OpenAgents Control
+
+
+# OpenAgents Control (AOC)
### AI agent framework for plan-first development workflows with approval-based execution
-[](https://github.com/darrenhinde/OpenAgentsControl/stargazers)
-[](https://x.com/DarrenBuildsAI)
-[](https://opensource.org/licenses/MIT)
-[](https://github.com/darrenhinde/OpenAgentsControl/commits/main)
-[](docs/contributing/CONTRIBUTING.md)
-[](https://buymeacoffee.com/darrenhinde)
-
**Multi-language support:** TypeScript • Python • Go • Rust
**Features:** Automatic testing • Code review • Validation
-> **🚀 Future Plans:** Currently optimized for OpenCode CLI. Support for other AI coding tools (Cursor, Claude Code, etc.) will be added after stabilizing the OpenCode integration.
+[](https://github.com/darrenhinde/OpenAgentsControl/stargazers)
+[](https://x.com/DarrenBuildsAI)
+[](https://opensource.org/licenses/MIT)
+[](https://github.com/darrenhinde/OpenAgentsControl/commits/main)
+
+[🚀 Quick Start](#get-started-in-5-minutes) • [📖 Documentation](#how-it-works) • [🎥 Demo Video](https://youtu.be/EOIzFMdmox8) • [💬 Community](https://nextsystems.ai)
-[](https://youtu.be/EOIzFMdmox8?si=4ZSsVlAkhMxVmF2R)
+## Why I Built This
-> **Note:** This repository has evolved since the demo video with continuous improvements to make it easier for others to use in their projects. The core concepts remain the same, but installation and component organization have been streamlined.
+I've spent 14+ years shipping production software. I've watched AI agents burn through thousands of tokens generating code that doesn't match your project, doesn't follow your patterns, and doesn't actually work without heavy refactoring.
-> 📹 **Following along with the video?** The simplified structure shown in the tutorial is available on the [`video-simple`](https://github.com/darrenhinde/OpenAgentsControl/tree/video-simple) branch.
+**The problem**: Most AI agents are like hiring a developer who doesn't know your codebase. They write generic code. You spend hours rewriting, refactoring, and fixing inconsistencies. Tokens burned. Time wasted. No actual work done.
+**This system solves that**: AOC teaches agents your patterns upfront. They understand your coding standards, your architecture, your security requirements. They propose plans before implementing. They execute incrementally with validation. The result: **code that actually ships to production without heavy rework**.
-## Why Use This?
+This isn't a gimmick project. I use this every day to ship real production code. It works because it respects two things:
+1. **Your time** - Agents propose plans, you approve before execution
+2. **Your patterns** - Agents follow your standards automatically
+
+**The result**: Production-ready code, not throwaway prototypes. No rework. No refactoring. Just ship.
+
+**Full-stack development**: AOC handles both frontend and backend work. No need for separate developers—the agents coordinate to build complete features from UI to database.
+
+---
+
+## What Is AOC?
+
+AOC is a **framework for AI-assisted development** that combines:
+- **Plan-first workflows** - Agents propose plans before implementing
+- **Context-aware execution** - Agents follow YOUR coding standards
+- **Incremental validation** - Step-by-step implementation with quality checks
+
+Think of it as having a senior developer who understands your project's patterns and asks for approval before making changes.
+
+**Key insight**: The context system (your coding standards) is the secret weapon. Agents automatically load and follow your patterns, so code is consistent without manual configuration.
+
+---
+
+## Quick Navigation
+
+- **New here?** → [What Is AOC?](#what-is-aoc) → [Get Started](#get-started-in-5-minutes)
+- **Want to understand the system?** → [How It Works](#how-it-works) → [Context System](#-the-context-system-your-secret-weapon)
+- **Ready to install?** → [Installation](#installation)
+- **Building something?** → [Example Workflows](#example-workflows)
+
+---
+
+## Why Use AOC?
- ✅ **Multi-language support** - Works with TypeScript, Python, Go, Rust, and more
- ✅ **Plan-first workflow** - Agents propose plans before implementing
@@ -35,148 +68,148 @@
---
-## Quick Start
+## Get Started in 5 Minutes
-### Step 1: Install OpenCode CLI (Follow official guide)
-```bash
-https://opencode.ai/docs#
-```
-### Step 2: Install Agents & Commands
-
-**Option A: Interactive Installer**
-
-> **Note:** Interactive mode requires downloading the script first (can't run through pipe)
-
-
-macOS / Linux
+**One command. That's it.**
```bash
-# Download the installer
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh -o install.sh
-
-# Run interactively
-bash install.sh
-```
-
-
-
-Windows (Git Bash)
-
-```bash
-# Download the installer
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh -o install.sh
-
-# Run interactively
-bash install.sh
-```
-
-
-
-Windows (PowerShell)
-
-```powershell
-# Download the script
-Invoke-WebRequest -Uri "https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh" -OutFile "install.sh"
-
-# Run with Git Bash
-& "C:\Program Files\Git\bin\bash.exe" install.sh
-
-# Or run with WSL
-wsl bash install.sh
-```
-
-> **Note:** Git Bash comes with Git for Windows. [Download here](https://git-scm.com/download/win)
-
-
-The installer offers:
-- 🎯 **Quick Profiles**: Essential, Developer, Business, Full, or Advanced
-- 🎨 **Custom Selection**: Pick exactly what you need
-- 📦 **Smart Dependencies**: Auto-installs required components
-- ✨ **Interactive Menus**: User-friendly component browser
-- 🛡️ **Collision Detection**: Safely handles existing files with 4 strategies (skip/overwrite/backup/cancel)
-- 🖥️ **Cross-Platform**: Works on macOS, Linux, and Windows (Git Bash/WSL)
-
-> **Updating?** The installer detects existing files and lets you choose: skip existing (keep your changes), overwrite all (get latest), or backup & overwrite (safe update). [Learn more](docs/getting-started/collision-handling.md)
-
-**Option B: Profile-Based Install (Recommended)**
-
-> **Fastest method:** One command, no interaction needed
-
-
-macOS / Linux / Git Bash / WSL
-
-```bash
-# Essential - Minimal essentials (23 components)
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh | bash -s essential
-
-# Developer - Recommended for daily work (37 components)
+# Quick install (developer profile)
curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh | bash -s developer
-
-# Business - Business automation and content creation (23 components)
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh | bash -s business
-
-# Full - Everything included (39 components)
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh | bash -s full
-
-# Advanced - Full + System Builder (48 components)
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh | bash -s advanced
```
-
-
-Windows PowerShell
-
-```powershell
-# Download script
-Invoke-WebRequest -Uri "https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh" -OutFile "install.sh"
-
-# Essential profile
-& "C:\Program Files\Git\bin\bash.exe" install.sh essential
-
-# Developer profile
-& "C:\Program Files\Git\bin\bash.exe" install.sh developer
-
-# Business profile
-& "C:\Program Files\Git\bin\bash.exe" install.sh business
-
-# Full profile
-& "C:\Program Files\Git\bin\bash.exe" install.sh full
-
-# Advanced profile
-& "C:\Program Files\Git\bin\bash.exe" install.sh advanced
-```
-
-
-> **New!** The `advanced` profile includes the **System Builder** - an interactive tool that generates complete custom AI systems tailored to your domain. [Learn more](docs/features/system-builder/)
-
-**Option C: Manual Install**
+**Or use interactive installer:**
+```bash
+# Download the installer
+curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh -o install.sh
+
+# Run interactively
+bash install.sh
+```
+
+Then start building:
+```bash
+opencode --agent OpenAgent
+> "Create a user authentication system"
+```
+
+**What happens:**
+1. Analyzes your request
+2. Proposes a plan (you approve)
+3. Executes step-by-step with validation
+4. Delegates to specialists when needed
+5. Ships production-ready code
+
+**That's the entire workflow.** No complex setup. No configuration. Just ship code.
+
+---
+
+## Recommended for New Users
+
+**Start with `OpenAgent`** - a lightweight, versatile agent perfect for getting started. It handles multiple task types and is ideal for learning the system.
+
+```bash
+opencode --agent OpenAgent
+> "Create a user authentication system" # Building features
+> "How do I implement authentication in Next.js?" # Questions
+> "Create a README for this project" # Documentation
+> "Explain the architecture of this codebase" # Analysis
+```
+
+OpenAgent is a streamlined version that can handle most tasks while you learn the workflow. It automatically delegates to specialists when needed.
+
+**Ready for advanced workflows?** Upgrade to `OpenCoder`:
+
+```bash
+opencode --agent OpenCoder
+> "Create a user authentication system" # Full-stack features
+> "Refactor this codebase to use dependency injection" # Multi-file refactoring
+> "Add real-time notifications with WebSockets" # Complex implementations
+```
+
+OpenCoder is the full-featured development agent with rigorous workflows: Discover context → Propose plan → Get approval → Execute incrementally → Validate → Ship. It provides deeper context management, session tracking, and more sophisticated delegation to specialists (TaskManager, TestEngineer, CodeReviewer).
+
+**Learn more:**
+- [OpenAgent Guide](docs/agents/openagent.md) - Lightweight, versatile agent for getting started
+- [OpenCoder Guide](docs/agents/opencoder.md) - Advanced development workflows
+
+---
+
+## Installation
+
+### Prerequisites
+- **OpenCode CLI** - [Install here](https://opencode.ai/docs)
+- **Bash 3.2+** (macOS default works)
+- **Git** (for cloning)
+
+### Install AOC
+
+**Recommended: One-line install**
+```bash
+curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh | bash -s developer
+```
+
+**Alternative: Interactive installer**
+```bash
+curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh -o install.sh
+bash install.sh
+```
+
+**Manual install**
```bash
-# Clone this repository
git clone https://github.com/darrenhinde/OpenAgentsControl.git
cd OpenAgentsControl
-
-# Install to OpenCode directory (global)
mkdir -p ~/.opencode
cp -r .opencode/agent ~/.opencode/
cp -r .opencode/command ~/.opencode/
cp -r .opencode/context ~/.opencode/
```
-### Step 3: Start Building
+### Start Using It
```bash
-# Start the universal agent (recommended for new users)
opencode --agent OpenAgent
-
-# Ask questions or request tasks
-> "Create a React todo list with TypeScript"
+> "Create a user authentication system"
```
-**What happens next:**
-1. OpenAgent analyzes your request (question or task)
-2. For tasks: proposes a plan and asks for approval
-3. Executes step-by-step with validation
-4. Delegates to specialists (@task-manager, @tester, @reviewer) when needed
-5. Confirms completion and offers cleanup
+---
+
+## 🌟 Liking This Project?
+
+
+
+**Join the community and stay updated with the latest AI development workflows!**
+
+[](https://youtube.com/@DarrenBuildsAI)
+[](https://nextsystems.ai)
+[](https://x.com/DarrenBuildsAI)
+[](https://buymeacoffee.com/darrenhinde)
+
+**📺 Tutorials & Demos** • **💬 Join Waitlist** • **🐦 Latest Updates** • **☕ Support Development**
+
+*Your support helps keep this project free and open-source!*
+
+
+
+---
+
+## Setup & Installation FAQ
+
+**Q: Does this work on Windows?**
+A: Yes! Use Git Bash (recommended) or WSL. See [Platform Compatibility Guide](docs/getting-started/platform-compatibility.md) for details.
+
+**Q: What bash version do I need?**
+A: Bash 3.2+ (works on macOS default bash). Run `bash scripts/tests/test-compatibility.sh` to check your system.
+
+**Q: Do I need to install plugins/tools?**
+A: No, they're optional. Only install if you want Telegram notifications or Gemini AI features.
+
+**Q: Where should I install - globally or per-project?**
+A: Global (`~/.opencode/`) works for most. Project-specific (`.opencode/`) if you need different configs per project.
+
+**Q: How do I add my own coding patterns?**
+A: Edit `~/.opencode/context/project/project-context.md` - agents automatically load this file.
+
+**Q: What languages are supported?**
+A: The agents work with any language (TypeScript, Python, Go, Rust, etc.) and adapt based on your project files.
---
@@ -213,69 +246,126 @@ User Request
**Context-aware:** Agents automatically load patterns from `.opencode/context/` to follow your coding standards.
+**Smart discovery:** ContextScout finds relevant standards, ExternalScout fetches current library docs (preventing outdated training data issues). ExternalScout supports 18+ libraries including Drizzle, Better Auth, Next.js, TanStack, Cloudflare Workers, AWS Lambda, and more.
+
+---
+
+## 🧠 The Context System (Your Secret Weapon)
+
+### What Is Context?
+
+Context files are **your project's coding standards and patterns**. They tell agents how you write code, what libraries you use, your security requirements, and your design system.
+
+**Think of it as a style guide for AI agents.**
+
+### How It Works
+
+```
+Your Request
+ ↓
+Agent receives request
+ ↓
+ContextScout discovers relevant context files
+ ↓
+Agent loads context files
+ ↓
+Agent follows patterns from context
+ ↓
+Code matches your standards automatically
+```
+
+### Why It Matters
+
+**Without context**: You ask for a component → Agent creates it in its own style → Doesn't match your project ❌
+
+**With context**: You ask for a component → Agent loads your patterns → Creates component matching your style → Perfectly matches your project ✅
+
+### Get Started
+
+1. **Add your patterns** to `~/.opencode/context/project/project-context.md`
+2. **Include examples** of your API endpoints, components, naming conventions
+3. **Agents automatically use** these patterns in all code they generate
+
+### Learn More
+
+For a complete guide including real-world examples and best practices, see [The Context System Guide](CONTEXT_SYSTEM_GUIDE.md).
+
---
## What's Included
-### 🤖 Main Agents
-- **openagent** - Universal coordinator for general tasks, questions, and workflows (recommended default)
-- **opencoder** - Specialized development agent for complex coding, architecture, and refactoring
-- **system-builder** - Meta-level generator for creating custom AI architectures
+### 🤖 Main Agents (3 core agents)
+- **OpenCoder** - Specialized development agent for production-ready code (start here for building)
+- **OpenAgent** - Universal coordinator for general tasks, questions, and workflows
+- **SystemBuilder** - Interactive tool for generating complete custom AI systems
### 🔧 Specialized Subagents (Auto-delegated)
-
-**Core Coordination:**
-- **task-manager** - Task breakdown and planning
-- **documentation** - Documentation authoring
-
-**Code Specialists:**
-- **coder-agent** - Quick implementation tasks
+- **task-manager** - Breaks complex features into atomic subtasks
+- **coder-agent** - Focused code implementations
+- **tester** - Test authoring and TDD
- **reviewer** - Code review and security analysis
-- **tester** - Test creation and validation
-- **build-agent** - Build and type checking
-- **codebase-pattern-analyst** - Pattern discovery
-
-**Utilities:**
-- **image-specialist** - Image generation with Gemini AI
-
-**System Builder (Meta-Level):**
-- **domain-analyzer** - Domain analysis and agent recommendations
-- **agent-generator** - XML-optimized agent generation
-- **context-organizer** - Context file organization
-- **workflow-designer** - Workflow design
-- **command-creator** - Custom command creation
+- **build-agent** - Type checking and build validation
+- **documentation** - Documentation generation
+- Plus category specialists: frontend, devops, copywriter, technical-writer, data-analyst
### ⚡ Commands
-- **/commit** - Smart git commits with conventional format
-- **/optimize** - Code optimization
-- **/test** - Testing workflows
-- **/clean** - Cleanup operations
-- **/context** - Context management
-- **/prompt-enhancer** - Improve your prompts
-- **/worktrees** - Git worktree management
-- **/validate-repo** - Validate repository consistency
+- `/commit` - Smart git commits with conventional format
+- `/test` - Testing workflows
+- `/optimize` - Code optimization
+- `/context` - Context management
+- And 7+ more productivity commands
-### 📚 Context Files
-- `core/essential-patterns.md` - Universal coding patterns
-- `project/project-context.md` - Your project-specific patterns
+### 📚 Context System
+Your coding standards automatically loaded by agents:
+- Code quality and security patterns
+- UI/design system standards
+- Task management workflows
+- External library integration guides
+- Your project-specific patterns
---
## Example Workflows
-### Build a Feature
+### Build a Full-Stack Feature
```bash
-opencode --agent OpenAgent
+opencode --agent OpenCoder
+> "Create a user dashboard with authentication and profile settings"
+
+# OpenCoder will:
+# 1. Discover context (loads your auth patterns, code standards)
+# 2. Propose detailed implementation plan
+# 3. Wait for your approval
+# 4. Initialize session and persist context
+# 5. Delegate to task-manager (creates atomic task breakdown)
+# - task-manager identifies UI and backend tasks
+# - Suggests frontend-specialist for UI work
+# - Includes design standards in context
+# 6. Frontend specialist executes 4-stage workflow:
+# - Stage 1: Layout (ASCII wireframe, responsive structure)
+# - Stage 2: Theme (design system, CSS theme file)
+# - Stage 3: Animation (micro-interactions, timing)
+# - Stage 4: Implementation (single HTML file, design_iterations/)
+# 7. Execute full-stack implementation (frontend + backend)
+# 8. Delegate to tester for tests and reviewer for security
+# 9. Validate and handoff production-ready code
+```
+
+### Build a Backend Feature
+```bash
+opencode --agent OpenCoder
> "Create a user authentication system with email/password"
-# OpenAgent will:
-# 1. Analyze the request (complex task)
-# 2. Propose implementation plan
+# OpenCoder will:
+# 1. Discover context (loads auth-patterns.md, code-quality.md)
+# 2. Propose implementation plan with component breakdown
# 3. Wait for your approval
-# 4. Delegate to @task-manager (creates task breakdown)
-# 5. Coordinate implementation step-by-step
-# 6. Use @tester for tests and @reviewer for security
-# 7. Validate, summarize, and confirm completion
+# 4. Initialize session (.tmp/sessions/YYYY-MM-DD-auth-system/)
+# 5. Delegate to task-manager for atomic task breakdown
+# 6. Execute incrementally (one component at a time)
+# 7. Validate after each step (type check, lint, test)
+# 8. Delegate to tester and reviewer
+# 9. Ship production-ready code
```
### Make a Commit
@@ -307,6 +397,55 @@ nano ~/.opencode/context/project/project-context.md
---
+## Feature Deep Dives
+
+The following sections provide detailed information about advanced features. New users can skip to [Advanced Features FAQ](#advanced-features-faq) and return to these as needed.
+
+---
+
+## 🎨 Frontend Design Workflow
+
+The **OpenFrontendSpecialist** follows a structured 4-stage design workflow for UI-heavy features:
+
+**4-Stage Process:**
+1. **Layout** - ASCII wireframe, responsive structure planning (mobile-first)
+2. **Theme** - Design system selection (Tailwind + Flowbite), OKLCH colors, typography
+3. **Animation** - Micro-interactions, timing (<400ms), accessibility (prefers-reduced-motion)
+4. **Implementation** - Single HTML file, semantic markup, saved to `design_iterations/`
+
+**Key Features:**
+- Approval gates at each stage
+- Design versioning (`design_1.html`, `design_1_1.html`, `design_2.html`)
+- Mobile-first responsive design (375px, 768px, 1024px, 1440px)
+- TaskManager auto-detects UI tasks and suggests OpenFrontendSpecialist
+
+**Learn more:** [Frontend Design Workflow Guide](docs/features/frontend-design-workflow.md)
+
+---
+
+## 📋 Task Management & Breakdown
+
+The **TaskManager** breaks complex features into atomic, verifiable subtasks with smart agent suggestions and parallel execution support.
+
+**Key Capabilities:**
+- **Atomic Decomposition** - Tasks completable in 1-2 hours
+- **Dependency Tracking** - Explicit dependencies via `depends_on`
+- **Parallel Execution** - Frontend and backend work simultaneously
+- **Agent Suggestions** - Auto-recommends best agent (e.g., OpenFrontendSpecialist for UI)
+- **Context Boundaries** - Separates standards from source material
+- **CLI Integration** - Status tracking and validation
+
+**Workflow:**
+1. **Plan** - Analyzes feature and creates task breakdown
+2. **Suggest** - Recommends best agent for each task
+3. **Execute** - Agents work with clear context boundaries (parallel where possible)
+4. **Verify** - Validates completion against acceptance criteria
+5. **Track** - CLI shows progress and next available tasks
+
+**Learn more:** [Task Management Guide](docs/features/task-management.md)
+
+---
+
## 🏗️ System Builder (New!)
**Build complete custom AI systems tailored to your domain in minutes.**
@@ -349,156 +488,23 @@ Purpose: Automate order processing and customer support
---
-## Optional Add-ons
-
-### 📱 Telegram Notifications
-Get notified when OpenCode sessions go idle.
-
-```bash
-# Copy plugin directory
-cp -r .opencode/plugin ~/.opencode/
-
-# Install dependencies
-cd ~/.opencode/plugin
-npm install
-
-# Configure
-cd ~/OpenAgentsControl
-cp env.example .env
-# Edit .env with TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID
-```
-
-**Get credentials:** Message @BotFather on Telegram → `/newbot` → Save token
-
-See [`.opencode/plugin/README.md`](.opencode/plugin/README.md) for detailed documentation.
-
-### 🎨 Gemini AI Image Tools
-Generate and edit images using Gemini AI.
-
-```bash
-# Copy tool directory
-cp -r .opencode/tool ~/.opencode/
-
-# Install dependencies
-cd ~/.opencode/tool
-npm install
-
-# Configure
-cd ~/OpenAgentsControl
-cp env.example .env
-# Edit .env with GEMINI_API_KEY
-```
-
-**Get API key:** https://makersuite.google.com/app/apikey
-
-### 🤖 Use with Claude Code (Beta)
-
-> **⚠️ Beta Feature** - This integration allows Claude Code to understand and use OpenAgents Control standards. Works with Claude Code v2.1.6+
-
-OpenAgents Control includes a bridge that makes Claude Code automatically load context files and follow your coding patterns.
-
-
-For This Repository (Contributors)
-
-If you're working **on** this repository and want Claude Code to understand OpenAgents Control:
-
-```bash
-cd /path/to/opencode-agents
-claude
-```
-
-Claude will automatically:
-- Load the `openagents-standards` Skill
-- Use `context-scout` to find relevant context files
-- Apply OpenAgents Control standards to any task
-
-**If it doesn't auto-trigger**, restart Claude Code and start your request with:
-```
-[Use OpenAgents Control standards]
-```
-
-
-
-
-For Your Own OpenAgents Control Projects
-
-If you've set up OpenAgents Control in your own project and want Claude Code support:
-
-```bash
-# One-line installer (recommended)
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/integrations/claude-code/install-claude.sh | bash
-
-# Use with Claude Code
-claude --plugin-dir ~/.claude/plugins/openagents-bridge
-```
-
-**Prereqs**: `git`, `bash`, `node`
-
-**Verify Claude Code**:
-```bash
-claude --version
-```
-
-**Manual install (if you already cloned this repo):**
-```bash
-cd /path/to/opencode-agents/integrations/claude-code
-./install-claude.sh
-```
-
-**How it works:**
-- The installer automatically converts your `.opencode/` files to Claude format
-- Converts agents, subagents, and creates context-scout skill
-- Claude automatically discovers and follows your patterns
-- No duplication - works with your existing OpenAgents Control setup
-
-
-
-
-CLI Reference
-
-| Command | Description |
-|---------|-------------|
-| `claude` | Start interactive session |
-| `claude "request"` | One-shot request |
-| `claude --plugin-dir ~/.claude/plugins/openagents-bridge` | Load with OpenAgents Control plugin |
-| `claude --print-plugins` | Show loaded plugins |
-| `claude --debug` | Debug mode (shows plugin loading) |
-
-**Manual workaround** if plugin doesn't trigger:
-```
-"Load context from .opencode/context/ then help me create a new agent"
-```
-
-
-
----
-
-## Common Questions
+## Advanced Features FAQ
**Q: What's the main way to use this?**
-A: Use `opencode --agent OpenAgent` as your default for general tasks and questions. For complex multi-file coding work, use `opencode --agent OpenCoder`. Both coordinate with specialists as needed.
-
-**Q: Does this work on Windows?**
-A: Yes! Use Git Bash (recommended) or WSL. See [Platform Compatibility Guide](docs/getting-started/platform-compatibility.md) for details.
-
-**Q: What bash version do I need?**
-A: Bash 3.2+ (works on macOS default bash). Run `bash scripts/tests/test-compatibility.sh` to check your system.
-
-**Q: Do I need to install plugins/tools?**
-A: No, they're optional. Only install if you want Telegram notifications or Gemini AI features.
-
-**Q: Where should I install - globally or per-project?**
-A: Global (`~/.opencode/`) works for most. Project-specific (`.opencode/`) if you need different configs per project.
-
-**Q: How do I add my own coding patterns?**
-A: Edit `~/.opencode/context/project/project-context.md` - agents automatically load this file.
-
-**Q: What languages are supported?**
-A: The agents work with any language (TypeScript, Python, Go, Rust, etc.) and adapt based on your project files.
+A: Use `opencode --agent OpenCoder` for building features and production code. For general questions, documentation, or simple tasks, use `opencode --agent OpenAgent`. Both coordinate with specialists as needed.
**Q: What's the Agent System Blueprint for?**
A: It's a teaching document explaining architecture patterns and how to extend the system. See [docs/features/agent-system-blueprint.md](docs/features/agent-system-blueprint.md)
+**Q: How does the frontend design workflow work?**
+A: The frontend-specialist agent follows a 4-stage workflow: Layout (wireframe) → Theme (design system) → Animation (micro-interactions) → Implementation (HTML). Each stage has approval gates. See the [Frontend Design Workflow](#-frontend-design-workflow) section above.
+
+**Q: What's ExternalScout?**
+A: ExternalScout fetches current documentation for external libraries (Tailwind, React, etc.) to prevent outdated training data issues. ContextScout uses it automatically when needed.
+
+**Q: How does task-manager suggest agents?**
+A: The task-manager analyzes each task and sets a `suggested_agent` field. For UI tasks, it suggests frontend-specialist and includes design context files automatically.
+
**Q: Can I use just one command or agent?**
A: Yes! Use the installer's list feature to see all components:
```bash
@@ -516,115 +522,6 @@ curl -o ~/.opencode/agent/core/opencoder.md \
---
-## Installation Profiles
-
-The installer offers five pre-configured profiles:
-
-### 🎯 Essential (Minimal - 23 components)
-Minimal starter kit - universal agent with core subagents.
-- **Agents**: openagent
-- **Subagents**: task-manager, documentation
-- **Commands**: context, clean
-- **Tools**: env
-- **Context**: essential-patterns, project-context
-- **Config**: env-example
-- **Best for**: Learning the system, lightweight tasks, minimal setup
-
-### 💼 Developer (Recommended - 37 components)
-Complete software development environment with code generation, testing, review, build tools, and visual content creation.
-- Everything in Essential, plus:
-- **Agents**: opencoder, frontend-specialist, backend-specialist, devops-specialist, codebase-agent
-- **Subagents**: coder-agent, reviewer, tester, build-agent, codebase-pattern-analyst, image-specialist
-- **Commands**: commit, test, optimize, validate-repo
-- **Tools**: gemini (AI image generation)
-- **Context**: All core standards and workflows, plus visual development (UI styling, design systems, design assets, animation patterns)
-- **Config**: readme
-- **Best for**: Most developers, daily use, full-featured development with visual content creation
-
-### 📊 Business (23 components)
-Business process automation, content creation, and visual workflows.
-- **Agents**: openagent, copywriter, technical-writer, data-analyst
-- **Subagents**: task-manager, documentation, image-specialist
-- **Commands**: context, clean, prompt-enhancer
-- **Tools**: env, gemini (AI image generation)
-- **Context**: essential-patterns, project-context, and all core standards
-- **Config**: env-example, readme
-- **Best for**: Business automation, content creation, non-developers
-
-### 📦 Full (39 components)
-Everything included - all agents, subagents, and tools for maximum functionality.
-- Everything in Developer and Business combined, plus:
-- **Commands**: worktrees (git worktree management), validate-repo
-- **Best for**: Power users, exploring all features
-
-### 🚀 Advanced (48 components)
-Full installation plus **System Builder** for creating custom AI architectures.
-- Everything in Full, plus:
-- **Agents**: system-builder
-- **System Builder Subagents**: domain-analyzer, agent-generator, context-organizer, workflow-designer, command-creator
-- **Commands**: build-context-system
-- **Best for**: Building custom AI systems, contributors, learning the architecture
-
-## Updating Components
-
-Keep your components up to date:
-
-```bash
-# Update all installed components
-./update.sh
-
-# Or re-run the installer
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh | bash
-```
-
----
-
-## Advanced
-
-### Understanding the System
-Read [Agent System Blueprint](docs/features/agent-system-blueprint.md) to learn:
-- How context loading works (the `@` symbol)
-- Agent architecture patterns
-- How to create custom agents and commands
-- How to extend the system for your needs
-
-### Safety & Security
-- **Approval-first workflow** - Agents propose plans before execution
-- **Configurable permissions** - Granular control over agent capabilities
-- **Secure credentials** - Environment variables for sensitive data
-- **Input sanitization** - Protection against injection attacks
-
-### Project Structure
-```
-.opencode/
-├── agent/ # AI agents (category-based)
-│ ├── core/ # Core system agents
-│ │ ├── openagent.md # Universal orchestrator
-│ │ └── opencoder.md # Development specialist
-│ ├── meta/ # Meta-level agents
-│ │ └── system-builder.md # System architect
-│ ├── development/ # Development specialists
-│ │ ├── frontend-specialist.md
-│ │ ├── backend-specialist.md
-│ │ └── devops-specialist.md
-│ ├── content/ # Content creation
-│ │ ├── copywriter.md
-│ │ └── technical-writer.md
-│ ├── data/ # Data & analysis
-│ │ └── data-analyst.md
-│ └── subagents/ # Specialized helpers
-├── command/ # Slash commands
-│ ├── commit.md
-│ └── optimize.md
-├── context/ # Coding patterns
-│ ├── core/ # Essential patterns
-│ └── project/ # Your patterns
-├── plugin/ # Optional: Telegram
-└── tool/ # Optional: Gemini AI
-```
-
----
-
## Contributing
We welcome contributions! Please see our [Contributing Guide](docs/contributing/CONTRIBUTING.md) for details.
@@ -644,38 +541,5 @@ This project is licensed under the MIT License.
---
-## Recommended for New Users
-
-**Start with `OpenAgent`** - your universal coordinator for general tasks, questions, and workflows. It follows a systematic 6-stage workflow (Analyze → Approve → Execute → Validate → Summarize → Confirm) and automatically delegates to specialized subagents when needed.
-
-```bash
-opencode --agent OpenAgent
-> "How do I implement authentication in Next.js?" # Questions
-> "Create a user authentication system" # Simple tasks
-> "Create a README for this project" # Documentation
-```
-
-OpenAgent will guide you through with a plan-first, approval-based approach. For questions, you get direct answers. For tasks, you see the plan before execution.
-
-**For complex coding work**, use `OpenCoder`:
-
-```bash
-opencode --agent OpenCoder
-> "Refactor this codebase to use dependency injection" # Multi-file refactoring
-> "Analyze the architecture and suggest improvements" # Architecture analysis
-```
-
-**Learn more:**
-- [OpenAgent Guide](docs/agents/openagent.md) - General tasks and coordination
-- [OpenCoder Guide](docs/agents/opencoder.md) - Specialized development work
-
----
-## Support & Connect
-
-If this helped you out, I'd love to hear about it!
-
-- **Follow on X**: [@DarrenBuildsAI](https://x.com/DarrenBuildsAI) - I post updates on AI agents and OpenCode workflows.
-- **Support the Work**: [](https://buymeacoffee.com/darrenhinde)
-
-Totally optional, but appreciated.
+**Made with ❤️ by developers, for developers. Star the repo if this helped you ship better code!**
diff --git a/VERSION b/VERSION
index d1d899f..a918a2a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.5.5
+0.6.0
diff --git a/docs/README.md b/docs/README.md
index ceec1ea..221f897 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -87,11 +87,22 @@ docs/
## 💡 Additional Resources
-- **Main README**: [../README.md](../README.md)
+- **Main README**: [../README.md](../README.md) - Complete overview and quick start
+- **CHANGELOG**: [../CHANGELOG.md](../CHANGELOG.md) - Version history and updates
- **GitHub Repository**: https://github.com/darrenhinde/OpenAgentsControl
- **OpenCode CLI Docs**: https://opencode.ai/docs
- **Component Registry**: [../registry.json](../registry.json)
+## 📌 Current Version
+
+**v0.6.0** (January 28, 2026)
+
+Latest updates:
+- ExternalScout subagent for fetching live library documentation (18+ libraries)
+- OpenImplementer agent for lightweight implementation tasks
+- Enhanced ContextScout with multi-model optimization
+- Complete command and agent documentation
+
## 🤝 Community
- **Issues**: [Report bugs or request features](https://github.com/darrenhinde/OpenAgentsControl/issues)
diff --git a/docs/images/hero-image.png b/docs/images/hero-image.png
new file mode 100644
index 0000000..f64fc9c
Binary files /dev/null and b/docs/images/hero-image.png differ
diff --git a/install.sh b/install.sh
index 98479d3..a5187ce 100755
--- a/install.sh
+++ b/install.sh
@@ -522,7 +522,7 @@ show_install_location_menu() {
echo ""
echo " 4) Back / Exit"
echo ""
- read -p "Enter your choice [1-4]: " location_choice
+ read -r -p "Enter your choice [1-4]: " location_choice
case $location_choice in
1)
@@ -537,7 +537,7 @@ show_install_location_menu() {
;;
3)
echo ""
- read -p "Enter installation path: " custom_path
+ read -r -p "Enter installation path: " custom_path
if [ -z "$custom_path" ]; then
print_error "No path entered"
@@ -549,7 +549,7 @@ show_install_location_menu() {
local normalized_path
normalized_path=$(normalize_and_validate_path "$custom_path")
- if [ $? -ne 0 ]; then
+ if ! normalize_and_validate_path "$custom_path" > /dev/null; then
print_error "Invalid path"
sleep 2
show_install_location_menu
@@ -558,7 +558,7 @@ show_install_location_menu() {
if ! validate_install_path "$normalized_path"; then
echo ""
- read -p "Continue anyway? [y/N]: " continue_choice
+ read -r -p "Continue anyway? [y/N]: " continue_choice
if [[ ! $continue_choice =~ ^[Yy] ]]; then
show_install_location_menu
return
@@ -593,12 +593,12 @@ show_main_menu() {
echo " 3) List Available Components"
echo " 4) Exit"
echo ""
- read -p "Enter your choice [1-4]: " choice
+ read -r -p "Enter your choice [1-4]: " choice
case $choice in
1) INSTALL_MODE="profile" ;;
2) INSTALL_MODE="custom" ;;
- 3) list_components; read -p "Press Enter to continue..."; show_main_menu ;;
+ 3) list_components; read -r -p "Press Enter to continue..."; show_main_menu ;;
4) cleanup_and_exit 0 ;;
*) print_error "Invalid choice"; sleep 2; show_main_menu ;;
esac
@@ -675,7 +675,7 @@ show_profile_menu() {
echo " 6) Back to main menu"
echo ""
- read -p "Enter your choice [1-6]: " choice
+ read -r -p "Enter your choice [1-6]: " choice
case $choice in
1) PROFILE="essential" ;;
@@ -743,7 +743,7 @@ show_custom_menu() {
echo " $((${#categories[@]}+3))) Back to main menu"
echo ""
- read -p "Enter category numbers (space-separated) or option: " -a selections
+ read -r -p "Enter category numbers (space-separated) or option: " -a selections
for sel in "${selections[@]}"; do
if [ "$sel" -eq $((${#categories[@]}+1)) ]; then
@@ -807,7 +807,7 @@ show_component_selection() {
done
echo "Enter component numbers (space-separated), 'all' for all, or 'done' to continue:"
- read -a selections
+ read -r -a selections
for sel in "${selections[@]}"; do
if [ "$sel" = "all" ]; then
@@ -834,7 +834,7 @@ show_component_selection() {
resolve_dependencies "$comp"
done
- if [ ${#SELECTED_COMPONENTS[@]} -gt $original_count ]; then
+ if [ ${#SELECTED_COMPONENTS[@]} -gt "$original_count" ]; then
print_info "Added $((${#SELECTED_COMPONENTS[@]} - original_count)) dependencies"
fi
@@ -904,7 +904,7 @@ show_installation_preview() {
print_info "Installing automatically (profile specified)..."
perform_installation
else
- read -p "Proceed with installation? [Y/n]: " confirm
+ read -r -p "Proceed with installation? [Y/n]: " confirm
if [[ $confirm =~ ^[Nn] ]]; then
print_info "Installation cancelled"
@@ -981,14 +981,14 @@ get_install_strategy() {
echo " 3) ${CYAN}Backup & overwrite${NC} - Backup existing files, then install new versions" >&2
echo " 4) ${RED}Cancel${NC} - Exit without making changes" >&2
echo "" >&2
- read -p "Enter your choice [1-4]: " strategy_choice
+ read -r -p "Enter your choice [1-4]: " strategy_choice
case $strategy_choice in
1) echo "skip" ;;
2)
echo "" >&2
print_warning "This will overwrite existing files. Your changes will be lost!"
- read -p "Are you sure? Type 'yes' to confirm: " confirm
+ read -r -p "Are you sure? Type 'yes' to confirm: " confirm
if [ "$confirm" = "yes" ]; then
echo "overwrite"
else
@@ -1104,51 +1104,98 @@ perform_installation() {
continue
fi
- # Convert registry path to installation path
- local dest
- dest=$(get_install_path "$path")
+ # Check if component has additional files (for skills)
+ local files_array
+ files_array=$(jq_exec ".components.${registry_key}[]? | select(.id == \"${id}\") | .files[]?" "$TEMP_DIR/registry.json")
- # Check if file exists before we install (for proper messaging)
- local file_existed=false
- if [ -f "$dest" ]; then
- file_existed=true
- fi
-
- # Check if file exists and we're in skip mode
- if [ "$file_existed" = true ] && [ "$install_strategy" = "skip" ]; then
- print_info "Skipped existing: ${type}:${id}"
- skipped=$((skipped + 1))
- continue
- fi
-
- # Download component
- local url="${RAW_URL}/${path}"
-
- # Create parent directory if needed
- mkdir -p "$(dirname "$dest")"
-
- if curl -fsSL "$url" -o "$dest"; then
- # Transform paths for global installation (any non-local path)
- # Local paths: .opencode or */.opencode
- if [[ "$INSTALL_DIR" != ".opencode" ]] && [[ "$INSTALL_DIR" != *"/.opencode" ]]; then
- # Expand tilde and get absolute path for transformation
- local expanded_path="${INSTALL_DIR/#\~/$HOME}"
- # Transform @.opencode/context/ references to actual install path
- sed -i.bak -e "s|@\.opencode/context/|@${expanded_path}/context/|g" \
- -e "s|\.opencode/context|${expanded_path}/context|g" "$dest" 2>/dev/null || true
- rm -f "${dest}.bak" 2>/dev/null || true
+ if [ -n "$files_array" ]; then
+ # Component has multiple files - download all of them
+ local component_installed=0
+ local component_failed=0
+
+ while IFS= read -r file_path; do
+ [ -z "$file_path" ] && continue
+
+ local dest
+ dest=$(get_install_path "$file_path")
+
+ # Check if file exists and we're in skip mode
+ if [ -f "$dest" ] && [ "$install_strategy" = "skip" ]; then
+ continue
+ fi
+
+ # Download file
+ local url="${RAW_URL}/${file_path}"
+ mkdir -p "$(dirname "$dest")"
+
+ if curl -fsSL "$url" -o "$dest"; then
+ # Transform paths for global installation
+ if [[ "$INSTALL_DIR" != ".opencode" ]] && [[ "$INSTALL_DIR" != *"/.opencode" ]]; then
+ local expanded_path="${INSTALL_DIR/#\~/$HOME}"
+ sed -i.bak -e "s|@\.opencode/context/|@${expanded_path}/context/|g" \
+ -e "s|\.opencode/context|${expanded_path}/context|g" "$dest" 2>/dev/null || true
+ rm -f "${dest}.bak" 2>/dev/null || true
+ fi
+ component_installed=$((component_installed + 1))
+ else
+ component_failed=$((component_failed + 1))
+ fi
+ done <<< "$files_array"
+
+ if [ $component_failed -eq 0 ]; then
+ print_success "Installed ${type}: ${id} (${component_installed} files)"
+ installed=$((installed + 1))
+ else
+ print_error "Failed to install ${type}: ${id} (${component_failed} files failed)"
+ failed=$((failed + 1))
+ fi
+ else
+ # Single file component - original logic
+ local dest
+ dest=$(get_install_path "$path")
+
+ # Check if file exists before we install (for proper messaging)
+ local file_existed=false
+ if [ -f "$dest" ]; then
+ file_existed=true
fi
- # Show appropriate message based on whether file existed before
- if [ "$file_existed" = true ]; then
- print_success "Updated ${type}: ${id}"
- else
- print_success "Installed ${type}: ${id}"
+ # Check if file exists and we're in skip mode
+ if [ "$file_existed" = true ] && [ "$install_strategy" = "skip" ]; then
+ print_info "Skipped existing: ${type}:${id}"
+ skipped=$((skipped + 1))
+ continue
+ fi
+
+ # Download component
+ local url="${RAW_URL}/${path}"
+
+ # Create parent directory if needed
+ mkdir -p "$(dirname "$dest")"
+
+ if curl -fsSL "$url" -o "$dest"; then
+ # Transform paths for global installation (any non-local path)
+ # Local paths: .opencode or */.opencode
+ if [[ "$INSTALL_DIR" != ".opencode" ]] && [[ "$INSTALL_DIR" != *"/.opencode" ]]; then
+ # Expand tilde and get absolute path for transformation
+ local expanded_path="${INSTALL_DIR/#\~/$HOME}"
+ # Transform @.opencode/context/ references to actual install path
+ sed -i.bak -e "s|@\.opencode/context/|@${expanded_path}/context/|g" \
+ -e "s|\.opencode/context|${expanded_path}/context|g" "$dest" 2>/dev/null || true
+ rm -f "${dest}.bak" 2>/dev/null || true
+ fi
+
+ # Show appropriate message based on whether file existed before
+ if [ "$file_existed" = true ]; then
+ print_success "Updated ${type}: ${id}"
+ else
+ print_success "Installed ${type}: ${id}"
+ fi
+ installed=$((installed + 1))
+ else
+ print_error "Failed to install ${type}: ${id}"
+ failed=$((failed + 1))
fi
- installed=$((installed + 1))
- else
- print_error "Failed to install ${type}: ${id}"
- failed=$((failed + 1))
fi
done
@@ -1389,8 +1436,8 @@ main() {
# Apply custom install directory if specified (CLI arg overrides env var)
if [ -n "$CUSTOM_INSTALL_DIR" ]; then
local normalized_path
- normalized_path=$(normalize_and_validate_path "$CUSTOM_INSTALL_DIR")
- if [ $? -eq 0 ]; then
+ if normalize_and_validate_path "$CUSTOM_INSTALL_DIR" > /dev/null; then
+ normalized_path=$(normalize_and_validate_path "$CUSTOM_INSTALL_DIR")
INSTALL_DIR="$normalized_path"
if ! validate_install_path "$INSTALL_DIR"; then
print_warning "Installation path may have issues, but continuing..."
diff --git a/registry.json b/registry.json
index ff8081f..58e3d55 100644
--- a/registry.json
+++ b/registry.json
@@ -38,7 +38,25 @@
"subagent:task-manager",
"subagent:tester"
],
- "category": "standard"
+ "category": "core"
+ },
+ {
+ "id": "openimplementer",
+ "name": "OpenImplementer",
+ "type": "agent",
+ "path": ".opencode/agent/core/openimplementer.md",
+ "description": "Lightweight implementation agent for focused coding tasks with direct execution, self-testing, and specialist review",
+ "tags": [
+ "implementation",
+ "focused-tasks",
+ "direct-execution",
+ "lightweight"
+ ],
+ "dependencies": [
+ "subagent:contextscout",
+ "subagent:reviewer"
+ ],
+ "category": "core"
},
{
"id": "openagent",
@@ -88,46 +106,6 @@
],
"category": "meta"
},
- {
- "id": "codebase-agent",
- "name": "OpenCodebaseAgent",
- "type": "agent",
- "path": ".opencode/agent/development/codebase-agent.md",
- "description": "Multi-language implementation agent for modular and functional development",
- "tags": [],
- "dependencies": [],
- "category": "standard"
- },
- {
- "id": "devops-specialist",
- "name": "OpenDevopsSpecialist",
- "type": "agent",
- "path": ".opencode/agent/development/devops-specialist.md",
- "description": "Expert in CI/CD, infrastructure as code, and deployment automation",
- "tags": [],
- "dependencies": [],
- "category": "development"
- },
- {
- "id": "frontend-specialist",
- "name": "OpenFrontendSpecialist",
- "type": "agent",
- "path": ".opencode/agent/development/frontend-specialist.md",
- "description": "Expert in React, Vue, and modern CSS architecture",
- "tags": [],
- "dependencies": [],
- "category": "development"
- },
- {
- "id": "backend-specialist",
- "name": "OpenBackendSpecialist",
- "type": "agent",
- "path": ".opencode/agent/development/backend-specialist.md",
- "description": "Expert in API design, database architecture, and server-side development",
- "tags": [],
- "dependencies": [],
- "category": "development"
- },
{
"id": "technical-writer",
"name": "OpenTechnicalWriter",
@@ -283,18 +261,24 @@
"category": "standard"
},
{
- "id": "codebase-pattern-analyst",
- "name": "PatternAnalyst",
+ "id": "frontend-specialist",
+ "name": "OpenFrontendSpecialist",
"type": "subagent",
- "path": ".opencode/agent/subagents/code/codebase-pattern-analyst.md",
- "description": "Analyzes and implements codebase patterns",
- "tags": [
- "patterns",
- "analysis",
- "architecture"
- ],
+ "path": ".opencode/agent/subagents/development/frontend-specialist.md",
+ "description": "Expert in React, Vue, and modern CSS architecture",
+ "tags": [],
"dependencies": [],
- "category": "specialized"
+ "category": "development"
+ },
+ {
+ "id": "devops-specialist",
+ "name": "OpenDevopsSpecialist",
+ "type": "subagent",
+ "path": ".opencode/agent/subagents/development/devops-specialist.md",
+ "description": "Expert in CI/CD, infrastructure as code, and deployment automation",
+ "tags": [],
+ "dependencies": [],
+ "category": "development"
},
{
"id": "domain-analyzer",
@@ -373,13 +357,15 @@
"name": "ContextScout",
"type": "subagent",
"path": ".opencode/agent/subagents/core/contextscout.md",
- "description": "Get accurate context FIRST before diving deep—save time, energy, and avoid rework. ContextScout intelligently discovers and retrieves the exact context files you need with precise file paths and line ranges, so you start with the right information instead of guessing.",
+ "version": "5.1.0",
+ "description": "Get accurate context FIRST before diving deep—save time, energy, and avoid rework. ContextScout intelligently discovers and retrieves the exact context files you need with precise file paths and line ranges, so you start with the right information instead of guessing. Optimized for multi-model compatibility (Claude, Gemini, GPT-4) with 20% token reduction.",
"tags": [
"context",
"search",
"discovery",
"navigation",
- "subagent"
+ "subagent",
+ "optimized"
],
"dependencies": [
"command:check-context-deps",
@@ -387,7 +373,29 @@
"context:context-system",
"context:mvi",
"context:structure",
- "context:workflows"
+ "context:workflows",
+ "subagent:externalscout"
+ ],
+ "category": "core"
+ },
+ {
+ "id": "externalscout",
+ "name": "ExternalScout",
+ "type": "subagent",
+ "path": ".opencode/agent/subagents/core/externalscout.md",
+ "version": "2.0.0",
+ "description": "Fetches live, version-specific documentation for external libraries and frameworks using Context7 and other sources. Optimized with 42% token reduction and enhanced references to prompt engineering and context system docs.",
+ "tags": [
+ "external-docs",
+ "libraries",
+ "frameworks",
+ "context7",
+ "subagent",
+ "optimized"
+ ],
+ "dependencies": [
+ "skill:context7",
+ "context:context-system"
],
"category": "core"
},
@@ -613,8 +621,19 @@
"context",
"dependencies"
],
- "dependencies": [
- "subagent:codebase-pattern-analyst"
+ "dependencies": [],
+ "category": "standard"
+ },
+ {
+ "id": "analyze-patterns",
+ "name": "Analyze Patterns",
+ "type": "command",
+ "path": ".opencode/command/analyze-patterns.md",
+ "description": "Analyze codebase for patterns and similar implementations",
+ "tags": [
+ "analysis",
+ "patterns",
+ "refactoring"
],
"category": "standard"
}
@@ -710,7 +729,12 @@
"workflow"
],
"dependencies": [],
- "category": "essential"
+ "category": "essential",
+ "files": [
+ ".opencode/skill/task-management/SKILL.md",
+ ".opencode/skill/task-management/router.sh",
+ ".opencode/skill/task-management/scripts/task-cli.ts"
+ ]
},
{
"id": "smart-router-skill",
@@ -724,7 +748,60 @@
"demo"
],
"dependencies": [],
- "category": "specialized"
+ "category": "specialized",
+ "files": [
+ ".opencode/skill/smart-router-skill/SKILL.md",
+ ".opencode/skill/smart-router-skill/router.sh",
+ ".opencode/skill/smart-router-skill/config/personality-config.json",
+ ".opencode/skill/smart-router-skill/scripts/sherlock-workflow.sh",
+ ".opencode/skill/smart-router-skill/scripts/stark-workflow.sh",
+ ".opencode/skill/smart-router-skill/scripts/yoda-workflow.sh"
+ ]
+ },
+ {
+ "id": "context7",
+ "name": "Context7",
+ "type": "skill",
+ "path": ".opencode/skill/context7/SKILLS.MD",
+ "description": "Fetch live, version-specific documentation for external libraries and frameworks via Context7 API",
+ "tags": [
+ "documentation",
+ "external",
+ "libraries",
+ "api"
+ ],
+ "dependencies": [],
+ "category": "essential",
+ "files": [
+ ".opencode/skill/context7/SKILLS.MD",
+ ".opencode/skill/context7/README.md",
+ ".opencode/skill/context7/library-registry.md",
+ ".opencode/skill/context7/navigation.md"
+ ]
+ },
+ {
+ "id": "context",
+ "name": "Context Manager",
+ "type": "skill",
+ "path": ".opencode/skill/context/SKILL.md",
+ "description": "Comprehensive context management with 8 operations: discover, fetch, harvest, extract, compress, organize, cleanup, and process. Integrates with ContextScout and ExternalScout with lazy loading and clear guidance.",
+ "tags": [
+ "context-management",
+ "discovery",
+ "organization",
+ "cleanup",
+ "external-docs",
+ "lazy-loading"
+ ],
+ "dependencies": [
+ "subagent:contextscout",
+ "subagent:externalscout"
+ ],
+ "category": "essential",
+ "files": [
+ ".opencode/skill/context/SKILL.md",
+ ".opencode/skill/context/router.sh"
+ ]
}
],
"contexts": [
@@ -2527,6 +2604,159 @@
],
"dependencies": [],
"category": "standard"
+ },
+ {
+ "id": "workflows-external-context-management",
+ "name": "External Context Management",
+ "type": "context",
+ "path": ".opencode/context/core/workflows/external-context-management.md",
+ "description": "Complete guide to managing external context: persistence, organization, cleanup, and best practices",
+ "tags": [
+ "external-context",
+ "management",
+ "workflows",
+ "cleanup"
+ ],
+ "dependencies": [],
+ "category": "standard"
+ },
+ {
+ "id": "workflows-external-context-integration",
+ "name": "External Context Integration",
+ "type": "context",
+ "path": ".opencode/context/core/workflows/external-context-integration.md",
+ "description": "Integration guide for external context: how main agents fetch and pass to subagents",
+ "tags": [
+ "external-context",
+ "integration",
+ "workflows",
+ "delegation"
+ ],
+ "dependencies": [
+ "context:workflows-delegation",
+ "context:workflows-external-context-management"
+ ],
+ "category": "standard"
+ },
+ {
+ "id": "external-libraries",
+ "name": "External Libraries Workflow",
+ "type": "context",
+ "path": ".opencode/context/core/workflows/external-libraries.md",
+ "description": "Workflow for handling external library documentation and integration patterns",
+ "tags": [
+ "external-libraries",
+ "workflows",
+ "documentation"
+ ],
+ "category": "standard"
+ },
+ {
+ "id": "visual-development",
+ "name": "Visual Development",
+ "type": "context",
+ "path": ".opencode/context/core/visual-development.md",
+ "description": "Visual development patterns and guidelines",
+ "tags": [
+ "visual",
+ "development",
+ "patterns"
+ ],
+ "category": "standard"
+ },
+ {
+ "id": "development-readme",
+ "name": "Development README",
+ "type": "context",
+ "path": ".opencode/context/development/README.md",
+ "description": "Development context overview and guide",
+ "tags": [
+ "development",
+ "guide"
+ ],
+ "category": "standard"
+ },
+ {
+ "id": "learning-readme",
+ "name": "Learning README",
+ "type": "context",
+ "path": ".opencode/context/learning/README.md",
+ "description": "Learning resources and guides",
+ "tags": [
+ "learning",
+ "guide"
+ ],
+ "category": "standard"
+ },
+ {
+ "id": "product-readme",
+ "name": "Product README",
+ "type": "context",
+ "path": ".opencode/context/product/README.md",
+ "description": "Product context overview and guide",
+ "tags": [
+ "product",
+ "guide"
+ ],
+ "category": "standard"
+ },
+ {
+ "id": "data-readme",
+ "name": "Data README",
+ "type": "context",
+ "path": ".opencode/context/data/README.md",
+ "description": "Data context overview and guide",
+ "tags": [
+ "data",
+ "guide"
+ ],
+ "category": "standard"
+ },
+ {
+ "id": "mastra-ai-readme",
+ "name": "Mastra AI README",
+ "type": "context",
+ "path": ".opencode/context/development/ai/mastra-ai/README.md",
+ "description": "Mastra AI framework documentation and guides",
+ "tags": [
+ "mastra-ai",
+ "ai",
+ "development"
+ ],
+ "category": "standard"
+ },
+ {
+ "id": "context-bundle-template",
+ "name": "Context Bundle Template",
+ "type": "context",
+ "path": ".opencode/context/openagents-repo/templates/context-bundle-template.md",
+ "description": "Template for creating context bundles",
+ "tags": [
+ "template",
+ "context",
+ "bundle"
+ ],
+ "category": "standard"
+ },
+ {
+ "id": "external-libraries-workflow",
+ "name": "External Libraries Workflow",
+ "type": "context",
+ "path": ".opencode/context/openagents-repo/guides/external-libraries-workflow.md",
+ "description": "Guide for fetching current documentation for external packages when adding agents or skills",
+ "tags": [
+ "external-libraries",
+ "workflow",
+ "agents",
+ "skills",
+ "dependencies"
+ ],
+ "dependencies": [
+ "context:external-libraries",
+ "context:adding-agent",
+ "context:adding-skill"
+ ],
+ "category": "standard"
}
],
"config": [
@@ -2592,22 +2822,20 @@
},
"developer": {
"name": "Developer",
- "description": "Complete software development environment with code generation, testing, review, and build tools. Recommended for most developers.",
+ "description": "Complete software development environment with code generation, testing, review, and build tools. Choose OpenImplementer for focused tasks or OpenCoder for complex architecture. Recommended for most developers.",
"badge": "RECOMMENDED",
"components": [
"agent:openagent",
+ "agent:openimplementer",
"agent:opencoder",
- "agent:frontend-specialist",
- "agent:backend-specialist",
- "agent:devops-specialist",
- "agent:codebase-agent",
"subagent:task-manager",
+ "subagent:frontend-specialist",
+ "subagent:devops-specialist",
"subagent:documentation",
"subagent:coder-agent",
"subagent:reviewer",
"subagent:tester",
"subagent:build-agent",
- "subagent:codebase-pattern-analyst",
"subagent:contextscout",
"skill:task-management",
"command:commit",
@@ -2616,6 +2844,7 @@
"command:clean",
"command:optimize",
"command:validate-repo",
+ "command:analyze-patterns",
"tool:env",
"context:essential-patterns",
"context:project-context",
@@ -2665,22 +2894,20 @@
"description": "Everything included - all agents, subagents, tools, and plugins for maximum functionality.",
"components": [
"agent:openagent",
+ "agent:openimplementer",
"agent:opencoder",
"agent:eval-runner",
- "agent:frontend-specialist",
- "agent:backend-specialist",
- "agent:devops-specialist",
- "agent:codebase-agent",
"agent:copywriter",
"agent:technical-writer",
"agent:data-analyst",
"subagent:task-manager",
+ "subagent:frontend-specialist",
+ "subagent:devops-specialist",
"subagent:documentation",
"subagent:coder-agent",
"subagent:reviewer",
"subagent:tester",
"subagent:build-agent",
- "subagent:codebase-pattern-analyst",
"subagent:contextscout",
"skill:task-management",
"subagent:image-specialist",
@@ -2692,6 +2919,7 @@
"command:prompt-enhancer",
"command:worktrees",
"command:validate-repo",
+ "command:analyze-patterns",
"tool:env",
"tool:gemini",
"plugin:notify",
@@ -2713,24 +2941,22 @@
"description": "Full installation plus System Builder for creating custom AI architectures. For power users and contributors.",
"components": [
"agent:openagent",
+ "agent:openimplementer",
"agent:opencoder",
"agent:system-builder",
"agent:repo-manager",
"agent:eval-runner",
- "agent:frontend-specialist",
- "agent:backend-specialist",
- "agent:devops-specialist",
- "agent:codebase-agent",
"agent:copywriter",
"agent:technical-writer",
"agent:data-analyst",
"subagent:task-manager",
+ "subagent:frontend-specialist",
+ "subagent:devops-specialist",
"subagent:documentation",
"subagent:coder-agent",
"subagent:reviewer",
"subagent:tester",
"subagent:build-agent",
- "subagent:codebase-pattern-analyst",
"subagent:image-specialist",
"subagent:context-retriever",
"subagent:contextscout",
@@ -2749,6 +2975,7 @@
"command:worktrees",
"command:build-context-system",
"command:validate-repo",
+ "command:analyze-patterns",
"tool:env",
"tool:gemini",
"plugin:notify",
diff --git a/scripts/external-context/manage-external-context.sh b/scripts/external-context/manage-external-context.sh
new file mode 100755
index 0000000..54e3fdb
--- /dev/null
+++ b/scripts/external-context/manage-external-context.sh
@@ -0,0 +1,259 @@
+#!/bin/bash
+
+# External Context Management Utility
+# Manages cached external documentation in .tmp/external-context/
+
+set -e
+
+EXTERNAL_CONTEXT_DIR=".tmp/external-context"
+MANIFEST_FILE="$EXTERNAL_CONTEXT_DIR/.manifest.json"
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+BLUE='\033[0;34m'
+NC='\033[0m' # No Color
+
+# Helper functions
+print_header() {
+ echo -e "${BLUE}=== $1 ===${NC}"
+}
+
+print_success() {
+ echo -e "${GREEN}✓ $1${NC}"
+}
+
+print_error() {
+ echo -e "${RED}✗ $1${NC}"
+}
+
+print_warning() {
+ echo -e "${YELLOW}⚠ $1${NC}"
+}
+
+# List all cached external context
+list_cache() {
+ print_header "Cached External Context"
+
+ if [ ! -d "$EXTERNAL_CONTEXT_DIR" ]; then
+ print_error "External context directory not found: $EXTERNAL_CONTEXT_DIR"
+ return 1
+ fi
+
+ if [ ! -f "$MANIFEST_FILE" ]; then
+ print_warning "Manifest file not found: $MANIFEST_FILE"
+ return 1
+ fi
+
+ echo ""
+ echo "Manifest:"
+ cat "$MANIFEST_FILE" | jq '.' 2>/dev/null || cat "$MANIFEST_FILE"
+
+ echo ""
+ echo "Cached files:"
+ find "$EXTERNAL_CONTEXT_DIR" -name "*.md" -type f | sort | while read -r file; do
+ size=$(du -h "$file" | cut -f1)
+ modified=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "$file" 2>/dev/null || stat -c "%y" "$file" 2>/dev/null | cut -d' ' -f1-2)
+ echo " $file ($size, modified: $modified)"
+ done
+}
+
+# Show details of a specific cached file
+show_file() {
+ local package=$1
+ local topic=$2
+
+ if [ -z "$package" ] || [ -z "$topic" ]; then
+ print_error "Usage: $0 show "
+ return 1
+ fi
+
+ local file="$EXTERNAL_CONTEXT_DIR/$package/$topic.md"
+
+ if [ ! -f "$file" ]; then
+ print_error "File not found: $file"
+ return 1
+ fi
+
+ print_header "File: $file"
+ echo ""
+ head -20 "$file"
+ echo ""
+ echo "... (showing first 20 lines)"
+}
+
+# Clean up old external context files
+cleanup_old() {
+ local days=${1:-7}
+
+ print_header "Cleaning up external context older than $days days"
+
+ if [ ! -d "$EXTERNAL_CONTEXT_DIR" ]; then
+ print_warning "External context directory not found"
+ return 0
+ fi
+
+ local count=0
+ while IFS= read -r file; do
+ print_warning "Removing: $file"
+ rm "$file"
+ count=$((count + 1))
+ done < <(find "$EXTERNAL_CONTEXT_DIR" -name "*.md" -type f -mtime +"$days")
+
+ if [ "$count" -eq 0 ]; then
+ print_success "No files older than $days days found"
+ else
+ print_success "Removed $count old files"
+ # Update manifest
+ regenerate_manifest
+ fi
+}
+
+# Regenerate manifest from actual files
+regenerate_manifest() {
+ print_header "Regenerating manifest"
+
+ if [ ! -d "$EXTERNAL_CONTEXT_DIR" ]; then
+ print_error "External context directory not found"
+ return 1
+ fi
+
+ # Create new manifest (placeholder for future implementation)
+ # local manifest
+ # manifest="{\"last_updated\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\", \"version\": \"1.0\", \"packages\": {}}"
+
+ # Find all packages and topics
+ find "$EXTERNAL_CONTEXT_DIR" -name "*.md" -type f | grep -v README | while read -r file; do
+ local package
+ local topic
+
+ package=$(basename "$(dirname "$file")")
+ topic=$(basename "$file" .md)
+
+ # Metadata extraction (placeholder for future implementation)
+ # local fetched
+ # local source
+ # local library
+ # local official_docs
+ # fetched=$(stat -f "%Sm" -t "%Y-%m-%dT%H:%M:%SZ" "$file" 2>/dev/null || stat -c "%y" "$file" 2>/dev/null | cut -d' ' -f1-2)
+ # source=$(grep "^source:" "$file" | cut -d: -f2- | xargs)
+ # library=$(grep "^library:" "$file" | cut -d: -f2- | xargs)
+ # official_docs=$(grep "^official_docs:" "$file" | cut -d: -f2- | xargs)
+
+ echo " $package/$topic.md"
+ done
+
+ print_success "Manifest regenerated"
+}
+
+# Delete specific cached file
+delete_file() {
+ local package=$1
+ local topic=$2
+
+ if [ -z "$package" ] || [ -z "$topic" ]; then
+ print_error "Usage: $0 delete "
+ return 1
+ fi
+
+ local file="$EXTERNAL_CONTEXT_DIR/$package/$topic.md"
+
+ if [ ! -f "$file" ]; then
+ print_error "File not found: $file"
+ return 1
+ fi
+
+ print_warning "Deleting: $file"
+ rm "$file"
+
+ # Remove empty directory
+ if [ -z "$(ls -A "$EXTERNAL_CONTEXT_DIR/$package" 2>/dev/null)" ]; then
+ rmdir "$EXTERNAL_CONTEXT_DIR/$package"
+ print_success "Removed empty directory: $EXTERNAL_CONTEXT_DIR/$package"
+ fi
+
+ # Update manifest
+ regenerate_manifest
+ print_success "File deleted and manifest updated"
+}
+
+# Delete entire package cache
+delete_package() {
+ local package=$1
+
+ if [ -z "$package" ]; then
+ print_error "Usage: $0 delete-package "
+ return 1
+ fi
+
+ local dir="$EXTERNAL_CONTEXT_DIR/$package"
+
+ if [ ! -d "$dir" ]; then
+ print_error "Package directory not found: $dir"
+ return 1
+ fi
+
+ print_warning "Deleting entire package: $dir"
+ rm -rf "$dir"
+
+ # Update manifest
+ regenerate_manifest
+ print_success "Package deleted and manifest updated"
+}
+
+# Show usage
+usage() {
+ cat << EOF
+External Context Management Utility
+
+Usage: $0 [options]
+
+Commands:
+ list List all cached external context
+ show Show details of a specific file
+ cleanup-old [days] Remove files older than N days (default: 7)
+ regenerate-manifest Regenerate manifest from actual files
+ delete Delete a specific file
+ delete-package Delete entire package cache
+ help Show this help message
+
+Examples:
+ $0 list
+ $0 show drizzle-orm modular-schemas
+ $0 cleanup-old 7
+ $0 delete drizzle-orm modular-schemas
+ $0 delete-package drizzle-orm
+
+EOF
+}
+
+# Main
+case "${1:-help}" in
+ list)
+ list_cache
+ ;;
+ show)
+ show_file "$2" "$3"
+ ;;
+ cleanup-old)
+ cleanup_old "${2:-7}"
+ ;;
+ regenerate-manifest)
+ regenerate_manifest
+ ;;
+ delete)
+ delete_file "$2" "$3"
+ ;;
+ delete-package)
+ delete_package "$2"
+ ;;
+ help|--help|-h)
+ usage
+ ;;
+ *)
+ print_error "Unknown command: $1"
+ usage
+ exit 1
+ ;;
+esac
diff --git a/scripts/registry/validate-registry.sh b/scripts/registry/validate-registry.sh
index 80606ce..10777d8 100755
--- a/scripts/registry/validate-registry.sh
+++ b/scripts/registry/validate-registry.sh
@@ -127,14 +127,14 @@ validate_component_paths() {
local category=$1
local category_display=$2
- [ "$VERBOSE" = true ] && echo -e "\n${BOLD}Checking ${category_display}...${NC}"
+ echo "Checking ${category_display}..." >&2
# Get all components in this category
local components
components=$(jq -r ".components.${category}[]? | @json" "$REGISTRY_FILE" 2>/dev/null)
if [ -z "$components" ]; then
- [ "$VERBOSE" = true ] && print_info "No ${category_display} found in registry"
+ echo "No ${category_display} found" >&2
return
fi