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(settings): call it the side model everywhere and keep CLI-only settings off the panel

Eren9e5740a8c3f8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a23609c..84ba881 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- A setting's "?" explanation now appears on hover or keyboard focus, floating over the settings, instead of opening on a click inside the row and pushing the rest of the list down.
+- The side model has one name everywhere: the panel's "Catch-up model" and "Catch up on session end" are now "Side model" and "Side model at session end", and the CLI and map texts follow.
+- The panel no longer lists Git policy and Agents, which it could not change: the git policy is per project and `cogit config git` without a policy now shows the current project's; `cogit config get` lists both.
- The settings modal has one Save at its bottom instead of one per setting: it saves every changed setting at once, counts the unsaved ones and marks their rows; a value the server refuses keeps its edit and shows why.
## [0.15.0] - 2026-10-27
diff --git a/README.md b/README.md
index 85fdb51..53f6b07 100644
--- a/README.md
+++ b/README.md
@@ -183,7 +183,7 @@ under `gitPolicy: ignore` the description says the hashes resolve only on the au
| `updateEveryTurns` | `15` | Turns between the main agent's record updates |
| `sideEveryTurns` | `5` | Turns between the side model's background records |
| `sessionEndCatchUp` | `true` | Summarize the last messages when a session ends |
-| `sideModel` | `haiku` | Model for the side records and the session-end catch-up |
+| `sideModel` | `haiku` | The side model: records every few turns outside the chat and at session end |
| `messageSummaries` | `false` | A summary on every message, not just every branch |
| `startupContext` | `true` | Hand the agent the previous session's lineage at session start |
| `tryBeforeNotes` | `true` | Tell the agent, before an edit, what earlier thoughts rejected for that file |
diff --git a/packages/cli/src/commands/backfill.ts b/packages/cli/src/commands/backfill.ts
index 5ce2571..f40dc74 100644
--- a/packages/cli/src/commands/backfill.ts
+++ b/packages/cli/src/commands/backfill.ts
@@ -225,11 +225,11 @@ export async function backfillTail(dir: string, sessionId: string, io: Io): Prom
);
} catch (err) {
if (!(err instanceof LockBusyError)) throw err;
- io.out(`catch-up already running for ${sessionId}`);
+ io.out(`the side model is already recording ${sessionId}`);
return;
}
if (turns.length === 0) {
- io.out(`session ${sessionId} has nothing to catch up`);
+ io.out(`session ${sessionId} has nothing left to record`);
// Story 9.3: `recordCommit: auto` still commits what an earlier update wrote.
await maybeAutoCommit(root, sessionId, io.env);
return;
diff --git a/packages/cli/src/commands/config.ts b/packages/cli/src/commands/config.ts
index c26f398..874e9d2 100644
--- a/packages/cli/src/commands/config.ts
+++ b/packages/cli/src/commands/config.ts
@@ -1,4 +1,10 @@
-import { ensureCogitGitignore, ensureGitignore, findGitRoot, type GitPolicy } from "../git.js";
+import {
+ cogitIgnored,
+ ensureCogitGitignore,
+ ensureGitignore,
+ findGitRoot,
+ type GitPolicy,
+} from "../git.js";
import { installGitHooks } from "../git-hooks.js";
import { CliError, type Io } from "../io.js";
import { Config, type RegistryEntry } from "../schema/config.js";
@@ -73,6 +79,16 @@ export async function configSet(key: string, raw: string, io: Io): Promise<void>
io.out(`${name} = ${JSON.stringify(next.data[key])}`);
}
+/** `cogit config git` without a policy: what this project does now, read from its `.gitignore`. */
+export async function configGitShow(dir: string, io: Io): Promise<void> {
+ const { root } = await resolveProjectRoot(dir);
+ const project = await loadProject(root);
+ if (!project.found) throw new CliError(`${root} is not initialized; run \`cogit init\` first`);
+ if (!project.ok) throw new CliError(project.error);
+ const policy: GitPolicy = (await cogitIgnored(root)) ? "ignore" : "commit";
+ io.out(`Git policy for ${project.data.name}: ${policy}`);
+}
+
/**
* `cogit config git commit|ignore` (Story 9.3): switches an existing project.
* Both ignore files are edited; no record file is ever deleted, so switching to
diff --git a/packages/cli/src/program.ts b/packages/cli/src/program.ts
index aa155f7..bd8a286 100644
--- a/packages/cli/src/program.ts
+++ b/packages/cli/src/program.ts
@@ -6,6 +6,7 @@ import { buildProject } from "./commands/build.js";
import {
configGet,
configGit,
+ configGitShow,
configHintOff,
configHintOn,
configPrune,
@@ -338,11 +339,12 @@ export function createProgram(makeIo: IoFactory = processIo, deps: ProgramDeps =
.action(run(async (key: string, value: string) => configSet(key, value, makeIo(false))));
config
.command("git")
- .description("commit or ignore this project's session records (story 9.3)")
- .argument("<policy>", "commit or ignore")
+ .description("show, or switch to commit or ignore, this project's session records (story 9.3)")
+ .argument("[policy]", "commit or ignore; without it, shows the current policy")
.argument("[dir]", "project directory", ".")
.action(
- run(async (policy: string, dir: string) => {
+ run(async (policy: string | undefined, dir: string) => {
+ if (policy === undefined) return configGitShow(dir, makeIo(false));
if (policy !== "commit" && policy !== "ignore")
throw new CliError(`invalid git policy "${policy}"; use commit or ignore`);
await configGit(dir, policy, makeIo(false));
diff --git a/packages/cli/src/view/settings.ts b/packages/cli/src/view/settings.ts
index de2fd82..b3b9a0f 100644
--- a/packages/cli/src/view/settings.ts
+++ b/packages/cli/src/view/settings.ts
@@ -124,20 +124,21 @@ const EDITABLE: FieldSpec[] = [
},
{
key: "sessionEndCatchUp",
- label: "Catch up on session end",
- help: "Record the unrecorded messages when a session ends.",
+ label: "Side model at session end",
+ help: "When a session ends, the side model records the messages still unrecorded.",
details:
- "When a session ends, record whatever nobody got to. It runs outside the chat, so it " +
- "does not spend the session's tokens.",
+ "When a session ends, the side model records whatever nobody got to. It runs outside " +
+ "the chat, so it does not spend the session's tokens.",
kind: "boolean",
},
{
key: "sideModel",
- label: "Catch-up model",
- help: "Model the catch-up and the background records use to summarize.",
+ label: "Side model",
+ help: "The small model that records outside the chat.",
details:
- "The small model the background recorder and the session-end catch-up run. Haiku is " +
- "cheap and good enough for titles, parents and short decisions.",
+ "The small model behind every side record: every few turns in mixed mode, all the " +
+ "time in side mode, and at session end. Haiku is cheap and good enough for titles, " +
+ "parents and short decisions.",
kind: "text",
},
{
@@ -164,10 +165,11 @@ const READ_ONLY: FieldSpec[] = [
{
key: "gitPolicy",
label: "Git policy",
- help: "Whether captures are committed to git; change it per project with `cogit config git`.",
+ help: "What `cogit init` offers a new project: commit the record to git, or ignore it.",
details:
- "Whether the record is committed to git with the code, so a reviewer can follow it, or " +
- "kept out of the repository. It is set per project when you initialize it.",
+ "Only the default for new projects: each project answers it during `cogit init`. " +
+ "`cogit config git` shows the current project's policy and `cogit config git commit` " +
+ "or `ignore` switches it.",
kind: "text",
},
{
@@ -184,16 +186,14 @@ const READ_ONLY: FieldSpec[] = [
/**
* One section today, "Recording", so later groups slot in without a redesign.
* Over `file://` (`canEdit` false) the editable fields still appear, read-only,
- * with the build-time values.
+ * with the build-time values. The CLI-only settings (`READ_ONLY`) stay out of
+ * the panel: they are per project or have one choice, so `cogit config` shows them.
*/
export function settingsSections(canEdit: boolean): SettingsSection[] {
return [
{
title: "Recording",
- fields: [
- ...EDITABLE.map((field) => ({ ...field, editable: canEdit })),
- ...READ_ONLY.map((field) => ({ ...field, editable: false })),
- ],
+ fields: EDITABLE.map((field) => ({ ...field, editable: canEdit })),
},
];
}
diff --git a/packages/cli/test/backfill.test.ts b/packages/cli/test/backfill.test.ts
index 41547bb..1d52bdb 100644
--- a/packages/cli/test/backfill.test.ts
+++ b/packages/cli/test/backfill.test.ts
@@ -207,7 +207,7 @@ describe("backfill --tail", () => {
await initialized(env);
const io = fakeIo(env);
await backfillTail(root, "s1", io);
- expect(io.lines).toEqual(["session s1 has nothing to catch up"]);
+ expect(io.lines).toEqual(["session s1 has nothing left to record"]);
await transcript([typed("first", 1)]);
await sessionWrite({ dir: root }, fakeIo(env), async () =>
@@ -215,7 +215,7 @@ describe("backfill --tail", () => {
);
const again = fakeIo(env);
await backfillTail(root, "s1", again);
- expect(again.lines).toEqual(["session s1 has nothing to catch up"]);
+ expect(again.lines).toEqual(["session s1 has nothing left to record"]);
});
it("exits quietly when another catch-up holds the session lock", async () => {
@@ -228,7 +228,7 @@ describe("backfill --tail", () => {
const io = fakeIo(env);
await backfillTail(root, "s1", io);
- expect(io.lines).toEqual(["catch-up already running for s1"]);
+ expect(io.lines).toEqual(["the side model is already recording s1"]);
expect(await record()).toBeUndefined();
});
diff --git a/packages/cli/test/program-commands.test.ts b/packages/cli/test/program-commands.test.ts
index 72c3f81..88dc325 100644
--- a/packages/cli/test/program-commands.test.ts
+++ b/packages/cli/test/program-commands.test.ts
@@ -139,7 +139,7 @@ describe("commands through the CLI", () => {
await cli("init", root, "--yes", "--retention", "keep");
expect(await cli("backfill", "s1")).toMatch(/--tail/);
expect(await cli("backfill", "s1", "--tail", "-C", root)).toBe("");
- expect(io.lines.at(-1)).toBe("session s1 has nothing to catch up");
+ expect(io.lines.at(-1)).toBe("session s1 has nothing left to record");
});
it("runs session write from a file", async () => {
@@ -298,6 +298,8 @@ describe("commands through the CLI", () => {
expect((await git("log", "-1", "--format=%s")).trim()).toBe("chore(cogit): record CLI session");
expect(await cli("config", "git", "nope")).toMatch(/^error: invalid git policy "nope"/);
+ // Without a policy it reports the current one instead of refusing.
+ expect(await cli("config", "git")).not.toMatch(/invalid git policy/);
expect(await cli("config", "git", "ignore", root)).toBe("");
expect(await readFile(join(root, ".gitignore"), "utf8")).toBe("# cogit\n/.cogit/\n");
});
diff --git a/packages/cli/test/session-git.test.ts b/packages/cli/test/session-git.test.ts
index 816eade..bcfcb3b 100644
--- a/packages/cli/test/session-git.test.ts
+++ b/packages/cli/test/session-git.test.ts
@@ -4,7 +4,7 @@ import { userInfo } from "node:os";
import { join } from "node:path";
import { promisify } from "node:util";
import { beforeEach, describe, expect, it } from "vitest";
-import { configGit, configSet } from "../src/commands/config.js";
+import { configGit, configGitShow, configSet } from "../src/commands/config.js";
import { hooksInstall, hooksUninstall } from "../src/commands/hooks.js";
import { sessionAuthor, sessionWrite } from "../src/commands/session.js";
import {
@@ -270,8 +270,17 @@ describe("ignore files and git hooks", () => {
expect(hook).toContain("cogit hook pre-commit --dir");
expect(await readFile(projectPaths(root).project, "utf8")).toContain('"proj"');
+ await configGitShow(root, io);
await configGit(root, "ignore", io);
await expect(readFile(join(root, ".gitignore"), "utf8")).resolves.toBe("# cogit\n/.cogit/\n");
+ await configGitShow(root, io);
+ expect(io.lines.filter((line) => line.startsWith("Git policy"))).toEqual([
+ "Git policy for proj: commit",
+ "Git policy for proj: commit",
+ "Git policy for proj: ignore",
+ "Git policy for proj: ignore",
+ ]);
+ await expect(configGitShow(join(root, "nowhere"), io)).rejects.toThrow(/not initialized/);
// Switching policy never deletes a record.
await expect(readFile(projectPaths(root).project, "utf8")).resolves.toContain('"proj"');
});
diff --git a/packages/cli/test/settings.test.ts b/packages/cli/test/settings.test.ts
index c2a0300..34b7f72 100644
--- a/packages/cli/test/settings.test.ts
+++ b/packages/cli/test/settings.test.ts
@@ -40,27 +40,23 @@ describe("settings model", () => {
});
});
- it("has one section with every field and edits only the allow-listed keys over http", () => {
+ it("has one section with the editable fields only; CLI-only settings stay off the panel", () => {
const sections = settingsSections(true);
expect(sections.map((section) => section.title)).toEqual(["Recording"]);
const fields = sections[0]?.fields ?? [];
- expect(fields.map((field) => field.key)).toEqual([
- ...PANEL_EDITABLE_KEYS,
- "gitPolicy",
- "agents",
- ]);
+ expect(fields.map((field) => field.key)).toEqual([...PANEL_EDITABLE_KEYS]);
for (const field of fields) {
expect(field.label).not.toBe("");
expect(field.help.length).toBeGreaterThan(10);
// Every field has the longer plain-language "?" text (Story 12.1).
expect(field.details.length).toBeGreaterThan(field.help.length);
- expect(field.editable).toBe((PANEL_EDITABLE_KEYS as readonly string[]).includes(field.key));
+ expect(field.editable).toBe(true);
}
});
it("shows everything read-only over file://", () => {
const fields = settingsSections(false).flatMap((section) => section.fields);
- expect(fields).toHaveLength(PANEL_EDITABLE_KEYS.length + 2);
+ expect(fields).toHaveLength(PANEL_EDITABLE_KEYS.length);
expect(fields.every((field) => !field.editable)).toBe(true);
});
diff --git a/packages/template/src/SessionMap.tsx b/packages/template/src/SessionMap.tsx
index 931b5b0..0ca4673 100644
--- a/packages/template/src/SessionMap.tsx
+++ b/packages/template/src/SessionMap.tsx
@@ -97,7 +97,7 @@ function SessionRow({
{count} message{count === 1 ? "" : "s"}
</span>
{session.unrecordedMessages ? (
- <span className="muted unrecorded" title="The SessionEnd catch-up is off">
+ <span className="muted unrecorded" title="The side model at session end is off">
{session.unrecordedMessages} not recorded
</span>
) : null}
diff --git a/packages/template/src/SidePanel.tsx b/packages/template/src/SidePanel.tsx
index 5ddc745..cb1c244 100644
--- a/packages/template/src/SidePanel.tsx
+++ b/packages/template/src/SidePanel.tsx
@@ -163,8 +163,8 @@ function SessionSummary({ model, session }: { model: LineageViewModel; session:
{session.unrecordedMessages ? (
<Field label="Not recorded">
{session.unrecordedMessages} message
- {session.unrecordedMessages === 1 ? "" : "s"} not recorded (the SessionEnd catch-up is
- off)
+ {session.unrecordedMessages === 1 ? "" : "s"} not recorded (the side model at session
+ end is off)
</Field>
) : null}
</dl>