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(record): summarise every message by default
Eren2077b4f57e55
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ba712eb..bda12da 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,9 @@ 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]+### Changed+- Every message now gets a one-line summary of what came of it (`messageSummaries` is on by default, and turned on once for existing setups). Without it, a message that only discussed or advised kept nothing but its title, so the map and search lost what the agent said. Turn it off with `cogit config set messageSummaries false`; it then stays off.+### Fixed- With Husky, cogit's hook blocks no longer vanish for good after `npm install` (Husky rewrites `.husky/_`): the next chat message puts them back. `cogit hooks uninstall` is remembered, so blocks you removed on purpose stay out.- A session the side model left untitled takes its first thread's title (or its first message's) at session end, instead of showing only its id on the map and in `cogit log`; `cogit log` also stops printing such an id twice.diff --git a/docs/guide/settings.md b/docs/guide/settings.mdindex b924ca5..537cb78 100644--- a/docs/guide/settings.md+++ b/docs/guide/settings.md@@ -18,11 +18,11 @@ Economical (recommended): a small model records in the background every few turn### One-line summary under each message-`messageSummaries` · default `false`+`messageSummaries` · default `true`**A sentence under each message title on the map.**-A one-sentence summary under each message title, so a skim reads better. Off keeps the record shorter and cheaper. Branch summaries and the line on where a session left off are written either way.+A one-sentence summary under each message title: what came of it. Without it, a message that only discussed or advised keeps nothing but its title. Off keeps the record shorter and cheaper. Branch summaries and the line on where a session left off are written either way.### Record at session startdiff --git a/docs/schema/config.json b/docs/schema/config.jsonindex 0e5dd7e..0fee165 100644--- a/docs/schema/config.json+++ b/docs/schema/config.json@@ -49,9 +49,18 @@"maxLength": 64},"messageSummaries": {- "default": false,+ "default": true,"type": "boolean"},+ "migrated": {+ "maxItems": 50,+ "type": "array",+ "items": {+ "type": "string",+ "minLength": 1,+ "maxLength": 60+ }+ },"shapes": {"default": true,"type": "boolean"diff --git a/packages/cli/src/commands/config.ts b/packages/cli/src/commands/config.tsindex 1de511c..8d4ea7f 100644--- a/packages/cli/src/commands/config.ts+++ b/packages/cli/src/commands/config.ts@@ -19,10 +19,10 @@ import {updateRegistry,} from "../store/stores.js";-export const CONFIG_KEYS = Object.keys(Config.shape).filter((k) => k !== "schema") as Exclude<- keyof Config,- "schema"->[];+/** Settings a user may read and set; `migrated` is cogit's own bookkeeping. */+export const CONFIG_KEYS = Object.keys(Config.shape).filter(+ (k) => k !== "schema" && k !== "migrated",+) as Exclude<keyof Config, "schema" | "migrated">[];/** Keys `cogit config` lists; `catchUpModel` is only an accepted old alias (12.1). */export const LISTED_CONFIG_KEYS = CONFIG_KEYS.filter((k) => k !== "catchUpModel");diff --git a/packages/cli/src/schema/config.ts b/packages/cli/src/schema/config.tsindex 47c5a17..a88d4ad 100644--- a/packages/cli/src/schema/config.ts+++ b/packages/cli/src/schema/config.ts@@ -31,10 +31,13 @@ export const Config = z.object({*/catchUpModel: z.string().trim().min(1).max(64).optional(),/**- * Whether the agent writes a per-message `summary`. Off by default: the branch- * summary is the outer layer and the drill-down already shows the reply.+ * Whether the record carries a per-message `summary`: what came of it. On by+ * default since 1.0.2: without it a message that only discussed or advised+ * kept nothing but its title, and the map and search lost what was said.*/- messageSummaries: z.boolean().default(false),+ messageSummaries: z.boolean().default(true),+ /** One-time config changes already applied (see `migrateConfig`); never shown. */+ migrated: z.array(z.string().min(1).max(60)).max(50).optional(),/*** Whether a message that landed commits gets a Shape (Story 13.6): a small* plain-language or diagram view of what the change does, written by whoever@@ -118,11 +121,23 @@ export const DEFAULT_SIDE_MODEL = "haiku";* The old key is dropped, so the next write stores only the new name. An* explicit new name wins; the plain default yields to the old one.*/+/** The 1.0.2 change that turned per-message summaries on for existing configs. */+export const SUMMARIES_ON = "messageSummaries-on";+export function migrateConfig(config: Config): Config {- if (config.catchUpModel === undefined) return config;- const { catchUpModel, ...rest } = config;- return {- ...rest,- sideModel: config.sideModel === DEFAULT_SIDE_MODEL ? catchUpModel : config.sideModel,- };+ let next = config;+ if (next.catchUpModel !== undefined) {+ const { catchUpModel, ...rest } = next;+ next = {+ ...rest,+ sideModel: next.sideModel === DEFAULT_SIDE_MODEL ? catchUpModel : next.sideModel,+ };+ }+ // Every config written before 1.0.2 stores the old default (off), so the new+ // default would reach nobody: turn it on once. A user who turns it off again+ // afterwards keeps it off, since the change is then marked as applied.+ if (!(next.migrated ?? []).includes(SUMMARIES_ON)) {+ next = { ...next, messageSummaries: true, migrated: [...(next.migrated ?? []), SUMMARIES_ON] };+ }+ return next;}diff --git a/packages/cli/src/view/settings.ts b/packages/cli/src/view/settings.tsindex e42e02c..2045724 100644--- a/packages/cli/src/view/settings.ts+++ b/packages/cli/src/view/settings.ts@@ -71,8 +71,9 @@ const EDITABLE: FieldSpec[] = [label: "One-line summary under each message",help: "A sentence under each message title on the map.",details:- "A one-sentence summary under each message title, so a skim reads better. Off keeps " +- "the record shorter and cheaper. Branch summaries and the line on where a session left " ++ "A one-sentence summary under each message title: what came of it. Without it, a " ++ "message that only discussed or advised keeps nothing but its title. Off keeps the " ++ "record shorter and cheaper. Branch summaries and the line on where a session left " +"off are written either way.",kind: "boolean",},@@ -272,7 +273,7 @@ export const DEFAULT_SETTINGS: PanelSettings = {sideEveryTurns: 5,sessionEndCatchUp: true,sideModel: "haiku",- messageSummaries: false,+ messageSummaries: true,startupContext: true,recordHeadless: false,tryBeforeNotes: true,diff --git a/packages/cli/test/config-epoch.test.ts b/packages/cli/test/config-epoch.test.tsindex 22575b5..8ef2e8b 100644--- a/packages/cli/test/config-epoch.test.ts+++ b/packages/cli/test/config-epoch.test.ts@@ -25,7 +25,10 @@ describe("config", () => {expect(io.lines).toContain("sideEveryTurns = 5");// The old name is an accepted alias, not a listed key (Story 12.1).expect(io.lines.some((line) => line.startsWith("catchUpModel"))).toBe(false);- expect(io.lines).toContain("messageSummaries = false");+ expect(io.lines).toContain("messageSummaries = true");+ // cogit's own bookkeeping is neither listed nor settable.+ expect(io.lines.some((line) => line.startsWith("migrated"))).toBe(false);+ await expect(configSet("migrated", "[]", io)).rejects.toThrow(/unknown key/);expect(io.lines).toContain("startupContext = true");// The old name reads as the new one (Story 12.1).await configGet("catchUpModel", io);@@ -72,6 +75,20 @@ describe("config", () => {expect(stored).not.toHaveProperty("catchUpModel");});+ it("turns message summaries on once for a config written before 1.0.2", async () => {+ const file = globalPaths(env).config;+ await mkdir(dirname(file), { recursive: true });+ // Every older config stores the old default.+ await writeFile(file, JSON.stringify({ schema: 1, messageSummaries: false }));+ expect((await loadConfig(env)).messageSummaries).toBe(true);+ // Turned off on purpose afterwards: it stays off, on every later read.+ await configSet("messageSummaries", "false", fakeIo(env));+ expect((await loadConfig(env)).messageSummaries).toBe(false);+ const stored = JSON.parse(await readFile(file, "utf8")) as Record<string, unknown>;+ expect(stored.migrated).toEqual(["messageSummaries-on"]);+ expect(stored.messageSummaries).toBe(false);+ });+it("keeps an explicit new model name over the old key (Story 12.1)", async () => {const file = globalPaths(env).config;await mkdir(dirname(file), { recursive: true });diff --git a/packages/cli/test/panel.test.ts b/packages/cli/test/panel.test.tsindex 13af06d..3c3d52e 100644--- a/packages/cli/test/panel.test.ts+++ b/packages/cli/test/panel.test.ts@@ -87,7 +87,7 @@ describe("buildPanel", () => {sideEveryTurns: 5,sessionEndCatchUp: true,sideModel: "haiku",- messageSummaries: false,+ messageSummaries: true,startupContext: true,recordHeadless: false,tryBeforeNotes: true,diff --git a/packages/cli/test/server.test.ts b/packages/cli/test/server.test.tsindex 8297fe4..354e459 100644--- a/packages/cli/test/server.test.ts+++ b/packages/cli/test/server.test.ts@@ -412,10 +412,11 @@ describe("settings write", () => {it("accepts a valid write, stores it and refreshes the panel", async () => {const server = await start();const token = await panelToken(server);- const reply = await configWrite(server, token, { key: "messageSummaries", value: true });+ // On by default: the write turns it off, so the change is real.+ const reply = await configWrite(server, token, { key: "messageSummaries", value: false });expect(reply.status).toBe(200);- expect(JSON.parse(reply.body)).toEqual({ ok: true, key: "messageSummaries", value: true });- expect((await loadConfig(env)).messageSummaries).toBe(true);+ expect(JSON.parse(reply.body)).toEqual({ ok: true, key: "messageSummaries", value: false });+ expect((await loadConfig(env)).messageSummaries).toBe(false);const handoff = await configWrite(server, token, { key: "startupContext", value: false });expect(handoff.status).toBe(200);@@ -426,10 +427,10 @@ describe("settings write", () => {let html = "";while (Date.now() < deadline) {html = await readFile(panel, "utf8");- if (html.includes('"messageSummaries":true')) break;+ if (html.includes('"messageSummaries":false')) break;await delay(25);}- expect(html).toContain('"messageSummaries": true');+ expect(html).toContain('"messageSummaries": false');});it("accepts the Story 9.3 settings and validates their values", async () => {@@ -447,7 +448,7 @@ describe("settings write", () => {try {expect(await events.waitFor("retry: 1000")).toBe(true);const token = await panelToken(server);- const reply = await configWrite(server, token, { key: "messageSummaries", value: true });+ const reply = await configWrite(server, token, { key: "messageSummaries", value: false });expect(reply.status).toBe(200);expect(await events.waitFor("event: change")).toBe(true);} finally {@@ -511,7 +512,7 @@ describe("settings write", () => {expect((await configWrite(server, token, { key: "messageSummaries", value: "true" })).status,).toBe(400);- expect((await loadConfig(env)).messageSummaries).toBe(false);+ expect((await loadConfig(env)).messageSummaries).toBe(true);});it("rejects a body that is valid JSON but not an object", async () => {@@ -575,7 +576,7 @@ describe("settings read", () => {ok: true,settings: {recorder: "side",- messageSummaries: false,+ messageSummaries: true,startupContext: true,recordHeadless: false,tryBeforeNotes: true,diff --git a/packages/cli/test/session.test.ts b/packages/cli/test/session.test.tsindex 9acae12..568abdf 100644--- a/packages/cli/test/session.test.ts+++ b/packages/cli/test/session.test.ts@@ -413,6 +413,7 @@ describe("session show", () => {it("shows the language and a compact record without summaries", async () => {await init(root, { name: "p", retention: "keep", language: "tr" }, fakeIo(envFor(dir)));+ await configSet("messageSummaries", "false", fakeIo(envFor(dir)));await sessionShow(root, "s1", io);expect(shown()).toEqual({initialized: true,@@ -446,6 +447,11 @@ describe("session show", () => {it("reports the messageSummaries setting the agent writes by", async () => {await init(root, { name: "p", retention: "keep", language: "auto" }, fakeIo(envFor(dir)));await sessionShow(root, "s1", io);+ // On by default since 1.0.2.+ expect(shown().messageSummaries).toBe(true);++ await configSet("messageSummaries", "false", fakeIo(envFor(dir)));+ await sessionShow(root, "s1", io);expect(shown().messageSummaries).toBe(false);await configSet("messageSummaries", "true", fakeIo(envFor(dir)));diff --git a/packages/cli/test/settings.test.ts b/packages/cli/test/settings.test.tsindex b083336..e369ad7 100644--- a/packages/cli/test/settings.test.ts+++ b/packages/cli/test/settings.test.ts@@ -65,7 +65,7 @@ describe("settings model", () => {const settings = { ...DEFAULT_SETTINGS, language: "tr", updateEveryTurns: 8 };expect(editableSettings(settings)).toEqual({recorder: "side",- messageSummaries: false,+ messageSummaries: true,startupContext: true,recordHeadless: false,tryBeforeNotes: true,