habithive-code 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,159 @@
1
+ # 05. Spec workflow
2
+
3
+ ## What it is
4
+
5
+ Hive ships a spec workflow built on OpenSpec and a custom schema called `intent-driven`. A change moves through a fixed chain of written artifacts (proposal, specs, design, ADR, tasks) before any code is written, and the agent then implements the task list. `habithive setup` installs everything you need. `habithive spec init` prepares a project to use it.
6
+
7
+ ## Why a spec workflow
8
+
9
+ - The intent (why) is written down before the implementation (how).
10
+ - Behaviour is described as testable GIVEN/WHEN/THEN scenarios, not prose.
11
+ - Long-lived architectural decisions are kept in the repo as ADRs, so the next change can read them.
12
+ - The agent works from a checklist and marks progress, so a session can be resumed.
13
+
14
+ ## OpenSpec is pinned at 1.5.0
15
+
16
+ Setup and update install exactly `@fission-ai/openspec@1.5.0`. A newer install is moved down to it. Newer releases (1.14.x was tested) reject the `intent-driven` schema, because its ADR step writes outside the change folder, and silently fall back to the default `spec-driven` schema. OpenSpec 1.5.0 needs Node.js 20.19 or later, which is why Hive requires it too.
17
+
18
+ The pin moves only with a Hive release. See [../COMPATIBILITY.md](../COMPATIBILITY.md).
19
+
20
+ ## The intent-driven chain
21
+
22
+ ```
23
+ proposal -> specs -> design -> adr -> tasks -> apply
24
+ ```
25
+
26
+ | Step | Produces | Requires | Contents |
27
+ |------|----------|----------|----------|
28
+ | proposal | `proposal.md` | nothing | Why (1-2 sentences), What Changes (mark breaking items **BREAKING**), Capabilities (new and modified, kebab-case names), Impact |
29
+ | specs | `specs/<capability>/spec.md` | proposal | One delta spec per capability. Requirements and scenarios in Gherkin style |
30
+ | design | `design.md` | proposal | Context, Goals / Non-Goals, Decisions (with alternatives), Risks / Trade-offs, Migration Plan, Open Questions |
31
+ | adr | `<repo>/adr/NNNN-title.md` | design | New Architecture Decision Records for long-term decisions |
32
+ | tasks | `tasks.md` | specs, adr | Numbered groups of `- [ ] X.Y` checkbox tasks |
33
+ | apply | code | tasks | Work through pending tasks and tick them off |
34
+
35
+ ### Specs
36
+
37
+ Each spec file is an OpenSpec delta. Use these headings exactly so archive can merge them:
38
+
39
+ - `## ADDED Requirements`, `## MODIFIED Requirements` (paste the full updated requirement, not a partial diff), `## REMOVED Requirements` (needs **Reason** and **Migration**), `## RENAMED Requirements` (`FROM:` / `TO:`).
40
+ - Each requirement is `### Requirement: <name>` and needs at least one scenario.
41
+ - Each scenario is `#### Scenario: <name>` (four hashes) with GIVEN, WHEN and THEN steps, plus AND or BUT for follow-ons.
42
+
43
+ ```markdown
44
+ ## ADDED Requirements
45
+
46
+ ### Requirement: Export as CSV
47
+ Users can export the report table.
48
+
49
+ #### Scenario: Export with rows
50
+ - **GIVEN** a report with three rows
51
+ - **WHEN** the user chooses Export
52
+ - **THEN** a CSV file with a header and three rows is downloaded
53
+ ```
54
+
55
+ Write observable outcomes in THEN steps. Do not create `.feature` files.
56
+
57
+ ### Design
58
+
59
+ Include `design.md` only when it helps: cross-cutting changes, new dependencies or data models, security, performance or migration concerns, or real ambiguity. Before writing, the agent reads the existing ADRs and keeps the design consistent with those in force. If a design needs to revisit an ADR, it lists that under Open Questions rather than editing the ADR.
60
+
61
+ ## ADR rules
62
+
63
+ - ADRs live in the repository's top-level `adr/` folder, beside `openspec/`. Never under `openspec/` and never inside a change folder.
64
+ - File name: `NNNN-kebab-title.md`, a four-digit sequence one higher than the highest in use. Numbers are never reused.
65
+ - ADRs are immutable once accepted. Do not edit a prior ADR: not its status, body or date.
66
+ - To change a decision, write a new ADR with status `accepted, supersedes ADR-NNNN` and a `Supersedes:` field naming the old one. The old ADR stays as history.
67
+ - An ADR is in force unless a later ADR supersedes it. The agent walks the `Supersedes:` links to find the set in force.
68
+ - Only record decisions that are long-term, affect future changes, and are not already covered. If nothing qualifies, no ADR is created.
69
+
70
+ An ADR has: Status, Date, Supersedes, Context and Problem Statement, Considered Options, Decision Outcome, Consequences.
71
+
72
+ ## Set up a project: `habithive spec init`
73
+
74
+ Run it from the project root (or pass a folder):
75
+
76
+ ```bash
77
+ cd my-project
78
+ habithive spec init
79
+ ```
80
+
81
+ It requires the `openspec` command on PATH (`habithive setup` installs it). It then:
82
+
83
+ 1. Runs `openspec init --tools opencode`, creating `openspec/`, the opencode slash commands and skills.
84
+ 2. Copies the `intent-driven` schema into `openspec/schemas/intent-driven/` so it is committed with your code.
85
+ 3. Sets `schema: intent-driven` in `openspec/config.yaml`.
86
+ 4. Runs `openspec schema validate intent-driven` and prints `ok` or `failed`.
87
+
88
+ Then commit `openspec/` and `.opencode/`.
89
+
90
+ If `openspec/config.yaml` already exists, Hive changes nothing. It prints the current schema, and if that is not `intent-driven` it prints how to switch:
91
+
92
+ ```bash
93
+ openspec schema fork intent-driven intent-driven
94
+ # then set `schema: intent-driven` in openspec/config.yaml
95
+ ```
96
+
97
+ ## Slash commands
98
+
99
+ `openspec init --tools opencode` creates these commands in the project's `.opencode/commands/`, in both modes:
100
+
101
+ | Command | Does |
102
+ |---------|------|
103
+ | `/opsx-propose` | Creates a change and generates the artifacts in one step |
104
+ | `/opsx-explore` | Think through an idea or problem before or during a change |
105
+ | `/opsx-apply` | Implements `tasks.md`, ticking checkboxes |
106
+ | `/opsx-sync` | Syncs delta specs into `openspec/specs/` without archiving |
107
+ | `/opsx-archive` | Archives a finished change |
108
+
109
+ There are no global `/opsx` commands. They exist only in projects that have been initialised. Matching skills are created under `.opencode/skills/`.
110
+
111
+ ## Worked example
112
+
113
+ ```text
114
+ /opsx-propose export-report-csv # change folder + proposal, specs, design, tasks
115
+ ```
116
+
117
+ 1. Review `openspec/changes/export-report-csv/proposal.md` and the spec scenarios. Edit them until they say what you want.
118
+ 2. Check `design.md`, and the new file in `adr/` if a long-term decision was made.
119
+ 3. Run `/opsx-apply`. The agent implements tasks and marks `- [ ]` as `- [x]`.
120
+ 4. Validate, then archive:
121
+
122
+ ```bash
123
+ openspec validate export-report-csv --type change --strict
124
+ ```
125
+
126
+ ```text
127
+ /opsx-sync # optional: merge specs now
128
+ /opsx-archive # finish and archive the change
129
+ ```
130
+
131
+ If a change name is ambiguous, `openspec list --json` lists the changes.
132
+
133
+ ## Refresh a project's schema copy
134
+
135
+ Setup and update refresh the user-level schema only. A project keeps its own copy in `openspec/schemas/intent-driven/` and `habithive spec init` will not overwrite it. To take a newer shipped version, replace the project copy with the user-level one and review the diff before committing:
136
+
137
+ ```bash
138
+ cp -R ~/.local/share/openspec/schemas/intent-driven/. openspec/schemas/intent-driven/
139
+ ```
140
+
141
+ ## Where the user-level schema lives
142
+
143
+ Setup and update install the schema to OpenSpec's data directory so every project can resolve it:
144
+
145
+ | Platform | Path |
146
+ |----------|------|
147
+ | macOS, Linux | `~/.local/share/openspec/schemas/intent-driven/` |
148
+ | With `XDG_DATA_HOME` set | `$XDG_DATA_HOME/openspec/schemas/intent-driven/` |
149
+ | Windows | `%LOCALAPPDATA%\openspec\schemas\intent-driven\` |
150
+
151
+ Hive owns this folder. If you edited it, setup moves your copy to `~/.habithive/schema-backups/intent-driven-<timestamp>` before installing the shipped one. Make lasting changes in a project copy instead.
152
+
153
+ ## Related
154
+
155
+ - [06-agents-skills-tools.md](06-agents-skills-tools.md)
156
+ - [07-updates-and-versions.md](07-updates-and-versions.md)
157
+ - [09-troubleshooting.md](09-troubleshooting.md)
158
+ - [../COMPATIBILITY.md](../COMPATIBILITY.md)
159
+ - [README.md](README.md)
@@ -0,0 +1,97 @@
1
+ # 06. Agents, skills and tools
2
+
3
+ ## What it is
4
+
5
+ In complex mode Hive runs opencode with oh-my-openagent, which adds named agents and task categories. Hive also installs two skills and three tools (graphify, Playwright MCP, OpenSpec). All of this is installed by `habithive setup`. Hive does not bundle opencode or oh-my-openagent; it installs them from their official sources.
6
+
7
+ ## Agents
8
+
9
+ oh-my-openagent has four main agents and seven subagents. Hive's model tree (`/hive-models`) lists exactly these.
10
+
11
+ Main agents are primary modes. You switch between them in the TUI and they use the model selected on screen.
12
+
13
+ | Agent | Role |
14
+ |-------|------|
15
+ | `sisyphus` | Ultraworker, the default orchestrating agent |
16
+ | `prometheus` | Plan builder |
17
+ | `atlas` | Plan executor |
18
+ | `hephaestus` | Deep worker, GPT models only |
19
+
20
+ Subagents are started by other agents through tasks. Each has its own model in `~/.config/opencode/oh-my-openagent.json`.
21
+
22
+ | Agent | Role |
23
+ |-------|------|
24
+ | `oracle` | Deep reasoning and debugging |
25
+ | `explore` | Codebase search |
26
+ | `librarian` | External documentation |
27
+ | `multimodal-looker` | Images and visual input |
28
+ | `metis` | Plan consultant |
29
+ | `momus` | Plan critic |
30
+ | `sisyphus-junior` | Worker |
31
+
32
+ ## Categories
33
+
34
+ Categories are task tiers. An agent delegating work picks a category, and the category decides the model. oh-my-openagent defines eight:
35
+
36
+ `ultrabrain`, `deep`, `quick`, `visual-engineering`, `artistry`, `writing`, `unspecified-low`, `unspecified-high`.
37
+
38
+ Model precedence in the tree: agent override, then category override, then the "everything" override, then your baseline. See [03-model-tree.md](03-model-tree.md).
39
+
40
+ ## GPT rules
41
+
42
+ oh-my-openagent enforces two rules through its own hooks. Hive does not change them. It warns you before a relaunch if your chosen model will be rerouted.
43
+
44
+ | Agent | Rule |
45
+ |-------|------|
46
+ | Sisyphus | Cannot use older GPT models. Models from `gpt-5.4` upward and the `gpt-5.x-codex` models are accepted. Otherwise the session is switched to Hephaestus. |
47
+ | Hephaestus | Requires a GPT model. With a non-GPT model it shows an error and the session returns to Sisyphus (oh-my-openagent 4.19.1). It is also absent from the agent list. |
48
+
49
+ To allow a non-GPT model on Hephaestus, set `agents.hephaestus.allow_non_gpt_model: true` in `oh-my-openagent.json`. Hive reads this setting and then does not warn. See [../COMPATIBILITY.md](../COMPATIBILITY.md) (finding 12).
50
+
51
+ ## Bundled skills
52
+
53
+ Setup copies the skills in the package's `skills/` folder to `~/.config/opencode/skills/`, replacing earlier copies. oh-my-openagent loads them in complex mode.
54
+
55
+ | Skill | For | Triggers |
56
+ |-------|-----|----------|
57
+ | `karpathy-guidelines` | Reducing common LLM coding mistakes: avoid overcomplication, make surgical changes, state assumptions, define verifiable success criteria | When the agent writes, reviews or refactors code (matched by its description) |
58
+ | `graphify` | Turning code, docs, papers, images or video into a knowledge graph, and answering codebase questions from it | `/graphify`, or any codebase question, especially when `graphify-out/` exists |
59
+
60
+ `karpathy-guidelines` is bundled unmodified under the MIT licence from the andrej-karpathy-skills project.
61
+
62
+ ## graphify CLI
63
+
64
+ The `graphify` skill drives the `graphify` command-line tool, published on PyPI as `graphifyy`. Setup installs it with `uv tool install --upgrade graphifyy`, or with `pip install -U graphifyy` when `uv` is missing. If `uv` already manages it, setup runs `uv tool upgrade graphifyy`. It builds an interactive HTML graph, a JSON graph and a `GRAPH_REPORT.md`.
65
+
66
+ ```text
67
+ /graphify # graph of the current folder
68
+ /graphify <path> --update # re-extract only changed files
69
+ ```
70
+
71
+ The skill was written for Claude Code's subagent runtime and may need tuning under opencode.
72
+
73
+ ## Playwright MCP
74
+
75
+ Gives agents a real browser to open pages, click, fill forms and take screenshots. Setup adds this entry to `mcp` in `opencode.jsonc` (in each mode's config) if it is not there:
76
+
77
+ ```json
78
+ "playwright": { "type": "local", "enabled": true, "command": "npx", "args": ["@playwright/mcp@latest"] }
79
+ ```
80
+
81
+ An existing entry is kept as you wrote it. The package is fetched by `npx` on first use.
82
+
83
+ ## OpenSpec CLI
84
+
85
+ Installed at the pinned version 1.5.0, with the `intent-driven` schema. See [05-spec-workflow.md](05-spec-workflow.md).
86
+
87
+ ## Licences and credits
88
+
89
+ Hive installs opencode, oh-my-openagent, OpenSpec, graphify and Playwright MCP from their official sources under their own licences. Bundled skills and their licence texts are listed in [../../THIRD-PARTY-NOTICES.md](../../THIRD-PARTY-NOTICES.md). Project overview: [../../README.md](../../README.md).
90
+
91
+ ## Related
92
+
93
+ - [02-modes.md](02-modes.md)
94
+ - [03-model-tree.md](03-model-tree.md)
95
+ - [05-spec-workflow.md](05-spec-workflow.md)
96
+ - [08-files-and-safety.md](08-files-and-safety.md)
97
+ - [README.md](README.md)
@@ -0,0 +1,115 @@
1
+ # Updates and versions
2
+
3
+ ## What it is
4
+
5
+ Hive is tested against specific versions of opencode, oh-my-openagent and OpenSpec. A Hive release pins those versions, and `habithive update` brings your machine to the release you install. Hive also checks once a day for a newer release and tells you inside opencode. Nothing updates on its own.
6
+
7
+ ## The daily update check
8
+
9
+ When the Hive plugin loads, it reads a cache (`~/.habithive/update-check.json`). If a newer release is known, opencode shows a toast: `habithive v<version> available — quit and run habithive update`. At most one such toast appears per process.
10
+
11
+ The cache refreshes in the background from the public npm registry when the last success is over 24 hours old and the last attempt over 1 hour old. The check has a 3-second timeout, never blocks startup and is silent on failure.
12
+
13
+ ## `habithive update`
14
+
15
+ Quit opencode first, then run:
16
+
17
+ ```bash
18
+ habithive update
19
+ ```
20
+
21
+ Steps:
22
+
23
+ 1. Checks npm for the latest `habithive-code`.
24
+ 2. If it is newer than the installed version, runs `npm i -g habithive-code@latest`. If npm is unreachable it says so and reconciles the installed version. If the install fails, check npm's global prefix permissions and retry.
25
+ 3. Runs the **new version's** `reconcile --yes` so its pins apply, not the old ones.
26
+ 4. Prints `restart opencode to load habithive v<version>`.
27
+
28
+ Update keeps your mode, model overrides and config. It does not record a mode or rename files.
29
+
30
+ If you run Hive from a source checkout, `habithive update` does not overwrite it from npm. It prints `update it with: git -C <path> pull && habithive update` and reconciles the checkout.
31
+
32
+ ## `habithive reconcile`
33
+
34
+ Reconcile is `setup` without the mode change. It is hidden from `--help` and is what `update` runs. Use it after pulling a source checkout or when you want to re-apply pins:
35
+
36
+ ```bash
37
+ habithive reconcile # prompts before installing opencode if it is missing
38
+ habithive reconcile --yes # no prompts
39
+ ```
40
+
41
+ It runs these steps, applied to **every mode set that exists** (see [02-modes.md](02-modes.md)):
42
+
43
+ | Step | Action |
44
+ |------|--------|
45
+ | 1 | Install opencode at the pin, or move an existing 1.x install to it with `opencode upgrade <pin>` |
46
+ | 2 | Wire the Hive plugin (both sets) and oh-my-openagent (complex set only); replace stale entries |
47
+ | 3 | Set `autoupdate: false` in each `opencode.jsonc` |
48
+ | 4 | Reset Hive-owned OmniRoute values in each set ([04-omniroute.md](04-omniroute.md)) |
49
+ | 5 | Add the Playwright MCP server if absent |
50
+ | 6 | Install OpenSpec at its pin and the intent-driven schema |
51
+ | 7 | Install or upgrade graphify |
52
+ | 8 | Copy the bundled skills into `~/.config/opencode/skills/` |
53
+
54
+ ## Pinned versions
55
+
56
+ These are set in `src/versions.js` and move only with a Hive release.
57
+
58
+ | Tool | Constant | Value |
59
+ |------|----------|-------|
60
+ | opencode | `OPENCODE_PIN` | 1.19.4 |
61
+ | oh-my-openagent | `OMO_SPEC` | `oh-my-openagent@4.19.1` |
62
+ | OpenSpec | `OPENSPEC_PIN` | 1.5.0 |
63
+ | Node.js | `NODE_MIN` | 20.19.0 (minimum, not an exact pin) |
64
+
65
+ Why they are pinned: oh-my-openagent 5.x moves the config file Hive manages, and newer OpenSpec releases reject the intent-driven schema. The test evidence for each pin is in [../COMPATIBILITY.md](../COMPATIBILITY.md).
66
+
67
+ ### What floats
68
+
69
+ | Tool | Behavior |
70
+ |------|----------|
71
+ | graphify | Upgraded to the latest release by `update` and `reconcile` (via `uv`, else `pip`) |
72
+ | Playwright MCP | Wired as `@playwright/mcp@latest`; npx fetches the current version |
73
+
74
+ ## Why `autoupdate` is false
75
+
76
+ Hive writes `"autoupdate": false` in `opencode.jsonc` in both mode sets. opencode therefore never upgrades itself to a version Hive has not tested. opencode moves only when you run `habithive update` or `habithive setup`.
77
+
78
+ ## Drift warnings
79
+
80
+ If the opencode on your machine differs from `OPENCODE_PIN`, Hive warns:
81
+
82
+ - At launch (shell): `opencode <version> is not the tested 1.19.4 — run: habithive update`
83
+ - Inside opencode, if started without the launcher: a toast saying the same.
84
+
85
+ The launch still continues. Run `habithive update` to move to the pin.
86
+
87
+ ## OpenCode 2 guard
88
+
89
+ Hive needs OpenCode 1. On OpenCode 2, complex mode and the model tree do not work. If Hive detects a different major version it prints a red notice at launch, in `habithive status`, and during `setup`/`update`, then continues. It does not try to downgrade (OpenCode 2 cannot be downgraded with `opencode upgrade`).
90
+
91
+ Recovery depends on how you installed OpenCode 2. Hive detects the method and prints one of these:
92
+
93
+ ```bash
94
+ # npm
95
+ npm rm -g @opencode/cli
96
+ habithive setup
97
+
98
+ # Homebrew
99
+ brew uninstall opencode-v2
100
+ habithive setup
101
+
102
+ # curl installer
103
+ curl -fsSL https://opencode.ai/install | bash -s -- --version 1.19.4
104
+ ```
105
+
106
+ If the method is not detected, Hive lists all three. Sessions created under OpenCode 2 may not open in OpenCode 1.
107
+
108
+ ## Related
109
+
110
+ - [01-getting-started.md](01-getting-started.md)
111
+ - [02-modes.md](02-modes.md): both mode sets receive updates
112
+ - [../COMPATIBILITY.md](../COMPATIBILITY.md): test evidence for each pin
113
+ - [../../CHANGELOG.md](../../CHANGELOG.md)
114
+ - [09-troubleshooting.md](09-troubleshooting.md)
115
+ - [Guide index](README.md)
@@ -0,0 +1,83 @@
1
+ # 8. Files and safety
2
+
3
+ ## What it is
4
+
5
+ This chapter lists every file and folder Hive reads or writes, the guarantees around those writes, and how to remove Hive completely. Paths use `~` for your home directory.
6
+
7
+ ## Files Hive writes
8
+
9
+ ### opencode config (`~/.config/opencode/`)
10
+
11
+ | File | Written by | What changes |
12
+ |------|------------|--------------|
13
+ | `opencode.jsonc` | setup, update, `--gateway` | `plugin` (oh-my-openagent in complex mode), `autoupdate: false`, `mcp.playwright` (only if absent), `provider.omniroute` |
14
+ | `tui.json` | setup, update | The Hive plugin `file://` entry in `plugin` |
15
+ | `opencode.json` | setup, update | Only if it already lists oh-my-openagent: it is then part of the mode set and handled like the files above |
16
+ | `oh-my-openagent.json` | model tree | Agent and category models. Not live: applies on relaunch |
17
+ | `skills/<name>/` | setup, update | Copies of the bundled skills |
18
+ | `<file>.habithive-bak-<timestamp>` | any edit above | Backup made before a change |
19
+
20
+ During a mode switch these config files are also renamed, not edited (see below).
21
+
22
+ ### Hive store (`~/.habithive/`)
23
+
24
+ | Path | Purpose |
25
+ |------|---------|
26
+ | `mode` | The active mode (`simple` or `complex`) |
27
+ | `modes/<mode>/` | The inactive mode's stored config set |
28
+ | `modes/files.json` | Which file names make up a mode set |
29
+ | `switch.journal` | Present only during a mode switch, so an interrupted switch can finish or roll back |
30
+ | `overrides.json` | Your model choices from the model tree |
31
+ | `baseline.json` | Snapshot of your original `oh-my-openagent.json`, restored by Reset |
32
+ | `oh-my-openagent.first-backup.json` | Byte copy of that original file |
33
+ | `last-applied.sha256` | Hash of the `oh-my-openagent.json` text Hive last wrote, to tell its writes from yours |
34
+ | `pending-apply.json` | A main-agent model change waiting to be applied after relaunch |
35
+ | `next-mode`, `next-session` | Queued in-app mode switch and the session to reopen; cleared on launch |
36
+ | `update-check.json` | Cache of the daily "new release?" check against the npm registry |
37
+ | `schema-installed.sha256` | Hash of the `intent-driven` schema Hive last installed |
38
+ | `schema-backups/` | Your edited schema copy, kept here when setup replaces it |
39
+
40
+ ### Elsewhere
41
+
42
+ | Path | What Hive does |
43
+ |------|----------------|
44
+ | `~/.local/share/openspec/schemas/intent-driven` | Installs the schema (the base follows `XDG_DATA_HOME` or `LOCALAPPDATA` when set) |
45
+ | `~/.local/state/opencode/model.json` | On a main-agent model change, moves the old and new model to the front of `recent` |
46
+ | `<project>/openspec/`, `<project>/.opencode/` | Created by `hive spec init` |
47
+
48
+ Hive also reads opencode's session list and the `opencode --version` output; it writes nothing there.
49
+
50
+ ## Safety guarantees
51
+
52
+ - A normal launch never writes config. `habithive status` reads only `~/.habithive/mode`.
53
+ - A mode switch only renames files. The first switch to a mode creates its set once from the active files; after that, contents are never edited.
54
+ - Switches are journaled. A launch finishes or rolls back an interrupted switch before doing anything else.
55
+ - Only `habithive setup`, `habithive update` and `habithive --gateway` edit your config.
56
+ - Every edit goes through one safe-edit routine: it parses the file first, makes no write when nothing changes, saves `<file>.habithive-bak-<timestamp>` next to the file, writes through a temp file and rename, keeps the file's permissions, and keeps only the newest 5 backups per file.
57
+ - An edited file is saved as plain JSON. Every setting is kept, but comments and layout are not; the backup keeps the original.
58
+ - If a file cannot be parsed, Hive writes nothing and prints `cannot read <file>:<line>:<col>`. Fix the file and re-run.
59
+ - Hive refuses to apply model overrides over an empty baseline, so it cannot wipe oh-my-openagent's config.
60
+ - Hive never writes API keys.
61
+
62
+ Never touched: your keys, other providers, sessions, projects, models you added to OmniRoute, and any config value Hive does not manage.
63
+
64
+ ## Uninstall
65
+
66
+ Switch to the mode whose config you want to keep, because deleting `~/.habithive` removes the other mode's stored set.
67
+
68
+ ```sh
69
+ habithive complex # or: habithive simple
70
+ npm rm -g habithive-code
71
+ npm rm -g @fission-ai/openspec # optional: the pinned OpenSpec CLI
72
+ rm -rf ~/.local/share/openspec/schemas/intent-driven # optional: the schema
73
+ rm -rf ~/.habithive
74
+ rm -f ~/.config/opencode/*.habithive-bak-* # optional: backups
75
+ ```
76
+
77
+ Then remove the Hive plugin and `oh-my-openagent` entries from `~/.config/opencode/tui.json` and `opencode.jsonc`, and the `omniroute` provider if you do not want it. Also optional: `~/.config/opencode/skills/` copies, the `playwright` MCP entry, and `"autoupdate": false` (opencode then updates itself again). Project folders created by `hive spec init` stay.
78
+
79
+ ## Related
80
+
81
+ - [Modes](02-modes.md)
82
+ - [Updates and versions](07-updates-and-versions.md)
83
+ - [Troubleshooting](09-troubleshooting.md)
@@ -0,0 +1,117 @@
1
+ # 9. Troubleshooting
2
+
3
+ ## What it is
4
+
5
+ Each entry is a symptom, the cause Hive's code handles, and the fix. `hive` is the same command as `habithive`. Hive prints `!` lines for warnings and keeps going; it only stops on a config parse error or a failed install.
6
+
7
+ ## Models and relaunch
8
+
9
+ ### The model did not change on screen
10
+
11
+ Cause: only main-agent and Everything changes move the on-screen model, and only through a relaunch. Subagent, sub-agent group and tier changes are saved to `oh-my-openagent.json` and apply on relaunch; the agent on screen keeps its model. If the automatic step cannot run, opencode's model picker opens and a toast names the model to select.
12
+
13
+ Fix: select the model in the picker, or relaunch with `habithive -c`. See [Model tree](03-model-tree.md).
14
+
15
+ ### "waiting for the open prompt"
16
+
17
+ Cause: a permission or question prompt is open. Hive does not quit opencode while one is open, because quitting would reject it.
18
+
19
+ Fix: answer the prompt. The change then applies. If opencode does not quit within 3 seconds, type `/exit` so the launcher can reopen the session.
20
+
21
+ ### "saved - restart with `habithive -c` to apply"
22
+
23
+ Cause: opencode was started as plain `opencode`, not through `habithive`, so there is no launcher to relaunch it. The change is saved.
24
+
25
+ Fix: quit and run `habithive -c`.
26
+
27
+ ### Another mode's provider or MCP server is missing
28
+
29
+ Cause: each mode keeps its own complete config set; changes made in one mode are not in the other.
30
+
31
+ Fix: copy the entry from `~/.habithive/modes/<mode>/` (the inactive set) into the active file. See [Modes](02-modes.md).
32
+
33
+ ## Versions
34
+
35
+ ### "opencode X is not the tested Y"
36
+
37
+ Cause: the installed opencode differs from the version pinned in this Hive release.
38
+
39
+ Fix: run `habithive update`. It re-applies the pin (`opencode upgrade <pin>`). `habithive setup` does the same.
40
+
41
+ ### OpenCode 2 detected
42
+
43
+ Cause: OpenCode 2 is installed (for example through `opencode upgrade --major`). Complex mode and the model tree do not work on it.
44
+
45
+ Fix: go back to OpenCode 1 with the command for your install method, then run `habithive setup` where shown. The launcher, `habithive status` and `habithive setup` print the right commands; see the Compatibility section of the [README](../../README.md#compatibility). Never run `opencode upgrade --major`.
46
+
47
+ ### "habithive needs Node.js 20.19 or newer"
48
+
49
+ Cause: Node is older than 20.19 (OpenSpec requires it).
50
+
51
+ Fix: `nvm install 22`, then retry.
52
+
53
+ ### `npm i -g` fails with `EACCES`
54
+
55
+ Cause: npm's global prefix is not writable. Fix: use a user-owned prefix or nvm, never `sudo`. See [Getting started](01-getting-started.md#install).
56
+
57
+ ## Config files
58
+
59
+ ### "cannot read <file>:<line>:<col>"
60
+
61
+ Cause: a config file Hive must edit has a syntax error. Hive writes nothing in that case.
62
+
63
+ Fix: open the file at that line and column, fix it, re-run the command.
64
+
65
+ ## OmniRoute
66
+
67
+ ### "connection refused" from OmniRoute
68
+
69
+ Cause: OmniRoute is not enabled. The provider points at the placeholder `http://localhost:20128/v1` until you set a gateway.
70
+
71
+ Fix: run `habithive --gateway <ip>`, then `/connect` in opencode to add your key. `habithive update` never changes the address. See [OmniRoute](04-omniroute.md).
72
+
73
+ ### OmniRoute sends no key
74
+
75
+ Cause: an older hand-copied OmniRoute block has `"apiKey": "{env:OMNIROUTE_API_KEY}"` and that variable is unset. opencode then sends no key and ignores the one saved by `/connect`. Hive never adds or removes that line.
76
+
77
+ Fix: export `OMNIROUTE_API_KEY`, or delete that line from the `omniroute` provider block.
78
+
79
+ ## Plugin and launcher
80
+
81
+ ### Two wordmarks on the home screen
82
+
83
+ Cause: the previous package is still wired into a global or per-project opencode config.
84
+
85
+ Fix: follow [Migrating from the previous package name](01-getting-started.md#migrating-from-the-previous-package-name).
86
+
87
+ ### "habithive plugin path is stale"
88
+
89
+ Cause: `tui.json` names a Hive plugin path that no longer exists, for example after the global npm install moved.
90
+
91
+ Fix: run `habithive setup`. It replaces the stale entry.
92
+
93
+ ### `hive` runs a different program
94
+
95
+ Cause: another program named `hive` (such as Apache Hive) is earlier on your PATH. Setup warns about this.
96
+
97
+ Fix: use `habithive`, which is the same command.
98
+
99
+ ## Specs
100
+
101
+ ### The schema is missing in a project
102
+
103
+ Cause: the project has OpenSpec set up with another schema, or its `openspec/schemas/intent-driven` copy is gone. `hive spec init` leaves an initialized project alone and prints how to switch.
104
+
105
+ Fix: run `habithive setup` to reinstall the user-level schema, then in the project:
106
+
107
+ ```sh
108
+ openspec schema fork intent-driven intent-driven
109
+ ```
110
+
111
+ and set `schema: intent-driven` in `openspec/config.yaml`. To refresh an existing copy: `rm -rf openspec/schemas/intent-driven && openspec schema fork intent-driven intent-driven`. If `hive spec init` says "openspec not found", run `habithive setup`. See [Spec workflow](05-spec-workflow.md).
112
+
113
+ ## Related
114
+
115
+ - [Files and safety](08-files-and-safety.md)
116
+ - [Updates and versions](07-updates-and-versions.md)
117
+ - [docs/COMPATIBILITY.md](../COMPATIBILITY.md)
@@ -0,0 +1,32 @@
1
+ # Hive developer guide
2
+
3
+ Hive (`habithive-code`) is a control layer for opencode. This guide is for developers adopting it. Commands are written as `habithive`; `hive` is the same command.
4
+
5
+ ## Reading order
6
+
7
+ | Chapter | What it covers |
8
+ |---------|----------------|
9
+ | [1. Getting started](01-getting-started.md) | Prerequisites, install, `habithive setup`, first launch, verifying |
10
+ | [2. Modes](02-modes.md) | Simple and complex mode, how switching works |
11
+ | [3. Model tree](03-model-tree.md) | Setting models per agent, group and tier |
12
+ | [4. OmniRoute](04-omniroute.md) | The OmniRoute provider, gateway, key |
13
+ | [5. Spec workflow](05-spec-workflow.md) | OpenSpec and the `intent-driven` schema in a project |
14
+ | [6. Agents, skills and tools](06-agents-skills-tools.md) | What is bundled and installed |
15
+ | [7. Updates and versions](07-updates-and-versions.md) | `habithive update`, pins, autoupdate |
16
+ | [8. Files and safety](08-files-and-safety.md) | Every file Hive touches, safety guarantees, uninstall |
17
+ | [9. Troubleshooting](09-troubleshooting.md) | Symptom, cause, fix |
18
+
19
+ Technical record of tested versions: [../COMPATIBILITY.md](../COMPATIBILITY.md). Patch notes: [../../CHANGELOG.md](../../CHANGELOG.md).
20
+
21
+ ## I want to...
22
+
23
+ | Goal | Go to |
24
+ |------|-------|
25
+ | Switch between simple and complex mode | [Modes](02-modes.md) |
26
+ | Change a model | [Model tree](03-model-tree.md) |
27
+ | Enable OmniRoute | [OmniRoute](04-omniroute.md), or [Getting started](01-getting-started.md#enable-omniroute) |
28
+ | Start a spec in a project | [Spec workflow](05-spec-workflow.md) |
29
+ | Update Hive | [Updates and versions](07-updates-and-versions.md) |
30
+ | Fix a problem | [Troubleshooting](09-troubleshooting.md) |
31
+ | Know what Hive writes to my machine | [Files and safety](08-files-and-safety.md) |
32
+ | Remove Hive | [Files and safety](08-files-and-safety.md#uninstall) |