← ClaudeAtlas

mycodaemon-intent-file-protocollisted

Apply this skill when writing, modifying, or reviewing any code that touches Myco's intent-file-mediated daemon communication protocol — even if the user doesn't explicitly ask about correctness. The protocol (write intent file → reconciler reads → acts) has four documented failure modes: (1) concurrent writers silently dropping each other's intent via shared-file merge logic, (2) intent cleared before the async action it triggers is confirmed complete, (3) intent written but never consumed when the daemon is in deep_sleep state (SELF_RECONCILE excludes deep_sleep), and (4) reconciler re-entrancy where a handler raises a new intent for the very action the reconciler is executing, producing a perpetual no-op loop. Covers diagnosis, fix patterns, and required test coverage for all four gaps.
goondocks-co/myco · ★ 13 · Data & Documents · score 79
Install: claude install-skill goondocks-co/myco
# Daemon Intent File Protocol — Four Correctness Gaps Myco's daemon uses an intent-file protocol for inter-process communication: a CLI or background job writes a TOML file signaling desired state; the SELF_RECONCILE job picks it up and acts. The protocol sounds simple but has four seams where failures are **silent** — the daemon appears healthy while actually doing nothing or doing the wrong thing. ## Prerequisites - SELF_RECONCILE runs in `['active', 'idle', 'sleep']` — **`deep_sleep` is explicitly excluded**. This shapes Gaps 3 and 4. - Current intent file paths are type-specific (post-split architecture): `intent.restart.toml` and `intent.update.toml`. The old shared `intent.toml` no longer exists. - Key files: - `packages/myco/src/daemon/update-installer.ts` — update intent authoring and `spawnUpdateScript` - `packages/myco/src/cli/restart.ts` — restart path (CLI command) - `packages/myco/src/daemon/self-reconcile.ts` — intent consumer, handler dispatch, and `skipIntent` usage - `packages/myco/src/daemon/intent.ts` — intent file constants and type definitions --- ## Gap 1 — Concurrent Writers Silently Drop Each Other's Intent **Category:** Write race — shared file + merge logic → last-writer-wins. When a single `intent.toml` was shared across all intent types, `mergeIntent()` performed a read-modify-write cycle: 1. Read the shared file 2. Merge in the new intent section 3. Write the file back When a CLI `myco restart` and the SELF_RECONCILE background jo