# opencode-open-webui-sync Syncs context from opencode sessions into Open WebUI. When a session goes idle, it summarizes what happened using a local vLLM model, writes the result to `AGENTS.md` in the project root, and updates an Open WebUI memory so the context is automatically injected into future conversations. No persistent services required. Memory API replaces the need for a Pipelines filter. ## How it works When an opencode session goes idle: 1. The plugin reads the session transcript via the opencode SDK 2. Sends it to the local vLLM endpoint for summarization 3. Overwrites `## Current State` in `AGENTS.md` and prepends a new `## Session Log` entry 4. Upserts an Open WebUI memory for the project (keyed by git remote repo name, so it works across machines) 5. Shows a toast in opencode when done ## Files | File | Purpose | |---|---| | `owui-sync.ts` | opencode plugin — the main implementation | | `AGENTS.md` | Template to copy into project roots | ## Setup ### 1. Get your Open WebUI API key Open WebUI → Settings → Account → API Keys → create one. ### 2. Add the plugin to `~/.config/opencode/config.json` ```json "plugin": [ ["file:///path/to/opencode-open-webui-sync", { "owui_url": "https://your-owui-host", "owui_token": "sk-your-api-key" }] ] ``` ### 3. Copy AGENTS.md into your project ```bash cp /path/to/opencode-open-webui-sync/AGENTS.md /your/project/AGENTS.md ``` The plugin writes to `{projectDirectory}/AGENTS.md`, wherever opencode is running from. ### 4. Verify it works Run an opencode session, do some work, let it go idle (~30s). Then: ```bash # Check AGENTS.md was updated cat /your/project/AGENTS.md # Watch the plugin log tail -f ~/.local/share/opencode/owui-sync.log ``` ## Plugin options | Option | Default | Description | |---|---|---| | `owui_url` | — | Open WebUI base URL | | `owui_token` | — | Open WebUI API key | | `vllm_url` | `http://10.10.0.12:8000/v1` | vLLM base URL | | `vllm_model` | `qwen3.6` | Model to use for summarization | | `vllm_key` | `token-abc123` | vLLM API key | `owui_url` and `owui_token` are required for memory sync. Without them, only `AGENTS.md` is written. The vLLM options have working defaults for this setup. Override them in config if your endpoint differs. ## Files written by the plugin | Path | Purpose | |---|---| | `{projectDir}/AGENTS.md` | Session context, updated after each session | | `~/.local/share/opencode/owui-sync.log` | Plugin log, capped at 500 lines | | `~/.local/share/opencode/owui-sync-ids.json` | Cache of Open WebUI memory IDs per project | ## AGENTS.md format ```markdown ## Current State - concise bullets describing where the project is right now - overwritten after every session ## Session Log ### YYYY-MM-DD HH:MM — Session title (sessionId) - **Worked on:** ... - **Decisions:** ... - **Done:** ... - **Blockers:** ... - **Next:** ... ``` Anything above `## Current State` (architecture notes, conventions, etc.) is left untouched.