# GitLooper Strategy

**Date:** 2026-03-17
**Epic:** Gitea Integration + Autonomous Issue Processing

## Overview

GitLooper is a Claude Code slash command (`/gitlooper:gitlooper`) that connects to Planarchy's Gitea instance, reads open issues, triages them, and autonomously implements fixes/features using spawned sub-agents.

## Architecture

```
User runs /gitlooper:gitlooper
        │
        ▼
┌─────────────────────┐
│  Phase 1: FETCH     │  Gitea REST API → list open issues
│  & TRIAGE           │  Classify: bug / feature / ux
│                     │  Estimate effort: S / M / L
│                     │  Present table → user approves
└────────┬────────────┘
         │ user picks issues
         ▼
┌─────────────────────┐
│  Phase 2: SOLVE     │  Per approved issue:
│  (sequential)       │  1. Comment on Gitea: "Working on this..."
│                     │  2. Analyze issue + screenshots
│                     │  3. Spawn coder agent (worktree)
│                     │  4. Spawn tester agent (verify)
│                     │  5. Merge + commit
└────────┬────────────┘
         │
         ▼
┌─────────────────────┐
│  Phase 3: REPORT    │  Comment resolution on Gitea
│  & CLOSE            │  Close issue via API
└────────┬────────────┘
         │
         ▼
┌─────────────────────┐
│  Phase 4: PUSH      │  git push origin main
│  & SUMMARY          │  Final summary table
└─────────────────────┘
```

## Gitea Connection

- **Instance:** `https://gitea.hartmut-noerenberg.com`
- **Repo:** `Hartmut/plANARCHY`
- **Auth:** Personal access token stored in `~/.gitea-token`
- **API Base:** `https://gitea.hartmut-noerenberg.com/api/v1`

## Current Open Issues (2026-03-17)

| # | Title | Type | Effort | Reporter | Priority |
|---|-------|------|--------|----------|----------|
| 3 | No Blueprints available in New Project Wizard | bug | S | Larissa | P1 |
| 5 | Account not linked to a resource | bug | S | Larissa | P1 |
| 7 | Dropdown menu broken in vacation management | bug | S | Larissa | P1 |
| 6 | My Vacations and Vacation Mgmt selected simultaneously | bug | S | Larissa | P2 |
| 10 | Sick leave not automatically added to timeline | bug | M | Larissa | P2 |
| 8 | Assign different color to Public Holidays vs Annual Vacation | ux | S | Larissa | P3 |
| 4 | Display Hours/Costs total per resource in Project Overview | feature | M | Larissa | P3 |
| 2 | Keep search bar locations consistent on all pages | feature | M | Larissa | P3 |
| 9 | Preferences: toggle "include demand projects" on page load | feature | M | Larissa | P4 |
| 1 | Assign a color to a project | feature | L | Larissa | P4 |

### Triage Notes

**P1 — Bugs (blocking):**
- **#3** — Blueprints likely not seeded in the new Gitea DB, or the query returns empty. Quick check of `blueprint.list` query.
- **#5** — User account created but `Resource.userId` not linked. Need to link Larissa's account to her resource record.
- **#7** — Chapter dropdown filter in VacationClient resets options after selecting one. Likely a state management bug in the filter component.

**P2 — Bugs (non-blocking):**
- **#6** — AppShell sidebar highlights both "My Vacations" and "Vacation Mgmt" simultaneously. URL path matching issue.
- **#10** — Sick leave entries (vacation type SICK) not showing on timeline. The timeline `getEntries` query likely filters vacation types.

**P3 — UX/Feature (quick wins):**
- **#8** — VacationClient uses same color for all vacation types. Add type-specific colors.
- **#4** — Add "Total Hours" and "Total Costs" columns to ProjectAssignmentsTable.
- **#2** — Add search bars to Timeline page matching Allocations page layout.

**P4 — Feature (larger scope):**
- **#9** — User preferences system (new DB field or localStorage) for default filter state.
- **#1** — Project color field + color picker in UI + timeline rendering by project color.

## Agent Spawning Strategy

### For bugs (S effort):
Direct fix in main context — no worktree needed. Read, fix, test, commit.

### For features (M effort):
Spawn a **coder** agent with `isolation: "worktree"` to keep main clean. Review output before merging.

### For features (L effort):
Spawn a **planner** agent first to create implementation plan. Then spawn **coder** agent per task in the plan. Requires user approval at each stage.

## Usage

```bash
# Triage all open issues (dry run)
/gitlooper:gitlooper --dry-run

# Work on all approved issues
/gitlooper:gitlooper

# Work on a specific issue
/gitlooper:gitlooper 7

# Parallel mode (use with care)
/gitlooper:gitlooper --parallel
```

## Files Created

| File | Purpose |
|------|---------|
| `.claude/commands/gitlooper/gitlooper.md` | Slash command definition |
| `~/.gitea-token` | API token (chmod 600, not in repo) |
| `docs/gitlooper-strategy.md` | This strategy document |
