Skip to content

feat(voice,dialectic): transport commands, in-loop intercept, typed-prompt input, and biofeedback docs (issue 8) - #80

Open
aurascoper wants to merge 2 commits into
mainfrom
feat/transport-commands-typed-seed
Open

aurascoper wants to merge 2 commits into
mainfrom
feat/transport-commands-typed-seed

Conversation

@aurascoper

Copy link
Copy Markdown
Owner

Summary

Stacked on origin/main at bdfc4e9 as two commits:

  1. 5b8224a - feat(voice,dialectic): transport commands ("say that again", "slow down") on both surfaces, shared SpeechRatePolicy, and the typed-seed path for the CLI and the app.
  2. 369283b - docs(biofeedback): Issue 8 sections for README.md and HARDWARE_SETUP.md covering the ADR-011 OSC and CoreMIDI egress.

Review Findings Addressed (A-D)

  • A. Shared Speech-Rate Policy (SpeechRatePolicy in BCICore):
    • Consolidates the composed-speech multiplicative scale adapter (scaled(_:by:), step 0.15, floor 0.5 so ProsodyWobble clause ratios survive) and the dialectic competition additive offset adapter (offset(_:by:), step 0.08, floor -0.20, rate floor 0.25 so pole cadence separation survives) into one shared SpeechRatePolicy contract in Sources/BCICore/Protocols/SpeechSynthesizing.swift.
  • B. Replay Invariants & Baseline-Controlled Standing Slow-Down:
    • HypnagogicDialecticLoopTransportTests.testStandingSlowDownShapesTheNextVoicedTurnToo compares the second real turn of ["the sea", "slow down", "the sea"] against a baseline ["the sea", "the sea"] loop (accounting for Turn 1 populating DialecticalMemory history/reply centroids).
    • HypnagogicDialecticLoopTransportTests.testReplayPreservesNodeIDEmbeddingSilenceCounterAndMemory verifies that consecutive transport replays ("say that again", "repeat that") do not call generator.generate, preserve the original SpokenNodeEvent.nodeID ("0") and embedding, do not increment consecutiveSilence (maxConsecutiveSilence = 2 never fires a silence cue), and do not duplicate the reply or insert transport phrases into ConversationHistory.
  • C. Typed-Prompt Privacy Semantics & Deterministic No-Mic-Auth Test:
    • AppViewModelVoiceCommandTests.testTypedPromptInputEnqueuesWithoutRequestingMicAuthorizationAndRetainsRuntimeDisclosure verifies that selecting DialecticInputSource.typedPrompt and submitting a prompt queues into TypedPromptListener with zero calls to microphone/speech authorization while retaining the runtime disclosure.
  • D. Biofeedback OSC & Muse BLE Documentation Scope:
    • README.md and HARDWARE_SETUP.md match the merged BCIBiofeedback implementation on main (five NEURALCOMPOSE_BIOFEEDBACK_* variables, MindMonitorMirror address table, custom BiofeedbackMapping health policies, loopback vs LAN privacy tiers, and the single-BLE-central constraint scoped explicitly to the supported Muse native-BLE profiles museTwoNativeBLE, museSNativeBLE, and museSAthena).

Verification Gates (Compiled & Executed on macOS Apple Silicon)

Gate Status Evidence
Transport recognition PASS FuzzyCommandRecognizerTests (14/14) & StubCommandRecognizerTests (17/17)
Repeat & grounding invariants PASS HypnagogicDialecticLoopTransportTests (9/9, 0 failures)
Slow-down policy & floors PASS HypnagogicDialecticLoopTransportTests + AppViewModelVoiceCommandTests (13/13)
Typed prompt FIFO & cancellation PASS TypedPromptListenerTests (12/12, 0 failures)
Privacy & no mic auth in typed mode PASS testTypedPromptInputEnqueuesWithoutRequestingMicAuthorizationAndRetainsRuntimeDisclosure
CLI --seed-file dry-run PASS swift run dialectic-session --dry-run --seed-file /tmp/seed.txt focused exits 0
Full Swift build & test regression PASS ./Scripts/build.sh + swift test across all 9 test targets (BCIBiofeedbackTests 71/71, BCIEEGTests 100/100, NeuralComposeAppTests, BCIVoiceTests, BCICloudBridgeTests, BCIPeerBridgeTests, BCIClassifierTests, BCILLMTests, WorldModelDemoTests, BCICoreTests)
Known limitations documented PASS HypnagogicDialogueLoop mirror mode does not intercept transport commands; app-triggered replay while mic is hot can be heard on the mic path

aurascoper and others added 2 commits November 7, 2026 23:01
…yped-prompt input path

Two things people say back to the voice, "say that again" and "slow down",
were reaching the dialectic generators as prompts. This adds them as first
class commands on both surfaces and gives the hypnagogic loop a keyboard.

Transport commands
- AppCommand gains .repeatLastUtterance ("tts.repeat") and .slowDownSpeech
  ("tts.slow-down"), with descriptors (aliases from the interaction logs),
  dispatcher arms and AppCommandDispatchTarget methods.
- AppViewModel tracks lastSpokenText and a speechRateScale (steps of 0.15,
  floor 0.5) applied to every planned prosody in speak(text:); repeat and
  slow-down forward to a running HypnagogicDialecticLoop, which owns its own
  last voiced turn.
- HypnagogicDialecticLoop intercepts transport phrases in runTurn before any
  generation (classifyTransportCommand), re-speaks the last voiced turn with
  a cumulative rate offset (steps of 0.08, floor -0.20, rate never below
  0.25), logs a candidate-less silent turn so the harness turn count still
  advances, and never touches the silence counter. App-side entries
  repeatLastUtterance() and slowDownSpeech() do the same without a log line.
- StubCommandRecognizer: an exact alias now wins over a longer alias it
  prefixes, so "say" stays .speak beside the new "say that again".

Typed-prompt input
- TypedPromptListener (BCICore): a HypnagogicListening actor fed by typed
  text; FIFO, suspends until submit, drops blank lines, cancel() resumes
  waiters with nil. parseSeedLines(_:) is the shared seed-file parser.
- dialectic-session --seed-file <path>: prompts from a file, one per line,
  # comments and blank lines skipped, queued before any <heard...> args;
  positional heard lines may then be empty.
- App: DialecticInputSource (microphone | typedPrompt) on AppViewModel,
  TypedPromptPanel in ContentView while the loop is enabled, the loop
  rebuilt on a source change, no mic authorization on the typed path, and
  the banner badge reading "Typed + Cloud" when typing.

Tests
- New: TypedPromptListenerTests, HypnagogicDialecticLoopTransportTests.
- Updated pins: AppCommandTests, AppCommandDispatcherTests (vocab 12 -> 14,
  allCasesForTesting), AppViewModelVoiceCommandTests spy, Stub and Fuzzy
  recognizer suites gain transport cases.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ESMEkNUJgN9USJkov7oWDH
README.md
- Add the five NEURALCOMPOSE_BIOFEEDBACK_* variables to the environment
  variable table.
- New "Biofeedback out (OSC and CoreMIDI)" section: the
  run-biofeedback-osc.sh flags, the Mind Monitor-compatible address table
  as MindMonitorMirror actually emits it (no touching_forehead, no batt),
  custom BiofeedbackMapping routes with their HealthPolicy, the virtual
  MIDI source name, and the loopback / LAN privacy tiers as the banner
  shows them.
- Architecture tree, load-bearing boundaries and repository layout now list
  BCIBiofeedback.

HARDWARE_SETUP.md
- New subsection under the Mind Monitor transport: outbound biofeedback OSC
  (UDP 7000, or 9000) vs the inbound Mind Monitor listener (UDP 5000), why
  the ports must differ, and why the native BLE profiles and Mind Monitor
  cannot hold the headband at the same time (one BLE central).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ESMEkNUJgN9USJkov7oWDH
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.

1 participant