Skip to content

Implement scoped audiences and actor projections - #49

Merged
MichaelSchmidle merged 6 commits into
mainfrom
codex/scoped-audience-projections
Nov 9, 2026
Merged

MichaelSchmidle merged 6 commits into
mainfrom
codex/scoped-audience-projections

Conversation

@MichaelSchmidle

@MichaelSchmidle MichaelSchmidle commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Perform previously delivered one text body to its entire audience. It now accepts @Corin, a leading #Mara,Nell, and flat #Mara(text) scopes within one atomic, branch-bound turn. Closing a scope restores the base; outside-base recipients receive only their named spans, while the actor retains their own primary performance.

The maintained DSH composer and legacy workbench keep an explicitly selected, visible default across turns. Typed actor/turn overrides do not modify it; opening another context resets it. #Mara(primary|fallback) is supported behind explicit opt-in and remains an unratified product extension. Parentheses balance, literal delimiters can be escaped, and unresolved identities or malformed scopes reject the whole turn without widening delivery.

Resolved spans and per-character projections persist with accepted turns. Context, runtime input, perceptions, closure callbacks and standalone Reverie source/reflection use only the observer's projection, omitting unperceived turns and hidden scope metadata. Delivery changes neither presence nor access and does not establish a claim's truth. Legacy turns remain literal. Generated candidates retain their existing routing contract; transcript visual redesign is outside scope.

Core, HTTP, CLI, DSH Perform, legacy Stage recovery, historical replacements, body-only corrections and archive validation are integrated. Body-only corrections persist fresh projections while preserving audience structure; routing changes require replacement turns. DSH journals the exact acceptance identity, branch head, default and syntax before transmission and exposes Retry pending performance. Lost-response retries cannot duplicate or rebind the occurrence to newer input/defaults.

Fallback scopes require nonblank primary content. Historical editors preserve a null base through opening, recovery and replacement; shared text requires an explicit base or turn audience. This applies to both DSH and the legacy workbench. Authored whitespace remains unchanged; the scope guide shows how to include connective whitespace in a private span so its omission leaves no gap.

The DSH historical speaker control also preserves a null base when changing characters. Handler-level regression tests cover unresolved, explicit actor-only and selected bases, including the submitted replacement request. Current focused validation passes 18 tests plus lint and TypeScript.

Validation:

  • 27 added behavior tests pass locally, covering both supplied examples, precedence, outside-base recipients, actor-own perception, private omission, escaping, invalid input, memory boundaries, exact retry/restart, DSH defaults/recovery, branch corrections and archive tampering/import.
  • Deterministic tests against the real standalone Reverie executable verify source.read/model.reflect privacy and safe reuse. All databases and source fixtures are isolated; no real simulations or running host were changed.
  • Lint and TypeScript pass. Production Nuxt build and smoke pass in Linux CI, along with the complete runtime suite and isolated first-launch/inference fixture.
  • The complete Windows/native-engine run passed 483/504. Pristine current main reproduced the exact same 21 failures (463/484): existing Windows filesystem, symlink, process-signal and SQLite cleanup/locking checks. All added tests passed.
  • No browser UI, live-model quality or assistive-technology check is claimed: no controllable browser is connected. DSH component/command tests and the real DSH-to-API adapter cover the new controls and submission path.

Supersedes the closed documentation-only handoff in memrok-com/reverie#30. The implementation belongs in Doxvelt; Reverie's public Rust/JSON-lines contract is unchanged.

@j2msReginaldBot j2msReginaldBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving: I found no blocking defects. I reviewed head 4997bd49144b5a7ca5d9edabcaafd6b535f2eafd against base dd91b532c9bea3af0e36a7f413f68549dbc5df1f.

What I checked

  • parsePerformance: precedence, outside-base recipients, actor-own perception, fallbacks, escaping, nesting and unclosed scopes, and atomic rejection. I also probed edge cases directly. Both documented examples produce the expected per-observer projections.
  • Every path that feeds a model or memory reads the observer's projection only: inspectActorContext, which now re-projects even a caller-supplied turns subset; branch-episode closure generation; candidate-routing; projectPerceptions; and the Reverie source builder, which drops recipients for scoped turns. I found no remaining consumer of transcript or audience.includes that sends authored text to a model.
  • Body corrections persist fresh projections and reject routing changes (correctScopedPerformance). The archive verifier recomputes both the message performance and the correction performance, so forged spans or projections are rejected.
  • The CLI and HTTP scoped paths skip the presence-roster fallback. commitManualTurn still checks the expected head, after the idempotent replay check. The DSH client journals requestId and expectedHead before sending, and the server uses them as commandId and expectedHead.
  • Locally, lint, tsc --noEmit, node --test tests/*.test.ts (504 tests: 501 pass, 3 skipped, 0 fail) and smoke all pass on Linux at this head. I ran no browser or live-model check.

Minor notes (non-blocking)

  1. An empty primary span drops the actor from their own turn. With base [mara, nell] and the fallback opt-in, #Mara(|she nods) is accepted. The canonical audience is ["nell"]: the performing actor and the named recipient Mara get no projection or perception, and Nell gets the fallback. Consider rejecting a fallback scope with a blank primary, or a turn whose actor projection is empty.
  2. Elision leaves visible gaps. With base [mara, nell], Hello #Mara(secret) world projects Hello world (two spaces) to Nell. This matches the documented rule of preserving internal spacing, but it hints at hidden text in model input. Collapsing whitespace at span boundaries in non-recipient projections would remove the hint. Alternatively, accept this as a deliberate authoring responsibility.
  3. A legacy Stage history edit turns a null base into "actor only". stage-history.ts opens a scoped turn with audience: baseAudience ?? []. If the original turn had no base (all scoped spans), an edit that adds unscoped text is delivered to the actor alone instead of failing with "Choose a default or turn audience". This narrows delivery rather than widening it, so it is safe, but it differs from the "never silently fall back" rule. I found this by reading the code; I did not exercise it in a browser.

@j2msReginaldBot j2msReginaldBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 522d6af (base dd91b53), which covers the three earlier notes. Approving.

  • Empty primary: fixed. parsePerformance now rejects a fallback scope with a blank primary. My earlier probe #Mara(|she nods) now fails with "An observer fallback requires a nonempty primary performance."
  • Double spaces: resolved by documentation. Whitespace stays under the author's control, and the doc shows Hello #Mara(secret )world as the authoring pattern. That is reasonable.
  • Null base in history edits: fixed. The Stage and DSH historical editors now keep a null base for an entirely scoped turn and offer an explicit "Only the actor" / "Use actor-only base" choice. The Stage editor validates the text with parsePerformance before submitting, and validateAlternativeRequest, buildAlternativeCommit and the archive verifier accept audience: null only together with audienceSyntax.

Locally at 522d6af: lint, tsc --noEmit, node --test tests/*.test.ts (508 tests: 505 pass, 3 skipped, 0 fail) and smoke all pass.

One new minor issue (non-blocking). The DSH historical editor can now hold form.editedAudience === null, but the speaker-change handler still calls form.editedAudience.filter(...) (scripts/dsh-gui-spike/client.js:806). Opening an entirely scoped turn and choosing another speaking character therefore throws a TypeError, and the speaker is not updated. A guard such as form.editedAudience?.filter(...) ?? null would fix it. I found this by reading the code; I did not exercise it in a browser.

@j2msReginaldBot j2msReginaldBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 55f0616 (base dd91b53). Approving; no open findings remain.

The speaker-change handler now uses form.editedAudience?.filter(...) ?? null, so an unresolved base stays null instead of throwing. The new tests/dsh-history-editor.test.ts renders the real client.js component and covers three cases: unresolved, explicit actor-only, and selected base. In each case it changes the speaker and checks the editedAudience sent with history-edit-next.

Locally at 55f0616: lint, tsc --noEmit, node --test tests/*.test.ts (511 tests: 508 pass, 3 skipped, 0 fail) and smoke all pass. No browser check was run.

@MichaelSchmidle
MichaelSchmidle merged commit 9a5113c into main Nov 9, 2026
1 check passed
@MichaelSchmidle
MichaelSchmidle deleted the codex/scoped-audience-projections branch November 9, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants