hbox-docs/agentes/agente-diario.md

8.4 KiB
Raw Blame History

Daily agent — runbook (Claude-facing)

Created 27-oct-2026. The team-facing rules are docs/agentes.md (published at /agentes/). When the two disagree, the stricter one wins; change both in the same commit. Everything the team reads is Mexican Spanish.

You run as a scheduled task on Leo's Mac (Monday–Friday, 18:37 Mexico City). You reach the Mac through the device bridge: device_bash for files in the mounted Drogheda folder (read and write; never git there), and the desktop-commander start_process tool for native macOS commands (ssh to the server, git in your own clone). If the computer or the server cannot be reached, stop and say so in the summary — do not improvise another path.

Paths: D=~/Documents/Claude/Projects/Drogheda, H=$D/hbox-docs (Leo's working copy — read it, write lotes and notes there, never git), A=~/Documents/Claude/Projects/_agentes/hbox-docs (your own clone for code fixes, outside the Drogheda repo; create it with git clone ssh://git@git.helgen.online:222/Helgen-Services/hbox-docs.git if missing, and pip install mkdocs-material in a venv there if mkdocs is not on the Mac).

API: $H/scripts/agente-api.sh METHOD PATH [json-file] (ssh + curl on 127.0.0.1:8081 as claude). Server files you may read over ssh as leo: /srv/projects/drogheda/{incidencias,acceso,standup,tareas,equipo}/…. You never use sudo.

0. Preflight (5 minutes)

  1. Read $H/CLAUDE.md, $H/docs/agentes.md, this file, and $D/CLAUDE.md §★ and §0.
  2. Fresh board: cd $H && ./scripts/tablero.sh foto (read-only), then read $H/_estado/tablero.md.
  3. Today's vigía report: ssh leo@git.helgen.online cat /srv/projects/drogheda/incidencias/_vigia/$(date +%F).json.
  4. Note what another session is doing: git -C $H status --short via start_process (native, read-only) — if the tree is dirty, someone is mid-task: do not touch the files they changed.

1. Incidents

Inputs: GET /api/incidencias?estado=abiertas, each one with GET /api/incidencia?id=…, GET /api/incidencias/errores?dias=2, the vigía report, and the last 2 days of /srv/projects/drogheda/acceso/intentos-AAAA-MM.jsonl (never print passwords — they are never stored anyway).

For every open incident, in this order (gravedad alta first):

  1. Triage — PATCH /api/incidencia?id= with tipo, gravedad, asignado (claude for site software; gibranlp for htracker/monitor/server; leo for decisions, accounts and anything physical), estado: en-revision, and a comment in Mexican Spanish: what you understood, what you will do, and — if information is missing — the exact question for the reporter. Duplicates: duplicado_de + estado: descartada + a comment linking the original.
  2. Reproduce in a local copy (the cloud container is fine: build the site from $A, run the backend with temp data like backend/tests-1027.sh does). Write the cause in a comment. If you cannot reproduce, say what you tried.
  3. Fix following the levels below. Comment what changed and how to undo it.
  4. Close — an incident fixed and published yesterday (estado: esperando) whose firma / page shows no new errors in the vigía report and the error logs for 24 h → estado: resuelta with a one-line comment. Access incidents: only when the person has an ok in the intentos log after the fix.
  5. Public notice — if a failure keeps several people from logging in, set publica: true with a short resumen_publico (no internal names, no data) and remove it when solved.

Level A — do it yourself (no authorization)

Only changes inside docs/ of hbox-docs that are pages, text, links, CSS or the JavaScript of the boards (docs/tableros/*.js|css|md, docs/*.md, docs/js/sitio.js, docs/js/standup.js). Not level A: docs/entrar.html, docs/publico/, docs/cuenta.html, docs/salir.html, docs/js/incidencias.js, docs/formularios/, backend/, overrides/, hooks/, mkdocs.yml nav changes, anything on the server.

  1. In $A: git checkout main && git pull --ff-only. Make the change. Commit message: agente: INC-xxxx <qué> (Claude, agente diario) + the attribution lines.
  2. mkdocs build --strict must pass; run the backend tests that touch what you changed (bash backend/tests-1027.sh . at least); check the page in light, dark and 390-px width with Playwright.
  3. Deploy-safety check: rsync -n -c -i --delete -e ssh site/ leo@git.helgen.online:/srv/projects/drogheda/hbox-docs/site/. Every listed file must be explained by your change (the changed pages, search/search_index.json, sitemap.xml*, and — if you changed a CSS/JS file — the pages whose ?v= hash moved). Anything else means the server has work that is not in main (Leo deployed something uncommitted): stop, do not deploy, push a branch instead (level B).
  4. Deploy the site only: rsync -az --delete -e ssh site/ leo@git.helgen.online:/srv/projects/drogheda/hbox-docs/site/ (never deploy.sh: it also copies the backend). Then git push main.
  5. Leo's working copy: if git -C $H status --porcelain is empty and it is on main, git -C $H pull --ff-only (native, via start_process). If it is dirty, do not touch it; tell Leo in the summary to git pull --rebase before his next push.
  6. Incident → estado: esperando, comment: «Publicado: … Lo cierro mañana si no se repite.»

Level B — prepare it, Leo approves

Backend, nginx, systemd, accounts, passwords, permissions, data (actas, inventario, pendientes), the entry page, the field forms, deleting anything, sudo, restarts. Work in $A on a branch agente/AAAA-MM-DD-INC-xxxx, with tests, push the branch, and comment on the incident with the exact commands Leo runs (merge, deploy, restart). Board changes always go in a lote ($H/backend/lotes/AAAA-MM-DD_agente.json, format in backend/lotes/README.md); Leo applies it.

Never

Delete anything · read, store, ask for or reset passwords · change permissions · send messages or email in anyone's name · put project data on the public entry page · touch the 4G/NTRIP parameter file · edit an applied lote · push to main anything that failed a check.

2. Standup bot

  1. Read today's answers: GET /api/standup?fecha=$(date +%F). For each answer:
    • Board changes the person already made with the checkbox are done — do not repeat them.
    • bloqueos that need someone else → in the lote, a comment on that pendiente (nota) naming who unblocks it, or a new pendiente for that person if none exists (si_no_hay).
    • Things they finished that are not on the board → comment on the closest pendiente; do not invent tasks. Write the lote to $H/backend/lotes/AAAA-MM-DD_standup.json (validate with tablero.validar_cambio before saving).
  2. Prepare the next working day (Friday → Monday): one entry per team member with open pendientes (from the fresh snapshot; skip claude and vigia). For each person:
    • instrucciones: 2–5 concrete steps for that day, in order, each tied to an existing pendiente (tarea_id) or a decision, with a liga to the document, form or board view (relative URL). Field technicians get the acta form to fill (/formularios/…html?serie=…&sitio=…). Use what they answered today and the latest juntas/decisions.
    • preguntas: one per open pendiente (max 6; overdue, en-curso and bloqueado first), each a specific question («¿Ya llegó la cotización de gabinetes o sigue bloqueada por el pago?»), never generic.
    • nota_bot: one line about yesterday (e.g. «Ayer cerraste 2; quedó bloqueado t-… esperando a Leo»). Mexican Spanish, «tú», short sentences. Save as JSON and POST /api/standup/preparar with fecha = next working day.
  3. People who did not answer for 2 working days in a row → mention them in the summary for Adriana (do not nag them).

3. Close the run

  1. Summary to Leo (final message, Mexican Spanish, ≤ 25 lines): incidents opened/closed/fixed (with ids), what needs his OK with the exact commands, standup (answered n of m, blockers and who unblocks them), the lote(s) to apply (./scripts/tablero.sh revisar → aplicar).
  2. Bitácora only if you published a fix: one line under today's date in $H/docs/bitacora.md… only through $A (level A commit), never by editing $H directly.
  3. If the run itself hit friction (a missing API, a permission), open an incident about it (origen: agente) so it is fixed like any other.