Skip to content

Commit 1016f03

Browse files
committed
AI workflows
Signed-off-by: Tzanko Matev <[email protected]> agents.just: Create a workflow for handling bigger issues Signed-off-by: Tzanko Matev <[email protected]>
1 parent 3c0046c commit 1016f03

File tree

5 files changed

+143
-0
lines changed

5 files changed

+143
-0
lines changed

Justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
mod agents
2+
13
default:
24
@just --list
35

@@ -62,3 +64,4 @@ test-all:
6264
file="${file[0]}"; \
6365
uv run -p "python3.$v" --with "${file}" --with pytest -- pytest -q; \
6466
done
67+

agents.just

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
next-issue:
2+
#!/usr/bin/env sh
3+
[ -f next-issue.md ] || exit 1
4+
5+
codex exec --full-auto --config model_reasoning_effort=high <<EOF
6+
1. You will next work on issue `cat next-issue.md`. Read the actual issue from 'issues.md'
7+
3. Decide is it relevant to write a failing test for the issue. If so, write the test, make sure that it fails.
8+
Note! Not all issues require writing failing tests. Use discretion. Remember - code is debt.
9+
4. Change the code to fix the issue. Use "just dev test" to check if changes compile and tests pass.
10+
Code must follow the rules in '/rules/source-code.md'
11+
5. When the issue is fixed and tests pass run "jj describe --stdin <<ENDDESC
12+
commit message
13+
ENDDESC".
14+
15+
For example:
16+
jj describe --stdin <<ENDDESC
17+
ISSUE-043: Update dog-barking protocol
18+
19+
...
20+
ENDDESC
21+
22+
Note! If you try to add a commit message like 'jj new -m "blah"' or 'jj describe -m "blah"' the resulting message will not be formatted properly.
23+
24+
EOF
25+
26+
rm next-issue.md
27+
28+
review-change:
29+
#!/usr/bin/env sh
30+
codex exec --full-auto --config model_reasoning_effort=high <<EOF
31+
1. Fetch the current changes by writing 'jj show'
32+
2. Create a new change by calling 'jj new -m "review(codex): ..."'. For example 'jj new -m "review(codex): Issue 004 - introducing dog barking functionality"'
33+
3. Do a deep review of the change.
34+
- Write your review inline in the code itself by using code comments starting with '//REVIEW(author)' (or '# REVIEW(author)') to record your review.
35+
- While reviewing make sure that the rules in '/rules' folder are satisfied by the change under review.
36+
- DO NOT make any other changes in the code except adding the above-mentioned review comments.
37+
- DO NOT review code which is unrelated to the change under review
38+
39+
4. Examine the changes and update the list of issues in 'issues.md'
40+
- If the change affects a specific issue update its status
41+
- If the change partially solves an issue update its status and create new issues for the part which is not yet solved
42+
- If the change affects any non-related issue or creates new issues write that down as well
43+
- If you find any problems in the code unrelated to the change under review DO NOT write/update issues about them. We only care about how the change under review affects the overall state of the code and issues.
44+
45+
Issues file must follow the rules in '/rules/issues.md'
46+
5. Update the change description with a summary of the review using 'jj describe --stdin <<REVIEW
47+
review(codex): ...
48+
49+
...
50+
REVIEW'
51+
EOF
52+
53+
tidy-issues:
54+
#!/usr/bin/env sh
55+
codex exec --full-auto --config model_reasoning_effort=high <<EOF
56+
1. Read the file '/issues.md'.
57+
2. Check if it follows the rules in '/rules/issues.md'
58+
3. run 'jj new -m "issues(codex): ..."'. For example 'jj new -m "issues(codex): Removing duplicate dog-barking issue"'
59+
4. Refactor the issues database to follow the specified rules. Do the MINIMAL changes necessary to make sure that the database follows the rules, while not removing any existing information in it.
60+
5. Finally update the file '/issues-overview.md' to match the changes in 'issues.md'. It is a table of issues and statuses.
61+
EOF
62+
63+
archive-issues:
64+
#!/usr/bin/env sh
65+
codex exec --full-auto --config model_reasoning_effort=high <<EOF
66+
This is a task to archive done issues.
67+
1. Read file '/issues.md'.
68+
2. Check if there are any issues which are DONE. If not, exit.
69+
3. Run 'jj new -m "issues(codex): Archiving done issues"'
70+
4. Change the status of all "Done" issues to "Archived"
71+
5. Then move achived issues to '.archive/issues-yyyy-mm-dd.md' file. Use current date.
72+
6. Finally update the file '/issues-overview.md'. It is a table of issues and statuses
73+
74+
pick-next-issue:
75+
#!/usr/bin/env sh
76+
codex exec --full-auto --config model_reasoning_effort=high <<EOF
77+
1. Examine issues.md and choose a single issue to work on.
78+
2. If no issue is chosen, then STOP and don''t do anything else.
79+
3. Otherwise:
80+
3.1. Run "jj new" DON''T add a commit message!
81+
3.2. Create a file in the root folder 'next-issue.md' The file must contain ONLY the issue id then a newline and nothing else.
82+
3.3. STOP.
83+
EOF
84+
85+
edit:
86+
#!/usr/bin/env sh
87+
jj show -r @ --git | sed -n 's/^diff --git a\/\([^ ]*\) b\/.*/\1/p' | sort -u | xargs -r ${EDITOR:-vi}
88+
89+
work:
90+
#!/usr/bin/env sh
91+
echo "Hi"
92+
while true; do
93+
echo "Bye"
94+
just agents::pick-next-issue
95+
[ -f next-issue.md ] || break
96+
just agents::next-issue
97+
just agents::review-change
98+
EDITOR=emacsclient just agents::edit
99+
jj squash issues.md
100+
jj edit -r @-
101+
done

issues.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# General Issues
2+
3+
## ISSUE-001
4+
### Description
5+
We need to record function arguments when calling a function
6+
7+
We have a function `encode_value` which is used to convert Python objects to value records. We need to use this function to encode the function arguments. To do that we should modify the `on_py_start` hook to load the current frame and to read the function arguments from it.
8+
9+
### Status
10+
Not started
11+
12+
113
# Issues Breaking Declared Relations
214

315
This document lists concrete mismatches that cause the relations in `relations.md` to fail.

rules/issues.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Rules for the issues.md file
2+
3+
* Every issue has the following attributes:
4+
- issue id (e.g 'ISSUE-001')
5+
- issue description
6+
- definition-of-done
7+
- current status
8+
9+
* Issues may optionally have the following attributes:
10+
- proposed solution
11+
- dependent issues
12+
- conflicts - those are issues whose solution would conflict with the solution of the current issue
13+
14+
* There shouldn't be any issues with status 'Archived' in 'issues.md'. Any issue with this status needs to be removed.
15+
* There shouldn't be any issues with status 'Archived' in 'issues.md'. Any issue with this status needs to bearchived.
16+
17+
* Issues should use CONCISE and CLEAR language. They should be easily readable by non-native English speakers.

rules/source-code.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Source code rules
2+
* Avoid defensive programming: when encountering edge cases the
3+
default behaviour should be to crash. We will only handle them after
4+
we receive a report from a user which confirms that the edge case
5+
does happen in real life.
6+
7+
* Code is debt - write as little as possible
8+
9+
* Prioritize readability above all else - code needs to be readable by as large an audience as practically possible.
10+

0 commit comments

Comments
 (0)