opencode-hive 0.9.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +10 -0
  2. package/dist/agents/architect.d.ts +12 -0
  3. package/dist/agents/forager.d.ts +12 -0
  4. package/dist/agents/hive.d.ts +6 -24
  5. package/dist/agents/hygienic.d.ts +12 -0
  6. package/dist/agents/index.d.ts +60 -0
  7. package/dist/agents/scout.d.ts +12 -0
  8. package/dist/agents/swarm.d.ts +12 -0
  9. package/dist/background/agent-gate.d.ts +64 -0
  10. package/dist/background/concurrency.d.ts +102 -0
  11. package/dist/background/index.d.ts +27 -0
  12. package/dist/background/manager.d.ts +154 -0
  13. package/dist/background/poller.d.ts +131 -0
  14. package/dist/background/store.d.ts +100 -0
  15. package/dist/background/types.d.ts +239 -0
  16. package/dist/index.js +5196 -2081
  17. package/dist/mcp/ast-grep.d.ts +2 -0
  18. package/dist/mcp/context7.d.ts +2 -0
  19. package/dist/mcp/grep-app.d.ts +2 -0
  20. package/dist/mcp/index.d.ts +2 -0
  21. package/dist/mcp/types.d.ts +12 -0
  22. package/dist/mcp/websearch.d.ts +2 -0
  23. package/dist/skills/builtin.d.ts +1 -1
  24. package/dist/skills/registry.generated.d.ts +1 -1
  25. package/dist/skills/types.d.ts +1 -1
  26. package/dist/tools/background-tools.d.ts +24 -0
  27. package/package.json +7 -1
  28. package/skills/brainstorming/SKILL.md +52 -0
  29. package/skills/dispatching-parallel-agents/SKILL.md +180 -0
  30. package/skills/executing-plans/SKILL.md +76 -0
  31. package/skills/systematic-debugging/SKILL.md +296 -0
  32. package/skills/test-driven-development/SKILL.md +371 -0
  33. package/skills/verification-before-completion/SKILL.md +139 -0
  34. package/skills/writing-plans/SKILL.md +116 -0
  35. package/dist/utils/agent-selector.d.ts +0 -29
  36. package/skills/hive-execution/SKILL.md +0 -60
@@ -0,0 +1,2 @@
1
+ import type { LocalMcpConfig } from './types';
2
+ export declare const astGrepMcp: LocalMcpConfig;
@@ -0,0 +1,2 @@
1
+ import type { RemoteMcpConfig } from './types';
2
+ export declare const context7Mcp: RemoteMcpConfig;
@@ -0,0 +1,2 @@
1
+ import type { RemoteMcpConfig } from './types';
2
+ export declare const grepAppMcp: RemoteMcpConfig;
@@ -0,0 +1,2 @@
1
+ import type { McpConfig } from './types';
2
+ export declare const createBuiltinMcps: (disabledMcps?: string[]) => Record<string, McpConfig>;
@@ -0,0 +1,12 @@
1
+ export type RemoteMcpConfig = {
2
+ type: 'remote';
3
+ url: string;
4
+ headers?: Record<string, string>;
5
+ oauth?: boolean;
6
+ };
7
+ export type LocalMcpConfig = {
8
+ type: 'local';
9
+ command: string[];
10
+ environment?: Record<string, string>;
11
+ };
12
+ export type McpConfig = RemoteMcpConfig | LocalMcpConfig;
@@ -0,0 +1,2 @@
1
+ import type { RemoteMcpConfig } from './types';
2
+ export declare const websearchMcp: RemoteMcpConfig;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Builtin Skills for Hive
3
3
  *
4
- * Following OMO-Slim pattern - skills are loaded from generated registry.
4
+ * Skills are loaded from the generated registry.
5
5
  * This file provides the infrastructure to load builtin skills.
6
6
  */
7
7
  import type { SkillDefinition, SkillLoadResult } from './types.js';
@@ -7,7 +7,7 @@ import type { SkillDefinition } from './types.js';
7
7
  /**
8
8
  * List of builtin skill names.
9
9
  */
10
- export declare const BUILTIN_SKILL_NAMES: readonly ["hive", "hive-execution"];
10
+ export declare const BUILTIN_SKILL_NAMES: readonly ["brainstorming", "dispatching-parallel-agents", "executing-plans", "systematic-debugging", "test-driven-development", "verification-before-completion", "writing-plans"];
11
11
  /**
12
12
  * All builtin skill definitions.
13
13
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Hive Skill System Types
3
3
  *
4
- * Following OMO-Slim pattern for skill definitions.
4
+ * Skill definitions for Hive.
5
5
  */
