Skip to content

Migrate Hive skills to OpenCode-native loading#95

Open
imarshallwidjaja wants to merge 15 commits into
tctinh:mainfrom
imarshallwidjaja:feat/migrate-to-opencode-skills
Open

Migrate Hive skills to OpenCode-native loading#95
imarshallwidjaja wants to merge 15 commits into
tctinh:mainfrom
imarshallwidjaja:feat/migrate-to-opencode-skills

Conversation

@imarshallwidjaja

@imarshallwidjaja imarshallwidjaja commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replace Hive's custom hive_skill surface with OpenCode's native skill tool.
  • Materialize bundled Hive skills into a generated native-skill directory and register that path with OpenCode.
  • Keep autoLoadSkills, but resolve native/user skills first and bundled Hive skills second.
  • Remove the old file-skill fallback and document the native SKILL.md frontmatter contract.

Behavior

  • Hive bundled skills are now normal OpenCode-discovered skills.
  • autoLoadSkills injects either native discovered skills or eligible bundled Hive skills into agent prompts.
  • Skill identity is SKILL.md frontmatter name, not the directory name.
  • Native/user skills shadow bundled Hive skills with the same name.
  • disableSkills only disables bundled Hive skills. It does not block native/user skills.
  • If skills.urls cannot be scanned, bundled Hive skill materialization/autoload is skipped for that run. Local native skills can still load.
  • If OpenCode resolves the worktree as /, generated Hive skills go under the OpenCode config directory instead of /.hive.
  • Bundled skills that reference Hive tools now say Agent Hive in their native descriptions. General skills keep general descriptions.

Notable Changes

  • Added native materialization and discovery handling in packages/opencode-hive/src/skills/native-materializer.ts.
  • Wired generated skill paths and native-first autoload into the OpenCode config hook.
  • Removed packages/opencode-hive/src/skills/file-loader.ts and the old hive_skill plugin tool surface.
  • Updated prompts, permissions, generated skill registry, docs, schema text, and tests for native skill loading.
  • Scoped native skill descriptions only for skills that reference Hive tools or commands, so non-Hive agents get clearer selection signals.
  • Added a safe generated-skill location for root-resolved sessions: ~/.config/opencode/agent-hive/generated/opencode-skills/<hash> or the configured OpenCode config dir equivalent.
  • Fixed the root build script to use @tctinh/agent-hive-mcp instead of the stale hive-mcp workspace filter.

Testing

  • cd packages/hive-core && bun test -> 238 pass, 0 fail
  • cd packages/opencode-hive && bun test -> 475 pass, 0 fail
  • cd packages/opencode-hive && XDG_CONFIG_HOME=/tmp/ci-xdg-config bun test -- src/skills/native-materializer.test.ts -> 26 pass, 0 fail
  • cd packages/opencode-hive && bun test -- src/skills/skill-content.test.ts -> 6 pass, 0 fail
  • bun run build -> PASS (exit 0)
  • bun run test -> PASS (exit 0)

Smoke Test: Bundled Hive Skill

Use this with hive-master on this branch:

Smoke test native Hive skill loading.

From your current system prompt and available tool list only, answer:

parallel-exploration content: present|missing
first heading: <heading or n/a>
hive_skill tool: present|absent
native skill tool: present|absent

Expected:

parallel-exploration content: present
first heading: # Parallel Exploration (Scout Fan-Out)
hive_skill tool: absent
native skill tool: present

This checks that a Hive-bundled skill which used to rely on hive_skill is now exposed through native skill registration and prompt autoload.

Smoke Test: Native User Skill

Create this file:

<project>/.opencode/skills/diagnostic/SKILL.md
---
name: diagnostic-skill
description: Diagnostic skill for native autoload verification
---
# Diagnostic Skill

This content should be visible in the agent system prompt.

Configure:

{
  "agents": {
    "hive-master": {
      "autoLoadSkills": ["diagnostic-skill"]
    }
  }
}

Ask hive-master:

Inspect your current system prompt. Do you see the heading "Diagnostic Skill"? Answer only "present" or "missing".

Expected: present.

Will have conflict after #94 will rebase after that merges

Add OpenCode-compatible frontmatter parsing with schema detection, conflict-safe materialized skill directories in .hive/skills, URL conflict scanning with per-request timeout, and focused materializer tests.
Replace hive_skill prompt/SKILL.md references with native skill wording and regenerate bundled skill registry and tests.
Retry OpenCode-compatible fallback sanitization when initial frontmatter parsing yields non-string skill metadata, so conflict scanning does not skip native skills OpenCode would load.
Config hook calls prepareNativeHiveSkills, generated Hive skill path is inserted before preserved user paths, skills.urls are preserved, and autoload now injects only eligible Hive bundled skill bodies while handing user/native file skills to OpenCode native discovery.
Remove the plugin-defined hive_skill tool, remove agent allow-list entries,
regenerate plugin.json, trim obsolete builtin skill loader exports, and
update hard-cut regression tests.
Delete `file-loader`, remove the export, rewrite autoload coverage for native handoff. Preserve paths/urls, URL-scan failure suppression, and custom subagent delta autoload.
Active docs/schema/types/templates/AGENTS.md updates for generated native skill materialization, `disableSkills` semantics, native user skill handoff, and URL-scan conservative behavior.
Use the MCP package name in the root build filter so verification runs every workspace, and refresh the tracked VS Code bundle generated from the updated default config.
Update active OpenCode Hive docs after the hive_skill hard cut so tool counts and tool-domain summaries reflect the 17 remaining Hive plugin tools.
Updates opencode-hive regression tests to avoid literal removed-tool strings
while preserving absence assertions and enabling the final hard-cut grep to pass.
Remove stale file-skill fallback wording from active OpenCode Hive docs and describe the removed custom skill-loading tool without reintroducing the removed tool literal.
@imarshallwidjaja imarshallwidjaja marked this pull request as ready for review May 5, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant