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.

fix(hooks): tell the agent the Thought trailer is cogit's

Erene7bf1e5fd4ee
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 434b1d9..13c1226 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- A Shape diagram in the message panel keeps legible text: it shrinks to the panel's width but not below half size, and a tall or wide one scrolls inside its box instead of shrinking until the labels cannot be read.
- A message is no longer lost from the record when the side model gets one of its fields wrong, or (in mixed mode) writes a field that belongs to the agent: only that field is left out, and the message keeps its title, summary and the rest.
- A chat that commits into another repository no longer stamps that commit with a `Thought:` trailer the other repository can never resolve: the trailer is added only when the chat runs in the project being committed (or in that working tree).
+- The agent is told at session start that the `Thought:` trailer comes from cogit, so it stops warning you about a line it did not write.
## [1.0.0] - 2026-11-04
### Changed
diff --git a/packages/cli/src/hooks/sessionstart.ts b/packages/cli/src/hooks/sessionstart.ts
index cea36ff..fbdbcef 100644
--- a/packages/cli/src/hooks/sessionstart.ts
+++ b/packages/cli/src/hooks/sessionstart.ts
@@ -166,7 +166,9 @@ async function startupContext(ctx: HookContext): Promise<string> {
`\`${command} search "<text>" -C "${ctx.root}"\`, and one message with ` +
`\`${command} show <ref> -C "${ctx.root}"\` (a ref is a message hash, an h+hex prefix of ` +
`six or more characters, or <session-id>:mN). When the user mentions a message hash or ` +
- `another session's mN, run show before answering.`;
+ `another session's mN, run show before answering. Commits here get a ` +
+ `\`Thought: h…\` trailer from cogit's git hook, naming the message behind them; ` +
+ `it is expected, so leave it in.`;
const sessions = await loadAllSessions(ctx.root, () => {});
const previous = mostRecentOtherSession(sessions, ctx.sessionId);
diff --git a/packages/cli/test/hooks.test.ts b/packages/cli/test/hooks.test.ts
index 7d0a70d..c786425 100644
--- a/packages/cli/test/hooks.test.ts
+++ b/packages/cli/test/hooks.test.ts
@@ -205,6 +205,8 @@ describe("runHook", () => {
};
// No earlier session yet: only the "how to read it" line.
expect(await context("startup")).toContain("cogit records this project's lineage");
+ // The agent must not take cogit's own trailer for something foreign in a commit.
+ expect(await context("startup")).toContain("trailer from cogit's git hook");
expect(await context("resume")).toContain(`log -C "${root}"`);
expect(await context("clear")).toContain("run show before answering");
});