6
6
  /**
7
7
  * Definition of a skill that can be loaded by agents.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Background task tools for Hive worker delegation.
3
+ *
4
+ * Provides user-facing tools for spawning, monitoring, and cancelling
5
+ * background tasks that execute in separate OpenCode sessions.
6
+ *
7
+ * Tools:
8
+ * - background_task: Spawn a new background task
9
+ * - background_output: Get output from a running/completed task
10
+ * - background_cancel: Cancel running task(s)
11
+ */
12
+ import { type ToolDefinition } from '@opencode-ai/plugin';
13
+ import { BackgroundManager, type OpencodeClient } from '../background/index.js';
14
+ /**
15
+ * Create background task tools.
16
+ *
17
+ * @param manager - The BackgroundManager instance for task lifecycle
18
+ * @param client - OpenCode client for session operations
19
+ */
20
+ export declare function createBackgroundTools(manager: BackgroundManager, client: OpencodeClient): {
21
+ background_task: ToolDefinition;
22
+ background_output: ToolDefinition;
23
+ background_cancel: ToolDefinition;
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-hive",
3
- "version": "0.9.0",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Agent Hive - from vibe coding to hive coding",
6
6
  "license": "MIT WITH Commons-Clause",
@@ -38,6 +38,12 @@
38
38
  "dependencies": {
39
39
  "simple-git": "^3.27.0"
40
40
  },
41
+ "optionalDependencies": {
42
+ "grep-mcp": "^1.1.0",
43
+ "@notprolands/ast-grep-mcp": "^1.1.1",
44
+ "@upstash/context7-mcp": "^2.1.0",
45
+ "exa-mcp-server": "^3.1.5"
46
+ },
41
47
  "devDependencies": {
42
48
  "hive-core": "workspace:*",
43
49
  "@opencode-ai/plugin": "^1.0.143",
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: brainstorming
3
+ description: "Use before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation."
4
+ ---
5
+
6
+ # Brainstorming Ideas Into Designs
7
+
8
+ ## Overview
9
+
10
+ Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
11
+
12
+ Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design in small sections (200-300 words), checking after each section whether it looks right so far.
13
+
14
+ ## The Process
15
+
16
+ **Understanding the idea:**
17
+ - Check out the current project state first (files, docs, recent commits)
18
+ - Ask questions one at a time to refine the idea
19
+ - Prefer multiple choice questions when possible, but open-ended is fine too
20
+ - Only one question per message - if a topic needs more exploration, break it into multiple questions
21
+ - Focus on understanding: purpose, constraints, success criteria
22
+
23
+ **Exploring approaches:**
24
+ - Propose 2-3 different approaches with trade-offs
25
+ - Present options conversationally with your recommendation and reasoning
26
+ - Lead with your recommended option and explain why
27
+
28
+ **Presenting the design:**
29
+ - Once you believe you understand what you're building, present the design
30
+ - Break it into sections of 200-300 words
31
+ - Ask after each section whether it looks right so far
32
+ - Cover: architecture, components, data flow, error handling, testing
33
+ - Be ready to go back and clarify if something doesn't make sense
34
+
35
+ ## After the Design
36
+
37
+ **Documentation:**
38
+ - Write the validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`
39
+ - Commit the design document to git
40
+
41
+ **Implementation (if continuing):**
42
+ - Ask: "Ready to set up for implementation?"
43
+ - Use `hive_skill:writing-plans` to create detailed implementation plan
44
+
45
+ ## Key Principles
46
+
47
+ - **One question at a time** - Don't overwhelm with multiple questions
48
+ - **Multiple choice preferred** - Easier to answer than open-ended when possible
49
+ - **YAGNI ruthlessly** - Remove unnecessary features from all designs
50
+ - **Explore alternatives** - Always propose 2-3 approaches before settling
51
+ - **Incremental validation** - Present design in sections, validate each
52
+ - **Be flexible** - Go back and clarify when something doesn't make sense
@@ -0,0 +1,180 @@
1
+ ---
2
+ name: dispatching-parallel-agents
3
+ description: Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
4
+ ---
5
+
6
+ # Dispatching Parallel Agents
7
+
8
+ ## Overview
9
+
10
+ When you have multiple unrelated failures (different test files, different subsystems, different bugs), investigating them sequentially wastes time. Each investigation is independent and can happen in parallel.
11
+
12
+ **Core principle:** Dispatch one agent per independent problem domain. Let them work concurrently.
13
+
14
+ ## When to Use
15
+
16
+ ```dot
17
+ digraph when_to_use {
18
+ "Multiple failures?" [shape=diamond];
19
+ "Are they independent?" [shape=diamond];
20
+ "Single agent investigates all" [shape=box];
21
+ "One agent per problem domain" [shape=box];
22
+ "Can they work in parallel?" [shape=diamond];
23
+ "Sequential agents" [shape=box];
24
+ "Parallel dispatch" [shape=box];
25
+
26
+ "Multiple failures?" -> "Are they independent?" [label="yes"];
27
+ "Are they independent?" -> "Single agent investigates all" [label="no - related"];
28
+ "Are they independent?" -> "Can they work in parallel?" [label="yes"];
29
+ "Can they work in parallel?" -> "Parallel dispatch" [label="yes"];
30
+ "Can they work in parallel?" -> "Sequential agents" [label="no - shared state"];
31
+ }
32
+ ```
33
+
34
+ **Use when:**
35
+ - 3+ test files failing with different root causes
36
+ - Multiple subsystems broken independently
37
+ - Each problem can be understood without context from others
38
+ - No shared state between investigations
39
+
40
+ **Don't use when:**
41
+ - Failures are related (fix one might fix others)
42
+ - Need to understand full system state
43
+ - Agents would interfere with each other
44
+
45
+ ## The Pattern
46
+
47
+ ### 1. Identify Independent Domains
48
+
49
+ Group failures by what's broken:
50
+ - File A tests: Tool approval flow
51
+ - File B tests: Batch completion behavior
52
+ - File C tests: Abort functionality
53
+
54
+ Each domain is independent - fixing tool approval doesn't affect abort tests.
55
+
56
+ ### 2. Create Focused Agent Tasks
57
+
58
+ Each agent gets:
59
+ - **Specific scope:** One test file or subsystem
60
+ - **Clear goal:** Make these tests pass
61
+ - **Constraints:** Don't change other code
62
+ - **Expected output:** Summary of what you found and fixed
63
+
64
+ ### 3. Dispatch in Parallel
65
+
66
+ ```typescript
67
+ // Using Hive tools for parallel execution
68
+ hive_exec_start({ task: "01-fix-abort-tests" })
69
+ hive_exec_start({ task: "02-fix-batch-tests" })
70
+ hive_exec_start({ task: "03-fix-race-condition-tests" })
71
+ // All three run concurrently in isolated worktrees
72
+ ```
73
+
74
+ ### 4. Review and Integrate
75
+
76
+ When agents return:
77
+ - Read each summary
78
+ - Verify fixes don't conflict
79
+ - Run full test suite
80
+ - Integrate all changes with `hive_merge`
81
+
82
+ ## Agent Prompt Structure
83
+
84
+ Good agent prompts are:
85
+ 1. **Focused** - One clear problem domain
86
+ 2. **Self-contained** - All context needed to understand the problem
87
+ 3. **Specific about output** - What should the agent return?
88
+
89
+ ```markdown
90
+ Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
91
+
92
+ 1. "should abort tool with partial output capture" - expects 'interrupted at' in message
93
+ 2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
94
+ 3. "should properly track pendingToolCount" - expects 3 results but gets 0
95
+
96
+ These are timing/race condition issues. Your task:
97
+
98
+ 1. Read the test file and understand what each test verifies
99
+ 2. Identify root cause - timing issues or actual bugs?
100
+ 3. Fix by:
101
+ - Replacing arbitrary timeouts with event-based waiting
102
+ - Fixing bugs in abort implementation if found
103
+ - Adjusting test expectations if testing changed behavior
104
+
105
+ Do NOT just increase timeouts - find the real issue.
106
+
107
+ Return: Summary of what you found and what you fixed.
108
+ ```
109
+
110
+ ## Common Mistakes
111
+
112
+ **❌ Too broad:** "Fix all the tests" - agent gets lost
113
+ **✅ Specific:** "Fix agent-tool-abort.test.ts" - focused scope
114
+
115
+ **❌ No context:** "Fix the race condition" - agent doesn't know where
116
+ **✅ Context:** Paste the error messages and test names
117
+
118
+ **❌ No constraints:** Agent might refactor everything
119
+ **✅ Constraints:** "Do NOT change production code" or "Fix tests only"
120
+
121
+ **❌ Vague output:** "Fix it" - you don't know what changed
122
+ **✅ Specific:** "Return summary of root cause and changes"
123
+
124
+ ## When NOT to Use
125
+
126
+ **Related failures:** Fixing one might fix others - investigate together first
127
+ **Need full context:** Understanding requires seeing entire system
128
+ **Exploratory debugging:** You don't know what's broken yet
129
+ **Shared state:** Agents would interfere (editing same files, using same resources)
130
+
131
+ ## Real Example from Session
132
+
133
+ **Scenario:** 6 test failures across 3 files after major refactoring
134
+
135
+ **Failures:**
136
+ - agent-tool-abort.test.ts: 3 failures (timing issues)
137
+ - batch-completion-behavior.test.ts: 2 failures (tools not executing)
138
+ - tool-approval-race-conditions.test.ts: 1 failure (execution count = 0)
139
+
140
+ **Decision:** Independent domains - abort logic separate from batch completion separate from race conditions
141
+
142
+ **Dispatch:**
143
+ ```
144
+ Agent 1 → Fix agent-tool-abort.test.ts
145
+ Agent 2 → Fix batch-completion-behavior.test.ts
146
+ Agent 3 → Fix tool-approval-race-conditions.test.ts
147
+ ```
148
+
149
+ **Results:**
150
+ - Agent 1: Replaced timeouts with event-based waiting
151
+ - Agent 2: Fixed event structure bug (threadId in wrong place)
152
+ - Agent 3: Added wait for async tool execution to complete
153
+
154
+ **Integration:** All fixes independent, no conflicts, full suite green
155
+
156
+ **Time saved:** 3 problems solved in parallel vs sequentially
157
+
158
+ ## Key Benefits
159
+
160
+ 1. **Parallelization** - Multiple investigations happen simultaneously
161
+ 2. **Focus** - Each agent has narrow scope, less context to track
162
+ 3. **Independence** - Agents don't interfere with each other
163
+ 4. **Speed** - 3 problems solved in time of 1
164
+
165
+ ## Verification
166
+
167
+ After agents return:
168
+ 1. **Review each summary** - Understand what changed
169
+ 2. **Check for conflicts** - Did agents edit same code?
170
+ 3. **Run full suite** - Verify all fixes work together
171
+ 4. **Spot check** - Agents can make systematic errors
172
+
173
+ ## Real-World Impact
174
+
175
+ From debugging session (2025-10-03):
176
+ - 6 failures across 3 files
177
+ - 3 agents dispatched in parallel
178
+ - All investigations completed concurrently
179
+ - All fixes integrated successfully
180
+ - Zero conflicts between agent changes
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: executing-plans
3
+ description: Use when you have a written implementation plan to execute in a separate session with review checkpoints
4
+ ---
5
+
6
+ # Executing Plans
7
+
8
+ ## Overview
9
+
10
+ Load plan, review critically, execute tasks in batches, report for review between batches.
11
+
12
+ **Core principle:** Batch execution with checkpoints for architect review.
13
+
14
+ **Announce at start:** "I'm using the executing-plans skill to implement this plan."
15
+
16
+ ## The Process
17
+
18
+ ### Step 1: Load and Review Plan
19
+ 1. Read plan file
20
+ 2. Review critically - identify any questions or concerns about the plan
21
+ 3. If concerns: Raise them with your human partner before starting
22
+ 4. If no concerns: Create TodoWrite and proceed
23
+
24
+ ### Step 2: Execute Batch
25
+ **Default: First 3 tasks**
26
+
27
+ For each task:
28
+ 1. Mark as in_progress
29
+ 2. Follow each step exactly (plan has bite-sized steps)
30
+ 3. Run verifications as specified
31
+ 4. Mark as completed
32
+
33
+ ### Step 3: Report
34
+ When batch complete:
35
+ - Show what was implemented
36
+ - Show verification output
37
+ - Say: "Ready for feedback."
38
+
39
+ ### Step 4: Continue
40
+ Based on feedback:
41
+ - Apply changes if needed
42
+ - Execute next batch
43
+ - Repeat until complete
44
+
45
+ ### Step 5: Complete Development
46
+
47
+ After all tasks complete and verified:
48
+ - Announce: "I'm using the finishing-a-development-branch skill to complete this work."
49
+ - **REQUIRED SUB-SKILL:** Use hive_skill:finishing-a-development-branch
50
+ - Follow that skill to verify tests, present options, execute choice
51
+
52
+ ## When to Stop and Ask for Help
53
+
54
+ **STOP executing immediately when:**
55
+ - Hit a blocker mid-batch (missing dependency, test fails, instruction unclear)
56
+ - Plan has critical gaps preventing starting
57
+ - You don't understand an instruction
58
+ - Verification fails repeatedly
59
+
60
+ **Ask for clarification rather than guessing.**
61
+
62
+ ## When to Revisit Earlier Steps
63
+
64
+ **Return to Review (Step 1) when:**
65
+ - Partner updates the plan based on your feedback
66
+ - Fundamental approach needs rethinking
67
+
68
+ **Don't force through blockers** - stop and ask.
69
+
70
+ ## Remember
71
+ - Review plan critically first
72
+ - Follow plan steps exactly
73
+ - Don't skip verifications
74
+ - Reference skills when plan says to
75
+ - Between batches: just report and wait
76
+ - Stop when blocked, don't guess