Skip to content

Commit 7abfe17

Browse files
committed
AI: workspaces - all workflows
1 parent 92443b7 commit 7abfe17

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'
@@ -116,7 +122,11 @@ pm-flow-update rev='@':
116122
echo "$INSTRUCTIONS_2" | codex exec --full-auto --config model_reasoning_effort=high
117123
118124
119-
next-issue:
125+
next-issue workspace_id:
126+
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
127+
128+
129+
next-issue-inner:
120130
#!/usr/bin/env sh
121131
[ -f next-issue.md ] || exit 1
122132
@@ -145,7 +155,12 @@ next-issue:
145155
146156
rm next-issue.md
147157
148-
review-change:
158+
159+
review-change workspace_id:
160+
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
161+
162+
163+
review-change-inner:
149164
#!/usr/bin/env sh
150165
codex exec --full-auto --config model_reasoning_effort=high <<EOF
151166
1. Fetch the current changes by writing 'jj show'
@@ -174,7 +189,12 @@ review-change:
174189
`cat "${AGENT_TOOL_COPY_ROOT:-.}/rules/issues.md"`
175190
EOF
176191

177-
tidy-issues:
192+
193+
tidy-issues workspace_id:
194+
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
195+
196+
197+
tidy-issues-inner:
178198
#!/usr/bin/env sh
179199
codex exec --full-auto --config model_reasoning_effort=high <<EOF
180200
1. Read the file '/issues.md'.
@@ -188,7 +208,11 @@ tidy-issues:
188208
`cat "${AGENT_TOOL_COPY_ROOT:-.}/rules/issues.md"`
189209
EOF
190210

191-
archive-issues:
211+
archive-issues workspace_id:
212+
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
213+
214+
215+
archive-issues-inner:
192216
#!/usr/bin/env sh
193217
codex exec --full-auto --config model_reasoning_effort=high <<EOF
194218
This is a task to archive done issues.
@@ -199,7 +223,11 @@ archive-issues:
199223
5. Then move achived issues to '.archive/issues-yyyy-mm-dd.md' file. Use current date.
200224
6. Finally update the file '/issues-overview.md'. It is a table of issues and statuses
201225

202-
pick-next-issue:
226+
pick-next-issue workspace_id:
227+
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
228+
229+
230+
pick-next-issue-inner:
203231
#!/usr/bin/env sh
204232
codex exec --full-auto --config model_reasoning_effort=high <<EOF
205233
1. Examine issues.md and choose a single issue to work on.
@@ -210,7 +238,12 @@ pick-next-issue:
210238
3.3. STOP.
211239
EOF
212240

213-
edit rev='@':
241+
242+
edit workspace_id rev='@':
243+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow edit -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} edit-inner {{rev}}
244+
245+
246+
edit-inner rev='@':
214247
#!/usr/bin/env sh
215248

216249
CURRENT_CHANGE=`jj log -r @ --template 'change_id' --no-graph`
@@ -220,32 +253,51 @@ edit rev='@':
220253

221254
jj edit $CURRENT_CHANGE
222255

223-
human-work-step:
256+
human-work-step workspace_id:
257+
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
258+
259+
260+
human-work-step-inner:
224261
#!/usr/bin/env sh
225-
just agents::edit
262+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} edit-inner
226263
jj split issues.md -m "issues: Update after review"
227264
jj edit @-
228265

229-
ai-work-step: next-issue review-change
266+
ai-work-step workspace_id:
267+
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
268+
269+
270+
ai-work-step-inner:
271+
#!/usr/bin/env sh
272+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} next-issue-inner
273+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} review-change-inner
230274

231275
# Use this step when starting to work on a new issue
232-
work:
276+
work workspace_id:
277+
bash scripts/agent-workspace.sh run {{workspace_id}} --workflow work -- just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} work-inner
278+
279+
280+
work-inner:
233281
#!/usr/bin/env sh
234282
while true; do
235-
just agents::pick-next-issue
283+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} pick-next-issue-inner
236284
[ -f next-issue.md ] || break
237-
just agents::ai-work-step
238-
just agents::human-work-step
285+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} ai-work-step-inner
286+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} human-work-step-inner
239287
done
240288

241289
# This should be started if you stop at editor phase and want to continue from where you left off
242290
# Current commit should be the last review commit
243-
continue-work:
291+
continue-work workspace_id:
292+
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
293+
294+
295+
continue-work-inner:
244296
#!/usr/bin/env sh
245297
while true; do
246-
just agents::human-work-step
247-
just agents::pick-next-issue
298+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} human-work-step-inner
299+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} pick-next-issue-inner
248300
[ -f next-issue.md ] || break
249-
just agents::ai-work-step
301+
just --justfile .agent-tools/agents.just --set workspace_id {{workspace_id}} ai-work-step-inner
250302
done
251303

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)