Skip to content

feat: add OpenCode plugin support (closes #6) - #9

Open
alfasin wants to merge 1 commit into
cytostack:mainfrom
alfasin:main
Open

feat: add OpenCode plugin support (closes #6)#9
alfasin wants to merge 1 commit into
cytostack:mainfrom
alfasin:main

Conversation

@alfasin

@alfasin alfasin commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Add OpenCode plugin support to OpenWolf via a new --opencode flag on openwolf init.

  • Creates OpenCode plugin at .opencode/plugin/openwolf.ts
  • Maps OpenCode's native hooks to OpenWolf's .wolf/ infrastructure
  • Injects OpenWolf protocol into OpenCode's system prompt via experimental.chat.system.transform

Changes

File Change
src/cli/init.ts Add initOpenCode() function, --opencode option handling
src/cli/index.ts Register --opencode CLI option
src/hooks/shared.ts Add projectDir param to getWolfDir(), new wolfDirExists()
tsconfig.json Exclude src/templates/*.ts from compilation
src/templates/opencode-plugin.ts OpenCode plugin implementation
src/templates/opencode-md-snippet.md Template for opencode.md injection

Usage

openwolf init --opencode

This creates:

  • .wolf/ directory with all OpenWolf infrastructure
  • .opencode/plugin/openwolf.ts - the plugin
  • Updates opencode.md with OpenWolf instructions

Add --opencode flag to 'openwolf init' for registering OpenCode plugin
instead of Claude Code hooks.

- Create OpenCode plugin directory with separated modules:
  - types.ts: interfaces for SessionState, FileRead, FileWrite, etc.
  - fs.ts: file system helpers (readJSON, writeJSON, etc.)
  - anatomy.ts: anatomy.md parsing and serialization
  - session.ts: session start handling
  - pre-read.ts: repeated read warnings, anatomy lookups
  - pre-write.ts: cerebrum check, buglog lookup
  - post-read.ts: token estimation
  - post-write.ts: anatomy update, memory append, bug detection
  - stop.ts: session summary, ledger update
  - index.ts: main plugin entry point

- Map OpenCode hooks to OpenWolf infrastructure
- Add opencode-md-snippet.md template
- Update shared.ts with projectDir param + wolfDirExists()
- Exclude plugin directory from tsconfig build

Refactors monolithic 1000-line file into 10 focused modules.

Closes cytostack#6
This was referenced Apr 24, 2026
cytostack added a commit that referenced this pull request Jul 12, 2026
…, #5, #6, #12, #22)

openwolf init --agent <codex|opencode|gemini|cursor|all> wires additional
agents to the same .wolf/ brain:

- adapter registry (src/agents/), architecture from PR #39
- Codex: .codex/hooks.json + config.toml hooks feature + AGENTS.md marker
  block; hooks made provider-agnostic via getProjectDir() (from PR #36)
- OpenCode: native plugin (tool.execute.before/after + session events)
  installed to .opencode/plugin/, from PR #9
- Gemini CLI: GEMINI.md marker block
- Cursor: .cursor/rules/openwolf.mdc (alwaysApply)
- marker blocks are idempotent and preserve user content
- installed agents recorded in .wolf/config.json (openwolf.agents)

Co-authored-by: nottyjay <3240411+nottyjay@users.noreply.github.com>
Co-authored-by: alfasin <1937869+alfasin@users.noreply.github.com>
Co-authored-by: ChasLui <10083758+ChasLui@users.noreply.github.com>
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