cli/internal/cmd/ai
Claude 3ccb67bddd
feat(agentci): rate limiting and native Go dispatch runner
Adds pkg/ratelimit for Gemini API rate limiting with sliding window
(RPM/TPM/RPD), persistent state, and token counting. Replaces the
bash agent-runner.sh with a native Go implementation under
`core ai dispatch {run,watch,status}` for local queue processing.

Rate limiting:
- Per-model quotas (RPM, TPM, RPD) with 1-minute sliding window
- WaitForCapacity blocks until capacity available or context cancelled
- Persistent state in ~/.core/ratelimits.yaml
- Default quotas for Gemini 3 Pro/Flash, 2.5 Pro, 2.0 Flash/Lite
- CountTokens helper calls Google tokenizer API
- CLI: core ai ratelimits {show,reset,count,config,check}

Dispatch runner:
- core ai dispatch run — process single ticket from queue
- core ai dispatch watch — daemon mode with configurable interval
- core ai dispatch status — show queue/active/done counts
- Supports claude/codex/gemini runners with rate-limited Gemini
- File-based locking with stale PID detection
- Completion handler updates issue labels on success/failure

Closes #42

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 03:08:16 +00:00
..
cmd_agent.go feat(agentci): Clotho orchestrator and security hardening 2026-02-10 03:08:16 +00:00
cmd_ai.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_commands.go feat(agentci): rate limiting and native Go dispatch runner 2026-02-10 03:08:16 +00:00
cmd_dispatch.go feat(agentci): rate limiting and native Go dispatch runner 2026-02-10 03:08:16 +00:00
cmd_git.go feat(mcp): add workspace root validation to prevent path traversal (#100) 2026-02-01 21:59:34 +00:00
cmd_metrics.go feat: wire release command, add tar.xz support, unified installers (#277) 2026-02-04 00:49:57 +00:00
cmd_ratelimits.go feat(agentci): rate limiting and native Go dispatch runner 2026-02-10 03:08:16 +00:00
cmd_tasks.go feat: wire release command, add tar.xz support, unified installers (#277) 2026-02-04 00:49:57 +00:00
cmd_updates.go feat: wire release command, add tar.xz support, unified installers (#277) 2026-02-04 00:49:57 +00:00
ratelimit_dispatch.go feat(agentci): rate limiting and native Go dispatch runner 2026-02-10 03:08:16 +00:00