commit

A command that creates one local Git commit containing reviewed working-tree changes. Git is the version-control system used to track code changes and commits.

In plain words
What is it for?
It is for reviewing intended changes, staging only the correct files, creating the commit, and checking the result afterward.
Why use it?
It checks the repository and staging area first, helping prevent unrelated files, partial changes, or possible secrets from being included.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/zhangshenao/harness9/commit
Clone the repo
git clone --depth 1 https://github.com/ZhangShenao/harness9
Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,843 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00008 $0.01843
Opus 5 $0.00004 $0.00922
Sonnet 5 $0.00002 $0.00369
Haiku 4.5 $0.00001 $0.00184

Measured 2d ago against content hash 687dafd147e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

commit scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

chmod 700 "$AUDIT_DIR"
.opencode/commands/commit.md · 164 lines

How it starts

The opening of the file, as written. The whole thing — 164 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Commit Reviewed Changes

Overview

Create one local commit containing only the intended, reviewed changes. Treat review, exact staging, and post-commit evidence as mandatory gates even when asked to hurry or bypass them.

Workflow

  1. Inspect the repository before changing Git state:

    git status --porcelain=v1 -z --untracked-files=all
    git diff --stat
    git diff --cached --stat
    git log -10 --pretty=format:'%s'
    

    Derive the intended file set from the current task. Parse the NUL-delimited status as Git's XY record, not by splitting filenames. Before any staging:

    • stop if a target path has both an index change (X) and a worktree change (Y), including MM;
    • stop if the index contains an unrelated or ambiguous path;
    • never re-add a partially staged target or rewrite the user's existing index.

    Ask the user to resolve ambiguity. Never equate "all changes" with the intended scope.

  2. Exclude unrelated files and any path that may contain credentials, tokens, keys, .env data, or other secrets. Do not inspect a suspected secret merely to decide whether to stage it; report the path and leave it untouched.

  3. Stage each unstaged intended file with literal pathspec semantics:

    git --literal-pathspecs add -- "$path"
    

    Pass exactly one explicit file path per invocation. Never use plain git add -- "$path" because names such as :(glob)* are pathspec magic. Never use git add -A, git add ., git add -u, a directory, or a glob.

  4. Audit the index and reject an empty staged diff:

    git diff --cached --name-status
    git diff --cached --stat
    git diff --cached --check
    

    Compare the staged paths with the intended reviewed set. Commit only when they match exactly and the staged diff is non-empty.

  5. Record the exact candidate commit before final review:

    AUDIT_DIR=
    cleanup_audit() {
      [ -n "$AUDIT_DIR" ] || return 0
      if ! python3 - "$AUDIT_DIR" <<'PY'
    import os
    import stat
    import sys
    
    audit_dir = sys.argv[1]
    descriptor = os.open(
        audit_dir,
        os.O_RDONLY
        | getattr(os, "O_DIRECTORY", 0)
        | getattr(os, "O_NOFOLLOW", 0),
    )
    for name in ("expected-paths", "current-paths", "actual-paths"):
        try:
            metadata = os.stat(
                name,
                dir_fd=descriptor,
                follow_symlinks=False,
            )
        except FileNotFoundError:
            continue
        if not stat.S_ISREG(metadata.st_mode):
            raise SystemExit("unexpected audit artifact type")
        os.unlink(name, dir_fd=descriptor)
    os.close(descriptor)
    os.rmdir(audit_dir)
    PY
      then
        return 1
      fi
      test ! -e "$AUDIT_DIR" || return 1
      AUDIT_DIR=
    }
    trap cleanup_audit EXIT
    trap 'exit 129' HUP
    trap 'exit 130' INT
    trap 'exit 143' TERM
    previous_umask=$(umask)
    umask 077
    AUDIT_DIR=$(mktemp -d)
    umask "$previous_umask"
    chmod 700 "$AUDIT_DIR"
    test "$(stat -f '%Lp' "$AUDIT_DIR" 2>/dev/null || stat -c '%a' "$AUDIT_DIR")" = 700
    BASE_HEAD=$(git rev-parse HEAD)
    EXPECTED_TREE=$(git write-tree)
    git diff --cached --name-only -z --no-renames > "$AUDIT_DIR/expected-paths"
    

Read the full file on GitHub · 164 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 164 lines · 8 tokens per session scan B 687dafd147e4

Subscribe to this mod's changes

commit is a command published in the GitHub repository ZhangShenao/harness9 (135 stars, last pushed 2d ago), licensed MIT. It adds 8 tokens to every session and 1,843 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.