Skip to content

feat(workspace): rill workspace state machine and distill record - #109

Merged
tarr1124 merged 3 commits into
mainfrom
feat/workspace-state-cli
Oct 20, 2026
Merged

tarr1124 merged 3 commits into
mainfrom
feat/workspace-state-cli

Conversation

@tarr1124

Copy link
Copy Markdown
Contributor

Summary

  • New rill workspace command (lib/workspace/rill_workspace.py, python3 >= 3.9, stdlib only), resolved from the distribution like lib/book.
  • Workspace status values: active, distill-pending (closed, distillation not yet verified; the set of these is the distill queue), completed. Legacy on-hold is accepted only as the source of close / reopen.
  • Transitions: close, reopen, requeue [--backfill], complete, snooze, unsnooze. Everything else is refused.
  • complete writes completed only after verify passes on the latest round of workspace/<id>/_distill.md, an append-only JSONL event record that only the CLI writes (distill begin | analysis | outcome | end | show).
  • verify: analysis-complete marker; analysis file list equals the coverage set (each file has candidates or a note); exactly one outcome per candidate; created/updated/duplicate notes exist; created notes have a source inside the workspace; valid skip labels with reasons (forbidden reasons refused; USER_DECLINED refused when RILL_DISTILL_UNATTENDED=1); totals recounted; _summary.md present.
  • queue (normal tier by close time, then backfill with no-_summary.md boxes first) and check (vault-wide invariant check for unattended jobs; exit 1 on violations).
  • Writes serialized with flock on a sidecar, files replaced atomically. Run lock in .rill/state/distill/<id>.lock; a stale lock (default 3h) is recorded as an abandoned run and taken over.

Rules, SPEC lifecycle section and the /close two-stage split follow in a separate PR so the rule text and the skill change land together.

Test plan

  • bash test/cli/test-workspace-state.sh (71 assertions) on python3 3.13 and macOS /usr/bin/python3 3.9
  • bash test/cli/test-cli-smoke.sh, CJK guard, PII regex guard

🤖 Generated with Claude Code

tarr1124 and others added 3 commits October 20, 2026 14:28
Workspace status becomes active | distill-pending | completed. The new
rill workspace subcommands are the only writers of status: close, reopen,
requeue, complete, snooze, unsnooze. complete writes completed only after
verify passes on workspace/<id>/_distill.md, an append-only event record
that only the CLI writes (distill begin / analysis / outcome / end / show).

verify checks the latest round: analysis-complete marker, analysis file
list equal to the coverage set (each file with candidates or a note),
exactly one outcome per candidate, created/updated notes exist and created
notes carry a source in the workspace, valid skip labels and reasons,
recounted totals, and _summary.md present. queue lists the distill queue
(normal tier by close time, then backfill with no-summary boxes first);
check is the vault-wide invariant check for unattended jobs.

Writes are serialized with flock on a sidecar and replaced atomically; the
run lock lives in .rill/state/distill/<id>.lock and a stale lock is
recorded as an abandoned run before it is taken over. Legacy on-hold is
accepted only as the source of close and reopen (migration path).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- created/updated/EVERGREEN_DUPLICATE paths must be notes in knowledge/notes/
- distill end requires --run and refuses a run that was taken over
- USER_DECLINED is refused when the open run began with --mode unattended
- frontmatter values drop YAML end-of-line comments
- legacy _session.md / _project.md metadata resolves (never renamed)
- distill outcome --amend supersedes an earlier outcome (duplicate merge)
- distill summary creates _summary.md (mkfile would number it NNN-summary.md)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ueue order

- analysis / outcome take --run (or RILL_DISTILL_RUN) and refuse a run that
  was taken over; they also require distill-pending, so a completed record
  cannot be amended
- queue orders by parsed timestamps, not strings (mixed time zones)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tarr1124
tarr1124 merged commit e31fe60 into main Oct 20, 2026
4 checks passed
@tarr1124
tarr1124 deleted the feat/workspace-state-cli branch October 20, 2026 05:43
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.

1 participant