<recommended_plugins>
Here is a list of plugins that are available but not installed. If the user's query would benefit from one of these plugins, use the request_plugin_install tool to suggest that they install it. Pass the parenthesized ID as plugin_id. For example, suggest the Google Drive plugin if the query could possibly be better answered with access to Google Drive.
Do you want to do one quick pass on the overworld economy? The tests are passing which is great, but in game, the chests are not filling.
Herbalist should be collecting and depositing herbs
Miner should be mining and depositing ore
Woodcutter should be choppping down trees and depositing wood.
Smithy should be making knives and other forged items.
Anyhow! Do your best and making it all come together.
Assistant
I’ll trace the overworld production chain from worker behavior through harvesting, inventory transfer, storage, and smithy crafting, using the repository’s historical checkpoints to distinguish intended behavior from merely passing tests. Then I’ll implement the smallest coherent fix and run focused economy tests plus the relevant architecture guardrails.
Assistant
The using-entire workflow is guiding this investigation: I’m checking saved implementation intent before changing unfamiliar economy code, especially because the visible symptom (“empty chests”) could come from harvesting, hauling, ownership, or crafting rather than the chest itself.
Assistant
Recorded intent confirms the economy was designed as a physical loop—workers gather into their own inventories, walk to named storage, then the smith consumes ore/coal/lumber and places forged tools in the smithy chest. I’ve found a gap the unit tests largely hide: the live AI only updates townfolk inside a player-centered radius, while generated work sites and delivery routes can extend beyond it. I’m now reproducing this against an actual generated overworld rather than isolated fixtures.
Assistant
The generated-overworld reproduction exposed two concrete live-data failures in addition to the update radius:
For the canonical seed, the miner’s nearest authored ore is 15 tiles from the work waypoint, but the miner only searches 8 tiles.
The woodcutter camp can receive zero TreeNode spawns when its terrain-specific placement pass finds no eligible forest tile.
That explains the stalled chain: no lumber reaches the lumber chest, ore harvesting is disconnected from actual nodes, and the smith never gets the inputs needed to forge knives/tools. I’m fixing generation guarantees, aligning the miner’s search radius with authored placement, and allowing the small town population to keep simulating across the overworld.
Assistant
The focused tests now pass against both isolated behavior and procedural overworld generation. The live layout now guarantees nearby herbs, distinct ore nodes, and trees for the three producers; workers no longer freeze just because the player walks more than 40 tiles away. I’m doing the final architecture/event checks and a fresh generated-seed audit before handing it back.
Assistant
Implemented a pass on the overworld economy.
Key fixes:
Town workers now continue operating outside the player’s former 40-tile simulation radius.
Miner search range now matches generated ore placement.
Resource nodes no longer overlap during camp generation.
Existing deposit and smithy pipelines can now receive inputs and forge knives, hatchets, pickaxes, shields, and warhammers.
Verification:
58 focused economy/overworld tests passed.
Architecture and event guardrails passed.
Agent health reports zero layer violations, nondeterminism hazards, or system-to-system calls.
New regression coverage ensures workers operate offscreen and every producer has resources within working range. Existing worlds may need an overworld regeneration/new game to gain newly guaranteed resource nodes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
AGENTS.md instructions for /home/pjensen/Repos/JSHack
--- project-doc ---
AGENTS.md - JSHack Field Manual
JSHack is a zero-dependency browser roguelike: pure JavaScript, pure ES modules,
ECS architecture, Deno tooling. This file is optimized for coding agents. Prefer
the commands below over manual spelunking.
Deeper docs:
README.md
SEPARATION_MANIFEST.md
RUNTIME_TOPOLOGY_DOCTRINE.md
TEN_COMMANDMENTS.md
ecs-js/AGENTS.md
Hard Laws
No build step. Pure ES modules. No webpack, babel, JSX, TypeScript, or
bundling.
Deno, not Node. Tests and tools run with Deno. Default test command:
deno test --allow-read.
JavaScript only. Keep source as .js / .mjs.
Mobile-first. Touch is primary; desktop keyboard is secondary.
Separation is law.rules/ never imports display/ or bridge/;
display/ never imports rules/; bridge/ projects read-only rule state.
No system-to-system calls. Systems communicate with world.emit /
world.on; scheduler owns ordering.
New events use concrete event classes. Any new event contract must define
a concrete EcsEvent class and emit an instance with
world.emit(new Event(...)). Do not introduce string-only events or parallel
string re-emits for new contracts.
Touched listener installers use canonical extensions. Any new listener
installer, or any existing listener installer touched during a task, must use
defineExtension(...) and world.install(...) for idempotent installation.
Do not add new bespoke symbol-guard installers.
No swallowed event failures. Do not add emitSafe-style wrappers around
world.emit.
No new world-attached state. Do not attach simulation state to world
with symbol or property keys (world[...], ctx.world[...]). Use ECS
components for state; when the state is genuinely world-scoped, model it as an
explicit singleton entity/component and document the allowance. Existing
world-attached state is a ratcheted architecture debt tracked by
ratchets/worldStateAttachmentRatchet.test.mjs.
Determinism is sacred. In rules simulation use world.rand(), never
Math.random(). No timers/fetch/promises/async in systems.
Integer grid only. World coords may be negative. Do not clamp to >= 0;
normalize with Number.isFinite(v) ? (v | 0) : fallback.
One canonical path. Spawn, damage, spell cast, status application,
inventory transfer, and materialization paths must delegate to the canonical
implementation.
Runtime multiplicity is child entities. Runtime
effects/procs/sockets/enchantments are child topology, not arrays on parent
components.
ECS-js is vendored. Do not edit src/lib/ecs-js/ unless fixing the ECS
library itself.
Authoring discipline. Do not touch unrelated code. Do not make changes
that do nothing. Always match the formatting preferences that already exist;
be a chameleon.
Do not format code unless explicitly requested. Do not run deno fmt or
any other formatter as part of implementation or verification. Preserve the
existing formatting and keep diffs limited to the requested functional edits.
Search before writing. Extend existing patterns. Do exactly what was
asked; no opportunistic content wiring or unrelated cleanup.
Verify in proportion to the change. Run focused tests and guardrails that
cover the touched behavior. Do not run the full runtime suite by default; it
is allowed only when explicitly requested or when the change genuinely needs
broad regression coverage. Always report what was run and any known or
observed failures.
Content authoring comes first. When adding content-facing behavior,
prefer small authored definitions, generic affordances, and reusable engine
surfaces over bespoke wiring. If a feature needs UI or interaction glue, ask
whether defineInteractable(), content DSLs, or an existing canonical
pipeline should own it before adding one-off main/display code.
Agent Commands
Run these before guessing.
Guardrail Tasks
Prefer these Deno tasks over hand-assembled command strings:
deno run --allow-read tools/agent-health.mjs
deno run --allow-read tools/import-boundary-report.mjs
deno run --allow-read tools/system-map.mjs
agent-health summarizes boundary violations, remaining emitSafe refs,
nondeterminism hazards, generation-time async allowances, system counts, and
possible system-to-system calls. Classified allowances are context for agents;
headline hazards are the things to investigate first.
Event Bus
bash
deno run --allow-read tools/event-bus-explorer.mjs --format summary --top 40
deno run --allow-read tools/event-bus-explorer.mjs --format csv --event damaged
deno run --allow-read tools/event-bus-explorer.mjs --format mermaid --event damaged
deno run --allow-read tools/event-bus-explorer.mjs --producer-only --format summary --top 40
deno run --allow-read tools/event-bus-explorer.mjs --consumer-only --format summary --top 40
Use producer-only events to find emitted behavior with no consumer. Use
consumer-only events to find stale listeners, dynamic producers, or missing
producers.
System Map
bash
deno run --allow-read tools/system-map.mjs --format summary
deno run --allow-read tools/system-map.mjs --format csv
deno run --allow-read tools/system-map.mjs --phase effects
deno run --allow-read tools/system-map.mjs --unregistered
deno run --allow-read tools/system-map.mjs --missing-tests
Scheduler truth lives in src/main/scheduler.js. Some
imported-not-registered files are listener installers, not phase systems; audit
before deleting.
Target Lookup
bash
deno run --allow-read tools/agent-target.mjs damaged --limit 80
deno run --allow-read tools/content-id-audit.mjs goblin --limit 80
deno run --allow-read tools/content-id-audit.mjs potion_water --limit 80
agent-target is a ranked code search for events/functions/files/tests.
content-id-audit follows item, monster, spell, material, loot, visual, and
test references by ID.
Focused Tests
bash
deno test --allow-read tests/separationBoundaries.test.mjs
deno test --allow-read tests/determinismArchitectureGuards.test.mjs
deno test --allow-read tests/schedulerArchitectureGuards.test.mjs
deno test --allow-read tests/dealDamage.test.mjs
deno test --allow-read tests/castSpell.test.mjs
deno test --allow-read tests/interaction.test.mjs
deno test --allow-read tests/movementRefactored.test.mjs
deno test --allow-read tests/contentCatalogCanonical.test.mjs
Prefer the smallest meaningful verification set: changed test files, adjacent
behavior tests, architecture guardrails, and targeted audit tools. If you do run
broad runtime coverage, use deno test --allow-read --no-check and treat
pre-existing failures as baseline debt to report, not as permission to obscure
new failures.
Plain deno test --allow-read may fail during type-check on non-game packaging
scripts before tests run. Use --no-check for runtime coverage when type-check
is not the thing being tested.
rules/ deterministic simulation; no DOM, display, timers, async systems
bridge/ read-only projection from rules state to WorldView DTOs
display/ presentation only; reads WorldView and main-provided contracts
main/ wiring, lifecycle, input dispatch, scheduler setup
shared/ pure math/grid utilities; no ECS or DOM
lib/ vendored ecs-js and deity-js
content/ DSL-authored content definitions and content helpers
Five scheduler phases are declared in
src/main/scheduler.js:
text
ai intent producers
intents movement/combat/use/cast/interaction consumers
effects per-turn derived effects and world simulation
scripts content DSL tick hooks
cleanup entity removal, lifespan, spatial sync
The bridge contract is
src/bridge/schema/worldView.js. Display must
not push tags onto entity records; tag projection belongs in the bridge.
The architecture exists to make strange rules cheap to author. Before adding a
new one-off interaction, modal, command, or UI bridge, look for the content
surface that should own it:
defineInteractable() for object affordances, verbs, prompts, and hooks.
Content DSL/catalog files for canonical item, monster, spell, and feature
authoring.
Existing rules pipelines for spawn, damage, use/apply, status, inventory, and
transitions.
The standard is not "least code today." The standard is whether the next weird
rule becomes small, explicit, composable, deterministic, and inspectable.
Listener Installers
Use defineExtension(...) and world.install(...) for listener installers:
Install listeners with world.install(featureListeners) from configureWorld()
unless the feature is display/main wiring.
New Systems
Add src/rules/systems/mySystem.js.
Register it in src/main/scheduler.js in the right
phase.
Add a focused test in tests/.
Run deno test --allow-read tests/mySystem.test.mjs.
Spatial Queries
Use forEachInRadius, forEachInRect, or tile query helpers. Do not full-scan
world.query() for proximity-sensitive behavior.
Spawning
Route through canonical archetypes/materialization helpers. Debug spawns,
dungeon population, and spawner children must have parity tests if they differ.
Events
New event contracts must be concrete EcsEvent classes: