coherence-sync-field-ordering

Diagnose and fix stale reads when coherence [Sync] setters depend on sibling synced fields.

Updated Jul 8, 2026
One-click install
npx skills add https://github.com/cmitchellVFS/Scrabble --skill coherence-sync-field-ordering-cmitchellvfs
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coherence-sync-field-ordering
Source: https://github.com/cmitchellVFS/Scrabble/tree/main/.claude/skills/coherence-sync-field-ordering
Command: npx skills add https://github.com/cmitchellVFS/Scrabble --skill coherence-sync-field-ordering-cmitchellvfs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When several coherence [Sync] fields update in the same network packet, a setter that reads another synced field can read a stale value, causing derived values to be wrong on remotes and intermittent desync that is hard to reproduce. ## Core Features & Use Cases - Root-cause explanation: Explains why [Sync] setters have no cross-field ordering guarantee while [OnValueSynced] callbacks run after all bindings are applied. - Four safe patterns: Compute-on-read getters, derivation in [OnValueSynced], LateUpdate dirty-flag recompute, and syncing the derived value from the authority. - Use Case: A synced Total = Base + Bonus is correct on the host but off by one tick on clients; the skill identifies the cross-field setter as the bug and refactors it into an idempotent OnValueSynced recompute. ## Quick Start Ask the AI to review a coherence [Sync] property whose setter reads another synced field and rewrite it using a safe ordering pattern.

Frequently Asked Questions about coherence-sync-field-ordering

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why is my coherence synced value wrong on remote clients but correct on the host?▼

A [Sync] setter that reads another synced field can run before that sibling is deserialized, so it combines the new value with last tick's data. On the authority both fields are set by your own code in order, hiding the race until two fields change in one packet.

How do I sync a computed value like Total = Base + Bonus in coherence?▼

Store Base and Bonus as raw [Sync] fields and compute Total in a getter, or recompute it in an [OnValueSynced] callback where all synced fields are guaranteed applied. Alternatively, have the authority compute and sync the derived value directly.

Does OnValueSynced fire on the authority in coherence?▼

No, [OnValueSynced] fires only on remotes receiving the update, not on the authority that wrote the value. The authority must produce any derived reaction inline in its own write path.

Can I fix sync ordering by reordering [Sync] fields in coherence?▼

No, setter execution follows binding-list order, which can change silently when you re-bake or reorder fields. Reordering tunes a race condition rather than fixing it; move cross-field logic to OnValueSynced, a getter, or LateUpdate instead.

What side effects are safe inside a coherence [Sync] setter?▼

A setter may store its own raw value and set a local dirty flag, since neither reads a sibling synced field. Any work that reads another synced field belongs in OnValueSynced, a getter, or a per-frame recompute.