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
feat(map): put the reason first in a message's details and fold the conversation
Erenaf6afaec98da
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3c98e48..95f8630 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,10 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- In side-only mode the session-end pass also hangs a session's first message from the earlier session it continues, which the side model never did before.### Changed- Settings → Recording is one choice: **Economical** (the default for new installs: a small model records in the background and closes each session) or **Detailed** (the main agent also records its own decisions every 15 turns). The turn intervals, the side model and the session-end switch left the panel and stay on `cogit config set`; so does the main-agent-only mode. An existing config keeps the mode it has.+- A message's detail panel puts the reason first: why, what was considered and rejected and who decided, then the agent's own decisions and work, then the code. The conversation and the branch context come last, folded.- "Message summaries" is now "One-line summary under each message", and its help says that branch summaries and where a session left off are written either way.- A new session's first message is offered the eight most recent other sessions, each with where it left off, its branches and the message each branch ends at, instead of the last three messages of three sessions. Work from further back or the middle of a session can now be continued.- The side model's prompt now includes what the agent did in each turn: the questions it asked with their options, the files it edited and its steps. It finds the agent's decisions and the topic of a turn in these.### Fixed+- A map or panel whose record contains `$'`, `$&` or `` $` `` (for example a price written as "0,02 $'ın") no longer breaks with "The embedded cogit data is not valid JSON": those characters were read as a replace pattern when the data went into the page.- A side-model catch-up no longer fails the whole write when the model sends an empty note as `null` (for example `"why": null`); such fields are left out.## [0.20.0] - 2026-10-28diff --git a/packages/template/src/SidePanel.tsx b/packages/template/src/SidePanel.tsxindex cb1c244..1fc7a3c 100644--- a/packages/template/src/SidePanel.tsx+++ b/packages/template/src/SidePanel.tsx@@ -247,10 +247,10 @@ function Conversation({ session, id }: { session: ViewSession | undefined; id: sbody = <p className="muted">This message was not found in the transcript.</p>;}return (- <section className="chat">- <h3>Conversation</h3>+ <details className="chat fold">+ <summary>Conversation</summary>{body}- </section>+ </details>);}@@ -280,8 +280,10 @@ function BranchDetails({? ` · ${formatTime(branch.firstAt)} → ${formatTime(branch.lastAt)}`: "";return (- <section className="branch-detail">- <h3 style={{ color: `var(--l${segment.colorIndex})` }}>{branch.title}</h3>+ <details className="branch-detail fold">+ <summary>+ Branch · <span style={{ color: `var(--l${segment.colorIndex})` }}>{branch.title}</span>+ </summary><p className="branch-range">{branch.count > 1 ? `${branch.fromLabel}–${branch.toLabel}` : branch.fromLabel} ·{" "}{branch.count} message{branch.count === 1 ? "" : "s"}@@ -302,7 +304,7 @@ function BranchDetails({<b>Open:</b> {branch.open}</p>) : null}- </section>+ </details>);}@@ -375,37 +377,7 @@ function NodeDetails({{node.kind === "message" && isMessageHash(node.nodeId) ? (<MessageHash value={node.nodeId} />) : null}- {node.kind === "message" && node.change ? (- <section>- <h3>Code landed</h3>- <p>- <span- className={`git-change${- !read && isBigChange(node.change, bigChangeLines) ? " is-big" : ""- }`}- >- {formatChange(node.change)}- </span>{" "}- after this message.- </p>- <button- type="button"- className="read-toggle"- aria-pressed={read}- disabled={onToggleRead === undefined}- onClick={() => onToggleRead?.(node.nodeId, !read)}- >- {read ? "Mark as unread" : "Mark as read"}- </button>- {typeof document !== "undefined" && isLivePage() ? null : (- <p className="muted">- Saved under .cogit/state by `cogit open`; this page keeps it only while open.- </p>- )}- {readError === null ? null : <p className="error">{readError}</p>}- </section>- ) : null}- {session ? <BranchDetails session={session} branchId={branchId} /> : null}+ {/* The reason first; the long text folded at the end. */}{node.summary ? (<section><h3>Summary</h3>@@ -418,16 +390,22 @@ function NodeDetails({<p>{node.why}</p></section>) : null}- {node.work?.length ? (+ {node.alternatives?.length ? (<section>- <h3>What the agent did</h3>+ <h3>Considered and rejected</h3><ul className="drilldown-list">- {node.work.map((item) => (- <li key={item}>{item}</li>+ {node.alternatives.map((alt) => (+ <li key={alt.option}>+ <strong>{alt.option}</strong>+ {alt.why ? <> — {alt.why}</> : null}+ </li>))}</ul></section>) : null}+ {node.decidedBy ? (+ <p className="decided-by">Decided by: {DECIDED_LABEL[node.decidedBy]}</p>+ ) : null}{node.agentDecisions?.length ? (<section><h3>Decided by the agent on its own</h3>@@ -451,19 +429,46 @@ function NodeDetails({</ul></section>) : null}- {node.alternatives?.length ? (+ {node.work?.length ? (<section>- <h3>Considered and rejected</h3>+ <h3>What the agent did</h3><ul className="drilldown-list">- {node.alternatives.map((alt) => (- <li key={alt.option}>- <strong>{alt.option}</strong>- {alt.why ? <> — {alt.why}</> : null}- </li>+ {node.work.map((item) => (+ <li key={item}>{item}</li>))}</ul></section>) : null}+ {node.kind === "message" && node.change ? (+ <section>+ <h3>Code landed</h3>+ <p>+ <span+ className={`git-change${+ !read && isBigChange(node.change, bigChangeLines) ? " is-big" : ""+ }`}+ >+ {formatChange(node.change)}+ </span>{" "}+ after this message.+ </p>+ <button+ type="button"+ className="read-toggle"+ aria-pressed={read}+ disabled={onToggleRead === undefined}+ onClick={() => onToggleRead?.(node.nodeId, !read)}+ >+ {read ? "Mark as unread" : "Mark as read"}+ </button>+ {typeof document !== "undefined" && isLivePage() ? null : (+ <p className="muted">+ Saved under .cogit/state by `cogit open`; this page keeps it only while open.+ </p>+ )}+ {readError === null ? null : <p className="error">{readError}</p>}+ </section>+ ) : null}{node.commits?.length ? (<section><h3>@@ -516,8 +521,8 @@ function NodeDetails({<p className="muted">Open with `cogit open` to see diffs.</p>) : null}{node.kind === "message" ? <Conversation session={session} id={node.nodeId} /> : null}+ {session ? <BranchDetails session={session} branchId={branchId} /> : null}<dl className="drilldown-meta">- {node.decidedBy ? <Field label="Decided by">{DECIDED_LABEL[node.decidedBy]}</Field> : null}<Field label={node.kind === "message" ? "Sent" : "Recorded"}>{formatTime(node.at ?? node.addedAt ?? null)}</Field>diff --git a/packages/template/src/styles.css b/packages/template/src/styles.cssindex 11477db..3728c8a 100644--- a/packages/template/src/styles.css+++ b/packages/template/src/styles.css@@ -1322,6 +1322,30 @@ body:has(.map-shell.is-expanded) {overflow-wrap: anywhere;}+/* Long text (the conversation, the branch context) sits folded at the end. */+.drilldown-body details.fold {+ margin-bottom: 14px;+}++.drilldown-body details.fold > summary {+ cursor: pointer;+ margin-bottom: 4px;+ font-size: 11px;+ text-transform: uppercase;+ letter-spacing: 0.08em;+ color: var(--muted);+}++.drilldown-body details.fold > summary:hover {+ color: var(--text);+}++.drilldown-body .decided-by {+ margin: -8px 0 14px;+ font-size: 12px;+ color: var(--muted);+}+.drilldown-list {margin: 4px 0 0;padding-left: 18px;diff --git a/packages/template/test/unread.test.ts b/packages/template/test/unread.test.tsindex 746500c..b1598fb 100644--- a/packages/template/test/unread.test.ts+++ b/packages/template/test/unread.test.ts@@ -194,6 +194,10 @@ describe("how much code landed on the map (10.3)", () => {expect(unread).toContain("Mark as read");expect(unread).toContain("after this message");expect(unread).toContain("is-big");+ // The reason and the code come first; the conversation is folded at the end.+ expect(unread).toContain('<details class="chat fold"><summary>Conversation</summary>');+ expect(unread.indexOf("Code landed")).toBeLessThan(unread.indexOf("Conversation"));+ expect(unread.indexOf("Conversation")).toBeLessThan(unread.indexOf("drilldown-meta"));const read = renderToStaticMarkup(createElement(DrillDown, {