Skip to content

armgit / cogit

Public Imported from GitHub
0

Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.

feat(captures): gather what the sessions left open from the record

Eren6d7816724ec6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa79866..beecf91 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+### Added
+- Captured work: `cogit captures` and the map's **Captured** list gather what the sessions left open — each session's pending items and each branch summary's open line — with the source message, who recorded it and how old it is; items waiting for you come first. Read-only and derived from the record; cogit keeps no planning state.
## [0.26.0] - 2026-10-31
### Removed
diff --git a/README.md b/README.md
index 8b70d25..53925bf 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,8 @@ Claude Code today.
- **Intent, Shape, Code**: a message that landed commits shows why it happened, a small
picture of what the change does (a diagram, a before/after or interface table, an example
or plain steps), and the diff, in one place.
+- **Captured work**: what the sessions left open — pending items and open branch lines —
+ gathered from the record into one read-only list (`cogit captures`, and on the map).
- **Pull request descriptions with the decisions**: `cogit pr` writes the goal, the
decisions and the rejected options, never the raw chat.
- **Teams share the record through git**: after a pull, your teammates' sessions are on the
diff --git a/docs/guide/map.md b/docs/guide/map.md
index 368d702..7274319 100644
--- a/docs/guide/map.md
+++ b/docs/guide/map.md
@@ -124,6 +124,23 @@ The Files view lists every file a recorded message touched, most recently first,
count. Opening a file lists the messages that changed it; opening one of those jumps to it on
the map. In the terminal: `cogit log --file <path>` and `cogit why <path>`.
+## Captured work
+
+Working with an agent is improvised: things that would have been a plan's items get done,
+half-done or dropped along the way. The **Captured** button lists what the sessions left open,
+gathered from the record: each session's pending items and each branch summary's open line,
+with the session, the message that named it, who recorded it and when. Items waiting for you
+come first and are marked "your call"; clicking a row opens its message on the map. In the
+terminal: `cogit captures` (`--session <id>`, `--json`).
+
+It is not a task board. The list is derived from the record on every build and cannot be
+edited: no checkboxes, no status, no assignee. cogit keeps no planning state; what becomes a
+real piece of work, and who owns it, is decided in your team's own tracker. The same text in two
+sessions stays two rows, because where it came from is the point.
+
+Known limit: when the agent removes a pending item from its record, it leaves the list too; the
+record keeps no history of pending items.
+
## Search
The search box in the top bar (Ctrl+F or Cmd+F) finds text in message titles, decisions,
diff --git a/docs/guide/reading-the-lineage.md b/docs/guide/reading-the-lineage.md
index 576f0f9..0285f2b 100644
--- a/docs/guide/reading-the-lineage.md
+++ b/docs/guide/reading-the-lineage.md
@@ -14,10 +14,11 @@ cogit why src/auth.ts # what earlier messages decided about this file, a
cogit why src/auth.ts:42 # only the thought behind line 42
cogit why src/auth.ts --line 42 # the same lookup
cogit search "refresh token" # titles, decisions, summaries and the stored conversation
+cogit captures # what the sessions left open (pending items, open branch lines)
```
-`log` and `search` take `-n <count>` and `--session <id>`; `log`, `show` and `search` take
-`--json`; `show --no-chat` leaves out the conversation turn.
+`log` and `search` take `-n <count>` and `--session <id>`; `captures` takes `--session <id>`
+too; `log`, `show`, `search` and `captures` take `--json`; `show --no-chat` leaves out the conversation turn.
## Addressing a message
diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts
index d49b5ce..6f73be3 100644
--- a/packages/cli/src/commands/build.ts
+++ b/packages/cli/src/commands/build.ts
@@ -36,6 +36,7 @@ import { projectPaths } from "../store/paths.js";
import { resolveProjectRoot } from "../store/root.js";
import { loadAllSessions, loadConfig, loadProject } from "../store/stores.js";
import { attachThoughtTrailers, earliestSessionStart, readThoughtTrailers } from "../thought.js";
+import { buildCaptures } from "../view/captures.js";
import { attachChanges } from "../view/change.js";
import { buildFileHistory, modelSessions } from "../view/files.js";
import { buildViewModel, embedViewModel, markBuiltBy } from "../view/lineage.js";
@@ -377,6 +378,8 @@ export async function buildProject(opts: BuildOptions): Promise<LineageViewModel
// The files view (8.15) unions each message's own files with the files of
// its commits, so a message the agent listed no paths for still lands.
built.files = buildFileHistory(modelSessions(built), commits.files);
+ // Story 14.1: what the sessions left open, read from the same records.
+ built.captures = buildCaptures(built.sessions);
// The skill already avoids secrets; this is the safety net before rendering.
const redacted = redactDeep(built);
if (redacted.count > 0)
diff --git a/packages/cli/src/commands/captures.ts b/packages/cli/src/commands/captures.ts
new file mode 100644
index 0000000..dae9a04
--- /dev/null
+++ b/packages/cli/src/commands/captures.ts
@@ -0,0 +1,64 @@
+import type { Io } from "../io.js";
+import { buildCaptures } from "../view/captures.js";
+import { timeSince } from "../view/inbox.js";
+import type { ViewCapture } from "../view/model.js";
+import { loadEffectiveSessions, openProject, selectSessions } from "./log.js";
+
+/**
+ * `cogit captures [dir]` (Story 14.1): what the sessions left open, gathered
+ * from the records — the same rows the map's Captured list shows. Read-only:
+ * cogit keeps no planning state, so there is nothing to tick off here.
+ */
+
+export interface CapturesOptions {
+ dir: string;
+ io: Io;
+ /** Only this session (id or unambiguous prefix). */
+ session?: string | undefined;
+ json?: boolean | undefined;
+ /** The reference time for "how old"; tests pin it. */
+ now?: string | undefined;
+}
+
+function oneLine(text: string): string {
+ return text.replace(/\s+/g, " ").trim();
+}
+
+/** One line per row: the text, then where it came from, who and how old. */
+export function formatCaptures(rows: readonly ViewCapture[], now: string): string[] {
+ if (rows.length === 0) return ["No captured work in this project."];
+ return rows.map((row) => {
+ const marker = row.needsUser ? "! " : " ";
+ const source = row.label === undefined ? row.sessionId : `${row.sessionId} ${row.label}`;
+ const age = timeSince(row.updatedAt, now);
+ const meta = [source, row.author, age === "" ? undefined : `${age} ago`]
+ .filter((part) => part !== undefined)
+ .join(" · ");
+ return `${marker}${oneLine(row.text)} (${meta})`;
+ });
+}
+
+/** `cogit captures`; returns the rows for tests and JSON callers. */
+export async function captures(opts: CapturesOptions): Promise<ViewCapture[]> {
+ const root = await openProject(opts.dir);
+ const sessions = await loadEffectiveSessions(root, opts.io);
+ const selected = opts.session === undefined ? sessions : selectSessions(sessions, opts.session);
+ const rows = buildCaptures(
+ selected.map(({ session, messages }) => ({
+ sessionId: session.sessionId,
+ title: session.title,
+ author: session.author,
+ authorEmail: session.authorEmail,
+ updatedAt: session.updatedAt,
+ status: session.status,
+ messages,
+ })),
+ );
+ if (opts.json === true) {
+ opts.io.out(JSON.stringify(rows, null, 2));
+ return rows;
+ }
+ for (const line of formatCaptures(rows, opts.now ?? new Date().toISOString())) opts.io.out(line);
+ if (rows.some((row) => row.needsUser)) opts.io.out("! = waiting for you");
+ return rows;
+}
diff --git a/packages/cli/src/program.ts b/packages/cli/src/program.ts
index 536aa59..e6e49e6 100644
--- a/packages/cli/src/program.ts
+++ b/packages/cli/src/program.ts
@@ -3,6 +3,7 @@ import pkg from "../package.json" with { type: "json" };
import { backfillTail } from "./commands/backfill.js";
import { blame } from "./commands/blame.js";
import { buildProject } from "./commands/build.js";
+import { captures } from "./commands/captures.js";
import {
configGet,
configGit,
@@ -197,6 +198,26 @@ export function createProgram(makeIo: IoFactory = processIo, deps: ProgramDeps =
),
);
+ program
+ .command("captures")
+ .description("list what the sessions left open, gathered from the record (not a plan)")
+ .helpGroup("Read:")
+ .argument("[dir]", "project directory", ".")
+ .option("-C, --dir <dir>", "project directory (same as the positional)")
+ .option("--session <id>", "only this session (id or prefix)")
+ .option("--json", "print JSON instead of text")
+ .addHelpText("after", examples("cogit captures", "cogit captures --session 9c32ab18"))
+ .action(
+ run(async (dir: string, opts: { dir?: string; session?: string; json?: boolean }) => {
+ await captures({
+ dir: opts.dir ?? dir,
+ io: makeIo(false),
+ session: opts.session,
+ json: opts.json === true,
+ });
+ }),
+ );
+
program
.command("search")
.description("find recorded messages, branch summaries and conversation text")
diff --git a/packages/cli/src/view/captures.ts b/packages/cli/src/view/captures.ts
new file mode 100644
index 0000000..3393875
--- /dev/null
+++ b/packages/cli/src/view/captures.ts
@@ -0,0 +1,91 @@
+import type { ViewCapture, ViewNode, ViewPendingItem } from "./model.js";
+import { personLabel } from "./people.js";
+
+/**
+ * Captured work (Story 14.1): what the sessions left open, gathered from the
+ * record after the fact. One read-only derivation — no stored state, no model
+ * call — that `cogit captures` and the map's Captured list both read, so the
+ * two can never disagree. It is not a plan: nothing here can be ticked off,
+ * assigned or edited. Kept free of Node imports because the template imports it.
+ */
+
+/** The part of a session the derivation needs; a `ViewSession` fits as is. */
+export interface CaptureSourceSession {
+ sessionId: string;
+ title: string;
+ author?: string | undefined;
+ authorEmail?: string | undefined;
+ updatedAt: string;
+ status: { pending: readonly ViewPendingItem[] };
+ messages: readonly Pick<ViewNode, "id" | "label" | "branch" | "unsummarized">[];
+}
+
+/** Parsed time, with `-Infinity` for an absent or rejected value. */
+function timeOf(at: string): number {
+ const time = Date.parse(at);
+ return Number.isNaN(time) ? Number.NEGATIVE_INFINITY : time;
+}
+
+/**
+ * `needsUser` first, then the newest session first. The sort is stable, so a
+ * tie keeps the record's order: pending items, then branches in message order.
+ */
+function byOrder(a: ViewCapture, b: ViewCapture): number {
+ return Number(b.needsUser) - Number(a.needsUser) || timeOf(b.updatedAt) - timeOf(a.updatedAt);
+}
+
+/** Every open line the records hold, one row per source, sorted for reading. */
+export function buildCaptures(sessions: readonly CaptureSourceSession[]): ViewCapture[] {
+ const rows: ViewCapture[] = [];
+ for (const session of sessions) {
+ const sessionTitle = session.title.trim() === "" ? session.sessionId : session.title;
+ const person = personLabel(session);
+ const base = {
+ sessionId: session.sessionId,
+ sessionTitle,
+ ...(person === undefined ? {} : { author: person }),
+ updatedAt: session.updatedAt,
+ };
+
+ // A pending item belongs to the session as a whole; it points at the
+ // newest message the record holds, where the session left off.
+ const recorded = session.messages.filter((message) => message.unsummarized !== true);
+ const newest = recorded[recorded.length - 1];
+ const seenPending = new Set<string>();
+ session.status.pending.forEach((item, index) => {
+ const text = item.text.trim();
+ if (text === "" || seenPending.has(text)) return;
+ seenPending.add(text);
+ rows.push({
+ key: `${session.sessionId}#p${index}`,
+ text,
+ source: "pending",
+ ...base,
+ ...(newest === undefined
+ ? {}
+ : {
+ messageId: newest.id,
+ ...(newest.label === undefined ? {} : { label: newest.label }),
+ }),
+ needsUser: item.needsUser,
+ });
+ });
+
+ // A branch summary's open line sits on the branch's first message.
+ for (const message of session.messages) {
+ const text = message.branch?.open.trim() ?? "";
+ if (text === "") continue;
+ rows.push({
+ key: `${session.sessionId}#${message.id}`,
+ text,
+ source: "branch",
+ ...base,
+ messageId: message.id,
+ ...(message.label === undefined ? {} : { label: message.label }),
+ ...(message.branch === undefined ? {} : { branch: message.branch.title }),
+ needsUser: false,
+ });
+ }
+ }
+ return rows.sort(byOrder);
+}
diff --git a/packages/cli/src/view/model.ts b/packages/cli/src/view/model.ts
index 66bbfec..b6322bf 100644
--- a/packages/cli/src/view/model.ts
+++ b/packages/cli/src/view/model.ts
@@ -347,6 +347,38 @@ export interface LineageViewModel {
* built before it; a project's map never carries another project's rows.
*/
inbox?: ViewInboxRow[];
+ /**
+ * Captured work (Story 14.1): what the sessions left open, derived from the
+ * records at build time. Absent on pages built before it.
+ */
+ captures?: ViewCapture[];
+}
+
+/**
+ * One line of captured work (Story 14.1): something a session left open, read
+ * from its record — a `status.pending` item or a branch summary's `open` line.
+ * Derived on every build, never stored, never edited; it is not a plan.
+ */
+export interface ViewCapture {
+ /** `<sessionId>#p<n>` for a pending item, `<sessionId>#<messageId>` for a branch. */
+ key: string;
+ text: string;
+ /** Where the record holds it: the session's pending list or a branch summary. */
+ source: "pending" | "branch";
+ sessionId: string;
+ /** The session's title, or its id when the record has none yet. */
+ sessionTitle: string;
+ /** The message that named it: the newest one for pending, the branch's first for an open line. */
+ messageId?: string;
+ /** That message's `mN` label. */
+ label?: string;
+ /** The branch summary's title, for an open line. */
+ branch?: string;
+ /** Who recorded the session (name, else email); absent on older records. */
+ author?: string;
+ /** The session's last update: how old the line is. */
+ updatedAt: string;
+ needsUser: boolean;
}
/**
diff --git a/packages/cli/test/captures.test.ts b/packages/cli/test/captures.test.ts
new file mode 100644
index 0000000..d741673
--- /dev/null
+++ b/packages/cli/test/captures.test.ts
@@ -0,0 +1,212 @@
+import { mkdir, writeFile } from "node:fs/promises";
+import { join } from "node:path";
+import { beforeEach, describe, expect, it } from "vitest";
+import { buildProject } from "../src/commands/build.js";
+import { captures, formatCaptures } from "../src/commands/captures.js";
+import { init } from "../src/commands/init.js";
+import { createProgram } from "../src/program.js";
+import type { Session } from "../src/schema/session.js";
+import { projectPaths } from "../src/store/paths.js";
+import { buildCaptures, type CaptureSourceSession } from "../src/view/captures.js";
+import { DATA_ELEMENT_ID } from "../src/view/model.js";
+import { envFor, type FakeIo, fakeIo, T0, tempDir } from "./helpers.js";
+
+const TEMPLATE = `<!doctype html><html><body><div id="root"></div>
+ <script id="${DATA_ELEMENT_ID}" type="application/json"></script></body></html>`;
+
+const branch = (open: string) => ({ title: "Parser", asked: "build it", outcome: "built", open });
+
+function source(over: Partial<CaptureSourceSession> & { sessionId: string }): CaptureSourceSession {
+ return {
+ title: "",
+ updatedAt: T0,
+ status: { pending: [] },
+ messages: [],
+ ...over,
+ };
+}
+
+describe("buildCaptures", () => {
+ it("is empty for a project with no sessions or nothing open", () => {
+ expect(buildCaptures([])).toEqual([]);
+ expect(buildCaptures([source({ sessionId: "s1" })])).toEqual([]);
+ });
+
+ it("takes pending items and branch open lines, dropping blanks and in-source repeats", () => {
+ const rows = buildCaptures([
+ source({
+ sessionId: "s1",
+ title: "Ship it",
+ author: "Ada",
+ authorEmail: "[email protected]",
+ status: {
+ pending: [
+ { text: "write the docs", needsUser: false },
+ { text: " ", needsUser: true },
+ { text: "write the docs ", needsUser: false },
+ ],
+ },
+ messages: [
+ { id: "h1", label: "m1", branch: branch("handle empty input") },
+ { id: "h2", label: "m2", branch: branch(" ") },
+ { id: "h3", label: "m3" },
+ { id: "h4", label: "m4", unsummarized: true },
+ ],
+ }),
+ ]);
+ expect(rows).toEqual([
+ {
+ key: "s1#p0",
+ text: "write the docs",
+ source: "pending",
+ sessionId: "s1",
+ sessionTitle: "Ship it",
+ author: "Ada",
+ updatedAt: T0,
+ // The newest recorded message, not the unsummarized tail.
+ messageId: "h3",
+ label: "m3",
+ needsUser: false,
+ },
+ {
+ key: "s1#h1",
+ text: "handle empty input",
+ source: "branch",
+ sessionId: "s1",
+ sessionTitle: "Ship it",
+ author: "Ada",
+ updatedAt: T0,
+ messageId: "h1",
+ label: "m1",
+ branch: "Parser",
+ needsUser: false,
+ },
+ ]);
+ });
+
+ it("puts needsUser first, then the newest session, and keeps one row per source", () => {
+ const rows = buildCaptures([
+ source({
+ sessionId: "old",
+ updatedAt: "2026-10-01T00:00:00.000Z",
+ status: { pending: [{ text: "pick a name", needsUser: true }] },
+ }),
+ source({
+ sessionId: "a",
+ updatedAt: "2026-10-10T00:00:00.000Z",
+ status: { pending: [{ text: "same text", needsUser: false }] },
+ }),
+ source({
+ sessionId: "b",
+ updatedAt: "2026-10-20T00:00:00.000Z",
+ status: { pending: [{ text: "same text", needsUser: false }] },
+ }),
+ ]);
+ expect(rows.map((row) => row.key)).toEqual(["old#p0", "b#p0", "a#p0"]);
+ // A session without a title falls back to its id; no message means no link.
+ expect(rows[0]?.sessionTitle).toBe("old");
+ expect(rows[0]?.messageId).toBeUndefined();
+ });
+});
+
+describe("formatCaptures", () => {
+ it("says so plainly when there is nothing", () => {
+ expect(formatCaptures([], T0)).toEqual(["No captured work in this project."]);
+ });
+});
+
+describe("cogit captures", () => {
+ let dir: string;
+ let root: string;
+ let io: FakeIo;
+
+ function session(over: Partial<Session> & { sessionId: string }): Session {
+ return {
+ schema: 1,
+ agent: "claude-code",
+ title: "",
+ startedAt: T0,
+ updatedAt: T0,
+ status: { goal: "", done: [], pending: [], next: "" },
+ nodes: [],
+ ...over,
+ };
+ }
+
+ beforeEach(async () => {
+ dir = await tempDir();
+ root = join(dir, "proj");
+ await mkdir(root);
+ io = fakeIo(envFor(dir));
+ await init(root, { name: "proj", retention: "keep", language: "auto" }, fakeIo(envFor(dir)));
+ const s1 = session({
+ sessionId: "s1",
+ title: "Parser",
+ author: "Ada",
+ updatedAt: "2026-10-21T08:00:00.000Z",
+ status: {
+ goal: "",
+ done: [],
+ pending: [{ text: "decide the error format", needsUser: true }],
+ next: "",
+ },
+ nodes: [
+ {
+ id: "h111111111111",
+ parent: null,
+ kind: "message",
+ title: "Build the parser",
+ at: "2026-10-21T07:00:00.000Z",
+ branch: branch("unicode input untested"),
+ },
+ ],
+ });
+ const s2 = session({
+ sessionId: "s2",
+ title: "Docs",
+ updatedAt: "2026-10-21T09:00:00.000Z",
+ status: {
+ goal: "",
+ done: [],
+ pending: [{ text: "decide the error format", needsUser: false }],
+ next: "",
+ },
+ });
+ await writeFile(projectPaths(root).session("s1"), JSON.stringify(s1));
+ await writeFile(projectPaths(root).session("s2"), JSON.stringify(s2));
+ });
+
+ it("prints one line per row with source, author and age", async () => {
+ const rows = await captures({ dir: root, io, now: T0 });
+ // The same text in two sessions stays two rows.
+ expect(rows.map((row) => row.key)).toEqual(["s1#p0", "s2#p0", "s1#h111111111111"]);
+ expect(io.lines).toEqual([
+ "! decide the error format (s1 m1 · Ada · 2 h ago)",
+ " decide the error format (s2 · 1 h ago)",
+ " unicode input untested (s1 m1 · Ada · 2 h ago)",
+ "! = waiting for you",
+ ]);
+ });
+
+ it("prints JSON and limits to one session", async () => {
+ await captures({ dir: root, io, json: true, session: "s2" });
+ const rows = JSON.parse(io.lines.join("\n"));
+ expect(rows).toHaveLength(1);
+ expect(rows[0]).toMatchObject({ sessionId: "s2", text: "decide the error format" });
+ });
+
+ it("runs through the command line", async () => {
+ const program = createProgram(() => io, {
+ launch: async () => true,
+ server: async () => null,
+ stdin: async () => "",
+ });
+ await program.parseAsync(["captures", root, "--session", "s2", "--json"], { from: "user" });
+ expect(JSON.parse(io.lines.join("\n"))).toHaveLength(1);
+ });
+
+ it("is carried in the map's page model", async () => {
+ const model = await buildProject({ dir: root, io, templateHtml: TEMPLATE, quiet: true });
+ expect(model.captures?.map((row) => row.key)).toEqual(["s1#p0", "s2#p0", "s1#h111111111111"]);
+ });
+});
diff --git a/packages/template/src/CapturesView.tsx b/packages/template/src/CapturesView.tsx
new file mode 100644
index 0000000..5586e44
--- /dev/null
+++ b/packages/template/src/CapturesView.tsx
@@ -0,0 +1,103 @@
+import type { ViewCapture } from "../../cli/src/view/model.js";
+import type { FilesTarget } from "./FilesView.js";
+import { formatStamp } from "./format.js";
+
+/**
+ * Captured work (Story 14.1): what the sessions left open, read from the
+ * record (`pending` items and branch summaries' open lines). A read-only list,
+ * not a plan: no checkboxes, no status, no assignee. Clicking a row opens the
+ * message that named it, the same drill-down the files view gives.
+ */
+export function CapturesView({
+ captures,
+ active,
+ onSelect,
+ onClose,
+}: {
+ captures: readonly ViewCapture[] | undefined;
+ /** The message the map has selected, if any. */
+ active: FilesTarget | null;
+ onSelect: (target: FilesTarget) => void;
+ onClose: () => void;
+}) {
+ const all = captures ?? [];
+ return (
+ <nav className="outline capture-view" aria-label="Captured work">
+ <header className="outline-head capture-head">
+ <span className="outline-title capture-title">
+ Captured work — what the sessions left open
+ </span>
+ <span className="outline-badge capture-badge">{all.length}</span>
+ <button
+ type="button"
+ className="drilldown-close"
+ aria-label="Hide captured work"
+ onClick={onClose}
+ >
+ ×
+ </button>
+ </header>
+ <p className="capture-note">
+ Derived from the record on every build. Not a plan: cogit keeps no planning state.
+ </p>
+ <div className="outline-scroll">
+ {all.length === 0 ? (
+ <p className="empty">No captured work in this project.</p>
+ ) : (
+ <ul className="capture-list">
+ {all.map((row) => {
+ const messageId = row.messageId;
+ const selected =
+ messageId !== undefined &&
+ active?.sessionId === row.sessionId &&
+ active.messageId === messageId;
+ const body = (
+ <>
+ <span className="capture-line">
+ <span className="capture-chip">
+ {row.source === "pending" ? "pending" : "branch"}
+ </span>
+ {row.needsUser ? (
+ <span className="capture-needs" title="Waiting for you">
+ your call
+ </span>
+ ) : null}
+ <span className="capture-text">{row.text}</span>
+ </span>
+ <span className="capture-meta">
+ <span className="capture-session">{row.sessionTitle}</span>
+ {row.label === undefined ? null : (
+ <span className="capture-label">{row.label}</span>
+ )}
+ {row.branch === undefined ? null : (
+ <span className="capture-branch">╭ {row.branch}</span>
+ )}
+ {row.author === undefined ? null : (
+ <span className="capture-author">{row.author}</span>
+ )}
+ <span className="capture-time">{formatStamp(row.updatedAt)}</span>
+ </span>
+ </>
+ );
+ return (
+ <li key={row.key}>
+ {messageId === undefined ? (
+ <div className="capture-row">{body}</div>
+ ) : (
+ <button
+ type="button"
+ className={`capture-row${selected ? " is-active" : ""}`}
+ onClick={() => onSelect({ sessionId: row.sessionId, messageId })}
+ >
+ {body}
+ </button>
+ )}
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </div>
+ </nav>
+ );
+}
diff --git a/packages/template/src/Graph.tsx b/packages/template/src/Graph.tsx
index 39cf91f..5305e97 100644
--- a/packages/template/src/Graph.tsx
+++ b/packages/template/src/Graph.tsx
@@ -19,6 +19,7 @@ import {
} from "react";
import type { LineageViewModel, ViewSession } from "../../cli/src/view/model.js";
import { hitMessageIds, hitSessionIds } from "../../cli/src/view/search.js";
+import { CapturesView } from "./CapturesView.js";
import { loadMapView, pageToken, saveOpenSessions, saveRowWidth } from "./data.js";
import { type FilesTarget, FilesView } from "./FilesView.js";
import { useFullscreen } from "./fullscreen.js";
@@ -328,6 +329,7 @@ function Flow({ model, search }: { model: LineageViewModel; search: MapSearchSta
const [showOutline, setShowOutline] = useState(true);
// The files and outline views share the left column; only one shows.
const [showFiles, setShowFiles] = useState(false);
+ const [showCaptures, setShowCaptures] = useState(false);
const [person, setPerson] = useState<PersonFilter>(null);
const people = useMemo(() => peopleOf(model), [model]);
const personOptions = useMemo(() => people.options(), [people]);
@@ -757,6 +759,7 @@ function Flow({ model, search }: { model: LineageViewModel; search: MapSearchSta
onClick={() => {
setShowOutline((value) => !value);
setShowFiles(false);
+ setShowCaptures(false);
}}
>
{showOutline ? "Hide outline" : "Show outline"}
@@ -769,13 +772,38 @@ function Flow({ model, search }: { model: LineageViewModel; search: MapSearchSta
onClick={() => {
setShowFiles((value) => !value);
setShowOutline(false);
+ setShowCaptures(false);
}}
>
{showFiles ? "Hide files" : "Files"}
</button>
+ <button
+ type="button"
+ className="outline-button capture-button"
+ aria-pressed={showCaptures}
+ title="What the sessions left open, read from the record"
+ onClick={() => {
+ setShowCaptures((value) => !value);
+ setShowFiles(false);
+ setShowOutline(false);
+ }}
+ >
+ {showCaptures ? "Hide captured" : "Captured"}
+ </button>
</div>
<div className="graph-wrap">
- {showFiles ? (
+ {showCaptures ? (
+ <CapturesView
+ captures={model.captures}
+ active={
+ selection?.type === "node"
+ ? { sessionId: selection.sessionId, messageId: selection.nodeId }
+ : null
+ }
+ onSelect={selectFromFiles}
+ onClose={() => setShowCaptures(false)}
+ />
+ ) : showFiles ? (
<FilesView
files={model.files}
active={
diff --git a/packages/template/src/styles.css b/packages/template/src/styles.css
index 2f32d27..8cf74ea 100644
--- a/packages/template/src/styles.css
+++ b/packages/template/src/styles.css
@@ -7,6 +7,8 @@
--muted: #9aa3b7;
--accent: #7aa2f7;
--warn: #e0af68;
+ /* Captured work (Story 14.1): its own colour, never the big-change warning. */
+ --capture: #73daca;
/* Branch lanes in the git graph (Story 8.2). */
--l0: #7aa2f7;
--l1: #9ece6a;
@@ -55,6 +57,7 @@
--muted: #545e72;
--accent: #2957c8;
--warn: #8a5300;
+ --capture: #0f766e;
--l0: #2957c8;
--l1: #2f7d32;
--l2: #8a5300;
@@ -99,6 +102,7 @@
--muted: #545e72;
--accent: #2957c8;
--warn: #8a5300;
+ --capture: #0f766e;
--l0: #2957c8;
--l1: #2f7d32;
--l2: #8a5300;
@@ -1161,6 +1165,112 @@ body:has(.map-shell.is-expanded) {
font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
}
+/* Captured work (Story 14.1): a read-only list, visibly not a message row. */
+.capture-view {
+ width: 340px;
+}
+
+.outline-button.capture-button[aria-pressed="true"] {
+ border-color: var(--capture);
+ color: var(--capture);
+}
+
+.capture-head {
+ border-bottom-color: var(--capture);
+}
+
+.capture-title {
+ color: var(--capture);
+}
+
+.capture-badge {
+ color: var(--capture);
+ border-color: var(--capture);
+}
+
+.capture-note {
+ margin: 0;
+ padding: 4px 10px 6px;
+ color: var(--muted);
+ font-size: 11px;
+}
+
+.capture-list {
+ margin: 0;
+ padding: 0 4px;
+ list-style: none;
+}
+
+.capture-row {
+ display: flex;
+ flex-direction: column;
+ gap: 3px;
+ width: 100%;
+ margin: 2px 0;
+ padding: 6px 8px;
+ color: var(--text);
+ background: transparent;
+ border: 0;
+ border-left: 2px solid var(--capture);
+ border-radius: 0 5px 5px 0;
+ font: inherit;
+ font-size: 12px;
+ text-align: left;
+}
+
+button.capture-row {
+ cursor: pointer;
+}
+
+button.capture-row:hover {
+ background: var(--hover);
+}
+
+.capture-row.is-active {
+ background: var(--active);
+ outline: 1px solid var(--capture);
+}
+
+.capture-line {
+ display: flex;
+ align-items: baseline;
+ gap: 6px;
+ min-width: 0;
+}
+
+.capture-chip,
+.capture-needs {
+ flex: none;
+ padding: 0 5px;
+ border: 1px solid var(--capture);
+ border-radius: 8px;
+ color: var(--capture);
+ font-size: 10px;
+ line-height: 15px;
+}
+
+.capture-needs {
+ background: var(--capture);
+ color: var(--bg);
+}
+
+.capture-text {
+ overflow-wrap: anywhere;
+}
+
+.capture-meta {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+ color: var(--muted);
+ font-size: 11px;
+}
+
+.capture-label,
+.capture-branch {
+ font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
+}
+
/* The map draws its own git graph; React Flow only pans, zooms and frames it. */
.map-node .git-graph {
margin: 0;
diff --git a/packages/template/test/captures-view.test.tsx b/packages/template/test/captures-view.test.tsx
new file mode 100644
index 0000000..dea35c2
--- /dev/null
+++ b/packages/template/test/captures-view.test.tsx
@@ -0,0 +1,62 @@
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { describe, expect, it } from "vitest";
+import type { ViewCapture } from "../../cli/src/view/model.js";
+import { CapturesView } from "../src/CapturesView.js";
+
+const T0 = "2026-10-26T10:00:00.000Z";
+
+const rows: ViewCapture[] = [
+ {
+ key: "s1#p0",
+ text: "decide the error format",
+ source: "pending",
+ sessionId: "s1",
+ sessionTitle: "Parser work",
+ messageId: "h3",
+ label: "m3",
+ author: "Ada",
+ updatedAt: T0,
+ needsUser: true,
+ },
+ {
+ key: "s1#h1",
+ text: "unicode input untested",
+ source: "branch",
+ sessionId: "s1",
+ sessionTitle: "Parser work",
+ messageId: "h1",
+ label: "m1",
+ branch: "Parser",
+ updatedAt: T0,
+ needsUser: false,
+ },
+];
+
+function render(captures: ViewCapture[] | undefined): string {
+ return renderToStaticMarkup(
+ createElement(CapturesView, { captures, active: null, onSelect: () => {}, onClose: () => {} }),
+ );
+}
+
+describe("CapturesView", () => {
+ it("lists each row with its source and the muted not-a-plan note", () => {
+ const html = render(rows);
+ expect(html).toContain("Captured work — what the sessions left open");
+ expect(html).toContain('class="capture-note"');
+ expect(html).toContain("Not a plan");
+ expect(html).toContain("decide the error format");
+ expect(html).toContain("unicode input untested");
+ expect(html).toContain("Parser work");
+ expect(html).toContain("m3");
+ expect(html).toContain("╭ Parser");
+ expect(html).toContain("your call");
+ // Read-only: nothing to tick.
+ expect(html).not.toContain('type="checkbox"');
+ });
+
+ it("shows a plain empty state", () => {
+ expect(render(undefined)).toContain("No captured work in this project.");
+ expect(render([])).toContain("No captured work in this project.");
+ });
+});