| 1 | # flow guide |
| 2 | |
| 3 | This guide walks the everyday journeys for flow, the agent-run client that `valley flow` runs: |
| 4 | setting it up, launching agent runs, following them, and seeing their work through GitHub or a |
| 5 | valley. `valley flow` runs a separate program installed with its package. Every command, flag and |
| 6 | key is in the [reference](./reference.md); how the pieces fit is in the [design](./design.md). |
| 7 | |
| 8 | ## Setup |
| 9 | |
| 10 | 1. Install flow ([README](../README.md#install)) and the programs it runs |
| 11 | ([prerequisites](../README.md#runtime-prerequisites)). Authenticate each agent CLI you select on |
| 12 | every machine that runs it, sandbox hosts included. |
| 13 | 2. Optionally run `valley flow init`: in a repository it writes `.klaus/config.json` and the worker |
| 14 | prompt template `.klaus/prompt.md`; elsewhere it writes the host config `~/.klaus/config.json`. |
| 15 | flow works without either. The host config holds what a repository must not choose (self-update, |
| 16 | forbidden terms, naming generation); a repository's `.klaus/config.json` overrides the rest |
| 17 | ([configuration](./reference.md#configuration)). When one of these files exists under |
| 18 | `.valley/flow/` (`~/.valley/flow/` for the host config), flow reads it instead. |
| 19 | 3. Register the repositories you work on, so runs and consults can name them: |
| 20 | |
| 21 | ```bash |
| 22 | valley flow project add acme/widget # clone into the projects directory and register |
| 23 | valley flow project add acme/site --path . # register an existing checkout |
| 24 | valley flow project set-dir ~/src # where project add clones |
| 25 | valley flow sync # fetch and fast-forward every registered project |
| 26 | ``` |
| 27 | |
| 28 | 4. If you keep rules that hold across all your projects, point `house_rules` at the file in a |
| 29 | registered project's repository; flow adds it to every worker's brief and to the reviews and |
| 30 | consults it runs ([`house_rules`](./reference.md#prompts-and-house-rules)). |
| 31 | |
| 32 | ## Coordinator sessions |
| 33 | |
| 34 | Run `valley flow` inside tmux. It resumes the most recent coordinator session, or starts one; |
| 35 | `valley flow new` always starts a fresh one, and `valley flow session --resume <id>` resumes a given |
| 36 | one. In a repository the coordinator gets its own worktree from `origin/<default branch>`; anywhere |
| 37 | else it gets a scratch workspace under `~/.klaus/sessions/<id>/`. Registered projects sync in the |
| 38 | background as the session starts. |
| 39 | |
| 40 | The coordinator is an ordinary interactive agent with `valley` and `valley-flow` on its `PATH`. You |
| 41 | plan with it; it researches and writes briefs, and launches runs for work that can proceed in |
| 42 | parallel. With `valley flow target acme/widget` (or a project name), launches from a session outside |
| 43 | any repository go to that repository by default. A Claude coordinator's memory directory is shared |
| 44 | across sessions through `~/.klaus/memory`; launched agents start clean. |
| 45 | |
| 46 | ### Choosing backends |
| 47 | |
| 48 | The coordinator and the workers are chosen independently, from `claude`, `codex` and `agy`: |
| 49 | |
| 50 | ```bash |
| 51 | valley flow new --backend codex --agent-backend agy # coordinator codex, workers agy by default |
| 52 | valley flow launch --backend claude --effort high --prompt-file brief.md |
| 53 | ``` |
| 54 | |
| 55 | Persistent defaults live in `default_coordinator_backend`, `default_agent_backend` and per-backend |
| 56 | `backends.<name>.model`/`effort`. A resumed coordinator keeps its backend; switch with |
| 57 | `valley flow new`. Budgets, budget pause and stored-trajectory replay are Claude-only; the |
| 58 | [backend table](./reference.md#backends) lists what else differs. |
| 59 | |
| 60 | ## Launching runs |
| 61 | |
| 62 | ```bash |
| 63 | valley flow launch --prompt-file /tmp/brief.md |
| 64 | valley flow launch --repo acme/widget --issue 42 --prompt-file /tmp/brief.md |
| 65 | ``` |
| 66 | |
| 67 | Each launch mints a run ID, `<date>-<time>-<8 hex digits>`, fetches the default branch, makes a |
| 68 | worktree on a new branch, installs commit hooks, and starts the agent headless in its own tmux |
| 69 | window. The agent works, runs its checks, commits and pushes; when its turn ends, flow finalizes the |
| 70 | run: it records cost and outcome, stores the run on the [data ref](./reference.md#the-data-ref), and |
| 71 | removes the worktree. |
| 72 | |
| 73 | **Write the brief to a file.** The agent has the repository but none of the conversation: the brief |
| 74 | is its whole briefing. Name what changes and why, the files and functions involved, what done looks |
| 75 | like, and the constraints. `--prompt-file` passes it verbatim; a brief in a shell argument is |
| 76 | subject to the shell's quoting, which expands backticks and `$VARS` outside single quotes. Briefs of |
| 77 | any length work. |
| 78 | |
| 79 | **Choose the repository** with `--repo`: a registered project name, `owner/repo` or a URL (cloned |
| 80 | under `<worktree_base>/.repos/`). Without it, launch uses the current repository, then the session |
| 81 | target. |
| 82 | |
| 83 | **Model, effort, budget.** `--model` and `--effort` override the backend defaults; `--budget` caps a |
| 84 | Claude run's spend in dollars (default `default_budget`, 5.00). `--reason` labels why a run was |
| 85 | dispatched, for its events and `valley flow report time`. |
| 86 | |
| 87 | **Branch names** are `<slug>-<run ID tail>`, the slug taken from the `--issue` title or the brief's |
| 88 | first `# ` heading or line, so `# Fix the healthz timeout` becomes |
| 89 | `fix-the-healthz-timeout-bd92f081`. `--branch` names it exactly. |
| 90 | |
| 91 | **Where agents run.** Agents run locally unless `sandbox_host` names an SSH host: then the worktree |
| 92 | is synced there and the agent runs remotely, while logging and finalize stay local. `--local` and |
| 93 | `--host <name>` override it per launch ([sandbox](./reference.md#sandbox-hosts)). |
| 94 | |
| 95 | How a run delivers follows from the repository's `origin`: on github.com the agent opens a GitHub |
| 96 | pull request <!-- prose-allow: vocabulary --> and the [GitHub pipeline](#runs-on-github) takes over; |
| 97 | anywhere else it pushes its branch ([direct push](#repositories-without-github)), and a repository |
| 98 | that [delivers to a valley](#repositories-that-deliver-to-a-valley) marks it ready there. |
| 99 | |
| 100 | ## Following runs |
| 101 | |
| 102 | ### The dashboard |
| 103 | |
| 104 | `valley flow dashboard` is the live view. It lists rows by what they work on: the runs on one GitHub |
| 105 | pull request <!-- prose-allow: vocabulary --> share its row, and the runs on one change share the |
| 106 | change's row. Rows are grouped by whose move it is: |
| 107 | |
| 108 | | Group | What is in it | |
| 109 | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | |
| 110 | | **yours** | yours or your coordinator's: `ATTN`, changes to approve (`READY`), review (`REVIEW`) or look at, branches to submit, GitHub rows to approve | |
| 111 | | **agents** | rows with an agent running on them | |
| 112 | | **pipeline** | everything waiting on CI, a merge or the integrator | |
| 113 | | **done** | merged, closed, integrated, withdrawn, gone, and exited agents | |
| 114 | |
| 115 | `j`/`k` move, `a` approves the selected GitHub row, `o` opens it in a browser, `d` drafts a message |
| 116 | about it into the coordinator's pane, `h` shows hidden done rows, `x` clears finished runs, `tab` |
| 117 | selects a job and `enter` reads it, `q` quits ([all keys](./reference.md#valley-flow-dashboard)). |
| 118 | With `dashboard.approve_command` set, the footer shows the command that approves the selected |
| 119 | `READY` change, filled in with its handle and head, for you to copy; the dashboard never runs it. |
| 120 | |
| 121 | The dashboard also does work: it polls GitHub (or takes webhooks), dispatches fix runs, checks |
| 122 | pushed branches and valley changes every minute, reports transitions as events, and restarts itself |
| 123 | onto a new binary on `PATH`. |
| 124 | |
| 125 | ### Status, logs and jobs |
| 126 | |
| 127 | ```bash |
| 128 | valley flow status # every run: status, age, change, CI, conflicts, merge; then jobs |
| 129 | valley flow queue # what waits on the coordinator, oldest first, then on the operator |
| 130 | valley flow logs <run-id> # the live pane, or the formatted saved log (--raw, --replay) |
| 131 | valley flow jobs # running and recent consults, reviews and prose passes |
| 132 | valley flow jobs show 1a2b --answer |
| 133 | valley flow notifications # events since you last asked, summarised |
| 134 | ``` |
| 135 | |
| 136 | ### What waits on the coordinator |
| 137 | |
| 138 | `valley flow queue` lists what waits on the coordinator, oldest first, with how long it has waited |
| 139 | and the one command that moves it on. That includes drafts to review, runs needing attention, and |
| 140 | changes that are stale or rejected, or have failed checks flow won't fix. What waits on the |
| 141 | operator, such as a change to approve, follows in its own group: |
| 142 | |
| 143 | ```text |
| 144 | Waiting on the coordinator |
| 145 | ◇ widget nxvp · awaiting-review · for 2h · head 1a2b3c4 |
| 146 | run: valley flow ready <run-id> --head 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b |
| 147 | |
| 148 | Waiting on the operator |
| 149 | ◇ widget k3fd · awaiting-approval · for 40m · head 9f8e7d6 · checks passing |
| 150 | ``` |
| 151 | |
| 152 | The coordinator checks the queue at the start of each turn and waits in the background with |
| 153 | `valley flow watch --queue`. It returns once the queue differs from the last one it printed, |
| 154 | printing the queue and a `next:` command for the following wait. To follow a landing that a plan |
| 155 | depends on, `valley flow watch --once --since-start --filter change:integrated --run <handle>` waits |
| 156 | for that event alone and returns at once if it is already in the session's events |
| 157 | ([watch](./reference.md#valley-flow-watch), [events](./reference.md#events)). |
| 158 | |
| 159 | ### Clearing finished runs |
| 160 | |
| 161 | `valley flow cleanup --done` (or `x` on the dashboard) removes the runs of finished work and the |
| 162 | older runs of open work, keeping each open item's latest run, anything needing attention, and |
| 163 | anything running. `valley flow cleanup <run-id>` removes one run; `--force` also removes a running |
| 164 | one, discarding its uncommitted work. `valley flow cleanup --all` tears the session down. Removed |
| 165 | runs still count in the session's cost. |
| 166 | |
| 167 | ## Correcting and continuing runs |
| 168 | |
| 169 | Agents run headless: nothing typed into their pane reaches them. To correct one, let it finish or |
| 170 | remove it, and continue its conversation in a fresh run: |
| 171 | |
| 172 | ```bash |
| 173 | valley flow launch --resume-from <run-id> --prompt-file /tmp/correction.md |
| 174 | valley flow launch --pr 42 --prompt-file /tmp/review-notes.md # more commits on a GitHub branch |
| 175 | valley flow launch --change nxvp --prompt-file /tmp/review-notes.md # more commits on a change |
| 176 | ``` |
| 177 | |
| 178 | `--pr` and `--change` work on the existing branch and keep its change ID; `--change` is for |
| 179 | repositories without GitHub. Follow-ups on an existing change or GitHub work get a default scope |
| 180 | rule that the brief can override: limit edits to the brief's items, their tests, and sentences those |
| 181 | edits make untrue; stop and report cost before building new mechanism; run one `_pre-review` pass on |
| 182 | the final head; and report each item's status and the round's size against its starting head. A |
| 183 | Claude follow-up replays the previous run's stored conversation when it is eligible |
| 184 | ([trajectory replay](./reference.md#trajectory-replay)). These launches refuse while another run |
| 185 | works on the same branch or change, naming it; wait for it, or pass `--force-takeover`. They never |
| 186 | remove a worktree that has the branch checked out, nor discard local commits that origin lacks, |
| 187 | except that `--force-takeover` resets the local branch to origin's tip. |
| 188 | |
| 189 | ## Runs on GitHub |
| 190 | |
| 191 | Once an agent opens its GitHub pull request, <!-- prose-allow: vocabulary --> the dashboard follows |
| 192 | it through a state machine: |
| 193 | |
| 194 | ``` |
| 195 | ci_pending → ci_passed → approved → merged |
| 196 | ↓ ↓ ↓ |
| 197 | ci_failed changes req. conflicts / behind |
| 198 | ↓ ↓ ↓ |
| 199 | fix agent fix agent rebase agent / branch update |
| 200 | ``` |
| 201 | |
| 202 | - **CI fails**: a fix agent is dispatched onto the branch (`valley flow launch --pr <n>`). |
| 203 | - **Changes requested**, or comments from a `trusted_reviewers` login: an agent addresses them. |
| 204 | - **Conflicts**: a rebase agent resolves them. **Behind the base branch**: the branch is updated |
| 205 | from the base (`gh pr update-branch`) and merged once CI re-runs. |
| 206 | - **Approved, CI green, no conflicts**: merged automatically when `auto_merge_on_approval` is on. |
| 207 | - A merge or branch update that keeps failing moves to `stalled` after three tries and emits one |
| 208 | `pipeline:stalled`. |
| 209 | |
| 210 | The pipeline never dispatches while a fix run is already working on the branch. |
| 211 | |
| 212 | ### Review, approval and merge |
| 213 | |
| 214 | Approval is the operator's: the coordinator never approves. Approve with `a` on the dashboard or |
| 215 | `valley flow approve 40 41`, then `valley flow merge 40 41` lands them in order, waiting for CI, |
| 216 | rebasing a conflicting one and verifying it (`merge_verify_command`) before its force-push. With |
| 217 | `require_approval` (the default), merge skips or asks about unapproved ones; `--yes` skips them |
| 218 | without asking. |
| 219 | |
| 220 | A comment from a `trusted_reviewers` login dispatches a fix agent even without a formal "changes |
| 221 | requested". Your own conversation comments on an agent's work count only when they start with a |
| 222 | `/klaus fix` line or carry `<!-- klaus-actionable -->` on a line of their own, since you and the |
| 223 | agents post through the same GitHub account. |
| 224 | |
| 225 | Each agent requests review from `pr_reviewer`, or from a reviewer flow picks from the repository's |
| 226 | collaborators ([`pr_reviewer`](./reference.md#configuration-keys)). |
| 227 | |
| 228 | ### Webhooks |
| 229 | |
| 230 | Polling every 30 seconds is the default. For prompt updates, run a relay that forwards GitHub |
| 231 | webhooks to the dashboard, set `webhook.relay_url` and `webhook.secret_file`, and create the hooks: |
| 232 | |
| 233 | ```bash |
| 234 | valley flow webhook check |
| 235 | valley flow webhook setup # or: valley flow webhook setup widget |
| 236 | ``` |
| 237 | |
| 238 | ## Repositories without GitHub |
| 239 | |
| 240 | When `origin` is not on github.com (a plain SSH remote such as `git@192.0.2.10:widget.git`, or a |
| 241 | local path), the agent pushes its branch instead of opening anything, and starts its final report |
| 242 | with the run ID, the branch and its head. The run shows as `awaiting-integration`, and the dashboard |
| 243 | as `SUBMIT <branch>@<short sha>` until flow sees the work on the default branch (`INTEGRATED`, or |
| 244 | `INTEGRATED~` for a content match) or the branch deleted (`GONE`). |
| 245 | |
| 246 | A run that ends without delivering, at a session limit, with uncommitted work, or crashed, is |
| 247 | salvaged: finalize commits what is left, pushes the branch without force, keeps the local branch, |
| 248 | and marks the run `needs-attention` (`ATTN`). Continue it with `--resume-from`, `--pr` or |
| 249 | `--change`; the run that takes the pushed work on carries the attention from then on. |
| 250 | |
| 251 | ## Repositories that deliver to a valley |
| 252 | |
| 253 | A direct-push repository whose head carries `policy/valley` or a `policy/instance/` directory, with |
| 254 | a `valley` on `PATH` that offers `ready` and `changes`, delivers to a valley. After the push, |
| 255 | finalize marks the pushed head ready as a version of the run's change: |
| 256 | |
| 257 | ``` |
| 258 | valley ready --change <change-id> --head <pushed sha> <branch> |
| 259 | ``` |
| 260 | |
| 261 | The change ID is the `Change-Id` trailer flow stamps on every agent commit |
| 262 | ([trailers](./reference.md#commit-hooks-and-trailers)). The valley names the uploader from the |
| 263 | clone's `valley.principal`, which the host sets. The run then reads `READY` (`awaiting-approval`) |
| 264 | until the valley says otherwise: `APPROVED` once you approve it, `INTEGRATED` once it lands, or |
| 265 | `STALE`, `REJECTED`, `CHECKS FAILED`, `CONFLICTING` and the rest |
| 266 | ([valley states](./reference.md#valley-change-states)). You approve on your own machine, with the |
| 267 | valley's own `approve`; `dashboard.approve_command` shows the command for the selected row. |
| 268 | |
| 269 | ### Drafts until review passes |
| 270 | |
| 271 | What you approve is what shows as ready, so a change should not show as ready before its review is |
| 272 | done. Set `"ready_at_finalize": false` (host config, or a project's `.klaus/config.json`) and |
| 273 | finalize records the version but returns the change to draft (`REVIEW`, `awaiting-review`). When the |
| 274 | review passes, the coordinator marks exactly the reviewed head ready: |
| 275 | |
| 276 | ```bash |
| 277 | valley flow ready nxvp --head 1a2b3c4 |
| 278 | ``` |
| 279 | |
| 280 | `valley flow ready` refuses when the change has moved to another head since the review, and while |
| 281 | any run is working on the change. |
| 282 | |
| 283 | ### Follow-ups on a change |
| 284 | |
| 285 | Every follow-up on a change goes through `valley flow launch --change <handle|change-id|run-id>`. |
| 286 | The run works on the change's branch and keeps its change ID; launch first returns the change to |
| 287 | draft so nobody approves it mid-rework, and finalize marks the new head ready again as the next |
| 288 | version. Because a valley lands a change as one commit under its head message, the agent amends the |
| 289 | head commit (or ends with a commit describing the whole change), never merges another branch in, and |
| 290 | pushes with a lease on the head it started from, so a push someone made meanwhile makes its push |
| 291 | fail rather than be lost. On the dashboard the follow-up joins the change's row. |
| 292 | |
| 293 | ### Restack conflicts |
| 294 | |
| 295 | After each landing the valley's restacker rebases ready changes onto main. When that conflicts on a |
| 296 | change flow owns, the dashboard (or `valley flow restack-conflicts` once, without a dashboard) |
| 297 | returns it to draft and dispatches a run that rebases onto `origin/main`, resolves the conflicts and |
| 298 | pushes; finalize marks the result ready. It acts once per set of inputs, at most three runs per |
| 299 | change until a clean restack, and never on a change it does not own or one that sits on other |
| 300 | changes. When it stops short, it emits `change:restack-stalled`, and the change becomes yours. |
| 301 | |
| 302 | ### Failed checks |
| 303 | |
| 304 | The valley host runs a ready change's required checks. flow shows them in the CI column (`CI …`, |
| 305 | `CI ✗`, `CI ✓`), emits `change:checks-failed` and `change:checks-passed`, and dispatches a run to |
| 306 | fix each failed head of a ready change flow owns, as for failing CI: the brief names the failed |
| 307 | checks, says how to read the worker's build output with `valley telemetry`, and has the run build |
| 308 | every check `valley checks --names origin/main HEAD` lists before it pushes. It stops after three |
| 309 | failed attempts until the checks pass. `valley flow failed-checks` does the same once, without a |
| 310 | dashboard. |
| 311 | |
| 312 | ### Working a knot |
| 313 | |
| 314 | On a valley project, `--issue` takes a knot from the project's plan graph, by its ID (`oc-`, `bd-`, |
| 315 | `ida-` or `qn-` and seven hex digits) or as `<project>:<id>` for another project on the same valley: |
| 316 | |
| 317 | ```bash |
| 318 | valley flow launch --issue <knot-id> --prompt-file /tmp/brief.md |
| 319 | ``` |
| 320 | |
| 321 | Launch reads the knot, its parents and comments through `valley knot`, appends them to the brief as |
| 322 | untrusted project notes, names the branch from the knot's title, and claims the knot for the run. |
| 323 | Finalize links the change to the knot and releases the claim; when the dashboard sees the change |
| 324 | land, it comments on the knot and closes it if nothing else keeps it open |
| 325 | ([knots](./reference.md#knots)). |
| 326 | |
| 327 | ### Tracking existing work |
| 328 | |
| 329 | `valley flow track` adds work no agent of the session made to the dashboard and |
| 330 | `valley flow status`, GitHub work and valley changes alike; `valley flow untrack` removes it: |
| 331 | |
| 332 | ```bash |
| 333 | valley flow track 405 acme/widget#406 # GitHub, by number, owner/repo#N or URL |
| 334 | valley flow track site:vpkz # a valley change, by <project>:<handle> |
| 335 | valley flow untrack 405 site:vpkz |
| 336 | ``` |
| 337 | |
| 338 | ## Cross-model review |
| 339 | |
| 340 | Same-family review shares blind spots, so flow reviews with another model family than the one that |
| 341 | wrote the code. The `_pre-review` an agent runs before delivering already does so. For a second |
| 342 | opinion on open GitHub work: |
| 343 | |
| 344 | ```bash |
| 345 | valley flow review 303 # reviewer family chosen by cross_review |
| 346 | valley flow review 303 --backend codex |
| 347 | valley flow review 303 --post # submit one COMMENT review |
| 348 | ``` |
| 349 | |
| 350 | The reviewer reads only the diff, title and description, read-only, in an empty directory. A posted |
| 351 | review is a second opinion, never an approval: its inline findings feed the trusted-review fix loop, |
| 352 | and `valley flow review` refuses to post twice on one head or beyond `cross_review.max_rounds` |
| 353 | ([cross-model review](./reference.md#valley-flow-review)). |
| 354 | |
| 355 | ## Prose rewrites |
| 356 | |
| 357 | Beside its peer review, `_pre-review` has another model family rewrite the prose a change adds (its |
| 358 | Markdown, READMEs, files `pre_review.prose.paths` matches, and the head commit message), and a third |
| 359 | fact-check the rewrite. It prints each rewrite with any fact-check failure and saves the passing |
| 360 | ones as a patch for `git apply` and a message for `git commit --amend -F`. Nothing is applied for |
| 361 | the agent, and the pass never fails `_pre-review`. Each pass is a `prose` job; finalize marks each |
| 362 | rewrite applied or rejected by whether the worktree has it. |
| 363 | |
| 364 | ## Consulting other models |
| 365 | |
| 366 | `valley flow consult` asks another model family a read-only question, without a worker, worktree or |
| 367 | branch: |
| 368 | |
| 369 | ```bash |
| 370 | valley flow consult --role critic --file plan.md --thread auth "Critique this plan" |
| 371 | valley flow consult --repo widget "Where is the retry policy decided?" |
| 372 | valley flow consult --panel "Polling or webhooks for build status?" |
| 373 | valley flow consult --thread design "Draft the migration plan" & # then: valley flow jobs show <id> --answer |
| 374 | ``` |
| 375 | |
| 376 | Roles are `partner`, `critic`, `reviewer`, or your own system prompt. `--thread NAME` keeps a |
| 377 | conversation per topic in the session. `--repo` reads a registered project as origin's default |
| 378 | branch has it, through a fresh snapshot, never the clone's working tree. `--panel` asks every other |
| 379 | installed family at once. Each call is a job, listed by `valley flow jobs` and the dashboard |
| 380 | ([details](./reference.md#valley-flow-consult)). |
| 381 | |
| 382 | ## Budget pause and resume |
| 383 | |
| 384 | Budget-paused work waits in a draft GitHub pull request <!-- prose-allow: vocabulary --> labelled |
| 385 | `klaus:budget-paused`. When a Claude agent reaches its `--budget`, flow commits what is uncommitted, |
| 386 | pushes the branch, opens or updates the draft with a comment saying how to continue, and cleans up, |
| 387 | rather than discarding the work. The dashboard shows it as budget paused, awaiting your decision. To |
| 388 | resume: |
| 389 | |
| 390 | ```bash |
| 391 | valley flow launch --pr 42 "continue the work" |
| 392 | ``` |
| 393 | |
| 394 | The new agent replays the paused conversation when eligible, and its finalize removes the label |
| 395 | (emitting `agent:resumed`). Close the draft to abandon the work, or push commits to redirect it. |
| 396 | |
| 397 | ## Where agent time goes |
| 398 | |
| 399 | ```bash |
| 400 | valley flow report time # the last week, every session |
| 401 | valley flow report time --since 2w --repo widget |
| 402 | valley flow report time --current --json |
| 403 | ``` |
| 404 | |
| 405 | The report sums runs by dispatch reason, time by phase, checks by kind, idle time between a change's |
| 406 | runs, time from a run to approval, follow-ups per change, consult and review time, and cost where |
| 407 | known ([report fields](./reference.md#run-fields-on-events)). |
| 408 | |
| 409 | ## Keeping flow up to date |
| 410 | |
| 411 | A host can follow a branch of this repository without a system rebuild. In the host config: |
| 412 | |
| 413 | ```json |
| 414 | "self_update": { "repo": "git@valley-host:~/the-valley", "branch": "main" } |
| 415 | ``` |
| 416 | |
| 417 | Then run `valley flow self-update` from a timer: nothing notifies the host when the remote branch |
| 418 | moves. It resolves the branch's tip, refuses (changing nothing) unless the flake at that commit |
| 419 | offers `packages.<system>.klaus`, builds exactly that package, smoke-tests it, and installs it into |
| 420 | your nix profile as the `klaus` element, in place of `klaus` or `valley-flow`. Each step prints one |
| 421 | line, so the timer's journal reads as a history. A running dashboard restarts onto the new build by |
| 422 | itself; running agents finish on the build they started with. |
| 423 | |
| 424 | ```bash |
| 425 | valley flow self-update --rollback # back to the previous build; again to return |
| 426 | valley flow self-update --pin # hold the current build until --unpin |
| 427 | valley flow self-update --retry # rebuild a tip that failed before |
| 428 | ``` |
| 429 | |
| 430 | `valley flow self-update` installs flow; `valley self-update` is the valley CLI's own command and |
| 431 | does not touch flow ([self-update](./reference.md#valley-flow-self-update)). |
| 432 | |
| 433 | ## Which names state gets |
| 434 | |
| 435 | flow finds and works on its state under the legacy names (`~/.klaus/`, a repository's `.klaus/`) and |
| 436 | the flow names (`~/.valley/flow/`, `.valley/flow/`) alike. Nothing moves: a session stays in its |
| 437 | directory for its whole life, whichever names new sessions get. |
| 438 | |
| 439 | The host config's `naming_generation` says which names new state gets: |
| 440 | |
| 441 | - `legacy` (the default): the legacy names. |
| 442 | - `bridge`: new sessions and other new home and repository state go under `~/.valley/flow/` and |
| 443 | `.valley/flow/`; the plumbing older builds share keeps the legacy names |
| 444 | ([what each gets](./reference.md#naming-generations)). |
| 445 | - `flow`: the plumbing too (not built; uses the `bridge` names). |
| 446 | |
| 447 | Before you set `bridge`, run: |
| 448 | |
| 449 | ```bash |
| 450 | valley flow naming status # or --json |
| 451 | ``` |
| 452 | |
| 453 | It changes nothing. It shows where each kind of state is, any kind found under both names, the live |
| 454 | sessions and the build that made each, commit hooks older than the current ones, self-update's |
| 455 | previous build, and what blocks each generation with its reason. Clear what blocks `bridge`, check |
| 456 | what the command cannot see (other machines, and timers and helpers on an older build that share |
| 457 | your home directory or the project), and add `"naming_generation": "bridge"` to the host config. |
| 458 | |
| 459 | Switching back to `legacy` moves nothing: state made under `bridge` stays where it is and keeps |
| 460 | working, while new state gets the legacy names. |