chore: auto-commit (286 archivos)

- .claude/agents/fn-orquestador/SKILL.md
- .claude/commands/fn_claude.md
- .claude/rules/INDEX.md
- .claude/rules/cpp_apps.md
- .claude/rules/ids_naming.md
- CHANGELOG.md
- apps/dag_engine/README.md
- apps/dag_engine/api.go
- apps/dag_engine/dags_migrated/example.yaml
- apps/dag_engine/dags_migrated/example_lineage_tracking.yaml
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-16 16:33:22 +02:00
parent 0b9af8f1bb
commit a03675113a
281 changed files with 12596 additions and 19526 deletions
@@ -1,12 +1,31 @@
---
id: 0085
title: Estandarizar llamadas a funciones del registry desde Claude + app de monitorizacion de uso
status: pending
status: done
closed: 2026-05-15
priority: high
created: 2026-05-13
related: [0068, 0069]
---
## Cierre 2026-05-15
Todas las piezas del plan implementadas:
- Schema event-log + vistas (0085a/0085l) — 7 tablas + `function_stats` view + `function_versions`.
- Hook Bash PostToolUse (0085b) capturando mcp/heredoc/sqlite_direct/edit_registry/violations.
- Wrappers opt-in (0085c py + 0085c-bash) activables via `FN_TELEMETRY=1`, smoke verificado.
- Interceptor en `fn run` (0085d-go) con duration real medida.
- UI tab "Claude Usage" en `registry_dashboard` (0085d/0085e) con KPIs + sub-tabs.
- Clusterizacion de patrones inline (0085f) — `call_monitor cluster-patterns [--persist]`, 11 clusters detectados, upsert idempotente.
- Reglas violation declarativas (0085g, parcial) — `dev/violation_rules.yaml` source-of-truth con 4 activas + 4 propuestas inactivas; runtime YAML reader TBD.
- Pipeline `call_monitor propose` (0085h) genera proposals con evidencia desde `function_stats`+`copied_code`+`violations`.
- Auditoria estatica de copia (0085k) `fn doctor copied-code`.
- Documentacion (0085j) — CLAUDE.md + `.claude/rules/registry_calls.md`.
Piezas futuras documentadas pero fuera del MVP: build-tag Go telemetry (0085m), macro C++ `FN_CALL` (0085n), runtime YAML reader del hook, vistas adicionales del dashboard (drill-down por sesion + diff entre sesiones).
---
## Contexto
Claude actualmente invoca funciones del registry de formas heterogeneas y sin trazabilidad:
@@ -286,13 +305,13 @@ Consultas utiles:
|---|---|---|---|
| 1 | Migracion `call_monitor.operations.db` schema (7 tablas event-log + vista `function_stats`) | 0085a | **hecho** |
| 2 | Hook Bash `PostToolUse` que parsea tools y escribe `calls`/`code_writes`/`violations` | 0085b | **hecho** |
| 3a | Wrapper Python `registry_telemetry` (activable con `FN_TELEMETRY=1`) | 0085c | pending |
| 3b | Wrapper Bash `bash/lib/telemetry_prelude.sh` | 0085c-bash | pending |
| 3a | Wrapper Python `registry_telemetry` (activable con `FN_TELEMETRY=1`) | 0085c | **hecho**`python/functions/infra/registry_telemetry.py`, sys.meta_path importer + `wrap_namespace`. Smoke verificado 2026-05-15: `filter_list_py_core` logged con `tool_used=python_wrapper`. |
| 3b | Wrapper Bash `telemetry_prelude` | 0085c-bash | **hecho**`bash/functions/infra/telemetry_prelude.sh`, autowrap idempotente via declare -f + eval rename. Smoke verificado 2026-05-15: `wait_for_http_bash_infra` logged con `tool_used=bash_wrapper`. |
| 3c | Interceptor en `fn run` (binario Go) | 0085d-go | **hecho** |
| 4 | Tab "Claude Usage" en `registry_dashboard` (datasource `ops:call_monitor`, KPIs + 3 sub-tabs) | 0085d | **hecho** |
| 5 | Top usage, huerfanas, sesiones (vistas UI) | 0085e | pending |
| 6 | Clusterizacion heredocs + tabla `patterns` populada | 0085f | pending |
| 7 | Reglas violation configurables YAML | 0085g | pending |
| 5 | Top usage, huerfanas, sesiones (vistas UI) | 0085e | **hecho** — implementadas en `registry_dashboard` tab "Claude Usage" (`projects/fn_monitoring/apps/registry_dashboard/views.cpp`, `data.h`, `data_http.h`). KPIs Reg%, MCP, Errors, Violations + sub-tabs top/huerfanas/sesiones. |
| 6 | Clusterizacion heredocs + tabla `patterns` populada | 0085f | **hecho** 2026-05-15 — `call_monitor cluster-patterns [--persist]` (`cluster.go`). Normaliza snippets (quoted strings -> STR, paths -> /PATH, hex 8+ -> HEX, numbers -> N), hashea sha256-truncado, agrega ocurrencias + session_ids. 11 clusters detectados de 286 calls inline; persistencia con UPSERT idempotente. 3 unit tests (TestNormalizeSnippet/TestHashSnippetStable/TestSplitCSV) pass. |
| 7 | Reglas violation configurables YAML | 0085g | **parcial** 2026-05-15 — `dev/violation_rules.yaml` cataloga 4 reglas activas (sqlite3_registry_select, python_dir_inspect, import_star_in_heredoc, client_http_request_direct) + 4 propuestas inactivas (mcp_ratio_low, heredoc_repetition, edit_registry_without_fn_index, protected_path_modified). YAML es source-of-truth declarativo. **Runtime reader TBD**: el hook PostToolUse sigue hardcoded; futura iteracion requiere jq/yq + refactor para leer reglas dinamicamente. |
| 8 | Pipeline `call_monitor propose` (funcion `infra.GenerateProposalsFromTelemetry` + `infra.PersistProposalDrafts`) que escribe a `registry.db.proposals` desde `function_stats` + `copied_code` + `violations`. 4 reglas MVP: copy_detected, orphan, bug, wrapper_skip. INSERT OR IGNORE con id determinista | 0085h | **hecho** |
| 9 | `e2e_checks` propios de call_monitor (en `app.md`, ya declarados) | 0085i | parcial (declarado) |
| 10 | Documentacion CLAUDE.md + rules (registry_calls.md) | 0085j | **hecho** |