mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
* refactor(config): make on-disk opencode.json the single source of truth Make <workspace>/.config/opencode/opencode.json the only store for the active OpenCode configuration. One owner (opencode-config-file.ts) reads, validates, writes, archives, and seeds the file; one owner (opencode-config-apply.ts) decides how an edit is applied: restart pending, or a live patch with recovery. Settings routes, the internal assistant API, the health-watch supervisor, boot, and host import all go through them, so an edit that lands on the file without going through the database is visible immediately instead of at the next Manager boot. Remove the named-config profiles. Migration 019 archives every opencode_configs row to .config/opencode-configs-archive/<name>.json, restores the default row to opencode.json when no file exists, then drops the table, its indexes, and repos.opencode_config_name. The /opencode-configs* and config/switch routes and the CreateConfigDialog/SwitchConfigDialog dialogs are gone, and the ocm tool gains GET/PUT /opencode-config backed by the same apply owner. Harden the write path: serialize and atomically write config updates while preserving the file mode, keep withFileLock usable after a rejection, route reloadConfig's cleaned-config write through the file owner, stop boot from rewriting an existing valid config when importing state, prune the health-watch directory to its newest 20 entries, resolve archive paths with realpath, and share one frontend config query across dialogs. * fix(mirror): canonicalize worktree paths before branch ownership check * refactor(config): unify opencode config apply and rollback paths - share one config route factory between public and internal mounts - capture last-known-good before every config write and restore via one helper - stop auto-restarting on save; flag restart-required fields and live-patch the rest - add CONFIG_PATCH_TIMEOUT_MS for config patch requests - extract canonicalPath helpers, health-watch artifact writer, and useProvidersWithModels hook * refactor(model-state): use OpenCode state file as model state source of truth
74 lines
4.0 KiB
Markdown
74 lines
4.0 KiB
Markdown
# Assistant Mode
|
|
|
|
Assistant Mode gives OpenCode Manager a dedicated AI workspace — an isolated directory (`repos/assistant/`) where a built-in assistant agent can manage scheduled jobs, send push notifications, and read or update settings through the `ocm` tool.
|
|
|
|
## What Is Assistant Mode?
|
|
|
|
The assistant workspace is a special repository-like directory managed and maintained by OpenCode Manager. When initialized it contains:
|
|
|
|
| File | Purpose |
|
|
|------|---------|
|
|
| `AGENTS.md` | Workspace description the agent reads on every session start |
|
|
| `opencode.json` | OpenCode configuration scoped to the assistant agent |
|
|
| `.opencode/agents/assistant.md` | Agent definition with system prompt and permissions |
|
|
| `.opencode/skills/` | Auto-generated skills teaching the agent to use the `ocm` tool |
|
|
|
|
## Skills Provided
|
|
|
|
Four skills are provisioned automatically when assistant mode is initialized:
|
|
|
|
| Skill | What it teaches |
|
|
|-------|----------------|
|
|
| `schedule-management` | Create, list, update, delete, and run scheduled jobs through the `ocm` `request` action |
|
|
| `notifications` | Send push notifications to registered user devices with the `ocm` `send_notification` action |
|
|
| `manager-settings` | Read and patch user preferences, read and update the OpenCode configuration file, and reload the assistant workspace, through the `ocm` `request` action |
|
|
| `repo-management` | List all managed repositories through the `ocm` `request` action |
|
|
|
|
The assistant manages the Manager's global OpenCode configuration file through the `ocm` tool (`/opencode-config`), and the file on disk is the source of truth.
|
|
|
|
See [Assistant Internal API](assistant-internal-api.md) for the full API reference these skills expose.
|
|
|
|
## Assistant Persona
|
|
|
|
The assistant's system prompt, behavior, and durable preferences live solely in `.opencode/agents/assistant.md`. This file is the single source of truth for the assistant agent's personality and self-editing rules. The `opencode.json` configuration no longer duplicates the agent persona — it only stores agent mode and workspace-level settings.
|
|
|
|
When the assistant self-edits its agent definition (e.g., to refine behavior or add durable preferences), it uses the `manager-settings` skill to call the `POST /assistant/reload` endpoint through the `ocm` `request` action. This disposes the current OpenCode workspace instance so the changes take effect on the next message. The reload endpoint is rate-limited to 5 requests per minute; the assistant always asks the user before reloading.
|
|
|
|
## Getting Started
|
|
|
|
1. Click **Assistant** in the sidebar or mobile tab bar
|
|
2. On first visit, OpenCode Manager initializes the workspace and creates a new session
|
|
3. A welcome prompt is automatically sent to orient the agent
|
|
4. Subsequent visits resume the most recent session
|
|
|
|

|
|
|
|
No manual setup is required. The workspace directory and all managed files are created automatically.
|
|
|
|
## Session Views
|
|
|
|
The assistant page works in two modes:
|
|
|
|
| Mode | URL | What you see |
|
|
|------|-----|-------------|
|
|
| Redirect | `/assistant` | Instantly redirects to the last session or creates one |
|
|
| Session list | `/assistant?view=sessions` | Full session history with sidebar panels |
|
|
|
|
The session list exposes the same management panels as regular repos — file browser, MCP servers, skills, source control, and permissions reset.
|
|
|
|
## Workspace Initialization
|
|
|
|
The workspace is initialized idempotently. Managed files are only rewritten when OpenCode Manager has updated their content. User customizations to managed files are preserved.
|
|
|
|
### Warnings
|
|
|
|
If a managed file was modified after initialization, the next session will receive an inline prompt explaining which files were preserved and what the expected content is. This surfaces configuration drift without silently overwriting your changes.
|
|
|
|
### Re-initializing
|
|
|
|
To re-apply all managed files to their latest defaults:
|
|
|
|
1. Navigate to the session list (`?view=sessions`)
|
|
2. Open the **Permissions** panel
|
|
3. Use the reset action to re-initialize the workspace
|