You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`refs/notes/session` - full session transcript (for Claude Code, OpenCode)
35
+
36
+
View metadata with:
32
37
```bash
33
-
git log --prompts
38
+
git log --prompts # show prompts (truncated to 200 chars)
39
+
git log --agent # show which AI agent made each commit
40
+
git log --session # show session transcript (paginated, first 20k bytes)
41
+
git log --session --session-offset=20000 # continue from byte 20000
34
42
```
35
43
36
-
### Environment Setup
44
+
### Agent Mode
37
45
38
-
Set `ZAGI_AGENT` to enable prompt enforcement:
46
+
Agent mode is automatically enabled when running inside AI tools:
47
+
- Claude Code (sets `CLAUDECODE=1`)
48
+
- OpenCode (sets `OPENCODE=1`)
49
+
- VS Code, Cursor, Windsurf (detected from terminal environment)
39
50
51
+
You can also enable it manually:
40
52
```bash
41
-
export ZAGI_AGENT=claude-code
53
+
export ZAGI_AGENT=my-agent
42
54
```
43
55
44
-
When this is set:
56
+
When agent mode is active:
45
57
1.`git commit` will fail without `--prompt`, ensuring all AI-generated commits have their prompts recorded
46
58
2. Destructive commands are blocked to prevent data loss
47
59
@@ -165,6 +177,85 @@ edit: complete
165
177
rebased: 3 commits
166
178
```
167
179
180
+
## Agent Subcommands
181
+
182
+
zagi provides two agent subcommands for autonomous task execution using the RALPH pattern (Recursive Agent Loop Pattern for Humans).
183
+
184
+
### zagi agent plan
185
+
186
+
Starts an interactive planning session where an AI agent collaborates with you to design and create tasks.
187
+
188
+
```bash
189
+
# Start an interactive session (agent will ask what you want to build)
190
+
zagi agent plan
191
+
192
+
# Start with initial context
193
+
zagi agent plan "Add user authentication with JWT"
194
+
195
+
# Preview the prompt without executing
196
+
zagi agent plan --dry-run
197
+
```
198
+
199
+
The planning agent follows an interactive protocol:
200
+
1.**Explore codebase**: Reads AGENTS.md and relevant code to understand architecture
201
+
2.**Ask clarifying questions**: Asks about scope, constraints, and preferences before drafting any plan
202
+
3.**Propose plan**: Presents a numbered implementation plan for your review
203
+
4.**Create tasks**: Only creates tasks after you explicitly approve the plan
204
+
205
+
This collaborative approach ensures the agent gathers all necessary context before committing to a task breakdown. The agent will ask 2-4 focused questions at a time about:
206
+
-**Scope**: What's included/excluded, edge cases, MVP vs nice-to-haves
Copy file name to clipboardExpand all lines: README.md
+26-10Lines changed: 26 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,29 +69,45 @@ git fork --delete-all
69
69
70
70
### Agent mode
71
71
72
-
Set `ZAGI_AGENT` to enable agent-specific features.
72
+
Agent mode is automatically enabled when running inside AI tools (Claude Code, OpenCode, Cursor, Windsurf, VS Code). You can also enable it manually:
73
73
74
74
```bash
75
-
export ZAGI_AGENT=claude-code
75
+
export ZAGI_AGENT=my-agent
76
76
```
77
77
78
-
The value can be any string describing your agent (e.g. `claude-code`, `cursor`, `opencode`) - this will be used in future features for agent-specific behavior.
79
-
80
78
This enables:
81
79
-**Prompt tracking**: `git commit` requires `--prompt` to record the user request that created the commit
80
+
-**AI attribution**: Automatically detects and stores which AI agent made the commit
82
81
-**Guardrails**: Blocks destructive commands (`reset --hard`, `checkout .`, `clean -f`, `push --force`) to prevent data loss
83
82
84
83
```bash
85
-
git commit -m "Add feature" --prompt "Add a logout button to the header.."
86
-
git log --prompts # view prompts
84
+
git commit -m "Add feature" --prompt "Add a logout button to the header"
85
+
git log --prompts # view prompts
86
+
git log --agent # view which AI agent made commits
87
+
git log --session # view full session transcript (with pagination)
87
88
```
88
89
89
-
To prevent child processes from overriding `ZAGI_AGENT`, make it readonly:
90
+
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.
|`ZAGI_AGENT`| Manually enable agent mode. Auto-detected from `CLAUDECODE`, `OPENCODE`, or IDE environment. | (auto) | Any string enables agent mode. For executors: `claude`, `opencode`|
97
+
|`ZAGI_AGENT_CMD`| Custom executor command override. When set, the prompt is appended as the final argument. | (unset) | Any shell command (e.g., `aider --yes`) |
98
+
|`ZAGI_STRIP_COAUTHORS`| Strips `Co-Authored-By:` lines from commit messages. | (unset) |`1` to enable |
99
+
100
+
**Agent detection**: Agent mode is automatically enabled when `CLAUDECODE=1` or `OPENCODE=1` is set (by Claude Code or OpenCode), or when running in VS Code/Cursor/Windsurf terminals.
Copy file name to clipboardExpand all lines: docs/features.md
+32-13Lines changed: 32 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,11 @@ Options:
39
39
-`--grep=<pattern>` - filter by commit message
40
40
-`--since=<date>` - commits after date (e.g. "2025-01-01", "1 week ago")
41
41
-`--until=<date>` - commits before date
42
+
-`--prompts` - show AI prompts attached to commits
43
+
-`--agent` - show which AI agent made the commit
44
+
-`--session` - show session transcript (first 20k bytes)
45
+
-`--session-offset=N` - start session display at byte N
46
+
-`--session-limit=N` - limit session display to N bytes
42
47
-`-- <path>...` - filter to commits affecting paths
43
48
44
49
### git diff
@@ -110,34 +115,48 @@ Forks are git worktrees. The `.forks/` directory is auto-added to `.gitignore`.
110
115
-`--pick` performs a proper git merge, preserving both base and fork history
111
116
-`--promote` moves HEAD to the fork's commit, discarding any base-only commits (stash uncommitted changes first)
112
117
113
-
### --prompt
118
+
### --prompt (AI Attribution)
114
119
115
-
Store the user prompt that created a commit:
120
+
Store the user prompt and AI metadata with a commit:
116
121
117
122
```bash
118
123
git commit -m "Add feature" --prompt "Add a logout button to the header"
119
-
git log --prompts # view prompts in log output
120
124
```
121
125
122
-
### ZAGI_AGENT
126
+
When `--prompt` is used, zagi stores metadata in git notes:
127
+
-`refs/notes/agent` - detected AI agent (claude, opencode, cursor, etc.)
128
+
-`refs/notes/prompt` - the user prompt text
129
+
-`refs/notes/session` - full session transcript (Claude Code, OpenCode)
123
130
124
-
Set `ZAGI_AGENT` to enable agent-specific features. The value can be any string describing your agent (e.g. `claude-code`, `cursor`, `aider`) - this will be used in future features for agent-specific behavior.
131
+
View with log flags:
132
+
```bash
133
+
git log --prompts # show prompts (truncated to 200 chars)
134
+
git log --agent # show agent name
135
+
git log --session # show session transcript (paginated)
136
+
git log --session --session-limit=1000 # first 1000 bytes
137
+
git log --session --session-offset=1000 # start at byte 1000
138
+
```
139
+
140
+
Git notes are local by default and don't modify commit history.
125
141
142
+
### Agent Mode
143
+
144
+
Agent mode is automatically enabled when running inside AI tools:
145
+
- Claude Code (`CLAUDECODE=1`)
146
+
- OpenCode (`OPENCODE=1`)
147
+
- VS Code, Cursor, Windsurf (detected from `VSCODE_GIT_ASKPASS_NODE`)
148
+
149
+
You can also enable it manually:
126
150
```bash
127
-
export ZAGI_AGENT=claude-code
128
-
git commit -m "x"# error: --prompt required
151
+
export ZAGI_AGENT=my-agent
129
152
```
130
153
131
-
When `ZAGI_AGENT`is set:
154
+
When agent mode is active:
132
155
-`git commit` requires `--prompt` to record the user request
133
156
- Destructive commands are blocked (guardrails)
134
157
135
-
To prevent child processes from overriding `ZAGI_AGENT`, make it readonly:
136
-
137
158
```bash
138
-
# bash/zsh
139
-
export ZAGI_AGENT=claude-code
140
-
readonly ZAGI_AGENT
159
+
git commit -m "x"# error: --prompt required in agent mode
0 commit comments