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.

2.4 KB
Raw Blame

Pull requests

A reviewer reading a diff sees what changed, not why. cogit pr turns a branch into a description with the goal, the decisions behind the code and the options that were rejected.

On the branch, before opening the pull request:

cogit pr main --copy   # Markdown on stdout, also copied to the clipboard

Without a base it uses the branch's upstream merge base, else main, else master. Paste the output into the pull request description on github.com, or with the GitHub CLI:

gh pr create --body "$(cogit pr)"

What it prints

The goal, the sessions the work came from, each message with its decisions and rejected options, and its commits and files. For example:

## Goal
- Add refresh-token rotation — Refresh tokens (9c32ab18)

## Sessions
Open a whole session with `cogit log --session <id>` or the map.
- Refresh tokens (9c32ab18) · m12–m29 · 2026-10-24 09:12 → 2026-10-24 11:40

## Thoughts

### `hb7a9882` 9c32ab18:m24 — Rotate refresh tokens on use

- Why: A leaked refresh token should stop working as soon as it is used.
- Decided by: agreed
- considered and rejected: shorten the token lifetime — it logs people out too often

Commits:
- `a1b2c3d` feat(auth): rotate refresh tokens on use
  - `src/auth/tokens.ts`

## Commits without a recorded thought
- `e4f5a6b` chore: bump deps — thought `h9c8b7a6` not recorded yet

## Dig deeper
- `cogit show <message-hash>` opens a thought: its decisions, the options it rejected, and the conversation turn for whoever has it locally.
- `cogit show <sha>` opens the thought behind a commit.
- This project shares its record, so a reviewer with cogit in their clone gets the same `cogit show` output once the author has pushed.

Safe on a public pull request

cogit pr reads only the record's titles, summaries and decisions, never the conversation text or your prompts as written.

For the reviewer

In a project that shares its record, a reviewer with cogit installed can run cogit show <hash> or open the map on the same messages once the author has pushed. A pull request from a fork is the exception: the record went to the fork, so its hashes resolve only there. In a project that keeps its record private, the description says the hashes resolve only on the author's machine.

cogit does not promise a faster review; nothing has measured that yet. It hands the reviewer the intent they would otherwise have to ask for in comments.