renderLogsCompact outputs maximally information-dense output optimized for agentic consumption. Designed for LLM context windows: minimal formatting, no decoration, structured but flat. Format sections: [summary] key=value pairs on one line [runs] aligned table with essential per-run metrics [e
(data LogsData)
| 54 | // [tools] top tool usage (only if present) |
| 55 | // [mcp] MCP failures (only if present) |
| 56 | func renderLogsCompact(data LogsData) { |
| 57 | logsCompactLog.Printf("Rendering %d runs in compact format", data.Summary.TotalRuns) |
| 58 | |
| 59 | s := data.Summary |
| 60 | |
| 61 | // [summary] single line of key=value pairs |
| 62 | summaryParts := []string{ |
| 63 | "runs=" + strconv.Itoa(s.TotalRuns), |
| 64 | "duration=" + s.TotalDuration, |
| 65 | "turns=" + strconv.Itoa(s.TotalTurns), |
| 66 | "errors=" + strconv.Itoa(s.TotalErrors), |
| 67 | } |
| 68 | if s.TotalAIC > 0 { |
| 69 | summaryParts = append(summaryParts, "aic="+formatCompactAIC(s.TotalAIC)) |
| 70 | } |
| 71 | if s.TotalTokens > 0 { |
| 72 | summaryParts = append(summaryParts, "tokens="+strconv.Itoa(s.TotalTokens)) |
| 73 | } |
| 74 | if s.TotalWarnings > 0 { |
| 75 | summaryParts = append(summaryParts, "warnings="+strconv.Itoa(s.TotalWarnings)) |
| 76 | } |
| 77 | if s.TotalMissingTools > 0 { |
| 78 | summaryParts = append(summaryParts, "missing_tools="+strconv.Itoa(s.TotalMissingTools)) |
| 79 | } |
| 80 | if s.TotalGitHubAPICalls > 0 { |
| 81 | summaryParts = append(summaryParts, "github_api="+strconv.Itoa(s.TotalGitHubAPICalls)) |
| 82 | } |
| 83 | if len(s.EngineCounts) > 0 { |
| 84 | parts := make([]string, 0, len(s.EngineCounts)) |
| 85 | for engine, count := range s.EngineCounts { |
| 86 | parts = append(parts, engine+":"+strconv.Itoa(count)) |
| 87 | } |
| 88 | summaryParts = append(summaryParts, "engines="+strings.Join(parts, ",")) |
| 89 | } |
| 90 | // Outcome metrics if available |
| 91 | if s.OutcomeAccepted > 0 || s.OutcomeRejected > 0 { |
| 92 | summaryParts = append(summaryParts, |
| 93 | "accepted="+strconv.Itoa(s.OutcomeAccepted), |
| 94 | "rejected="+strconv.Itoa(s.OutcomeRejected), |
| 95 | ) |
| 96 | if s.OutcomeAcceptanceRate > 0 { |
| 97 | summaryParts = append(summaryParts, "acceptance="+fmt.Sprintf("%.0f%%", s.OutcomeAcceptanceRate*100)) |
| 98 | } |
| 99 | } |
| 100 | fmt.Fprintf(os.Stdout, "[summary] %s\n", strings.Join(summaryParts, " ")) |
| 101 | |
| 102 | if len(data.Runs) == 0 { |
| 103 | return |
| 104 | } |
| 105 | |
| 106 | // [runs] aligned table using tabwriter |
| 107 | fmt.Fprintln(os.Stdout, "[runs]") |
| 108 | w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) |
| 109 | fmt.Fprintln(w, "RUNID\tWORKFLOW\tENGINE\tSTATUS\tDUR\tTOKENS\tAIC\tTURNS\tERR\tEVENT\tACTOR\tBRANCH") |
| 110 | |
| 111 | for _, r := range data.Runs { |
| 112 | status := r.Conclusion |
| 113 | if status == "" { |