Nexus Legacy Advisor
A Firefox extension for Nexus Legacy that reads your colony from the game's own API and tells you the best one or two things to build or research next.
It only ever reads. Every recommendation is something you click yourself.
How it decides
For each action you could legally take right now, it simulates the colony with that action applied and measures how much value you would actually bank over a 24-hour horizon, then ranks by return on the resources spent.
That one mechanism reproduces the advice the beginner's guide gives by hand:
| Situation | What falls out of the simulation |
|---|---|
| A mine upgrade would outrun your power | Energy factor drops, throttling every resource, so the upgrade's own gain is discounted and the loss elsewhere is shown |
| Your silo is already full | Banked value is capped at storage headroom, so the mine upgrade scores zero and the Storage Complex scores well |
| The upgrade needs alloys you cannot produce | Reported as permanently blocked, not "save up for it" |
| A cost exceeds your storage capacity | Flagged as unreachable until storage grows |
| Everything is net-negative over the horizon | Ranked by payback rather than absolute value, so it does not pick armour plating just because it is cheap |
The two picks are sequenced: the second is scored against the colony as it will be once the first one finishes. That is why suggesting a mine upgrade is usually followed by a Solar Plant rather than a second mine.
Because the build queue and the research lab run in parallel, when the lab is idle you get one of each.
Where the numbers come from
Nothing about the game is hardcoded. Costs, build times, prerequisites and
level caps are read per-request from /api/planets/:id and
/api/research?planetId=, which report the exact next-level figures.
The two formulas the API does not expose were taken from the game's own client bundle and verified against the live server:
production(perLevel, level) = floor(perLevel * level * 1.07^level * gameSpeed)
energy(perLevel, level) = floor(perLevel * level * 1.07^level)
Reconstructing every building on a live colony from those formulas reproduces
the server's reported base production and its exact energy produced/consumed
totals. test/advisor.test.js asserts this, so the model cannot drift.
Costs and gains in different resources are compared using the standardised trading values from the official guide: ore 1, silicate 2, hydrogen 3, alloy 4.
Install (Firefox)
Grab the latest .xpi from Releases, or clone the
repo and load the source directly:
- Open
about:debugging#/runtime/this-firefox. - Click Load Temporary Add-on….
- Select
manifest.json(or the downloaded.xpi). - Open your universe —
s0.nexuslegacy.space,beta…ornewfrontier…— and sign in.
A panel appears in the top right of the game. Drag it by its header; the position and collapsed state are remembered. The Firefox sidebar (View → Sidebar → Nexus Legacy Advisor) shows the same advice plus ranked alternatives.
Or build a package and load that instead:
npm run build
which writes dist/nexus-legacy-advisor-<version>.xpi.
Temporary add-ons are removed when Firefox restarts. For a permanent install the
.xpihas to be signed — submit it at addons.mozilla.org, or use Firefox Developer Edition / Nightly withxpinstall.signatures.requiredset tofalseinabout:config.
The lobby at nexuslegacy.space has no colony data. Universes live on
subdomains, and the extension is deliberately quiet on the apex domain.
Several games at once
s0, beta and newfrontier are separate games with separate colonies, and
planet ids are only unique within a universe. The extension keeps them apart
rather than letting whichever tab polled last win:
- The in-game panel is per-tab and labelled with its universe, so the header always names the game you are looking at.
- The sidebar binds to one universe at a time. It follows your active tab by default; when more than one game is open a Game picker appears so you can pin it to one. Broadcasts from any other universe are discarded — both the universe stamped on the message and the sender's real URL have to match.
- The popup reports on the active tab, not on whichever game tab it happened to find first.
- Requests are addressed. Every message carries its universe, and a tab that receives one meant for another game refuses it instead of answering.
- Planet selection is per-universe. It is stored in
localStorage, which is per-origin, sobeta's choice cannot leak intos0. A planet id that does not belong to the universe being asked is reported and dropped rather than quietly swapped for that universe's homeworld — silent fallback is exactly how one game's colony ends up displayed under another game's name. - The text export is tagged
NEXUS LEGACY [s0] - …so a pasted summary says which game it came from.
Using it
- Next moves — one or two actions, with the real cost, build time, payback and the reason. Warnings call out anything that would throttle your power or cannot be paid for.
- Watch out — power deficits, storage about to overflow, an idle lab, no free building slots.
- Copy — a plain-text summary of the colony and the advice, for pasting into an alliance chat or an AI assistant.
Development
npm test
42 tests in two suites:
test/advisor.test.js(30) — model fidelity against the live server, the level curve, energy consequences, storage overflow, affordability, eligibility gates and the shape of the recommendations.test/universe.test.js(12) — universe identification, message routing, broadcast filtering and cross-universe planet ids.
To see the engine and UI render without loading the extension:
python -m http.server 8931
then open http://127.0.0.1:8931/test/preview.html. It runs the real engine
against a fixture captured from a live day-one colony and offers scenario
buttons (power deficit, storage full, lab idle, queues busy). Opening it over
file:// will not work — the scripts need a real origin.
Layout
manifest.json Firefox MV3 manifest
background.js Opens the sidebar from the toolbar button
content.js Runs on universe subdomains: polls the API, paints the panel
src/
api.js API client, universe detection, error handling
state.js Normalises API payloads; the level curve and value model
advisor.js Candidate generation, simulation, ranking, explanations
render.js Shared DOM building (textContent only - names are hostile input)
overlay.js In-game floating panel, in a shadow root
theme.js The single stylesheet, shared by overlay/sidebar/popup
sidebar.* Firefox sidebar panel
popup.* Toolbar popup
scripts/build.js Dependency-free .xpi packager
test/
advisor.test.js Engine tests
universe.test.js Cross-universe isolation tests
fixtures/ Live capture from s0, with the account identity removed
preview.html Visual harness
Notes
- Player-controlled text (planet, alliance and commander names) is only ever
written with
textContent, neverinnerHTML. - The overlay lives in a shadow root, so the game's stylesheet and ours cannot reach each other.
- Polling backs off from 20s to 120s while the tab is hidden.
Building on this
The engine is deliberately separable: src/state.js and src/advisor.js are
plain modules with no browser dependencies, so they run under Node and can be
reused outside the extension entirely.
const S = require('./src/state.js');
const A = require('./src/advisor.js');
const state = S.normalize(planetPayload, researchPayload, mePayload, configPayload);
const result = A.recommend(state, { horizonHours: 48 });
console.log(result.picks);
recommend() also returns all, every scored candidate ranked, and blocked,
everything ineligible with the reason why — enough to build a different UI, a
longer-horizon planner, or a multi-colony view on top without touching the
engine.
See CONTRIBUTING.md for the seams and the one rule that matters: nothing about the game gets guessed.
Licence
MIT. Do what you like with it.
Not affiliated with or endorsed by the developers of Nexus Legacy. It reads the game's own API with your session and never writes to it, but you are responsible for checking that suits the game's rules before you use it.
Limits
- Advice covers one colony at a time. The sidebar has a planet picker; the recommendation is always for the selected colony of the selected game.
- Economy only, as intended — fleet, combat and defence are read but not scored.
- Population effects (Residential, Medical Bay, Bio Complex) are shown but not valued, because the worker multiplier's exact curve is not exposed by the API.
solar_energy_bonusresearch is modelled as a whole-grid bonus. That is exact while solar is your only power source and slightly optimistic once thermal or fusion plants are running.- Payback figures assume you keep the colony powered and do not sell resources.