agentleFS
c-w-zc-w-z/commit-decision-record/.agents/skills/trace-decision/SKILL.md

trace-decision

Skill1 starsChanged 5 days agoMITView on GitHub

Use when the user asks the reason for a decision or about an earlier version, or before you overturn a decision. Do not search history for other reasons.

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 6 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the current docs first: Look at the reason, the accepted costs and the rejected options next to the decision.

    line 14
  2. Very specific:

    If the heading changed or the section moved, search for a phrase in all files.

    line 19
  3. Very specific:

    If the file has a new name, add --follow: git log --follow --format='%h %s' -- ':(top)docs/design/architecture.md'.

    line 23
  4. Distinctive:

    Read the comments next to the code.

    line 27
  5. Very specific:

    If the line --- references: not read names a reference that can explain the decision, run the script again with a larger --max-references.

    line 33
  6. Distinctive:

    Use this step when no comment links a design section about the decision, and no changed design section is about it:

    line 36
  7. Distinctive:

    Do not use git log --first-parent.

    line 41
  8. Distinctive:

    Keep the current reason and accepted costs (from the docs) separate from the reason and costs at that time (from commits).

    line 45
  9. Very specific:

    If the question is about a downside, say if a design doc or a Cost: line lists it.

    line 46
  10. Very specific:

    Commit: give its hash and author date.

    line 49
  11. Distinctive:

    Before you overturn a decision, give the user what you found.

    line 54
  12. Very specific:

    After the maintainer decides, update the docs as docs/doc-rules.md says.

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Find the reason for a decision

Docs show only the current state. Commit bodies show why a decision changed (see History and Commits in CONTRIBUTING.md).

  • Old content in history is not the current decision. Do not act on it.

Steps

  1. Read the current docs first. Look at the reason, the accepted costs and the rejected options next to the decision. These usually answer the question.
  2. Find the history of a doc section:
    git log --format='%h %ad %s' --date=short -L '/^## Modules/,/^## /:docs/design/architecture.md'
    If the heading changed or the section moved, search for a phrase in all files. Replace <phrase> with a quoted sentence from the section. :(top) makes the path start at the repo root:
    git log --format='%h %ad %s' --date=short -S <phrase> -- ':(top)docs'
    If the file has a new name, add --follow: git log --follow --format='%h %s' -- ':(top)docs/design/architecture.md'.
  3. Find overturned decisions: git log --grep='^Supersedes:' --format='%h %s%n%b'.
  4. Read each commit that you found: git show --stat <hash>. Read the Why, Rejected, Cost, Evidence and Supersedes lines and the change.
  5. Go from code to design:
    1. Read the comments next to the code. If a comment links a design section, follow it with step 2 (Find the history of a doc section).
    2. Collect the sources of all lines of the decision. The lines of one decision can come from more than one commit. The script prints each commit with its lines, its full message and its design doc diff. Through gh, it also prints the pull request of each commit, with the body, the other commits and the design doc diff. It also prints the issues and comments that they name. Its --help text gives the parameters and the exit codes. The command finds the script from the repo root, and <file> is a path from the current directory:
      node "$(git rev-parse --show-toplevel)/tools/trace-decision/collect.mjs" <file> <start> <end>
      If the script exits with 1, fix the input. If it exits with 2, each status line --- <source>: not read marks one source that you did not read. A line --- <source>: not read in full marks a source that you read only in part. A line --- pull request: not confirmed means that the script could not confirm which pull request contains the commit. The evidence of such a pull request can still be in a candidate pull request block. A line --- github: not read means that the script read only Git. Only these status lines give the status. The text from Git and GitHub has 4 spaces before each line. The other sources in the same block are read. If the line --- references: not read names a reference that can explain the decision, run the script again with a larger --max-references.
    3. Judge each block, the commits first. A commit or a pull request can also do more than the decision in the code. Its Why and its changed design sections can be about a different decision. If a changed section is about the decision, follow it with step 2 (Find the history of a doc section). Follow a reference that explains the decision. You do not need to read every source that a pull request names. A candidate pull request block holds a pull request that the script could not confirm for a commit. Its evidence can be about a different change. If you give a reason from it, say that the pull request is not confirmed.
    4. Use this step when no comment links a design section about the decision, and no changed design section is about it:
      • Report the sources that you read: the comment, the commits, and the pull requests, issues and comments.
      • Say that none of them links a design section about the decision. Do not say that no design section exists.
      • Give each reason that is about the decision: from the Why of a commit, a pull request, an issue or a comment. If none is about it, say that the sources that you read do not give the reason.

Do not use git log --first-parent. It hides the commits inside a merged PR.

Report

  • Keep the current reason and accepted costs (from the docs) separate from the reason and costs at that time (from commits).
  • If the question is about a downside, say if a design doc or a Cost: line lists it.
  • Cite each reason and cost by source:
    • Design doc: link the section. For a code comment, give its file path and line.
    • Commit: give its hash and author date. Use the date in the collector output. If it is missing, use git show -s --format=%ad --date=short <hash> if the commit is local. Otherwise, say that the date is unknown.
    • Pull request or issue: link its URL. For an issue comment or review comment, link the URL of that comment, not the discussion page.
  • A commit can have no reason or no Cost: line. In that case, say that you did not find it. Do not conclude that the author accepted or missed a downside. Do not give a guess from the diff as a fact.
  • Report each source that the script of step 5 marks as "not read" as not read, and each source that it marks as "not read in full" as read in part. Do this also when you found a design section.
  • For a commit whose pull request is "not confirmed", say that its pull request is not known. Report what you read from each candidate pull request apart from that.
  • Before you overturn a decision, give the user what you found. The maintainer decides.
  • After the maintainer decides, update the docs as docs/doc-rules.md says. Put Supersedes: in the commit body.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.