Public Beta
Not set

Experience

Changes how pages explain things, never what you can do.

More

Experience

Changes how pages explain things, never what you can do.

Sign inGet started

Personal Productivity v0.1.2 · claude-code

Archive SHA-256 e8d3540943d7825ebf9fbcdc07e4356e0ae330a2c115ce852a22866256c87eab · 39.4 KB · built Nov 27, 2026

src/review.js

// Daily and weekly review checklists built from the user's tasks plus fixed review prompts.
import { parseYmd } from "./tz.js";
import { describeTask, md } from "./tasks.js";

const DAILY_PROMPTS = [
  "Check today's calendar and commitments",
  "Pick the one task that matters most today",
  "Process inboxes (email, notes, chat) to zero or to a list",
  "Time-block the top tasks (plan_time_blocks)",
  "End of day: tick off finished tasks and move unfinished ones",
];
const WEEKLY_PROMPTS = [
  "Collect loose notes, papers and voice memos into your task list",
  "Empty inboxes",
  "Review last week's calendar for follow-ups",
  "Review the next two weeks of calendar",
  "Review each project: is there a next action?",
  "Review waiting-for items and nudge where needed",
  "Review someday/maybe items: promote, keep or drop",
  "Choose the top three outcomes for next week",
];

export function buildReview(kind, tasks, quadrants, todayDay, today, maxItems = 10) {
  const open = tasks.filter((t) => !t.done);
  const dueDay = (t) => (t.due ? parseYmd(t.due) : null);
  const sections = [];
  const add = (title, list, describe = describeTask) => {
    sections.push({ title, items: list.slice(0, maxItems).map(describe), total: list.length });
  };
  const byDue = (a, b) => (a.due ?? "9999").localeCompare(b.due ?? "9999");
  const overdue = open.filter((t) => dueDay(t) !== null && dueDay(t) < todayDay).sort(byDue);
  const unsortedIds = new Set(quadrants.unsorted.map((t) => t.id));
  if (kind === "daily") {
    add("Overdue", overdue);
    add("Due today", open.filter((t) => dueDay(t) === todayDay));
    add("Do first (urgent and important)", quadrants.do.slice(0, 3));
    add("Inbox: unsorted tasks to clarify", open.filter((t) => unsortedIds.has(t.id)));
    sections.push({ title: "Daily prompts", items: DAILY_PROMPTS, total: DAILY_PROMPTS.length });
  } else {
    const weekStart = todayDay - 6;
    // Cancelled tasks ("- [-]") are closed but not completed, so they never count as done work.
    const completed = tasks.filter((t) => t.done && !(t.tags ?? []).includes("cancelled"));
    const doneDated = completed.filter((t) => t.done_date && parseYmd(t.done_date) >= weekStart && parseYmd(t.done_date) <= todayDay);
    const doneUndated = completed.filter((t) => !t.done_date);
    add("Completed in the last 7 days", doneDated);
    if (doneUndated.length) sections.push({ title: "Done without a completion date", items: [`${doneUndated.length} done task(s) have no completion date (add done:YYYY-MM-DD) and cannot be placed in a week`], total: doneUndated.length });
    add("Overdue", overdue);
    add("Due in the next 7 days", open.filter((t) => dueDay(t) !== null && dueDay(t) >= todayDay && dueDay(t) <= todayDay + 7).sort(byDue));
    // Tasks you tagged #waiting/#delegate are already with someone else; delegate-quadrant tasks are
    // only candidates (urgent, not important) that you could hand off, so they get their own section.
    add("Waiting for / delegated", open.filter((t) => t.waiting));
    add("Delegate candidates (urgent, not important)", quadrants.delegate.map((q) => open.find((t) => t.id === q.id)).filter((t) => t && !t.waiting));
    add("High priority without a due date (give it a date)", open.filter((t) => t.priority === "high" && !t.due));
    add("Someday / unsorted", open.filter((t) => unsortedIds.has(t.id)));
    sections.push({ title: "Weekly prompts", items: WEEKLY_PROMPTS, total: WEEKLY_PROMPTS.length });
  }
  const lines = [`# ${kind === "daily" ? "Daily" : "Weekly"} review: ${today}`];
  for (const s of sections) {
    lines.push("", `## ${md(s.title)}`, "");
    if (!s.items.length) lines.push("_Nothing here._");
    const box = s.title === "Completed in the last 7 days" ? "[x]" : "[ ]";
    for (const it of s.items) lines.push(`- ${box} ${it}`);
    if (s.total > s.items.length) lines.push(`- _and ${s.total - s.items.length} more_`);
  }
  return { sections, markdown: lines.join("\n") + "\n" };
}

Find an agent

Do not include passwords, keys, customer data or other confidential details.
Rule-based matching is free during the public beta (fair use).