magus v0.4.3 is out. See what's new
¶ View generated markdown
6 min read

magus-commit-composition

Short form: 3824 bytes, 13% smaller than the full form's 4432.

Restructure an UNPUSHED branch so each commit is one reviewable idea, using the workspace's own boundaries (project ownership, declared outputs, blast radius) rather than guessing from paths. Use when a branch has accumulated commits in the order the work occurred, before opening a PR, when asked to reconsolidate/squash/reword/clean up commits, or when a reviewer would meet a rename split across commits and a fix buried in a regeneration. Do NOT use on pushed commits, and do NOT use it to write a single message - that is idiomatic-commit-messages; this decides what goes IN each commit.

Install it, rather than copying from this page:

magus agent install .claude/skills   # writes both forms below

An installed copy carries a provenance stamp, so magus doctor can tell you when a magus upgrade has made it stale. Text copied from this page carries none.

What an installed copy carries

magus agent install writes this frontmatter above the body. magus doctor reads it to report whether your installed skills are current.

field value
license GPL-3.0-or-later
compatibility any-agent
source magus
agent-skill-version 88
knowledge-schema-version 15
skill-content 82ac2b6e8eb1
skill-variant full

The skill-content digest covers this skill alone, and both forms below report it: they go stale together, never one silently, and a change to another skill does not move it.

The two forms

Both are hand-authored from one source body. The short form is the always-loaded primary - the enumeration dropped, the judgment kept, for the most capable readers rather than the least. The full form is its <name>-full twin, loaded by name when a reader wants the rationale. The bar above shows how much shorter the primary is; switch between them here to see exactly what it gave up. See Skills for how to choose.

magus agent install --tar | tar -xO -f - magus-commit-composition/SKILL.md
# Composing unpushed commits into reviewable chunks

A reviewer reads commits, not diffs. Work committed in the order it occurred to
you arrives as a log nobody can review: a rename spread over four commits, a fix
buried in a regeneration, notes-to-self between two real changes. This decides
what belongs in each commit so every one is a single idea a reviewer can accept
or reject on its own.

The workspace already models its own boundaries. Use that rather than guessing
from directory names.

magus does not rewrite history for you. It tells you where the seams are and
proves afterwards that nothing was lost; your VCS performs the edit.

## Two constraints that decide most groupings

**Only unpushed work is eligible.** Published commits are fixed. Establish what
is unpushed before planning anything.

**Generated output belongs with the source that moved it.** This is not
cosmetic: split them and the source commit fails its own drift gate.

```sh
magus describe file <changed-path>...
```

Every `output` path joins the `source` change that invalidated it. A commit whose
whole content is regeneration means that pairing was missed - fold it into the
change that caused it.

## Ask the workspace where the seams are

```sh
magus ls                             # the projects: the coarsest real boundary
magus describe project <path>        # its declared sources, outputs, depends_on
magus affected --impact              # what a candidate group actually reaches
magus refs <symbol> --occurrences    # every site of a rename, uncapped
```

Three signals, strongest first:

- **Project ownership.** Changes in projects with no dependency edge between them
  are separate commits. Read the edges from `magus describe project`.
- **Blast radius.** Candidate groups that reach disjoint project sets are
  genuinely separable; groups that reach the same set usually want to be one
  commit.
- **Symbol coupling.** A rename's sites belong together however many directories
  they span.

## Where this stops

**Two changes inside one file cannot be separated by path.** A file carrying both
a rename and a behavior fix needs hunk-level work or the honest admission that
they ship together. Recognize it while planning.

Prefer the cheapest operation that makes the branch reviewable. In rising order
of risk: reword a message, fold a regeneration into its neighbor, drop a commit
whose content the final tree does not keep, reorder independent commits, split
one commit into several.

## Before you start, and after you finish

Record the identity of the state you are about to rewrite:

```sh
magus vcs checkpoint          # revision, branch, dirty flag, patch digest; writes nothing
```

Then restructure with your VCS. When it stops on a conflicted generated file,
settle it with magus rather than by hand:

```sh
magus vcs resolve             # settles the conflicted declared outputs, regenerates once
```

**Prove the content survived.** A restructure must change history and nothing
else, and a lost commit still leaves a tree that builds:

```sh
magus graph diff --rev <checkpoint-revision>
```

Everything it reports must be a change you intended. Nodes missing that you did
not remove mean the restructure dropped work: return to the recorded revision and
start again rather than reconciling by hand.

Finish by staging through the workspace's own declarations and re-running the
gate:

```sh
magus vcs add
magus affected ci
```

## What does not belong in a commit at all

Session notes and scratch plans are not repository content unless the repository
already tracks them. Untracked session state belongs in the
repository's memory, not the branch.

## See also

- **magus-vcs-hygiene** - classifying paths and staging one commit safely.
- **magus-memory** - where session notes live instead of the branch.
magus agent install --tar | tar -xO -f - magus-commit-composition-full/SKILL.md
# Composing unpushed commits into reviewable chunks

