Verified constants against a9e1f0f20e^ Encryption.cs/Common.cs, the
MacCipherScheme setting's default/round-trip/reach into both configs,
the PeerConnection scheme-mismatch diagnostic (both directions traced
by hand, including the wrong-key non-misfire case), SocketStatus 100
never hits the wire, and the Security-pane picker's commit-on-change +
full-reopen path. gates.sh green under tools/guard.sh; no app launch,
no sockets, no tests (none exist in this repo).
One non-blocking finding: BulkChannel.reconfigure's disruptive check
omits cipherScheme, unlike ChannelConfig.needsFullReopen — traced as
harmless (new BulkConnections pick up the current config regardless)
but worth a comment for the next reader.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
§2.5 is the legacy stream: the fixed salt, IV and iteration count with
citations into the pre-a9e1f0f20e Encryption.cs, the missing cleartext
header, why the sacrificial block exists, the MacCipherScheme setting and
the mismatch diagnostic. §2.3 now says plainly that it describes v0.101
and later only.
§10.9 records the one fact in this document confirmed against a live
Windows machine rather than the source: the lead's independent Python
probe completed the whole handshake against the user's PC under the
legacy scheme, which proves framing, the magic hash, the packet layout
and the handshake as transcribed, and localises the earlier failure to
the stream cipher alone.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Cross-checked every Status/TODO tick against the PowerToys source (Awake
assertion lifetime, fullscreen edge-path-only gating, drawn-cursor
lifecycle, ClipboardBridge provisional lines, corners/relative-mode
trace). tools/gates.sh green. One informational, non-blocking finding:
the display-awake renew has no equivalent of HumanBeingDetected's
local-activity guard.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
§10.8 records seven findings with citations: the Awake receiver honours
the sender's setting and pokes itself with a mouse jiggle; the fullscreen
rule is asked once, only by the pointer's owner; the excluded-apps list
matches two spellings of the image name; DrawMouseCursor only draws when
the real cursor is suppressed; BlockMouseAtCorners is a 100 px square
around every monitor corner; relative mode moves edge detection to the
controlled machine and gates NextMachine on IsSwitchingByMouseEnabled;
both edge paths set HasSwitchedMachineSinceLastCopy.
README: Assumptions confirmed, Handshakes updated to the shipped API with
four deviations, two open requests (input-capture's easyMouseKeyDown,
clipboard's HasSwitchedMachineSinceLastCopy) and the three provisional
lines taken in ClipboardBridge.swift, Status ticked, Work log with the
corners/relative-mode reading trace.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Reviewed the diff against Core/Clipboard.cs, SocketStuff.cs, FormHelper.cs,
ReceivedDestinationFile.cs, Receiver.cs and Common.cs; ran tools/gates.sh
(all green). No wire-format, trust-gate, or logging violations found.
Findings are all low/medium severity and don't block CP2: the bulk
connection limit doesn't reproduce Windows's single-flight receive
semaphore, a dead stagingURL(in:) helper, a comment/behaviour mismatch
on the text-size gate, an unused AppKit import, and a send-time failure
message that can say "not found" instead of "too big" in a narrow race.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
A 1 MB payload is 21 846 packets. Handing them to ControlChannel.forward in
one loop overruns the 512-packet outbox (contracts C3), which closes the
connection, and puts a second of clipboard traffic ahead of the next mouse
packet. Windows paces naturally because SendClipboardDataUsingTCP writes
each packet down a blocking socket from its own thread (Clipboard.cs:260-305).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A machine pair keeps two control connections and PreProcess exempts
ClipboardText/ClipboardImage from the replay ring (Receiver.cs:40-82), so
every chunk is delivered twice. Windows reassembles from the one socket the
first chunk arrived on (Clipboard.cs:308-373) and never sees it; ours is
keyed by sending machine, so the copies interleaved and corrupted the
payload. Reassembler now keeps a 50-entry ring of chunk Ids, which works
because contracts C1 stamps one Id per chunk for both deliveries.
docs/protocol.md §10.7 note 11.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Verified gates/bundle build-only, settings completeness against README
§Settings, menu actions, status colours against the PowerToys devdocs,
hotkey-recorder modifier mapping, the SettingsStore-only edit path, the
single Permissions.request() call site, bundle-identifier guards on
notifications/SMAppService, dead-code removal in AppLifecycle, file/
function size and force-unwrap/try!/fatalError checks, MWBMac layering
imports, and that the security key never reaches a log call. One
plausible low-severity finding: a strong reference cycle between Engine
and UIBridge from a dropped [weak ui] capture, inert today because
AppDelegate is a process-lifetime singleton.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
- Resources/Info.plist: NSSupportsSuddenTermination = false, so nothing
can skip applicationWillTerminate (invariant 3, contracts C2). That is
the only bundle change notifications and login items turned out to
need; the work log says what else was checked.
- docs/features/app-ui/README.md: Assumptions brought in line with what
shipped, Handshakes replaced with the real API (five deviations, all
reasoned), one open request to app-engine for a DrawMouseCursor
accessor, Status/TODO ticked, work log.
- TODO.md §7: three lines ticked; CP1 left for the lead.
- UIBridge: dropped an unused openSettings entry point.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Records the rework round item by item, moves session-matrix request 1 and
input-capture request 1 to "answered", brings the Assumptions section
into line with the three fixes (0600 re-applied after the replace,
`releaseAll()` in the tail of `perform(_ actions:)`, `ByeBye` on the
signal path) and replaces the stale "Engine.swift 598" with prose —
quoting a line count in a work log guarantees it is wrong by the next
commit, and the judgement it supported is unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Cross-lane edit, authorised by the lead. The struct declared two public
lets and no init, so the memberwise one was internal and no other target
could build a value — `EngineSnapshot.permissions` had to default to
`Permissions.preflight()`, i.e. a TCC query, just to have a value to
hold. The default is now `PermissionState(listen: false, post: false)`,
which is also the honest value before `start()` has read anything.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Cross-lane edit, authorised by the lead. Contracts C1 gives the process
one sequencer and two callers: the Engine actor stamps application
packets, each `Session` stamps its own handshake, heartbeat, `Hi` and
`ByeBye` on the channel's queue (`Session.swift:402-403`). `value &+ 1`
with no synchronisation can lose an update and hand two packets the same
`Id`, which the peer's replay ring drops (`Receiver.cs:40-82`). The
counter now lives under an `NSLock` — Foundation only, so MWBCore's
layering holds — and the class is `@unchecked Sendable`, which is the
guarantee Windows gets from `Interlocked.Increment` (`Common.cs:916`).
`ReplayFilter` is unchanged: one queue touches it.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Reviewed against CLAUDE.md, contracts C1-C5, protocol §10.6 and the Windows
source. Gates green; one confirmed finding (Settings.save(to:) does not
reliably enforce 0600 via replaceItemAt on a pre-existing file, verified
empirically) and two plausible ones (releaseAll() parity across switch-to-
local paths; ByeBye not sent on SIGTERM/SIGINT/SIGHUP), filed with file:line
on both sides for the dev.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
The 5 s health check already had to notice Input Monitoring being
revoked (contracts C2). Noticing it being granted and retrying
EventTap.start() means a first run does not have to be restarted after
the user ticks the box in System Settings.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
§10.6 records six things the Windows source says that §1-§9 did not:
that a switch moves the pointer only when the target is the local
machine (Helper.cs:75-127), that a Mouse packet addressed to us takes
control back by assignment rather than by switching (Receiver.cs:122-125),
that relative mode puts the edge detection on the controlled machine
(Receiver.cs:147-172), that the reconnect countdown is 30 s and gated on
"no socket established" (frmScreen.cs:425-449), the exact JSON shapes of
the settings file, and why Heartbeat has to be a 64-byte packet.
The README's Handshakes section now documents the API as shipped, six
deliberate deviations, the answers to all eleven open requests from
lanes 3-5, and four new requests: PacketSequencer is used from two
queues and is not thread-safe (session-matrix), PermissionState has no
public initialiser and Cursor publishes no pointer position
(input-capture), and there is no way to send a Heartbeat on demand
(control-channel).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Dated 2026-09-16 rework entry in docs/features/input-inject/README.md:
finding 1 accepted and fixed (chord tracking and the lock-hotkey test
now see the raw wire VK; `normalise(vk:)` is the posting path only),
finding 2 accepted as a documentation gap and recorded (Windows'
secure-desktop gate has no macOS analogue, so always-eat-and-lock is a
decision). Notes why 10.5 note 8 was appended rather than inserted.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Windows wraps the `HotKeyLockMachine` branch in
`if (!Common.RunOnLogonDesktop && !Common.RunOnScrSaverDesktop)`
(`InputSimulation.cs:408-409`); `KeyState.processDown` has no such
guard, and nothing said whether that was considered or missed.
Both flags are set only where the MWB service launches a second copy of
the process onto the `Winlogon` or `Screen-saver` secure desktop
(`Program.cs:150-167`, `Common.cs:176-186`). macOS has no secure-desktop
session split, no copy of us behind `loginwindow` or the screen saver,
and a user-space `CGEventTap` neither receives nor posts once the screen
is locked; the Windows service is out of scope besides (README D6). So
the condition is unconditionally true for a Mac receiver and the
always-eat-and-lock behaviour is the faithful port.
Recorded as docs/protocol.md 10.5 note 8 (appended, so the note numbers
existing citations use stay stable), as a feature README Assumptions
bullet, and as a comment at the site in `KeyState.processDown`. No
behaviour change.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Gates green; verified KeyState.swift and Injector.swift against
InputSimulation.cs, Receiver.cs, InitAndCleanup.cs, InputHook.cs and
Event.cs. One confirmed finding: KeyState normalises side-less
modifier VKs before chord/hotkey matching, so a lock-chord replay
matches hotkeys Windows' side-specific-only switch would not match
from the same bytes — contradicts this lane's own protocol.md §10.4
note 3 citation. One plausible finding: the configurable lock hotkey
is missing Windows' RunOnLogonDesktop/RunOnScrSaverDesktop guard,
undocumented either way.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Answers the four QA findings of 2026-09-16 by number, with what changed
and why, and records that the round was build-only: no tap created, no
`CGEvent` posted, no cursor moved, no permission requested.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 4: `ProcessHotKeys` never returns `false` for a matched
`HotKeySwitch2AllPC` (`InputHook.cs:518-522`) — unlike every other hotkey
branch it falls through, so a chord that does not itself hold Ctrl+Alt
toggles ALL mode and still reaches the OS. `HotkeyMatch` grows
`swallows`, true for every hotkey except that one when its configured
chord requires neither Ctrl nor Alt; `handleKey` then queues the action
and carries on encoding the key as an ordinary keystroke, which is what
`ProcessHotKeys` returning `true` leaves to `KeyboardEvent` and
`CallNextHookEx`. Documented in docs/protocol.md §4.5 and in the feature
README, including the residual narrowing (Windows also requires the VK to
land in the switch-machine range, `:611-620`). Unreachable today: the
shortcut ships empty (`MouseWithoutBordersProperties.cs:30`) and an empty
hotkey never matches (`Common.cs:127-129`).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 3: the Assumptions bullet claimed "three acquisitions per
event at most (snapshot, virtual cursor, counters)", which named neither
`Screens` nor `CaptureQueue` and undercounted every path. Replaced with
the four lock objects the callback can reach and the count on each of the
four paths — local key 2, local move 3-4, remote key 3, remote move 5-6 —
counted from the code, with the extras (unmapped key, hotkey, escape,
modifier transitions) spelled out.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Verified every Status/TODO tick against InputHook.cs/Event.cs/VK.cs/WM.cs/
WinAPI.cs/Common.cs and docs/protocol.md §10.4, docs/contracts.md C2-C4.
Findings: EventTap.thread unguarded across start()/stop() despite the
class's own Sendable-safety claim; screens.layout fetched unconditionally
on the hot local-mouse-move path; README's lock-count claim undercounts
actual acquisitions; a disabled-by-default Switch2AllPC swallow quirk vs
Windows. No typos fixed (all findings need real changes).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
In remote mode one physical move queues a .mouse and an .edgeCandidate,
so matching only the last entry meant the kinds alternated and motion was
never coalesced -- the ring would fill at two entries per move whenever
the Engine stalled, which is the case C3's coalescing exists to survive.
The scan stops at the first non-motion entry so transitions keep order.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
§10.4 records ten things the lane established from the Windows source
(one-sided hotkey matching, the three meanings of Md.WheelDelta, the
virtual cursor and its primary+-1 clamp, the unconditional relative bias,
SwitchLocation, synthesised LLKHF bits, the eleven ReleaseAllKeys VKs, the
two input counters, monitor enumeration) plus the macOS device masks. The
README's Assumptions and Handshakes now describe what shipped, with the
nine decisions and three deliberate non-ports in the work log.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Round-2 QA finding: the channel reset beatInputEventCount on its own
clock, out of phase with every connection's heartbeat instant, so a
session could send Heartbeat (20) where Windows sends Awake (21) — and
Awake is what drives the peer's Common.HumanBeingDetected()
(Receiver.cs:245-248), the default-on BlockScreenSaver mechanism.
Windows's beat is the send: SendAwakeBeat() compares
lastRealInputEventCount against Event.RealInputEventCount and re-records
it in the same call (Common.cs:542-559). So the comparison belongs at the
send. Session.tick(now:userActive:) becomes
Session.tick(now:inputEventCount:), taking the raw process-wide counter
(Event.cs:51-55, InputHook.cs:223, 345) and keeping its own
beatInputEventCount — Common.lastRealInputEventCount, Common.cs:543 —
recorded on both branches (:558).
ControlChannel loses lastBeatAt and beatInputEventCount entirely;
noteUserActivity() only increments the counter and tick() hands the same
value to every connection. No userActive-shaped name is left in Sources.
Sources/MWBCore/Session.swift is session-matrix's file, edited for this
fix with the lead's authorisation, as is that lane's Handshakes section.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Verified the rework against SocketStuff.cs, Common.cs, Event.cs and
InputHook.cs: finding 1 (Resolver two-group control flow) and finding 2
(id-collision gated to outbound) are both correctly fixed and cited, and
the literal ask for finding 3 (counter compare, not sliding window) is met.
But reading how ControlChannel's userActive is actually consumed by
Session.tick (Sources/MWBCore/Session.swift) turned up a new problem: the
channel's own beat-reset clock (ControlChannel.swift:457-471) is not
synchronized with any connection's actual heartbeat send, which is decided
independently by each Session's own nextHeartbeat. A connection can read
userActive == false at its own send instant even though real input happened
since its own previous heartbeat, silently downgrading Awake to Heartbeat
for that peer — in the default (blockScreenSaver = true) configuration.
Documented with a concrete timeline; verdict REWORK.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Dated 2026-09-16 work-log entry answering findings 1-3 by number plus the
CLAUDE.md re-read, and the Assumptions bullets the fixes changed (name
resolution per group, the client-only id collision, the userActive
counter rule).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 3. `tick` computed `userActive` as "input within the last
heartbeat interval". `SendAwakeBeat` instead sends `Awake` when
`lastRealInputEventCount != Event.RealInputEventCount` — real input since
the previous heartbeat — and re-records the counter every time it runs
(Common.cs:545-558). Keep the same two counters: `noteUserActivity()` is
`Event.RealInputEventCount++` (InputHook.cs:223, 345) and the channel
re-records on its own heartbeat boundary, which is the one global beat
Windows's 100 ms timer runs for every socket (frmScreen.cs:565-575).
Also fixes the stale citation for this rule in docs/protocol.md §3.3,
which pointed at SendHeartBeat/screen-capture code (Common.cs:499-513,
662-676) instead of SendAwakeBeat.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 2. The id check ran for every connection that finished its
handshake, so an inbound peer announcing our own id could force-close
every socket and make the app draw a new machine id. Windows runs the id
comparison and the keep-the-first-client rule as two branches of one
block gated by `status == Connected && tcp.IsClient`
(SocketStuff.cs:1980-1981): a server-accepted socket reaches neither.
Move the collision check inside the `isOutbound` gate the dedup half
already had, and say so in the README and docs/protocol.md §10.3 note 3.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
QA finding 1. `Resolver.addresses` applied one same-subnet check to the
union of the Name2IP mappings and the DNS results. `StartNewTcpClient`
checks each group on its own: the mapped group's failure is a `return`
that skips `Dns.GetHostEntry` entirely (SocketStuff.cs:934-937, 950), so
nothing is dialled for that name that round; the DNS group's failure
(:1037-1040) drops only the DNS addresses, because the mapped ones have
already been dialled (:941). Port that control flow, and document it in
the feature README's Assumptions and docs/protocol.md §10.3 note 6.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Verified gates, TODO ticks against SocketStuff.cs, C1-C4 compliance,
Sendable justification and no key/packet logging. Two undocumented
behavioural deviations from Windows found by line-by-line comparison:
Resolver.addresses merges the Name2IP/DNS same-subnet checks instead of
running them separately (and misses Windows's early return when the
Name2IP group fails its check), and ControlChannel detects machine-id
collision on inbound connections too where Windows gates that on
IsClient. A third, minor, doc-only note on the userActive heuristic.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Verified the rework against the reference checkout at 3104d5c: read-error
counting now matches SocketStuff.cs:1330-1529/1531, Switcher.learn persists
only on a new machine (MachineStuff.cs:737/755), parkCursor carries the
HideMouseCursor gate (Common.cs:1488, MachineStuff.cs:1025), and contract
C1's forward(_:)-only stamping matches SkSend (Common.cs:901-935). Fixed a
trivially wrong citation in protocol.md §10.2 note 11 (Common.cs:914 ->
916, the actual PackageID increment line). tools/gates.sh green.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Re-read all seven files: no force-unwrap, try!, fatalError or
precondition; longest file 422 lines (Session.swift), longest function 26
(countUntrusted); nothing logs. Corrected four SocketStuff.cs citations
that were off by one or two against the reference checkout (:1390->:1389,
:1441->:1439, the untrusted branch :1386-1500 -> :1387-1529).
`xcrun swift-format format -i --recursive Sources Package.swift` made no
further changes; tools/gates.sh green.
Work log gains a dated rework entry answering QA findings 1-3 and
contract C1 by number.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>