Skip to content

Commit e93d990

Browse files
LeeCampbellclaude
andauthored
chore: agent-loop sort order and stream-json output (HdrHistogram#126)
- Add sort:created-asc to agent-loop.sh issue self-selection to match fleet.sh behaviour (oldest issues first) - Add --output-format stream-json --verbose to run_claude() for structured output - Document cd/git -C avoidance in CLAUDE.md Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 21964fe commit e93d990

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

.devcontainer/agent-loop.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ sync_state() {
1818

1919
run_claude() {
2020
local prompt="$1"
21-
timeout "$CLAUDE_TIMEOUT" claude --dangerously-skip-permissions --print "$prompt"
21+
timeout "$CLAUDE_TIMEOUT" claude --dangerously-skip-permissions --print \
22+
--output-format stream-json --verbose "$prompt"
2223
}
2324

2425
load_prompt() {
@@ -154,12 +155,14 @@ Closes #${ISSUE_NUM}"
154155
# Self-select: assigned first, then labelled 'agent'
155156
ISSUE_JSON=$(gh issue list --assignee @me --state open \
156157
--repo "$UPSTREAM_REPO" \
157-
--json number,title --limit 1 2>/dev/null || echo "[]")
158+
--json number,title --limit 1 \
159+
--search "sort:created-asc" 2>/dev/null || echo "[]")
158160

159161
if [ "$ISSUE_JSON" = "[]" ] || [ "$ISSUE_JSON" = "" ]; then
160162
ISSUE_JSON=$(gh issue list --label agent --state open \
161163
--repo "$UPSTREAM_REPO" \
162-
--json number,title --limit 1 2>/dev/null || echo "[]")
164+
--json number,title --limit 1 \
165+
--search "sort:created-asc" 2>/dev/null || echo "[]")
163166
fi
164167

165168
ISSUE_NUM=$(echo "$ISSUE_JSON" | jq -r '.[0].number // empty')

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ HdrHistogram aims to be an extremely fast, low resource usage tool to collect la
2626
- Branch naming convention: `feat/`, `fix/`, `chore/` prefixes
2727
- PRs should target only one issue. An Issue may have multiple PRs to solve it in a managable way.
2828
- Before creating PRs, always have other agents test and review the code.
29+
- Avoid using `cd` or `git -C` when trying to perform tasks in the pwd (present working directory). It breaks the claude-code permission model forcing permission request that are unnessecary.

0 commit comments

Comments
 (0)