<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.
I just added action_harvest_plant.mp3 to assets -- please pay this sound when a plant is harvested, either by an NPC or by a player.
Assistant
I’ll trace the existing harvest event and audio wiring, then connect the new asset at the shared harvest outcome so NPCs and players follow the same path. I’m using the repo’s using-entire skill because this requires codebase exploration and historical intent.
Assistant
The recorded history confirms the established pattern: world actions emit positional audio:play events for NPC labor, while player harvest outcomes are handled by display audio wiring. I’ll preserve that split and use one shared sound ID, with plant-kind filtering so ore, trees, and fishing don’t trigger it.
Assistant
The focused audio, registry, and townfolk suites are green (90 tests). I’ve verified the new sound is spatial and triggers at the harvested node; I’m doing the final architecture/event guard and diff review now.
Assistant
Implemented plant harvest audio for both players and NPCs.
Registered action_harvest_plant.mp3 as action:harvest_plant.
Player harvesting triggers spatial audio for crops, herbs, berries, mushrooms, and other plants.
Farmers and herbalists emit the sound at the harvested plant’s position.
Trees, ore, stone, and fishing retain their existing audio paths.
Verification: 94 tests passed, including event doctrine guards.
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: