Skip to content

feat(plugin): unify KiloCode/OpenCode plugin exports and routing#337

Closed
mikij wants to merge 1 commit intomksglu:nextfrom
mikij:fix/kilocode
Closed

feat(plugin): unify KiloCode/OpenCode plugin exports and routing#337
mikij wants to merge 1 commit intomksglu:nextfrom
mikij:fix/kilocode

Conversation

@mikij
Copy link
Copy Markdown
Contributor

@mikij mikij commented Apr 24, 2026

  • Rename factory to createContextModePlugin and add default { server } export for KiloCode
  • Update routing call to pass platform string instead of hardcoded "opencode"
  • Add compatibility named export ContextModePlugin for OpenCode consumers
  • Adjust tests to verify both default and named exports

BREAKING CHANGE: Plugin consumers using default export must switch from ContextModePlugin(ctx) to { server } shape; named export remains for backward compat.

What / Why / How

Could not get any saving on context

Affected platforms

  • Claude Code
  • Cursor
  • VS Code Copilot (GitHub Copilot)
  • Gemini CLI
  • OpenCode
  • KiloCode
  • Codex CLI
  • OpenClaw (Pi Agent)
  • Kiro
  • Antigravity
  • Zed
  • All platforms

Test plan

added test for "default export has KiloCode PluginModule shape { server }" and renamed old one

Checklist

  • Tests added/updated (TDD: red → green)
  • npm test passes
  • npm run typecheck passes
  • Docs updated if needed (README, platform-support.md)
  • No Windows path regressions (forward slashes only)
  • Targets next branch (unless hotfix)
Cross-platform notes

Our CI runs on Ubuntu, macOS, and Windows.

  • If touching file paths, verify forward-slash normalization on Windows
  • If touching hook paths, verify no backslash separators
  • Use path.join() / path.resolve(), never hardcode / separators
  • Use event-based stdin reading — readFileSync(0) breaks on Windows
  • Use os.tmpdir(), never hardcode /tmp

- Rename factory to `createContextModePlugin` and add default `{ server }` export for KiloCode
- Update routing call to pass platform string instead of hardcoded "opencode"
- Add compatibility named export `ContextModePlugin` for OpenCode consumers
- Adjust tests to verify both default and named exports

BREAKING CHANGE: Plugin consumers using default export must switch from `ContextModePlugin(ctx)` to `{ server }` shape; named export remains for backward compat.
@mksglu
Copy link
Copy Markdown
Owner

mksglu commented Apr 24, 2026

Hi @mikij! Thanks! Why we need that?

@mikij
Copy link
Copy Markdown
Contributor Author

mikij commented Apr 24, 2026

Honestly I asked model to investigate what is wrong with plugin as it does not work for me as I can notice. It found this and now I am trying to figure out if that will help. I managed to work with your example prompt but still in daily use I don't see prompts go through context-mode for me. It could be that KiloCode made. some changes in plugin architecture that is little different than OpenCodes but not sure. If you have any other suggestion to try instead I am open to try.

@mikij
Copy link
Copy Markdown
Contributor Author

mikij commented Apr 24, 2026

And after I did that in my local installation I start seeing report that says there are savings again. Before even I see tool is called ctx stats says nothing has been processed

image

@mksglu
Copy link
Copy Markdown
Owner

mksglu commented Apr 25, 2026

Thanks @mikij — resolved the bundle conflicts and merged to next. Typecheck clean.

We'd appreciate it if you could test the KiloCode/OpenCode plugin routing once we cut the next release. We'll tag you when it's out.

@mksglu mksglu closed this Apr 25, 2026
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.

2 participants