zagi

作者 mattzcarey已验证

better git cli for agents

290
Stars
14
Forks
Zig
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/mattzcarey/zagi

快速入门

使用 zagi 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

zagi

a better git interface for agents

Why use zagi?

  • 121 git compatible commands
  • ~50% smaller output that doesn't overflow context windows
  • 1.5-2x faster than git in all implemented commands
  • Agent friendly features like fork and prompt
  • Three output modes: succinct (default), --compat (git-identical), --json
  • Git passthrough for non implemented commands

Installation

curl -fsSL zagi.sh/install | sh

This downloads the binary and sets up git as an alias to zagi. Restart your shell after installation.

From source

git clone https://github.com/mattzcarey/zagi.git
cd zagi
zig build -Doptimize=ReleaseFast
./zig-out/bin/zagi alias  # set up the alias

Usage

Use git as normal:

git status         # compact status
git log            # concise commit history
git diff           # minimal diff format
git add .          # confirms what was staged
git commit -m "x"  # shows commit stats

Any commands or flags not yet implemented in zagi pass through to git. zagi also comes with its own set of features for managing code written by agents.

Output modes

zagi has three output modes:

Succinct (default) — token-efficient output for agents:

git status
# branch: main
# staged: 2 files
#   A  src/new.ts
#   M  src/main.ts

Compat — identical to git CLI output:

git --compat status
git --compat log --oneline -5
git --compat diff --stat

JSON — structured output for machine parsing:

git --json status
# {"branch":"main","clean":false,"staged":[{"marker":"A","path":"src/new.ts"}],"modified":[],"untracked":[]}

git --json log -n 3
# [{"hash":"abc123f","date":"2025-01-15","author":"Alice","email":"alice@example.com","subject":"Add feature"}]

git --json diff
# {"files":[{"path":"src/main.ts","insertions":5,"deletions":2}]}

Easy worktrees

zagi ships with a wrapper around worktrees called fork:

# Create named forks for different approaches your agent could take
git fork nodejs-based
git fork bun-based

# Work in each fork
cd .forks/nodejs-based
# ... make changes, commit ...

cd .forks/bun-based
# ... make changes, commit ...

# Compare results, then pick the winner
cd ../..
git fork                       # list forks with commit counts
git fork --pick bun-based      # merge fork into base (keeps both histories)
git fork --promote bun-based   # replace base with fork (discards base commits)

# Clean up
git fork --delete-all

Agent mode

Agent mode is automatically enabled when running inside AI tools (Claude Code, OpenCode, Cursor, Windsurf, VS Code). You can also enable it manually:

export ZAGI_AGENT=my-agent

This enables:

  • Prompt tracking: git commit --prompt records the user request that created the commit
  • AI attribution: Automatically detects and stores which AI agent made the commit
git commit -m "Add feature" --prompt "Add a logout button to the header"
git log --prompts   # view prompts
git log --agent     # view which AI agent made commits
git log --session   # view full session transcript (with pagination)

Metadata is stored in git notes (refs/notes/agent, refs/notes/prompt, refs/notes/session) which are local by default and don't affect commit history.

Guardrails

Opt-in protection against destructive commands (reset --hard, push --force, clean -f, etc.):

export ZAGI_GUARDRAILS=1
git reset --hard HEAD~1  # blocked!

To bypass guardrails, set an override secret:

git set-override pineapples
ZAGI_OVERRIDE=pineapples git reset --hard HEAD~1  # allowed

Environment variables

VariableDescriptionDefault
ZAGI_GUARDRAILSBlock destructive git commands. Bypass with ZAGI_OVERRIDE.(unset)
ZAGI_OVERRIDEBypass guardrails with the secret set via git set-override.(unset)
ZAGI_REQUIRE_PROMPT_COMMITRequire --prompt on commits in agent mode.(unset)
ZAGI_STRIP_COAUTHORSStrip Co-Authored-By: lines from commit messages.(unset)

Agent mode is automatically detected when running inside Claude Code (CLAUDECODE=1) or OpenCode (OPENCODE=1).

Strip co-authors

Remove Co-Authored-By: lines that AI tools like Claude Code add to commit messages:

export ZAGI_STRIP_COAUTHORS=1
git commit -m "Add feature

Co-Authored-By: Claude <claude@anthropic.com>"  # stripped automatically

Output comparison

Standard git log:

commit abc123f4567890def1234567890abcdef12345
Author: Alice Smith <alice@example.com>
Date:   Mon Jan 15 14:32:21 2025 -0800

    Add user authentication system

zagi log:

abc123f (2025-01-15) Alice: Add user authentication system

Development

Requirements: Zig 0.15, Bun

zig build                           # build
zig build test                      # run zig tests
cd test && bun i && bun run test    # run integration tests
bash test/conformance.sh ./zig-out/bin/zagi  # run conformance tests

See AGENTS.md for contribution guidelines.

License

MIT

常见问题

What is zagi?

zagi is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by mattzcarey. better git cli for agents. It has 290 GitHub stars.

Is zagi safe to use?

Yes. zagi passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install zagi?

Clone the repository with "git clone https://github.com/mattzcarey/zagi" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is zagi written in?

zagi is primarily written in Zig. It is open-source under mattzcarey on GitHub, so you can review or fork the full source.

Are there alternatives to zagi?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh zagi against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情