ai-agentmanager 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.18.0 (2026-11-04)
4
+
5
+ - **Goals.** Give an outcome for today, this week or no deadline, across one or more projects (**+ Goal** in the Backlog tab, or `agentmgr goal add`). It's planned into tasks, one agent each, which go to the backlog and run until done; autopilot ships them where it's on. When all are finished, the outcome is checked against what was delivered and what's missing is queued, for up to 2 more rounds. Each goal keeps **completed**, **pending** and **follow-ups** current, with **Copy summary**, **Carry over** when overdue, and an optional look at the plan before agents start.
6
+ - **Work record.** What your agents got done is appended, as it happens, to `~/.agentmanager/worklog.csv`: pull requests opened, merged and closed, bugs fixed, issues filed and agents finished, with dates, links and costs. A weekly summary goes to `worklog-weekly.csv`. **Work record…** in the menu shows a period's totals, the weeks and the events, with **Copy summary** (Markdown for a review) and the files to download; `agentmgr worklog`. Agents now list issues they open as `- Filed:` lines in their brief.
7
+ - **Follow-up reminders.** The Inbox reminds you about recent agents that went quiet: work that isn't finished (still open, or closed by itself, the session cap or clean up), with a nudge to send, Resume or Close session; and finished agents whose session is still open, to close. **Later** snoozes a reminder for a few hours, **Not needed** until the agent is used again (`agentmgr remind`). Timing in config.json under `reminders`.
8
+ - **Close all** next to the agent counts closes every open session at once. The assistant stays open, and so do agents working right now unless you also choose **Close them too**.
9
+ - **Autopilot ships at a score.** Per project, choose when autopilot ships: when the scorecard says ready, as before, or at 80+, 85+, 90+ or 95+ (`agentmgr backlog autopilot <project> merge --target 85`). With a score set, work that isn't there yet, *Look at these first* included, goes back to its agent with its scorecard to improve, and ships once it's ready at the target. It waits for you when the tries run out (3) or when a try raised the score by less than 3 points. Items show their scores so far (*72 → 81 → 87*).
10
+ - Autopilot sends not-ready work back with the full scorecard, as **✨ Improve** does, instead of only the reasons, and up to three times instead of two (`"autopilot": { "rounds": 3 }`).
11
+ - **The agents list puts the most recently created or used agents on top.** It's one list now, each agent tagged with its project. Above the list, switch to **Running first** (running agents on top, then the rest) or **By project** (the grouped view as before). Each browser remembers the choice.
12
+
3
13
  ## 1.17.0 (2026-11-03)
4
14
 
5
15
  - **Sessions go both ways with the Claude desktop app.** **Open in Claude desktop** on a Claude agent (and `agentmgr desktop <agent>`) continues its conversation in the desktop app through Claude Code's `claude --desktop --resume`. The agent's session here closes first, messages for it wait until you resume it here, and **Resume** picks up what was said in the desktop app. **Import** now lists sessions started in the desktop app's Code tab (marked **Claude desktop**, with their title there) and in editors. Before, it only listed sessions started from a terminal. A session open in the desktop app is protected like one open in a terminal: close it there, or continue a copy.
package/README.md CHANGED
@@ -319,7 +319,8 @@ How it behaves:
319
319
  Every agent has a priority, **P0** (urgent) to **P3** (low). **P2** is the default.
320
320
 
321
321
  - **Look.** P0 shows a solid red chip and a red bar on the agent. P1 shows a red outline chip, and P3 a muted chip. P2 shows nothing, to keep the list calm.
322
- - **Ordering.** Within a project, agents sort by priority, then needs-input, then running. Projects holding a P0 or P1 agent move to the top and show the chip in their header.
322
+ - **Ordering.** In the **By project** order, agents within a project sort by priority, then needs-input, then running. Projects holding a P0 or P1 agent move to the top and show the chip in their header.
323
+ - **Order.** The list starts with the agents created or used most recently on top: one list, each agent with its project. A new agent starts at the top; after that, you or it working in it moves it up (typing, its conversation, its brief); a restart alone doesn't. Above the list, switch to **Running first** (running agents on top, most recently used first, then the rest) or **By project** (the grouping described here). Each browser remembers its choice.
323
324
  - **Setting it.** Use the selector next to the agent's name, the New agents dialog, `add --priority P1`, or `agentmgr priority <agent> P0`.
324
325
  - **Backlog.** Items use the same P0–P3 scale and pass it on to their agents.
325
326
  - **Slack.** Alerts are tagged `[P0]` / `[P1]`.
@@ -531,11 +532,29 @@ Autopilot takes a project's finished items the rest of the way when the [review
531
532
 
532
533
  What it does with work that isn't ready:
533
534
 
