Back to search
owlex
SkillGitHub
Get a second opinion without leaving Claude Code.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Checked today
Badge for your README
Markdown
[](/listings/agentic-mcp-tools--owlex)HTML
<a href="/listings/agentic-mcp-tools--owlex"><img src="/api/listings/agentic-mcp-tools--owlex/badge.svg" alt="findsafeskills safety rating" /></a>Install
i
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
uv tool install git+https://github.com/agentic-mcp-tools/owlex.git
Add to `.mcp.json`:
{
"mcpServers": {
"owlex": {
"command": "owlex-server"
}
}
}What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
README.md · README · 170 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- # Owlex
- [](https://github.com/agentic-mcp-tools/owlex/releases)
- [](LICENSE)
- [](https://python.org)
- [](https://modelcontextprotocol.io)
- **Get a second opinion without leaving Claude Code.**
- Different AI models have different strengths and blind spots. Owlex lets you query Codex, Gemini, OpenCode, ClaudeOR, and AiChat directly from Claude Code - and optionally run a structured deliberation where they review each other's answers before Claude synthesizes a final response.
- 
- ## How the Council Works
- 1. **Round 1** - Your question goes to each agent independently. They answer without seeing each other.
- 2. **Round 2** - Each agent sees all Round 1 answers and can revise their position.
- 3. **Synthesis** - Claude reviews everything and outputs a structured answer.
- Use it for architecture decisions, debugging tricky issues, or when you want more confidence than a single model provides. Not for every question - for the ones that matter.
- ### Data Flow
- 
- ## Installation
- ```bash
- uv tool install git+https://github.com/agentic-mcp-tools/owlex.git
- ```
- Add to `.mcp.json`:
- ```json
- {
- "mcpServers": {
- "owlex": {
- "command": "owlex-server"
- }
- }
- }
- ```
- ## Usage
- ### Council Deliberation
- ```
- council_ask prompt="Should I use a monorepo or multiple repos for 5 microservices?"
- ```
- Options:
- - `claude_opinion` - Share your initial thinking with agents
- - `deliberate` - Enable Round 2 revision (default: true)
- - `critique` - Agents critique each other instead of revise
- - `roles` - Assign specialist roles (dict or list)
- - `team` - Use a predefined team preset
- - `timeout` - Timeout per agent in seconds (default: 300)
- ### Specialist Roles
- Agents can operate with specialist perspectives that shape their analysis:
- | Role | Description |
- |------|-------------|
- | `security` | Security analyst - vulnerabilities, auth, data protection |
- | `perf` | Performance optimizer - efficiency, caching, scalability |
- | `skeptic` | Devil's advocate - challenge assumptions, find edge cases |
- | `architect` | System architect - design patterns, modularity, APIs |
- | `maintainer` | Code maintainer - readability, testing, tech debt |
- | `dx` | Developer experience - ergonomics, documentation, errors |
- | `testing` | Testing specialist - coverage, strategies, edge cases |
- | `neutral` | No role injection (default) |
- **Assign roles explicitly:**
- ```
- council_ask prompt="Review this auth flow" roles={"codex": "security", "gemini": "perf"}
- ```
- **Auto-assign from list (in agent order: codex, gemini, opencode, claudeor, aichat):**
- ```
- council_ask prompt="Review this code" roles=["security", "skeptic", "maintainer"]
- ```
- ### Team Presets
- Predefined role combinations for common scenarios:
- | Team | Codex | Gemini | OpenCode | ClaudeOR | AiChat |
- |------|-------|--------|----------|----------|--------|
- | `security_audit` | security | skeptic | architect | dx | testing |
- | `code_review` | maintainer | perf | testing | dx | security |
- | `architecture_review` | architect | perf | maintainer | dx | skeptic |
- | `devil_advocate` | skeptic | skeptic | skeptic | skeptic | skeptic |
- | `balanced` | security | perf | maintainer | dx | testing |
- | `optimal` | maintainer | architect | dx | skeptic | perf |
- ```
- council_ask prompt="Is this design secure?" team="security_audit"
- ```
- ### Individual Agent Sessions
- | Tool | Description |
- |------|-------------|
- | `start_codex_session` | New Codex session |
- | `resume_codex_session` | Resume with session ID or `--last` |
- | `start_gemini_session` | New Gemini session |
- | `resume_gemini_session` | Resume with index or `latest` |
- | `start_opencode_session` | New OpenCode session |
- | `resume_opencode_session` | Resume with session ID or `--continue` |
- | `start_claudeor_session` | New Claude via OpenRouter session |
- | `resume_claudeor_session` | Resume with session ID or `--continue` |
- | `start_aichat_session` | New AiChat session |
- | `resume_aichat_session` | Resume with session name |
- ### Claude Code Skills
- Non-blocking slash commands for quick agent invocation:
- | Skill | Description |
- |-------|-------------|
- | `/codex` | Ask Codex a question |
- | `/gemini` | Ask Gemini a question |
- | `/council` | Run council deliberation |
- | `/critique` | Run council in critique mode |
- ### Async Task Management
- Council runs in the background. Start a query, keep working, check results later.
- | Tool | Description |
- |------|-------------|
- | `wait_for_task` | Block until task completes |
- | `get_task_result` | Check result without blocking |
- | `list_tasks` | List tasks with status filter |
- | `cancel_task` | Kill running task |
- ## Configuration
- | Variable | Default | Description |
- |----------|---------|-------------|
- | `COUNCIL_EXCLUDE_AGENTS` | `` | Skip agents (e.g., `opencode,gemini,claudeor`) |
- | `COUNCIL_DEFAULT_TEAM` | `` | Default team when none specified (empty = neutral) |
- | `COUNCIL_CLAUDE_OPINION` | `false` | Claude shares its opinion with agents by default |
- | `OWLEX_DEFAULT_TIMEOUT` | `300` | Timeout in seconds |
- | `CODEX_BYPASS_APPROVALS` | `false` | Bypass sandbox (use with caution) |
- | `GEMINI_YOLO_MODE` | `false` | Auto-approve Gemini actions |
- | `OPENCODE_AGENT` | `plan` | `plan` (read-only) or `build` |
- | `OPENROUTER_API_KEY` | `` | OpenRouter API key (enables ClaudeOR agent) |
- | `CLAUDEOR_MODEL` | `` | OpenRouter model for ClaudeOR (e.g., `deepseek/deepseek-v3.2`) |
- | `AICHAT_MODEL` | `` | Model for AiChat (e.g., `openrouter:minimax/minimax-m2.5`) |
- ## Cost Notes
- - **Codex** and **Gemini** use your existing subscriptions (Claude Max, Google AI Pro, etc.)
- - **OpenCode** and **AiChat** use API tokens (provider-dependent)
- - Exclude agents with `COUNCIL_EXCLUDE_AGENTS` to control costs
- - Use council for important decisions, not every question
- ## When to Use Each Agent
- | Agent | Strengths |
- |-------|-----------|
- | **Codex (gpt5.2-codex)** | Deep reasoning, code review, bug finding |
- | **Gemini** | 1M context window, multimodal, large codebases |
- | **OpenCode** | Alternative perspective, configurable models |
- | **ClaudeOR** | Claude Code + OpenRouter (DeepSeek, GPT-4o, etc.) |
- | **AiChat** | Multi-provider (20+ backends), bring-your-own-model flexibility |
- | **Claude** | Complex multi-step implementation, synthesis |
owlex/agents/opencode.py · Bundled script · 253 lines · 2 findings marked
- """
- OpenCode CLI agent runner.
- """
- import asyncio
- import json
- import os
- import re
- from pathlib import Path
- from typing import Callable
- from ..config import config
- from .base import AgentRunner, AgentCommand
- def _get_opencode_project_id(working_directory: str) -> str | None:
- """
- Look up the projectID that OpenCode uses for session storage.
- OpenCode stores sessions in ~/.local/share/opencode/storage/session/<projectID>/
- The projectID is NOT computed from the path - it's stored in project config files
- at ~/.local/share/opencode/storage/project/<projectID>.json
- Returns None if no project found for the given working directory.
- """
- project_dir = Path.home() / ".local" / "share" / "opencode" / "storage" / "project"
- if not project_dir.exists():
- return None
- abs_path = os.path.normpath(os.path.abspath(os.path.expanduser(working_directory)))
- # Scan project files to find one matching our working directory
- try:
- for project_file in project_dir.glob("*.json"):
- if project_file.name == "global.json":
- continue # Skip global project
- try:
- with open(project_file) as f:
- project_data = json.load(f)
- stored_worktree = project_data.get("worktree")
- if not isinstance(stored_worktree, str):
- continue
- normalized_worktree = os.path.normpath(os.path.abspath(os.path.expanduser(stored_worktree)))
- if normalized_worktree == abs_path:
- project_id = project_data.get("id")
- if not isinstance(project_id, str):
- continue
- return project_id
- except (json.JSONDecodeError, OSError, UnicodeDecodeError):
- continue
- except OSError:
- return None
- return None
- async def get_latest_opencode_session(
- working_directory: str | None = None,
- since_mtime: float | None = None,
- max_retries: int = 3,
- retry_delay: float = 0.3,
- ) -> str | None:
- """
- Find the most recent OpenCode session ID from filesystem.
- OpenCode stores sessions in ~/.local/share/opencode/storage/session/<project>/ses_*.json
- The session ID is extracted from the filename (without .json extension).
- Args:
- working_directory: Project directory to scope session search.
- since_mtime: Only consider sessions created after this timestamp.
- max_retries: Number of retries if no session found.
- retry_delay: Delay between retries in seconds.
- Returns:
- Session ID (e.g., ses_49b5d1b81ffeZfa2uTg3NVmKrH) if found, None otherwise
- """
- opencode_dir = Path.home() / ".local" / "share" / "opencode" / "storage" / "session"
- if not opencode_dir.exists():
- return None
- # Require working_directory for project-scoped session discovery
- # Without it, we could accidentally resume a session from a different project
- if not working_directory:
- return None
- # Look up the projectID from OpenCode's config files
- project_id = _get_opencode_project_id(working_directory)
- if not project_id:
- return None # Project not found in OpenCode's registry
- for attempt in range(max_retries):
- latest_file: Path | None = None
- latest_mtime: float = 0
- project_dirs = [opencode_dir / project_id]
- for project_dir in project_dirs:
- if not project_dir.exists():
- continue
- try:
- for session_file in project_dir.glob("ses_*.json"):
- try:
- mtime = session_file.stat().st_mtime
- # Skip files older than since_mtime if specified
- if since_mtime is not None and mtime < since_mtime:
- continue
- if mtime > latest_mtime:
- latest_mtime = mtime
- latest_file = session_file
- except OSError:
- continue
- except OSError:
- continue
- if latest_file is not None:
- # Session ID is the filename without .json extension
- return latest_file.stem
- # Retry with delay if no session found
- # Uses asyncio.sleep to avoid blocking the event loop
- if attempt < max_retries - 1:
- await asyncio.sleep(retry_delay)
- return None
- def clean_opencode_output(raw_output: str, original_prompt: str = "") -> str:
- """Clean OpenCode CLI output by removing noise."""
- if not config.opencode.clean_output:
- return raw_output
- cleaned = raw_output
- # Remove ANSI escape codes
- cleaned = re.sub(r'\x1b\[[0-9;]*m', '', cleaned)
- # Collapse multiple newlines
- cleaned = re.sub(r'\n{3,}', '\n\n', cleaned)
- return cleaned.strip()
- class OpenCodeRunner(AgentRunner):
- """Runner for OpenCode AI coding agent CLI."""
- @property
- def name(self) -> str:
- return "opencode"
- def build_exec_command(
- self,
- prompt: str,
- working_directory: str | None = None,
- enable_search: bool = False, # OpenCode doesn't have web search flag
- **kwargs,
- ) -> AgentCommand:
- """Build command for running OpenCode with a prompt."""
- full_command = ["opencode", "run"]
- # Model configuration (format: provider/model)
- if config.opencode.model:
- full_command.extend(["--model", config.opencode.model])
- # Agent selection (e.g., "build", "plan")
- if config.opencode.agent:
- full_command.extend(["--agent", config.opencode.agent])
- # Output format
- if config.opencode.json_output:
- full_command.extend(["--format", "json"])
- # Use -- to signal end of options, preventing prompt-as-flag injection
- # This ensures prompts starting with - aren't parsed as CLI flags
- # Note: OpenCode doesn't support stdin input, so we must use positional args
- full_command.append("--")
- full_command.append(prompt)
- return AgentCommand(
- command=full_command,
- prompt="", # Prompt is in command as positional arg
- cwd=working_directory,
- output_prefix="OpenCode Output",
- not_found_hint="Please ensure OpenCode is installed (curl -fsSL https://opencode.ai/install | bash).",
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 180 on GitHub
- stream=True,
- )
- def build_resume_command(
- self,
- session_ref: str,
- prompt: str,
- working_directory: str | None = None,
- enable_search: bool = False,
- **kwargs,
- ) -> AgentCommand:
- """Build command for resuming an existing OpenCode session."""
- full_command = ["opencode", "run"]
- # Model configuration
- if config.opencode.model:
- full_command.extend(["--model", config.opencode.model])
- # Agent selection
- if config.opencode.agent:
- full_command.extend(["--agent", config.opencode.agent])
- # Output format
- if config.opencode.json_output:
- full_command.extend(["--format", "json"])
- # Session resume
- if session_ref == "--continue" or session_ref == "latest":
- full_command.append("--continue")
- else:
- # Validate session_ref to prevent flag injection
- if session_ref.startswith("-"):
- raise ValueError(f"Invalid session_ref: '{session_ref}' - cannot start with '-'")
- full_command.extend(["--session", session_ref])
- # Use -- to signal end of options, preventing prompt-as-flag injection
- # Note: OpenCode doesn't support stdin input, so we must use positional args
- full_command.append("--")
- full_command.append(prompt)
- return AgentCommand(
- command=full_command,
- prompt="", # Prompt is in command as positional arg
- cwd=working_directory,
- output_prefix="OpenCode Resume Output",
- not_found_hint="Please ensure OpenCode is installed (curl -fsSL https://opencode.ai/install | bash).",
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 226 on GitHub
- stream=False, # Resume uses non-streaming mode
- )
- def get_output_cleaner(self) -> Callable[[str, str], str]:
- return clean_opencode_output
- async def parse_session_id(
- self,
- output: str,
- since_mtime: float | None = None,
- working_directory: str | None = None,
- ) -> str | None:
- """
- Get session ID for OpenCode.
- OpenCode doesn't output session ID in stdout, so we check the filesystem
- for the most recently created session file.
- Args:
- output: Ignored (OpenCode doesn't output session IDs)
- since_mtime: Only consider sessions created after this timestamp
- working_directory: Project directory to scope session search
- """
- return await get_latest_opencode_session(
- working_directory=working_directory,
- since_mtime=since_mtime,
- )
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.