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
revert: keep record-sync hidden and out of the docs
Erenabc338ee46e7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c41a705..e221bba 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,9 +5,6 @@ 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-- `cogit record-sync send` is now listed in `cogit --help` and says what it did: how many session records it sent, and what is still queued and why. It sends the queue from your terminal, so an SSH key with a passphrase can be answered there.-### Fixed- A `prepare-commit-msg` hook of your own that sets its own `trap ... EXIT` or ends with `exec` no longer drops the `Thought:` trailer: cogit now runs your lines as a child and adds the trailer once they finish. Existing hooks update on the next chat message.- With an SSH key that has a passphrase and no ssh-agent, the records that follow a push are no longer lost: the background send used to retry the remote every 3 seconds for 10 minutes (each a failed login) and then drop them. It now stops at the first failure and keeps them queued, and `cogit doctor` says to add the key to ssh-agent or run `cogit record-sync send` from a terminal.diff --git a/docs/guide/teams-and-git.md b/docs/guide/teams-and-git.mdindex 1d57a57..6b3ebab 100644--- a/docs/guide/teams-and-git.md+++ b/docs/guide/teams-and-git.md@@ -36,8 +36,7 @@ pages, which also means the record cannot be read there: reading it takes cogit.- **Sending:** `git push` to `origin` (or your only remote) prints how many records will follow,and they go in the background once the push has landed. It never slows the push, never asksfor anything and never fails it. A rejected push sends nothing, and neither does `git push --dry-run`: cogit reads it from the running `git` on Linux and macOS. On Windows a `--dry-run` with nothing new to push still sends. What could not- be sent stays queued, the next session start tries again, and `cogit doctor` tells you why;- `cogit record-sync send` sends the queue right away.+ be sent stays queued, the next session start tries again, and `cogit doctor` tells you why.Pushing to any other remote, such as a deploy target, sends nothing.- **Receiving:** the first time cogit runs in a clone, it adds one fetch line to that clone's`.git/config` and downloads the team's records, showing progress in a terminal. After that adiff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.mdindex d686eac..58e7bff 100644--- a/docs/guide/troubleshooting.md+++ b/docs/guide/troubleshooting.md@@ -25,10 +25,9 @@ cogit ties its record to commits, so it needs git. Run `git init` (or work in aIn a project that shares its record, they arrive in two steps: they send with `git push`, youreceive with `git pull`, and cogit shows them the next time it runs. If they still do not appear,run `cogit doctor` on both machines: its record line says when a send or download failed and-why. An SSH key that needs a passphrase has to be in `ssh-agent` (`ssh-add`), since the record is-sent in the background where nothing can ask for it; without the agent, `cogit record-sync send`-sends what is queued from your terminal, asking for the passphrase there. If your project keeps-its record private, nothing is shared; `cogit config git` shows which it is.+why. An SSH key that needs a passphrase has to be in `ssh-agent`, since the record is sent in the+background where nothing can ask for it. If your project keeps its record private, nothing+is shared; `cogit config git` shows which it is.## Nothing is recordeddiff --git a/packages/cli/src/program.ts b/packages/cli/src/program.tsindex 6452334..526a9e1 100644--- a/packages/cli/src/program.ts+++ b/packages/cli/src/program.ts@@ -31,13 +31,7 @@ import { isGitHookEvent, runGitHook } from "./git-hooks.js";import { runHook } from "./hooks/run.js";import { CliError, type Io, processIo } from "./io.js";import { prepareRecords } from "./record-prepare.js";-import {- downloadRecords,- reconcileRecords,- recordSyncStatus,- sendAfterPush,- sendRecords,-} from "./record-sync.js";+import { downloadRecords, reconcileRecords, sendAfterPush, sendRecords } from "./record-sync.js";import { startMapServer } from "./server.js";import { takeMigrationWarnings } from "./store/migrate.js";import { projectPaths } from "./store/paths.js";@@ -740,27 +734,19 @@ export function createProgram(makeIo: IoFactory = processIo, deps: ProgramDeps =}),);- // Started detached by the pre-push hook (send-pushed) and by SessionStart; a person- // runs `send` when a background send cannot ask for an SSH passphrase.+ // Started detached by the pre-push hook and by SessionStart.program- .command("record-sync")- .description("send the queued session records now, or download the team's")- .argument("<action>", "send or download")- .addOption(new Option("--after <ref=sha>").hideHelp())+ .command("record-sync", { hidden: true })+ .description("send the queued session records, or download the team's")+ .argument("<action>", "send, send-pushed or download")+ .option("--after <ref=sha>", "with send-pushed: wait until the remote holds this").option("-C, --dir <dir>", "project directory", ".").action(run(async (action: string, opts: { dir: string; after?: string }) => {const io = makeIo(false);const { root } = await resolveProjectRoot(opts.dir);- if (action === "send") {- const sent = await sendRecords(root, io.env);- const left = await recordSyncStatus(root, io.env);- io.out(`sent ${sent} session record${sent === 1 ? "" : "s"}`);- if (left.pending > 0)- throw new CliError(- `${left.pending} still queued${left.sendError === undefined ? "" : `: ${left.sendError}`}`,- );- } else if (action === "send-pushed") await sendAfterPush(root, io.env, opts.after);+ if (action === "send") await sendRecords(root, io.env);+ else if (action === "send-pushed") await sendAfterPush(root, io.env, opts.after);else if (action === "download") {await downloadRecords(root, io.env);await reconcileRecords(root, io.env);diff --git a/packages/cli/test/program-commands.test.ts b/packages/cli/test/program-commands.test.tsindex 7da702a..10234fe 100644--- a/packages/cli/test/program-commands.test.ts+++ b/packages/cli/test/program-commands.test.ts@@ -7,7 +7,6 @@ import { promisify } from "node:util";import { beforeEach, describe, expect, it } from "vitest";import { readSkillAllowed } from "../src/agents/claude/settings.js";import { createProgram } from "../src/program.js";-import { queueRecords } from "../src/record-sync.js";import { globalPaths } from "../src/store/paths.js";import { loadConfig, loadProject, loadSession } from "../src/store/stores.js";import { envFor, type FakeIo, fakeIo, noGitDir, noGitProject, T0, tempDir } from "./helpers.js";@@ -332,12 +331,6 @@ describe("commands through the CLI", () => {// No remote to send to: the hook is silent.await cli("hook", "pre-push", "--dir", root, "origin", "nowhere");await cli("record-sync", "send", "-C", root);- expect(io.lines.at(-1)).toBe("sent 0 session records");- // A remote the records cannot reach: the person sees what is still queued, and why.- await git("remote", "add", "origin", join(dir, "gone.git"));- await queueRecords(root, io.env);- expect(await cli("record-sync", "send", "-C", root)).toMatch(/1 still queued: /);- await git("remote", "remove", "origin");await cli("record-sync", "download", "-C", root);expect(await cli("record-sync", "elsewhere", "-C", root)).toMatch(/unknown record-sync action/);await cli("config", "git", "share", root);