# GitHub Spaces A Herdr layout with a two-part sidebar: spaces marked by colored vertical bars above, all agents below with the selected space's agents first. Spaces summarize pull requests and agents needing attention; agent rows show a PR number, CI counts, review decision, and current activity when that information is available. Tabs and framed terminals fill the rest of the window, with optional Files/Changes panels and a machine, branch, agent-count, unique open-PR count, and watcher-health footer. An optional local helper keeps GitHub data fresh and forwards PR changes to matching terminals. ![GitHub Spaces](preview.png) ## What you see All sizes are logical pixels at zoom 1. The layout inherits the person's theme and fonts; the preview shows a dark appearance. Panels use the theme's chrome color, the surrounding workspace uses canvas, and terminals use background. Text uses foreground, muted, and dim; selections use selected, hover uses hover, and focused borders use accent. - **Left sidebar:** initially 268 px wide, bounded to 44–480 px, with a 1 px divider on its right. A 46 px brand strip shows the Herdr mark, search, and collapse control. A 69 px footer contains Settings and Add machine. Between these, two scrolling lists share the available height equally, each with a 90 px minimum. - **Spaces list:** a 31 px heading, “SPACES,” with + at the right. Rows are 48 px high with 8 px corners, 2 px gaps, and 8 px outer horizontal inset. A 3 × 36 px bar sits 4 px from the row's left edge. Its palette cycles through teal #22a99a, orange #e3814f, blue #5b8def, violet #8b7cf6, green #3fae6a, and pink #d9649a. The first line has a 13 px space name, nonzero PR totals by state, and an attention badge when needed. The second has an 8 px status dot and the last segment of the branch name in 11 px dim text. PR badges use 12 px symbols and 11 px counts; attention uses a 14 px rounded square containing ! plus an 11 px count. - **Agents list:** a top border and 31 px “AGENTS” heading with the visible count when nonzero. Rows are 52 px high with 8 px corners and a leading space-color bar. A 6 px status dot appears on the second line. The first line shows a 13 px PR symbol and number, or the terminal title/program name/address, followed by nonzero CI counts. The second line shows an 11 px status label and context; a 10 px review label sits at the right when available. Each list scrolls independently. - **Top of work area:** a 42 px tab strip with rounded 29 px tab pills, program icons, status indicators, active-tab close, and a + menu. Files/Changes toggles appear when enabled in the person's Herdr setup. - **Terminal area:** 8 px outer padding and gaps; every pane, including a lone pane, has 10 px corners, a 1 px border, an accent border when focused, and an always-visible 30 px header. Terminal padding is 14 px vertically and 12 px horizontally. An optional right panel starts hidden at 368 px wide, bounded to 280–900 px, showing either Files or Changes. - **Bottom status bar:** 34 px high, top border, 14 px horizontal inset, 16 px gaps, and 11.8 px text. It shows the selected machine (“This computer” locally), the full branch when available, the total agent count across all spaces, and a blocked-agent count when nonzero. It also shows unique open PR totals and watcher health. Hovering watcher health shows cache errors, startup guidance, and the log path. The command palette shortcut sits at the far right. - **Window:** no system title bar; macOS traffic lights are positioned at [12, 16]. The brand strip and tab strip can drag the window. ## How it behaves Agent rows use the following four states. Space dots reflect Herdr's most urgent state: blocked, then done, working, idle. Unknown space status has no dot. | Status | Dot and label color | Agent label | Context | | --- | --- | --- | --- | | Working | Theme working, falling back to accent | working | Time since first observing this state, such as 2h 14m | | Blocked | Theme blocked, falling back to #e06c75 | needs you | Terminal title when different from the program name; otherwise review | | Done | Theme done, falling back to #3fae6a | done | just now, then time ago | | Idle | Theme idle, falling back to dim | idle | just now, then time ago | Times refresh every 30 seconds. They are local observations, reset on status changes, layout reloads, and when an agent leaves the displayed list. Herdr clears unseen done status when someone looks at the agent. Working tabs and pane headers have native spinning indicators; blocked panes show “Needs you,” done panes show a dot, and idle panes have no status marker. PR colors are open green #3fae6a, draft gray #8b949e, merged purple #a371f7, and closed red #e06c75. CI counts appear in failed, pending, skipped, passed order, using #e06c75, #d29922, #8b949e, and #3fae6a. The most recently updated open PR takes precedence for a branch, including drafts; only when none is open does the helper select the most recently updated closed or merged PR. Closed, unmerged PRs display cancelled in red #e06c75, overriding any review decision. Reviews on other PRs display approved in green, changes requested in red, or review required in amber if that value is supplied. An empty decision displays ready in green #3fae6a or draft in grey #8b949e according to the PR's draft status; missing review metadata displays review unknown. Zero counts are omitted. The PR/CI/review badges are informational; clicking an agent row focuses its pane, including when clicking a badge. Click a space to select it; + opens Herdr's new-space flow. The selected space and focused agent have a selected background; rows highlight on hover. Hovering a truncated space name or branch shows its full value. PR counts, attention counts, and CI counts have explanatory tooltips. The custom lists do not implement context menus or drag reordering. Space colors remain stable for the lifetime of the mod instance. Each space counts a PR once across its visible agent rows, using each agent's space and pane, and excludes terminal panes absent from the agents list. Attention counts blocked and unseen done agents plus live blocked/error descendant terminals reached through parent links. The attention badge uses blocked color if any blocked item exists, otherwise done color. The agents list always shows all agents, stably placing the selected space's agents first. The visible count covers every agent. Long activity context truncates within the row and has a full-text tooltip; status and review labels retain their width. The inherited tab strip selects on click, renames on double-click, opens a context menu on right-click, changes tabs on wheel scrolling, and moves a tab when pressed on one tab and released on another. The + menu offers a shell or an installed agent. Pane headers focus their pane; hovering reveals split-right, split-down, zoom, and close buttons. Drag a split pane by its top-center grip to swap or place it beside another pane. The root sidebar boundary, list boundary, and open side-panel boundary can resize; the sidebar's brand/footer and the work area's vertical bars stay fixed. Files/Changes choices are remembered per space. Search opens the space picker; Settings and Add machine open the corresponding built-in interfaces. The sidebar collapse control narrows it to 76 px on macOS or 44 px elsewhere, although the custom lists do not have a compact rendering. The palette hint reflects the person's global command binding, or just “commands” if unbound; clicking it opens the palette. No key bindings are included or changed. Existing Herdr shortcuts, including layout switching and pane navigation, continue to apply. When the helper is built, the agent list checks its health immediately, on the first three-second timer tick, and roughly every 30 seconds thereafter. To start a missing watcher, it uses an explicit repository override or resolves the selected local pane directory with Git, falling back to the saved space folder. It retries inference if the initial folder is unavailable or invalid. The launcher enables `--discover-repos`, so badge data includes repositories of live local Herdr panes across all spaces, using each checkout's origin owner/repository. PR-change notifications stay scoped to the initial repository. All panels poll cache data every 15 seconds in addition to folder watching, and retry failed watches on that timer. PR data normally refreshes every 60 seconds. The first observation establishes a baseline; subsequent changes to PR state, commits, CI, reviews, comments, or mergeability are forwarded to matching terminals. Working or blocked terminals hold updates for a later poll. The helper itself does not post GitHub comments, push code, or merge PRs; messages may ask the receiving agent to act. ## Built from Start with an empty package directory and an installed Herdr. Read that installation's `AGENTS.md`, `herdr.d.ts`, and `gpui-kit.d.ts`; the UI is native GPUI JavaScript, not HTML or Node. This build was checked on Herdr 0.1.12 on macOS. The layout and list mods originated from Herdr 0.1.9. Create this tree in `layouts/github-spaces.json`: ```text root row [canvas; divider 1 border; titlebar none; traffic_lights [12,16]; terminal_padding [14,12]] ├─ sidebar column [268px, min 44, max 480; chrome; resizable false] │ ├─ brand block [46px; window_drag] → workspace-chrome │ ├─ sidebar-lists column │ │ ├─ spaces block [weight 1, min 90] → spaces-letter │ │ └─ agents block [weight 1, min 90] → agents-space │ └─ sidebar-footer block [69px] → workspace-chrome {footer:true} └─ work column [resizable false] ├─ tabs block [42px; window_drag] → tabs ├─ work-body row [padding 8; gap 8] │ ├─ main block → tab:"active" │ │ pane: background background, border 1 border, focus 1 accent, │ │ radius 10, gap 8, lone true, │ │ header → pane [height 30, position top, reveal always] │ └─ panel column [hidden; 368px, min 280, max 900] │ └─ panel-body stack [active files] │ ├─ files block → files │ └─ changes block → changes └─ status block [34px] → github-spaces-status ``` Keep these IDs: the shipped chrome and tabs target them. `resizable:false` applies only to the column that declares it; it does not disable the root's horizontal divider or the nested list divider. Leave theme and font fields unset. No floating blocks or custom terminal menu are needed. Each UI mod has `main.js` default-exporting a `View` subclass and `mod.json` with `place:"none"`. All three UI mods accept optional `helperDir`, `statusFile`, and `pidFile` props; the agent mod additionally accepts `repo` and `githubAccounts` (an owner or OWNER/REPO to saved gh login map). Ship the agent block with `props:{repo:""}` so no personal path is bundled; the launcher infers the repository from the active local pane, falling back to the saved space folder; without an explicit override or a usable local repository, no watcher starts. Use `div`, `h_flex`, `v_flex`, and `svg` from `gpui-kit`/`gpui-base`. Read layout configuration through Herdr's `props()` API, falling back to the View initialization argument only when the host supplies none. Load asynchronous data in `init` through `cx.spawn`, and use the callback's own context to notify; Herdr live data already rerenders automatically. | Mod | Data, rendering, and actions | | --- | --- | | `spaces-letter` | `spaces()`, `agents()`, `panes()`, `terminals()`, `theme()`. `summary.js` resolves each visible agent's pane and space, deduplicates PRs by URL or repository+number, and walks terminal parent chains with cycle protection for attention. `run("space.select", {id})` and `run("space.new")`. Reads `status.json` with `readTextFile`, watches its folder with `watchFolder`; missing/invalid data becomes an empty PR map. | | `agents-space` | `agents()`, `panes()`, `spaces()`, `focused()`, `theme()`. Join agent pane IDs to pane cwd/branch and derive machine from space, then address prefix. Watch the same cache. Keep per-address status/time in memory. `run("pane.focus", {pane})` on each row. A three-second timer periodically checks daemon health; a separate 30-second timer refreshes times. | | `github-spaces-status` | A separately named copy of the shipped `workspace-status` implementation, preserving the installed original. Uses `spaces()`, `agents()`, `theme()`, `window()`, `keys()`, and `run("app.palette")`. The total/blocked counts cover every space. It reads the configured PR cache, deduplicates open PRs by repository and number, and checks the configured watcher PID every 15 seconds. Startup guidance comes from shared state keyed by PID path; cache errors and the log path are included in its tooltip. | The cache defaults to `appHome() + "/mods/space-status/status.json"`, so custom Herdr homes work. All three mods accept absolute `helperDir`, `statusFile`, and `pidFile` props. Cache and PID paths default under `helperDir`; set matching props on all three blocks when relocating them. `repo` is an optional absolute local path override; when empty, the launcher infers the active local pane repository and falls back to the space folder; it does not launch if neither resolves to a local Git repository. Invalid props leave normal agent/status rendering active. Its shape is `{prs: {[key]: recordOrNull}, lastRefresh, durationMs, errors?}`. Keys must be JavaScript-compatible `JSON.stringify([machineOrNull, cwd, branchOrEmpty])`. Each record has `repository`, `number`, uppercase `state`, `isDraft`, `reviewDecision`, and integer `failed`, `pending`, `skipped`, `passed`, `total`. No match is null. Only show CI badges when total and the individual count are nonzero. Shared UI source lives in `mods/space-status/ui.js`. Because Herdr confines imports to the current mod folder, `node scripts/sync-ui.mjs` copies it into each UI mod as `status.js`. Ship these generated files; `node scripts/sync-ui.mjs --check` verifies they agree. Both lists asynchronously cache Git worktree roots for local pane directories, prune roots when directories leave the live pane set, and retry failed resolutions. They use the exact cache key first, then the resolved root with the same branch and machine. Bundle `mods/agents-space/fonts/SymbolsNerdFont-Regular.ttf` and its LICENSE. PR symbols are U+F407 open, U+F4DD draft, U+F419 merged, U+F4DC closed; CI symbols are U+F52F failed, U+F444 pending, U+F517 skipped, U+F42E passed. Set their font family to `Symbols Nerd Font`. Other art comes from Herdr: `frame/welcome/herdr.png`, `mods/workspace-chrome/{monitor,server,branch,spinner,...}.svg`, pane icons, and program icons. No external image service is used. Use installed `workspace-chrome` twice (no props for brand, `{footer:true}` for footer), `tabs`, `pane` (Herdr supplies `{pane,terminal}`), `files`, and `changes`. Their menus depend on installed `menu`, `new-menu`, `picker`, `prompt`, `confirm`, `worktree`, `peek`, and `machine-add`. These shipped mods supply `app.settings`, `mod.open`, `layout.resize`, tab/pane commands, `layout.select/show/hide`, and platform window controls. Do not overwrite shipped mods. Other installations must rename any conflicting custom names and update all references and asset paths. Create `mods/space-status/` as a Go CLI project, not a UI mod. It uses Go 1.27 and `github.com/google/go-github/v72` v72.0.0. Split CLI dispatch, Git/process helpers, GitHub calls, refresh, watcher, and asynchronous atomic writing into small files; include `go.mod`, `go.sum`, and the existing helper tests. Build with `go build -trimpath -buildvcs=false -o space-status .` and validate with `go test ./...` from that directory. - `refresh --repo PATH [--github-repo OWNER/NAME] [--output PATH] [--once]`: inspect `git worktree list --porcelain`, get each branch with `git rev-parse --abbrev-ref HEAD`, infer owner/repo from `git remote get-url origin` unless `--github-repo` overrides it, and query the GitHub REST API. Skip `master` and `main`. Look up one open PR per remaining head branch, falling back to the most recently updated closed PR; this branch lookup is not author-filtered. Fetch CI and reviews per unique PR, then atomically write the cache. Local keys use null for machine. Without `--once`, poll every 60 seconds. - `pr-watch --repo PATH [--github-repo OWNER/NAME] [--state PATH] [--status PATH] [--pid PATH] [--skip ADDRESS]`: refresh that same cache, discover live terminals with `hc ls --json`, and use `hc get --json ADDRESS` for foreground cwd, falling back to terminal cwd. Keep terminals inside the repo or a worktree and skip explicit addresses plus `HC_TERMINAL_ID`. Match their branches to PRs. Store snapshots of head, state, mergeability, draft/review decision, checks, and comments/reviews/inline comments. Compare subsequent snapshots; ignore comment bodies beginning `[Herdr]:`, normalize whitespace, and clip bodies to 700 Unicode characters. Before `hc send`, recheck status and hold messages for working/blocked terminals. Persist baselines and pending updates in `pr_watch_state.json`; write `pr_watch.pid`; react to SIGUSR1 for early polling. Messages contain PR links and grouped changes with suggested next actions. - `trigger [--pid PATH]`: read the selected PID file and send SIGUSR1, rejecting invalid or nonpositive/process-group IDs. Both refresh/watch require explicit `--repo`. Runtime defaults are beside the executable, with flags for output, state, status, and PID files. Authentication is resolved inside the helper: repository-specific `--github-account OWNER/REPO=LOGIN` mappings override owner mappings, and mapped logins use `gh auth token --hostname github.com --user LOGIN` with token environment variables removed in that subprocess only. Unmapped repositories use `--token`, then `GITHUB_TOKEN`, then `gh auth token`. Only login names are passed as arguments; tokens stay in memory. The global gh account is not switched. Do not query the authenticated user profile; branch-based matching does not need it. The `agents-space` launcher reads the selected PID file and uses `exec("kill", ["-0", pid])` for health checks. It invokes `sh`/`nohup` with a fixed script and positional arguments for every configured path, using a restrictive umask and redirecting to `helperDir/pr_watch.log`. The binary receives explicit `--repo`, `--state`, `--status`, and `--pid` arguments, enables `--discover-repos`, and receives configured `--github-account KEY=LOGIN` mappings as literal positional arguments. No token is passed through the shell. An in-flight guard prevents overlapping launcher tasks in one mod instance. The helper reads repository files and Herdr terminal metadata, writes local state/logs, and contacts api.github.com. The UI does not fetch URLs directly. The inherited Files/Changes panels also read the selected repository and run Git. ## Watch out - **Use a private mod name for the status bar.** `workspace-status` is shipped and replaced on startup; this package uses `github-spaces-status`. That bar shows machine, branch, total agents, blocked count, deduplicated open PR totals, watcher health/errors, and the palette hint. Despite the historical name `spaces-letter`, spaces show colored bars, not letter badges. - **Local setup assumptions:** the helper needs a Unix-like system, Git, `hc`, and authenticated `gh` or a supplied token. `sh`, `nohup`, signals, and Go syscall usage are not a native Windows implementation. No repository path is bundled; the active local pane repository, falling back to the saved space folder, is used unless `repo` overrides it. Layout props require absolute paths, and defaults derive from `appHome()`. CLI paths can be relative and resolve against the caller's working directory. `helperDir`, `statusFile`, and `pidFile` support relocating the helper and runtime files; all three panels must use matching paths. The launcher passes literal paths, including spaces and apostrophes. The helper's lock prevents concurrent watcher instances from running. - **Optional data can be absent:** build the binary before expecting PR badges. Failed GitHub access, invalid/missing cache, or a missing binary leaves the lists usable with names and statuses. There is no setup dialog; the footer shows watcher state and offers startup guidance/errors in its tooltip. Folder-watch failures retry every 15 seconds, with polling as a fallback. Rejected and nonzero process launches are handled. Health checks retry missing helpers; PID checks do not establish process identity, while the Go helper's file lock prevents concurrent watcher instances from running. - **Data scope and limits:** the initial repository and its worktrees plus live local Herdr repositories discovered each refresh, not remote-machine PR discovery. Local subdirectories resolve to their Git worktree roots for badge lookup; machine and branch must still match. Remote PR discovery is not added. The same watcher includes newly opened local repositories without replacement; notifications stay scoped to its initial repository. CI fetches the first 100 check runs and first 100 commit statuses, with no further CI pagination. Comments/reviews paginate. Review labels approximate the latest decisive review per reviewer, not branch-protection rules; this helper produces APPROVED, CHANGES_REQUESTED, or empty, never REVIEW_REQUIRED. Partial API failures can produce incomplete results. There is no 40/100-PR author cap in the active branch-based lookup. - **Notification scope:** discovery checks live terminals and cwd, not program identity; it is not strictly Pi-only. Nonworking/nonblocked matching terminals can receive messages. `hc get` calls add latency as terminal counts grow. First observations do not replay old comments; `[Herdr]:` filtering applies to issue/inline comments, not submitted reviews. Pending changes are snapshots, not a complete event history. Do not run the daemon merely to test appearance against someone's active work. - **Sizing and navigation:** below 160 px the shipped chrome collapses but the custom lists clip; they have no compact rail or unfold button. Restore with `herdr-app do layout.resize '{"id":"sidebar","px":268}'`. Large badge counts and long review labels compete with names. The custom agent list never calls `setAgentOrder`, so next/previous agent shortcuts may use a different order. Rows assume an agent has a focusable pane. - **Theme, assets, and preview:** semantic base colors follow settings, while PR/CI colors are fixed hex. Missing the bundled font yields missing symbols. The root screenshot is gallery art, not an in-app layout-picker preview. The public screenshot removes workspace names, paths, task text, branch text, and terminal contents, and contains no image metadata. Keep required upstream font copyright/license attribution; it is third-party asset provenance, not the installer’s identity. ## Done when - All three bundled UI mods pass Herdr's mod checker, and the layout opens without reported layout/mod errors. The Go helper builds and its tests pass. Configuration tests confirm that no active local folder and no explicit repository override launches nothing, custom app homes and literal paths work, invalid PIDs are rejected, and authentication output is not included in failure messages. - The window has the specified sidebar, tab strip, framed terminal area, hidden optional panel, and bottom bar; a single pane is framed too. Both lists scroll when long, and the root sidebar divider resizes. - Selecting a space puts its agents first while retaining all other agents. Selecting an agent focuses its pane. Names/branches truncate with tooltips; all four status presentations and elapsed-time resets match the table. - Representative cache entries display the four PR colors, only nonzero CI counts, and the corresponding review text. Duplicate PRs within one space count once. Blocked/done attention and blocked/error descendants contribute as described. Missing cache still leaves usable lists. - The palette hint matches the configured shortcut. Settings, search, pane header controls, tabs, and enabled Files/Changes toggles work through the inherited mods. The status bar counts agents globally and deduplicates PR totals across cache entries. - On a deliberately configured test repo, the helper establishes baselines, refreshes badges, detects later PR changes, holds delivery while working/blocked, and routes only to eligible terminals within that repo's worktrees. The launcher starts a missing helper on its health-check cycle for the active local pane repository, saved space folder fallback, or explicit repository override. - One distributable folder contains the layout, three UI mods, helper source/dependency files, font and license, this recipe, README, and preview.png. Runtime caches, PID/state/lock/log files, credentials, personal settings, and compiled binaries are excluded. Its public GitHub repository has the herdr-layout topic.