Skip to content

Commit 0e33813

Browse files
committed
AI: workspaces - all workflows
1 parent 664122d commit 0e33813

File tree

2 files changed

+84
-24
lines changed

2 files changed

+84
-24
lines changed

agents.just

Lines changed: 74 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ consolidate-inner start_change_id end_change_id:
88
read -r -d '' INSTRUCTIONS <<-EOF
99
You will be given a diff with 'jj diff --from {{start_change_id}} --to {{end_change_id}}'. The task is to write a specification which describes the introduced changes.
1010

11-
You need to produce a full detailed specification in the folder 'specs/'. Imagine that the changes that the diff shows disappeared and we had to implement the functionality from scratch. The specification must contain all necessary details in order to be ample to implement equivalent functionality.
11+
You need to produce a full detailed specification in the folder 'specs/'. Imagine that the changes that the diff shows disappeared and we had to implement the functionality from scratch. The specification must contain all necessary details in order to be possible to implement equivalent functionality.
1212

1313
Abide by the following rules:
1414

@@ -45,7 +45,10 @@ workspace-clean workspace_id:
4545
workspace-sync-tools workspace_id:
4646
scripts/agent-workspace.sh sync-tools {{workspace_id}}
4747

48-
questions-for-pm rev='@':
48+
questions-for-pm workspace_id rev='@':
49+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow questions-for-pm -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} questions-for-pm-inner {{rev}}
50+
51+
questions-for-pm-inner rev='@':
4952
#!/usr/bin/env sh
5053
CURRENT_CHANGE=`jj log -r @ --template 'change_id' --no-graph`
5154

@@ -76,9 +79,9 @@ questions-for-pm rev='@':
7679
[ "$CURR_HASH" = "$PREV_HASH" ] && break
7780

7881
# Optional manual edits
79-
jj edit $CURRENT_CHANGE && just agents::edit $PM_CHANGE
82+
jj edit $CURRENT_CHANGE && just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} edit-inner $PM_CHANGE
8083
# Update issues based on PM responses
81-
just agents::pm-flow-update $PM_CHANGE
84+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} pm-flow-update-inner $PM_CHANGE
8285

8386
# Start a new iteration change, include a counter in the message
8487
jj new -r @ -m "Questions for the PM (iteration ${ITERATION})"
@@ -93,7 +96,10 @@ questions-for-pm rev='@':
9396
jj edit $CURRENT_CHANGE
9497

9598

96-
pm-flow-update rev='@':
99+
pm-flow-update workspace_id rev='@':
100+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow pm-flow-update -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} pm-flow-update-inner {{rev}}
101+
102+
pm-flow-update-inner rev='@':
97103
#!/usr/bin/env sh
98104
read -r -d '' INSTRUCTIONS_2 <<-EOF
99105
1. Read the current state of open issues in 'issues.md'
@@ -110,7 +116,11 @@ pm-flow-update rev='@':
110116
echo "$INSTRUCTIONS_2" | codex exec --full-auto --config model_reasoning_effort=high
111117

112118

113-
next-issue:
119+
next-issue workspace_id:
120+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow next-issue -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} next-issue-inner
121+
122+
123+
next-issue-inner:
114124
#!/usr/bin/env sh
115125
[ -f next-issue.md ] || exit 1
116126

@@ -139,7 +149,12 @@ next-issue:
139149

140150
rm next-issue.md
141151

142-
review-change:
152+
153+
review-change workspace_id:
154+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow review-change -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} review-change-inner
155+
156+
157+
review-change-inner:
143158
#!/usr/bin/env sh
144159
codex exec --full-auto --config model_reasoning_effort=high <<EOF
145160
1. Fetch the current changes by writing 'jj show'
@@ -168,7 +183,12 @@ review-change:
168183
`cat "${AGENT_TOOL_COPY_ROOT:-.}/rules/issues.md"`
169184
EOF
170185

171-
tidy-issues:
186+
187+
tidy-issues workspace_id:
188+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow tidy-issues -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} tidy-issues-inner
189+
190+
191+
tidy-issues-inner:
172192
#!/usr/bin/env sh
173193
codex exec --full-auto --config model_reasoning_effort=high <<EOF
174194
1. Read the file '/issues.md'.
@@ -182,7 +202,11 @@ tidy-issues:
182202
`cat "${AGENT_TOOL_COPY_ROOT:-.}/rules/issues.md"`
183203
EOF
184204

185-
archive-issues:
205+
archive-issues workspace_id:
206+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow archive-issues -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} archive-issues-inner
207+
208+
209+
archive-issues-inner:
186210
#!/usr/bin/env sh
187211
codex exec --full-auto --config model_reasoning_effort=high <<EOF
188212
This is a task to archive done issues.
@@ -193,7 +217,11 @@ archive-issues:
193217
5. Then move achived issues to '.archive/issues-yyyy-mm-dd.md' file. Use current date.
194218
6. Finally update the file '/issues-overview.md'. It is a table of issues and statuses
195219

196-
pick-next-issue:
220+
pick-next-issue workspace_id:
221+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow pick-next-issue -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} pick-next-issue-inner
222+
223+
224+
pick-next-issue-inner:
197225
#!/usr/bin/env sh
198226
codex exec --full-auto --config model_reasoning_effort=high <<EOF
199227
1. Examine issues.md and choose a single issue to work on.
@@ -204,7 +232,12 @@ pick-next-issue:
204232
3.3. STOP.
205233
EOF
206234

207-
edit rev='@':
235+
236+
edit workspace_id rev='@':
237+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow edit -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} edit-inner {{rev}}
238+
239+
240+
edit-inner rev='@':
208241
#!/usr/bin/env sh
209242

210243
CURRENT_CHANGE=`jj log -r @ --template 'change_id' --no-graph`
@@ -214,32 +247,51 @@ edit rev='@':
214247

215248
jj edit $CURRENT_CHANGE
216249

217-
human-work-step:
250+
human-work-step workspace_id:
251+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow human-work-step -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} human-work-step-inner
252+
253+
254+
human-work-step-inner:
218255
#!/usr/bin/env sh
219-
just agents::edit
256+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} edit-inner
220257
jj split issues.md -m "issues: Update after review"
221258
jj edit @-
222259

223-
ai-work-step: next-issue review-change
260+
ai-work-step workspace_id:
261+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow ai-work-step -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} ai-work-step-inner
262+
263+
264+
ai-work-step-inner:
265+
#!/usr/bin/env sh
266+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} next-issue-inner
267+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} review-change-inner
224268

225269
# Use this step when starting to work on a new issue
226-
work:
270+
work workspace_id:
271+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow work -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} work-inner
272+
273+
274+
work-inner:
227275
#!/usr/bin/env sh
228276
while true; do
229-
just agents::pick-next-issue
277+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} pick-next-issue-inner
230278
[ -f next-issue.md ] || break
231-
just agents::ai-work-step
232-
just agents::human-work-step
279+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} ai-work-step-inner
280+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} human-work-step-inner
233281
done
234282

235283
# This should be started if you stop at editor phase and want to continue from where you left off
236284
# Current commit should be the last review commit
237-
continue-work:
285+
continue-work workspace_id:
286+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow continue-work -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} continue-work-inner
287+
288+
289+
continue-work-inner:
238290
#!/usr/bin/env sh
239291
while true; do
240-
just agents::human-work-step
241-
just agents::pick-next-issue
292+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} human-work-step-inner
293+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} pick-next-issue-inner
242294
[ -f next-issue.md ] || break
243-
just agents::ai-work-step
295+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} ai-work-step-inner
244296
done
245297

design-docs/jj-workspaces.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,16 @@ is running: `AGENT_WORKSPACE_ID`, `AGENT_WORKSPACE_PATH`, `AGENT_WORKSPACE_METAD
5555

5656
## Using the Workflows
5757

58-
- `just agents::consolidate <workspace-id> <start-change> <end-change>` creates or
59-
reuses a workspace and delegates the existing automation to `consolidate-inner`.
58+
- Most automation recipes now take `<workspace-id>` as their first parameter and are
59+
backed by a matching `*-inner` recipe. Examples include
60+
`questions-for-pm`, `pm-flow-update`, `next-issue`, `review-change`, `tidy-issues`,
61+
`archive-issues`, `pick-next-issue`, `edit`, `human-work-step`, `ai-work-step`,
62+
`work`, and `continue-work`.
63+
- `just agents::<workflow> <workspace-id> ...` shells out to
64+
`scripts/agent-workspace.sh run` before delegating to `<workflow>-inner`, keeping all
65+
nested steps inside the same workspace copy of the tooling.
66+
- `just agents::consolidate <workspace-id> <start-change> <end-change>` follows the
67+
same pattern and delegates to `consolidate-inner`.
6068
- Nested workflows should pass the same `workspace_id` down via `--set` so that every
6169
automated step stays inside the same working copy.
6270
- `just agents::workspace-status` lists all workspaces for the repo. Add an ID to view

0 commit comments

Comments
 (0)