Mainframe Responsibilities Current
Mainframe is the higher-level AI layer. It does not calculate the actual nav path itself for the client run. Instead, it prepares agents, tracks performance, stores memory, accepts coaching, and evolves agent params.
mainframe.js handles:
- target knowledge
- path recordings
- agent serving
- run start announcements
- run finish learning
- coach hints
- inspection / admin summaries
- personality, mood, and call-sign progression
Mainframe Routes Current
These are the active mainframe endpoints visible in the file.
POST /ai/path/save-recording
POST /ai/path/get-agents
POST /ai/path/report-run-start
POST /ai/path/report-run
POST /ai/path/admin/coach
POST /ai/path/admin/inspect
Agent pool + support agents
Coaching profile support
Run telemetry + learning
How Mainframe Chooses Agents Current
Agent selection prefers target-specific active agents. If none exist, it falls back to a per-game global pool, and if that is empty it seeds a new batch of agents.
Target-specific agents
-> fallback to "__global__" agents
-> seed fresh agents if none exist
-> decorate with personas / mood / call-signs
-> attach success/stuck/improve probabilities
Support agents are cross-target helpers with enough prior runs, so the cluster can borrow stronger experience from elsewhere.
What report-run Updates Current
On run finish, mainframe updates both the chosen agent and the target memory. It stores path outcomes, stuck positions, environment snapshots, recordings, and then triggers possible evolution.
report-run stores / updates:
- aiPathRun
- aiPathAgent
- aiTargetKnowledge
- aiEnvironmentSnapshot
- aiPathRecording (via save-recording)
- agent mood / stats / params
- dialogue history
- probabilities inputs
- maybeEvolveAgents(...)
Coaching System Current
Manual creator hints are classified into intent buckets and attached either globally to a target or to a more specific stuck location key.
POST /ai/path/admin/coach
Current built-in coach intents:
- entrance_forward
- jumpable
- parkour_right_wall
string-similarity classification
location-aware hint scoping
agent discussion / logging output
Sandbox Responsibilities Current
Sandbox is the low-level planner and tooling layer. It stores maps, solves paths, builds previews, exposes the viewer, and gives you cleanup/admin tools.
sandboxRunner.js handles:
- map storage and lazy loading
- chunked map upload
- path solving
- hazard-aware / collider-aware A*
- viewer + SSE events
- leaderboard, runs, PBs
- admin delete / wipe routes
- waypoint directives
- hooks into sandboxEngine.js
Sandbox Routes Current
These are the visible routes in the sandbox runner file.
GET /ai/sandbox/events
GET /ai/sandbox/viewer
GET /ai/sandbox/leaderboard
GET /ai/sandbox/engine/runs
GET /ai/sandbox/engine/bests
GET /ai/sandbox/engine/run/:id
DELETE /ai/sandbox/engine/run/:id
POST /ai/sandbox/admin/delete-map
POST /ai/sandbox/admin/delete-runs
POST /ai/sandbox/admin/wipe-all
POST /ai/sandbox/admin/coach-waypoint
GET /ai/sandbox/maps
GET /ai/sandbox/map/preview
GET /ai/sandbox/map/exists
POST /ai/sandbox/map/upload/init
POST /ai/sandbox/map/upload/chunk
POST /ai/sandbox/map/upload/commit
POST /ai/sandbox/map/upsert
POST /ai/sandbox/path/solve
GET /ai/sandbox/status
Planned AutoFarm Server Flow Planned
The full auto-farm plan changes the solve flow from single-goal movement into area-based batched routing. The server should choose the first few targets, solve their legs now, and keep preparing the rest in the background while the client is already moving.
Client sends:
- IsAutoFarm = true
- ContinueUntilStop = true/false
- AreaName / RouteKey / LoopStartPosition
- Targets = { visible target snapshot }
- AttackRange / PreferredRange / MinSafeRange
- PrecomputeCount
Server returns:
- farmSessionId / batchId / version
- target order for the current batch
- path legs for the first few targets
- attack point for each target
- enough metadata for the client to continue without pausing after every kill
- When
IsAutoFarm is true, do not save the initial player-to-first-target path as the main reusable farming path.
- Save target-to-target legs and area-level loop knowledge instead, so the memory is tied to the farming route rather than wherever the player started.
- Use
AreaName, RouteKey, and the loop anchor so all targets in the same area can be grouped under a stable farm identity.
- Keep the current batch alive until all targets in it are resolved. Only refresh when the batch is exhausted and the area cannot find more valid targets locally.
- Prepare the next batch in the background before the client fully runs out of targets, so the player rarely has to stand still waiting on a solve.
Best fit for the current architecture: keep sandboxRunner.js as the path solver for each leg, while mainframe.js stores area memory, target confidence, target-to-target route reuse, and session state.
Recommended AutoFarm Response Shape Planned
The server response should describe the batch, the chosen target order, and the stand-off endpoint for each target. That makes the client an executor instead of a planner.
{
farmSessionId: "abc123",
batchId: "batch_04",
areaName: "BanditCamp",
version: 7,
loopMode: "return_to_anchor",
targetOrder: ["bandit_1", "bandit_2", "bandit_3"],
targetPlan: [
{
targetId: "bandit_1",
targetKey: "BanditCamp:Bandit1",
targetPos: { x, y, z },
attackPoint: { x, y, z },
attackRange: 18,
preferredRange: 14,
path: [ ...nodes ],
targetMeta: {
hasHumanoid: true,
confidence: 0.96
}
}
]
}
- Separate target order from the actual path legs so dead or skipped targets can be removed without rebuilding everything.
- Return a version or session ID so stale async responses do not overwrite newer farm state.
- Attach target confidence and humanoid checks so the planner can prefer real mobs over props.
Attack Range-Aware Pathing Planned
For some games the player can hit from far enough away that pathing directly into the mob is actually worse. The solver should aim for a good attack point around the target instead of the target centre itself.
Attack inputs:
- TargetDetectRange = 80
- AttackRange = 18
- PreferredRange = 14
- MinSafeRange = 10
Planner target:
- player -> best attack point around mob
- not player -> mob center
Best model: treat the target like an attack donut. Too close is dangerous, too far cannot hit, and the ideal solve endpoint sits in the preferred band if a safe walkable point exists.
- Sample candidate attack points around the target instead of only solving to the centre.
- Prefer reachable points with probable line of sight and enough distance from the mob's danger-close zone.
- Store attack profiles per game or per area later if different games need different stand-off behaviour.
Viewer / Mob Recognition Plan Planned
The sandbox viewer can become the auto-farm debugger by rendering not just geometry but also visible combat targets and their chosen attack points.
Viewer can show:
- map geometry
- visible target markers
- selected batch targets
- chosen attack stand-off points
- rough attack radius circles
- humanoid-confirmed targets vs low-confidence props
- Use target snapshots from the client to mark likely mobs if their positions line up with the uploaded map.
- Use
HasHumanoid and HasHumanoidRootPart to raise target confidence.
- Show which mobs were selected by the batch planner so route quality is easier to debug.
Path Solve Output Current
The solve route can return nodes, jump actions, and meta/debug information. The client then follows that plan.
{
version: "plan_v3",
nodes: [...],
actions: [
{ type: "jump", nodeIndex: 7, jt: 1, prompt: "Jump" },
{ type: "jump", nodeIndex: 15, jt: 2, prompt: "Clear gap" },
{ type: "jump", nodeIndex: 23, jt: 3, prompt: "Jump over kill brick" }
],
meta: {
expanded,
verticalAbs,
jumpEdges,
hopJumpEdges,
gapMomentumEdges,
killHopEdges
}
}
Collider-aware blocking
Hazard mask for red neon kill parts
Gap momentum + jump hop support
Offline PB Engine Current
sandboxEngine.js is the offline optimiser. It refreshes sandbox agents, targets, evaluates solutions, smooths/mutates paths, computes times, records PBs, and emits engine events.
SandboxEngine core jobs:
- refresh agents
- refresh targets
- solve baseline path
- smoothPath(...)
- mutateShortcuts(...)
- computeTimeMs(...)
- record bests and attempts
- emit PB / failure events
Red / Orange Audit Review
These are the pieces that most strongly look like they need updating.
Red
Likely broken if used
lruEvictIfNeeded() uses MapMem.entries() and SolMem.entries() even though those caches are plain objects.
trainerPickMap() uses MapMem.values() even though MapMem is a plain object.
startIdleTrainer() loops Trainer.agents.values() even though Trainer.agents is also a plain object.
Orange
Legacy / partial / manual
//startIdleTrainer(); is commented out, so the whole trainer path looks inactive right now.
/map/upsert looks like legacy compatibility beside the chunked upload pipeline.
/path/idle-think is treated as a no-op on the client, so the old idle endpoint flow looks retired.
/admin/coach-waypoint looks manual/server-side only and not part of the normal client path flow.
Likely Unused or Low-Use Items Likely Unused
These are not guaranteed dead, but they do not look like normal production flow from the files you provided.
- UseServerDrivenPlans config on the client appears unused.
- /ai/path/admin/inspect is an admin inspection route and does not appear to be called by the client.
- /ai/sandbox/status is a debug route rather than a normal runtime dependency.
- /ai/sandbox/viewer, /events, /leaderboard, and engine run routes are tooling / monitoring routes, not movement routes.
- /ai/path/save-recording is only called after successful runs with enough points, so it is conditional rather than always-on.
Cleanup Notes Later
The same cleanup candidates are still noted here, but this section is now written as general cleanup notes instead of a hard priority ladder.
- Fix the plain-object cache iteration bugs in
sandboxRunner.js.
- Decide whether the sandbox idle trainer should be re-enabled or removed fully.
- Remove or properly revive the old idle-think flow so it is not half-retired.
- Decide whether
/map/upsert still deserves to exist beside the chunked upload flow.
- Clean out low-use config values and manual-only routes after the auto-farm flow settles.