Skip to content

feat: smoothness pack — caffeinate, desktop notifier, task links#68

Merged
NagyVikt merged 1 commit intomainfrom
claude/improve-oclony-smoothness-5s8fu
Apr 27, 2026
Merged

feat: smoothness pack — caffeinate, desktop notifier, task links#68
NagyVikt merged 1 commit intomainfrom
claude/improve-oclony-smoothness-5s8fu

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

@NagyVikt NagyVikt commented Apr 27, 2026

Summary

Three small polish features ported from NagyVikt/agent-orchestrator (caffeinate, plugin-style notifier slot) and NagyVikt/hive (worktree connections → cross-task links). Each is scoped to a single concern and lives at an existing extension point in CLAUDE.md.

1. macOS idle-sleep prevention (@colony/worker)

apps/worker/src/caffeinate.ts holds a caffeinate -i -w <worker-pid> assertion while the embed loop is running, so a laptop lid-close or system idle no longer silently suspends long-running embedding backfills. No-op on non-darwin; never started when the embedder failed to load (the worker is then just a viewer + state-file writer with no background work to protect). The -w <pid> form means the assertion auto-releases even if the worker dies without running its shutdown handler.

2. Desktop notifier slot (@colony/process + @colony/config)

@colony/process gains a generic notify({ level, title, body }, { provider, minLevel, log }) helper. provider: 'desktop' fans out to:

  • darwin → osascript -e 'display notification "<body>" with title "<title>"'
  • linux → notify-send -u <urgency> <title> <body>
  • everything else → no-op (no portable system tray worth depending on)

Fire-and-forget: never awaits the spawned helper, never throws, never blocks a hot path. Spawn failures route through the optional log callback so a missing notify-send on a headless box never crash-loops.

@colony/config adds a notify settings group (provider, minLevel). Default 'none' so a fresh install stays unobtrusive — colony config show and settingsDocs() pick it up automatically.

The worker uses it on the embedder-load-failure path so users see a real signal instead of a stderr line they may never read.

3. Cross-task links (@colony/storage + @colony/core + @colony/mcp-server)

The hive analogue. Schema bump v7 → v8 introduces a task_links table: one row per unordered pair, low_id < high_id enforced by CHECK. linkTasks is idempotent (re-linking preserves original metadata); linkedTasks(task_id) returns the other side of each edge with link metadata, regardless of which side originally created the link.

New MCP tools:

  • task_link(task_id, other_task_id, session_id, note?)
  • task_unlink(task_id, other_task_id)
  • task_links(task_id)

So an agent on a "frontend" lane can see decisions/blockers from a paired "backend" lane in their own preface without copy-paste.

Why these three?

  • Match existing extension points in CLAUDE.md (new MCP tool + new storage migration + new config setting are all documented patterns).
  • Match existing rules: notifier reuses the "no silent failures" rule (test(tasks): lock down handoff lifecycle + hook injection #9); caffeinate complements the worker's idle-shutdown contract; task_link rides the same compression + redaction pipeline as task_post.
  • Zero new dependenciescaffeinate, osascript, and notify-send ship with the OS.

Test plan

  • pnpm typecheck — passes for every package except @imdeadpool/colony-cli (pre-existing missing zod dep on main, unrelated)
  • pnpm test — all affected packages pass: storage (+4 new tests), process (+4), worker (+1), core, mcp-server (snapshot updated)
  • pnpm lint — error count unchanged from baseline (35 → 35; my changes add zero new violations)
  • pnpm --filter @colony/worker --filter @colony/mcp-server build — clean
  • Manual smoke: run the worker on macOS, confirm pmset -g assertions shows the PreventUserIdleSystemSleep assertion held by caffeinate while the embed loop is active, released on shutdown
  • Manual smoke: set notify.provider = 'desktop', force an embedder load failure, confirm the system notification fires
  • Manual smoke: link two tasks via MCP, verify task_links(A) returns B and vice versa; unlink and verify both sides drop

Marked as draft for the manual smokes and any review on the migration shape.

Notes

  • Schema migration is forward-only (per the storage rules). A CREATE TABLE IF NOT EXISTS covers the path; the schema_version row bumps to 8.
  • The notifier helper deliberately lives in @colony/process (which only depends on node: builtins per CLAUDE.md) so adding it doesn't break the dependency direction.
  • The caffeinate test only asserts the non-darwin no-op path; the spawn path is exercised manually since CI runners aren't a useful test bed for power management.

Generated by Claude Code

…, task links

Three small polish features ported from agent-orchestrator (caffeinate,
notifier slot) and hive (cross-task links).

- worker: hold a `caffeinate -i -w <pid>` assertion on darwin while the
  embed loop is running, so a laptop lid-close or system idle no longer
  silently suspends embedding backfills. No-op on non-darwin and when the
  embedder failed to load.

- process: new `notify({ level, title, body }, { provider, minLevel })`
  helper. provider='desktop' fans out to osascript/notify-send;
  provider='none' is a no-op. Fire-and-forget, never throws, never blocks
  a hot path. Worker uses it to surface embedder-load failures so users
  see a real signal instead of a stderr line they may never read.

- config: new `notify` settings group (provider, minLevel). Defaults to
  silent so a fresh install stays unobtrusive.

- storage: schema v8 adds `task_links` (one row per unordered pair).
  `linkTasks`/`unlinkTasks`/`linkedTasks` are symmetric and idempotent.

- core: `TaskThread.link/unlink/linkedTasks` wraps the storage primitives.

- mcp: new tools `task_link`, `task_unlink`, `task_links` so agents on
  one task can see decisions/blockers from a paired task without
  copy-paste — equivalent of hive's "worktree connections" minus the GUI.
@NagyVikt NagyVikt marked this pull request as ready for review April 27, 2026 14:25
@NagyVikt NagyVikt merged commit b158138 into main Apr 27, 2026
1 of 3 checks passed
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