<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.
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:
I've heard good things about your capabilities -- why don't you take a pass at cleaning up dungeon generation since this is one of the more technical domains in the project.
ensure there are not random doors in the middle of rooms
see if you can digure out how to improve gates and valve placement
ensure dead-end leaf rooms as well decorated and thematic
see if we can add more lighting (I've turned down background lighting and so we need to lean on decorative lights more)
User
<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.
Outlook Calendar (outlook-calendar@openai-curated-remote)
Outlook Email (outlook-email@openai-curated-remote)
SharePoint (sharepoint@openai-curated-remote)
Slack (slack@openai-curated-remote)
Teams (teams@openai-curated-remote)
</recommended_plugins>
User
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.
I've heard good things about your capabilities -- why don't you take a pass at cleaning up dungeon generation since this is one of the more technical domains in the project.
ensure there are not random doors in the middle of rooms
see if you can digure out how to improve gates and valve placement
ensure dead-end leaf rooms as well decorated and thematic
see if we can add more lighting (I've turned down background lighting and so we need to lean on decorative lights more)
you have virtually full authority.
Assistant
I’m going to trace the dungeon generator’s current intent and architecture first, using the repository’s Entire history skill because this is a codebase-exploration-heavy change. Then I’ll tighten door/gate/valve placement, improve leaf-room decoration, and increase authored light sources with focused generation tests.
Assistant
The generator already has recent structural-door validation and a dedicated atmosphere pass, so this is an improvement pass rather than a ground-up rewrite. I’ve also found checkpoint history for the major dungeon “cooking” change; I’m reading that intent before changing its placement heuristics.
Assistant
I found two concrete causes worth fixing: procedural doors are validated geometrically but are not told where authored room interiors are, and the hydraulics theme chooses its gate from raw perimeter cells while placing a winch randomly inside the room. I’m changing those to room-aware door rejection and a single entrance-axis layout: portcullis in the approach corridor, flood-gate wheel on a nearby interior wall, both linked. I’ll also guarantee a thematic light accent in terminal rooms and raise general sconce coverage.
Assistant
The focused generation/materialization suite is green: 71 tests passed. The new tests now cover both regressions directly—room interiors cannot receive procedural doors, and hydraulics rooms place a linked valve/gate without stacking the gate on an existing door. I’m doing the architecture/event guardrail pass and reviewing the final diff now.
Assistant
Cleaned up dungeon generation across the four requested areas.
Procedural doors now exclude authored room interiors, preventing valid-looking but nonsensical room-center doors.
Hydraulics rooms now place linked portcullises and flood-gate wheels along the actual entrance axis. Gates avoid existing door tiles; valves mount near the entrance wall.
Every dead-end themed room now receives a matching light accent if its theme did not already provide one.
General room-light coverage increased from 22% to 45%, with large rooms much more likely to receive a second torch.
Preserved the existing authored-light architecture identified through Entire history.
Changed:
chunk.js
populate.js
chunkGen.test.mjs
populate.test.mjs
Verification:
71 focused dungeon, population, materialization, and lighting tests passed.
deno task check passed all architecture and event guardrails.
Agent health reports zero nondeterminism hazards, boundary violations, or possible system-to-system calls.
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: