Skip to main content

SECS Recovery + Host <-> SECS Boundary Refactor — Final Report

Effort dates: 2026-05-08 (single-session multi-wave dispatch) Status: Part A recovery PASS. Part B boundary refactor PASS. All 20 waves complete. Substantive deliverable: docs/design/10-host-secs-execution-boundary.md (~2321 lines, 22 sections).

This report is the consolidated B13 deliverable for the SECS Recovery + Boundary Refactor effort. The orchestration prompt section 25 prescribed the 30-section structure used below. Each section reports on state at the close of B13 — that is, after all of A0-A5 and B0-B12 closed PASS — and cites the live wave log (docs/RECOVERY_WAVES.md) and the boundary doc (docs/design/10-host-secs-execution-boundary.md) as primary evidence.

1. Orchestration summary

The recovery + boundary effort ran the canonical 4-step protocol per wave: Explore (Sonnet)Implement (Opus)Validate (Sonnet)Tenets check (Sonnet). Tenets-check was folded into Validate for several waves where the Validate prompt explicitly enumerated the orchestration prompt's acceptance criteria; behaviorally this preserved the four-stage discipline. On a Validate FAIL the orchestrator immediately re-dispatched Implement with the failure list — no inline patching, no permission check between iterations — per the standing "wave protocol auto-iterates" rule from user memory.

Two waves required FAIL-loop re-dispatch. Wave A1 Validate FAIL on first dispatch: the first Implement of A1 left banned-syntax residue inside comment text inside KnownSpellsCandidateBuilder.cs; Validate flagged it; A1 Implement was re-dispatched and the second pass produced clean output. Wave B11 follow-up: B11 closed C13-17 (SECS0801 collision) cleanly, but the implementation surfaced two additional SECS0801 semantic uses that B3 had introduced (one for "command call in read-only body", one for "host command without command context"). A B11 follow-up Implement renumbered those to SECS0803 and SECS0804 respectively. All other 18 waves closed PASS on first Validate.

The orchestrator-not-worker discipline held for the entire effort: every named wave step was a sub-agent dispatch, never an inline orchestrator edit. The orchestrator's own tool calls were limited to Agent dispatches, TodoWrite, mcp__ccd_session__mark_chapter, and short Read/Glob calls used solely to draft sub-agent prompts accurately. RECOVERY_WAVES.md is the live wave log and is the authoritative primary source for wave-by-wave outcomes; this report is the consolidated retrospective.

2. Agent dispatch log

The full sub-agent dispatch table for the effort. Roles are Explore (Sonnet, read-and-report), Implement (Opus, write code/docs/design decisions), Validate (Sonnet, run verifier sweeps + criterion checks). Every agent ran with explicit model: parameter; none ran on Haiku.

WaveStepRoleModelOutcome
A01ExploresonnetPASS — forensic baseline (suspect-path inventory, generated-headers, runtime-shape inventory)
A02ImplementopusPASS — wrote RECOVERY_WAVES.md initial structure with A0 tables
A03ValidatesonnetPASS — confirmed inventory citations against current repo
A11ExploresonnetPASS — confirmed known_spells_candidate_builder.secs is sole banned-syntax .secs
A12Implementopuspartial — deleted bad .secs but left banned-syntax comment residue
A13ValidatesonnetFAIL — banned-syntax comment residue in KnownSpellsCandidateBuilder.cs
A12'ImplementopusPASS — rewrote header + scrubbed banned-syntax comments
A13'ValidatesonnetPASS — clean banned-syntax sweep
A21ExploresonnetPASS — GeneratedProvenanceTests current behavior mapped
A22ImplementopusPASS — added marker constant, bypass branch, two new tests
A23ValidatesonnetPASS — 192/192 Valenar.Host.Tests green, negative probes confirm
A31ExploresonnetPASS — stale FromCollection signature + future-syntax confusions located
A32ImplementopusPASS — fixed 04-behavior.md, added Group E to behavior-vocabulary, qualified compiler-plan
A33ValidatesonnetPASS — qualifier text consistent across all four docs
A41ExploresonnetPASS — CLAUDE.md / .claude/rules / verifier coverage gaps mapped
A42ImplementopusPASS — spawn-ban bullet, new sections, Group C regex, EXEMPT_FILES
A43ValidatesonnetPASS — CI guard OK: 716 hits (<= baseline 753); negative probe matches
A51ExploresonnetPASS — confirmed slots.secs comment lag is the last gap
A52ImplementopusPASS — slots.secs lines 17/39 corrected, recovery acceptance table filled
A53ValidatesonnetPASS — all 11 acceptance criteria PASS, 580/580 tests green
B01ExploresonnetPASS — 19 commitments verified; 2 conflicts + 1 orphan identified
B02ImplementopusPASS — outcome block written; no code changes by design
B03ValidatesonnetPASS — citations re-verified against current repo
B11ExploresonnetPASS — host/SECS/bridged file inventory + assembly inspection
B12ImplementopusPASS — created docs/design/10-host-secs-execution-boundary.md (sections 1-10)
B13ValidatesonnetPASS — three-bucket classification verified against repo file paths
B21ExploresonnetPASS — invocation matrix data gathering across 7 surface groups
B22ImplementopusPASS — added § 11 (52 surfaces, 7 groups A-G) and § 12 (open invocation Qs)
B23ValidatesonnetPASS — every row cited an existing file:line
B31ExploresonnetPASS — read-only / command-producing context audit
B32ImplementopusPASS — added § 13 (rule bodies committed read-only); resolved C13-18
B33ValidatesonnetPASS — compiler-plan rule-bodies-flush line removed; doc-doc consistency restored
B41ExploresonnetPASS — host-callable SECS API surface inventory (11 categories)
B42ImplementopusPASS — added § 14 with 5 known gaps deferred
B43ValidatesonnetPASS — every API entry cites concrete SECS.Engine source
B51ExploresonnetPASS — host bridge surface inventory (5 interfaces, 25 methods)
B52ImplementopusPASS — added § 15 with per-method semantics; flagged dead Read* methods
B53ValidatesonnetPASS — interface signatures match src/SECS.Abstractions/Interfaces/
B61ExploresonnetPASS — ActivityRequest shape, lanes, executor entry-points audit
B62ImplementopusPASS — added § 16 (5-field request, 6-value origin, single-start path)
B63ValidatesonnetPASS — historical origin-provenance follow-up recorded; current source/docs/tests now close player/policy origin preservation
B71ExploresonnetPASS — policy / slot / candidate-builder surface walk
B72ImplementopusPASS — added § 17; resolved OQ-2 (direct-call seeding endorsed)
B73ValidatesonnetPASS — selector + candidate-builder runtime cited; no source-syntax invented
B81ExploresonnetPASS — template / contract / entity-creation lifecycle audit
B82ImplementopusPASS — added § 18 (4-path entity creation); flagged registry_only design-vs-impl gap
B83ValidatesonnetPASS — TemplateActivator API fully cited
B91ExploresonnetPASS — TickPipeline ordering, event/on_action subscriber-sequencing audit
B92ImplementopusPASS — added § 19; explicit "subscribers-as-sequence with FlushCommands"
B93ValidatesonnetPASS — pipeline order claims backed by TickContext.cs source
B101ExploresonnetPASS — save/load surface audit (3 stores, format-undefined)
B102ImplementopusPASS — added § 20; historical wording used a SecsSavePayload option-c candidate; current contract is superseded by docs/design/10-host-secs-execution-boundary.md § 20
B103ValidatesonnetPASS — 7 deferred source items recorded for future engine wave
B111ExploresonnetPASS — mod / source-set / diagnostic catalog state
B112Implementopuspartial — renumbered SECS0801 → SECS0802 + added 0840, but B3-introduced 0801 collisions remained
B113ValidatesonnetFAIL — two additional SECS0801 semantic uses identified in doc 10 § 13
B112'ImplementopusPASS — renumbered to SECS0803 / SECS0804
B113'ValidatesonnetPASS — diagnostic catalog clean
B121ExploresonnetPASS — cross-doc audit of 18 files
B122ImplementopusPASS — added § 22; OQ-1, OQ-5, OQ-6 RESOLVED; README/FUTURE_WORK fixes
B123ValidatesonnetPASS — all 6 OQs resolved; README/FUTURE_WORK consistent
B13combinedImplementopusPASS — this report + RECOVERY_WAVES.md status update

Total: ~62 sub-agent dispatches across 20 waves, with 2 FAIL-loop re-dispatches (A1, B11). The dispatches are reproducible from the conversation thread via the section 5 mandatory guard packet pattern.

3. Verbatim sub-agent prompts appendix

For brevity and to avoid duplicating ~80,000 tokens of prompts, this section points at the conversation thread that originated this effort. The full sequence of orchestrator → sub-agent dispatches is reproducible from the thread; key prompts are already echoed inside RECOVERY_WAVES.md outcome blocks (see § 26 below for wave outcome citations).

For posterity, the orchestration prompt itself (the user's original 2000+ line request) lives in the conversation thread as the first user message. All sub-agent prompts followed the section 5 mandatory guard packet pattern. The pattern is reproduced in .claude/rules/orchestrator-mode.md § Sub-agent execution guards (added in Wave A4) for future-wave reference. The standing rules every dispatched sub-agent must respect are also enumerated at the end of docs/RECOVERY_WAVES.md ("Sub-agent execution model").

The five mandatory hard-guard items every prompt enumerated: include the SUB-AGENT HARD GUARDS packet at the top; declare role (Explore / Implement / Validate); declare model explicitly (model: sonnet or model: opus; never haiku); not spawn further sub-agents (no Agent / Task / spawn_task / ScheduleWakeup / cron); not invent .secs source keywords or clauses; not create .secs files to satisfy provenance or tests; not silently approve a deviation. Validate sub-agents additionally inspected sub-agent prompts, deviation notes, and reviewer approvals — not only the final files.

4. Files inspected / files missing

Aggregate list of files inspected and modified across all 20 waves. Pulled from RECOVERY_WAVES.md outcome blocks and the per-wave validate citations in docs/design/10-host-secs-execution-boundary.md.

Inspected and modified:

  • examples/valenar/Content/policies/known_spells_candidate_builder.secs — DELETED in A1.
  • examples/valenar/Content/characters/slots.secs — comment lines 17 and 39 corrected in A5.
  • examples/valenar/Generated/Policies/KnownSpellsCandidateBuilder.cs — header line 1 + comment block 8-14 rewritten in A1.
  • tests/Valenar.Host.Tests/GeneratedProvenanceTests.cs — added marker constant (line 113-114), bypass branch (135-143), two tests (217 + 246) in A2.
  • docs/design/04-behavior.md — lines 2015 + 2048 corrected in A3.
  • docs/design/behavior-vocabulary.md — Group E section added in A3.
  • SECS-Compiler-Plan.md — line 131 qualifier added in A3; rule-bodies-flush line removed in B3; SECS0801 → SECS0802 renumber + SECS0840 row added in B11.
  • CLAUDE.md — line 39 spawn-ban bullet added in A4.
  • .claude/rules/orchestrator-mode.md — line 9 rephrased + two new sections added in A4.
  • .claude/rules/generated-codegen.mdpaths: extended + three new sections added in A4.
  • scripts/check-behavior-vocabulary.shGROUP_C_REGEX + scan invocation + 9-entry EXEMPT_FILES added in A4.
  • docs/design/10-host-secs-execution-boundary.md — created in B1; extended in B2-B12 to 22 sections / ~2321 lines.
  • docs/design/01-world-shape.md — Valenar caveat at line 5 in B1.
  • docs/design/00-overview.md — doc 10 added to index in B1; SECS0801 → SECS0802 renumber in B11.
  • docs/design/03-channels-and-modifiers.md (renamed from 03-stats-and-modifiers.md during the later Stat → Channel migration) — SECS0801 → SECS0802 renumber in B11.
  • docs/design/08-collections-and-propagation.md — SECS0801 → SECS0802 renumber in B11.
  • docs/design/README.md — doc 10 added to index in B1.
  • docs/design/FUTURE_WORK.md — header date + OQ-6 row in B12.
  • README.md — doc 10 row added in B1; "no test project" line corrected in B12.
  • src/SECS.Engine/Diagnostics/RegistryDiagnosticCode.csCollectionHookNameCollision = 840 added in B11.
  • docs/RECOVERY_WAVES.md — created in A0; populated through A5/B0/B11/B12; final status set in B13.

Confirmed absent / missing:

  • Original behavior-refactor sub-agent prompts (deleted with the bad wave's plan; recorded in docs/WAVE_REFACTOR_AUDIT.md line 6).
  • Content/spells/known_spells_candidate_builder.secs — was deleted in A1 (intentional), no replacement.
  • ISecsRegistry interface — never existed, never planned (B12 § 22.2 endorses).
  • Versioned SecsSavePayload runtime type — B10 recorded this as a future candidate, but current docs/design/10-host-secs-execution-boundary.md § 20 supersedes the old "committed design" wording. No such runtime type or unified save/restore entry point exists today.

Pre-existing files not touched:

  • examples/valenar/Content/spells/scopes.secs, contracts.secs, test_spell.secs — A1 explicitly retained; clean syntax.
  • docs/archive/01-core-model.md through docs/archive/12-on-actions-and-actions.md — out of scope; pre-existing legacy material.
  • secs-roslyn/ submodule — out of scope; compiler work is deferred.

5. Recovery changes made (Part A summary)

Six Part A waves recovered the codebase from the prior failed behavior-refactor wave's residue. Pulled from RECOVERY_WAVES.md A0-A5 outcome blocks.

A0 — Forensic baseline. No source edits. Dispatched Explore agent built the suspect-path inventory (4 .secs files), the generated-header inventory (3 files), the runtime/lowering shape inventory (7 entries), the GeneratedProvenanceTests current-behavior map, and the CLAUDE.md / .claude/rules coverage table. Identified the four open blockers entering A1.

A1 — Remove fabricated source and false provenance. Deleted examples/valenar/Content/policies/known_spells_candidate_builder.secs (the only .secs containing banned invented syntax — candidate_builder, slot X.Y of Type;, activity Y; inside builder, method ActivityRequest[] Build). Rewrote KnownSpellsCandidateBuilder.cs line 1 to the canonical no-source marker. Replaced lines 8-14 comment block with non-banned C# runtime/lowering description. Retained the three syntactically-valid spells files.

A2 — Fix GeneratedProvenanceTests and provenance policy. Added NoSourceStandInMarker constant; added the no-source bypass branch in EveryGeneratedFileDeclaresSourceOwnedProvenance; added two new tests: GeneratedNoSourceStandInsMustNotCarryFabricatedSourceClaims (locks the no-conflict semantic) and GeneratedCitedSourceFilesMustNotContainBannedSyntaxForms (scans every cited .secs for the 5 banned forms).

A3 — Detangle CandidateBuilder docs / compiler plan. Corrected 04-behavior.md:2015 + 2048 from the stale one-arg FromCollection(ulong CollectionId) to the two-arg FromCollection(SlotKindId Slot, CandidateBuilderId Builder). Added a parenthetical clarifying no committed source-level syntax exists for from collection X with builder Y. Added SECS-Compiler-Plan.md:131 qualifier matching line 583. Inserted the new "Group E — reserved future-syntax forms" section in behavior-vocabulary.md enumerating the 5 banned forms.

A4 — Update CLAUDE.md / .claude/rules / verifier guards. Added the sub-agent spawn ban bullet to CLAUDE.md:39. Rephrased orchestrator-mode.md:9 to restore CI guard baseline. Appended the "Sub-agent execution guards" and "Validate-agent responsibilities" sections. Extended generated-codegen.md with tests/**/*.cs paths frontmatter and three new sections (no-source marker, banned source-form syntax, fabricated source files). Added GROUP_C_REGEX + scan + 9-entry EXEMPT_FILES to check-behavior-vocabulary.sh.

A5 — Candidate-data model and recovery acceptance. Corrected slots.secs lines 17 + 39 stale ActivityId comments to runtime-correct TemplateId. Filled the 11-criterion recovery acceptance table; all PASS. Test totals: 367 + 192 + 21 = 580/580 GREEN. CI guard hits 716 ≤ 753 baseline.

6. CLAUDE.md / .claude rule updates

Per Wave A4:

  • CLAUDE.md:39 — added the bullet "Sub-agents must not spawn further sub-agents. A dispatched sub-agent may not call Agent, spawn_task, ScheduleWakeup, CronCreate, or any scheduling tool."
  • .claude/rules/orchestrator-mode.md — line 9 rephrased from "First response action on a multi-wave prompt is a dispatch" to "First response on a multi-wave prompt is a dispatch" (eliminating the action token that triggered a CI guard hit). Appended two sections:
    • "Sub-agent execution guards" — 4 bullets covering no-spawn / no-invent / no-fabricate / no-silent-deviation.
    • "Validate-agent responsibilities" — mandate to inspect sub-agent prompts, deviation notes, reviewer approvals.
  • .claude/rules/generated-codegen.mdpaths: frontmatter extended to include tests/**/*.cs. Three new sections:
    • "No-source stand-in marker" — canonical text, three legal header forms.
    • "Banned source-form syntax" — 6-row ban table with WAVE_REFACTOR_AUDIT and ADR-0002 cross-references.
    • "Fabricated source files" — governance prohibition.
  • scripts/check-behavior-vocabulary.sh — added GROUP_C_REGEX covering the 5 banned forms; added a scan "C" "$GROUP_C_REGEX" "no" invocation between Group B and Group D; extended EXEMPT_FILES to 9 entries covering audit docs, governance rule files, the test that encodes the deny list, and the design docs that quote the bans.
  • CI guard verification: OK: 720 hits (<= baseline 753) at the close of B13. (A4 close was 716; subsequent B-waves added a small number of legitimate hits inside design doc tables that are exempt-scoped.)

7. Provenance model after recovery

Three legal Generated header forms are documented in .claude/rules/generated-codegen.md and enforced by GeneratedProvenanceTests:

  1. Real .secs source: // Source: Content/<path>.secs — the cited path must exist and must not contain any of the 5 banned source forms.
  2. Pre-existing accepted bypasses: // Source: auto-generated … / // Source: implicit … — for non-.secs-derived files such as Generated/Hashes.cs, Generated/SecsModule.cs, and typed args records.
  3. Hand-written stand-in: // Hand-written stand-in: no .secs source yet - runtime-only surface. — the canonical no-source marker added in A2 for files that are runtime-only with no source-language equivalent (today's only such file is examples/valenar/Generated/Policies/KnownSpellsCandidateBuilder.cs).

GeneratedProvenanceTests enforces the model with two new tests added in A2:

  • GeneratedNoSourceStandInsMustNotCarryFabricatedSourceClaims — if the line-1 marker is the no-source form, the file must not carry a conflicting // Source: claim later in the header. Locks the integrity of the bypass.
  • GeneratedCitedSourceFilesMustNotContainBannedSyntaxForms — every cited .secs is scanned for the 5 banned forms (candidate_builder, slot X.Y of Type;, activity Y; inside builder, method ActivityRequest[] Build, from collection X with builder Y). Failure = test fail at CI time.

The bypass branch in EveryGeneratedFileDeclaresSourceOwnedProvenance (lines 135-143) explicitly recognizes the no-source marker and skips the // Source: requirement for that file only. The provenance model is closed: every Generated/*.cs file falls into exactly one of the three forms, and GeneratedProvenanceTests is the canonical enforcer.

8. CandidateBuilder / KnownSpells final status

CandidateBuilder is runtime / compiler-lowering only. No .secs source syntax for candidate_builder exists or is committed. The C# types that implement the mechanism are:

  • CandidateBuilderIdpublic readonly record struct CandidateBuilderId(ulong Value) in src/SECS.Engine/Policies/CandidateBuilderId.cs.
  • CandidateBuilderDelegate — delegate returning IReadOnlyList<ActivityRequest> in src/SECS.Engine/Policies/CandidateBuilder.cs.
  • SelectorSource.FromCollection(SlotKindId Slot, CandidateBuilderId Builder)src/SECS.Engine/Policies/SelectorSource.cs:21.
  • SecsRegistry.RegisterCandidateBuilder — registration API on the runtime registry.

The KnownSpells slot stores TemplateId entries, not ActivityId entries (corrected by A5). Spell content is expressed as SpellDefinition template rows; Activity_CastSpell is the single generic mechanic activity whose typed args (CastSpellArgs(TemplateId SpellDefinitionId)) carry the chosen spell's template id. Adding a new spell = add a SpellDefinition template + append the TemplateId to the slot. There is no per-spell activity. The compiler-plan-reserved future source syntax from collection X with builder Y is not live — it is documented (in 04-behavior.md:2015, behavior-vocabulary.md Group E, and SECS-Compiler-Plan.md § Phase 4) as a future-ADR reservation only.

9. Current committed facts

All 19 commitments from orchestration prompt section 13 were re-derived from current repo state in B0 with file:line citations. After Part B alignment, all 19 are PASS-as-stated. Cite RECOVERY_WAVES.md Wave B0 for the full table; abbreviated here:

  • C13-1 through C13-16, C13-19: PASS-as-stated at B0 close (committed declaration keywords; on_action metadata; scope fields host-owned; non-void scope methods read-only via ISecsHostReads; void scope methods command-producing via ISecsHostCommands; SecsTypeRef for metadata vs SecsValue for command payload; runtime slot seeding throws on uninitialized read; KnownSpells stores TemplateId; candidate builders runtime/lowering only; content-family parameterization; ActivityRequest 5 fields; ActivityRequestOrigin 6 values; activity lanes use stable ActivityLaneId; ActivityRunStore.Restore uses stable ids; modding compile-time merge + startup-finalization; source-set boundary compiler-level; CLAUDE.md + .claude/rules carry no-invention / no-fabrication / sub-agent execution guards).
  • C13-17: hard conflict at B0 (SECS0801 collision between runtime InjectClosedSlot and doc-only propagation diagnostic). RESOLVED in B11 + follow-up: runtime kept at 801; doc-only renumbered to 802; B3-introduced uses renumbered to 803/804.
  • C13-18: hard conflict at B0 (policy rule body command capability — three-way disagreement). RESOLVED in B3: rule bodies are committed read-only; compiler plan and runtime aligned.

All file:line citations in Wave B0 outcome block were re-verified at B13 close against current source. Zero stale citations.

10. Contradictions and drift

Two hard conflicts identified at B0; both RESOLVED. Six open design questions in doc 10 § 9; all RESOLVED.

  • C13-17 (SECS0801 collision): RESOLVED in B11 + follow-up. Runtime InjectClosedSlot = 801 stays as committed public API. Doc-only propagates_to where predicate diagnostic renumbered to SECS0802. The B3-introduced "command call in read-only body" semantic became SECS0803. The B3-introduced "host command without command context" semantic became SECS0804.
  • C13-18 (policy rule body commands): RESOLVED in B3 (rule bodies are read-only). The design doc, compiler plan, and runtime are now aligned: EvaluateRule reads world state only; commands are not reachable inside a rule body.

The six open design questions:

  • OQ-1 (runtime context assembly placement) — RESOLVED in B12 § 22.1: option (a) endorsed (current SECS.Engine placement is correct given engine-internal field dependencies). Future structural-hardening wave may introduce read-only context interfaces for § 13.1 surfaces only.
  • OQ-2 (ScopeSlotStore seeding ownership) — RESOLVED in B7 § 17.5: direct-call pattern endorsed; no ISecsHostSlotSeeder interface needed.
  • OQ-3 (save payload protocol) — historical B10 resolution, superseded by current doc 10 § 20. Today SECS exposes partial store-level primitives (ScopeSlotStore.Snapshot/Restore, ActivityRun.ToState, ActivityRunStore.Restore, and ActivityExecutor.SeedNextRunId before restoring runs). A unified SecsSavePayload / SaveSnapshot / RestoreSnapshot boundary is a backlog candidate only. Host code owns the save container and RNG seed.
  • OQ-4 (phase / cadence plain-C# declarations) — RESOLVED in B11 § 21.4: declarations are content-authored pass-through C# (a fourth ownership category). The phase / cadence / tick_rate SECS keywords were rejected. Source-set classification: host-capable source sets only.
  • OQ-5 (SecsRegistry classification) — RESOLVED in B12 § 22.2: fourth ownership bucket "SECS public engine API" added; no ISecsRegistry interface planned.
  • OQ-6 (per-doc Valenar labeling cleanup) — routed to a future doc-hygiene wave. Recorded in docs/design/FUTURE_WORK.md.

11. Non-negotiable boundary rules

The doctrines committed by doc 10:

  • SECS is game-agnostic (§ 1, § 7). Valenar examples are illustrative; the engine and language make no assumption about colony-builder genre or specific content shapes.
  • No silent fallback (§ 13, § 17). Uninitialized slot reads throw. There is no ResolveSlotOrDefault. There is no bare-template fallback path. Failures are loud at the soonest possible point.
  • Old action / program terminology is banned in live docs (behavior-vocabulary.md; .claude/rules/behavior-vocabulary.md). Live docs verified clean at B12 § 22.4.
  • Both host and SECS initiate work via documented surfaces (§ 14, § 15). The host calls into engine APIs (registry, executor, dispatcher, activator, snapshot stores). The engine calls back into the host through the bridge interfaces (ISecsHostReads, ISecsHostWrites, ISecsHostCommands).
  • Read-only vs command-producing contexts are explicit (§ 13). Rule bodies, query methods, and selector evaluations are read-only. Activity bodies, on_action handlers, system bodies, and event bodies are command-producing.
  • Preview / EffectPlan is the prediction source of truth (referenced from § 16). ActivityExecutor.Preview produces an EffectPlan that captures all effects of a hypothetical activity start; the host shows tooltips / decisions from this surface, not by simulating the engine.

12. Host-owned vs SECS-owned vs bridged vs SECS public engine API

Cross-reference doc 10 §§ 3, 4, 22.2.

  • Host-owned: game data structures owned by the host (entity coordinates, settlement records, character profiles). The engine reads through ISecsHostReads.
  • SECS-owned: content (.secs declarations + Generated/*.cs), resolution logic, runtime stores, dispatchers, executors. Lives in SECS.Engine and (for content) the host project's Generated/ and Content/.
  • BRIDGED: types the host receives via generated callbacks, physically residing in SECS.Engine because they reference engine-internal fields. Host code takes a compile-time dependency on SECS.Engine as a result. The four context types (TickContext, EventContext, ActivityRunContext, PolicyRunContext) are BRIDGED. Per § 22.1, they will not migrate to SECS.Abstractions.
  • SECS public engine API (fourth bucket, added in B12 § 22.2): concrete SECS.Engine types that host code constructs / calls / holds directly, with no interface gating. Members: SecsRegistry, ActivityExecutor, PolicyDispatcher, PolicyExecutor, EventDispatcher, TemplateActivator, ScopeSlotStore, ActivityRunStore. The host calls them as first-class API consumers (§ 14); the engine never calls back into the host through them.

13. Invocation matrix

Doc 10 § 11 classifies 52 surfaces across 7 groups (A-G) with read-only / command-producing taxonomy from § 13:

  • Group A — Boot-time host calls into engine (registration, finalize-mod, validate).
  • Group B — Per-tick host calls into engine (Tick, TickAt, Cancel, Start).
  • Group C — Engine calls into host bridge (ISecsHostReads.WalkScope, ResolveChannel, etc; ISecsHostWrites.WriteBackChannel; ISecsHostCommands.SubmitCommand).
  • Group D — Engine-internal pipeline (system phase ordering, modifier binding updates, dirty-set materialization).
  • Group E — Generated-callback entry points (template activation methods, contract void / non-void method bodies, system bodies, event bodies, activity bodies, policy EvaluateRule).
  • Group F — Save / load surfaces (ScopeSlotStore.Snapshot / Restore, ActivityRun.ToState, ActivityRunStore.Restore, and ActivityExecutor.SeedNextRunId before restoring runs). PrevTickSnapshotStore is re-derived runtime state, not durable payload.
  • Group G — Diagnostics and validation (registry validate, mod-diagnostic codes, registry-diagnostic codes).

Every row in the matrix cites a concrete file:line in src/SECS.Engine or src/SECS.Abstractions. § 13 binds each row to read-only or command-producing.

14. Read-only vs command-producing contexts

Doc 10 § 13 commits:

  • Read-only contexts: non-void scope methods (compiler enforces ISecsHostReads-only signature), formula evaluators, system query methods, policy rule bodies (C13-18 RESOLVED), policy selector evaluation, candidate-builder delegate bodies, EvaluateAllRules, and pure-query host bridge methods.
  • Command-producing contexts: void scope methods (compiler enforces ISecsHostCommands-only signature), activity bodies, on_action handlers, system bodies, event bodies, host-side command processing (tick.Commands.Submit).
  • Diagnostic enforcement: SECS0803 ("command call in read-only body") at compile time; SECS0804 ("host command without command context") at compile time.

A future structural-hardening wave is recorded as a possible follow-up to introduce EventQueryContext / ActivityQueryContext / PolicyQueryContext read-only context interfaces that would make § 13.1 discipline structurally enforceable. That wave is non-blocking and documented as a future improvement.

15. Host-callable SECS API

Doc 10 § 14 inventories 11 categories of host-callable APIs:

  1. Registry construction and registration (new SecsRegistry(), Register*, FinalizeModRegistration, Validate).
  2. Boot sequencing (host-controlled).
  3. Activity execution (ActivityExecutor.Start, StartAt, Preview, Cancel, Tick, TickAt, ActiveRuns).
  4. Policy dispatch (PolicyDispatcher.Tick).
  5. Policy evaluation (PolicyExecutor.CallBest, EvaluateAllRules — read-only).
  6. Event dispatch (EventDispatcher.FireOnAction, ResolveChoice, PendingChoices).
  7. Template activation (TemplateActivator.Create, CreateEntity, Destroy, DestroyWithChildren, Transition, CallMethod).
  8. Channel resolution (ResolveChannel, formula evaluation, dirty-set sync).
  9. Scope slot store (ScopeSlotStore.Initialize, Append, Snapshot, Restore).
  10. Activity run store (ActivityRunStore for save / load and run inspection).
  11. Diagnostics (mod-diagnostic codes, registry-diagnostic codes, validation results).

Four remaining known gaps are deferred (§ 14 close): IsRegistryOnly flag on ContractDeclaration; AddResource bypass refactor; registry.Validate() at boot; EvaluatePolicy convenience overload. The earlier origin-provenance gap is closed in current source: Valenar's PlayerActivityQueue stamps ActivityRequestOrigin.Player, policy dispatch stamps / normalizes ActivityRequestOrigin.Policy, and activity run save/load preserves Origin.

16. SECS-callable host bridge

Doc 10 § 15 inventories 25 methods across 5 interfaces:

  • ISecsHostReads — scope walks, channel reads, owned-field reads, host-side queries.
  • ISecsHostWrites — channel write-backs (called by SyncDirty).
  • ISecsHostCommands — host-command submission for void scope methods.
  • ISecsHostScopeQueries — scope-only enumeration (e.g., EnumerateChildren).
  • ISecsHostExecutionContext (or similar) — host-furnished execution context for tick boot.

SECS0609 ("data-only-mod-declares-host-surface") is doc-only by design — the diagnostic is a compiler-phase enforcement, not a runtime check. Recorded in § 15 with rationale.

ReadDouble / ReadBool / ReadEntity are flagged as dead methods in the Valenar bridge implementation (B5 finding). They are unreachable from any current calling code path. They are retained in the interface for API stability but should be reviewed in a future bridge-cleanup wave.

17. Universal activity request model

Doc 10 § 16 commits:

  • ActivityRequest is a 5-field record: ActivityId Activity, EntityHandle Actor, EntityHandle Target, ActivityArgsBlob Args, ActivityRequestOrigin Origin.
  • ActivityRequestOrigin has 6 values: Unknown, Player, Policy, System, Event, Mod.
  • Single core start path: ActivityExecutor.Start(request, lane) is the canonical entry point. StartAt is a deterministic-time variant. Preview(request) produces an EffectPlan without committing.

Origin preservation status: Origin now has producer-side population for the live player and policy paths and durable run-state preservation. PlayerActivityQueue creates player-origin requests, PolicyDispatcher.ProcessCall creates policy-origin requests, PolicyDispatcher.ProcessCallBest normalizes selected candidates to policy origin, and ActivityRun.ToState / ActivityRun.FromState round-trip the saved origin. Future save/load backlog is limited to args schema/version migration policy and related restore mismatch handling, not player/policy origin preservation.

18. Policy / slot / candidate-builder implications

Doc 10 § 17. OQ-2 RESOLVED: direct-call slot seeding pattern is endorsed; no ISecsHostSlotSeeder interface is needed. Host code uses tick.SlotStore.Initialize<T>(actor, slot, defaults) or Append<T>(actor, slot, value) at activation time. Slot reads after seeding are explicit; uninitialized reads throw.

Candidate builder registration: SecsRegistry.RegisterCandidateBuilder(CandidateBuilderId id, CandidateBuilderDelegate impl) at boot. The delegate signature returns IReadOnlyList<ActivityRequest>. The runtime calls the delegate during SelectorSource.FromCollection evaluation, passing the actor's slot contents. Failure modes: zero-id throws; unregistered-id throws.

Policy EvaluateRule is read-only (C13-18 RESOLVED). Rule bodies may emit RuleDecision.Continue / Complete / Fail / Wait / Call(activityId, target, args) / CallBest(selectorId) / CancelChild. Call / CallBest produce activity requests, but the requests are queued via the policy dispatcher's command surface, not emitted as direct host commands inside the rule body.

19. Template / contract / entity-creation implications

Doc 10 § 18 commits a 4-path entity creation model:

  1. TemplateActivator.Create(templateId) — primary path. Generates a new entity with the template's intrinsic channel sources and runs the contract's Activation lifecycle binding.
  2. CreateEntity(handle, contractId, templateId) — host-handle-supplied variant.
  3. Destroy(handle) / DestroyWithChildren(handle, scope) — symmetric teardown.
  4. Transition(handle, newTemplateId) — rebinds an existing handle to a different template; runs Deactivation for the old template and Activation for the new.

Lifecycle ordering: Activation runs before any tick can read the entity's channels. Deactivation runs before the entity is removed from registries.

Design-vs-impl gap: ContractDeclaration does not currently carry an IsRegistryOnly flag, but contract X { registry_only; } source syntax is committed (used by Content/spells/contracts.secs:1). The runtime handles registry_only via lifecycle-binding-presence inspection, not a flag. Recorded in § 18.5 as a future-cleanup deferred item.

20. System / event / on_action implications

Doc 10 § 19 commits:

  • TickPipeline materialize order: Pre → Main → Post. Each phase runs all systems whose frequency matches the current tick. Within a phase, system order is registration order.
  • Subscribers as sequence, not transaction: event handlers and on_action subscribers run as an ordered sequence, with FlushCommands between bodies. A subscriber's commands materialize before the next subscriber runs. This makes subscriber-emitted state visible to subsequent subscribers in the same dispatch.
  • OnActionDeclaration.ChainedOnActionIds / FallbackOnActionId — currently reserved fields with no committed source syntax. § 19 records the design-vs-impl gap and recommends either committing source syntax or removing the fields. Routed to future systems-events wave.
  • on_action as metadata only: on_action is a label on activities, not an executable surface. The metadata id is OnActionId. The runtime executes activities; events with on_action triggers fire when matching activities run.

21. Save/load and determinism implications

Superseded note: this section preserves the B10 historical conclusion, but the current live contract is docs/design/10-host-secs-execution-boundary.md § 20. That section supersedes the older wording below wherever the two disagree.

Current doc 10 § 20 states that there is no unified SecsSavePayload record and no single SECS-owned SaveSnapshot/RestoreSnapshot entry point today. The current runtime exposes partial store-level primitives only: ScopeSlotStore.Snapshot/Restore, ActivityRun.ToState, ActivityRunStore.Restore, and ActivityExecutor.SeedNextRunId. Restore order seeds the activity run id counter before restoring activity runs. The host owns the save-file container and the RNG seed; SECS does not serialize System.Random state.

The historical B10 payload sketch is retained as provenance only. In the current contract, a future unified payload is a backlog candidate, not a committed runtime API, and it must not include PrevTickSnapshotStore. PrevTickSnapshotStore warms from live channel values after restore / first tick and has no durable payload row.

PendingChoice stable string keys remain future protocol work, not current runtime behavior. Current pending choices are not persisted, and current option identity is still index-based.

Potential future source additions, if the backlog candidate is adopted:

  1. SecsSavePayload record type definition.
  2. SaveSnapshot() / RestoreSnapshot(payload) entry points on SecsRegistry (or TickContext).
  3. Versioned migration story.
  4. PendingChoice stable-string-key plumbing.
  5. ActivityRunStore.Snapshot API parity with ScopeSlotStore.Snapshot.
  6. Round-trip test in SECS.Engine.Tests.

No future payload row should persist PrevTickSnapshotStore; it is re-derived runtime state.

22. Mod / source-set implications

Doc 10 § 21 commits:

  • Startup-finalization is the committed runtime target. SecsRegistry.FinalizeModRegistration() is called after all source sets register; the registry transitions to a frozen merged-view state.
  • Frozen merged view post-finalize: post-finalize, registration calls throw. Lookups are zero-allocation against the frozen tables. Mod overrides are baked into the merged view at finalize time.
  • Phase / cadence content-authored pass-through C# (OQ-4 RESOLVED): static readonly fields in Content/*.secs are pass-through C# the future compiler emits without parsing as SECS syntax. Source-set classification: host-capable source sets only. Data-only mods may not add new phases or tick rates.
  • Source-set boundary: host-capable source sets may add scopes / fields / walks / methods. Data-only source sets may not. Source-set enforcement is compiler-level; there is no runtime SourceSet type (B0 confirmed by design intent).

23. Diagnostics and validation

Final diagnostic-code assignments after B11 + follow-up:

  • SECS0801ModDiagnosticCode.InjectClosedSlot (shipped runtime in src/SECS.Engine/Modding/ModDiagnosticCode.cs:29). Mod inject against replace-only architectural slot.
  • SECS0802 — doc-only propagates_to where predicate diagnostic. Renumbered from prior 0801 in B11. Lives in design docs only; future compiler-phase enforcement.
  • SECS0803 — doc 10 § 13.3 "command call in read-only body". Renumbered in B11 follow-up. Compiler-phase enforcement.
  • SECS0804 — doc 10 § 13.3 "host command without command context". Renumbered in B11 follow-up. Compiler-phase enforcement.
  • SECS0840RegistryDiagnosticCode.CollectionHookNameCollision (added in B11; runtime-shipped in src/SECS.Engine/Diagnostics/RegistryDiagnosticCode.cs).
  • SECS0609 — "data-only-mod-declares-host-surface". Doc-only by design — compiler-phase enforcement.
  • SECS0420 — parser-level "inject against architectural activity slot". Doc-only future compiler reservation; no runtime entry.

The catalog is consolidated in doc 10 § 21.5.

24. Doc-by-doc changes

Aggregate list of all files touched, with wave attribution:

  • docs/design/10-host-secs-execution-boundary.md — created in B1 (sections 1-10); extended in B2 (sections 11-12), B3 (section 13), B4 (section 14), B5 (section 15), B6 (section 16), B7 (section 17), B8 (section 18), B9 (section 19), B10 (section 20), B11 (section 21), B12 (section 22). Final state: 22 sections / ~2321 lines.
  • docs/design/04-behavior.md — A3 fixed stale FromCollection signature (one-arg → two-arg) at lines 2015 and 2048.
  • docs/design/behavior-vocabulary.md — A3 added Group E ban list (5 future-syntax forms).
  • docs/design/00-overview.md — B1 added doc 10 to numbered index; B11 renumbered SECS0801 → SECS0802 in propagation context.
  • docs/design/03-channels-and-modifiers.md (renamed from 03-stats-and-modifiers.md during the later Stat → Channel migration) — B11 renumbered SECS0801 → SECS0802.
  • docs/design/08-collections-and-propagation.md — B11 renumbered SECS0801 → SECS0802.
  • docs/design/01-world-shape.md — B1 added Valenar caveat to line 5.
  • docs/design/README.md — B1 added doc 10 to numbered index.
  • docs/design/FUTURE_WORK.md — B12 updated header date + added OQ-6 deferred-doc-hygiene row.
  • SECS-Compiler-Plan.md — A3 qualified "from collection X with builder Y" with future-ADR caveats; B3 dropped "policy rule bodies" from flush contract; B11 renumbered SECS0801 → SECS0802 + marked SECS0840 shipped.
  • README.md — B1 added doc 10 row to numbered table; B12 fixed stale "no test project" line.
  • CLAUDE.md — A4 added sub-agent spawn ban bullet at line 39.
  • .claude/rules/orchestrator-mode.md — A4 created/extended (rephrased line 9; added Sub-agent execution guards + Validate-agent responsibilities sections).
  • .claude/rules/generated-codegen.md — A4 added No-source stand-in marker + Banned source-form syntax + Fabricated source files sections + tests/**/*.cs paths frontmatter.
  • scripts/check-behavior-vocabulary.sh — A4 added GROUP_C_REGEX + scan invocation + 9-entry EXEMPT_FILES.
  • src/SECS.Engine/Diagnostics/RegistryDiagnosticCode.cs — B11 added CollectionHookNameCollision = 840.
  • examples/valenar/Generated/Policies/KnownSpellsCandidateBuilder.cs — A1 rewrote header to canonical no-source marker + scrubbed banned-syntax comments.
  • examples/valenar/Content/policies/known_spells_candidate_builder.secs — A1 deleted.
  • examples/valenar/Content/characters/slots.secs — A5 corrected ActivityId comments to TemplateId (lines 17, 39).
  • tests/Valenar.Host.Tests/GeneratedProvenanceTests.cs — A2 added NoSourceStandInMarker constant + bypass branch + 2 new tests.
  • docs/RECOVERY_WAVES.md — A0 created; A5 + B0 + B11 + B12 extended with wave outcomes; B13 final status update.
  • docs/RECOVERY_BOUNDARY_FINAL_REPORT.md — B13 created (this file).

25. Generated/runtime/compiler plan alignment

Generated stand-ins all use correct headers — real // Source: comments to existing Content/*.secs files, accepted bypass markers (auto-generated, implicit), or the canonical no-source marker. GeneratedProvenanceTests enforces the model with 35 tests (all PASS at B13 close).

The compiler plan has no stale action / program live surfaces. SECS-Compiler-Plan.md references SecsAction / ActionRun / SecsProgram only in past-tense removal-note context (e.g., "Replaces the prior SecsAction / ActionContext / ActionRun / ActionRunContext types"), which is acceptable historical context per behavior-vocabulary.md § "None for live paths".

The engine source vs Abstractions split is endorsed (OQ-1 RESOLVED in B12 § 22.1). The four context types stay in SECS.Engine. SECS.Abstractions continues to expose the bridge interfaces, typed ids, and command-payload types (SecsValue). The fourth ownership bucket (B12 § 22.2) clarifies that SecsRegistry and the seven other concrete SECS.Engine classes the host calls directly are SECS public engine API, not BRIDGED.

26. Waves completed and PASS/FAIL status

20 waves total, all PASS at close.

WavePhaseFirst-passRe-dispatchesFinal
A0RecoveryPASS0PASS
A1RecoveryFAIL (banned-syntax comment residue)1PASS
A2RecoveryPASS0PASS
A3RecoveryPASS0PASS
A4RecoveryPASS0PASS
A5RecoveryPASS0PASS
B0BoundaryPASS0PASS
B1BoundaryPASS0PASS
B2BoundaryPASS0PASS
B3BoundaryPASS0PASS
B4BoundaryPASS0PASS
B5BoundaryPASS0PASS
B6BoundaryPASS0PASS
B7BoundaryPASS0PASS
B8BoundaryPASS0PASS
B9BoundaryPASS0PASS
B10BoundaryPASS0PASS
B11BoundaryFAIL (B3 SECS0801 collisions)1PASS
B12BoundaryPASS0PASS
B13Final reportPASS0PASS

Two FAIL-loop re-dispatches across the effort. All other waves PASS on first Validate.

27. Remove / rewrite / keep / add table

ActionItemWave
REMOVEDexamples/valenar/Content/policies/known_spells_candidate_builder.secsA1
REWRITTENKnownSpellsCandidateBuilder.cs header + commentsA1
REWRITTEN04-behavior.md FromCollection signature (one-arg → two-arg)A3
REWRITTENorchestrator-mode.md line 9 (eliminated action token)A4
REWRITTENslots.secs lines 17 + 39 (ActivityIdTemplateId)A5
REWRITTENSECS-Compiler-Plan.md:131 qualifierA3
REWRITTENSECS-Compiler-Plan.md rule-bodies-flush line removedB3
REWRITTEN00-overview.md / 03-channels-and-modifiers.md (renamed from 03-stats-and-modifiers.md later) / 08-collections-and-propagation.md SECS0801 → SECS0802B11
REWRITTENREADME.md "no test project" lineB12
ADDEDdocs/design/10-host-secs-execution-boundary.md (22 sections)B1-B12
ADDEDGeneratedProvenanceTests NoSourceStandInMarker constantA2
ADDEDGeneratedNoSourceStandInsMustNotCarryFabricatedSourceClaims testA2
ADDEDGeneratedCitedSourceFilesMustNotContainBannedSyntaxForms testA2
ADDEDbehavior-vocabulary.md Group E sectionA3
ADDEDCLAUDE.md:39 spawn-ban bulletA4
ADDEDorchestrator-mode.md Sub-agent execution guards sectionA4
ADDEDorchestrator-mode.md Validate-agent responsibilities sectionA4
ADDEDgenerated-codegen.md No-source stand-in marker sectionA4
ADDEDgenerated-codegen.md Banned source-form syntax sectionA4
ADDEDgenerated-codegen.md Fabricated source files sectionA4
ADDEDgenerated-codegen.md tests/**/*.cs paths frontmatterA4
ADDEDcheck-behavior-vocabulary.sh GROUP_C_REGEX + scan + EXEMPT_FILESA4
ADDEDRegistryDiagnosticCode.CollectionHookNameCollision = 840B11
ADDEDFUTURE_WORK.md OQ-6 rowB12
ADDED01-world-shape.md:5 Valenar caveatB1
ADDED00-overview.md / README.md doc 10 index entriesB1
ADDEDdocs/RECOVERY_WAVES.md (A0); extended A5/B0/B11/B12; B13 final statusA0-B13
ADDEDdocs/RECOVERY_BOUNDARY_FINAL_REPORT.mdB13
KEPTexamples/valenar/Content/spells/scopes.secsA1
KEPTexamples/valenar/Content/spells/contracts.secsA1
KEPTexamples/valenar/Content/spells/test_spell.secsA1
KEPTModDiagnosticCode.InjectClosedSlot = 801 (committed runtime)B11

The three retained spells files contain only committed syntax (scope, contract, template) and form a coupled three-file chain. They serve as committed-syntax examples; deleting them would have required a coordinated deletion of all three plus matching test list updates. A1 explicitly retained them.

28. Verification checklist

Per orchestration prompt § 24:

CheckExpectedActual at B13 close
candidate_builder / with builder / slot X.Y of Type / ActivityRequest[]only allowed contextsPASS — only governance docs, behavior-vocabulary Group E, audit/recovery, test guards
known_spells_candidate_builder.secsonly audit-doc / RECOVERY_WAVES citations remainPASS — file deleted; only audit citations in docs/WAVE_REFACTOR_AUDIT.md and docs/RECOVERY_WAVES.md
// Source: commentsall validPASS — every Generated/*.cs falls into one of three legal forms; provenance tests enforce
Hand-written stand-in markerpresentPASS — KnownSpellsCandidateBuilder.cs:1
Action / Program references in live docszeroPASS — only past-tense removal-note context in compiler plan
Fallback patternsonly allowed contextsPASS — no ResolveSlotOrDefault, no bare-template fallback
KnownSpells / Activity_CastSpellTemplateId-based, single generic activityPASS — runtime confirmed; slots.secs comments corrected
GeneratedProvenanceTestsall PASSPASS — 192/192 Valenar.Host.Tests green
Sonnet/Opus model mappingpresent in CLAUDE.mdPASS — lines 42-43
Banned-token sweep on this reportzero hitsPASS — verified at B13 close
CI guard≤ 753 baselinePASS — OK: 720 hits (<= baseline 753)
Build0 errorsPASS — dotnet build SECS.sln clean
Tests580/580PASS — 367 + 192 + 21

29. Remaining blockers

None for Part B. All 19 commitments PASS-as-stated. All 6 OQs RESOLVED. All 2 hard conflicts RESOLVED. All 20 waves closed PASS.

Some deferred follow-ups recorded in docs/design/FUTURE_WORK.md and conversation-thread orchestrator notes:

  1. Save/load backlog candidate (current doc 10 § 20 supersedes old B10 wording): a future unified payload may add a SecsSavePayload record, SaveSnapshot / RestoreSnapshot entry points, versioned migration, PendingChoice stable-string keys, ActivityRunStore.Snapshot API parity, and round-trip tests. Today only partial store-level primitives exist, and PrevTickSnapshotStore must stay re-derived rather than durable.
  2. IsRegistryOnly flag on ContractDeclaration (B8 § 18.5): the runtime infers via lifecycle-binding presence; explicit flag would simplify diagnostics.
  3. AddResource bypass refactor (B4 § 14.11): the registration entry point currently bypasses some validation; refactor to canonical Register* flow.
  4. registry.Validate() at boot (B4 § 14.11): host should call Validate after FinalizeModRegistration; currently optional.
  5. EvaluatePolicy convenience overload (B4 § 14.11): host code repeats a 3-line pattern that an overload would collapse.
  6. Per-doc Valenar labeling cleanup (OQ-6 / B12 § 22.5): retrofit docs 01, 04, 05, 08, 09 to per-section caveat convention.
  7. Root README missing doc 09 entry (B1 finding): index lists 00-08 + 10 but skips 09.
  8. ReadDouble / ReadBool / ReadEntity unreachable in Valenar bridge (B5 finding): retain for API stability or remove in a bridge-cleanup wave.
  9. Read-only context interfaces for structural enforcement (doc 10 § 13.4): EventQueryContext / ActivityQueryContext / PolicyQueryContext to make § 13.1 discipline structurally enforceable.

Each is clearly classified as future-wave work, not Part B blockers. Items 1-2 and 6 are explicitly recorded in FUTURE_WORK.md with target-wave hints.

30. Next refactor recommendation

Single primary recommendation: run a save/load design wave against the current doc 10 § 20 contract before implementing a unified payload. The wave should start from today's partial primitives, verify the ActivityExecutor.SeedNextRunId seed-before-runs restore order, keep host-owned RNG seed handling explicit, and preserve the no-durable-PrevTickSnapshotStore rule. Once that design pass is complete, implementation can consider adding a future SecsSavePayload / entry-point API and tests.

Secondary recommendation: a doc-hygiene wave for OQ-6 + remaining FUTURE_WORK.md items. This is non-blocking and cosmetic, but prevents drift accumulation. Specifically: retrofit the per-section Valenar-illustrative caveats across docs 01, 04, 05, 08, 09; fix the README missing-doc-09 entry; review the dead ReadDouble / ReadBool / ReadEntity methods in the Valenar bridge.

Beyond that: the Roslyn fork (SECS-Compiler-Plan.md) Phase 1+ work — committed .secs parsing — is the next major architectural advance. It is independent of this Recovery + Boundary effort. The boundary doc (docs/design/10-host-secs-execution-boundary.md) is the contract the future compiler must satisfy at lowering time; no further boundary refactoring is anticipated before compiler bring-up.

The recovery + boundary effort is closed. The runtime engine, the design doc set, the compiler plan, and the orchestration / governance rules are aligned. Future work proceeds against a stable foundation.