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
import type { LineageViewModel, ViewNode, ViewSession } from "../../cli/src/view/model.js";
const message = (
id: string,
title: string,
parent: string | null,
at: string,
extra: Partial<ViewNode> = {},
): ViewNode => ({ id, kind: "message", title, parent, at, ...extra });
const session = (
sessionId: string,
title: string,
startedAt: string,
updatedAt: string,
messages: ViewNode[],
status: ViewSession["status"],
): ViewSession => ({
sessionId,
agent: "claude-code",
title,
startedAt,
updatedAt,
status,
messages,
transcriptAvailable: true,
});
/**
* Dev-only sample data (`npm run dev -w template`). Mirrors the shape `cogit
* build` produces: three sessions in start order, a branch that
* folds, a return link and an unrecorded message at the end of a chain.
*/
export const fixture: LineageViewModel = {
kind: "lineage",
schema: 1,
project: {
name: "cogit",
path: "/home/dev/cogit",
generatedAt: "2026-10-24T12:00:00.000Z",
},
status: {
goal: "Ship the project map as one self-contained HTML file.",
done: ["Define the view-model contract", "Scaffold the template package"],
pending: [
{ text: "Pick the graph layout that survives 500 nodes", needsUser: true },
{ text: "Write the resume command copy fallback", needsUser: false },
],
next: "Render the fixture through the template and check the single-file build.",
lastActivity: "2026-10-24T11:42:00.000Z",
},
settings: {
recorder: "mixed",
language: "auto",
updateEveryTurns: 15,
sideEveryTurns: 5,
sessionEndCatchUp: true,
sideModel: "haiku",
messageSummaries: false,
startupContext: true,
recordHeadless: false,
tryBeforeNotes: true,
shapes: true,
captures: true,
shareConversations: false,
agents: ["claude-code"],
bigChangeLines: 300,
},
sessions: [
session(
"fixture-template",
"Template package and single-file output",
"2026-10-24T08:00:00.000Z",
"2026-10-24T11:42:00.000Z",
[
message("m1", "Scaffold the template package", null, "2026-10-24T09:00:00.000Z", {
summary: "React 19 + Vite 8, one index.html at build time.",
branch: {
title: "Template scaffold",
asked: "Which build setup keeps the page one file?",
outcome: "Vite + vite-plugin-singlefile; the data is embedded as JSON.",
open: "",
},
}),
message("m2", "Wire the data contract", "m1", "2026-10-24T09:12:00.000Z", {
summary: "The page reads the JSON script element and types it once.",
work: ["Added view/model.ts shared by CLI and template"],
files: ["packages/cli/src/view/model.ts", "packages/cli/src/view/lineage.ts"],
}),
message("m3", "Read data from the DOM", "m2", "2026-10-24T09:20:00.000Z", {
summary: "A fetch would break file://; the JSON element survives inlining.",
decidedBy: "agent",
alternatives: [{ option: "fetch the JSON", why: "breaks over file://" }],
}),
message("m4", "Build the dev fixture", "m3", "2026-10-24T09:41:00.000Z", {
summary: "Three sessions in start order, enough to exercise every branch shape.",
decidedBy: "agreed",
alternatives: [
{
option: "ship the fixture as a separate JSON file",
why: "the map has to stay one file",
},
{ option: "mock the model in the tests instead", why: "it never draws the real graph" },
],
commits: ["1a2b3c4", "9f8e7d6"],
shape: {
by: "side",
commits: ["1a2b3c4", "9f8e7d6"],
tools: [
{
kind: "mermaid",
valid: true,
text: [
"flowchart TD",
" F[fixture.ts] --> S[Three sessions, in start order]",
" S --> L[Lay out the git rows]",
" L --> G[Draw the graph]",
" G --> C{Every message placed?}",
" C -- yes --> R[Render the map]",
" C -- no --> L",
].join("\n"),
},
],
},
commitTags: [
{ hash: "1a2b3c4", subject: "feat(template): add the dev fixture" },
{ hash: "9f8e7d6" },
],
files: ["packages/template/src/fixture.ts"],
}),
message("m5", "Check the page in the browser", "m4", "2026-10-24T10:02:00.000Z", {
summary: "Layout measured; console clean.",
}),
message("m6", "Draw nested groups", "m4", "2026-10-24T10:20:00.000Z", {
summary: "A second branch off the fixture work.",
files: ["packages/template/src/Graph.tsx"],
branch: {
title: "Nested groups",
asked: "How do sessions and messages nest?",
outcome: "Groups around the git rows.",
open: "",
},
}),
message("m7", "Return to the data contract", "m6", "2026-10-24T10:35:00.000Z", {
summary: "The contract needed one more field for the pending count.",
links: ["m2"],
}),
message("m8", "Ship the map", "m7", "2026-10-24T11:10:00.000Z", {
summary: "Build, open and verify.",
}),
message("m9", "Lineage graph idea", null, "2026-10-24T11:42:00.000Z", {
summary: "A git graph of the user's messages.",
files: ["packages/cli/src/view/files.ts"],
branch: {
title: "Git graph",
asked: "What if the map read like a git history?",
outcome: "",
open: "Not built yet.",
},
}),
],
{
goal: "Render a typed fixture through the template.",
done: ["Scaffold Vite + React", "Add the fixture"],
pending: [{ text: "Confirm the graph layout", needsUser: true }],
next: "Check the page in the browser.",
},
),
session(
"fixture-capture",
"Session merge and redaction",
"2026-10-20T09:00:00.000Z",
"2026-10-20T16:30:00.000Z",
[
message("c1", "Harden session writes", null, "2026-10-20T09:00:00.000Z", {
summary: "Locked read → merge → write with redaction.",
files: ["packages/cli/src/store/stores.ts"],
branch: {
title: "Safe writes",
asked: "How do two turns write the same session?",
outcome: "A per-session lock, then merge and redact.",
open: "",
},
}),
message("c2", "Keep parents optional on input", "c1", "2026-10-20T09:30:00.000Z", {
why: "The agent can add a child without re-sending the whole tree.",
decidedBy: "agreed",
}),
message("c3", "Add the turn counter", "c2", "2026-10-20T16:30:00.000Z"),
],
{
goal: "Make session writes safe under concurrency.",
done: ["Per-session lock", "redactDeep"],
pending: [],
next: "Add the turn counter.",
},
),
session(
"fixture-unassigned",
"Scratch notes on status cards",
"2026-10-19T16:00:00.000Z",
"2026-10-19T18:00:00.000Z",
[
message("u1", "Sketch the status card", null, "2026-10-19T16:00:00.000Z", {
summary: "Goal, done, pending, next and last activity.",
}),
message("u2", "What counts as an active session?", "u1", "2026-10-19T18:00:00.000Z", {
summary: "Updated within the last 7 days.",
unsummarized: true,
}),
],
{
goal: "Decide how the status card merges parallel sessions.",
done: [],
pending: [{ text: "Define active", needsUser: true }],
next: "Ask before implementing.",
},
),
].sort((a, b) => a.startedAt.localeCompare(b.startedAt)),
// Patches carried by the page, so the demo map shows a diff with no server.
diffs: {
"1a2b3c4": {
"": [
"diff --git a/packages/template/src/fixture.ts b/packages/template/src/fixture.ts",
"new file mode 100644",
"index 0000000..1a2b3c4",
"--- /dev/null",
"+++ b/packages/template/src/fixture.ts",
"@@ -0,0 +1,4 @@",
'+import type { LineageViewModel } from "../../cli/src/view/model.js";',
"+",
'+export const fixture: LineageViewModel = { kind: "lineage", schema: 1 };',
"+",
].join("\n"),
"packages/template/src/fixture.ts": [
"diff --git a/packages/template/src/fixture.ts b/packages/template/src/fixture.ts",
"new file mode 100644",
"index 0000000..1a2b3c4",
"--- /dev/null",
"+++ b/packages/template/src/fixture.ts",
"@@ -0,0 +1,4 @@",
'+import type { LineageViewModel } from "../../cli/src/view/model.js";',
"+",
'+export const fixture: LineageViewModel = { kind: "lineage", schema: 1 };',
"+",
].join("\n"),
},
},
// Story 8.15: the files view, as `build` unions message files and commit files.
files: [
{
path: "packages/cli/src/view/files.ts",
count: 1,
lastAt: "2026-10-24T11:42:00.000Z",
hits: [
{
sessionId: "fixture-template",
sessionTitle: "Template package and single-file output",
messageId: "m9",
label: "m9",
at: "2026-10-24T11:42:00.000Z",
title: "Lineage graph idea",
branch: "Git graph",
commits: [],
},
],
},
{
path: "packages/template/src/Graph.tsx",
count: 1,
lastAt: "2026-10-24T10:20:00.000Z",
hits: [
{
sessionId: "fixture-template",
sessionTitle: "Template package and single-file output",
messageId: "m6",
label: "m6",
at: "2026-10-24T10:20:00.000Z",
title: "Draw nested groups",
branch: "Nested groups",
commits: [],
},
],
},
{
path: "packages/template/src/fixture.ts",
count: 1,
lastAt: "2026-10-24T09:41:00.000Z",
hits: [
{
sessionId: "fixture-template",
sessionTitle: "Template package and single-file output",
messageId: "m4",
label: "m4",
at: "2026-10-24T09:41:00.000Z",
title: "Build the dev fixture",
branch: "Template scaffold",
commits: ["1a2b3c4", "9f8e7d6"],
},
],
},
{
path: "packages/cli/src/view/model.ts",
count: 1,
lastAt: "2026-10-24T09:12:00.000Z",
hits: [
{
sessionId: "fixture-template",
sessionTitle: "Template package and single-file output",
messageId: "m2",
label: "m2",
at: "2026-10-24T09:12:00.000Z",
title: "Wire the data contract",
branch: "Template scaffold",
commits: [],
},
],
},
{
path: "packages/cli/src/view/lineage.ts",
count: 1,
lastAt: "2026-10-24T09:12:00.000Z",
hits: [
{
sessionId: "fixture-template",
sessionTitle: "Template package and single-file output",
messageId: "m2",
label: "m2",
at: "2026-10-24T09:12:00.000Z",
title: "Wire the data contract",
branch: "Template scaffold",
commits: [],
},
],
},
{
path: "packages/cli/src/store/stores.ts",
count: 1,
lastAt: "2026-10-20T09:00:00.000Z",
hits: [
{
sessionId: "fixture-capture",
sessionTitle: "Session merge and redaction",
messageId: "c1",
label: "c1",
at: "2026-10-20T09:00:00.000Z",
title: "Harden session writes",
branch: "Safe writes",
commits: [],
},
],
},
],
// Story 15.1: the Tasks list, as the distiller writes it after a session.
captures: [
{
id: "c1a2b3c4d",
text: "Pick the graph layout that survives 500 nodes",
state: "suggested",
source: { sessionId: "fixture-template" },
createdAt: "2026-10-24T11:42:00.000Z",
updatedAt: "2026-10-24T11:42:00.000Z",
},
{
id: "c2b3c4d5e",
text: "Write the resume command copy fallback",
state: "suggested",
source: { sessionId: "fixture-template" },
createdAt: "2026-10-24T10:20:00.000Z",
updatedAt: "2026-10-24T10:20:00.000Z",
},
{
id: "c3c4d5e6f",
text: "Define what counts as an active session",
state: "open",
source: { sessionId: "fixture-unassigned" },
createdAt: "2026-10-19T18:00:00.000Z",
updatedAt: "2026-10-21T09:00:00.000Z",
},
{
id: "c4d5e6f70",
text: "Add the turn counter to the status card",
state: "done",
source: { sessionId: "fixture-capture" },
createdAt: "2026-10-20T16:30:00.000Z",
updatedAt: "2026-10-21T10:00:00.000Z",
closedAt: "2026-10-21T10:00:00.000Z",
},
],
// Story 8.12: the switcher's data, as `build` collects it from the registry.
switcher: [
{
name: "cogit",
path: "/home/dev/cogit",
lastActivity: "2026-10-24T11:42:00.000Z",
leftOff: "Render the fixture through the template and check the single-file build.",
lineageUrl: "file:///home/dev/cogit/.cogit/map.html",
current: true,
},
{
name: "start-project",
path: "/home/dev/start-project",
lastActivity: "2026-10-23T18:05:00.000Z",
leftOff: "Write the push commands for the release notes.",
lineageUrl: "file:///home/dev/start-project/.cogit/map.html",
current: false,
},
],
};