A reviewer reads commits, not diffs. Work committed in the order it occurred to
you arrives as a log nobody can review: a rename spread over four commits, a fix
buried in a regeneration, notes-to-self between two real changes. This decides
what belongs in each commit so every one is a single idea a reviewer can accept
or reject on its own.

The workspace already models its own boundaries. Use that rather than guessing
from directory names.

magus does not rewrite history for you, the same way it reports what a
change affects without editing it. It tells you where the seams are and
proves afterwards that nothing was lost; your VCS performs the edit.

## Two constraints that decide most groupings

**Only unpushed work is eligible.** Published commits are fixed. Establish what
is unpushed before planning anything; a branch with no upstream has
published nothing.

**Generated output belongs with the source that moved it.** This is not
cosmetic: split them and the source commit fails its own drift gate.

```sh
magus describe file <changed-path>...
```

Every `output` path joins the `source` change that invalidated it. A commit whose
whole content is regeneration means that pairing was missed - fold it into the
change that caused it.

## Ask the workspace where the seams are

```sh
magus ls                             # the projects: the coarsest real boundary
magus describe project <path>        # its declared sources, outputs, depends_on
magus affected --impact              # what a candidate group actually reaches
magus refs <symbol> --occurrences    # every site of a rename, uncapped
```

Three signals, strongest first:

- **Project ownership.** Changes in projects with no dependency edge between them
  are separate commits. Read the edges from `magus describe project`,
  which frequently disagrees with what the directory layout suggests.
- **Blast radius.** Candidate groups that reach disjoint project sets are
  genuinely separable; groups that reach the same set usually want to be one
  commit.
- **Symbol coupling.** A rename's sites belong together however many directories
  they span. If refs reports a project not-indexed, run `magus graph
  build` first - `unknown, not absent` is not an empty result.

## Where this stops

**Two changes inside one file cannot be separated by path.** A file carrying both
a rename and a behavior fix needs hunk-level work or the honest admission that
they ship together. Recognize it while planning; discovering it
mid-restructure turns a cleanup into a recovery.

Prefer the cheapest operation that makes the branch reviewable. In rising order
of risk: reword a message, fold a regeneration into its neighbor, drop a commit
whose content the final tree does not keep, reorder independent commits, split
one commit into several. Most branches need only the first three.

## Before you start, and after you finish

Record the identity of the state you are about to rewrite:

```sh
magus vcs checkpoint          # revision, branch, dirty flag, patch digest; writes nothing
```

Then restructure with your VCS. When it stops on a conflicted generated file,
settle it with magus rather than by hand:

```sh
magus vcs resolve             # settles the conflicted declared outputs, regenerates once
```

**Prove the content survived.** A restructure must change history and nothing
else, and a lost commit still leaves a tree that builds - which is why
a green suite is not evidence here:

```sh
magus graph diff --rev <checkpoint-revision>
```

Everything it reports must be a change you intended. Nodes missing that you did
not remove mean the restructure dropped work: return to the recorded revision and
start again rather than reconciling by hand.

Finish by staging through the workspace's own declarations and re-running the
gate:

```sh
magus vcs add
magus affected ci
```

## What does not belong in a commit at all

Session notes and scratch plans are not repository content unless the repository
already tracks them - check the path's history on the base branch
before assuming either way. Untracked session state belongs in the
repository's memory, not the branch, and dropping those commits is
often the single largest reduction available.

## See also

- **magus-vcs-hygiene** - classifying paths and staging one commit safely.
- **magus-memory** - where session notes live instead of the branch.
generatedinternal/agent/skills/magus-commit-composition/SKILL.mdagentsskillsmagus-commit-composition
Last updated (c5971189)
Earlier changes on this page (7)

Full history ↗ · Blame source ↗

Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. See workspace.

Project

A directory magus recognizes as a unit of work (it has a magusfile); the unit of caching, scheduling, and dependency tracking. See workspace.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Ward

A coded diagnostic that inspects a resolved op and nudges or blocks an anti-pattern before it runs. See wards.

Affected

The set of projects touched by a change; magus affected <target> runs a target only over them. See affected.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Span

OpenTelemetry's name for one unit of work under a trace - a target execution, whose sub-operations are child spans. An output reference points at a span's captured output. See telemetry.

Ownership

An insight lens: author concentration - the primary author and their share, the distinct-author count (the bus factor), and abandonment. See insight.

Session

An agent host's conversation, by the id the host delivers to its hooks. magus never mints one: a record with no session is unattributed, and the OS user it carries says whose account ran it.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate.

Pane

A split within a tab. Splitting divides the focused pane along its longer side, so the same action tiles side-by-side on a desktop and stacks on a phone; a tab with no split is a single pane. Drag the divider to re-weight the split. See reference/console.

Conventions

Placeholders

Angle brackets mark a value you replace with your own - never type the brackets:

magus run <target>
magus completion <shell>    # e.g. bash, zsh, fish

<target>, <path>, <shell>, <name> and the like are stand-ins, not literal text.