@irythill/orq 0.0.0-stage → 0.2.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.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +240 -2
  3. package/README.pt-BR.md +242 -0
  4. package/dist/accounts.js +18 -0
  5. package/dist/agents.js +202 -0
  6. package/dist/banner.js +87 -0
  7. package/dist/cli.js +92 -0
  8. package/dist/commands/agent.js +334 -0
  9. package/dist/commands/baseline.js +101 -0
  10. package/dist/commands/block.js +74 -0
  11. package/dist/commands/board.js +435 -0
  12. package/dist/commands/claim.js +88 -0
  13. package/dist/commands/completion.js +88 -0
  14. package/dist/commands/config.js +35 -0
  15. package/dist/commands/deps.js +82 -0
  16. package/dist/commands/gc.js +164 -0
  17. package/dist/commands/instructions.js +66 -0
  18. package/dist/commands/lang.js +35 -0
  19. package/dist/commands/lock.js +69 -0
  20. package/dist/commands/pick.js +111 -0
  21. package/dist/commands/quota.js +40 -0
  22. package/dist/commands/run.js +46 -0
  23. package/dist/commands/set.js +27 -0
  24. package/dist/commands/setup.js +187 -0
  25. package/dist/commands/stats.js +41 -0
  26. package/dist/commands/verify.js +123 -0
  27. package/dist/commands/wait.js +81 -0
  28. package/dist/config.js +93 -0
  29. package/dist/fsutil.js +9 -0
  30. package/dist/i18n.js +21 -0
  31. package/dist/install.js +137 -0
  32. package/dist/keyring.js +51 -0
  33. package/dist/lock.js +81 -0
  34. package/dist/paths.js +34 -0
  35. package/dist/pick.js +126 -0
  36. package/dist/process.js +147 -0
  37. package/dist/quota.js +334 -0
  38. package/dist/roles.js +28 -0
  39. package/dist/stats.js +159 -0
  40. package/dist/suggest.js +121 -0
  41. package/dist/terminal.js +83 -0
  42. package/dist/testrun.js +203 -0
  43. package/dist/toml-set.js +46 -0
  44. package/package.json +46 -4
  45. package/skills/issue/SKILL.md +229 -0
  46. package/skills/orq-setup/SKILL.md +114 -0
  47. package/skills/orq-status/SKILL.md +37 -0
  48. package/templates/workspace.CLAUDE.md +49 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 irythill
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,241 @@
1
- # Temporary Holding Version
1
+ **English** · [Português](README.pt-BR.md)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center"><img src="docs/img/orq-logo.svg" alt="orq — an orc in a tailcoat raising a conductor's baton" width="304"></p>
4
+
5
+ # orq — orchestrating coding agents with herdr
6
+
7
+ You describe the work in a Plane issue. A **conductor** (Claude, ideally Opus) reads it, picks the right agent for
8
+ each step, dispatches the **implementer**, the **tests** and a **cross-vendor review** in [herdr](https://herdr.dev)
9
+ tabs, and hands the issue back *In Review* with a summary in Plane. Merge, PR and deploy stay with you.
10
+
11
+ What orq does **not** decide for you: which agents you have, how much each may spend and how you like to work. All of
12
+ that lives in your config.
13
+
14
+ > Born from daily use at a health-tech company: 3–5 issues in parallel on a 14 GB PC, across Claude Code, Codex,
15
+ > OpenCode, Antigravity and Copilot. The story, numbers and lessons: **[docs/case-study.md](docs/case-study.md)**.
16
+ >
17
+ > 🚧 = not available yet.
18
+
19
+ ## How it works
20
+
21
+ ```
22
+ You ── "/issue DEMO-123" ──► conductor (Claude in herdr)
23
+ │ orq-pick impl ──► which agent/model implements (config + history + quota)
24
+ ├─► implementer herdr-agent own tab · worktree from origin/<base> · memory cap
25
+ ├─► tests herdr-verify only the diff's tests · queue of one suite at a time
26
+ │ orq-pick review ─► a reviewer from ANOTHER vendor
27
+ ├─► reviewer herdr-agent -r read only · diff + criteria + test results attached
28
+ └─► Plane comment, state, labels
29
+ ◄── "[HERDR-AGENT DONE] ..." in the conductor's pane (the only completion signal)
30
+ ```
31
+
32
+ - **Every step in a herdr tab.** You watch it live and the tab closes when it's done. Results stay in
33
+ `.orquestra/<ID>/` (`.out.md`, `.log`, `.done`).
34
+ - **Fixed order every round:** implementer ok → tests with no new failure → review. A blocking problem becomes a fix
35
+ round in the implementer's own session (configurable maximum).
36
+ - **Nobody picks an agent by gut feeling.** `orq-pick` decides from data: what each agent delivered in the history,
37
+ how many tokens it spent, how long it took, the current quota, and a rotation so no agent gets all the work.
38
+ - **The machine stays up.** Each agent runs under its own memory cap; tests wait in a queue.
39
+
40
+ ## Supported agents
41
+
42
+ | Agent | CLI | Possible roles | Notes |
43
+ |---|---|---|---|
44
+ | Claude Code | `claude` | conductor, implement, review | several accounts (`claude-accounts`); Opus as conductor |
45
+ | Codex | `codex` | implement, review | sandbox without network: the conductor runs `git fetch` |
46
+ | OpenCode | `opencode` | implement, review | any provider (e.g. MiniMax) |
47
+ | Antigravity | `agy` | review | headless denies commands outside its allowlist: it reviews by reading the attached diff |
48
+ | GitHub Copilot | `copilot` | second opinion | small allowances on some plans: occasional use |
49
+
50
+ You declare only the ones you have, and the roles each may take.
51
+
52
+ ## Install
53
+
54
+ Linux, macOS or Windows (native, not only WSL), in any shell — bash, zsh, fish, PowerShell, cmd.
55
+ **Requirements:** Node 20+ with `npm`, `git`, and at least one agent from the table above, logged in. Optional:
56
+ [herdr](https://herdr.dev) or tmux, so each child gets its own tab or window (otherwise children run in the
57
+ background and `orq board` shows them).
58
+
59
+ ```bash
60
+ npm i -g @irythill/orq
61
+ orq setup
62
+ ```
63
+
64
+ `orq setup` shows what it found (git, terminal, how memory is capped, keyring, your shell), links orq's skills into
65
+ `~/.claude/skills/` and each account folder in `claude-accounts` (a junction on Windows; never over a folder of
66
+ yours), asks about your agents and plans, writes `~/.config/orq/config.toml` (`%APPDATA%\orq\config.toml` on Windows)
67
+ and prepares the folder that groups your repos for the conductor: `.orquestra/`, the map `CLAUDE.md` and the
68
+ `/issue` playbook in the conductor's format. Pieces on their own: `orq setup --install` (no questions),
69
+ `orq setup --workspace <folder> --conductor <agent>`. Inside Claude, **`/orq-setup`** does the same as a
70
+ conversation and also fills in the repo table. Plane: [docs/plane.md](docs/plane.md).
71
+
72
+ **Memory cap:** a systemd scope on Linux with a user session, else a watchdog (macOS, Windows, WSL without systemd).
73
+ **Keyring** (Antigravity quota, Claude quota on macOS): Secret Service, Keychain or Credential Manager through
74
+ `@napi-rs/keyring`; without the native module, `secret-tool`/`security`.
75
+
76
+ ### Shell completion
77
+
78
+ | Shell | Turn it on |
79
+ |---|---|
80
+ | bash | `echo 'eval "$(orq completion bash)"' >> ~/.bashrc` |
81
+ | zsh | `echo 'eval "$(orq completion zsh)"' >> ~/.zshrc` (after `compinit`) |
82
+ | fish | `orq completion fish > ~/.config/fish/completions/orq.fish` |
83
+ | PowerShell | `Add-Content $PROFILE 'orq completion powershell \| Out-String \| Invoke-Expression'` |
84
+ | cmd | no programmable completion |
85
+
86
+ ### Linux extras from a clone: `install.sh` (optional)
87
+
88
+ For herdr as an always-on service, its plugin and the old script names (`herdr-*`, `orq-*`, `agent-quota`):
89
+
90
+ ```bash
91
+ # herdr (tested on 0.9.3)
92
+ curl -fsSL https://herdr.dev/install.sh -o /tmp/herdr-install.sh && less /tmp/herdr-install.sh && sh /tmp/herdr-install.sh
93
+ git clone https://github.com/irythill/orq ~/Code/orq && cd ~/Code/orq
94
+ ./install.sh # links in ~/.local/bin, herdr service, skills for Claude
95
+ ```
96
+
97
+ Needs `git`, `jq`, Node 20+ with `npm`, `python3` (3.11+ for TOML config; older → JSON config or
98
+ `pip install --user tomli`) and user `systemd` (WSL2: Ubuntu 22.04+ with systemd enabled). `install.sh` checks the
99
+ requirements (table of what's found and missing), builds the `orq` CLI (`src/` → `dist/`), then **symlinks** (never
100
+ copies) the scripts into `~/.local/bin`, `setup/herdr.service` into `~/.config/systemd/user/` (and enables it), and
101
+ every skill into `~/.claude/skills/` plus each account folder listed in `~/.config/claude-accounts`. Idempotent:
102
+ re-run it after a `git pull` or a new account. It never overwrites a real file (warns and skips) and never writes
103
+ your config.
104
+
105
+ | Flag | What it does |
106
+ |---|---|
107
+ | `--dry-run` | print what it would do, change nothing |
108
+ | `--uninstall` | remove only the links it creates, and only those pointing into this repo (config and history stay) |
109
+
110
+ ## Configuration
111
+
112
+ Two layers, to keep **your way of working** apart from **the team's project**:
113
+
114
+ | File | Whose | What it holds |
115
+ |---|---|---|
116
+ | `~/.config/orq/config.toml` | yours, stays on your machine | agents, accounts, models per role and level, pick weights, memory limits |
117
+ | `<workspace>/.orq/workspace.toml` 🚧 | the team's, versioned | Plane (projects, issue standard), repos, base branch, verification, tests, dependencies |
118
+
119
+ The more specific one wins, key by key. JSON works too (`config.json`). To see the merged result: `orq-config`
120
+ (everything), `orq-config get policy.weights`, `orq-config files`.
121
+
122
+ ### Example: personal config
123
+ Complete, commented example: [`examples/irythill/config.toml`](examples/irythill/config.toml). The essentials:
124
+
125
+ ```toml
126
+ [agents.codex]
127
+ vendor = "openai"
128
+ roles = ["impl", "fix", "review"]
129
+ quota = ["codex"] # name in agent-quota's output
130
+ [agents.codex.models.impl]
131
+ simple = "gpt-6-sol@low" # model@effort
132
+ heavy = "gpt-6.1-sol@medium"
133
+
134
+ [agents.opencode]
135
+ vendor = "minimax"
136
+ roles = ["review"] # here it only reviews; for someone else it may implement
137
+ [agents.opencode.models.review]
138
+ default = "minimax/MiniMax-M3"
139
+
140
+ [policy]
141
+ quota_limit = 90 # ≥ 90% used → agent out
142
+ [policy.weights]
143
+ quality = 0.40 # did it deliver? (impl: approved on the first review)
144
+ tokens = 0.45 # did it spend little?
145
+ speed = 0.15
146
+ rotation = 0.20 # penalty for having been picked recently
147
+ ```
148
+
149
+ ### How `orq-pick` chooses
150
+ 1. **Filters:** only agents with that role, under the quota limit, not blocked (`orq-block`) and, for reviews, from a
151
+ vendor other than the implementer's. With several accounts, it takes the least used one.
152
+ 2. **Scores:** `quality × delivery + tokens × economy + speed × quickness − rotation × recent picks`. The numbers come
153
+ from the history (`orq-stats`); an agent with few runs uses the config's `prior` and gets an exploration bonus.
154
+ 3. **`reserve = true` agents** (e.g. Claude, which shares quota with the conductor) only come in when nothing else fits.
155
+
156
+ ```bash
157
+ orq-pick review --impl-agent codex --explain # every candidate's score and who was left out, and why
158
+ orq-stats --days 30 # scoreboard: delivery, approval, time and tokens per agent and model
159
+ orq-block antigravity --days 3 # out of the picks (e.g. weekly quota gone, no collector for it)
160
+ ```
161
+
162
+ ### Language and theme
163
+ orq speaks English and Portuguese: CLI messages, `herdr-board`, notices and `install.sh`. It follows
164
+ `[ui] lang` in your config (`"auto"` = system locale, `"en"`, `"pt"`), or the `ORQ_LANG` environment variable.
165
+ Switch it any time:
166
+ - `orq-lang pt` / `orq-lang en` / `orq-lang toggle` (`orq-lang` alone shows the current one);
167
+ - `l` inside `orq board`;
168
+ - a herdr key: `install.sh` links the `orq` herdr plugin; bind its `orq.lang-toggle` action (snippet in
169
+ `herdr-plugin/herdr-plugin.toml`) — e.g. `prefix+shift+l` — and `orq.board` to open the board as an overlay.
170
+
171
+ `orq board` has its own look, from the [SYNTH.DECK](https://github.com/irythill/synth-deck-portfolio)
172
+ portfolio: `[ui] theme = "gunmetal"` (default, dark graphite), `"chrome"` (light silver), `"lcd"` (phosphor green) or
173
+ `"terminal"` (your terminal's colors). `t` inside the board cycles through them (`ORQ_THEME` overrides).
174
+
175
+ Whatever is already running keeps its language. Conductors always talk to you in your own language. Docs:
176
+ [Português](README.pt-BR.md).
177
+
178
+ ## Daily use
179
+
180
+ ```bash
181
+ herdr # opens the window (the server runs as a service)
182
+ cd ~/Code/<workspace> && herdr-conductor # inside a herdr pane: opens the conductor (account and model optional)
183
+ ```
184
+ In the conductor: **`/issue DEMO-123`**. It answers in one line and moves on by itself at every `[HERDR-AGENT DONE]`.
185
+ You only come back when it asks for a decision or says it's done.
186
+
187
+ To see everything at once, keep **`orq board`** open in a tab or window (any terminal, any OS; `herdr-board` calls it):
188
+ test queue, running agents (model, memory against the cap, last action), conductors and their issues, memory, quota,
189
+ blocks and the 7-day scoreboard. `--once` prints it once, `--json` for scripts. With
190
+ `ui.toast.delivery = "system"` in herdr's config, each finished step also pops up a native OS notification.
191
+
192
+ Several issues at once: one conductor per issue (ideally on different accounts). `herdr-claim` keeps two conductors
193
+ off the same issue. Details, shortcuts and scenarios: [docs/herdr.md](docs/herdr.md).
194
+
195
+ ## Skills
196
+
197
+ | Skill | What for | Status |
198
+ |---|---|---|
199
+ | `/issue <ID>` | Full flow: issue → implementation → tests → review → Plane | ready |
200
+ | `/orq-setup` | Guided setup: agents, accounts, repos, verification | ready |
201
+ | `/review <PR or branch>` | Cross review of something finished (e.g. a teammate's PR), no implementation | 🚧 |
202
+ | `/investigate <question>` | A read-only agent investigates a bug or piece of code and reports | 🚧 |
203
+ | `/orq-status` | Summary in chat: queue, running agents, scoreboard and quota | ready |
204
+
205
+ ## Commands
206
+
207
+ | Command | What it does |
208
+ |---|---|
209
+ | `orq agent -a <agent> ...` (`herdr-agent`) | Runs an agent with a memory cap in a herdr tab, a tmux window or the background; `-r` read only, `-R <id>` continue the session, `-i` attach a file, `-b <base>` attach the diff, `-T` the agent's own screen (herdr only) |
210
+ | `orq instructions claude\|agents` | Writes the `/issue` playbook as `SKILL.md` (Claude Code) or into `AGENTS.md` (Codex, OpenCode…) |
211
+ | `orq wait <prefix>...` | Blocks until those agents finish; prints `status=` and the answer file (any conductor, any terminal) |
212
+ | `orq verify ...` (`herdr-verify`) | Tests related to the diff, queued and memory-capped; failures that also fail on the base count as pre-existing |
213
+ | `orq board` (`herdr-board`) | Live board: queue, agents, conductors, quota, blocks, scoreboard |
214
+ | `herdr-conductor` | Opens the conductor in the current pane |
215
+ | `herdr-claim` | Owner of each issue among conductors |
216
+ | `herdr-deps` | Links the worktree's dependencies to the main repo's (no reinstall) |
217
+ | `orq baseline ...` (`herdr-baseline`) | Manual snapshot of the tests failing on the base (outside the flow) |
218
+ | `orq gc [-w <workspace>] [--yes]` | Lists issue worktrees that are safe to remove; `--yes` removes them |
219
+ | `orq setup` | First configuration and install: environment, skills for Claude, config, conductor workspace |
220
+ | `orq completion bash\|zsh\|fish\|powershell` | Prints the shell completion script (see Install) |
221
+ | `orq <config\|set\|lang\|block\|quota>` | The cross-platform CLI (TypeScript); the `orq-*` and `agent-quota` names below call it |
222
+ | `agent-quota` | Current quota of each agent and account; on a failed reading, the last good one until its window resets |
223
+ | `orq-config` · `orq-pick` · `orq-stats` · `orq-block` | Configuration, agent pick, scoreboard, manual blocks |
224
+ | `orq-lang` | Shows or switches the language of orq's messages (en/pt) |
225
+ | `orq-set <section> <key> <value>` | Writes one value into your orq config (e.g. `orq-set ui theme lcd`) |
226
+
227
+ ## More
228
+
229
+ - [docs/case-study.md](docs/case-study.md) — how this came to be, with real numbers
230
+ - [docs/plane.md](docs/plane.md) — self-hosted Plane through MCP
231
+ - [docs/claude-accounts.md](docs/claude-accounts.md) — several Claude accounts
232
+ - [docs/herdr.md](docs/herdr.md) — herdr day to day, shortcuts, several issues at once
233
+ - [docs/troubleshooting.md](docs/troubleshooting.md) — known problems and fixes
234
+ - [docs/omarchy.md](docs/omarchy.md) — extras for Omarchy users
235
+ - [docs/portability.md](docs/portability.md) — the roadmap: Linux, macOS and native Windows, any agent as conductor, user-defined roles, guided setup
236
+ - [CHANGELOG.md](CHANGELOG.md) — what changed, release by release
237
+ - `examples/` — real configurations to copy
238
+
239
+ ## License
240
+
241
+ [MIT](LICENSE)
@@ -0,0 +1,242 @@
1
+ [English](README.md) · **Português**
2
+
3
+ <p align="center"><img src="docs/img/orq-logo.svg" alt="orq — um orc de fraque erguendo a batuta de maestro" width="304"></p>
4
+
5
+ # orq — orquestrando agentes de código com o herdr
6
+
7
+ Você descreve o trabalho numa issue do Plane. Um **conductor** (Claude, de preferência Opus) lê a issue, escolhe o
8
+ agente certo para cada etapa, despacha o **implementador**, os **testes** e uma **review cross-vendor** em abas do
9
+ [herdr](https://herdr.dev), e devolve a issue *In Review* com um resumo no Plane. Merge, PR e deploy continuam com você.
10
+
11
+ O que o orq **não** decide por você: quais agentes você tem, quanto cada um pode gastar e como você gosta de
12
+ trabalhar. Tudo isso fica na sua config.
13
+
14
+ > Nasceu do uso diário numa empresa de saúde: 3–5 issues em paralelo num PC de 14 GB, usando Claude Code, Codex,
15
+ > OpenCode, Antigravity e Copilot. A história, os números e as lições: **[docs/pt-BR/case-study.md](docs/pt-BR/case-study.md)**.
16
+ >
17
+ > 🚧 = ainda não disponível.
18
+
19
+ ## Como funciona
20
+
21
+ ```
22
+ You ── "/issue DEMO-123" ──► conductor (Claude in herdr)
23
+ │ orq-pick impl ──► which agent/model implements (config + history + quota)
24
+ ├─► implementer herdr-agent own tab · worktree from origin/<base> · memory cap
25
+ ├─► tests herdr-verify only the diff's tests · queue of one suite at a time
26
+ │ orq-pick review ─► a reviewer from ANOTHER vendor
27
+ ├─► reviewer herdr-agent -r read only · diff + criteria + test results attached
28
+ └─► Plane comment, state, labels
29
+ ◄── "[HERDR-AGENT DONE] ..." in the conductor's pane (the only completion signal)
30
+ ```
31
+
32
+ - **Cada etapa numa aba do herdr.** Você acompanha ao vivo e a aba fecha quando termina. Os resultados ficam em
33
+ `.orquestra/<ID>/` (`.out.md`, `.log`, `.done`).
34
+ - **Ordem fixa em toda rodada:** implementador ok → testes sem falha nova → review. Um problema bloqueante vira uma
35
+ rodada de correção na própria sessão do implementador (com máximo configurável).
36
+ - **Ninguém escolhe agente no feeling.** O `orq-pick` decide com base em dados: o que cada agente entregou no
37
+ histórico, quantos tokens gastou, quanto tempo levou, a quota atual e um rodízio para nenhum agente ficar com todo o
38
+ trabalho.
39
+ - **A máquina não cai.** Cada agente roda com seu próprio limite de memória; os testes esperam numa fila.
40
+
41
+ ## Agentes suportados
42
+
43
+ | Agente | CLI | Papéis possíveis | Observações |
44
+ |---|---|---|---|
45
+ | Claude Code | `claude` | conductor, implement, review | várias contas (`claude-accounts`); Opus como conductor |
46
+ | Codex | `codex` | implement, review | sandbox sem rede: o conductor roda o `git fetch` |
47
+ | OpenCode | `opencode` | implement, review | qualquer provider (ex.: MiniMax) |
48
+ | Antigravity | `agy` | review | em modo headless nega comandos fora da allowlist: faz a review lendo o diff anexado |
49
+ | GitHub Copilot | `copilot` | segunda opinião | cota pequena em alguns planos: uso ocasional |
50
+
51
+ Você declara só os que tem, e os papéis que cada um pode assumir.
52
+
53
+ ## Instalação
54
+
55
+ Linux, macOS ou Windows (nativo, não só WSL), em qualquer shell — bash, zsh, fish, PowerShell, cmd.
56
+ **Requisitos:** Node 20+ com `npm`, `git`, e pelo menos um agente da tabela acima, logado. Opcional:
57
+ [herdr](https://herdr.dev) ou tmux, para cada filho ter sua própria aba ou janela (sem eles, os filhos rodam em
58
+ segundo plano e o `orq board` mostra todos).
59
+
60
+ ```bash
61
+ npm i -g @irythill/orq
62
+ orq setup
63
+ ```
64
+
65
+ O `orq setup` mostra o que encontrou (git, terminal, como a memória é limitada, chaveiro, seu shell), liga as skills
66
+ do orq em `~/.claude/skills/` e em cada pasta de conta do `claude-accounts` (uma junction no Windows; nunca por cima
67
+ de uma pasta sua), pergunta sobre seus agentes e planos, escreve o `~/.config/orq/config.toml`
68
+ (`%APPDATA%\orq\config.toml` no Windows) e prepara a pasta que agrupa seus repos para o conductor: `.orquestra/`, o
69
+ mapa `CLAUDE.md` e o playbook do `/issue` no formato do conductor. Partes avulsas: `orq setup --install` (sem
70
+ perguntas), `orq setup --workspace <pasta> --conductor <agente>`. Dentro do Claude, o **`/orq-setup`** faz o mesmo
71
+ como conversa e ainda preenche a tabela de repos. Plane: [docs/pt-BR/plane.md](docs/pt-BR/plane.md).
72
+
73
+ **Limite de memória:** um scope do systemd no Linux com sessão de usuário; senão, um vigia (macOS, Windows, WSL sem
74
+ systemd). **Chaveiro** (cota do Antigravity, cota do Claude no macOS): Secret Service, Keychain ou Credential Manager
75
+ pelo `@napi-rs/keyring`; sem o módulo nativo, `secret-tool`/`security`.
76
+
77
+ ### Autocompletar no shell
78
+
79
+ | Shell | Como ligar |
80
+ |---|---|
81
+ | bash | `echo 'eval "$(orq completion bash)"' >> ~/.bashrc` |
82
+ | zsh | `echo 'eval "$(orq completion zsh)"' >> ~/.zshrc` (depois do `compinit`) |
83
+ | fish | `orq completion fish > ~/.config/fish/completions/orq.fish` |
84
+ | PowerShell | `Add-Content $PROFILE 'orq completion powershell \| Out-String \| Invoke-Expression'` |
85
+ | cmd | sem autocompletar programável |
86
+
87
+ ### Extras do Linux a partir de um clone: `install.sh` (opcional)
88
+
89
+ Para o herdr como serviço sempre ligado, o plugin dele e os nomes antigos dos scripts (`herdr-*`, `orq-*`,
90
+ `agent-quota`):
91
+
92
+ ```bash
93
+ # herdr (testado na 0.9.3)
94
+ curl -fsSL https://herdr.dev/install.sh -o /tmp/herdr-install.sh && less /tmp/herdr-install.sh && sh /tmp/herdr-install.sh
95
+ git clone https://github.com/irythill/orq ~/Code/orq && cd ~/Code/orq
96
+ ./install.sh # links em ~/.local/bin, serviço do herdr, skills do Claude
97
+ ```
98
+
99
+ Precisa de `git`, `jq`, Node 20+ com `npm`, `python3` (3.11+ para config em TOML; mais antigo → config em JSON ou
100
+ `pip install --user tomli`) e `systemd` de usuário (WSL2: Ubuntu 22.04+ com systemd habilitado). O `install.sh`
101
+ confere os requisitos (tabela do que foi encontrado e do que falta), compila o CLI `orq` (`src/` → `dist/`) e depois
102
+ cria **symlinks** (nunca copia) dos scripts em `~/.local/bin`, do `setup/herdr.service` em `~/.config/systemd/user/`
103
+ (e habilita o serviço), e de cada skill em `~/.claude/skills/` e em cada pasta de conta listada em
104
+ `~/.config/claude-accounts`. É idempotente: rode de novo depois de um `git pull` ou de uma conta nova. Nunca
105
+ sobrescreve um arquivo de verdade (avisa e pula) e nunca escreve a sua config.
106
+
107
+ | Flag | O que faz |
108
+ |---|---|
109
+ | `--dry-run` | mostra o que faria, sem mudar nada |
110
+ | `--uninstall` | remove só os links que ele cria, e só os que apontam para este repo (config e histórico ficam) |
111
+
112
+ ## Configuração
113
+
114
+ Duas camadas, para separar **o seu jeito de trabalhar** do **projeto do time**:
115
+
116
+ | Arquivo | De quem | O que guarda |
117
+ |---|---|---|
118
+ | `~/.config/orq/config.toml` | seu, fica na sua máquina | agentes, contas, modelos por papel e nível, pesos do pick, limites de memória |
119
+ | `<workspace>/.orq/workspace.toml` 🚧 | do time, versionado | Plane (projetos, padrão de issue), repos, branch base, verificação, testes, dependências |
120
+
121
+ O mais específico ganha, chave por chave. JSON também funciona (`config.json`). Para ver o resultado mesclado:
122
+ `orq-config` (tudo), `orq-config get policy.weights`, `orq-config files`.
123
+
124
+ ### Exemplo: config pessoal
125
+ Exemplo completo e comentado: [`examples/irythill/config.toml`](examples/irythill/config.toml). O essencial:
126
+
127
+ ```toml
128
+ [agents.codex]
129
+ vendor = "openai"
130
+ roles = ["impl", "fix", "review"]
131
+ quota = ["codex"] # name in agent-quota's output
132
+ [agents.codex.models.impl]
133
+ simple = "gpt-6-sol@low" # model@effort
134
+ heavy = "gpt-6.1-sol@medium"
135
+
136
+ [agents.opencode]
137
+ vendor = "minimax"
138
+ roles = ["review"] # here it only reviews; for someone else it may implement
139
+ [agents.opencode.models.review]
140
+ default = "minimax/MiniMax-M3"
141
+
142
+ [policy]
143
+ quota_limit = 90 # ≥ 90% used → agent out
144
+ [policy.weights]
145
+ quality = 0.40 # did it deliver? (impl: approved on the first review)
146
+ tokens = 0.45 # did it spend little?
147
+ speed = 0.15
148
+ rotation = 0.20 # penalty for having been picked recently
149
+ ```
150
+
151
+ ### Como o `orq-pick` escolhe
152
+ 1. **Filtros:** só agentes com aquele papel, abaixo do limite de quota, não bloqueados (`orq-block`) e, para reviews,
153
+ de um vendor diferente do implementador. Com várias contas, pega a menos usada.
154
+ 2. **Pontuação:** `quality × delivery + tokens × economy + speed × quickness − rotation × recent picks`. Os números vêm
155
+ do histórico (`orq-stats`); um agente com poucas execuções usa o `prior` da config e ganha um bônus de exploração.
156
+ 3. **Agentes com `reserve = true`** (ex.: Claude, que divide quota com o conductor) só entram quando nada mais serve.
157
+
158
+ ```bash
159
+ orq-pick review --impl-agent codex --explain # every candidate's score and who was left out, and why
160
+ orq-stats --days 30 # scoreboard: delivery, approval, time and tokens per agent and model
161
+ orq-block antigravity --days 3 # out of the picks (e.g. weekly quota gone, no collector for it)
162
+ ```
163
+
164
+ ### Idioma e tema
165
+ O orq fala inglês e português: mensagens da CLI, `herdr-board`, avisos e `install.sh`. Ele segue `[ui] lang` na sua
166
+ config (`"auto"` = idioma do sistema, `"en"`, `"pt"`) ou a variável de ambiente `ORQ_LANG`. Para trocar a qualquer
167
+ momento:
168
+ - `orq-lang pt` / `orq-lang en` / `orq-lang toggle` (`orq-lang` sozinho mostra o atual);
169
+ - a tecla `l` dentro do `orq board`;
170
+ - uma tecla no herdr: o `install.sh` liga o plugin `orq` do herdr; associe a ação `orq.lang-toggle` (trecho pronto em
171
+ `herdr-plugin/herdr-plugin.toml`) — por exemplo, `prefix+shift+l` — e a `orq.board` para abrir o painel por cima.
172
+
173
+ O `orq board` tem visual próprio, inspirado no portfólio [SYNTH.DECK](https://github.com/irythill/synth-deck-portfolio):
174
+ `[ui] theme = "gunmetal"` (padrão, grafite escuro), `"chrome"` (prata claro), `"lcd"` (verde fósforo) ou `"terminal"`
175
+ (as cores do seu terminal). A tecla `t` dentro do painel alterna entre eles (`ORQ_THEME` tem prioridade).
176
+
177
+ O que já está rodando continua no idioma em que começou. Os conductors sempre falam com você no seu idioma.
178
+
179
+ ## Uso diário
180
+
181
+ ```bash
182
+ herdr # abre a janela (o servidor roda como serviço)
183
+ cd ~/Code/<workspace> && herdr-conductor # dentro de um pane do herdr: abre o conductor (conta e modelo opcionais)
184
+ ```
185
+ No conductor: **`/issue DEMO-123`**. Ele responde numa linha e segue sozinho a cada `[HERDR-AGENT DONE]`. Você só volta
186
+ quando ele pede uma decisão ou avisa que terminou.
187
+
188
+ Para ver tudo de uma vez, deixe o **`orq board`** aberto numa aba ou janela (qualquer terminal, qualquer SO; o
189
+ `herdr-board` o chama): fila de testes, agentes rodando (modelo, memória contra o limite, última ação), conductors e
190
+ suas issues, memória, quota, bloqueios e o placar de 7 dias. `--once` imprime uma vez, `--json` para scripts. Com
191
+ `ui.toast.delivery = "system"` na config do herdr, cada etapa concluída também gera uma notificação nativa do sistema.
192
+
193
+ Várias issues ao mesmo tempo: um conductor por issue (de preferência em contas diferentes). O `herdr-claim` impede que
194
+ dois conductors peguem a mesma issue. Detalhes, atalhos e cenários: [docs/pt-BR/herdr.md](docs/pt-BR/herdr.md).
195
+
196
+ ## Skills
197
+
198
+ | Skill | Para quê | Status |
199
+ |---|---|---|
200
+ | `/issue <ID>` | Fluxo completo: issue → implementação → testes → review → Plane | pronta |
201
+ | `/orq-setup` | Setup guiado: agentes, contas, repos, verificação | pronta |
202
+ | `/review <PR or branch>` | Review cruzada de algo pronto (ex.: PR de um colega), sem implementação | 🚧 |
203
+ | `/investigate <question>` | Um agente só-leitura investiga um bug ou trecho de código e reporta | 🚧 |
204
+ | `/orq-status` | Resumo no chat: fila, agentes rodando, placar e quota | pronta |
205
+
206
+ ## Comandos
207
+
208
+ | Comando | O que faz |
209
+ |---|---|
210
+ | `orq agent -a <agent> ...` (`herdr-agent`) | Roda um agente com limite de memória numa aba do herdr, numa janela do tmux ou em segundo plano; `-r` só leitura, `-R <id>` continua a sessão, `-i` anexa um arquivo, `-b <base>` anexa o diff, `-T` a tela do próprio agente (só herdr) |
211
+ | `orq instructions claude\|agents` | Escreve o playbook do `/issue` como `SKILL.md` (Claude Code) ou dentro do `AGENTS.md` (Codex, OpenCode…) |
212
+ | `orq wait <prefixo>...` | Bloqueia até esses agentes terminarem; imprime `status=` e o arquivo da resposta (qualquer conductor, qualquer terminal) |
213
+ | `orq verify ...` (`herdr-verify`) | Testes relacionados ao diff, em fila e com limite de memória; falhas que também falham na base contam como pré-existentes |
214
+ | `orq board` (`herdr-board`) | Painel ao vivo: fila, agentes, conductors, cota, bloqueios, placar |
215
+ | `herdr-conductor` | Abre o conductor no pane atual |
216
+ | `herdr-claim` | Dono de cada issue entre os conductors |
217
+ | `herdr-deps` | Liga as dependências do worktree às do repo principal (sem reinstalar) |
218
+ | `orq baseline ...` (`herdr-baseline`) | Snapshot manual dos testes que falham na base (fora do fluxo) |
219
+ | `orq gc [-w <workspace>] [--yes]` | Lista worktrees de issues seguras para remover; `--yes` as remove |
220
+ | `orq setup` | Primeira configuração e instalação: ambiente, skills do Claude, config, workspace do conductor |
221
+ | `orq completion bash\|zsh\|fish\|powershell` | Imprime o script de autocompletar do shell (veja Instalação) |
222
+ | `orq <config\|set\|lang\|block\|quota>` | O CLI multiplataforma (TypeScript); os nomes `orq-*` e `agent-quota` abaixo chamam ele |
223
+ | `agent-quota` | Quota atual de cada agente e conta; se a leitura falha, vale a última boa até a janela resetar |
224
+ | `orq-config` · `orq-pick` · `orq-stats` · `orq-block` | Configuração, escolha de agente, placar, bloqueios manuais |
225
+ | `orq-lang` | Mostra ou troca o idioma das mensagens do orq (en/pt) |
226
+ | `orq-set <seção> <chave> <valor>` | Grava um valor na sua config do orq (ex.: `orq-set ui theme lcd`) |
227
+
228
+ ## Mais
229
+
230
+ - [docs/pt-BR/case-study.md](docs/pt-BR/case-study.md) — como isso surgiu, com números reais
231
+ - [docs/pt-BR/plane.md](docs/pt-BR/plane.md) — Plane self-hosted via MCP
232
+ - [docs/pt-BR/claude-accounts.md](docs/pt-BR/claude-accounts.md) — várias contas do Claude
233
+ - [docs/pt-BR/herdr.md](docs/pt-BR/herdr.md) — herdr no dia a dia, atalhos, várias issues ao mesmo tempo
234
+ - [docs/pt-BR/troubleshooting.md](docs/pt-BR/troubleshooting.md) — problemas conhecidos e soluções
235
+ - [docs/pt-BR/omarchy.md](docs/pt-BR/omarchy.md) — extras para quem usa Omarchy
236
+ - [docs/pt-BR/portability.md](docs/pt-BR/portability.md) — o roadmap: Linux, macOS e Windows nativo, qualquer agente como conductor, papéis definidos pelo usuário, setup guiado
237
+ - [CHANGELOG.pt-BR.md](CHANGELOG.pt-BR.md) — o que mudou, versão a versão
238
+ - `examples/` — configurações reais para copiar
239
+
240
+ ## Licença
241
+
242
+ [MIT](LICENSE)
@@ -0,0 +1,18 @@
1
+ // Claude accounts (one CLAUDE_CONFIG_DIR folder per account), from the claude-accounts file: lines "<name> <folder>".
2
+ // File: $CLAUDE_ACCOUNTS_FILE, else claude-accounts next to orq's config folder (~/.config/claude-accounts on
3
+ // Linux/macOS, %APPDATA%\claude-accounts on Windows). No file → one account, "claude", in ~/.claude.
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import { homedir } from "node:os";
6
+ import { dirname, join } from "node:path";
7
+ import { configDir, expand } from "./paths.js";
8
+ export const accountsFile = () => process.env.CLAUDE_ACCOUNTS_FILE ?? join(dirname(configDir()), "claude-accounts");
9
+ export function claudeAccounts() {
10
+ const f = accountsFile();
11
+ if (!existsSync(f))
12
+ return [{ name: "claude", dir: process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), ".claude") }];
13
+ const seen = new Set();
14
+ return readFileSync(f, "utf8").split(/\r?\n/)
15
+ .map((l) => l.replace(/#.*/, "").trim().split(/\s+/))
16
+ .filter((p) => p.length >= 2 && !seen.has(p[1]) && seen.add(p[1]))
17
+ .map(([name, dir]) => ({ name, dir: expand(dir) }));
18
+ }