Lcos

Lcos

The command-line interface and local daemon for Life Coach OS. Same daemon-and-CLI blueprint as Mxr and Spotuify, with one honest difference: lcos is a local-first mirror of a cloud backend, not the sole owner of its truth.

Project lives at: ~/code/planetaryescape/life-coach-os/apps/cli/ (a Rust cargo workspace inside the bun/Turborepo monorepo)
Docs: apps/cli/docs/ — philosophy.md, decisions.md, gotchas.md, runbook.md

In one paragraph

lcos is a single Rust binary. lcos daemon runs the long-lived process; every other subcommand auto-spawns it and talks to it over a Unix socket using length-delimited JSON. The daemon owns a local SQLite mirror of the user's health signals and coaching, a Tantivy index rebuildable from it, and a sync engine that reconciles with Convex. The CLI front-end, the MCP server, and any future client are equal peers over one IPC contract. What's different from mxr and spotuify: those daemons own the only copy of the truth. lcos doesn't. Convex is the cloud source of truth and the only place a coaching verdict is produced; the local store is a fast, disposable mirror that lets you query your health data offline and lets an agent speak to it through a shell.

The rules it shares with Mxr and Spotuify

What's genuinely new here (and became its own notes)

Mirroring a managed-auth cloud backend into a Rust daemon produced learnings the email/music daemons never hit:

Architecture summary

   Human / Script      Agent / MCP
        │                   │
        └─────────┬─────────┘
                  │  length-delimited JSON over a Unix socket
                  ▼
             lcos daemon
        ┌─────────┼──────────────┐
        ▼         ▼              ▼
     SQLite    Tantivy        sync engine ──HTTPS (self-signed JWT)──► Convex
    (local     (rebuildable                                            (cloud truth +
     mirror,    from SQLite)                                            coaching authority)
     NULL≠0)

The local SQLite mirror answers facts at speed and offline. Convex stays the authority for writes and verdicts. The sync engine drains changed-since by derivedAt on the warm lane; reads never trigger it.

Why it exists

So I can speak to my own health data from a terminal and from an agent, without the round-trip and without the app. The Life Coach OS phone app is the daily surface; lcos is the scriptable one. lcos ask "how's my HRV trending vs last month" answers instantly from the mirror; lcos ask --deep reaches the real coach. An agent can drive the same commands through MCP while I sleep, and it's gated to reads by default.

It also exists because the daemon-and-CLI blueprint keeps earning its keep. Email (Mxr), music (Spotuify), now health. The shape travels.

What it is NOT

Status (2026-06-26)

Built across five workflow-driven phases, 199 tests green, committed to main. The backend changes are deployed; the CLI auth provider ships gated off (empty LCOS_CLI_JWT_ISSUER) until the signing key and issuer are set and apps/web is deployed. Five read commands (journal, checkins, briefing, insights, correlations) are deliberately deferred behind a typed "not implemented" until their backend read-routes exist. Go-live steps live in apps/cli/docs/runbook.md.

Connections