@cogit/cli

中文文档
1.3.1发布于 2026/11/09MITES Module零依赖近 30 天下载 7152

Git for the intent behind agent-written code.

原始使用文档
文档目录7 节
  1. Why
  2. See it
  3. What it does
  4. Install
  5. Quick start
  6. Guide
  7. Licence

cogit

cogit

Git for the intent behind agent-written code.

René Descartes with git branches running through his hair
Cogito, ergo commit.

cogit records every message you send to an AI coding agent as a thought commit: what you asked, what came of it, and the message it answered. Your code commits point back to the thought behind them, so cogit why takes any line of code back to the reason it exists. It works with Claude Code today.

Agent memory helps your agent remember. cogit helps you understand.

It runs as a Claude Code plugin and works through Claude Code hooks, so the record is written while you work, not reconstructed from the diff afterwards.

Click through a saved map: no install, no server. It's the page cogit open writes, built from sample data and read-only.

Why

I started by copying code out of ChatGPT, then moved to browser tools, editor extensions and now terminal agents. Each step moved the code further from me, and I kept feeling something was slipping away. When you write code yourself, it sinks in bit by bit: you know why that table exists and why you wrote that class. When an agent writes it, that feeling goes away.

The information isn't really gone. It sits in your messages, the agent's replies and your commits, just in separate places. cogit ties them together, so you can always walk back and see why something was done. It helps most when you juggle projects: I run 5-10 agents at once across 2-3 of them, and a few minutes later I can lose track of what I did where.

A conceptual chart from machine code to software factories: abstraction keeps rising, while how much of the why you can still trace falls sharply once AI starts writing code. cogit keeps what falls away.

It's bigger than one person's memory: a reviewer sees what changed, not why. More, with research and sources.

cogit isn't:

  • Agent memory (OpenViking, Mem0): that helps your agent recall what you talked about.
  • A token saver (RTK, Headroom): that sends the model less.
  • A code map (graphify): that shows how a codebase fits together.
  • An orchestrator (Herdr, Conductor): that runs many agents at once.
  • A planning framework (BMAD, Spec Kit): that decides what to build next.
  • An AI review bot (CodeRabbit, Greptile): that comments on whether a diff looks right.

It answers the one question they leave open: why is this code the way it is? I use several of them alongside it.

See it

The map: sessions as a git graph, each with its messages, branches, commit chips and a left off here marker

Your sessions as a git graph — one row per message, the decision behind it, and where you left off.

A message opened on its Shape tab: a flowchart of what the change does, under the tabs Intent, Shape and Code

A message that landed commits opens as Intent, Shape and Code: why it happened, a picture of what the change does, and the diff.

The Tasks panel: suggested items with Accept and Dismiss, open items with Done, and a Done section

Tasks — work that came up in a session and didn't get finished, caught when the session closes. You accept, dismiss or close each one.

The Files view: a changed file opened, listing the messages that touched it with each message's reason and the option it rejected

A changed file opens its history: every message that touched it, and the reason behind each — including the option that was rejected.

What it does

  • Every message becomes a thought commit: the question, the outcome, the decisions with their reasons and the options that were rejected, and which earlier message it continues.
  • A map of your sessions: a git graph of your conversations with branches, decisions, a "Your turn" inbox, and Resume and Fork buttons that copy the command to reopen a chat or continue it as a new one.
  • Commits point back to their reason: a Thought: trailer on each commit; cogit show <sha>, cogit blame and cogit why follow it back.
  • Intent, Shape, Code: a message that landed commits shows why it happened, a small picture of what the change does (a diagram, a before/after or interface table, an example or plain steps), and the diff, in one place.
  • Tasks: when a session ends, a small model catches the work that came up and didn't get finished as a few user-level items; you accept, dismiss or close them (cogit captures, and on the map).
  • Pull request descriptions with the decisions: cogit pr writes the goal, the decisions and the rejected options, never the raw chat. cogit pr --install-action adds a GitHub Action that posts them on every pull request.
  • Teams share the record through git: after a pull, your teammates' sessions are on the map too, with who ran them and what changed most.
  • The agent's own reasons, or the cheapest record: a small model records in the background and never interrupts the agent. By default, when a session ends, the model it ran on reopens the whole conversation and corrects the record with what only it saw, for about one more message. Economical leaves it all to the small model: under 2 cents per 20 messages in our measurement.
  • No server, no account: it runs on your machine. Nothing leaves it unless you say so: cogit init asks whether to share the record (titles, decisions and reasons) with your team. If you do, git push sends it to your own repository, outside your branches, so it never shows up in a pull request or git status. Your chats stay local, cogit prune deletes old sessions, and key and token patterns are redacted.
  • The agent gets the context too: a new session starts where the last one left off, and before editing a file the agent hears what was already tried and rejected there. It works alongside memory tools; it doesn't replace them.

Install

You need Node 22.13+, Claude Code 2.1.275+ and a git repository.

npm install -g @cogit/cli

Then, in Claude Code:

/plugin install cogit --marketplace erensrtky/cogit

To get plugin updates on their own, turn on auto-update once: /plugin → Marketplaces → cogit → Enable auto-update. Claude Code leaves it off for marketplaces outside its own.

If the map stays empty, run cogit doctor.

Quick start

cd your-project
cogit init        # a few questions: git, transcript retention, team setup, language

Work with Claude Code as usual; recording needs nothing from you. Then open the map:

cogit open .

Guide

The record format is in docs/format.md.

Licence

MIT — see LICENSE.

版本与发布记录

@cogit/cli 共发布 38 个版本,首次发布于 2026/10/28;过去 12 个月发布了 38 个版本。

版本发布日期距今
1.3.1latest2026/11/091 天前
1.3.02026/11/091 天前
1.2.12026/11/091 天前
1.2.02026/11/072 天前
1.1.02026/11/073 天前
1.0.12026/11/064 天前

关于 @cogit/cli 的常见问题

@cogit/cli 是什么?

Git for the intent behind agent-written code.

如何安装 @cogit/cli?

在项目目录运行 npm install @cogit/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 cogit,可以用 npx cogit 直接运行。

@cogit/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cogit__cli 是否存在。

@cogit/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cogit/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cogit/cli 可以商用吗?

@cogit/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cogit/cli 的下载量有多少?

根据 npm 官方下载统计,@cogit/cli 在 2026/10/11 – 2026/11/09 这 30 天内被下载 7,152 次,日均约 238 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cogit/cli 还在维护吗?

最新版本 1.3.1 发布于 2026/11/09(1 天前);至今共发布 38 个版本,其中过去 12 个月发布了 38 个;首次发布于 2026/10/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。