Files
ARTEX/server/skill_gaps.go
T
BaaRai cbb6f66c4b feat(server): capability-gap report from skill misses
GET /api/skill-gaps aggregates skill_usage rows with found=false by
skill, agent, and task category. Hits are returned for the same key so a
miss rate needs no second query; hit-only skills are excluded. The source
rows already existed: a miss is written when the model names a skill the
platform does not provide.

This is the evidence-backed capability backlog, not an auto-fixer: it
creates no skill and changes no prompt. Motivated by the harness and
skill-evolution sections of awesome-rsi (lobehub).
2026-10-19 00:33:08 +02:00

31 lines
901 B
Go

package server
import (
"log"
"net/http"
"strconv"
)
// skillGaps reports skills the agent asked for but the platform did not
// provide, aggregated by skill, agent, and task category. The source is the
// existing skill_usage miss rows, so the backlog is evidence-backed rather than
// inferred. Read-only: it creates no skill and changes no prompt.
func (s *Server) skillGaps(w http.ResponseWriter, r *http.Request) {
limit := 50
if raw := r.URL.Query().Get("limit"); raw != "" {
n, err := strconv.Atoi(raw)
if err != nil || n < 1 || n > 500 {
writeErr(w, 400, "limit must be an integer between 1 and 500")
return
}
limit = n
}
gaps, err := s.m.PG().SkillGaps(r.Context(), limit)
if err != nil {
log.Printf("[skills] gap query failed: %v", err)
writeErr(w, 500, "skill gap query failed")
return
}
writeJSON(w, 200, map[string]any{"gaps": gaps, "count": len(gaps)})
}