Lesson #1479

← Back to Knowledge Board
agent-dispatch-workflow-gitea-issue-n8n-handler
ID
1479
Author
ai
Agent
agent-claude
Reviewed
✓ Yes
Source authority
75 / 100
Source
Konsolidierte Dispatch-Regel: jede Aufgabe als Gitea-Issue mit @agent-X mention; n8n routet automatisch; spart 10Γ— Claude-Tokens vs Bash-subprocess
Source issue
β€”
Created at
2026-05-12T13:43:50.538702+00:00
Valid until
β€”
Deprecated at
β€”
Supersedes
β€”
Obsidian path
/root/.claude/projects/-nvmetank1-projects/memory/feedback_agent_dispatch_workflow.md
Obsidian hash
3b8ecf01e36068ec5b4ea846fe058731
Tags
claude-memory,feedback

Content

**Konsolidiert 2026-05-12** aus `feedback_gitea_issue_workflow` + `feedback_n8n_automation` (beide hatten 60 % Overlap).

## Rule

EVERY project task β€” auch single bug-fixes β€” landet als Gitea-Issue im relevanten Repo BEVOR irgendein Agent dispatched wird. **Kein silent in-memory todo-only work.**

Bevorzuge **`@agent-X`-mention in einer Gitea-Issue/Comment** ΓΌber `Bash subprocess`. n8n-flow `03-Agent-Dispatch (Mention-Listener)` handhabt den Dispatch automatisch.

## Why

User reaffirmed 2026-05-05: "die aufgaben sind aktuell nicht im gitea. merke dir bei jeder claude code session, jedes projekt immer ins repo und ein issue dazu erfassen."

Plus token-saving (user 2026-05-04: "nutze dein wissen ΓΌber n8n um dinge zu automatisieren und weniger tokens zu verbrauchen"):

| Pfad | Claude-Tokens |
|---|---|
| Direct or-agent subprocess via Bash | ~5k (prompt-write + monitor-loop + log-parse) |
| Gitea-issue + n8n-dispatch | ~500 (Issue-body only) |
| **Ratio** | **10Γ— gΓΌnstiger** |

## How to apply

### 1. Create Gitea-Issue

**Title:** kurzes imperative ("fix(X): one-line", "feat(scope): one-line")

**Body-Struktur** (proven examples: ubuadmin/glug#620, #562, #450):
```markdown
## Goal
<one paragraph>

## Steps
1. <concrete step>
2. ...

## Acceptance criteria
- <testable bullet>
- bin/smoke passes

@agent-codex  ← oder gemini/or/qwen/claude/cursor
```

### 2. Labels (combined, all required)

| Label | Werte | Pflicht |
|---|---|---|
| `agent-X` | claude/codex/gemini/or/qwen/cursor | βœ“ |
| `priority-X` | low/medium/high | βœ“ (Flight Recorder AP1 Β§4) |
| `status-X` | ready/in-progress/review/done | βœ“ |
| `type-X` | feature/bug/refactor/docs/epic | βœ“ |
| codex-specific: `package` | fΓΌr bundle-issues | optional |

### 3. Agent-Auswahl per Capability

| Task-Typ | Agent-Label |
|---|---|
| Backend / auth / pytest / small-coding | `agent-codex` |
| Read-only review / long-context / second-opinion | `agent-gemini` oder `agent-or` |
| Single-file CSS / templates | `agent-or-coder-plus` |
| Bulk renames / mechanical refactor | `agent-qwen` |
| Cross-cutting architecture / spec design | `agent-claude` (orchestrator) |
| Local-dev assist (manuell) | `agent-cursor` |

Bei Unsicherheit: `agent-dispatch route --task "<desc>" --repo X` β†’ pickt automatisch.

### 4. Repo-Auswahl

- yoga UI/admin/auth bug β†’ `ubuadmin/yoga`
- glug framework bug β†’ `ubuadmin/glug`
- rag-stack governance/orchestrator/agent stuff β†’ `ubuadmin/rag-stack`
- bugtest-stack Phase-1 β†’ `ubuadmin/bugtest-stack`
- Flyspray-public-bugs (User-Reports) β†’ kommen via `bug.joelduss.xyz` rein, werden vom Triage-Classifier (rag-stack#122) auf richtigen Repo geroutet

### 5. Walk away β€” n8n routet

n8n-Flow `03-Agent-Dispatch (Mention-Listener)` empfΓ€ngt Gitea-Webhook:
- Trigger: comment/body enthΓ€lt `@agent-<name>` ODER label `agent-<name>` + `status-ready`
- Action: ruft `POST hooks.joelduss.xyz/hook/host-action/agent-<name>` mit X-Webhook-Token
- agent-dispatch-receiver (in rag-stack/bin/) spawnt `/nvmetank1/projects/rag-stack/bin/agent-handler-<name>.sh <repo> <issue>`
- Handler liest Issue, ruft CLI, postet ack + result als Comment, optional PR

### 6. Monitor

- `mcp__gitea__list_issues label=agent-X state=open` (every 5-10min) β€” oder via Web /governance/bugs
- `tail -20 /var/log/glug-agent-handler.log` β€” last handler invocations
- Watch for `status-review` label β†’ handler hat PR aufgemacht

## Verify n8n is live

```sh
docker ps --filter name=n8n --format '{{.Status}}'
# Should be "Up X hours"

docker logs n8n-automation --tail 30   # last events
```

## When NOT to use n8n dispatch (still spawn subprocess)

- Quick exploratory recon < 30 seconds
- Tasks needing live tail of agent output (debugging agent itself)
- When n8n is down (`docker ps | grep n8n` shows nothing)
- When der `claude --print` direkter & schneller ist (z.B. quick Triage-Classification)

## Forward-compat

- rag-stack#92 dispatcher (`agent-dispatch route`) ist single-entry-point β€” wenn ready, ersetzt es das @-mention-Routing.
- Flyspray-Integration (#117): bug.joelduss.xyz REST-Webhook β†’ rag-stack triage β†’ schreibt automatisch in Gitea + dispatched.

## Reference

- orchestrator.joelduss.xyz β€” Multi-Agent-Übersicht / Activity / Bugs
- /governance/bugs β€” alle gitea-issues mit type-bug across alle ubuadmin repos
- /var/log/glug-agent-handler.log β€” Logs aller Dispatches