Skip to content

Commit e127b53

Browse files
committed
AI: PM loop
1 parent 99fbb1d commit e127b53

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

.#agents.just

Lines changed: 0 additions & 1 deletion
This file was deleted.

agents.just

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ consolidate start_change_id end_change_id:
2626

2727
questions-for-pm rev='@':
2828
#!/usr/bin/env sh
29+
CURRENT_CHANGE=`jj log -r @ --template 'change_id' --no-graph`
30+
2931
read -r -d '' INSTRUCTIONS_1 <<-EOF
3032
1. Read the current state of open issues in issues.md
3133
2. Read relevant state of the code base
@@ -34,20 +36,39 @@ questions-for-pm rev='@':
3436
5. Append the new questions to the end of 'pm-faq.md' file
3537
EOF
3638

37-
3839
jj new -r {{rev}} -m "Questions for the PM"
3940
PM_CHANGE=`jj log -r @ --template 'change_id' --no-graph`
4041

42+
# Add a dated header once
4143
echo "# Questions from `date -I`" >> pm-faq.md
42-
echo "$INSTRUCTIONS_1" | codex exec --full-auto --config model_reasoning_effort=high
43-
jj edit -r $CURRENT_CHANGE
44-
just agents::edit $PM_CHANGE
4544

46-
just agents::pm-flow-update $PM_CHANGE
47-
UPDATE_CHANGE=`jj log -r @ --template 'change_id' --no-graph`
48-
jj edit -r $CURRENT_CHANGE
45+
# Initialize iteration counter for commit messages
46+
ITERATION=1
47+
48+
# Keep asking until no further changes are made to pm-faq.md
49+
while true; do
50+
PREV_HASH=`[ -f pm-faq.md ] && sha256sum pm-faq.md | cut -d' ' -f1 || echo ""`
51+
52+
echo "$INSTRUCTIONS_1" | codex exec --full-auto --config model_reasoning_effort=high
53+
54+
CURR_HASH=`[ -f pm-faq.md ] && sha256sum pm-faq.md | cut -d' ' -f1 || echo ""`
55+
[ "$CURR_HASH" = "$PREV_HASH" ] && break
56+
57+
# Optional manual edits
58+
jj edit $CURRENT_CHANGE && just agents::edit $PM_CHANGE
59+
# Update issues based on PM responses
60+
just agents::pm-flow-update $PM_CHANGE
61+
62+
# Start a new iteration change, include a counter in the message
63+
jj new -r @ -m "Questions for the PM (iteration ${ITERATION})"
64+
PM_CHANGE=`jj log -r @ --template 'change_id' --no-graph`
65+
ITERATION=$((ITERATION + 1))
66+
done
67+
68+
# Return to original change
69+
jj edit $CURRENT_CHANGE
70+
4971

50-
5172
pm-flow-update rev='@':
5273
#!/usr/bin/env sh
5374
read -r -d '' INSTRUCTIONS_2 <<-EOF
@@ -163,17 +184,17 @@ edit rev='@':
163184
#!/usr/bin/env sh
164185

165186
CURRENT_CHANGE=`jj log -r @ --template 'change_id' --no-graph`
166-
jj edit -r {{rev}}
187+
jj edit {{rev}}
167188

168189
jj show -r @ --git | sed -n 's/^diff --git a\/\([^ ]*\) b\/.*/\1/p' | sort -u | xargs -r ${EDITOR:-vi}
169190

170-
jj edit -r $CURRENT_CHANGE
191+
jj edit $CURRENT_CHANGE
171192

172193
human-work-step:
173194
#!/usr/bin/env sh
174195
just agents::edit
175196
jj split issues.md -m "issues: Update after review"
176-
jj edit -r @-
197+
jj edit @-
177198

178199
ai-work-step: next-issue review-change
179200

0 commit comments

Comments
 (0)