534
- - **Not ready, for a concrete reason** (failing CI, acceptance criteria not met, barely verified): the item goes back to the same agent with those reasons. This happens twice at most; after that it waits for you.
535
+ - **Not ready, for a concrete reason** (failing CI, acceptance criteria not met, barely verified): the item goes back to the same agent with its scorecard, as [**✨ Improve**](#review-changes) sends it: the low scores with why, the criteria not met, where a reviewer would look. This happens three times at most (`"autopilot": { "rounds": 3 }`); after that it waits for you.
535
536
  - **Look at these first, a failed step, or a closed pull request:** autopilot stops and it waits for you in the **Inbox** ("Autopilot held"), saying why. You can **Review changes**, **Ship it** (go ahead anyway), or **Send back** with a note.
536
537
 
538
+ **Ship at a score.** Next to the level, choose when it ships: **when ready** (the scorecard says *Ready to approve*), or **at 80+**, **85+**, **90+** or **95+** (`agentmgr backlog autopilot <project> merge --target 85`; `--target none` goes back to when ready; a default for all projects goes in config.json as `"autopilot": { "target": 85 }`). With a score set, work that isn't there yet, *Look at these first* included, goes back to its agent to improve, and is scored again when the agent is done. It ships once the scorecard says ready and rates it at least the target. It waits for you when the tries are used up, or earlier when a try raised the score by less than 3 points, since more of the same won't get there. The item shows the scores so far (*scores 72 → 81 → 87*).
539
+
537
540
  An item whose pull request merges is done. Each item shows where autopilot stands ("pull request open #12", "waiting for checks to merge", "sent back to the agent"). **Ship it** is also on every item in review, so you can ship one by hand with autopilot off. Plugins can still refuse the commit, the pull request or the merge (`agent.commit`, `agent.pr`, `agent.merge`).
538
541
 
542
+ ### Goals
543
+
544
+ A goal is a work order for an outcome, not a task: *"This week: users can sign in with SSO on web, and the API paginates /orders, both with tests."* **+ Goal** at the top of the Backlog tab (or `agentmgr goal add "…" -p web,api`) takes the outcome, when it's due (**today**, **this week** or **no deadline**) and the projects it spans.
545
+
546
+ 1. **Planned.** A model breaks the outcome into tasks, one agent each, each in one of the goal's projects, at most 12. With **Show me the plan before agents start** (`--review`) you see the plan first, untick what you don't want and **Start**; otherwise it starts right away.
547
+ 2. **Worked.** The tasks go to the backlog, tagged with the goal. The backlog's limits start the agents, and where a project's [autopilot](#autopilot) is on, finished work is opened as a pull request (and merged) by itself.
548
+ 3. **Checked.** When every task is finished, the model compares the outcome with what each task delivered (its brief's results and pull requests). Whatever is still missing is queued as new tasks, for up to 2 more rounds; then the goal is done.
549
+
550
+ Each goal's card shows how far it got and keeps three lists current:
551
+
552
+ - **Completed:** finished tasks, with their pull requests.
553
+ - **Pending:** tasks queued, being worked on, or with autopilot.
554
+ - **Follow-ups:** what needs you, with the reason. That covers blocked tasks, work autopilot held, work waiting for your review (autopilot off), and agents that need input, asked a question, seem stuck or went quiet.
555
+
556
+ **Copy summary** (`agentmgr goal show <id>`) gives the same as Markdown for a stand-up or status update. A goal past its due date shows as overdue, with **Carry over to tomorrow / next week**. **Stop** cancels its queued tasks; agents already working go on as ordinary backlog items. `agentmgr goal ls | approve | replan | extend | stop | rm`.
557
+
539
558
  ## Playbooks
540
559
 
541
560
  Saved requests you run again: **Backlog → Playbooks**, **Save as playbook…** in New agents, or `agentmgr playbook`. A playbook is a request, the projects to run it in (one agent each), and optionally a model, permission mode, priority and schedule:
@@ -577,6 +596,10 @@ The **Inbox** tab (and `agentmgr inbox`) lists what needs you, across all agents
577
596
  | AI review | The agent said it was done and the judge checked the work against the intent and brief | **Send back to finish** (types the missing items in) or **Looks good** |
578
597
  | Stuck? | The agent seems to be going in circles | Send the suggested nudge (edit it first if you like) or dismiss |
579
598
  | Overlap | It changes the same files as another agent | Tell one or both agents; see the suggested merge order |
599
+ | Follow up | An agent used in the last 3 days has been quiet for 2 hours and isn't finished: still open, or its session ended by itself or was closed by the session cap or clean up | Send the suggested nudge (edit it first), **Resume** a closed one, or **Close session**; **Later** (4 hours) or **Not needed** (until it's used again) |
600
+ | Close session? | It's done (its brief says so, or its pull request merged), quiet for 2 hours, and its session is still open | **Close session** (it resumes when you open it), **Later** or **Not needed** |
601
+
602
+ Follow-up reminders skip agents that are working or already waiting on you for something else, and agents you closed yourself. Change the timing in config.json: `"reminders": { "quietHours": 2, "recentDays": 3, "laterHours": 4 }`, or turn them off with `"enabled": false`. From the command line: `agentmgr remind <agent> later|dismiss`.
580
603
 
581
604
  **Fewer questions: approval rules.** Each yes you give a permission prompt counts toward the command, per repo (`npm test`, `pytest`, `git status`; an MCP tool; fetching from a site). After 3, the inbox offers to always allow it there. An allowed rule goes to every agent in that repo when it starts (Claude Code's `--allowedTools`), and answers its prompts that are already open, so you aren't asked again. Rules are never offered for commands that chain, redirect or substitute (`&&`, `|`, `>`, `$(…)`), or that delete, escalate, publish or reach the network (`rm`, `sudo`, `git push`, `npm publish`, `curl`…). Settings → Approval rules (or `agentmgr rules`) lists them with how many prompts each answered; **Remove** to be asked again. Stored in `~/.agentmanager/rules.json`; In config.json, `"rules": { "auto": false }` stops rules answering open prompts and `"rules": { "suggestAfter": 5 }` changes the count. Claude Code agents only for now.
582
605
 
@@ -914,6 +937,19 @@ Agents started this way are marked **⚡ GitHub** or **⚡ webhook**, Slack aler
914
937
 
915
938
  **Results** in the top bar shows how agents did over the last 7, 30 or 90 days (or all time): how many started and how many opened a pull request, PRs merged and closed, the merge rate, the median time from starting an agent to its first PR and to merge, and the cost per merged PR. The same by engine and model (which one gets merged more, for less), by where agents came from (you, the assistant, triggers, the backlog, teams, races) and by project. `agentmgr stats --days 30`.
916
939
 
940
+ ### Work record
941
+
942
+ **Work record…** in the menu (and `agentmgr worklog`) keeps what your agents got done, for your own notes and for performance reviews. It's recorded as it happens, into two spreadsheets (CSV files that open in Excel or Numbers, or File → Import in Google Sheets):
943
+
944
+ - **`~/.agentmanager/worklog.csv`**: one row per event, with the date, project, agent, title, link, linked bugs, engine and model:
945
+ - *pull request opened*, *merged* (with the hours from opening to merge) or *closed* unmerged;
946
+ - *bug fixed*: a bug the agent's request linked (a Jira or GitHub issue), once its pull request merges;
947
+ - *issue filed*: an issue the agent opened, from a `- Filed: <link> <title>` line in its brief's Results (agents are asked to add one for each);
948
+ - *agent finished*: its brief says done, with the hours since it started and what it cost.
949
+ - **`~/.agentmanager/worklog-weekly.csv`**: one row per week, Monday to Sunday, added once the week is over. It counts PRs opened, merged and closed, the merge rate, bugs fixed, issues filed, agents finished, the median time to merge, and the week's spend.
950
+
951
+ Rows are only ever added; edit or chart them in your spreadsheet. The first time, the history already recorded is written too, with the dates it happened. The dialog shows a period's totals, the weeks and every event. **Copy summary** (`agentmgr worklog --days 90 --summary`) gives the period as Markdown with links, ready for a review document. To keep the files somewhere else, such as a synced folder, set `"worklog": { "dir": "~/Documents/agent-work" }` in config.json; `"enabled": false` stops recording.
952
+
917
953
  ### Spend and budgets
918
954
 
919
955
  The same dialog shows what agents cost today, the last two weeks and the costliest agents, from the cost Claude Code records for each session (the API price, even on a subscription plan; Codex and Antigravity record none). Set limits there, with `agentmgr spend --per-agent 5 --per-day 50`, or in config.json (`"budgets": { "perAgentUsd": 5, "perDayUsd": 50 }`):
@@ -925,6 +961,8 @@ Alerts for both go to Slack with **Alerts → nears or reaches its budget**.
925
961
 
926
962
  ## Cleaning up old agents
927
963
 
964
+ **Close all** (next to the agent counts above the list) closes every open agent session at once. The assistant's stays open, and so do agents working at that moment unless you choose **Close them too**. Closed sessions keep their conversation and resume when you open them. From the command line: `agentmgr close --all`.
965
+
928
966
  Agents you no longer use keep a session open and a worktree on disk. **Clean up** (in the top bar, or `agentmgr cleanup`) closes agents with no activity for a while and deletes agents that stayed closed long after that. Pick a strategy:
929
967
 
930
968
  | Strategy | What happens on its own (checked every few hours) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agentmanager",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "Run background coding agents (Claude Code, Codex) per intent, and keep track of them from a web UI, your phone or the CLI",
5
5
  "keywords": [
6
6
  "claude",
package/public/app.js CHANGED
@@ -15,6 +15,8 @@ import { initReview } from '/review.js';
15
15
  import { initLand, prChips } from '/land.js';
16
16
  import { initTriggers } from '/triggers.js';
17
17
  import { initSpend } from '/spend.js';
18
+ import { initGoals } from '/goals.js';
19
+ import { initWorklog } from '/worklog.js';
18
20
  import { initPlaybooks } from '/playbooks.js';
19
21
  import { initSetup } from '/setup.js';
20
22
  import { initUpdate } from '/update.js';
@@ -58,6 +60,16 @@ const saveRecent = () => {
58
60
  localStorage.setItem('agentmgr.recentDays', String(recent.days));
59
61
  } catch {}
60
62
  };
63
+ // How the agents list is ordered: recently used (the default) or running first, one list each; or grouped by project.
64
+ const ORDERS = ['recent', 'running', 'project'];
65
+ let listOrder = (() => {
66
+ try {
67
+ const v = localStorage.getItem('agentmgr.listOrder');
68
+ return ORDERS.includes(v) ? v : 'recent';
69
+ } catch {
70
+ return 'recent';
71
+ }
72
+ })();
61
73
 
62
74
  // ------------------------------------------------------------------ helpers
63
75
 
@@ -114,6 +126,8 @@ async function act(fn, okMsg) {
114
126
  const reviewUi = initReview({ api, esc, toast, agents, $ });
115
127
  const triggersUi = initTriggers({ api, esc, toast, $ });
116
128
  initSpend({ api, esc, toast, $ });
129
+ const goalsUi = initGoals({ api, esc, toast, $, ago: (t) => ago(t), getProjects: () => projectsState, rerender: () => renderBacklog() });
130
+ initWorklog({ api, esc, toast, $ });
117
131
  initSetup({ api, esc, $ });
118
132
  const updateUi = initUpdate({ api, esc, toast, $ });
119
133
  initMenu({ api, esc, toast, $ });
@@ -730,15 +744,18 @@ const prioChip = (p, { always = false } = {}) =>
730
744
 
731
745
  const noRepo = (a) => a.kind === 'general' || a.kind === 'assistant';
732
746
 
733
- function agentItem(a) {
747
+ function agentItem(a, { project = false } = {}) {
734
748
  const st = statusOf(a);
735
749
  const idle = !isActive(a);
750
+ const p = project && a.projectInfo && !['other', 'general', 'assistant'].includes(a.projectInfo.key) ? a.projectInfo : null;
736
751
  return `<li data-id="${a.id}" ${a.kind === 'general' || a.kind === 'assistant' ? '' : 'draggable="true" '}class="agent pr${a.priority ?? 2} ${a.id === selectedId ? 'selected' : ''} ${idle ? 'idle' : ''}">
737
752
  <div class="line1">${prioChip(a.priority ?? 2)}${a.results?.outcome === 'blocked' ? '<span class="outcome-mark" title="Blocked">⛔</span>' : a.results?.outcome === 'done' ? '<span class="outcome-mark" title="Done">✅</span>' : ''}<span class="name">${esc(a.name)}</span>${flags(a)}<span class="pill ${st}">${pillText(st)}</span></div>
738
753
  <div class="intent" title="${esc(describeTitle(a) ?? '')}">${a.builds ? `<span class="tag assistant" title="Develops the agent ${esc(a.builds.name)} (Built tab)">⚙ builds agent</span> ` : ''}${a.kind === 'general' ? '<span class="tag">general</span> ' : a.kind === 'assistant' ? '<span class="tag assistant">assistant</span> ' : a.startedBy ? '<span class="tag assistant" title="Started by the assistant">🤖 by assistant</span> ' : a.trigger ? `<span class="tag assistant" title="Started from ${a.trigger.source === 'github' ? 'a labeled GitHub issue' : 'the webhook'}${a.trigger.url ? `: ${esc(a.trigger.url)}` : ''}">⚡ ${a.trigger.source === 'github' ? 'GitHub' : 'webhook'}</span> ` : a.playbook ? `<span class="tag assistant" title="Started by the playbook ${esc(a.playbook.name)}">▶ ${esc(a.playbook.name)}</span> ` : ''}${a.engine && a.engine !== 'claude' ? `<span class="tag engine">${esc(ENGINE_LABEL[a.engine] ?? a.engine)}</span> ` : ''}${a.isolation === 'container' ? '<span class="tag engine" title="Runs in its own Docker container: it sees only its own folder">📦 container</span> ' : ''}${esc(describe(a) || (a.kind === 'assistant' ? 'Finds new work and starts agents for it' : 'General session'))}</div>
739
754
  ${a.status === 'preparing' && a.progress ? `<div class="progress-line">${esc(progressText(a.progress))}</div>` : ''}
740
755
  <div class="meta">
741
756
  <span class="mono">${a.id}</span>
757
+ ${p ? `<span class="tag proj" title="Project: ${esc(p.full || p.name)}">${esc(p.shortcut || p.name)}</span>` : ''}
758
+ ${!idle && project && a.activeAt ? `<span title="Last used">${ago(a.activeAt)}</span>` : ''}
742
759
  ${idle && a.activeAt ? `<span title="Idle: no work and no input from you for over a day">💤 ${ago(a.activeAt)}</span>` : ''}
743
760
  ${a.git?.branch ? `<span class="branch" title="${esc(a.git.branch)}">⎇ ${esc(a.git.branch)}</span>` : ''}
744
761
  ${a.prs.length ? `<span>${a.prs.length} PR</span>` : ''}
@@ -804,6 +821,13 @@ function projectGroups(list) {
804
821
  );
805
822
  }
806
823
 
824
+ /** One list, most recently used first (Running first: the running agents, then the rest). */
825
+ const usedAt = (a) => a.activeAt ?? a.createdAt ?? '';
826
+ function orderedAgents(list) {
827
+ const top = (a) => (listOrder === 'running' && !a.runtime.running ? 1 : 0);
828
+ return [...list].sort((a, b) => top(a) - top(b) || usedAt(b).localeCompare(usedAt(a)));
829
+ }
830
+
807
831
  function renderList() {
808
832
  if (dragging) return void (listStale = true);
809
833
  const waiting = [...agents.values()].filter((a) => a.runtime.attention).length;
@@ -831,16 +855,19 @@ function renderList() {
831
855
  const all = [...agents.values()];
832
856
  const projects = new Set(all.map((a) => a.projectInfo?.key ?? 'other')).size;
833
857
  const running = all.filter((a) => a.runtime.running).length;
858
+ const open = all.filter((a) => a.runtime.running && a.kind !== 'assistant').length;
834
859
  $('#counts').innerHTML = agents.size
835
860
  ? `<span title="Projects">${projects} project${projects === 1 ? '' : 's'}</span><span>${agents.size} agents</span><span>${running} running</span>
836
861
  ${waiting ? `<span class="fail">${waiting} need${waiting === 1 ? 's' : ''} input</span>` : ''}
837
- <span class="spacer"></span><button class="link" id="import-btn" title="Continue Claude sessions you started in a terminal or the Claude desktop app on this machine">Import</button><button class="link" id="flush-btn" title="Save session IDs, terminal scrollback and state to disk now (also automatic every 30s)">Save now</button>`
862
+ <span class="spacer"></span><button class="link" id="import-btn" title="Continue Claude sessions you started in a terminal or the Claude desktop app on this machine">Import</button>${open ? `<button class="link" id="close-all-btn" title="Close every open agent session (the assistant's stays); they resume when you open them">Close all</button>` : ''}<button class="link" id="flush-btn" title="Save session IDs, terminal scrollback and state to disk now (also automatic every 30s)">Save now</button>`
838
863
  : '';
839
864
 
840
865
  // Every agent a project has, also the ones a filter hides.
841
866
  const totals = new Map();
842
867
  for (const a of all) totals.set(a.projectInfo?.key ?? 'other', (totals.get(a.projectInfo?.key ?? 'other') ?? 0) + 1);
843
868
 
869
+ $('#list-order').value = listOrder;
870
+ if (listOrder !== 'project') return void morph($('#agent-list'), orderedAgents(shown).map((a) => agentItem(a, { project: true })).join(''));
844
871
  morph($('#agent-list'), projectGroups(shown)
845
872
  .map((g) => {
846
873
  const total = totals.get(g.key) ?? g.agents.length;
@@ -901,6 +928,7 @@ function renderBacklog() {
901
928
  <button class="link" data-bl="playbooks" title="Saved requests you run again, by hand or on a schedule">Playbooks</button>
902
929
  </div>
903
930
  ${!backlogState.autoRun ? '<p class="hint bl-paused">Paused: queued items wait until you resume.</p>' : ''}
931
+ ${goalsUi.html()}
904
932
  ${items.length
905
933
  ? `<ul class="agent-list">${[...groups.values()]
906
934
  .map((g) => {
@@ -910,7 +938,7 @@ function renderBacklog() {
910
938
  ${p.shortcut ? `<span class="shortcut">${esc(p.shortcut)}</span>` : ''}
911
939
  <span class="pname">${esc(g.name)}</span>
912
940
  <button class="link" data-bl="limit" data-project="${esc(g.key)}" data-name="${esc(g.name)}" title="How many items of this project agents work on at once">${p.limit} at a time ✎</button>
913
- <label class="bl-autopilot" title="${esc(AUTOPILOT_HINT)}">🛫 <select aria-label="Autopilot" data-bl-autopilot="${esc(g.key)}">${Object.entries(AUTOPILOT_LEVELS).map(([v, l]) => `<option value="${v}" ${(p.autopilot ?? 'off') === v ? 'selected' : ''}>${l}</option>`).join('')}</select></label>
941
+ <label class="bl-autopilot" title="${esc(AUTOPILOT_HINT)}">🛫 <select aria-label="Autopilot" data-bl-autopilot="${esc(g.key)}">${Object.entries(AUTOPILOT_LEVELS).map(([v, l]) => `<option value="${v}" ${(p.autopilot ?? 'off') === v ? 'selected' : ''}>${l}</option>`).join('')}</select>${(p.autopilot ?? 'off') !== 'off' ? ` <select aria-label="Ships at" title="${esc(TARGET_HINT)}" data-bl-target="${esc(g.key)}">${AUTOPILOT_TARGETS.map((n) => `<option value="${n}" ${(p.target ?? 0) === n ? 'selected' : ''}>${n ? `at ${n}+` : 'when ready'}</option>`).join('')}</select>` : ''}</label>
914
942
  </div>
915
943
  <ul class="project-agents">${g.items.map(itemRow).join('')}</ul>
916
944
  </li>`;
@@ -922,13 +950,16 @@ function renderBacklog() {
922
950
 
923
951
  const AUTOPILOT_LEVELS = { off: 'Off', pr: 'Open PRs', merge: 'Merge' };
924
952
  const AUTOPILOT_HINT = 'When an item is done and its review scorecard says ready: Open PRs commits, pushes and opens the pull request; Merge also merges it once checks pass. Not-ready work goes back to the agent; anything else waits for you in the inbox.';
953
+ const AUTOPILOT_TARGETS = [0, 80, 85, 90, 95];
954
+ const TARGET_HINT = 'When it ships. At a score: work goes back to its agent to improve until the scorecard says ready and rates it at least that, a few times at most, stopping early when a try no longer raises the score.';
925
955
  const AUTOPILOT_STATE = { queued: 'going ahead', scoring: 'scoring the changes', shipping: 'opening the pull request', pr: 'pull request open', landing: 'waiting for checks to merge', merging: 'merging', returned: 'sent back to the agent', held: 'waiting for you', merged: 'merged' };
926
956
  /** Where autopilot stands on an item, under it in the backlog. */
927
957
  function autopilotLine(it) {
928
958
  const ap = it.autopilot;
929
959
  if (!ap?.state || !['review', 'active', 'done'].includes(it.status) || (it.status === 'active' && ap.state !== 'returned')) return '';
930
960
  const pr = ap.pr ? ` <a href="${esc(ap.pr)}" target="_blank" rel="noopener">#${esc(ap.pr.split('/').pop())} ↗</a>` : '';
931
- return `<p class="hint bl-ai bl-ap ${ap.state === 'held' ? 'held' : ''}">🛫 Autopilot: ${AUTOPILOT_STATE[ap.state] ?? esc(ap.state)}${pr}${ap.note ? ` · ${esc(ap.note)}` : ''}</p>`;
961
+ const trail = ap.scores?.length > (ap.state === 'returned' ? 1 : 0) ? ` · scores ${ap.scores.map((n) => n ?? '?').join(' → ')}` : '';
962
+ return `<p class="hint bl-ai bl-ap ${ap.state === 'held' ? 'held' : ''}">🛫 Autopilot: ${AUTOPILOT_STATE[ap.state] ?? esc(ap.state)}${pr}${ap.note ? ` · ${esc(ap.note)}` : ''}${trail}</p>`;
932
963
  }
933
964
 
934
965
  function itemRow(it) {
@@ -972,12 +1003,18 @@ function showTab(tab) {
972
1003
  for (const b of document.querySelectorAll('.side-tab')) b.onclick = () => showTab(b.dataset.tab);
973
1004
 
974
1005
  $('#backlog-view').addEventListener('change', (e) => {
1006
+ const tkey = e.target.dataset?.blTarget;
1007
+ if (tkey) {
1008
+ const n = Number(e.target.value);
1009
+ return act(() => api('POST', '/backlog/settings', { project: tkey, target: n || null }), n ? `Autopilot ships at ${n}/100 or more` : 'Autopilot ships when the scorecard says ready');
1010
+ }
975
1011
  const key = e.target.dataset?.blAutopilot;
976
1012
  if (!key) return;
977
1013
  const level = e.target.value;
978
1014
  act(() => api('POST', '/backlog/settings', { project: key, autopilot: level }), level === 'off' ? 'Autopilot off' : `Autopilot: ${AUTOPILOT_LEVELS[level]}`);
979
1015
  });
980
1016
  $('#backlog-view').addEventListener('click', async (e) => {
1017
+ if (e.target.closest('[data-goal-act]')) return goalsUi.onClick(e);
981
1018
  const el = e.target.closest('[data-bl]');
982
1019
  if (!el) return;
983
1020
  const what = el.dataset.bl;
@@ -1051,7 +1088,7 @@ function flags(a) {
1051
1088
  }
1052
1089
 
1053
1090
  const TRIAGED = { now: 'sent (AI: urgent)', digest: 'held for the digest', skip: 'dropped by the AI judge' };
1054
- const NEED_ORDER = { approval: 0, prompt: 0, waiting: 1, plan: 1, question: 1, team: 1, rule: 2, review: 2, autopilot: 2, stuck: 3, conflict: 4, repeat: 5 };
1091
+ const NEED_ORDER = { approval: 0, prompt: 0, waiting: 1, plan: 1, question: 1, team: 1, rule: 2, review: 2, autopilot: 2, stuck: 3, conflict: 4, reminder: 5, close: 5, repeat: 5 };
1055
1092
  /** What an agent needs from the user. `both`: overlaps on both agents (detail), else only the one that should rebase (inbox). */
1056
1093
  function needsFor(a, { both = false } = {}) {
1057
1094
  const items = [];
@@ -1061,6 +1098,7 @@ function needsFor(a, { both = false } = {}) {
1061
1098
  if (a.aiReview?.verdict && !a.aiReview.seen) items.push({ a, kind: 'review', key: `review:${a.id}` });
1062
1099
  for (const q of a.questions ?? []) if (!q.answer) items.push({ a, kind: 'question', key: `q:${a.id}:${q.id}`, q });
1063
1100
  for (const f of a.stuck ?? []) items.push({ a, kind: 'stuck', key: `stuck:${a.id}:${f.key}`, f });
1101
+ if (a.followUp) items.push({ a, kind: a.followUp.kind === 'close' ? 'close' : 'reminder', key: `reminder:${a.id}`, r: a.followUp });
1064
1102
  for (const g of a.conflicts ?? []) if (both || g.mergeFirst !== a.id) items.push({ a, kind: 'conflict', key: `conflict:${a.id}:${g.agent.id}`, g });
1065
1103
  return items;
1066
1104
  }
@@ -1096,7 +1134,7 @@ function inboxItems() {
1096
1134
  .sort((x, y) => NEED_ORDER[x.kind] - NEED_ORDER[y.kind] || (x.a.priority ?? 2) - (y.a.priority ?? 2));
1097
1135
  }
1098
1136
 
1099
- const NEED_LABEL = { repeat: 'Make it a playbook?', autopilot: 'Autopilot held', rule: 'Always allow?', approval: 'Approval', team: 'Team', prompt: 'Needs input', waiting: 'Waiting on you', plan: 'Plan review', question: 'Question', review: 'AI review', stuck: 'Stuck?', conflict: 'Overlap' };
1137
+ const NEED_LABEL = { reminder: 'Follow up', close: 'Close session?', repeat: 'Make it a playbook?', autopilot: 'Autopilot held', rule: 'Always allow?', approval: 'Approval', team: 'Team', prompt: 'Needs input', waiting: 'Waiting on you', plan: 'Plan review', question: 'Question', review: 'AI review', stuck: 'Stuck?', conflict: 'Overlap' };
1100
1138
  /** Why the AI judge thinks so, as a small tag. */
1101
1139
  const aiTag = (confidence, what = 'AI') => `<span class="tag ai" title="Judged by a model from the agent's activity; your reactions tune later calls">🤖 ${what}${confidence != null ? ` ${Math.round(confidence * 100)}%` : ''}</span>`;
1102
1140
  /** What a permission prompt asks about: the command, file or tool. */
@@ -1120,6 +1158,7 @@ function groupCard(g) {
1120
1158
  <p class="need-title">${toolLine(t)}</p><p class="hint">${names}</p>
1121
1159
  <div class="need-actions"><button class="small primary" data-ib="yes-all">Yes to all ${g.length}</button></div></div>`;
1122
1160
  }
1161
+ const FOLLOW_UP = "Where are you on this? Carry on with the next step, or update the brief with what's left and what's blocking you.";
1123
1162
  function needCard(it, { inDetail = false } = {}) {
1124
1163
  const { a } = it;
1125
1164
  const who = inDetail
@@ -1202,6 +1241,19 @@ function needCard(it, { inDetail = false } = {}) {
1202
1241
  <input data-draft="${esc(it.key)}:text" placeholder="Or type an answer…" value="${draft('text')}" />
1203
1242
  <button class="small primary">Send</button>
1204
1243
  </form>`;
1244
+ } else if (it.kind === 'reminder' || it.kind === 'close') {
1245
+ const r = it.r;
1246
+ const later = `<button type="button" class="small ghost" data-ib="remind-later" title="Remind me again in a few hours">Later</button><button type="button" class="small ghost" data-ib="remind-dismiss" title="No reminder until it's used again">Not needed</button>`;
1247
+ body = `<p class="need-title">${esc(r.title)} <span class="hint">last used ${ago(r.since)}</span></p>
1248
+ ${r.detail ? `<p class="hint">${esc(r.detail)}</p>` : ''}
1249
+ ${it.kind === 'close'
1250
+ ? `<div class="need-actions"><button class="small primary" data-ib="remind-close">Close session</button><button class="small ghost" data-ib="terminal">Open terminal</button>${later}</div>`
1251
+ : r.closed
1252
+ ? `<div class="need-actions"><button class="small primary" data-ib="remind-resume">Resume</button>${later}</div>`
1253
+ : `<form class="need-reply col" data-ib-form="remind">
1254
+ <textarea rows="2" data-draft="${esc(it.key)}:text">${draft('text', FOLLOW_UP)}</textarea>
1255
+ <div class="need-actions"><button class="small primary">Send</button><button type="button" class="small ghost" data-ib="terminal">Open terminal</button><button type="button" class="small ghost" data-ib="remind-close">Close session</button>${later}</div>
1256
+ </form>`}`;
1205
1257
  } else if (it.kind === 'stuck') {
1206
1258
  const f = it.f;
1207
1259
  const judged = f.ai?.verdict === 'stuck' ? aiTag(f.ai.confidence, 'confirmed') : f.ai?.verdict === 'checking' ? '<span class="tag ai">🤖 checking…</span>' : '';
@@ -1355,6 +1407,14 @@ async function onNeed(e) {
1355
1407
  return act(async () => upsert(await api('POST', `/agents/${id}/conflicts/dismiss`, { with: el.dataset.with })));
1356
1408
  case 'waiting-choice':
1357
1409
  return act(async () => upsert(await api('POST', `/agents/${id}/waiting/answer`, { text: el.dataset.text })), 'Answer queued');
1410
+ case 'remind-close':
1411
+ return act(async () => upsert(await api('POST', `/agents/${id}/stop`)), 'Session closed; resume it any time');
1412
+ case 'remind-resume':
1413
+ return act(async () => upsert(await api('POST', `/agents/${id}/start`, {})), 'Resumed');
1414
+ case 'remind-later':
1415
+ return act(async () => upsert(await api('POST', `/agents/${id}/reminder`, { action: 'later' })), 'Reminding you later');
1416
+ case 'remind-dismiss':
1417
+ return act(async () => upsert(await api('POST', `/agents/${id}/reminder`, { action: 'dismiss' })));
1358
1418
  case 'waiting-dismiss':
1359
1419
  return act(async () => upsert(await api('POST', `/agents/${id}/waiting/dismiss`)));
1360
1420
  case 'review-finish':
@@ -1384,6 +1444,8 @@ async function onNeedSubmit(e) {
1384
1444
  const done = () => needDrafts.delete(field.dataset.draft);
1385
1445
  if (form.dataset.ibForm === 'waiting') {
1386
1446
  await act(async () => upsert(await api('POST', `/agents/${id}/waiting/answer`, { text })), 'Answer queued');
1447
+ } else if (form.dataset.ibForm === 'remind') {
1448
+ await act(() => api('POST', `/agents/${id}/tell`, { text }), 'Sent');
1387
1449
  } else if (form.dataset.ibForm === 'answer') {
1388
1450
  await act(async () => upsert(await api('POST', `/agents/${id}/answer`, { question: form.dataset.q, text })), 'Answer sent');
1389
1451
  } else {
@@ -3202,8 +3264,21 @@ function agentChanged(a) {
3202
3264
  sidePane?.agentChanged(a);
3203
3265
  }
3204
3266
 
3267
+ /** Close all: every open session but the assistant's; agents working right now only when you say so. */
3268
+ async function closeAll(working = false) {
3269
+ const open = [...agents.values()].filter((a) => a.runtime.running && a.kind !== 'assistant');
3270
+ const busy = open.filter((a) => a.runtime.busy).length;
3271
+ if (!working && !confirm(`Close ${open.length - busy} open session${open.length - busy === 1 ? '' : 's'}? They resume when you open them.${busy ? `\n\n${busy} working right now stay open.` : ''}`)) return;
3272
+ const r = await act(() => api('POST', '/agents/close-all', { working }));
3273
+ if (!r) return;
3274
+ const msg = `Closed ${r.closed.length} session${r.closed.length === 1 ? '' : 's'}${r.failed.length ? `; ${r.failed.length} couldn't be closed` : ''}`;
3275
+ if (r.working.length) toast(`${msg}. ${r.working.length} still working: ${r.working.map((x) => x.name).slice(0, 3).join(', ')}${r.working.length > 3 ? '…' : ''}`, 10000, { label: 'Close them too', run: () => closeAll(true) });
3276
+ else toast(msg);
3277
+ }
3278
+
3205
3279
  $('#counts').addEventListener('click', (e) => {
3206
3280
  if (e.target.id === 'import-btn') return openImport();
3281
+ if (e.target.id === 'close-all-btn') return closeAll();
3207
3282
  if (e.target.id !== 'flush-btn') return;
3208
3283
  act(async () => {
3209
3284
  const r = await api('POST', '/flush');
@@ -3478,6 +3553,13 @@ $('#filter').addEventListener('input', (e) => {
3478
3553
  renderList();
3479
3554
  });
3480
3555
 
3556
+ $('#list-order').addEventListener('change', (e) => {
3557
+ listOrder = ORDERS.includes(e.target.value) ? e.target.value : 'recent';
3558
+ try {
3559
+ localStorage.setItem('agentmgr.listOrder', listOrder);
3560
+ } catch {}
3561
+ renderList();
3562
+ });
3481
3563
  $('#recent-days').value = recent.days;
3482
3564
  $('#recent-on').addEventListener('change', (e) => {
3483
3565
  recent.on = e.target.checked;
@@ -3841,6 +3923,7 @@ function handleEvent(msg) {
3841
3923
  agents.clear();
3842
3924
  msg.agents.forEach((a) => agents.set(a.id, a));
3843
3925
  if (msg.backlog) backlogState = msg.backlog;
3926
+ if (msg.goals) goalsUi.set(msg.goals);
3844
3927
  if (msg.projects) projectsState = msg.projects;
3845
3928
  races.clear();
3846
3929
  for (const r of msg.races ?? []) races.set(r.id, r);
@@ -3890,6 +3973,8 @@ function handleEvent(msg) {
3890
3973
  builtUi.render();
3891
3974
  } else if (msg.t === 'backlog') {
3892
3975
  backlogState = msg.backlog;
3976
+ } else if (msg.t === 'goals') {
3977
+ goalsUi.set(msg.goals);
3893
3978
  } else if (msg.t === 'projects') {
3894
3979
  projectsState = msg.projects;
3895
3980
  renderProjectOptions();
@@ -0,0 +1,153 @@
1
+ // Goals (top of the Backlog tab): outcomes for today or this week across projects, planned into
2
+ // backlog tasks and seen through by agents, with completed / pending / follow-ups kept current.
3
+
4
+ const STATUS = { planning: 'planning…', review: 'plan ready', running: 'in progress', checking: 'checking the outcome…', done: 'done', stopped: 'stopped', error: "couldn't plan" };
5
+ const PERIOD = { day: 'Today', week: 'This week', none: 'No deadline' };
6
+
7
+ export function initGoals({ api, esc, toast, $, ago, getProjects, rerender }) {
8
+ let goals = [];
9
+ const openGoals = new Set(); // cards expanded in this browser session
10
+
11
+ const due = (g) => {
12
+ if (!g.due) return '';
13
+ const d = new Date(g.due);
14
+ const label = g.period === 'day' ? 'today' : `by ${d.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' })}`;
15
+ return `<span class="${g.overdue ? 'fail' : 'hint'}">${g.overdue ? `overdue (was due ${esc(d.toLocaleDateString())})` : esc(label)}</span>`;
16
+ };
17
+ const prLinks = (r) => r.prs.map((p) => `<a href="${esc(p.url)}" target="_blank" rel="noopener">#${esc(p.url.split('/').pop())}${p.state && p.state !== 'OPEN' ? ` ${esc(p.state.toLowerCase())}` : ''}</a>`).join(' ');
18
+ const row = (r, extra = '') => `<li><span class="goal-task">${esc(r.title.split('\n')[0])}</span> <span class="hint">${esc(r.project ?? '')}${r.agentId ? ` · <a href="#${esc(r.agentId)}">${esc(r.agentName ?? r.agentId)}</a>` : ''}</span> ${prLinks(r)}${extra}</li>`;
19
+
20
+ function card(g) {
21
+ const c = g.counts;
22
+ const open = openGoals.has(g.id) || g.status === 'review' || g.status === 'error';
23
+ const pct = c.total ? Math.round((c.completed / c.total) * 100) : 0;
24
+ const s = g.summary;
25
+ const body = [];
26
+ if (g.status === 'error') body.push(`<p class="error">${esc(g.error ?? '')}</p><div class="need-actions"><button class="small primary" data-goal-act="replan">Plan again</button><button class="small ghost" data-goal-act="remove">Remove</button></div>`);
27
+ if (g.status === 'review') {
28
+ body.push(`<p class="hint">The plan: one agent per task. Untick what you don't want, then start.${g.note ? ` ${esc(g.note)}` : ''}</p>
29
+ <ul class="goal-plan">${g.plan.map((t, i) => `<li><label><input type="checkbox" data-goal-task="${i}" checked> <span class="tag">${esc(t.project)}</span> ${esc(t.title)}</label></li>`).join('')}</ul>
30
+ <div class="need-actions"><button class="small primary" data-goal-act="approve">Start ${g.plan.length} agent${g.plan.length === 1 ? '' : 's'}</button><button class="small ghost" data-goal-act="replan">Plan again</button><button class="small ghost" data-goal-act="remove">Remove</button></div>`);
31
+ }
32
+ if (c.total) {
33
+ if (s.followUps.length) body.push(`<p class="goal-h fail">Follow-ups (${s.followUps.length})</p><ul class="goal-list">${s.followUps.map((r) => row(r, `<div class="hint">${esc(r.why)}</div>`)).join('')}</ul>`);
34
+ if (s.pending.length) body.push(`<p class="goal-h">Pending (${s.pending.length})</p><ul class="goal-list">${s.pending.map((r) => row(r, ` <span class="tag">${esc(r.state)}</span>`)).join('')}</ul>`);
35
+ if (s.completed.length) body.push(`<p class="goal-h">Completed (${s.completed.length})</p><ul class="goal-list">${s.completed.map((r) => row(r)).join('')}</ul>`);
36
+ }
37
+ const last = g.checks?.at(-1);
38
+ if (last) body.push(`<p class="hint">Outcome check ${last.met === false ? `found more to do (${last.tasks} task${last.tasks === 1 ? '' : 's'} added)` : last.met ? 'says it is met' : ''}${last.reason ? `: ${esc(last.reason)}` : ''}</p>`);
39
+ const actions = [
40
+ c.total ? '<button class="small ghost" data-goal-act="copy" title="Completed, pending and follow-ups as Markdown">Copy summary</button>' : '',
41
+ g.period !== 'none' && g.overdue ? `<button class="small ghost" data-goal-act="extend">Carry over to ${g.period === 'day' ? 'tomorrow' : 'next week'}</button>` : '',
42
+ ['running', 'checking', 'planning'].includes(g.status) ? '<button class="small ghost" data-goal-act="stop" title="Cancel its queued tasks; work in progress goes on">Stop</button>' : '',
43
+ ['done', 'stopped'].includes(g.status) ? '<button class="small ghost" data-goal-act="remove">Remove</button>' : '',
44
+ ].join('');
45
+ return `<li class="goal ${esc(g.status)} ${g.overdue ? 'overdue' : ''}" data-goal="${esc(g.id)}">
46
+ <button class="goal-head" data-goal-act="toggle" aria-expanded="${open}">
47
+ <span class="caret">${open ? '▾' : '▸'}</span><span class="goal-title">🎯 ${esc(g.title)}</span>
48
+ <span class="pill ${g.status === 'done' ? 'done' : g.status === 'error' ? 'error' : c.followUps ? 'attention' : 'working'}">${STATUS[g.status] ?? esc(g.status)}</span>
49
+ </button>
50
+ <div class="goal-meta">${due(g)} <span class="hint">${esc(g.projects.join(', '))}</span>
51
+ ${c.total ? `<span class="goal-bar" title="${pct}% completed"><span style="width:${pct}%"></span></span><span>${c.completed} completed · ${c.pending} pending · <span class="${c.followUps ? 'fail' : ''}">${c.followUps} follow-up${c.followUps === 1 ? '' : 's'}</span></span>` : ''}</div>
52
+ ${open ? `<div class="goal-body">${body.join('')}${actions ? `<div class="need-actions">${actions}</div>` : ''}</div>` : ''}
53
+ </li>`;
54
+ }
55
+
56
+ function html() {
57
+ const shown = goals.filter((g) => g.status !== 'done' || Date.now() - Date.parse(g.doneAt ?? 0) < 3 * 86_400_000);
58
+ return `<div class="goals">
59
+ <div class="goals-head"><b>Goals</b><span class="hint">outcomes agents work toward until they're done</span><span class="spacer"></span><button class="link" data-goal-act="new">+ Goal</button></div>
60
+ ${shown.length ? `<ul class="goal-cards">${shown.map(card).join('')}</ul>` : ''}
61
+ </div>`;
62
+ }
63
+
64
+ // New goal dialog.
65
+ const dlg = $('#goal-dialog');
66
+ const f = $('#goal-form');
67
+ function openNew() {
68
+ const projects = getProjects();
69
+ $('#goal-projects').innerHTML = projects.length
70
+ ? projects.map((p) => `<label class="goal-proj"><input type="checkbox" name="project" value="${esc(p.shortcut)}"> <span class="shortcut">${esc(p.shortcut)}</span> ${esc(p.name)}</label>`).join('')
71
+ : '<p class="hint">No projects yet: start an agent in a repo or folder first, or add one with <code>agentmgr project add</code>.</p>';
72
+ if (projects.length === 1) $('#goal-projects input').checked = true;
73
+ $('#goal-error').hidden = true;
74
+ dlg.showModal();
75
+ f.text.focus();
76
+ }
77
+ f.addEventListener('submit', async (e) => {
78
+ e.preventDefault();
79
+ const projects = [...f.querySelectorAll('input[name="project"]:checked')].map((x) => x.value);
80
+ try {
81
+ const g = await api('POST', '/goals', { text: f.text.value, period: f.period.value, projects, review: f.review.checked, priority: Number(f.priority.value) });
82
+ goals = [g, ...goals.filter((x) => x.id !== g.id)];
83
+ openGoals.add(g.id);
84
+ dlg.close();
85
+ f.text.value = '';
86
+ toast(f.review.checked ? 'Planning it; the plan shows here for you to start' : 'Planning it; agents start as tasks are queued');
87
+ rerender();
88
+ } catch (err) {
89
+ $('#goal-error').hidden = false;
90
+ $('#goal-error').textContent = err.message;
91
+ }
92
+ });
93
+ $('#goal-cancel').onclick = () => dlg.close();
94
+
95
+ async function onClick(e) {
96
+ const el = e.target.closest('[data-goal-act]');
97
+ if (!el) return false;
98
+ e.preventDefault();
99
+ const act = el.dataset.goalAct;
100
+ if (act === 'new') return openNew(), true;
101
+ const id = el.closest('[data-goal]')?.dataset.goal;
102
+ const g = goals.find((x) => x.id === id);
103
+ if (!g) return true;
104
+ const run = async (fn, msg) => {
105
+ try {
106
+ const v = await fn();
107
+ if (v?.id) goals = goals.map((x) => (x.id === v.id ? v : x));
108
+ if (msg) toast(msg);
109
+ } catch (err) {
110
+ toast(`Error: ${err.message}`, 5000);
111
+ }
112
+ rerender();
113
+ };
114
+ switch (act) {
115
+ case 'toggle':
116
+ openGoals.has(id) ? openGoals.delete(id) : openGoals.add(id);
117
+ return rerender(), true;
118
+ case 'approve': {
119
+ const keep = [...el.closest('[data-goal]').querySelectorAll('[data-goal-task]')].filter((x) => x.checked).map((x) => g.plan[Number(x.dataset.goalTask)]);
120
+ return run(() => api('POST', `/goals/${id}/approve`, { tasks: keep }), `Started ${keep.length} agent${keep.length === 1 ? '' : 's'}`), true;
121
+ }
122
+ case 'replan':
123
+ return run(() => api('POST', `/goals/${id}/replan`), 'Planning it again'), true;
124
+ case 'extend':
125
+ return run(() => api('POST', `/goals/${id}/extend`), 'Carried over'), true;
126
+ case 'stop':
127
+ if (!confirm('Stop this goal? Its queued tasks are cancelled; agents already working go on.')) return true;
128
+ return run(() => api('POST', `/goals/${id}/stop`), 'Goal stopped'), true;
129
+ case 'remove':
130
+ await run(() => api('DELETE', `/goals/${id}`));
131
+ goals = goals.filter((x) => x.id !== id);
132
+ return rerender(), true;
133
+ case 'copy':
134
+ try {
135
+ await navigator.clipboard.writeText((await api('GET', `/goals/${id}/summary`)).markdown);
136
+ toast('Summary copied (Markdown)');
137
+ } catch (err) {
138
+ toast(`Couldn't copy: ${err.message}`, 4000);
139
+ }
140
+ return true;
141
+ }
142
+ return true;
143
+ }
144
+
145
+ return {
146
+ set(list) {
147
+ goals = list ?? [];
148
+ },
149
+ html,
150
+ onClick,
151
+ count: () => goals.filter((g) => g.counts?.followUps || g.status === 'review').length,
152
+ };
153
+ }
package/public/index.html CHANGED
@@ -45,6 +45,7 @@
45
45
  <span id="me-where" class="hint"></span>
46
46
  </div>
47
47
  <button role="menuitem" id="settings-btn">Settings…</button>
48
+ <button role="menuitem" id="worklog-btn" title="What your agents got done: pull requests, bugs fixed, issues filed; kept in a spreadsheet for reviews">Work record…</button>
48
49
  <button role="menuitem" id="cleanup-btn" title="Close agents idle for a while, and delete old closed ones">Clean up…</button>
49
50
  <button role="menuitem" id="alerts-btn" class="local-only" title="Slack alerts when an agent needs you">Alerts…</button>
50
51
  <button role="menuitem" id="remote-btn" class="local-only" title="Open AI Agent Manager from your phone">Remote access…</button>
@@ -74,6 +75,11 @@
74
75
  </label>
75
76
  <input type="number" id="recent-days" min="1" max="3650" value="7" aria-label="Days"> days
76
77
  <span class="spacer"></span><span id="recent-hidden"></span>
78
+ <select id="list-order" aria-label="Order" title="Recently used: one list, the agents created or worked in most recently on top. Running first: running agents on top, most recently used first, then the rest. By project: grouped, busiest and most urgent first.">
79
+ <option value="recent">Recently used</option>
80
+ <option value="running">Running first</option>
81
+ <option value="project">By project</option>
82
+ </select>
77
83
  </div>
78
84
  <ul id="agent-list" class="agent-list" aria-label="Agents"></ul>
79
85
  </div>
@@ -688,6 +694,39 @@
688
694
  </form>
689
695
  </dialog>
690
696
 
697
+ <dialog id="goal-dialog">
698
+ <form id="goal-form" class="alerts-body">
699
+ <h2>New goal</h2>
700
+ <p class="hint">An outcome to reach, in one or more projects. It's planned into tasks, one agent each; they go to the backlog and run until the goal is done. Where a project's autopilot is on, finished work ships by itself.</p>
701
+ <label>The outcome
702
+ <textarea name="text" rows="5" required placeholder="By Friday: users can sign in with SSO on web, and the API returns paginated results for /orders. Both with tests."></textarea>
703
+ </label>
704
+ <div class="row">
705
+ <label>When <select name="period"><option value="day">Today</option><option value="week" selected>This week</option><option value="none">No deadline</option></select></label>
706
+ <label>Priority <select name="priority"><option value="0">P0</option><option value="1">P1</option><option value="2" selected>P2</option><option value="3">P3</option></select></label>
707
+ </div>
708
+ <div>Projects<div id="goal-projects" class="goal-projects"></div></div>
709
+ <label class="check"><input type="checkbox" name="review"> Show me the plan before agents start</label>
710
+ <p id="goal-error" class="error" hidden></p>
711
+ <div class="dialog-actions"><span class="spacer"></span><button type="button" id="goal-cancel" class="ghost">Cancel</button><button class="primary">Plan and start</button></div>
712
+ </form>
713
+ </dialog>
714
+
715
+ <dialog id="worklog-dialog">
716
+ <form method="dialog" class="alerts-body">
717
+ <h2>Work record <select id="worklog-days" class="inline-select"><option value="7">last 7 days</option><option value="30" selected>last 30 days</option><option value="90">last 90 days</option><option value="365">last year</option><option value="0">all time</option></select></h2>
718
+ <div id="worklog-body"></div>
719
+ <p id="worklog-files" class="hint"></p>
720
+ <div class="dialog-actions">
721
+ <button type="button" id="worklog-copy" title="The period's totals and what was merged, fixed and filed, with links, as Markdown for a review or status update">Copy summary</button>
722
+ <button type="button" id="worklog-csv" class="ghost">Download events</button>
723
+ <button type="button" id="worklog-weekly" class="ghost">Download weekly</button>
724
+ <span class="spacer"></span>
725
+ <button type="button" id="worklog-close" class="ghost">Close</button>
726
+ </div>
727
+ </form>
728
+ </dialog>
729
+
691
730
  <dialog id="cleanup-dialog">
692
731
  <form id="cleanup-form" method="dialog" class="alerts-body">
693
732
  <h2>Clean up old agents</h2>