hopfuse: how Hop picks minds and judges their answers
Hop chooses who answers, for every message; there is no model or agent to pick. You say what you want; Hop sorts the request, hands it to the cheapest mind that should be good enough (your own model first, when it is there and the request is something to answer), hands it on to a stronger one when the answer is not sure, and for open-ended work asks several minds from different makers at once and fuses what they say. The choosing is done by one piece of seeded Omega, Omega/hopfuse.om, linked into Hop as native code through the binding in Generated/, the same way as hopfact (see Omega/README.md).
The design follows spec/cognitive-routing.md in omega-mv: a requirement, the cheapest ladder expected to meet it, a bounded number of escalations, an ensemble class, and a refusal in place of a silent approximation. It does not use that spec's measured profiles: Hop has no labelled trials for the tools on your Mac, so tiers and costs are stated in the settings and the plan says when it is working without what it wanted (word 12 below).
Who does what
The core (Omega/hopfuse.om) decides the shape of the work among the seats it is shown (PLAN) and whether a round of replies is agreement (JUDGE). It runs nothing, holds no state between calls and allocates nothing.
The host is Swift (Sources/Fusion.swift; the Agent screen reaches it through Sources/Pick.swift, the command line through hop fuse). It finds the seats, runs them, reads their replies and shows the result. It also decides things the core does not, and each of them is listed under "What the host does" below: which mind sorts a request, that the person's own model is shown to the core alone first, when a reply counts as unsure, what "Stronger" hides from the core, and that a plan the minds did not agree on is not carried out.
What the minds say to each other
A mind ends its reply with a small Omegese record, and the next step is decided from its numbers, not from its prose:
note hop record
fn confidence to ulong
ret 870000
end
The host reads only fn NAME to ulong, ret N, end after the marker line note hop record; anything else ends the record. A record is a valid Omega unit body: the same lines compile with omc. The host does not run a compiler on it.
Records in use:
| Step | Functions | Meaning |
|---|---|---|
| Sorting | kind 1..3, difficulty 1..5, stakes 1..3, confidence | what the request is |
| An answer or a proposal | confidence | how sure the mind is, in parts per million |
| A reply to a fused draft | deltas, agree 0 or 1, confidence | how many changes it asks for, and whether the draft should stand |
In a reply to a draft, silence is agreement: a mind that agrees writes nothing but the record, and only the changes asked for travel back to the mind that fuses.
What this is not: the minds are separate programs, each either a model server asked over HTTP or an agent tool started as a command, of different makers or of one. They exchange text. Nothing of one model's internal state reaches another.
Native ABI (bridge native call ABI v1, profile OM-1)
/* fn hopfuse inp view ulong 256 res edit ulong 256 to ulong */
uint32_t omega_hopfuse(uint64_t *result, const void *o_inp, uint64_t o_inp_len, void *o_res, uint64_t o_res_len);
Lengths, alignment, status codes and threading are as for omega_hopfact (Omega/README.md). The host shows any nonzero status as INVALID.
Input inp[256]
| Word | PLAN (word 2 = 1) | JUDGE (word 2 = 2) |
|---|---|---|
| 0, 1 | magic 1212568915, version 1 | the same |
| 3 | number of seats, 0 to 16 | number of replies, 0 to 8 |
| 4 | kind: 1 answer, 2 make, 3 act (changes things) | rounds already done, 0 to 3 |
| 5 | difficulty: 0 unknown, 1 trivial, 2 simple, 3 standard, 4 hard, 5 open-ended | most rounds, 0 to 3 |
| 6 | stakes: 0 unknown, 1 low, 2 normal, 3 high | 0 |
| 7 | how sure the sorting was, 0 to 1000000 | 0 |
| 8 | most seats at once, 1 to 8 | 0 |
| 9 | most escalations, 0 to 3 | 0 |
| 10 | flags: bit 0 the host already has the exact answer, bit 1 fuse, bit 2 never fuse | 0 |
| 11..15 | 0 | 0 |
16+6r .. 21+6r | seat r: id (unique, at most 65535), tier 1..4, family 1..31, cost up to 1000000, state (0 unknown, 1 ready, 2 limited, 3 down), capabilities (bit 0 answers, bit 1 acts) | reply r: seat id, status (0 unknown, 1 answered, 2 failed, 3 timed out, 4 no record), confidence, deltas up to 1000, agree 0 or 1, 0 |
| rest | 0 | 0 |
Output res[256], PLAN
-1 means all bits set: none.
| Word | Meaning |
|---|---|
| 0, 1 | magic, version |
| 2 | verdict (equal to *result) |
| 3 | reason: INVALID see below; REFUSED 80 no seat is ready, 81 seats are ready but none can do it |
| 4 | INVALID: the first faulting input word |
| 5 | wanted tier |
| 6 | the difficulty the plan meets, after raising |
| 7 | number of chosen seats |
| 8 | the seat that fuses (-1 when none) |
| 9 | the seat that carries out fused work that changes things (-1 when none) |
| 10 | rounds of replies to the draft: 1, or 2 when the stakes are high |
| 11 | sum of the chosen seats' costs |
| 12 | why the plan is what it is: 1 the difficulty was unknown, 2 the sorting was unsure, 4 high stakes, 8 a fusion was wanted and could not be formed, 16 no seat of the wanted tier, 32 a limited seat is used |
16+i | chosen seat ids, in the order they are asked |
32+s | role of input seat s: 0 not used, 1 chosen, 2 fuses only, 3 carries out only, 4 may not be chosen (unknown or down) |
Verdicts:
| Verdict | Name | When |
|---|---|---|
| 1 | INVALID | the input is malformed; only words 0 to 4 are set |
| 2 | REFUSED | no seat can do it; nothing is approximated |
| 3 | DIRECT | the host already has the exact answer; no seat is asked |
| 4 | SINGLE | one seat |
| 5 | LADDER | one seat, then stronger ones if its answer is not accepted |
| 6 | FUSION | several seats at once, one that fuses |
Rules, in order:
- An unknown difficulty counts as standard, never less. A sorting that was not sure (under 600000) raises the difficulty one step, to hard at most. High stakes raise it one more step.
- The wanted tier is the difficulty, and 4 for hard and open-ended.
- A seat whose state is unknown or down is never chosen. A limited seat is chosen only when no ready seat can do the work.
- Work that changes things goes only to a seat that can act.
- A fusion is wanted for open-ended work or when the user asks for one, unless the user forbids it or only one seat at a time is allowed. Its proposers are seats of tier 3 or 4 that can answer, one per family first (ready before limited, then the higher tier, then the cheaper), at most as many as allowed; if that gives fewer than two, one more of a family already used may join. With fewer than two it is not a fusion: the plan falls back to a ladder and says so (word 12, value 8).
- A ladder starts at the cheapest seat that has the wanted tier. Each escalation is the cheapest seat of a higher tier than the rung before. When no seat reaches the wanted tier the strongest one is used and the plan says so (word 12, value 16).
INVALID reasons: 1 magic, 2 version, 3 operation, 4 a word with bit 63 set, 5 a count over its limit, 6 tier, 7 family or agree flag, 8 duplicate id, 9 capability mask, 10 nonzero padding, 11 too many rows, 12 a header word out of range, 13 a reserved header word is not 0, 14 state or status code, 15 id over 65535.
Output res[256], JUDGE
| Word | Meaning |
|---|---|
| 2 | verdict |
| 5 | usable replies (status 1) |
| 6 | changes asked for, in all |
| 7 | lowest confidence among the usable replies (-1 when none) |
| 8 | replies that do not agree |
16+i | seat ids of the usable replies |
32+r | reply r: 1 agrees, 2 does not agree, 3 not usable |
A reply agrees only when it says so and asks for no change. A reply that says it agrees and still asks for changes does not agree. An unknown status is never agreement.
| Verdict | Name | When |
|---|---|---|
| 7 | CONSENSUS | two or more usable replies, all agree |
| 8 | ANOTHER_ROUND | some do not agree and rounds are left |
| 9 | SETTLE | some do not agree and no round is left: the changes are applied once more and what stays unsettled is said |
| 10 | ONE_VOICE | one usable reply |
| 11 | NONE | no usable reply |
What the host does
Before the plan:
- Seats. One per model server in the settings (not one marked
"rewrite": false, and not the person's own ones whenpreferOwnModelis false), one per installed agent tool, and for Claude Code its small model as a chat-only command (tools switched off). Claude Code's own seat is started with Claude's strong model by name (--model opus), and one more seat runs its middle model with the person's own Claude command; when that command names a model itself, the seat has that model's tier and there is no middle-model seat beside it. A model server on this Mac or the person's network is the person's own model: tier 3 unless the settings give it a tier, cost 1. One reached online is tier 2, cost 30 (1 when the settings call it free).fusionSeatsreplaces all of this with the person's list. - Ready. A tool is ready when it is found; a model server when it answers its model list within two seconds. A seat that failed in the last ten minutes on the Agent screen is not ready, and its reason is kept; one that was only busy is asked again next time.
- More than 16 seats. The core plans 16. The ready ones are taken first, in the order of the settings, and a line in the conversation names the ones left out.
- Sorting. The request is sorted by a ready model server or by Hop's own chat-only command (the Claude CLI started with every tool off): the person's own model first, whatever its tier, then the cheapest of the others that is not of the highest tier. A command from the settings never sorts. It gets the request and the last four messages of the conversation, each cut to 600 characters. One more is asked if the first gives no usable record. Neither of the two needs the yes: nothing runs on this Mac for a model server, and the chat-only command can answer and nothing else. With no usable sorting the words decide; a message that follows work that changed things, or a short go-ahead after any conversation, is then taken as work that changes things too. A go-ahead is at most six words, all of them words of consent or of doing ("yes, do that", "ok", "go ahead", "run it"), and not a question ("Do you know French?" is not one).
- The yes. Before the first command of a run is started on this Mac, the person's yes to agent tools is asked (once ever; it is kept in the settings). That covers every seat that is a command, whatever the settings say it is for, in every role: the test question, answering, proposing, fusing, a replacement, carrying out. A no ends the run with nothing started.
hop fusecannot ask: without a yes given before in Hop's window it runs no command but Hop's own chat-only one.
With a plan:
- Own model first. While an own model is ready and the request is something to answer or write (not work that changes things, not a plain sum), the core is shown the own models alone, with one seat at a time and no fusion, whatever the difficulty. When that model is busy or fails, the host marks it down and asks the core again among all the other seats. When it answers and is unsure, the core is asked again among the seats of a higher tier only; when there is none, its answer stands.
- DIRECT: Hop does plain sums itself (digits,
+ - * /, brackets) and shows the result, also when no seat exists. A date or a number with dashes, or a number that starts with 0 (555-0199), is not a sum; neither is one with a number of more than 15 digits or a step that reaches 10^15. The sum is worked out in whole-number fractions, so no step rounds (100000000000000 + 0.1 - 100000000000000 is 0.1); a fraction that outgrows 64 bits, or a result that cannot be written out exactly in ten places after the point (1/3), is left to a mind. - SINGLE and LADDER: the seat's reply is shown as it arrives: a model server's as it streams, a tool's line by line as the tool prints it, and Hop's own chat-only Claude seat's in the small pieces Claude Code sends (it is asked for partial messages). If its record says it is unsure (under 700000) and a stronger rung is left, that one is asked and its reply replaces the first. Stronger means a higher tier: after an answer that was not sure, a seat of the same tier or below is not asked, also not when the plan is made again. No seat is given the request twice in one run: a seat that was given it counts as down in every plan after, so when a later rung turns out not to be ready the request does not go back to the first. When nobody stronger can take it, or the stronger minds give no answer (none answers, none can fuse), the answer that was not sure stands and is put back on screen. The same tier rule holds when a seat that fuses is replaced. When the seat that is to fuse or to carry out cannot take that on (a model server that fails while it fuses, or a tool that fails the test question before it is given the work), any seat that proposed and has not failed takes its place (for carrying out: one that may act); one such seat is enough, no new fusion is formed for it. A command that fails after it was given the fusing or the carrying out is not replaced: the run ends there, as after any command that fails on the work. A reply without a record is taken as it is. A reply that is nothing but a record is a failure.
- The test question. Before an agent tool that Hop knows by name (its table of tools), with a command that takes what it is asked as text (
{prompt}), is given a request, in any role, it is asked "Reply with exactly one word: ready. Do not use any tools." and has a minute for it, unless it showed in the last ten minutes that it is ready (it passed this, or answered a request; the Agent screen keeps that,hop fuseasks every time). The reply must have a line that is that word and nothing else, the command must end well and in time. A tool that fails on it (not signed in, no credit, no quota, cannot be started, "not ready", no reply) is marked down with the reason and the core is asked again: it has not been given the request. Whatever the question started is ended, and waited for, before anything else starts. Any other command (one of the person's own that Hop does not know, or one with no place for the text) is never asked the question: it is run with the request only. A command with no place for the text is run once for a request and is never part of a fusion: when the core plans a fusion with such a seat in it, the host asks again without those seats, and when no fusion is left, for one seat to do the work (flag bit 2). - A model server that fails while it is asked (busy, not answering, timed out, a reply that is only a record) is marked down and the core is asked again. There is no count of tries: every new plan follows a seat that was marked down, so the choosing ends when the seats do.
- After a command that was given the request fails, nobody is started in its place, whatever kind the request is and whatever the command says went wrong: it may have changed something, Hop cannot see what, and a second one would do it over. The run ends and says so. In a fusion that holds for every command that saw the request: one that fails to propose, to look at the draft, to fuse or to put the changes in ends the run, also when the others answered. A command whose time is up is ended with everything it started, and that is waited for; when it cannot be ended, it stays known and no command is started beside it, in this run or the next. A tool that reports an error of its own (Claude Code's error result) has failed, whatever its exit status; that is read from the event, and an answer that merely begins like an error is an answer. When only one of the minds of a fusion answers, its answer is one mind's answer, it is not asked again, and the line under it is that mind's own (for a model server: where it ran and the model it named); when none does, the core is asked again without them. Work that changes things is never run twice because a record was unsure.
- FUSION: the proposers work alone and at the same time. The fusing seat sees their answers as "Mind 1", "Mind 2" without names. The others then see the draft and reply with changes or with silence. Every stage gets the conversation so far. For work that changes things the proposers are told to plan and change nothing, and one seat carries out the plan, but only when the others agreed to the draft or the changes they asked for were put in. When too few came back, or the changes could not be put in, the plan is shown, said to be only a plan, and given to no seat to carry out. When only one mind answered at all, its plan is carried out as a single mind's would be. A proposal, a fused text, a merged text or the reply of the seat that carries out the plan that is nothing but a record is a failure, never an empty answer and never taken as work done. When a model server cannot put the changes in, no other seat is asked: the draft is shown as it is. A plan the minds did not agree on is given to no tool to carry out, and Hop says that and no more: it cannot say that the tools that planned changed nothing.
- Stronger (
Fusion.planwith a standing): the same request and the same sorting, planned again with every seat of the tier that answered, and below, marked down, so the core picks among higher tiers only. When no ready seat of a higher tier can do the work, a fusion is asked for (flag bit 1) and taken only when the core forms one. After a fusion nothing is stronger: the host answers verdict 2 with its own reason 82 without calling the core. The mind asked gets the earlier reply with the request. On the Agent screen the earlier answer comes back when the stronger try gives none, and what the failed try had written of its own answer is dropped. - The conversation so far goes with the request: a model server gets it as messages, a tool as text in front of the request. A tool that keeps its own session (Claude Code names one) carries on in it when it also answered the message before, within 15 minutes.
- A single seat's reply, and the reply of the seat that carries out a plan, is shown while it arrives. In a fusion the proposals, the draft and the looks at it are not shown; the fused text is shown when it is done. The record at a reply's end (everything from the last marker line on), a code fence opened just for the record, the blank lines before it and the line end after the last line are never shown. Where what was shown in pieces differs from the reply the record reader keeps (spaces around the reply, a quoted marker before a fenced record), the kept reply is put on screen in its place when the reply is over, so the two are the same.
- Stop. A command runs as the leader of a process group of its own (Hop starts itself once more only to make the group and become the command). On Stop the command, the processes below it and the whole group are asked to end; what is still running five seconds later is ended by force: the command, the processes seen below it at the stop, every member of the group (so also what was started while the command was ending, and what a command that had already ended by itself left running), and everything below those. The run starts nothing more: a command that had not been launched yet is never launched. The next message does not wait to be taken, but no command is started for it while a stopped command or anything of it is still running (a model server is asked at once). If that is still so ten seconds after it was looked for, no command is started and the run says that the stopped tool could not be ended.
hop fusestops everything it started the same way on Ctrl-C, from its first question on, and ends when the tools are gone (or says that one could not be ended). - Counting. The tokens of every call of a run are counted where they went (this Mac, the network, online), as the server or tool reported them; a model server that reports none is estimated; a tool that reports none is not counted. An answer is kept for an instant repeat only when no command the yes covers ran for it, the test question included (Hop's own chat-only Claude seat, which has no tools, does not count as one).
Limits
- Tiers and costs are what the settings say (
fusionSeats, ortier,familyandcoston one agent or model), or Hop's own table for the tools it knows by name. Nothing is measured, and how much of a subscription is left is not looked at. - Words only ever raise the difficulty and the kind the sorting gave.
- "Stronger" means a higher tier in that table, not a measured better answer.
- Words such as fix, run, delete or deploy make it work that changes things unless the whole request is one question ("How do I delete a branch?"). A request of more than one sentence ("Is it green? If so, deploy it."), or one that asks for the work to be done ("Can you…", "Why don't you…"), stays work that changes things.
- Hop cannot see what a tool did to the disk. So nothing a tool says after it was given a request is taken as proof that it did nothing, and the only tool that is passed over is one that failed on the test question, before it saw the request. The price is that question: a small call to the tool before the first request and after ten quiet minutes. The test question itself goes to a tool that could act; it is told to use no tools, and it holds no request to carry out. Hop takes it that a tool it knows by name does what the text it is given says: one set up in the settings so that it does work whatever it is asked would do that work on the test question too.
- "Change nothing" in a proposal is an instruction to the tool. Hop cannot hold a tool to it; a tool started with flags that switch its approval prompts off may still act.
- A seat counts as ready when its tool is found (or its server answers its model list). Hop learns that an account is signed out or empty only when it asks.
- The core plans at most 16 seats and judges at most 8 replies (the size of its fixed input, 256 words).
fusionMaxSeatsis 1 to 8 andfusionEscalations0 to 3 for the same reason; a value outside is brought into the range and Hop's window says so. - Stop reaches the command, the processes below it and its process group. A process that left both (it moved to another group and its parents ended) before Hop looked is not found, neither for ending nor for the wait before the next command. A tool that ended by itself, without a Stop and within its time, is not looked at again: what it left running stays (a tool may start a server on purpose).
- A fusion asks seats of different makers first; when that gives fewer than two, one more of a maker already used may join (rule 5 above), so two voices can come from one maker.
- Work that changes things has no time limit (the person can stop it); an answer has 30 minutes, a proposal or a fusing step 15, the sorting 25 seconds.
- Generation runs only on Linux AArch64 (
Omega/gen.sh). The Mac only compiles the generated C. Check on macOS arm64:sh Omega/tests/check-fuse-mac.sh.