# Tasks A **Tasks** panel beside Files and Changes that answers "what do I work on next?" from your GitHub project board: the In Progress, In Review and Todo cards of the repo you're in, each with a **Start** button that makes a worktree off `main`, opens your agent in it with the issue, and moves the card to In Progress. A **What's next?** button opens an agent to plan the next issues with you, and a strip at the right of the status bar shows how much of your Claude and Codex plan limits you've used. ![Tasks](preview.png) ## What you see - **Tab bar:** Herdr's own tab bar, untouched, then an 84px block with a **Tasks** button (GitHub mark, 14px, label 12px) styled like Herdr's Files / Changes buttons: `selected` background while the Tasks panel is open, `chrome` otherwise. - **Side panel → Tasks**, top to bottom: - Header: **Up next** (14px semibold), a board switcher button (board title, ▾), a 26px **↗** button that opens the board on GitHub, and **↻** (a braille spinner while loading). - Search input (32px): "Search board and issues: title, #123, label". - Sections **IN PROGRESS · n**, **IN REVIEW · n**, **TODO · n** (11px semibold, `dim`), each listing every open card of that status in board order. An empty Todo says "Nothing in Todo. Search to pull an issue in, or plan on the board ↗." - A card (8px radius, `border`): `#number` (12px, `dim`) and the title (medium, wraps; click opens the issue), then a row with: - an agent chip (6px status dot + "claude · working") when an agent works on it; - labels (up to 3) as chips when no agent; - for a parent issue, a 40×4px progress bar and "7/13 sub-issues ▸"; - the button: **Start** (solid on Todo, outlined otherwise), **Go to tab** when an agent is on it, **…** while busy. - Bottom bar: an agent button (its icon, ▾), a model/effort button ("Opus · High", "Opus · Default"), and **✦ What's next?** (`accent` border and text). - **Status bar:** Herdr's own status bar, then a 300px **usage strip**: "Used", then per agent its icon (12px), the session % (or tightest limit), and time to reset ("37% 3h 58m"). A limit ≥70% is `ansi3`, ≥90% `blocked`. A non-session limit past 70% joins as "· Weekly 85%". - **Usage popup** (340px wide, at the pointer): "Usage" with ↻ and ✕, then one card per agent: icon, name, plan chip ("pro", "go"), "as of 2m ago"; a 6px bar per limit (Session (5h), Weekly, Weekly Opus, Monthly) with "38% used" and "Resets in 1h 1m". ## How it behaves - **Which board:** the repo of the focused terminal (checked every 1.5s); its board is the one most of its last 50 open issues sit on, or the one picked in the switcher (remembered per repo). The board reloads every 60s. - **Agent status on cards:** an agent whose pane's branch starts with `-` belongs to issue ``. Most urgent wins: blocked ("needs you"), done, working, idle. - **Start** opens a panel in the card: the first message ("Let's discuss this issue before writing any code: ", editable), "New worktree from main on `-` · moves to In Progress", the chosen agent ("Opus · High"), Cancel and **Start**. Start: 1. reuses a space already on that worktree (new tab), or `git fetch origin main` and `git worktree add --no-track -b ~/.herdr/worktrees// origin/main` (falls back to `main`; an existing branch is checked out instead); 2. opens a space there with the agent (plus `--model` / `--effort`) and the first message; 3. moves the card to In Progress. - **Sub-issues:** a parent's Start works on the whole issue. Clicking "7/13 sub-issues ▸" lists its open sub-issues, each with its own Start (or Go to tab). Starting one moves the *parent* to In Progress; sub-issues are never added to the board. An agent on a sub-issue also shows on the collapsed parent ("#319 · claude · working"). - **Search** (350ms after typing): board items of any status not Done, then the repo's open issues not on the board ("Not on board"). A match outside In Progress / In Review / Todo gets **Move to Todo** (added to the board first if needed). A sub-issue shows "sub-issue of #239": **Start** when the parent is already up next, else **Move #239 to Todo**. - **Agent / model / effort** (bottom bar) set what both Start and What's next? use, remembered across restarts. Agents: the installed ones Herdr knows. Models: Claude Code (Default, Fable, Opus, Sonnet, Haiku), Codex (its cached model list), Antigravity (`agy models`); others Default only. Effort: Default, Low, Medium, High, XHigh, Max (Claude, Codex, Antigravity). Default passes no flag. - **What's next?** opens the agent in a new tab of the repo's main checkout with: read the board with `gh project item-list`, suggest 3–4 Backlog items to move to Todo with a reason each, change nothing until I agree. - **Usage** refreshes when an agent finishes a turn or the popup opens (at most every 2 minutes), and every 5 minutes. A 429 from Anthropic keeps the last numbers and waits out its Retry-After. ## Built from - `layouts/main-mods.json`: Herdr's `main` layout plus each installed mod's `place.json`, written by `setup.py` (the same file in every mod) from the *installed* `main`. Tasks' `place.json`: `{ "tabbar": { "size": 84, "props": { "view": "button" } }, "panel": {}, "order": 10 }`; Usage's: `{ "statusbar": { "size": 300 } }`. The result: - `tabs` block → row `tabs-row` (42px, `resizable: false`): the `tabs` block, then `tasks-tabbar` (84px, `window_drag`, `{ "mod": "tasks", "props": { "view": "button" } }`). - `panel-body` stack gains `{ "id": "tasks", "type": "block", "content": { "mod": "tasks" } }`. - `status` block → row `status-row` (28px, `resizable: false`): the `status` block, then `usage-statusbar` (300px). - `mods/tasks` (`place: none`): `main.js` (the view; `props().view === "button"` draws only the button and adds `"tasks"` to `shared("workspace.panels")` so Herdr's tab bar restores it per space), `gh.js` (`gh api graphql`: `repositoryOwner { projectV2 }`, `items` paged 100 at a time, `fieldValueByName(name: "Status")`, `subIssuesSummary`, `subIssues`, `search(type: ISSUE)`, `updateProjectV2ItemFieldValue`, `addProjectV2ItemById`), `start.js` (worktree + `space.new` / `space.select` + `tab.new` with `argv` and `task`). - `herdr`: `spaces`, `panes`, `focused`, `agents`, `knownAgents`, `exec`, `run`, `home`, `readTextFile`, `theme`, `shared` / `setShared` (`tasks.boards`, `tasks.agent`, `tasks.models`, `tasks.effort`, `tasks.cache.#`), `notify`, `props`, `layout`. - Commands: `layout.select`, `layout.show`, `layout.hide`, `space.new`, `space.select`, `tab.new`, `agent.focus`. - `mods/usage` (`place: none`, overlay 340×350): `main.js` (strip; with `props().overlay`, the popup), `data.js`: - Claude: `~/.claude/state/rate-limits.json` when under 15 minutes old (written by a status-line script, see Watch out), else `GET https://api.anthropic.com/api/oauth/usage` (`anthropic-beta: oauth-2025-04-20`) with Claude Code's sign-in from the macOS Keychain item "Claude Code-credentials". Plan from `~/.claude.json` `oauthAccount.organizationType`. - Codex: the last `"rate_limits"` record in the newest `~/.codex/sessions/*/*/*/*.jsonl` (`primary` / `secondary`, `used_percent`, `window_minutes`, `resets_at`), plan from `plan_type`. - Icons: Herdr's `icons/.svg`. - Programs run: `gh`, `git`, `sh`, `security` (Keychain), `agy models`; the agents themselves when you Start. ## Watch out - **Network and files:** it calls GitHub (through `gh`) and Anthropic's usage endpoint, runs programs, and reads `~/.claude.json`, `~/.claude/state/rate-limits.json`, `~/.codex/sessions`, `~/.codex/models_cache.json` and Claude Code's Keychain item. - **Anthropic's usage endpoint is undocumented** and rate-limited (polling every 30s earned a 429 with a 55-minute Retry-After). For live numbers without it, have your Claude Code status line save what it's given: ```sh if echo "$input" | jq -e '.rate_limits' >/dev/null 2>&1; then echo "$input" | jq -c '{at: (now * 1000 | floor), rate_limits}' > ~/.claude/state/rate-limits.json fi ``` - **`gh` needs the `project` scope** (`gh auth refresh -s project`). - **`exec` leaves stdin open:** `codex exec` and `agy` wait on it forever. Run them through `sh -c '… -`; an agent on a differently named branch isn't linked to its card. - **A mod can't add itself as a panel** (herdrdev/herdr-app#520), hence the layout. Re-run `setup.py` after a Herdr update to rebuild it from the new `main`; it exits with "Herdr changed …" if a node it hooks into (`tabs`, `status`, `panel-body`) moved. Each mod is independent: Tasks without Usage leaves the status bar alone, Usage without Tasks leaves the tab bar alone. - Only spaces on this computer: a remote space shows "Tasks works on this computer's spaces." ## Done when - `herdr-app check` passes for `mods/tasks` and `mods/usage`, and `herdr-app status` shows no errors on `main-mods`. - In a repo whose issues sit on a project board, the panel lists that board's In Progress, In Review and Todo cards in board order, and a parent card shows "n/m sub-issues". - Searching `#` of an off-board issue shows it with Move to Todo; pressing it puts the card in Todo on GitHub. - Start on a Todo card creates `~/.herdr/worktrees//-` on a new branch from `origin/main`, opens the agent there with the first message, and the card shows In Progress with the agent's chip. - Picking Sonnet + High and pressing Start launches `claude --model sonnet --effort high`. - The status bar shows "Used" with the Claude session % and reset time; clicking it opens the popup with a bar per limit and the plan chip.