# Engagement and pursuit replacement plan > **For agentic workers:** Tasks 1 and 2 were explicitly authorized on 23 October with immediate valid melee admission and End human playtesting. Tasks 1 and 2 are implemented; Task 2 qualification remains open and is recorded separately. Task 3 was subsequently authorized after approval of the overhead mockup, with End human playtesting; Task 4 remains integrated qualification. The user reports Tasks 1–2 good based on human playtesting, without closing automated gates. Use `projecti-slice` and `superpowers:executing-plans` (lead implementation recommended); use `superpowers:subagent-driven-development` only if that method is selected. Follow current ProjectI review, testing and closure policies. Unchecked steps are not completed evidence. **Goal:** enemies sustain real combat anywhere on the stage, make a bounded attempt to regain useful combat, and visibly stop pursuing when that attempt fails, while encounter pressure remains relevant to a moving party. **Architecture:** keep the encounter director, individual perception/attacks and safe movement owners. Replace fixed local-area permissions and rechargeable chase balances with one host-owned engagement cycle per actor. Broad pressure areas remain assignment destinations, never combat boundaries. **Tech stack:** Unity 6000.6.4f1, Unity Behavior 1.0.16, AI Navigation 2.0.14, Netcode for GameObjects 2.13.3, URP 17.6.0, Test Framework 1.8.0; preserve manifest/lockfile pins. **Spec:** section 2 is the replacement contract, based on the user's simpler-design discussion and the [accepted scenario direction](../../Design/Enemies/2026-10-13-ai-replacement-scenarios.md). On 23 October the user authorized **Task 1 only**, chose End human review, and explicitly amended melee: any valid newly admitted melee attack immediately counts as combat, including a later miss. Bolt retains consecutive two-second confirmation. Task 1 was isolated. The subsequently authorized Task 2 integrates the cycle into opt-in actors; normal-stage activation is unchanged. See [Task 1 execution and evidence](2026-10-23-engagement-replacement-task1.md) and [Task 2 checkpoint and open gates](2026-10-23-engagement-replacement-task2.md). ## 1. Scope, status and decision - Requested 23 October 2026: concrete replacement plan, including what stays and what is removed. Runtime edits, Unity operations, test execution and implementation are not authorized by this request. - Baseline inspected: HEAD `ff50410ba009426e0588109830e5b39b9f7c8771` **plus the existing dirty working tree**. HEAD alone does not represent the inspected implementation. Many pursuit, melee, navigation, diagnostics and documentation changes are uncommitted; art changes are also present. Preserve all of them. Re-inventory before execution; another chat may change the same source. - Current [brief](../../PROJECT_PLAN.md) and [earlier plan](2026-10-21-enemy-engagement-and-pursuit.md) retain implemented Tasks 1R–3R/7–9, unresolved integrated failures and pending human acceptance. This replacement is a proposal, not proof that those failures have been fixed or were caused by pursuit. - Falsifiable hypothesis: removing historical location and pursuit credit from combat permission makes moving fights coherent; a finite unsuccessful attempt plus mandatory interruption creates a usable escape opportunity without periodic enemy trains. - Risk: high when implemented, because actor lifecycle, shared assignments, cooperation and movement permissions change. Independent technical, gameplay and design/UX perspectives review this plan; future implementation still needs its required pre/post reviews against the then-current source. - Lead owns this document and integration. Reviewers are read-only. Human-playtest timing is not applicable to planning; ask once at implementation start. Estimate: four sequential implementation tasks plus integrated qualification; elapsed duration unknown until baseline failures, Editor readiness and human timing are established. - Recommendation: replace the pursuit policy in a preserved opt-in checkpoint, assess the hypothesis, then remove obsolete code. Do not add re-anchoring first or build a permanent dual-policy framework. ## 2. Proposed replacement contract ### Player promise and explicit tradeoff Useful combat can continue indefinitely wherever it occurs. Escaping means ending this enemy's current approach/search attempt and gaining room to reposition. It does **not** promise invulnerability, cessation of already legal fire, a guaranteed safe rest, or permanent exclusion of that survivor from later encounters. The initial proposal uses a finite breakoff, not a per-player exclusion list. It can therefore produce later pursuit waves. If this looks like the same chase repeatedly pausing and restarting, or yields no usable repositioning opportunity, human acceptance fails: stop promotion and reconsider encounter reassignment. Do not hide that failure by adding another refill, geographical exception or endless timer tuning. Durable same-enemy escape would be a different design requiring explicit approval. ### One actor cycle | Phase | Admission and behaviour | Exit | |---|---|---| | Available | No active pursuit attempt. May receive a normally admitted coarse assignment; may attack using independently legal personal opportunity. | First admitted approach/search starts Pursue; sustained real combat establishes Fight. | | Pursue | One absolute host-time deadline covers coarse approach, direct chase, reposition to regain an attack, and investigation. Movement still needs normal route/action/evidence permission. | Confirmed combat establishes Fight; deadline expiry enters Breakoff. | | Fight | Genuine, continuing role contribution, independent of original contact location or preferred positioning distance. Legal shots, attacks and useful bounded positioning continue. | Loss of contribution starts one Pursue attempt immediately; no additional exit-grace/refill timer. | | Breakoff | For the full breakoff interval, deny new target-seeking travel and cancel only owned pursuit/search transit. Optional fixed regroup movement, otherwise hold and reassess. Normal legal attacks/paid attack commitments remain possible. | After the interval: Fight if combat is confirmed and still current, otherwise Available for normal reassessment. | **Provisional checkpoint tuning:** keep the current 20-second pursuit duration initially to avoid changing duration and policy together; use 2 seconds of continuous bolt combat confirmation, immediate new-melee-admission confirmation, and 3 seconds of mandatory breakoff. These values are hypotheses, not accepted balance. The gameplay review suggested 8 seconds as a possible later shorter-attempt comparison; do not introduce a second preset or silently change the first checkpoint. Preserve the existing 2-second director reassessment cadence and normal staggering. **User amendment and feasibility gate before live migration:** the original proposal required two-second confirmation for melee; the user explicitly replaced that requirement during Task 1 because an admitted melee attack is already close combat. Each genuinely new owner-admitted attack immediately qualifies, including a later dodged swing. Repeated `Running` responses for the same action, rejected/deferred requests, proximity and incoming damage do not qualify. Current fixture tuning stays 1.5 m attack reach, 3.5 m lunge admission, 0.35 s preparation, 0.12 s commitment, 0.5 s recovery and 1.2/2.5 s cooldowns. Losing current legal opportunity starts one finite pursuit attempt. No new grace, geography or credit mechanism is added. Task 1 compares repeated real admissions/dodges against retreat and incoming damage. Full lunge/attack-owner integration and human interpretation remain separate acceptance before live promotion. An attempt starts when the director admits a purpose that can approach/search, before route-query work. It starts once: changed targets, new sightings, direct damage, reports, coarse-area changes, cooperation, route sections and new assignment IDs cannot extend it. Unknown/deferred query work consumes wall-clock attempt time but is not a geometry failure or retirement proof. Root/stun does not extend the deadline; existing status rules still prohibit invalid actions. A large clock jump can expire one attempt, never execute catch-up attempts. Invalid/backward time fails closed. Available does not repeatedly create attempts without an admitted purpose. At exact deadline, expiry wins over same-tick combat confirmation; this enters Breakoff and cannot be undone by a late callback. No new target-seeking context may outlive its captured deadline. Already paid attacks finish/cancel under their existing owners; they do not extend pursuit movement. A new fight creates a new generation for future contexts, never retroactively revives an expired one. ### What counts as combat - Use **actual executor participation plus a current legal role opportunity**. Being nearby, seeing a target, receiving damage, making route progress or playing an animation is insufficient by itself. - Bolt: a valid admitted preparation/commitment/burst or normal recovery/cooldown from an admitted attack, while the appropriate current personal evidence, range and physical firing opportunity remain valid. Reuse/refine `EnemyBoltExecution.UsefulHoldServer`; do not require hits or a shot every short fixed interval. - Melee: a newly admitted valid attack immediately establishes combat without the two-second wait. A later paid miss still counts as that admission. Continuing Fight requires a current reachable contact opportunity under authored attack rules; a fleeing target outside reach does not keep combat alive merely because recovery is playing. Preserve lunge commitment and collision limits. Emit the admission event once per new action, never for idempotent `Running` responses. - Ordinary weapon cooldown can exceed the confirmation interval. Cooldown alone is never evidence: the actor must have participated in a valid attack and still have a legal opportunity. Failed preparation before confirmation clears that candidate; paying a cancellation cooldown alone does not qualify. - Bolt confirmation is consecutive evidence-backed time, not banked credit; melee uses its new-admission event instead. A gap, stale sample, invalid target or lost opportunity resets continuing contribution. Never backfill an unsampled interval as combat. Host sampling uses the existing actor update, with captured validity capped by original evidence/commitment validity; at most 1 second of sample coverage between observations. This is a sampling safety bound, not another player-facing timer. - For the initial implementation, confirmed contribution is supported for the existing bolt and melee actors only. Other ordinary roles retain their current inactive/unsupported status. A future support role must supply actual useful-beneficiary evidence; do not equate a Keeper label or proximity with contribution. Bosses and Splinter-child activation remain outside this plan. - Confirmation may continue across legitimate current targets only when the actor continuously contributes; switching target alone grants nothing. Four-player targeting stability and individual actor state remain separate. One member's combat never qualifies another. Once Fight is established, ordinary moves while the opportunity remains valid do not consume a pursuit currency. When an approach is necessary because the opportunity is lost, it uses Pursue. Full physical route validation and per-action bounds remain mandatory in both phases. ### Breakoff and encounter pressure Breakoff is mandatory for all target-seeking travel, including director assignments, elite cooperation and recovery reassignment. Sight, damage and a new area cannot shorten its three seconds. Legal attacks from the current opportunity may continue, including an already authorised short attack lunge; no new approach route is smuggled in as an attack or regroup. Combat may be confirmed during breakoff, but restores pursuit eligibility only after the interval ends. Use an existing valid ally/regroup opportunity only as one captured fixed destination at breakoff entry, with normal physical safety and an action deadline capped by breakoff. Do not track the escaped target or a moving ally through repeated regroup endpoints. If no such task is genuinely useful/admitted, hold for the short interval. No new patrol subsystem, teleport, speed boost, spawn-point return, health reset or forced retirement. The encounter director continues broad reachable-region assignments, stable target distribution, spawn/admission budgets and normal pacing. Available survivors may receive a later ordinary assignment. Breakoff remains visible to assignment admission; changing the assignment's name or group cannot reset it. Keep the actor's one ledger-owned pressure contribution throughout; do not remove/re-add it to manufacture capacity or immediately replace the actor. A useful attack against another nearby co-op player may continue while travel is blocked; breakoff does not freeze the entire squad. ### Information, safety and failure remain independent Search shares the attempt deadline **and** retains the original shorter investigation/evidence deadlines. Fresh personal sight can change what is known; it cannot renew an unsuccessful attempt. Reports never become personal firing permission. Keep no-progress/backoff and all-target recovery/retirement predicates. Pursuit expiry proves neither stranding nor retirement eligibility. A changed phase alone does not clear completed geometry failures. **23 October playtest amendment:** after a strictly newer genuine personal sighting and subsequent sight loss, rebuild raycasts and predictions from that captured sight. Preserve the original search deadline/evidence ceiling and spent travel, attempts and inspections. New locations start unchecked; old checked coverage does not transfer. Exhaustion of the old prediction locations may be reconsidered, but actual time/travel/attempt/inspection limits and invalid lifetimes stay closed. Replace only owned search work and invalidate its old contexts; do not add pursuit time or shared query capacity. Human acceptance remains at End; see the Task 2 execution record. **Subsequent attempt-lifetime amendment:** each genuinely admitted Pursue attempt owns a new bounded search allowance, shared across all its targets. Its clock starts at first admitted search purpose, before queries, and ends at the earliest of search duration, pursuit deadline or captured evidence expiry. Within that attempt, sightings, target changes, assignment refreshes and same-cycle capability reinitialization cannot refill the clock or spent quotas. A genuinely new attempt may replace an earlier attempt's exhausted allowance; Breakoff still prohibits search and must finish normally. Persistent geometry/backoff history is not cleared by this rearm. Standalone fixture timing remains sight-anchored. Keep host authority, actor/target/run/stage lifetimes, stale-token rejection, claims, bounded queries, action distance/time caps, supported full-route sections, capsule/sweep/occupancy checks and actual weapon validation. Remove the old **engagement sphere containment** check, not physical collision or world/stage bounds. Preserve the existing 60 m full-route opportunity ceiling and authored per-action travel limits initially; remove only the cumulative 60 m chase currency. These are different constraints. ## 3. Keep, rewrite and remove map Paths below are relative to `Assets/_Project/Features/Enemies/` unless stated otherwise. Recheck callers at execution; filenames do not imply the entire file is obsolete. | Component/files | Decision | Required treatment | |---|---|---| | `Encounters/PrototypeEncounterDirector.CreditSpawning.cs`, `Encounters/EnemyAdmissionLedger.cs`, `Coordination/EnemySquadAssignments.cs`, `Coordination/EnemyPressureAssignment.cs` | Keep, adapt admission seam | Preserve paid births, lifetime membership, one pressure contribution, stable coarse grouping and assignment scoring. Add cycle eligibility at existing admission points; no spawn rebalance. | | `Perception/EnemyPerception.cs`, `EnemyTargetRules.cs`, attack commitment/recovery/cue owners | Keep | Preserve personal/report/hearing separation, target stability, reaction, original timestamps, paid attacks and death/status rules. Remove only any obsolete area/credit caller dependency. | | `Coordination/EnemyPressureDirector.cs`, `.Tasks.cs`, `.Pursuit.cs`, `EnemyPressureTaskDecision.cs` | Rewrite affected policy | Own one actor cycle, sample contribution, admit/cancel matching contexts and expose phase/reason/deadlines. Separate enablement from `EngagementRetentionEnabled` and the ranged-only `TaskEnabled` predicate. Preserve candidate/query scheduling and progress ownership. | | `Coordination/EnemyPursuitState.cs`, `.Accounting.cs`, `.Live.cs` | Replace, then remove | Replace with one `EnemyEngagementCycle.cs`; remove seconds/metres balances, participant-accounting inheritance, refill/qualification zones and old generation arrays. Keep identity/generation rejection in the replacement, not old credit machinery. | | `Coordination/EnemyEngagementArea.cs`, `EnemyPressureDirector.EngagementArea.cs` | Remove after caller conversion | No immutable local sphere, original-centre provenance or re-anchoring. Retain coarse `EnemySquadAssignments.Area` and evidence provenance in their proper owners. | | `Coordination/EnemyEngagementPolicy.cs` | Remove as combat/assignment gate | Replace its 32 m retention/2 s release logic with actor contribution/attempt state. Preserve scoped report and cooperation permissions explicitly; do not delete those with the distance gate. Delete type only after all consumers/tests migrate. | | `Coordination/EnemyEliteCooperation.cs` | Keep, adapt | Preserve partner selection, capacity and cooperation identity; actor cycle survives partner changes. Breakoff blocks borrowed approach; allies never share combat confirmation. | | `Navigation/EnemyMovementContext.cs`, `EnemyMovePlan.cs`, `EnemyMovementExecutor.cs` | Keep safety carrier, replace policy fields | Remove `Area`, area containment, credit charging and per-target accounting generations. Capture actor cycle generation, phase/purpose and immutable deadline alongside existing evidence, assignment, token and approved route. Existing leases never gain time when state changes. | | `Navigation/EnemyPositioning.cs`, `.Alert.cs`, `.AllyReposition.cs`, `Behavior/Nodes/EnemySeekPositionAction.cs`, `RequestEnemyAssignmentAction.cs` | Rewrite permission consumers | Replace local-vs-escaping branch with phase/purpose admission. Retain route prefix/detour work, alert orientation and bounded ally clearance. Alert is not combat; ally clearance does not reset pursuit. | | `Coordination/EnemyTaskProgress.cs`, `EnemyRetirementService.cs` | Keep; adapt seams | Keep persistent completed-failure/backoff and genuine all-target recovery conditions. Gate `TryAssignRecoveryServer` during breakoff. Cycle expiry must not trigger deletion, healing or replacement. | | `Investigation/EnemyInvestigationEpisode.cs`, `EnemyInvestigationPlanner.cs` | Keep, adapt context | Search retains original evidence/search deadline and receives the attempt cap; no new search epoch extends pursuit. | | `Attacks/Bolt/EnemyBoltExecution.cs`, `Attacks/Melee/EnemyMeleeExecution.cs` | Small integration changes | Expose/read current useful-role participation without changing weapons, damage, range, cooldowns, cues or payment. Do not add a generic future-role framework. | | `Debug/EnemyBehavior/EnemyBehaviorDiagnostics.cs`, `EnemyBehaviorScenarioDriver.cs`, `.Renewal.cs`; `Editor/EnemyBehaviorSandboxWindow.cs` (under `Assets/_Project/`) | Replace displays/exercises | Display phase, attempt/breakoff deadline, contribution and denial reason. Replace renewal scenarios with replacement scenarios; preserve reset/new lifetime, paid fixtures and read-only inspection. No player-facing pursuit HUD. | **Ally-clearance dependency:** `.AllyReposition.cs` currently resets its budget through `task.Accounting`, qualification and a matching bolt release. Replace that with a currently confirmed useful-combat receipt captured **after the old clearance budget deadline**, plus a matching-target actual bolt release after that deadline. The director receipt records the currently contributing target lifetime, source actor, sample validity and confirmation sequence; it is one current receipt, not a per-target ledger. The release must match that current target and be consumed only once. Continuous Fight may reset clearance on a genuinely new matching release; it does not need to exit/re-enter Fight or mint another confirmation sequence. Keep its authored two-attempt/4 m/3 s limits and original at-most-6 s window. A phase change, missed query, target switch or clearance travel does not refresh this budget. Remove `allyArea` and its sphere containment, retaining evidence, scope, corridor and physical safety checks. **Remove tuning:** local area radius; retention distance/release-grace as combat gates; cumulative pursuit travel; exit grace; refill duration; entry/continuation distances; inner-area margin; per-target balance/receipt settings. Keep pursuit duration renamed `AttemptSeconds`, add `CombatConfirmSeconds` and `BreakoffSeconds`. Keep unrelated director cadence, query limits, progress rules, weapon/navigation tuning and sampling validity limits. Delete the new mode's old fields rather than leave dead knobs in the sandbox. ## 4. Interfaces and ownership Introduce the following small rules type in `Coordination/EnemyEngagementCycle.cs`; names here are proposed interfaces, not existing APIs: ```csharp public enum EnemyEngagementPhase { Available, Pursue, Fight, Breakoff } public sealed class EnemyEngagementCycle { public EnemyEngagementCycle(double attemptSeconds, double combatConfirmSeconds, double breakoffSeconds); public bool TryBeginAttempt(double now); public void Observe(double now, bool usefulCombat, double validUntil); public void ObserveMeleeAttack(double now, double validUntil); public void Close(); public EnemyEngagementPhase Phase { get; } public ulong Generation { get; } public ulong CombatConfirmationSequence { get; } public double CombatConfirmedAt { get; } public double AttemptDeadline { get; } public double BreakoffUntil { get; } } ``` `Observe` advances clock/phase and confirmation; reads remain neutral. Call it before admission on each host update and recheck authoritative time at every assignment/recovery admission and asynchronous route completion. Context validation remains a pure check that rejects an expired deadline immediately even before the next owner update. The first owner observation of expiry enters Breakoff with `BreakoffUntil = now + BreakoffSeconds`; a host stall past the nominal deadline plus three seconds must not skip the interruption. Late combat callbacks cannot restore the expired generation. Generation changes when a phase transition invalidates movement permission; Close permanently rejects new work. `TryBeginAttempt` admits only Available, is non-renewing for an existing Pursue, and refuses Breakoff/closed/invalid time. Target lifetime and contribution provenance are validated by the director before supplying observations, not stored as a second per-target accounting dictionary. `CombatConfirmationSequence` increments only for a newly confirmed contribution period; do not mint one every update in a long fight. Confirmation while Breakoff does not change its end time or allow approach. The director's member owns this type. Immutable movement context captures the applicable generation and phase deadline; the director verifies current purpose and actor/participant/evidence validity. Investigation keeps its existing owner and shorter deadline. Regroup captures its endpoint once; alert orientation remains non-translational. Do not replace validated movement context with a broad `canMove` boolean or make `Current()` universally true when area checks disappear. Replace the `AccountingEnabled` branch in `MovementParticipantsEligibleServer` with explicit exact captured-participant eligibility: every participant relied on by a context must still be valid in the current actor/run/stage/assignment scope. Do not fall back to the old any-participant shortcut when deleting accounting. Keep lifetime slots/identity validation needed for assignments even though pursuit balances disappear. Existing outside-squad report permission still requires live cooperation: during Breakoff, preserve partner preference if useful, but invalidate its approach assignment and deny borrowed reports that require that assignment. Same-birth reports retain their own independent scope. Re-admit cooperation normally after Breakoff; never display partner selection as live report permission. Reuse bolt's existing useful-hold hook and add the corresponding focused melee hook if needed. Keep opportunity calculation under attack owners; director must not duplicate weapon raycasts/range semantics. Read-only diagnostics capture decisions, never call `Observe` or admission methods. ## 5. Implementation sequence (not authorized execution) ### Task 1 — Cycle, contribution feasibility and preserved baseline 23 October execution: isolated model and revised melee proof implemented; see [evidence, reviews and qualification limits](2026-10-23-engagement-replacement-task1.md). Task 2 is not authorized by this work. The original planning bullets below are amended by the user's immediate-melee-admission decision above. **Files:** create `Coordination/EnemyEngagementCycle.cs` and `Assets/_Project/Tests/EditMode/EnemyEngagementCycleTests.cs`; add isolated native contribution-probe cases in `Assets/_Project/Tests/PlayMode/EnemyBehaviorMeleeTests.cs` using its existing actual actor fixture. Existing production paths unchanged. - [x] Re-inventory source/diff and conflicting active work; preserve affected dirty/untracked files and metas in an explicit hashed recovery snapshot. No unrelated art was committed/stashed/reset. - [x] Add exact 20/2/3 timing, gap/stall, expiry precedence, generation, neutral read, invalid/backward clock, Close and deadline arithmetic tests, plus immediate melee event cases under the amended API. - [x] Implement one attempt deadline, one breakoff deadline and confirmation start/sequence; no target balances or travel currency. No production callers. - [x] Import through the Editor with generated metas, exact discovery and distinct RED/GREEN identities. Final focused rules: 30/30. - [x] Execute paired native stationary-strike probes: seven admitted paid misses with physical player travel over 21.85 seconds, and retreat beyond reach with incoming damage. Both pass; traces retain actual phases and gaps. These use conservative center-range opportunity and direct accepted damage injection, not full weapon/projectile or lunge integration. - [ ] Human interpretation/feel acceptance remains pending at End; the future live checkpoint must prove exact attack-owner opportunity semantics, lunge and moving-enemy pursuit. **Deliverable:** testable rule model and a resolved contribution-feasibility gate, no change to production enemy behavior. Stop if the implementation needs historical geography, an extra grace mechanism or per-target credit to make these rules coherent. The automated feasibility gate was resolved under the melee amendment; the user subsequently authorized Task 2 with human review deferred to End. Human acceptance remains open. ### Task 2 — One coherent live replacement checkpoint Explicitly authorized after Task 1, retaining immediate valid melee combat and human playtesting at End. See [Task 2 execution, source reviews and immutable evidence](2026-10-23-engagement-replacement-task2.md). The bolt owner now carries a live, freshness-bounded next-attack token through normal cooldown; prior successful attacks alone cannot sustain contribution after that waiting owner ends. This resolves the measured sub-two-second cadence handoff without adding a grace timer or changing weapon tuning. **Files:** affected director/context/positioning/investigation/attack/cooperation/recovery files in section 3; new `Assets/_Project/Tests/PlayMode/EnemyEngagementReplacementTests.cs` and focused existing cooperation tests carry the replacement proof; related regression surfaces include `Assets/_Project/Tests/EditMode/EnemyPressureContractTests.cs`, `EnemyBehaviorPressureTests.cs`, `EnemyEliteCooperationTests.cs` and `Assets/_Project/Tests/PlayMode/EnemyBehaviorPressureTests.cs`, `EnemyBehaviorCooperationTests.cs`, `EnemyBehaviorNavigationTests.cs`, `EnemyBehaviorInvestigationTests.cs`, `EnemyBehaviorMeleeTests.cs`, `EnemyBehaviorPressureTests.AllyReposition.cs`. - [x] Add focused native regressions for contribution outside the old area, actor-wide deadline across targets/assignments, long cooldown with current/lost opportunity, melee miss versus fleeing target, and expiry during paid attack. - [x] Integrate the cycle into the existing opt-in actor registration/update and bolt/melee contribution path. Replace every area/credit permission consumer together; do not publish a half-migrated local/pursuit model. Normal-stage activation remains unchanged. - [x] Convert contexts to immutable phase/generation/deadline permission; retain actor/target/assignment/evidence validation, safe route prefixes and physical bounds. Test stale route callback, stale phase generation, recycled targets, death/despawn and changed stage. - [x] Gate direct assignment, cooperative approach, investigation and `TryAssignRecoveryServer` during breakoff. Add fixed regroup/hold only within existing admitted-task mechanisms. Verify one actor's breakoff does not disable squadmates or alter admission accounting. - [x] Convert alert/ally-clearance dependencies using section 3's one-use combat confirmation/release reset; preserve exact clearance budgets and no-progress history. Test failed/unknown clearance never qualifies combat or renews the attempt. - [x] Verify continuous Fight can reset expired clearance using a new matching release without a new confirmation sequence, while reusing the release, a mismatched target or a pre-deadline release cannot reset it. - [x] Run focused exact-discovered rule/native selections per section 6; obtain compact technical/gameplay/design delta review. Keep old code only until remaining consumers migrate; never run both policies on the same actor. **Status:** implementation and focused checks complete; the user reports Tasks 1–2 good based on human playtesting. Broad automated gates remain RED; this does not infer unreported multiplayer/hardware acceptance. Checked items describe implemented/checked scope, not full campaign qualification. Exact outcomes and bounded reuse are in the Task 2 record. **Deliverable:** complete opt-in playable replacement with ordinary shooter, large shooter elite and existing melee fixture; lifecycle and physical safety remain intact. This is the earliest useful human checkpoint, subject to chosen timing and required safety proof. Do not fix unrelated navigation/weapon failures under this task. ### Task 3 — Remove obsolete policy, make behavior inspectable **Files:** obsolete types/partials, tuning consumers and debug files in section 3; `Assets/_Project/Tests/EditMode/EnemyPursuitAccountingTests.cs`, `EnemyEngagementAreaTests.cs`, `EnemyPressureDiagnosticTests.cs`, `EnemyBehaviorPressureTests.cs`; `Assets/_Project/Tests/PlayMode/EnemyBehaviorScenarioTests.cs`; `Docs/ENEMY_AI_SETTINGS.md`, `Docs/TEST_CATALOGUE.md`. - [x] Replace renewal UI/exercises with the scenario matrix in section 6. Capture startup tuning and current owner phase/reason/deadlines; preserve manual reset, paid fixtures, normal/large selection and observation neutrality. - [x] Trace remaining references to `EnemyPursuitState`, `EnemyEngagementArea`, `EnemyEngagementPolicy`, `Accounting`, `RenewalSettings`, `ChargesPursuit`, `PursuitTravel`, and retired tuning. Categorize each source/test/asset reference before deleting anything; coarse pressure areas and physical limits stay. - [x] Remove obsolete runtime files/metas only after all live callers migrate. Migrate any serialized debug/scenario values deliberately with no GUID regeneration. Remove obsolete invariant tests only when each assertion is marked superseded or mapped to replacement coverage; preserve safety, lifecycle, neutrality and ledger checks. - [x] Update settings/catalogue to distinguish deleted invariants from preserved ones and record exact replacement fixtures. Keep old plan/evidence records intact as history. Retire renewal scenario names with an explicit correspondence, not silently reinterpret archived captures. - [x] Verify diagnostics cannot mutate phase/deadlines/RNG/claims; run changed scenario/diagnostic/contract fixtures. No permanent compatibility wrapper or policy switch remains solely to preserve old tests. **Status:** Task 3 implementation, scoped automated proof, development/release builds and three-perspective review complete. Actual overhead captures are inspected. End human readability acceptance remains pending; Task 4 integrated qualification and RED commit/promotion gates remain open. Exact failed runs, corrections, compatible reuse and final checks are in the [Task 3 record](2026-10-23-engagement-replacement-task3.md). **Deliverable:** one policy, one set of meaningful controls and diagnostics, and an auditable test migration. No broad refactor or roster expansion. ### Task 4 — Integrated qualification and keep/tune/revert decision **Files:** final task evidence and minimal current-brief update after real implementation; production assets only if separately authorized. - [x] Obtain required independent final technical/gameplay/design review of the complete source diff, including Ponytail simplicity and this plan's preserved invariants. Resolve blockers and recheck only affected deltas. - [x] Freeze source and perform integrated gates in section 6 once; retain exact failures/identity. New corrections invalidate affected proof. Existing RED gates remain open unless demonstrated resolved or explicitly accepted under project policy. - [ ] Run actual human solo and co-op scenarios at the selected timing. Record keep, bounded tuning, or revert. If 3-second interruption yields repeated trains/no escape, stop rather than add ad hoc exclusions or re-anchoring. - [x] Remove any temporary transition seam; update current status honestly. Create a scoped local implementation commit only when required reviews/checks and any human-before-commit gate permit; no automatic push. Production promotion requires the affected normal-stage/build/network gates and explicit acceptance. **Status, 23 October:** bounded automated qualification and final source reviews complete; see the [Task 4 record](2026-10-23-engagement-replacement-task4.md) for fresh EditMode, audited native per-leaf reuse, matching builds/exclusion and actual two/four-peer, arena, menu and Verdant results. Original RED artifacts remain retained; this is not a fresh full660-case native pass. Human gameplay/keep-tune-revert, hardware, separate-network and production acceptance remain open. The user subsequently authorized commits of all completed AI work; the [commit record](2026-10-23-enemy-ai-checkpoint-commits.md) owns the coherent implementation checkpoint and preserved unrelated work. **Deliverable:** evidence-backed decision on the replacement, not merely passing rules. Rollback restores the preserved pre-change task snapshot, never discards unrelated concurrent edits and never calls the old RED checkpoint qualified. ## 6. Verification and acceptance The original planning task performed only document/reference/source inspection. Tasks 1–2 now have linked execution records; the complete qualification below remains Task 4. Checks were selected using [TESTING](../../TESTING.md) and the relevant [catalogue](../../TEST_CATALOGUE.md) entries; only the linked execution records claim bounded results. | Scenario | Required observation / coverage | |---|---| | Moving fight crosses original 48 m sphere | Shooter, large elite and melee remain responsive using legitimate opportunities. No location-based permission denial; native real-route and human moving-fight proof. | | Stationary player outside weapon reach, reachable detour | Supported approach occurs within attempt/action limits; stairs and useful temporary retreat remain valid. Existing physical route ceiling is not silently widened. | | Cover reload / unseen exit | Fire obeys visibility; finite approach/search uses original evidence and shorter search deadline. No exact hidden tracking. | | Distant potshots / repeated peeks / fresh reports | Deadline does not move. Incoming damage and target/assignment/cooperation changes cannot buy new time. | | Real sustained return / dodged attacks | Bolt contribution for 2 seconds confirms combat anywhere; each new valid melee admission confirms immediately, including paid misses. Interrupted bolt confirmation cannot accumulate. | | Repeated short melee exchanges | Each distinct legitimate melee admission counts immediately even with sub-2-second contact; opportunity loss starts one finite attempt. No synthetic grace. Task 1's stationary-strike probes pass; exact live/lunge opportunity and human acceptance remain open. | | Long preparation/cooldown / departed target | Current viable admitted cycle can count; old cooldown or animation cannot sustain Fight after escape. | | Exact expiry / breakoff / returning player | No target-seeking travel during the full 3 seconds through any admission path. Existing legal attacks remain valid. New local combat does not restore travel early. | | Fixed regroup / no regroup / repeated cycles | Endpoint cannot follow player/ally during breakoff; safe hold is bounded. Actual play must show usable repositioning, not periodic enemy trains. | | Two/four players split or swap damage | Stable distributed pressure, actor deadline unchanged by swaps, independent members, no shared confirmation. Explicitly contrast A-to-B with 2 seconds of actual continuous combat against B anywhere (Fight) versus sightings/incoming damage alone (same deadline). Solo and split-party acceptance remain distinct. | | Root/stun/yield/query starvation / no-progress | No stale movement/renewal, no false geometry failure/retirement, preserved bounded retry history. | | Ally blocks muzzle / alert elsewhere | Clearance keeps authored budgets and fresh one-use reset; orientation alone never confirms combat; no area boundary dependency. | | Death/recycle/disconnect/reset/stage change | Old contexts/callbacks cannot restart pursuit or qualify replacement actors; pressure ledger conservation and cleanup hold. | **Focused execution:** use positively discovered exact fixture names, one Editor operation at a time. New fixture: `ProjectI.Tests.EnemyEngagementCycleTests`. Existing mode/names are verified through catalogue and fresh discovery, not inferred from filenames. Example after discovery: ```csharp ProjectI.Editor.FoundationTestRunner.RunEditModeFiltered( "engagement-replacement-rules-", "ProjectI.Tests.EnemyEngagementCycleTests"); // Select actual discovered native types via RunFixtures, never a namespace prefix. ``` **Integrated gates:** full EditMode and full PlayMode assemblies once after freeze, including affected pressure/cooperation/navigation/investigation/shooter/melee/retirement/ledger/lifecycle/scenario/diagnostic fixtures. Current known failures are baseline evidence, not permission to omit full-suite meaning. Necessary normal/debug/release compilation and release-exclusion verification apply to changed runtime/debug footprints. Preserve normal MainMenu -> VerdantRelay authoring and production activation status; no arena rebuild, terrain edit or navigation rebake. Execute affected real two/four-peer combat, targeting, lifecycle, join/leave/disconnect/reset checks against matching builds; run normal menu/stage/progression regressions once after owned-player cleanup where affected. Native peer fixtures do not substitute for human four-player latency/readability, representative hardware or separate-network acceptance. Follow the catalogue's actual launcher capabilities; do not claim an existing generic arena launcher proves new pursuit scenarios unless it exercises them. Add only the needed scenario coverage to the existing harness if absent. Before operations read [SETUP](../../SETUP.md), validate connection/project/version/play state/import/compile/Console and exact discovery. Preserve unique manifests, source/build identity, failures/skips and cleanup errors. Timeouts require confirmed owned-operation termination before another run. No Natural-arrival campaign rerolls or new budgets are granted by this plan. Historical evidence may only be reused for demonstrably unchanged compatible contracts, explicitly identified as reuse; old pursuit evidence cannot prove this new policy. **Human acceptance:** moving combat stays convincing; cover buys time without freezing enemies; escaping an unsuccessful chase provides an observable opportunity; re-engaging is immediately dangerous; solo/split co-op do not produce periodic trains or arbitrary mass disengagement. Report usefulness/readability/balance separately from automation. One bounded tuning comparison may be proposed after the first checkpoint, with exact changed values and scenarios; new conceptual exceptions require a revised design decision. ## 7. Plan review and closure Review focus: (1) expiry versus combat-confirmation races; (2) removing area checks without removing physical authority; (3) director/cooperation/recovery bypass of breakoff; (4) long attack cycles and sparse observations; (5) preserving ally-clearance budgets and failure history. Each is mapped to Tasks 1–3 and section 6. **23 October planning review:** independent Sol 6.1 / Medium technical/Ponytail, gameplay and design/UX reviewers examined the proposal. Gameplay approved the proposed 20/2/3 baseline and requested the paired actual-combat-versus-sight-only target-switch case, now included. Technical review required deadline checks at asynchronous admission, a full breakoff after a host stall, and an explicit continuous-Fight ally-clearance reset; those corrections and tests are included and the delta was approved. Design review identified repeated short melee exchanges as unresolved; the explicit pre-migration gate was added and the delta approved as a planning artifact. Reviewer approval does not settle that feasibility question or substitute for implementation reviews. **Document verification:** inspected baseline source/callers, package pins, affected catalogue/procedure entries and all six relative Markdown links (all resolve). Corrected the admission-ledger path to `Encounters/EnemyAdmissionLedger.cs`. Final whitespace/staged-scope inspection accompanies the document-only commit. No runtime edits, Unity operations, tests, builds, new gameplay evidence or promotion occurred. No historical test result is presented as proof of this replacement. The preceding closure describes the original planning-only work. Task 1 was subsequently authorized and implemented with the user's melee amendment; its [execution record](2026-10-23-engagement-replacement-task1.md) owns current evidence and limitations. Live implementation and human acceptance remain pending. Recommended later execution is one lead implementing sequential tasks with required independent reviews, because policy/context migration has tightly coupled shared-file consumers. Task 1 does not authorize Task 2.