Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.
JavaScript ai-codingclaudeclaude-codeclaude-code-pluginclicoding-agentsdeveloper-toolsgitllmtypescript
fix(map): an untitled session shows its first message, not its id
Eren11b1b5bcf742
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1edf901..9ee336a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Fixed+- A session the closing pass left untitled no longer shows as a bare id on the map and in the inbox: it takes its first message's title, and the side model is now told to write a title when the record has none.+### Changed- Map rows show the date only on a day's first row (the rest show the time), the `mN` label is quieter, and "↑ continues <session> · m37" is now "↑ m37" with the session in its tooltip.diff --git a/packages/cli/src/commands/backfill.ts b/packages/cli/src/commands/backfill.tsindex fd5e436..1c181be 100644--- a/packages/cli/src/commands/backfill.ts+++ b/packages/cli/src/commands/backfill.ts@@ -73,6 +73,7 @@ function rules(language: string, messageSummaries: boolean, recorder: RecordModeconst lines = ["Rules (from the cogit lineage skill):",'- Send one "message" node for every message below, with the id exactly as given in its heading (m1, m2, …); skip none, even a short "ok". Never make up an id.',+ "- The session title: when the record's title is empty, send one (a few words on what the session is about); a session without one shows only its id on the map.",`- kind is "message". title: a few words in the user's own wording.${messageSummaries ? " summary: one or two sentences on what came of it." : ""}`,@@ -88,7 +89,7 @@ function rules(language: string, messageSummaries: boolean, recorder: RecordMode];if (recorder === "mixed") {lines.push(- "- This is a periodic background run: send only message nodes with their titles, parents and user decisions. Do not send status, branch summaries or agentDecisions; the main agent owns those.",+ "- This is a periodic background run: send only message nodes with their titles, parents and user decisions, and the session title when it is empty. Do not send status, branch summaries or agentDecisions; the main agent owns those.",);}return lines.join("\n");diff --git a/packages/cli/src/view/lineage.ts b/packages/cli/src/view/lineage.tsindex c361219..67aa444 100644--- a/packages/cli/src/view/lineage.ts+++ b/packages/cli/src/view/lineage.ts@@ -230,6 +230,16 @@ export function statusCard(sessions: Session[], now: string): StatusCard {};}+/**+ * The title a session shows: its own, else its first message's, so a record the+ * recorder left untitled reads as what it is about instead of a bare id.+ */+export function sessionTitle(session: Pick<Session, "title" | "nodes">): string {+ const own = session.title.trim();+ if (own) return own;+ return session.nodes.find((node) => node.kind === "message")?.title.trim() ?? "";+}+/*** The messages the record does not hold yet join the end of the chain, so the* newest message is on the map before the agent summarizes it (8.2).@@ -246,7 +256,7 @@ function toViewSession(return {sessionId: session.sessionId,agent: session.agent,- title: session.title,+ title: sessionTitle(session),...(session.author === undefined ? {} : { author: session.author }),epoch: session.epoch,startedAt: session.startedAt,diff --git a/packages/cli/src/view/panel.ts b/packages/cli/src/view/panel.tsindex 68fc491..c31229d 100644--- a/packages/cli/src/view/panel.ts+++ b/packages/cli/src/view/panel.ts@@ -19,7 +19,7 @@ import {type InboxCandidate,inboxRows,} from "./inbox.js";-import { embedViewModel, lastActive, statusCard } from "./lineage.js";+import { embedViewModel, lastActive, sessionTitle, statusCard } from "./lineage.js";import {type PanelSettings,type PanelViewModel,@@ -211,7 +211,7 @@ export async function collectInboxForProject(projectPath: project.path,mapUrl: pathToFileURL(projectPaths(project.path).html).href,sessionId: session.sessionId,- sessionTitle: session.title || session.sessionId,+ sessionTitle: sessionTitle(session) || session.sessionId,turn,lastActivity: activityIso(session),needsUser,diff --git a/packages/cli/test/backfill.test.ts b/packages/cli/test/backfill.test.tsindex 30186d1..4299633 100644--- a/packages/cli/test/backfill.test.ts+++ b/packages/cli/test/backfill.test.ts@@ -135,10 +135,13 @@ describe("catchUpPrompt", () => {expect(prompt).toContain("branch summary");expect(prompt).toContain("only for technical choices with a reason");expect(prompt).toContain("decidedBy");+ // A closing pass once left a session untitled, so the map showed its bare id.+ expect(prompt).toContain("when the record's title is empty, send one");// The periodic mixed run writes messages and user decisions only.const mixed = catchUpPrompt([turn], undefined, "s1", "auto", false, "mixed");expect(mixed).toContain("periodic background run");expect(mixed).toContain("Do not send status, branch summaries or agentDecisions");+ expect(mixed).toContain("and the session title when it is empty");const side = catchUpPrompt([turn], undefined, "s1", "auto", false, "side");expect(side).not.toContain("periodic background run");const agent = catchUpPrompt([turn], undefined, "s1", "auto", false, "agent");diff --git a/packages/cli/test/session-title.test.ts b/packages/cli/test/session-title.test.tsnew file mode 100644index 0000000..f73ca87--- /dev/null+++ b/packages/cli/test/session-title.test.ts@@ -0,0 +1,22 @@+import { describe, expect, it } from "vitest";+import { sessionTitle } from "../src/view/lineage.js";++describe("sessionTitle", () => {+ const nodes = [+ { kind: "phase", title: "An old topic node" },+ { kind: "message", title: " İroni postmodern " },+ { kind: "message", title: "Later message" },+ ] as Parameters<typeof sessionTitle>[0]["nodes"];++ it("keeps the session's own title", () => {+ expect(sessionTitle({ title: " Release 0.22 ", nodes })).toBe("Release 0.22");+ });++ it("falls back to the first message's title when the recorder left it empty", () => {+ expect(sessionTitle({ title: " ", nodes })).toBe("İroni postmodern");+ });++ it("stays empty without any message", () => {+ expect(sessionTitle({ title: "", nodes: [] })).toBe("");+ });+});