AGENTS.md instructions for /home/pjensen/Repos/JSHack <INSTRUCTIONS>…
- 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 importsdisplay/orbridge/;display/never importsrules/;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
EcsEventclass and emit an instance withworld.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(...)andworld.install(...)for idempotent installation. Do not add new bespoke symbol-guard installers. - No swallowed event failures. Do not add
emitSafe-style wrappers aroundworld.emit.
- User
<environment_context> /home/pjensen/Repos/JSHack bash <current_date>2026-06-10</current_date> America/New_York <workspace_roots>/home/pjensen/Repos/JSHack</workspace_roots><permission_profile type="managed"><file_system type="restricted">:root/home/pjensen/Repos/JSHack:slash_tmp:tmpdir/home/pjensen/Repos/JSHack/.git/home/pjensen/Repos/JSHack/.agents/home/pjensen/Repos/JSHack/.codex</file_system></permission_profile> </environment_context>
- User
I feel like these new overworld structures should have all been inside .js files just like the rest of the buildings we have.
- Assistant
I’ll trace how structures and buildings are currently authored so the fix follows the existing content pattern instead of inventing a parallel one.
- Assistant
Using the
using-entireskill for the initial pass because this touches an existing content-authoring pattern. The current grep already shows authored buildings undersrc/rules/data/buildings/*.jsand likely newer structure data embedded elsewhere. - Assistant
The existing registry is exactly as you described: each building is a data module imported by
buildingRegistry.js. I’m narrowing in on the newer landmark/structure definitions now; they look embedded in generation code and should be pulled into the same kind of authored module. - Assistant
I found the mismatch: the four named landmarks are hard-coded in
overworld.jswith bespoke placement functions, while town buildings use authored definitions plus a stamping path. I’m going to extract those landmark shapes into data modules under the building/content data area, then leave generation responsible only for picking where they go. - Assistant
The cleanest change is to keep landmark placement procedural but make the landmark footprints declarative. That means
overworld.jsstill chooses biome/location, and the stamp data lives in.jsfiles withtilesandspawns, just like the other buildings. - Assistant
I’m about to edit
buildingRegistry.js,stampBuilding.js,overworld.js, and add four small data modules. The behavior should stay the same: same landmark ids, tiles, spawns, and biome placement; only the authored shape moves out of generator code. - Assistant
The extraction is in place. I’m running the focused structure/stamping tests now because this change touches both the authored data path and overworld generation.
- Assistant
The focused tests pass with the extraction. I’m adding a small assertion to the existing overworld structure test so future landmarks stay in authored
.jsdefinitions instead of slipping back into generator code. - Assistant
The test now locks in the convention: placed landmark ids must resolve to
LANDMARK_DEFSwith authored tiles and spawns. I’m rerunning the focused suite after that test edit. - Assistant
The focused checks are still green. I’m doing a final diff pass now to make sure the generator only kept placement logic and the data moved cleanly.
- Assistant
The code behavior is fine, but
deno fmtreformatted older files far beyond the actual change. I’m backing out that formatter churn in the touched existing files and reapplying the small semantic edits so the diff stays reviewable. - Assistant
The existing files are back to their prior formatting. I’m reapplying just the imports, registry export, tile-map entry, and landmark stamping hook.
- Assistant
The diff is now back to the intended shape. I’m rerunning the same focused tests without reformatting the older files.
- Assistant
The formatter churn is gone and the focused tests are green again. I’m checking for leftover unused imports and then I’ll do one status pass including the new data files.
- Assistant
One subtle behavior difference surfaced: using the building stamper would make the ruined watchtower roofed, while the old hard-coded version only painted tiles. I’m preserving the old visual behavior by letting authored definitions opt out of roof marking.
- Assistant
I added a
roofed: falseopt-out for the watchtower and kept the default roof behavior for normal buildings. I’m rerunning the focused tests once more. - Assistant
All focused structure and roof tests pass. I’m doing the final status check now; the only remaining changes should be the landmark data extraction and the small registry/stamper/test wiring.
- Assistant
Done. I moved the four overworld landmarks out of
overworld.jsinto authored.jsdefinitions alongside the other buildings:- ruined_watchtower.js
- wayside_shrine.js
- abandoned_camp.js
- strange_grove.js
overworld.jsnow only picks landmark locations and stampsLANDMARK_DEFS. I also addedmoorlandtile support tostampBuilding, plus aroofed: falseopt-out so the ruined watchtower keeps its old unroofed behavior.Verification passed:
bashdeno test --allow-read tests/stampBuilding.test.mjs tests/overworldStructures.test.mjs tests/overworldRoofView.test.mjs15 passed, 0 failed.
- User
under abandoned camp, lets spawn 3-4 bandits; to the side I'll work out precisely how they operate in the world; I was thinking knife throwing specialist, a dagger wielder, a sword and board bandit together with a epic + legendary loot chest (either or)
I think that would be very very cool.
- Assistant
I’ll check the existing monster/content patterns first so the camp uses whatever bandit or humanoid definitions already exist before adding new ones.
- Assistant
There are already bandit definitions, including a melee bandit and archer/captain variants. I’m checking how authored spawns become monsters and chests so the camp data can simply request the right spawn kinds and loot table.
- Assistant
The authored spawn path supports
{ kind: "monster", params: { monsterId: "..." } }, and populate resolves that to canonical monster params. For now I’ll use existingbandit,bandit_archer, andbandit_captainas the 3-4 encounter, then make the camp chest use a high-tier loot table. - Assistant
One important detail: generated overworld chunks are not prefab rooms, so raw
{ monsterId }params may not be resolved before materialization. I’m checking the materializer before deciding whether to encode resolved monster params during overworld generation or teach the generic spawn path to resolve them. - Assistant
Rather than making landmark stamping know about monsters, I’m going to make the generic
monsterspawn materializer honorparams.monsterId. That keeps authored building/room data consistent and avoids embedding resolved runtime stats in the data file. - Assistant
For the chest, I’m going to support deterministic
lootTableChoiceson chest spawns and use["chest:epic", "chest:legendary"]at the camp. That matches the “either/or” wording and lets the existing chest identity/glow code show whichever table was selected. - Assistant
The data now asks for four camp defenders and a deterministic epic-or-legendary chest. I’m adding a focused assertion against the generated overworld spawn data so the camp contract is explicit.
- Assistant
The overworld test now records the specific camp contract: four monsters and the high-tier chest choices. I’ll run the focused structure tests plus a broader check around populate/materialization.
- Assistant
The relevant existing suites are green. I’m adding one small populate-level test too, because I changed the generic materializer to resolve
monsterIdand choose from chest loot tables, and that deserves direct coverage. - Assistant
The populate tests already have good materialize helpers, so I’ll extend that file rather than creating a new harness. The new test will prove
monsterIdresolves to a real bandit and chest choices resolve to an epic or legendary identity. - Assistant
The first patch missed the local formatting in
populate.test.mjs; I’m reading the exact test blocks and will patch against the current text. - Assistant
I found the exact blocks. I’m adding the two direct materializer tests next to the existing monster/chest tests.
- Assistant
The direct materializer coverage is in place. I’m rerunning the affected suites now.
- Assistant
The affected tests pass. I’m doing a final diff/status pass so I can call out exactly what changed and avoid hiding any unrelated work.
- Assistant
Implemented the abandoned camp encounter.
Changes:
- abandoned_camp.js: added 4 guards:
- 2x
bandit - 1x
bandit_archer - 1x
bandit_captain
- 2x
- Swapped the camp chest from
chest:basicto deterministiclootTableChoices: ["chest:epic", "chest:legendary"]. - populate.js: made generic authored monster spawns resolve
{ monsterId, depth }, and added chestlootTableChoicessupport. - Added tests for the camp contract and the new materializer behavior.
Verified:
bashdeno test --allow-read tests/populate.test.mjs deno test --allow-read tests/overworldStructures.test.mjs tests/stampBuilding.test.mjs tests/overworld.test.mjsAll passed.
- abandoned_camp.js: added 4 guards:
- User
shit quick one; I forgot the cooking fire.
- Assistant
I’ll add the existing
cooking_firecamp fixture to the authored abandoned camp data and run the focused structure test. - Assistant
cooking_fireis already a simple spawn kind and tavern uses the same authored form. I’m placing it at the camp center and moving the existing torch off-center so they don’t overlap. - Assistant
I confirmed
cooking_firematerializes directly. I’m making the small data/test update now. - Assistant
The camp now has a center cooking fire, with the torch nudged one tile aside. I’m running the focused overworld structure test.
- Assistant
Added it. The abandoned camp now has a
cooking_fireat the center, and the torch is shifted one tile east so they don’t overlap.Verified with:
bashdeno test --allow-read tests/overworldStructures.test.mjs10 passed.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.