From 455771e5e16d7825532e33eddb14d158a82d6606 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Tue, 3 Mar 2026 15:25:29 -0600 Subject: [PATCH] =?UTF-8?q?store:=20Refactor:=20issue-poller.sh=20?= =?UTF-8?q?=E2=80=94=20replaced=205=20of=206=20Haiku+MCP=20calls=20with=20?= =?UTF-8?q?direct=20curl+jq=20Gitea=20API=20calls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...laced-5-of-6-haikumcp-calls-with-436e13.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 graph/solutions/refactor-issue-pollersh-replaced-5-of-6-haikumcp-calls-with-436e13.md diff --git a/graph/solutions/refactor-issue-pollersh-replaced-5-of-6-haikumcp-calls-with-436e13.md b/graph/solutions/refactor-issue-pollersh-replaced-5-of-6-haikumcp-calls-with-436e13.md new file mode 100644 index 00000000000..6425af17d8b --- /dev/null +++ b/graph/solutions/refactor-issue-pollersh-replaced-5-of-6-haikumcp-calls-with-436e13.md @@ -0,0 +1,52 @@ +--- +id: 436e133f-2c31-488a-9810-fb6ca5b45250 +type: solution +title: "Refactor: issue-poller.sh — replaced 5 of 6 Haiku+MCP calls with direct curl+jq Gitea API calls" +tags: [issue-poller, gitea-api, curl, jq, cost-optimization, automation, claude-scheduled, refactor] +importance: 0.8 +confidence: 0.8 +created: "2026-03-03T21:25:29.636362+00:00" +updated: "2026-03-03T21:25:29.636362+00:00" +--- + +# Issue-Poller Refactor: Haiku → curl+jq + +## Project +claude-scheduled / issue-poller automation + +## File +`~/.config/claude-scheduled/issue-poller.sh` + +## Motivation +- Haiku spawned for simple CRUD operations was slow (~60-90s discovery phase) and expensive (~$0.80-1.00/run) +- The MCP wrapper for list_repo_issues was causing an infinite loop (see related bug fix memory) + +## What Was Replaced (5 of 6 calls) + +| Old (Haiku+MCP) | New (curl+jq) | Endpoint | +|---|---|---| +| Auth check | gitea_get /user | GET /api/v1/user | +| List issues | gitea_get /repos/{owner}/{repo}/issues?type=issues | GET with type filter | +| Label race-check | gitea_get issue + jq | GET issue JSON | +| Add label | gitea_post labels | POST /issues/{id}/labels | +| Post-worker label swap | gitea_delete + gitea_post | DELETE + POST labels | + +## What Was Kept (1 call) +- Feasibility check — genuinely needs AI reasoning to determine if an issue is actionable + +## Helper Functions Added +```bash +gitea_get() # curl GET wrapper with auth +gitea_post() # curl POST wrapper with JSON body +gitea_delete() # curl DELETE wrapper +ensure_label() # search existing labels before creating (prevents duplicates) +add_label() # add label to issue +remove_label() # remove label from issue +``` + +## Token Source +`~/.config/claude-scheduled/secrets` + +## Performance Improvement +- Discovery phase: ~60-90s → ~2s +- Cost savings: ~$0.80-1.00/run