Stripped the plugin down from ~2000+ lines to ~600 lines to test the core concept.
src/types/index.ts (~120 lines, was ~284)
src/executor/execution-manager.ts (~50 lines, was ~164)
src/executor/index.ts (~240 lines, was ~700)
src/opencode-plugin.ts (~200 lines, was ~380)
src/index.ts (~30 lines, was ~10)
src/plugin.ts - Duplicate implementation (802 lines)src/sdk.ts - SDK wrapper (not needed for core test)examples/test/ability.yaml - Simple 3-step test abilitytest-minimal.ts - Quick validation scriptMINIMAL_TEST.md - Testing guideSIMPLIFICATION_SUMMARY.md - This file✅ Core functionality proven:
$ bun test-minimal.ts
✅ Loaded ability: test
✅ Ability is valid
✅ step1: completed
✅ step2: completed
✅ step3: completed
✅ All tests passed!
Tool Blocking Test
ability.run({ name: "test" })
[while running] bash({ command: "ls" })
Expected: ❌ Tool blocked
Context Injection Test
ability.run({ name: "test" })
[send message while running]
Expected: See "🔄 Active Ability: test"
Status Check Test
ability.status()
Expected: Current step info
tool.execute.before can block toolschat.message hook injects ability stateOnce core is proven, add back incrementally:
Problem: Two plugin implementations with different event handling Solution: Kept one simple implementation, removed session complexity
Problem: Global execution state across all sessions Solution: Simplified to single execution (will add session scoping later)
Problem: Too many features before proving core concept Solution: Stripped to essentials - script steps only
Before:
- types/index.ts: 284 lines
- executor/index.ts: 700 lines
- executor/execution-manager: 164 lines
- opencode-plugin.ts: 380 lines
- plugin.ts: 802 lines (duplicate!)
- sdk.ts: ~200 lines
Total: ~2500+ lines
After:
- types/index.ts: 120 lines
- executor/index.ts: 240 lines
- executor/execution-manager: 50 lines
- opencode-plugin.ts: 200 lines
Total: ~600 lines
76% reduction while keeping all core functionality!
needs)Minimal version is successful if:
3/6 proven in isolation, 3/6 need OpenCode environment
The simplification was successful. We now have a testable minimal implementation that proves the core concept without the complexity of:
Next: Test in OpenCode environment to validate hooks work as expected.