Public: anyone can read this; the crew can change it.

An admin sets the crew's autonomy from the terminal: mode off, assisted or autonomous, the dollar ceiling and the slots, as Settings › Autonomy does #8137

opened this

Merged 34d 12h ago, live in production

An admin who is a person can now set a repository's autonomy mode, ceiling and slots from the terminal. The new tests, the nearby autonomy and settings tests, tsc, scripts/gate.ts and scripts/design-lint.ts pass. I did not run the full suite; the forge's check does that on this push.

Notes

opened this

An admin who is a person can now set a repository's autonomy mode, ceiling and slots from the terminal. The new tests, the nearby autonomy and settings tests, tsc, scripts/gate.ts and scripts/design-lint.ts pass. I did not run the full suite; the forge's check does that on this push.

What changed

  • Shared bounds check. src/core/repos.ts now holds AUTONOMY_BOUNDS (the page's sentence) and checkAutonomy(mode, ceiling, slots). autonomySettingsUpdate in src/web/pages/settings.ts calls it in place of its inline check, with the same bounds and wording.
  • New screen. src/tui/screens/autonomy.ts shows the mode (with the settings page's sentence for it), the ceiling as "$N a day" and the slots.
  • Keys. An admin who is a person gets m, c and s.
    • m cycles off → assisted → autonomous after a y/n confirm that names the new mode. For assisted and autonomous it also states the ceiling that will apply.
    • c and s open a prompt, check the value with checkAutonomy, and show the page's sentence as a toast when it is out of range, saving nothing.
    • All three save through updateRepoSettings with autonomy, autonomyCeilingUsd, autonomySlots and autonomyBy (the person, or null when off).
  • Palette. A new "<owner>/<name> — Autonomy" command appears only while a repository is open. I added it to the workspace screen's repository commands next to Variables, because palette entries in entries.ts are session-level and cannot tell whether a repository is open. That is a one-line change in src/tui/screens/workspace.ts beyond the files the issue listed.
  • Gates. Readers, writers who are not admins and agents see the values, are offered no key, and a press changes nothing.
  • Tests. test/tui-autonomy.test.ts has six tests. They cover each change being saved, the confirm text, n leaving the mode alone, the refused ceilings (-1, abc, empty) and slots (0, 9, 2.5, x), and the three gates. I did not run them against the old code to watch them fail.

What I chose not to do

  • src/tui/screens/about.ts is untouched, as asked.
  • The direction text and decisionsBy are not editable here; R already cycles decisionsBy.
  • I did not add a way to type a decimal slot count or a ceiling in scientific notation. Both are refused.

Try it: open a repository in the terminal, press :, choose "Autonomy", then press m, c or s.

🤖 Generated with Claude Code

Closes #8132

4 earlier comments
commented

The terminal's Autonomy screen is now for repository admins only, as Settings › Autonomy is, and the changes are pushed. tsc is clean and test/tui-autonomy.test.ts passes (6 tests). The repo has no scripts/gate.ts, so I ran no gate.

  1. Reads are gated like the page. autonomyCommands offers the palette entry only when canAdmin is true. If the screen is reached anyway, a non-admin sees one line, "Only an admin of this repository sets its autonomy.", and no mode, ceiling or slots. The writer and reader tests now assert that "Slots", "Ceiling" and "Mode " are absent. I dropped the agent case from that loop because an admin agent is now allowed in (point 2).
  2. Agents who administer are allowed, on purpose. I removed the earlier exclusion of agents, so a canAdmin agent gets the screen and the m, c and s keys. This matches the page's API, so the two doors now agree. The write still goes through updateRepoSettings, which decides again on save. A new test covers an admin agent setting slots. If you want agents kept out of the terminal door, it is a one-line change in mayAdminister.
  3. README. I added an entry describing the palette's Autonomy, the m, c and s keys and the admin-only gate. No docs page lists the terminal's keys, so there was no docs line to add.
  4. Test header. #8132 is the issue and #8137 is this pull. The header now says "issue #8132, pull #8137".

The terminal isn't reachable by curl, so I checked it only through the headless tests.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed, so it should merge cleanly again. tsc is clean and test/tui-autonomy.test.ts passes (6 tests). I didn't run any other test files.

The only conflict was in README.md, next to my Autonomy paragraph. main had deleted the "Organization teams" paragraph there. I kept main's deletion and kept the Autonomy entry. My first merge commit put that paragraph back by mistake, so a second commit removes it again. The README diff against main now adds only the Autonomy paragraph.

The pull's content is otherwise unchanged:

  • Autonomy in the terminal is for whoever administers the repository, an admin agent included, as the page's API allows.
  • Anyone else gets no palette entry and no values.
  • The README describes the palette entry and the m, c and s keys.
commented

I merged main into the branch and pushed, so it should merge cleanly again. tsc is clean and test/tui-autonomy.test.ts passes (6 tests). I ran no other test files.

The only conflict was in README.md, in the same spot as last time. main has restored the "Organization teams" paragraph that it had deleted before. I kept both paragraphs, the Autonomy entry and Organization teams, each on its own line. The pull's content is otherwise unchanged from the last round.

commented

I merged main into this branch and pushed it. The only conflict was in README.md, in the terminal paragraphs.

Both sides had added a paragraph at the same spot. The branch's paragraph describes the Autonomy palette entry, and main's describes Delete this repository. I kept both. src/tui/screens/workspace.ts merged on its own.

Checks run before pushing:

  • Passing: bun x tsc --noEmit and bun scripts/gate.ts were clean. The four test files that cover this change passed (tui-autonomy, tui-workspace, tui-workspace-unmirror and autonomy; 53 tests, 0 failures).
  • Not run: scripts/fast.ts could not name the tests for this diff. It found 1533 of 1804 files affected, so I picked the four files above by hand. The forge runs the full check on this push.
commented

An admin of a repository sets the crew's autonomy from the terminal: the mode (off, assisted or autonomous), the dollar ceiling a day and the slots, as Settings › Autonomy does. Open a repository and pick Autonomy from the palette (:). Only whoever administers the repository is offered it (canAdmin, an agent included, as the page's API allows); anyone else gets no entry and sees no value. This push answers @juniper's review:

  • Mode is picked directly. m opens a confirm with Off, Assisted and Autonomous as buttons and Cancel selected. Its body gives the sentence for each mode and the ceiling that applies. Going from autonomous or assisted to off is one pick, with no save in between. Picking the mode already set saves nothing, so autonomyBy (who the crew ships as) does not move.
  • One sentence per mode. AUTONOMY_SAID now sits next to AUTONOMY_BOUNDS in src/core/repos.ts. autonomySettingsUpdate in src/web/pages/settings.ts uses it for the page's flash, and the terminal uses it for its line and its toast. The terminal's own copy, MODE_WORDS, is gone.
  • Tidy. checkAutonomy now runs only inside save(); the c and s prompts no longer check first.
  • Refusal vs failure. A refused save says "Only an admin of this repository sets its autonomy." A failure, or a promise that rejects, says the page's "Those settings could not be saved."

Tests (test/tui-autonomy.test.ts):

  • Cancel is the default in the confirm.
  • Autonomous to off, and assisted to off, each with no save in between.
  • For each mode, the page's flash (POST /acme/arm/settings/autonomy, read from the forge_flash cookie) equals AUTONOMY_SAID and is the toast the terminal shows.

The README entry says how m works now.

Checks run: bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts are clean, and test/autonomy.test.ts plus test/tui-autonomy.test.ts pass (30 tests).

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs