cogit
cogit is a Claude Code plugin and npm CLI that records why code changed. For each user message in a session it keeps a lineage node with decisions, rejected options, commits and status. It links commits to those messages with a `Thought:` git trailer, and renders everything as a local HTML map with `why`, `blame`, `log`, `search` and `pr` commands.
Worth knowing: Changes the agent's instructions or settings. Both Claude reviews found this fine for what it does.
What it can touch
| files | write, including ~/.claude/settings.json, ~/.claude/projects/**/*.jsonl, ~/.claude/plugins/installed_plugins.json, <project>/.claude/settings.json, ~/.config/cogit/ |
|---|---|
| network | evil.example, github.com, nodejs.org |
| shell | runs commands |
| secrets | CONFIG_KEYS |
What it actually does
The plugin registers Stop, SessionStart, SessionEnd, UserPromptSubmit and PreToolUse (Edit/Write/MultiEdit) hooks, each running its bundled `node dist/cli.js`. What it reads and stores: - It reads Claude Code transcripts under `~/.claude/projects` and copies redacted conversation turns into `.cogit/conversations`. - It writes session records under `.cogit/`. What it runs: - It periodically spawns a headless `claude -p --safe-mode` side model (Haiku by default). That model is fed transcript excerpts to write records, Shapes and task suggestions. - It installs `prepare-commit-msg` and `post-commit` git hook blocks. These add `Thought:` trailers to commits and queue Shapes. - It runs a loopback map server on 127.0.0.1. Settings it changes: - `init` edits the user's `~/.claude/settings.json`: it adds `Skill(cogit:record)` to `permissions.allow` and can raise `cleanupPeriodDays`, backing the file up first. - `init` also writes the project's shared `.claude/settings.json`. That enables the plugin, adds the GitHub marketplace `erensrtky/cogit`, and adds a `node -e` UserPromptSubmit guard hook. The guard blocks the first prompt of a session started without the plugin. Sharing (opt-in): when a project chooses to share, records are pushed to the origin remote on separate refs after `git push`, and teammates' records are downloaded. The code shown has no hidden instructions, credential theft, obfuscation or exfiltration.
What the check found
highChanges the agent's instructions or settings
Editing CLAUDE.md, AGENTS.md, memory files, hooks or MCP settings lets a tool keep steering the agent even after it's removed.
packages/cli/src/commands/doctor.ts:352 fix: `check ~/.claude/settings.json is valid, or add ${ctx.agent.skillRule} to permissions.allow`,
mediumChanges the agent's instructions or settings
Editing CLAUDE.md, AGENTS.md, memory files, hooks or MCP settings lets a tool keep steering the agent even after it's removed.
CHANGELOG.md:62 - `cogit init` asks where the session records should live — with a note on what committing `.cogit/` shares — and, below 90 days, whether to keep transcripts lo
CHANGELOG.md:297 - `cogit init` can set the project up for a team (`--project-settings`): it enables the plugin in the project's `.claude/settings.json` and adds a hook that sto
mediumHas a hidden comment that speaks to the agent
HTML comments don't show when Markdown is displayed, but agents read them.
docs/demo/index.html:36 <!-- `cogit build` replaces the empty element with the JSON view model. -->
mediumDownloads programs or archives while running
Files fetched at run time weren't part of this check, and they can change at any time.
package-lock.json:2018 "resolved": "https://registry.npmjs.org/@types/d3-fetch/-/d3-fetch-3.0.7.tgz",
package-lock.json:3175 "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.1.tgz",
mediumChanges the agent's instructions or settings
Editing CLAUDE.md, AGENTS.md, memory files, hooks or MCP settings lets a tool keep steering the agent even after it's removed.
packages/cli/src/agents/claude/settings.ts:275 * Writes the team setup into the project's `.claude/settings.json`, keeping every
mediumRuns code that is built while it runs
eval, exec and new Function run text as code, which makes it hard to know what will actually run.
packages/cli/src/commands/pr.ts:127 const { stdout } = await exec("git", ["-C", root, ...args], { env });
mediumRuns code that is built while it runs
eval, exec and new Function run text as code, which makes it hard to know what will actually run.
packages/cli/src/diff.ts:55 const { stdout } = await exec("git", ["-C", gitRoot, "show", "--format=", "--name-only", sha], {
packages/cli/src/diff.ts:83 await exec("git", ["-C", gitRoot, "rev-parse", "--verify", "--quiet", `${sha}^{commit}`], {
packages/cli/src/diff.ts:105 const { stdout } = await exec("git", args, {
mediumRuns code that is built while it runs
eval, exec and new Function run text as code, which makes it hard to know what will actually run.
packages/cli/src/git.ts:29 const { stdout } = await exec("git", [
packages/cli/src/git.ts:167 const { stdout } = await exec("git", [
packages/cli/src/git.ts:179 const { stdout } = await exec("git", [
mediumRuns code that is built while it runs
eval, exec and new Function run text as code, which makes it hard to know what will actually run.
packages/cli/src/thought.ts:86 await exec("git", [
packages/cli/src/thought.ts:107 const { stdout } = await exec("git", ["-C", dir, "rev-parse", "--absolute-git-dir"], { env });
packages/cli/src/thought.ts:215 const { stdout } = await exec("git", args, {
mediumEdits the user's global Claude Code settings (permission allow-list and transcript retention)
`init` adds `Skill(cogit:record)` to `permissions.allow` in `~/.claude/settings.json`. Since 0.28.1 it does this by default without asking; `--no-allow-skill` and `--yes` avoid it. `init --retention` and doctor's suggested fix change `cleanupPeriodDays`, which keeps transcripts longer. The permission is narrow and a backup is taken. Still, silently widening agent permissions and lengthening transcript retention should be disclosed to users.
packages/cli/src/agents/claude/settings.ts:98 return { ...s, permissions: { ...permissions, allow: [...allow, SKILL_RULE] } };
packages/cli/src/agents/claude/settings.ts:88 return updateSettings(env, stamp, (s) => ({ ...s, cleanupPeriodDays: days }));
CHANGELOG.md:62 - `cogit init` asks where the session records should live — with a note on what committing `.cogit/` shares — and, below 90 days, whether to keep transcripts lo
mediumWrites team-wide project settings: enables the plugin, adds a third-party marketplace and a prompt-blocking hook
The project's `.claude/settings.json` is meant to be committed. Writing it affects everyone who opens the repository. It enables `cogit@cogit` and registers the GitHub marketplace `erensrtky/cogit`. It also adds a `node -e` UserPromptSubmit hook that blocks the first prompt of an attended session missing the plugin and tells the user to install it. The hook only reads stdin and writes a marker in tmpdir, and it lets the second send through. Even so, it pushes a third-party plugin onto teammates.
packages/cli/src/agents/claude/settings.ts:292 enabledPlugins: { ...(settings.enabledPlugins as object), [PLUGIN_ID]: true },
packages/cli/src/agents/claude/settings.ts:295 [MARKETPLACE]: { source: { source: "github", repo: MARKETPLACE_REPO } },
packages/cli/src/agents/claude/settings.ts:228 { hooks: [{ type: "command", command: GUARD_COMMAND, timeout: 5 }] },
mediumInstalls git hooks that rewrite commit messages and run on every commit
cogit adds marked blocks to `prepare-commit-msg` and `post-commit` in the hooks directory git uses. Every commit, human or agent, then runs cogit and gets a `Thought:` trailer appended. The behavior is disclosed and reversible with `cogit hooks uninstall`, and it is central to the tool. Users should still know it keeps running outside Claude Code sessions.
packages/cli/src/thought.ts:87 "interpret-trailers",
CHANGELOG.md:155 - `cogit init` and `cogit hooks install` also add a `post-commit` block now, which queues a Shape after a commit without blocking it; `cogit doctor` flags it wh
mediumReads and copies Claude Code conversation transcripts, and sends excerpts to a side model
The build scans every transcript folder under `~/.claude/projects`, though only this project's sessions are used. It appends redacted user messages and agent replies to a local conversation store. Background and session-end passes feed transcript excerpts to a headless `claude -p` run, which costs tokens on the user's account. Data goes to the same provider the user already uses, but it is a real privacy and cost consideration.
packages/cli/src/agents/claude/transcripts.ts:55 const projectsDir = join(claudeConfigDir(env), "projects");
packages/cli/src/commands/build.ts:178 const appended = await appendConversationTurns(
packages/cli/src/commands/backfill.ts:373 const stdout = await runClaude(prompt, config.sideModel, io.env);
mediumPushes session records to the git remote in the background and pulls teammates' records
When sharing is on, the records (titles, decisions, goals derived from conversations) are sent to origin after each push. Sharing is opt-in ('no answer means no'). Users should know their session content leaves the machine. record-sync.ts was not provided.
CHANGELOG.md:13 - `git push` sends the record of a project that shares it, in the background once the push has landed: it prints how many, never slows or fails the push, and on
CHANGELOG.md:14 - The first time cogit runs in a clone of a shared project it downloads the team's records, and from then on a plain `git pull` brings them. An empty map says w
mediumInstalls git hooks that persist outside the plugin and rewrite commit messages
prepare-commit-msg and post-commit blocks are written into the repo's hooks directory and add a `Thought:` trailer to commits. They stay after the plugin is removed, although the changelog says they do nothing when no CLI is found and `cogit hooks uninstall` removes them. git-hooks.ts was not provided, so the hook body could not be checked.
CHANGELOG.md:155 - `cogit init` and `cogit hooks install` also add a `post-commit` block now, which queues a Shape after a commit without blocking it; `cogit doctor` flags it wh
CHANGELOG.md:326 - The git hooks work without a `cogit` on PATH (a plugin-only install): the hook block falls back to the CLI that installed it, run with `node`, and does nothin
packages/cli/src/thought.ts:92 `${THOUGHT_TRAILER}: ${value}`,
mediumShared records from other people are injected into the agent's context
Hooks return additionalContext built from the record. In a shared project that record includes teammates' sessions downloaded from the remote. A malicious collaborator could plant instructions in a record's decisions or why fields, and the PreToolUse hook would feed them to the agent before it edits a file. This is a cross-user prompt-injection vector.
CHANGELOG.md:312 - `cogit why <file>` follows file → the commits that touched it → their `Thought:` messages → the decisions and rejected alternatives those thoughts recorded, n
packages/cli/src/agents/claude/hooks.ts:51 return { hookSpecificOutput: { hookEventName: event, additionalContext: text } };
mediumExecuted code is a prebuilt bundle on a CI-built branch, not the reviewed source
The marketplace installs from the `plugin` branch, which CI rebuilds, and every hook runs `dist/cli.js`. Neither the bundle nor the build script (scripts/build-plugin-branch.mjs) was provided, so the code users actually run is unverified. Several core modules were also omitted from the bundle.
.claude-plugin/marketplace.json:8 "source": { "source": "github", "repo": "erensrtky/cogit", "ref": "plugin" },
packages/cli/hooks/hooks.json:9 "args": ["${CLAUDE_PLUGIN_ROOT}/dist/cli.js", "hook", "stop"],
Keep an eye on it
This check is of one commit. Watch cogit and we'll email you if a later commit changes what it can touch.
Made this? Add the badge
[](https://plugsday.com/tools/erensrtky-cogit)About this check
Checked November 5, 2026 at commit 3b1de2012e89, 265 files. Rules for known red flags, then two Claude reviews, one of them told to assume the author is malicious. A later commit hasn't been checked. How checks work.