Weave Multi-Agent Orchestration Plugin

repository·main·Indexed 41 days ago

https://github.com/pgermishuys/opencode-weave

A lean OpenCode plugin for multi-agent orchestration that weaves agents, tools, and skills into structured development workflows. It features specialized agents like Loom and Tapestry for planning, execution, and auditing, and supports Spec-Driven Development (SDD) via the GitHub Spec Kit. Includes a comprehensive evaluation harness for deterministic prompt contracts, live routing, and trajectory-based multi-turn behavior testing.

Tokens
33.6K
Snippets
88
Records
141
Agent score
50%

What's inside Weave

  1. Overview of Weave Agents and Roles

    main

    Weave uses specialized agents to manage different parts of the development lifecycle. These agents are organized into primary orchestrators, category workers, and subagents.

    AgentRoleModeDescription
    Loommain orchestratorprimaryThe central team lead that plans tasks, coordinates work, and delegates to specialized agents.
    Tapestryexecution orchestratorprimaryManages todo-list driven execution of multi-step plans, focusing on sequential implementation without subagent spawning.
    Shuttlecategory workerallDomain-specific specialist worker with full tool access, dispatched dynamically via the category system.
    Patternstrategic plannersubagentAnalyzes requirements and produces detailed implementation plans with research and dependency mapping.
    Threadcodebase explorersubagentFast, read-only codebase navigation and analysis using grep, glob, and read tools.
    Spindleexternal researchersubagentPerforms external documentation lookups and reference searches, providing synthesized answers with source citations.
    Weftreviewer/auditorsubagentReviews completed work and plans with a critical but fair eye, rejecting only for true blocking issues.
    Warpsecurity auditorsubagentAudits code changes for security vulnerabilities and specification compliance with a skeptical bias.
  2. Understand the Weave Agent Hierarchy and Delegation

    main

    Weave uses a multi-agent system where a central orchestrator delegates specialized tasks to specific agents.

    Agent Roles

    • Loom (Main Orchestrator): The primary entry point. It receives user messages and decides which specialist to call.
    • Tapestry (Execution Engine): Triggered by the /start-work command. It executes multi-step plans by delegating individual tasks to Shuttle.
    • Pattern (Strategic Planner): Researches the codebase and writes structured .md plans in .weave/plans/.
    • Thread (Codebase Explorer): A read-only agent for searching and reading code.
    • Spindle (External Researcher): A read-only agent for researching external documentation and APIs.
    • Weft (Reviewer/Auditor): A read-only agent that reviews code or plans for quality and completeness.
    • Warp (Security Auditor): A read-only agent specialized in security audits.
    • Shuttle (Category Specialist): The implementation agent. It performs the actual file writes, edits, and command executions.
  3. Distinguish between Analysis and Review gates

    main

    In the SDD workflow, Analysis is distinct from Review gates:

    • Analysis (Thread, step 8): A mechanical consistency check that finds gaps, conflicts, and coverage holes. It produces a findings report and does NOT block workflow progression. However, the report is an input for the implementation step.
    • Code Review (Weft, step 10): A quality judgment performed after implementation. It assesses correctness, readability, and testing. It CAN block the workflow with a [REJECT] status.
    • Security Review (Warp, step 11): A security audit performed after implementation. It CAN block the workflow with a [REJECT] status.
  4. Organize Weave Plan phases

    main

    To maintain a clean execution flow, organize tasks into the following standard phases:

    PhasePurpose
    Setup (T001–T010)Scaffolding, dependencies, project config, directory structure
    Foundation (T011–T030)Core data models, base components, shared utilities, DB migrations
    User Stories (T031–T080)One group per user story (e.g., grouped by US1, US2, ...)
    Polish (T081–T099)Error handling, edge cases, performance, documentation, cleanup
  5. Understand the Weave Agent System

    main

    Weave orchestrates multi-agent AI workflows using 8 specialized agents. Each agent has a specific role, cost profile, and tool access level. Agents operate in different modes which determine how they resolve their underlying LLM models.

    Agent Roles and Constraints

    AgentRoleModeCostTool Access
    LoomMain orchestrator — plans tasks and delegates across the agent systemprimaryexpensiveFull
    TapestryPlan execution coordinator — delegates each plan task to Shuttle, verifies results, and advances checkboxesprimaryexpensiveFull
    ShuttleTask executor / category specialist — performs delegated implementation workallcheapFull
    PatternStrategic planner — creates .md plan filessubagentexpensiveGuarded (.weave/ only)
    ThreadCodebase explorer — fast search & analysissubagentfreeRead-only
    SpindleExternal researcher — docs & web lookupsubagentfreeRead-only
    WeftReviewer/auditor — approves or rejects worksubagentfreeRead-only
    WarpSecurity auditor — flags vulnerabilities and spec violationssubagentexpensiveRead-only

    Agent Modes

    • primary: Respects the user's UI-selected model (used by Loom, Tapestry).
    • subagent: Uses its own fallback chain and ignores UI selection (used by Pattern, Thread, Spindle, Weft, Warp).
    • all: Available in both primary and subagent contexts (used by Shuttle).

    Key Invariants

    • Pattern is restricted to writing .md files inside the .weave/ directory.
    • Tapestry manages plan execution by delegating tasks to Shuttle and verifying results.
    • Thread, Spindle, Weft, and Warp are strictly read-only (write/edit tools are disabled).
    • Warp operates with a skeptical security bias, rejecting patterns by default.
  6. Artifact Structure for SDD and Weave

    main

    The Spec-Driven Development (SDD) process generates two distinct sets of artifacts to separate specification from execution.

    SDD Specification Artifacts (.specify/)

    These belong to the feature and contain research, requirements, and plans.

    • .specify/memory/constitution.md: Project governance.
    • .specify/features/{slug}/spec.md: Feature specification (FR-001, SC-001 format).
    • .specify/features/{slug}/plan.md: SDD implementation plan.
    • .specify/features/{slug}/tasks.md: Granular task list.
    • .specify/features/{slug}/analysis.md: Consistency findings.
    • .specify/features/{slug}/checklists/requirements.md: FR coverage checklist.
    • .specify/working-spec.json: Shared state tracking current phase and paths.

    Weave Execution Artifacts (.weave/)

    These belong to the execution engine.

    • .weave/plans/{slug}.md: The Tapestry-executable version of the SDD plan.
  7. Understand Weave Agent Tiers and Model Requirements

    main

    Weave agents are categorized into three tiers based on their reasoning requirements. Choosing the correct tier is critical for workflow quality:

    • Top Tier (Loom, Pattern, Warp): Requires the strongest reasoning. These agents make high-level decisions (orchestration, planning, security) that impact the entire workflow. Bad judgment here causes cascading failures.
    • Mid Tier (Tapestry, Weft, Shuttle): Requires good coding ability and comprehension. These agents follow plans and analyze code. They must be reliable and not sloppy.
    • Economy Tier (Thread, Spindle): Requires speed over depth. These agents perform high-volume, low-complexity tasks like codebase searching and web research.
  8. Understand the Weave Configuration Pipeline

    main

    Weave uses a layered configuration system that merges user-level and project-level settings through a 6-phase transformation pipeline.

    Configuration Merging

    Configuration is loaded from two main sources:

    1. User Config: ~/.config/opencode/
    2. Project Config: .opencode/ (within the current project)

    Merge Strategy:

    • Nested objects (e.g., agents, categories): Deep merged; project-level settings override user-level settings.
    • Arrays (e.g., disabled_*): Unioned with deduplication.
    • Scalars: Project-level values take precedence.

    The 6-Phase ConfigHandler Pipeline

    Once merged and validated against the Zod schema, the ConfigHandler processes the configuration in these phases:

    1. Provider Config: Sets up model providers.
    2. Agent Config: Applies overrides and custom display names.
    3. Tool Config: Filters out disabled tools.
    4. MCP Config: Configures Model Context Protocol settings.
    5. Command Config: Remaps agent names for command usage.
    6. Skill Config: Resolves injectable skill fragments.
  9. Understand @opencode_weave/weave Dist-Tags

    main

    The project uses npm dist-tags to separate stable releases from development/preview versions. All prerelease types (e.g., alpha, beta, rc, preview) are published under the next tag.

    | Dist-tag | Used for | Install command |
    |----------|----------|-----------------|
    | `latest` | Stable releases (`0.7.0`) | `npm install @opencode_weave/weave` |
    | `next` | Preview/prerelease versions (`0.7.0-beta.1`) | `npm install @opencode_weave/weave@next` |
  10. Normalize data for the evaluation website

    main

    The evaluation website should perform a single fetch to the canonical suite JSONL and normalize the rows client-side. The expected normalized object shape for the UI is:

    {
      suiteId,
      timestamp,
      modelKey,
      provider,
      model,
      score,
      passedCases,
      totalCases,
      durationMs,
      caseResults: [{ caseId, description, passed, score }]
    }

    Recommended UI Components:

    • Scenario-by-model matrix: Rows represent cases, columns represent models. Primary content shows the latest pass/fail and score; secondary content shows a compact history of the last 6 runs.
  11. How the Weave Hook System governs agent behavior

    main

    Hooks are lifecycle callbacks that allow Weave to enforce governance and automate tasks. They are triggered by specific events and can be conditionally disabled via the disabled_hooks configuration key.

    HookTriggerPurpose
    startWorkchat.message with /start-workParses plans, creates work state, and switches context to Tapestry
    workContinuationsession.idle eventGenerates continuation prompts for incomplete plans
    patternMdOnlytool.execute.before (Pattern)Blocks Pattern from writing files outside .weave/ or using non-.md formats
    contextWindowMonitorchat.messageMonitors token usage (warns at 80%, recovers at 95%)
    writeGuardtool.execute.beforeTracks file reads and validates that writes target known files
    rulesInjectortool.execute.beforeAutomatically loads AGENTS.md, .rules, or CLAUDE.md into context
    keywordDetectorchat.messageDetects specific keywords like ultrawork or ulw
    verificationReminderchat.messageReminds agents to verify their work
    firstMessageVariantchat.messageTracks session state
    contextWindowMonitorchat.messageWarns at 80%, recovers at 95% token usage
  12. How Weave resolves agent models

    main

    When an agent needs a model, Weave resolves the selection using the following priority order:

    1. Config override: The value set at agents.<name>.model in your configuration (highest priority).
    2. UI-selected model: Only applies to Loom, Tapestry, and Shuttle.
    3. Category model: If the agent belongs to a category with a configured model.
    4. Built-in fallback chain: Attempts to match default models against your available models.
    5. System default: The global fallback model.
    6. Hardcoded fallback: github-copilot/claude-opus-4.8 (lowest priority).