Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

Island and Settings: publish last week's recap to the phone, and the switch for it

Claude326ddef61fd0
diff --git a/windows/src/core/bridge.ts b/windows/src/core/bridge.ts
index 848daecf..20f79299 100644
--- a/windows/src/core/bridge.ts
+++ b/windows/src/core/bridge.ts
@@ -136,6 +136,25 @@ export interface PhoneLinkUsage {
codex: PhoneLinkPlan | null;
}
+/**
+ * Last week's recap as the phone gets it: counts, the week's Monday and the busiest agent's name (cap `recap`). The project is a folder name that
+ * Rust sends only to a phone that also may see session details. A week with no session is not sent: all zero clears the phone's card.
+ */
+export interface PhoneLinkRecap {
+ /** The Monday that starts the week, YYYY-MM-DD (local). */
+ week: string;
+ minutes: number;
+ sessions: number;
+ files: number;
+ linesAdded: number;
+ linesRemoved: number;
+ commands: number;
+ allowed: number;
+ denied: number;
+ topAgent?: string;
+ topProject?: string;
+}
+
/** What one service pill says, for a phone whose user allowed it (Rust cuts every text to size). */
export interface PhoneLinkService {
id: string;
@@ -154,6 +173,10 @@ export interface PhoneUsageStatus {
enabled: boolean;
}
+export interface PhoneRecapStatus {
+ enabled: boolean;
+}
+
export interface PhoneDiffsStatus {
enabled: boolean;
}
@@ -315,6 +338,9 @@ export const Bridge = {
/** Off by default; only from the switch in Settings. Phones are reconnected so they learn about it. */
phoneUsageSetEnabled: (enabled: boolean) => callOrThrow<PhoneUsageStatus>("phone_usage_set_enabled", { enabled }),
phoneLinkPublishUsage: (usage: PhoneLinkUsage) => call<void>("phone_link_publish_usage", { usage }),
+ phoneRecapStatus: () => call<PhoneRecapStatus>("phone_recap_status"),
+ phoneRecapSetEnabled: (enabled: boolean) => callOrThrow<PhoneRecapStatus>("phone_recap_set_enabled", { enabled }),
+ phoneLinkPublishRecap: (recap: PhoneLinkRecap | null) => call<void>("phone_link_publish_recap", { recap: recap ?? {} }),
phoneChatStatus: () => call<PhoneChatStatus>("phone_chat_status"),
/** Off by default; only from the switch in Settings. Phones are reconnected so they learn about it. */
phoneChatSetEnabled: (enabled: boolean) => callOrThrow<PhoneChatStatus>("phone_chat_set_enabled", { enabled }),
diff --git a/windows/src/i18n/extra.json b/windows/src/i18n/extra.json
index 9ba0b6ab..11a0787c 100644
--- a/windows/src/i18n/extra.json
+++ b/windows/src/i18n/extra.json
@@ -3669,6 +3669,28 @@
"ru": "Телефон показывает, какая часть ваших тарифов Claude и Codex использована и когда они сбросятся: те же проценты, что и на плашках здесь, и ничего больше.",
"id": "Ponsel menampilkan seberapa banyak paket Claude dan Codex Anda terpakai dan kapan direset: persentase yang sama dengan pil di sini, tidak ada yang lain."
},
+ "Show my weekly recap on the phone": {
+ "zh-Hans": "在手机上显示我的每周回顾",
+ "hi": "फ़ोन पर मेरा साप्ताहिक सारांश दिखाएँ",
+ "es": "Mostrar en el teléfono mi resumen semanal",
+ "ar": "عرض ملخصي الأسبوعي على الهاتف",
+ "fr": "Afficher sur le téléphone mon récap de la semaine",
+ "bn": "ফোনে আমার সাপ্তাহিক সারাংশ দেখান",
+ "pt-BR": "Mostrar no celular meu resumo semanal",
+ "ru": "Показывать на телефоне мой итог недели",
+ "id": "Tampilkan rekap mingguan saya di ponsel"
+ },
+ "The phone shows last week's recap: time coding, sessions, files, lines, commands, permissions and the agent you used most. Counts only. The project's name is added only if you also show session details.": {
+ "zh-Hans": "手机会显示上周的回顾:编程时长、会话、文件、行数、命令、权限,以及您用得最多的代理。只有数字。只有在您同时开启会话详情时,才会加上项目名称。",
+ "hi": "फ़ोन पिछले सप्ताह का सारांश दिखाता है: कोडिंग का समय, सत्र, फ़ाइलें, लाइनें, कमांड, अनुमतियाँ और वह एजेंट जिसे आपने सबसे ज़्यादा इस्तेमाल किया। सिर्फ़ गिनती। प्रोजेक्ट का नाम तभी जुड़ता है जब आप सत्र का विवरण भी दिखाते हैं।",
+ "es": "El teléfono muestra el resumen de la semana pasada: tiempo programando, sesiones, archivos, líneas, comandos, permisos y el agente que más usaste. Solo cifras. El nombre del proyecto se añade únicamente si también muestras los detalles de las sesiones.",
+ "ar": "يعرض الهاتف ملخص الأسبوع الماضي: وقت البرمجة والجلسات والملفات والأسطر والأوامر والأذونات والوكيل الأكثر استخدامًا. أعداد فقط. لا يُضاف اسم المشروع إلا إذا كنت تعرض تفاصيل الجلسات أيضًا.",
+ "fr": "Le téléphone montre le récap de la semaine dernière : temps passé à coder, sessions, fichiers, lignes, commandes, autorisations et l'agent le plus utilisé. Des chiffres uniquement. Le nom du projet n'est ajouté que si vous affichez aussi les détails des sessions.",
+ "bn": "ফোন গত সপ্তাহের সারাংশ দেখায়: কোডিংয়ের সময়, সেশন, ফাইল, লাইন, কমান্ড, অনুমতি এবং আপনি যে এজেন্ট সবচেয়ে বেশি ব্যবহার করেছেন। শুধু সংখ্যা। সেশনের বিবরণও দেখালে তবেই প্রজেক্টের নাম যোগ হয়।",
+ "pt-BR": "O celular mostra o resumo da semana passada: tempo programando, sessões, arquivos, linhas, comandos, permissões e o agente que você mais usou. Só números. O nome do projeto só é incluído se você também mostrar os detalhes das sessões.",
+ "ru": "Телефон показывает итог прошлой недели: время за кодом, сессии, файлы, строки, команды, разрешения и самого частого агента. Только числа. Название проекта добавляется, только если вы также показываете сведения о сессиях.",
+ "id": "Ponsel menampilkan rekap minggu lalu: waktu coding, sesi, berkas, baris, perintah, izin, dan agen yang paling sering dipakai. Hanya angka. Nama proyek baru ditambahkan jika Anda juga menampilkan detail sesi."
+ },
"Payment failed": {
"zh-Hans": "付款失败",
"hi": "भुगतान विफल",
diff --git a/windows/src/island/phone-link.ts b/windows/src/island/phone-link.ts
index 840603bc..4f0a5a1f 100644
--- a/windows/src/island/phone-link.ts
+++ b/windows/src/island/phone-link.ts
@@ -11,6 +11,8 @@ import { fileName, parseDiffStep, type FileDiff } from "../core/diff";
import type { PlanUsage, CodexPlanUsage } from "../core/plan";
import { State } from "../core/state";
import { parseOutfit } from "../mochi/wardrobe";
+import { recapForPhone, recapWeekKey } from "../recap/phone";
+import { previousWeekStart } from "../recap/summary";
import { dropPendingCard } from "./hooks";
import { serviceCards } from "./phone-services";
import type { Island } from "./island";
@@ -145,6 +147,8 @@ export function registerPhoneLink(island: Island): () => void {
let lastUsage = "";
/** The service cards last sent, as JSON; "" before anything was. */
let lastServices = "";
+ /** The week whose recap was last sent (or checked while the switch was off); "" before anything was. */
+ let lastRecapWeek = "";
let timer: number | null = null;
const publish = () => {
@@ -152,6 +156,7 @@ export function registerPhoneLink(island: Island): () => void {
publishQuestion();
publishOutfit();
publishUsage();
+ publishRecap();
publishServices();
const snapshot = linkSnapshot();
const key = JSON.stringify(snapshot);
@@ -182,6 +187,23 @@ export function registerPhoneLink(island: Island): () => void {
void Bridge.phoneLinkPublishUsage(usage);
};
+ /**
+ * Last week's recap, for phones whose user turned it on. Worked out once per week (and again when a setting changes), not on every burst: a
+ * completed week does not change. With the switch off nothing is read, and the hub is told there is nothing to hold.
+ */
+ const publishRecap = () => {
+ const now = new Date();
+ const week = recapWeekKey(now);
+ if (week === lastRecapWeek) return;
+ lastRecapWeek = week;
+ void (async () => {
+ const on = (await Bridge.phoneRecapStatus())?.enabled === true;
+ const history = on ? await Bridge.recapHistory(previousWeekStart(now).getTime() / 1000) : null;
+ if (!running) return;
+ await Bridge.phoneLinkPublishRecap(on ? recapForPhone(history, now) : null);
+ })();
+ };
+
const publishServices = () => {
const cards = serviceCards();
const key = JSON.stringify(cards);
@@ -205,6 +227,7 @@ export function registerPhoneLink(island: Island): () => void {
lastOutfit = "";
lastUsage = "";
lastServices = "";
+ lastRecapWeek = "";
if (running) schedule();
else if (timer != null) {
window.clearTimeout(timer);
@@ -214,7 +237,12 @@ export function registerPhoneLink(island: Island): () => void {
const unsubscribe = State.subscribe(schedule);
// Turning the link on or off in Settings reaches the island as settings-changed.
- void onEvent("settings-changed", () => void refresh());
+ void onEvent("settings-changed", () => {
+ // The recap switch is one of the settings: read it again at the next picture.
+ lastRecapWeek = "";
+ if (running) schedule();
+ void refresh();
+ });
// The phone answered: Rust has already told the agent; the card goes.
void onEvent<string>("phone-link-decided", (requestId) => {
if (State.pendingApproval?.requestId === requestId) dropPendingCard(island);
diff --git a/windows/src/recap/phone.ts b/windows/src/recap/phone.ts
new file mode 100644
index 00000000..83cc9c53
--- /dev/null
+++ b/windows/src/recap/phone.ts
@@ -0,0 +1,35 @@
+// The weekly recap as the phone gets it (cap `recap`, docs/ANDROID_LINK.md): the numbers of the last completed week and the busiest agent's
+// name. Pure: no DOM, no Tauri; tests/phone-recap.test.mjs runs it as it is. The week is the same one the recap card on the island shows.
+
+import type { PhoneLinkRecap } from "../core/bridge";
+import { dayKey, previousWeekStart, summarize, type RecapHistory } from "./summary";
+
+/**
+ * Last week's numbers for the phone, or null when the week had no session (the phone then shows no recap). `hideProjects` (the recap's own
+ * privacy choice) keeps the project out; Rust adds it for a phone only if that phone may see session details.
+ */
+export function recapForPhone(history: RecapHistory | null | undefined, now: Date): PhoneLinkRecap | null {
+ if (!history) return null;
+ const start = previousWeekStart(now);
+ const week = summarize(history, start);
+ if (!week) return null;
+ const recap: PhoneLinkRecap = {
+ week: dayKey(start),
+ minutes: week.totalMinutes,
+ sessions: week.sessionCount,
+ files: week.filesChanged,
+ linesAdded: week.linesAdded,
+ linesRemoved: week.linesRemoved,
+ commands: week.commandsRun,
+ allowed: week.permissionsAllowed,
+ denied: week.permissionsDenied,
+ };
+ if (week.topAgent) recap.topAgent = week.topAgent;
+ if (week.topProject && !history.prefs?.hideProjects) recap.topProject = week.topProject;
+ return recap;
+}
+
+/** The key of the week the phone is told about: it changes on Monday, and only then is a new recap worth computing. */
+export function recapWeekKey(now: Date): string {
+ return dayKey(previousWeekStart(now));
+}
diff --git a/windows/src/settings/phone.ts b/windows/src/settings/phone.ts
index 14b219cd..f94a4070 100644
--- a/windows/src/settings/phone.ts
+++ b/windows/src/settings/phone.ts
@@ -69,6 +69,7 @@ export function phoneSection(on: boolean, makeToggle: Toggle, settings: Settings
answersBlock(makeToggle),
diffsBlock(makeToggle),
usageBlock(makeToggle),
+ recapBlock(makeToggle),
servicesBlock(),
chatBlock(makeToggle, settings),
);
@@ -345,6 +346,39 @@ function usageBlock(makeToggle: Toggle): HTMLElement {
);
}
+/**
+ * Last week's recap on the phone: off until the user turns it on. Only counts (minutes, sessions, files, lines, commands, permissions) and the
+ * name of the busiest agent; the project's folder name only reaches a phone that also shows session details. Rust re-reads this switch for every
+ * connection.
+ */
+function recapBlock(makeToggle: Toggle): HTMLElement {
+ const note = h("div", { class: "hint" });
+ const switchEl = makeToggle(false, (next) => {
+ void (async () => {
+ note.textContent = "";
+ try {
+ await Bridge.phoneRecapSetEnabled(next);
+ } catch (err) {
+ switchEl.classList.remove("on");
+ switchEl.setAttribute("aria-pressed", "false");
+ note.textContent = String(err);
+ }
+ })();
+ });
+ void Bridge.phoneRecapStatus().then((status) => {
+ if (!status) return;
+ switchEl.classList.toggle("on", status.enabled);
+ switchEl.setAttribute("aria-pressed", String(status.enabled));
+ });
+ return h(
+ "div",
+ {},
+ h("div", { class: "row" }, h("label", { text: t("Show my weekly recap on the phone") }), switchEl),
+ h("div", { class: "hint", text: t("The phone shows last week's recap: time coding, sessions, files, lines, commands, permissions and the agent you used most. Counts only. The project's name is added only if you also show session details.") }),
+ note,
+ );
+}
+
/**
* The files an agent changed, on the phone: off until the user turns it on. The list (names and counts) rides on the
* session; the lines of a file are sent only when the phone asks for that file. Rust re-reads this for every connection.
diff --git a/windows/tests/phone-link.test.mjs b/windows/tests/phone-link.test.mjs
index e98e2327..b3464f92 100644
--- a/windows/tests/phone-link.test.mjs
+++ b/windows/tests/phone-link.test.mjs
@@ -8,12 +8,23 @@ import { calls, emit, internals, sent } from "./tauri.mjs";
import { bareCommand, folderName, linkSnapshot, registerPhoneLink } from "../src/island/phone-link.ts";
import { makeDiffStep } from "../src/core/diff.ts";
import { DEFAULT_SETTINGS, State } from "../src/core/state.ts";
+import { previousWeekStart, sampleHistory, summarize } from "../src/recap/summary.ts";
const CLAUDE = "integration_claude";
let status = { enabled: true, running: true, port: 47821, host: "192.168.1.2", name: "PC", clients: 0, error: null };
const original = internals.invoke;
-internals.invoke = async (cmd, args) => (cmd === "phone_link_status" ? status : original(cmd, args));
+let recapOn = false;
+let recapHistory = null;
+internals.invoke = async (cmd, args) => {
+ if (cmd === "phone_link_status") return status;
+ if (cmd === "phone_recap_status") return { enabled: recapOn };
+ if (cmd === "recap_history") {
+ await original(cmd, args); // recorded like any other command
+ return recapHistory;
+ }
+ return original(cmd, args);
+};
let asked;
let dispose = () => {};
@@ -31,6 +42,8 @@ beforeEach(() => {
asked = [];
calls.length = 0;
status = { ...status, running: true };
+ recapOn = false;
+ recapHistory = null;
State.tasks = [];
State.focusId = null;
State.pendingApproval = null;
@@ -437,3 +450,71 @@ test("service cards are published when the link comes up and when they change, a
assert.equal(p().length, 2);
for (const id of Object.keys(State.integrations)) delete State.integrations[id];
});
+
+// ── Last week's recap (cap `recap`) ───────────────────────────────────────────
+
+test("last week's recap goes out once, as counts, when the switch is on", async () => {
+ recapOn = true;
+ recapHistory = sampleHistory(previousWeekStart(new Date()));
+ dispose = registerPhoneLink(island);
+ await settle();
+ tick(250);
+ await settle();
+ const p = () => sent("phone_link_publish_recap");
+ assert.equal(p().length, 1);
+ const r = p()[0].recap;
+ assert.equal(r.sessions, 6);
+ assert.equal(r.minutes, summarize(recapHistory, previousWeekStart(new Date())).totalMinutes);
+ assert.ok(r.minutes > 0);
+ assert.equal(r.allowed, 4);
+ assert.equal(r.denied, 1);
+ assert.equal(r.topAgent, "Claude Code");
+ assert.deepEqual(
+ Object.keys(r).sort(),
+ ["allowed", "commands", "denied", "files", "linesAdded", "linesRemoved", "minutes", "sessions", "topAgent", "topProject", "week"],
+ );
+ assert.match(r.week, /^\d{4}-\d{2}-\d{2}$/);
+
+ State.notify(); // another burst: a completed week has not changed
+ tick(250);
+ await settle();
+ assert.equal(p().length, 1, "not worked out again until the week changes or a setting does");
+ assert.equal(sent("recap_history").length, 1);
+});
+
+test("with the switch off the history is not even read, and the hub is told there is nothing", async () => {
+ recapOn = false;
+ recapHistory = sampleHistory(previousWeekStart(new Date()));
+ dispose = registerPhoneLink(island);
+ await settle();
+ tick(250);
+ await settle();
+ assert.equal(sent("recap_history").length, 0);
+ assert.deepEqual(sent("phone_link_publish_recap"), [{ recap: {} }]);
+});
+
+test("turning the switch on or off in Settings is picked up at the next picture", async () => {
+ dispose = registerPhoneLink(island);
+ await settle();
+ tick(250);
+ await settle();
+ assert.equal(sent("phone_link_publish_recap").length, 1);
+ recapOn = true;
+ recapHistory = sampleHistory(previousWeekStart(new Date()));
+ emit("settings-changed", {});
+ await settle();
+ tick(250);
+ await settle();
+ assert.equal(sent("phone_link_publish_recap").length, 2);
+ assert.equal(sent("phone_link_publish_recap")[1].recap.sessions, 6);
+});
+
+test("a week with no session publishes nothing to show", async () => {
+ recapOn = true;
+ recapHistory = { turns: [], decisions: [], prefs: { enabled: true, hideProjects: false, lastShownWeek: "" } };
+ dispose = registerPhoneLink(island);
+ await settle();
+ tick(250);
+ await settle();
+ assert.deepEqual(sent("phone_link_publish_recap"), [{ recap: {} }]);
+});
diff --git a/windows/tests/phone-recap.test.mjs b/windows/tests/phone-recap.test.mjs
new file mode 100644
index 00000000..3f648945
--- /dev/null
+++ b/windows/tests/phone-recap.test.mjs
@@ -0,0 +1,60 @@
+// The weekly recap as the phone gets it (src/recap/phone.ts): the numbers of the last completed week, the busiest agent's name, and nothing
+// that names a file or a command.
+
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { recapForPhone, recapWeekKey } from "../src/recap/phone.ts";
+import { addDays, dayKey, mondayOf, previousWeekStart, sampleHistory, summarize } from "../src/recap/summary.ts";
+
+const MONDAY = new Date(2026, 9, 5); // Monday 5 October 2026, local time
+const NEXT_WEEK = new Date(2026, 9, 12, 10, 30); // the Monday after, 10:30
+
+test("the recap is last completed week's numbers", () => {
+ const history = sampleHistory(MONDAY);
+ const r = recapForPhone(history, NEXT_WEEK);
+ const week = summarize(history, MONDAY);
+ assert.equal(r.week, "2026-10-05");
+ assert.equal(r.minutes, week.totalMinutes);
+ assert.equal(r.sessions, week.sessionCount);
+ assert.equal(r.files, week.filesChanged);
+ assert.equal(r.linesAdded, week.linesAdded);
+ assert.equal(r.linesRemoved, week.linesRemoved);
+ assert.equal(r.commands, week.commandsRun);
+ assert.equal(r.allowed, 4);
+ assert.equal(r.denied, 1);
+ assert.equal(r.topAgent, "Claude Code");
+ assert.equal(r.topProject, "coucou");
+});
+
+test("the recap is the same all week long and changes on Monday", () => {
+ const wednesday = addDays(NEXT_WEEK, 2);
+ assert.equal(recapWeekKey(NEXT_WEEK), recapWeekKey(wednesday));
+ assert.equal(recapWeekKey(NEXT_WEEK), "2026-10-05");
+ assert.notEqual(recapWeekKey(NEXT_WEEK), recapWeekKey(addDays(NEXT_WEEK, 7)));
+ assert.equal(recapWeekKey(new Date(2026, 9, 11, 23, 59)), "2026-09-28", "Sunday night is still the week before");
+ assert.equal(dayKey(previousWeekStart(NEXT_WEEK)), recapWeekKey(NEXT_WEEK));
+});
+
+test("a week with no session has no recap", () => {
+ assert.equal(recapForPhone(sampleHistory(MONDAY), addDays(NEXT_WEEK, 14)), null);
+ assert.equal(recapForPhone({ turns: [], decisions: [], prefs: { enabled: true, hideProjects: false, lastShownWeek: "" } }, NEXT_WEEK), null);
+ assert.equal(recapForPhone(null, NEXT_WEEK), null);
+ assert.equal(recapForPhone(undefined, NEXT_WEEK), null);
+});
+
+test("hiding project names in the recap keeps the project out of what the phone gets", () => {
+ const history = sampleHistory(MONDAY);
+ history.prefs.hideProjects = true;
+ const r = recapForPhone(history, NEXT_WEEK);
+ assert.equal(r.topProject, undefined);
+ assert.equal(r.topAgent, "Claude Code");
+});
+
+test("nothing but counts, a date and two names is published", () => {
+ const r = recapForPhone(sampleHistory(MONDAY), NEXT_WEEK);
+ for (const [key, value] of Object.entries(r)) {
+ if (key === "week" || key === "topAgent" || key === "topProject") assert.equal(typeof value, "string", key);
+ else assert.ok(Number.isInteger(value) && value >= 0, key);
+ }
+ assert.equal(mondayOf(NEXT_WEEK).getDay(), 1);
+});