6285be6c2e
Skills clip-* nunca tinham sido committed. Adicionadas todas (9): clip, clip-agent, clip-health, clip-instructions, clip-issue, clip-org, clip-routine, clip-skill, clip-vision. Migração para mcp__paperclip__diag_* (17 substituições em 5 skills): - clip: 5 substituições (agents_by_status, false_blockers, token burn, stuck routines, company_skills_summary) - clip-agent: 2 (agent_full_context consolida 4 passos, false_blockers) - clip-health: 8 (budget_orphans, missing_permissions, missing_heartbeat, routine_triggers_broken, false_blockers, heartbeat_token_usage, prompt_too_long_errors, stuck_routines, zombie_parents) - clip-org: 1 (agent_hierarchy) - clip-routine: 1 (routine_triggers_broken) Sem substituições (CRUD-específico sem diag_* equivalente): clip-instructions, clip-issue, clip-skill — mantêm psql. Refs: Desk #2041, mcp-paperclip feature/diagnostics-db Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
163 lines
4.8 KiB
Markdown
163 lines
4.8 KiB
Markdown
---
|
|
name: clip
|
|
description: Dashboard rápido Paperclip — estado agentes, issues abertas, heartbeats recentes, alertas. Usar quando "clip", "paperclip", "estado clip", "agentes clip".
|
|
context: fork
|
|
---
|
|
|
|
# /clip — Dashboard Paperclip
|
|
|
|
Dashboard rapido do estado do Clip (Paperclip Orquestrador Descomplicar).
|
|
|
|
## Constantes
|
|
|
|
```
|
|
BD: PGPASSWORD="paperclip" psql -h localhost -p 54329 -U paperclip -d paperclip
|
|
COMPANY_ID: ebe10308-efd7-453f-86ab-13e6fe84004f
|
|
```
|
|
|
|
## Procedimento
|
|
|
|
Executar os 5 passos em paralelo (silenciosamente), depois apresentar dashboard compacto.
|
|
|
|
### Passo 1: Estado do servico
|
|
|
|
```bash
|
|
systemctl --user status paperclip 2>&1 | head -5
|
|
```
|
|
|
|
### Passo 2: Agentes por status
|
|
|
|
Invocar tool MCP: `mcp__paperclip__diag_agents_by_status`
|
|
|
|
### Passo 3: Issues abertas
|
|
|
|
```sql
|
|
SELECT i.title, i.status, i.priority, a.name as assignee
|
|
FROM issues i LEFT JOIN agents a ON i.assignee_agent_id = a.id
|
|
WHERE i.company_id = 'ebe10308-efd7-453f-86ab-13e6fe84004f'
|
|
AND i.status NOT IN ('done','cancelled')
|
|
ORDER BY
|
|
CASE i.priority WHEN 'critical' THEN 1 WHEN 'high' THEN 2 WHEN 'medium' THEN 3 ELSE 4 END,
|
|
i.status;
|
|
```
|
|
|
|
### Passo 4: Ultimos 10 heartbeats
|
|
|
|
```sql
|
|
SELECT a.name, hr.status, hr.started_at, hr.finished_at
|
|
FROM heartbeat_runs hr JOIN agents a ON hr.agent_id = a.id
|
|
WHERE a.company_id = 'ebe10308-efd7-453f-86ab-13e6fe84004f'
|
|
ORDER BY hr.started_at DESC LIMIT 10;
|
|
```
|
|
|
|
### Passo 5: Alertas
|
|
|
|
Heartbeats falhados nas ultimas 24h:
|
|
```sql
|
|
SELECT a.name, LEFT(hr.error, 80) as erro, hr.started_at
|
|
FROM heartbeat_runs hr JOIN agents a ON hr.agent_id = a.id
|
|
WHERE a.company_id = 'ebe10308-efd7-453f-86ab-13e6fe84004f'
|
|
AND hr.status = 'failed'
|
|
AND hr.started_at > NOW() - INTERVAL '24 hours'
|
|
ORDER BY hr.started_at DESC;
|
|
```
|
|
|
|
Falsos blockers (INC-07):
|
|
|
|
Invocar tool MCP: `mcp__paperclip__diag_false_blockers`
|
|
|
|
Se resultado > 0 → listar como alerta: "N issues blocked com sub-tasks activas — provavelmente deveriam ser in_progress".
|
|
|
|
Token burn — agentes com consumo excessivo de tokens nas últimas 24h (INC-12):
|
|
|
|
Invocar tool MCP: `mcp__paperclip__diag_heartbeat_token_usage(hours=24)`
|
|
|
|
Se `agentes_risco > 0` → alertar: "TOKEN BURN: N agentes com runs >500K cache tokens — usar /clip-health check 19 para detalhes".
|
|
|
|
Routines presas (INC-08) — a ligação issue→routine está em `routine_runs.linked_issue_id`:
|
|
|
|
Invocar tool MCP: `mcp__paperclip__diag_stuck_routines(hours=4)`
|
|
|
|
Se `routines_presas > 0` → alertar: "ROUTINE BLOQUEADA: N issues de routine paradas >4h — usar /clip-health check 20".
|
|
|
|
Budget (agentes com >0 configurado):
|
|
```sql
|
|
SELECT name, budget_monthly_cents, spent_monthly_cents,
|
|
CASE WHEN budget_monthly_cents > 0
|
|
THEN ROUND(spent_monthly_cents::numeric / budget_monthly_cents * 100, 1)
|
|
ELSE 0 END as pct
|
|
FROM agents
|
|
WHERE company_id = 'ebe10308-efd7-453f-86ab-13e6fe84004f'
|
|
AND budget_monthly_cents > 0
|
|
ORDER BY pct DESC;
|
|
```
|
|
|
|
### Passo 6: Saude API (endpoint dashboard)
|
|
|
|
Verificar se os endpoints criticos respondem:
|
|
```bash
|
|
HEALTH=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3100/api/health)
|
|
DASH=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3100/api/companies/ebe10308-efd7-453f-86ab-13e6fe84004f/dashboard)
|
|
BADGES=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3100/api/companies/ebe10308-efd7-453f-86ab-13e6fe84004f/sidebar-badges)
|
|
echo "health=$HEALTH dashboard=$DASH badges=$BADGES"
|
|
```
|
|
|
|
- health=200 = OK (sem auth)
|
|
- dashboard/badges=401 = OK (auth funciona, endpoint existe)
|
|
- dashboard/badges=404 ou 500 = CRITICO (endpoint em falha, provavelmente refs orfas na BD)
|
|
|
|
Verificar instancias duplicadas:
|
|
```bash
|
|
ss -tlnp | grep -E "310[0-9]" | wc -l
|
|
```
|
|
- 1 = OK
|
|
- 2+ = AVISO (processos orfaos, recomendar limpeza)
|
|
|
|
### Passo 7: Company skills
|
|
|
|
Invocar tool MCP: `mcp__paperclip__diag_company_skills_summary`
|
|
|
|
## Formato de output
|
|
|
|
Apresentar como dashboard compacto:
|
|
|
|
```
|
|
## Clip Dashboard — [data/hora]
|
|
|
|
**Servico:** [running/stopped] ha [tempo]
|
|
**Agentes:** [N] total — [n] running, [n] idle, [n] paused
|
|
**API:** health=[code] dashboard=[code] badges=[code] | Instancias: [N]
|
|
**Skills:** [N] instaladas ([n] locais, [n] skills.sh, [n] github)
|
|
|
|
### Issues abertas
|
|
| Titulo | Status | Prioridade | Assignee |
|
|
...
|
|
|
|
### Heartbeats recentes
|
|
| Agente | Status | Inicio | Fim |
|
|
...
|
|
|
|
### Alertas
|
|
- [CRITICO] descricao
|
|
- [TOKEN BURN] N agentes >500K tokens — /clip-health check 19
|
|
- [ROUTINE BLOQUEADA] N issues paradas >4h — /clip-health check 20
|
|
```
|
|
|
|
## Referencias
|
|
|
|
- Manual: Hub `06-Operacoes/Documentacao/Manuais/Paperclip/`
|
|
- API: `04-Stack/02.06-Clip/skills.md`
|
|
- Spec: `04-Stack/02.06-Clip/docs/superpowers/specs/2026-03-28-clip-grande-visao-design.md`
|
|
|
|
---
|
|
|
|
## Healing Log
|
|
|
|
Registo de erros conhecidos e como evitá-los. Lido automaticamente antes de executar.
|
|
|
|
```jsonl
|
|
{"date":"","issue":"","fix":"","source":"user|auto"}
|
|
```
|
|
|
|
*Adicionar nova linha após cada erro corrigido.*
|