feat: rain command + token-window watcher (0.8) - #81
Merged
Merged
Conversation
- rain, the garden watering round, as a portable skill (templates/skills/rain.md): full-roster fan-out, pick-your-own plant, one serial applier; never auto-fires; wiring note added for the trigger word - token watcher: 5h session-window weather (fresh/open/closing) reconstructed read-only from local transcripts, streamed line-by-line; timing and spend, not quota - CLI grows loci tokens + loci rain [--fire] (the one hand-off: execs the agent runtime from the palace root and exits); desktop grows a rain-gauge card behind an explicit click (read_token_window / read_rain_status / fire_rain), spawned rounds reaped on exit - carries the three pre-merge pre-mortem fixes from #79: child reaping, streaming reader, trigger-word doc
An adversarial review of the token-window watcher and rain command found two gaps in the transcript scanner (loci-cli/src/tokens.rs, desktop/src-tauri/src/token_watcher.rs): - The directory walk followed symlinks via Path::is_dir(), so a symlink planted in the scanned tree could redirect the scan outside it. - BufRead::lines() buffers one line in full before yielding it; an unterminated multi-GB "line" would force an unbounded allocation despite the file itself being read as a stream. Both files get a file_type()-based symlink guard and a bounded line reader that drains and discards any line over 8MB instead of buffering it. Added unit tests for the new reader; neither file had any test coverage before.
huximaxi
force-pushed
the
feat/rain-0.8
branch
from
September 9, 2026 07:37
c6be04d to
e4078c0
Compare
huximaxi
marked this pull request as ready for review
September 9, 2026 11:44
huximaxi
added a commit
that referenced
this pull request
Sep 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The rain command + token-window watcher, as an 0.8 scope item (deliberately skipping the 0.7 line, which stays focused on the CLI write-side). One concern, one commit. This code briefly lived on #79 and was pulled out pre-merge so the beta shipped only fleet-reviewed code; it returns here carrying the three fixes its own pre-mortems found.
Draft until the gate passes. The merge gate for this PR is an adversarial (Cipher-lens) pass over the two sensitive surfaces: the transcript reader (the most secret-dense files on a user's disk, read-only or not) and the exec hand-off. Recommended to run jointly with the deferred
loci sync/loci servethreat model, since three exec-adjacent surfaces converge on the same trust question.What it contains
templates/skills/rain.md: the garden watering round as a portable skill. Full persona roster fans out over the idea garden, each agent picks its own plant, exactly one serial applier writes; convergence of several personas on one plant is signal, not conflict. Never auto-fires: weather is a suggestion, spending is a gate. Includes the wiring note that--firesends the literal wordrainand the palace's orchestrator instructions must route it.loci tokens(CLI): approximate agent-runtime 5-hour session-window status, reconstructed read-only from local transcripts, streamed line-by-line. Reports timing and spend, explicitly not quota, and labels itself approximate.loci rain [--fire](CLI): watering weather on one screen (window signalfresh/open/closing, plant count, last rain from thegarden/.rain/archive).--fireis the CLI's one hand-off: execs the user's agent runtime from the palace root and exits. The CLI itself still does no inference.read_token_window,read_rain_status,fire_rain.Fixes carried from the #79 pre-mortems
fire_rainnow waits on the spawned round in a reaper thread; previously each fired round left a zombie process for the app's lifetime.read_to_string; peak memory is one line regardless of transcript size (multi-hundred-MB transcripts are real).Pre-mortem
fire_rain/rain --firespawns the user's agent runtime. Explicit flag or click only; no schedule, no daemon, no auto-fire path. Binary absent = immediate plain error. The runtime invoked isclaudeon the user's PATH, same trust class as their shell profile.Verification
CLI built and live-run against a real palace (window signal, garden state,
--json); tauri backend suite 22/22; leptos wasm type-checks; bleed and em-dash scans clean on the full diff.🤖 Generated with Claude Code