oh-my-opencode-slim

repository·master·Indexed 25 days ago

https://github.com/alvinunreal/oh-my-opencode-slim

A lightweight agent orchestration plugin for OpenCode (version 2.2.8) that uses a team of specialized agents, such as the Orchestrator, Explorer, and Oracle, to automate complex coding tasks. It features bundled skills like codemap for repository mapping, clonedeps for dependency inspection, and simplify for code refactoring, alongside support for terminal multiplexers and MCP integrations.

Tokens
82K
Snippets
146
Records
493
Agent score
93%

What's inside oh-my-opencode-slim

  1. Overview of the clonedeps skill

    master

    clonedeps is a bundled OpenCode workflow skill designed to clone a small set of critical dependency source repositories into a local, git-ignored workspace. This allows AI agents to read library internals directly to improve code understanding and task execution.

    Key Characteristics:

    • Orchestrator-managed: The orchestrator handles git and filesystem operations, while delegating source discovery and URL/ref resolution to @librarian.
    • Safety-first: Instead of using a brittle cross-ecosystem script, the workflow requires approval before performing cloning operations.
    • Local Workspace: Cloned repositories are stored in a dedicated directory that is ignored by your project's git configuration.
  2. Overview of oh-my-opencode-slim responsibilities

    master

    oh-my-opencode-slim is an OpenCode plugin that implements a specialist-agent operating model. Its core responsibilities include:

    • Defining orchestrator and specialist agent factories with permission policies.
    • Loading layered plugin configuration and per-agent permissions.
    • Exposing additional tools and MCP (Model Context Protocol) integrations.
    • Managing background job-board orchestration and terminal multiplexer visualization.
    • Injecting workflow-enforcement hooks and runtime command handlers.
    • Shipping install-time skills and a bootstrap CLI.
  3. Understand the OpenCode lifecycle hooks architecture

    master

    The oh-my-opencode-slim plugin implements OpenCode lifecycle hooks to transform, process, and manage chat messages and attachments. These hooks are integrated into the OpenCode experimental.chat.messages.transform API, allowing the plugin to modify message content before it reaches models or after responses are generated.

    Core Architecture

    • Factory Pattern: Hooks are created using factory functions (e.g., createApplyPatchHook(), createAutoUpdateCheckerHook()) which return a handler matching the OpenCode hook signature.
    • HookRegistry: A central dispatcher (src/hooks/hook-registry.ts) that manages hook registration via registry.register(hookPoint, handler) and dispatching via registry.dispatch().
    • SessionLifecycle: A coordinator (src/hooks/session-lifecycle.ts) that manages cleanup callbacks and pending-session signaling with a timestamp TTL.
    • Message Transformation Pipeline: Hooks operate on the MessageWithParts[] type, enabling the transformation of user messages, assistant responses, and system messages.
  4. Use the Codemap Skill for repository understanding

    master

    The Codemap skill is a custom tool designed to help agents build a high-quality mental model of an unfamiliar codebase. It selects relevant files using LLM judgment, generates hierarchical codemap templates, and tracks changes over time using hashes.

    Codemap is automatically installed by the oh-my-opencode-slim installer when custom skills are enabled.

  5. Understand OpenCode's Loop Engineering implementation status

    master
    OpenCode implements a subset of the five building blocks required for full Loop Engineering. Currently, the project has mature support for Skills, Connectors/MCP, and Sub-agents, with Worktrees available as a skill. The Loop engine (runtime) and Automations (scheduling/triggers) are currently in the design/specification phase and are not yet implemented.
  6. Use the Clonedeps Skill to inspect dependency internals

    master

    The clonedeps skill allows OpenCode to clone important dependency source code into an ignored local workspace (.slim/clonedeps/repos/). This enables the agent to inspect library internals, understand SDK/framework behavior from source, and debug implementation details that are not available via standard documentation or APIs.

    When to use:

    • When you need to understand how a specific dependency works internally.
    • When debugging library implementation details.
    • When you need to see the actual source code of a framework or SDK to solve a task.

    Note: Do not use this for ordinary API or documentation questions; use @librarian for those instead.

  7. Understand the oh-my-opencode-slim architecture

    master

    The plugin is built using several key architectural patterns to integrate with OpenCode:

    • Plugin Pattern: Uses a single exported plugin function to register agents, tools, and MCPs.
    • Facade Pattern: index.ts acts as a central facade composing agents, tools, MCPs, hooks, and the multiplexer.
    • Observer Pattern: Uses OpenCode's event system to respond to session lifecycles, message updates, and tool executions.
    • Strategy Pattern: Employs ForegroundFallbackManager for runtime model selection and fallback.
    • Singleton Pattern: Uses MultiplexerSessionManager to maintain a single instance for task session management.
  8. Understand the Multiplexer Abstraction

    master

    The multiplexer system provides a unified interface to manage terminal panes for OpenCode agent sessions across different terminal multiplexers. It supports tmux, zellij, herdr, cmux, and kitty.

    Key implementations include:

    • TmuxMultiplexer: Uses tmux CLI.
    • ZellijMultiplexer: Uses the zellij plugin API.
    • HerdrMultiplexer: Uses herdr CLI.
    • KittyMultiplexer: Uses kitten @ CLI commands.
    • CmuxMultiplexer: Uses the cmux CLI via UUID surface implementation.
  9. Understand the Simplify skill contract

    master

    The simplify skill provides a behavior-preserving refactoring contract designed for clarity-focused, low-risk code cleanup. It operates through an executable prompt specification defined in SKILL.md which enforces four explicit phases:

    1. Pre-change understanding: Analyzing the code before any edits.
    2. Simplification candidate selection: Identifying specific areas for improvement.
    3. Incremental transformation and verification: Applying changes in small steps and verifying them.
    4. Final review checklist: A concluding validation step.

    This skill is declarative and consumed by the OpenCode skill executor; it does not require local runtime state machines or helper scripts.

  10. Understand the Skill Registry and Categories

    master

    The project uses a metadata-driven approach for OpenCode custom skills. Skills are defined in a central registry and categorized by their purpose and access scope.

    General-purpose skills (available for broad reuse):

    • codemap/: Repository mapping and codebase documentation.
    • clonedeps/: Dependency source mirroring and inspection.
    • simplify/: Readability and maintainability guidance.

    Orchestrator-only skills (reserved for heavy or high-risk workflows):

    • deepwork/: Heavy coding sessions and risky refactors.
    • verification-planning/: Project-specific evidence planning.
    • reflect/: Learning from repeated work.
    • worktrees/: Safe Git worktree lanes for isolated work.
    • oh-my-opencode-slim/: Plugin configuration and self-improvement.
  11. Understand the OpenCode Tool Factory Pattern

    master

    The OpenCode plugin system uses a Tool Factory Pattern. Each tool is implemented as a factory function that returns a ToolDefinition record compatible with the @opencode-ai/plugin SDK.

    Key characteristics:

    • Encapsulation: Tool logic and dependencies are isolated.
    • Composition: Tools are composed in src/tools/index.ts.
    • Testability: Factories accept dependencies as parameters for easy mocking.
    • Type Safety: All tool arguments are validated at runtime using Zod schemas.
  12. Understand the TmuxMultiplexer implementation

    master
    The TmuxMultiplexer provides a concrete implementation of the Multiplexer interface for managing child session panes within a Tmux session. It handles pane spawning, graceful shutdown (via Ctrl+C), and layout management. It is designed to work within an existing Tmux session (detected via the TMUX environment variable) and requires the tmux binary and opencode CLI to be available in your PATH.