opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Hot-reload agents, skills and commands.

Open IgorWarzocha opened this issue 9 hours ago • 2 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Allow configs to be invalidated and reloaded while OC is running. This not only enables the users to create new agents/skills/commands and instantly use them, but it also allows the agents themselves to develop these skills or create new agents on the fly and instantly use them (Ralph Loops, anyone?).

Proposal:

  • Watch instance + config directories when hot-reload is enabled.
  • When agent/, skill/, or command/ markdown changes: invalidate cached state and reload immediately.
  • When custom tool .ts/.js changes: re-import with cache busting. (I believe this is a side effect that can be removed)
  • Emit config.updated, skill.updated, command.updated so TUI/Desktop refresh live.

Is it safe? Not necessarily, and is not for everyone. I have a functioning version of it, that is locked behind EXPERIMENTAL_HOT_RELOAD flag. Kept changes to minimum and preserved everything from upstream. https://github.com/IgorWarzocha/opencode/tree/agent-skills-commands-hot-reloading

It works, but there are some caveats - agents would need a create skill/command/agent tool for creating a markdown files that pass the parsing check (if it fails, nothing happens). This is probably the easiest implementation - let agent do the thing, and as a return of the tool call, give it a path to the file and ask it to expand the instructions set and leave the frontmatter alone.

Toast on reload would be a nice addition, but I'm not doing either until I know if there's actually a demand for this.

IgorWarzocha avatar Jan 15 '26 22:01 IgorWarzocha