The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Add interactive local trace browser
Justin D'Souzaa611cd53cbb8
diff --git a/README.md b/README.mdindex d64b437d..5c9a3d81 100644--- a/README.md+++ b/README.md@@ -110,6 +110,12 @@ Beacon continuously captures your session history in the background.### 3. Explore your history+```bash+beacon traces+```++This opens a local terminal browser for traces, event timelines, token usage, and retained content. Nothing is sent anywhere. To use the local web view instead:+```bashbeacon endpoint dashboard```diff --git a/cli/beacon/README.md b/cli/beacon/README.mdindex ec0eb8b6..1511a2c4 100644--- a/cli/beacon/README.md+++ b/cli/beacon/README.md@@ -17,6 +17,7 @@ make build./beacon endpoint disconnect./beacon endpoint discover --json./beacon endpoint repair+./beacon traces./beacon endpoint dashboard./beacon endpoint uninstall --keep-logs```@@ -130,6 +131,18 @@ ingest tokens already select the target repository.## Dashboard+Use the full-screen terminal browser for a local trace list, search, event filters,+and event details:++```bash+./beacon traces+```++The browser reads the same local runtime JSONL and trace index as the commands+under `beacon endpoint traces`. With redirected input or output it falls back to+a bounded tab-separated list, while `endpoint traces list`, `search`, and `show`+remain available for scripting and JSON output.+```bash./beacon endpoint dashboard./beacon endpoint dashboard --addr 127.0.0.1:8765diff --git a/cli/beacon/cmd/endpoint.go b/cli/beacon/cmd/endpoint.goindex 6f0761af..dc1ffa3d 100644--- a/cli/beacon/cmd/endpoint.go+++ b/cli/beacon/cmd/endpoint.go@@ -354,6 +354,7 @@ func init() {rootCmd.AddCommand(topLevelDoctorCmd)rootCmd.AddCommand(topLevelStatusCmd)rootCmd.AddCommand(topLevelInventoryCmd)+ rootCmd.AddCommand(topLevelTracesCmd)endpointCmd.AddCommand(endpointInstallCmd)endpointCmd.AddCommand(endpointStatusCmd)@@ -409,6 +410,9 @@ func init() {c.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and the system collector service")c.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")}+ topLevelTracesCmd.Flags().BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")+ topLevelTracesCmd.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and the system collector service")+ topLevelTracesCmd.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")endpointInstallCmd.Flags().StringVar(&endpointOpts.harnesses, "harness", "claude,codex", "Comma-separated harnesses to configure")endpointInstallCmd.Flags().IntVar(&endpointOpts.grpcPort, "otlp-grpc-port", endpointconfig.DefaultGRPCPort, "Local OTLP gRPC port")diff --git a/cli/beacon/cmd/endpoint_traces.go b/cli/beacon/cmd/endpoint_traces.goindex 3998d975..f25afa68 100644--- a/cli/beacon/cmd/endpoint_traces.go+++ b/cli/beacon/cmd/endpoint_traces.go@@ -3,6 +3,7 @@ package cmdimport ("encoding/json""fmt"+ "io""os""strings"@@ -10,6 +11,7 @@ import ("github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/dashboard""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/lifecycle"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/traceview")var endpointTraceOpts struct {@@ -31,6 +33,38 @@ var endpointTracesCmd = &cobra.Command{Short: "Index and search local endpoint traces",}+var topLevelTracesCmd = &cobra.Command{+ Use: "traces",+ Short: "Browse local endpoint traces in the terminal",+ SilenceUsage: true,+ RunE: runTopLevelTraces,+}++var runTraceView = traceview.Run++func runTopLevelTraces(cmd *cobra.Command, args []string) error {+ logPath := endpointTraceLogPath()+ if !isCharDevice(os.Stdin) || !isCharDevice(os.Stdout) || strings.EqualFold(os.Getenv("TERM"), "dumb") {+ result, err := dashboard.ReadTraceList(logPath, dashboard.TraceQuery{Limit: 100})+ if err != nil {+ return err+ }+ printPlainTraceList(cmd.OutOrStdout(), result)+ return nil+ }+ return runTraceView(logPath, os.Stdin, cmd.OutOrStdout())+}++func printPlainTraceList(out io.Writer, result dashboard.TraceListResultV1) {+ for _, trace := range result.Traces {+ title := strings.Join(strings.Fields(trace.Title), " ")+ fmt.Fprintf(out, "%s\t%s\t%s\t%s\n", trace.ID, trace.Harness.Name, trace.UpdatedAt, title)+ }+ if result.Truncated {+ fmt.Fprintf(out, "Showing %d of %d traces; use `beacon endpoint traces list --page` to continue.\n", result.Returned, result.TotalMatched)+ }+}+var endpointTracesStatusCmd = &cobra.Command{Use: "status",Short: "Show local trace store status",@@ -92,12 +126,7 @@ var endpointTracesListCmd = &cobra.Command{if endpointOpts.jsonOutput {return json.NewEncoder(os.Stdout).Encode(result)}- for _, trace := range result.Traces {- fmt.Printf("%s\t%s\t%s\t%s\n", trace.ID, trace.Harness.Name, trace.UpdatedAt, trace.Title)- }- if result.Truncated {- fmt.Printf("Showing %d of %d traces; use --page or --limit to continue.\n", result.Returned, result.TotalMatched)- }+ printPlainTraceList(cmd.OutOrStdout(), result)return nil},}diff --git a/cli/beacon/cmd/endpoint_traces_tui_test.go b/cli/beacon/cmd/endpoint_traces_tui_test.gonew file mode 100644index 00000000..aea6c8ae--- /dev/null+++ b/cli/beacon/cmd/endpoint_traces_tui_test.go@@ -0,0 +1,44 @@+package cmd++import (+ "bytes"+ "strings"+ "testing"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/dashboard"+)++func TestTopLevelTracesCommandIsRegistered(t *testing.T) {+ command, _, err := rootCmd.Find([]string{"traces"})+ if err != nil {+ t.Fatalf("find traces command: %v", err)+ }+ if command != topLevelTracesCmd {+ t.Fatalf("root traces command = %p, want %p", command, topLevelTracesCmd)+ }+}++func TestPrintPlainTraceList(t *testing.T) {+ result := dashboard.TraceListResultV1{+ Traces: []dashboard.TraceSummaryV1{{+ ID: "session:cursor:s1",+ Title: "A local trace",+ UpdatedAt: "2026-09-21T08:00:00Z",+ Harness: dashboard.TraceHarnessV1{Name: "cursor"},+ }},+ TotalMatched: 150,+ Returned: 1,+ Truncated: true,+ }+ var out bytes.Buffer+ printPlainTraceList(&out, result)+ for _, want := range []string{+ "session:cursor:s1\tcursor\t2026-09-21T08:00:00Z\tA local trace",+ "Showing 1 of 150 traces",+ "beacon endpoint traces list --page",+ } {+ if !strings.Contains(out.String(), want) {+ t.Fatalf("plain output missing %q:\n%s", want, out.String())+ }+ }+}diff --git a/cli/beacon/cmd/root.go b/cli/beacon/cmd/root.goindex f8b98776..41a43d65 100644--- a/cli/beacon/cmd/root.go+++ b/cli/beacon/cmd/root.go@@ -45,6 +45,7 @@ func printRootSplash(cmd *cobra.Command) {fmt.Fprintln(out)fmt.Fprintln(out, "Start with:")fmt.Fprintln(out, " beacon endpoint install")+ fmt.Fprintln(out, " beacon traces")fmt.Fprintln(out, " beacon endpoint status")fmt.Fprintln(out, " beacon endpoint wazuh print-config")fmt.Fprintln(out)diff --git a/cli/beacon/go.mod b/cli/beacon/go.modindex 075a5f4a..ba2c676b 100644--- a/cli/beacon/go.mod+++ b/cli/beacon/go.mod@@ -4,6 +4,8 @@ go 1.25.0require (github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve v0.0.0+ github.com/charmbracelet/bubbletea v1.3.10+ github.com/charmbracelet/lipgloss v1.1.0github.com/pelletier/go-toml/v2 v2.3.1github.com/spf13/cobra v1.8.1golang.org/x/sys v0.47.0@@ -17,16 +19,30 @@ replace github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve => ../../pkgrequire (cel.dev/expr v0.25.1 // indirectgithub.com/antlr4-go/antlr/v4 v4.13.1 // indirect+ github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect+ github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect+ github.com/charmbracelet/x/ansi v0.10.1 // indirect+ github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect+ github.com/charmbracelet/x/term v0.2.1 // indirectgithub.com/cpuguy83/go-md2man/v2 v2.0.4 // indirectgithub.com/dustin/go-humanize v1.0.1 // indirect+ github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirectgithub.com/google/cel-go v0.30.0 // indirectgithub.com/google/uuid v1.6.0 // indirectgithub.com/inconshreveable/mousetrap v1.1.0 // indirect+ github.com/lucasb-eyer/go-colorful v1.2.0 // indirectgithub.com/mattn/go-isatty v0.0.24 // indirect+ github.com/mattn/go-localereader v0.0.1 // indirect+ github.com/mattn/go-runewidth v0.0.16 // indirect+ github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect+ github.com/muesli/cancelreader v0.2.2 // indirect+ github.com/muesli/termenv v0.16.0 // indirectgithub.com/ncruces/go-strftime v1.0.0 // indirectgithub.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect+ github.com/rivo/uniseg v0.4.7 // indirectgithub.com/russross/blackfriday/v2 v2.1.0 // indirectgithub.com/spf13/pflag v1.0.5 // indirect+ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirectgo.yaml.in/yaml/v3 v3.0.4 // indirectgolang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirectgolang.org/x/text v0.39.0 // indirectdiff --git a/cli/beacon/go.sum b/cli/beacon/go.sumindex b2a330e0..570545dc 100644--- a/cli/beacon/go.sum+++ b/cli/beacon/go.sum@@ -2,10 +2,26 @@ cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4=cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=+github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=+github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=+github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=+github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4=+github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=+github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=+github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=+github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=+github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ=+github.com/charmbracelet/x/ansi v0.10.1/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=+github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=+github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=+github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=+github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=+github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=+github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=github.com/google/cel-go v0.30.0 h1:ll54AkzKunWkBn9wSoiUXbFZXYZTkdJGNXTBXUoolGo=github.com/google/cel-go v0.30.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8=github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=@@ -18,20 +34,37 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFsgithub.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=+github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=+github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=+github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=+github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=+github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=+github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=+github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=+github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=+github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=+github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=+github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=+github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=github.com/pelletier/go-toml/v2 v2.3.1 h1:MYEvvGnQjeNkRF1qUuGolNtNExTDwct51yp7olPtrEc=github.com/pelletier/go-toml/v2 v2.3.1/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=+github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=+github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=+github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=+github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=+github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA=@@ -40,6 +73,7 @@ golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk=golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40=golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=+golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg=diff --git a/cli/beacon/internal/endpoint/traceview/traceview.go b/cli/beacon/internal/endpoint/traceview/traceview.gonew file mode 100644index 00000000..57b6cfc1--- /dev/null+++ b/cli/beacon/internal/endpoint/traceview/traceview.go@@ -0,0 +1,596 @@+// Package traceview provides the full-screen, local-only trace browser.+package traceview++import (+ "encoding/json"+ "fmt"+ "io"+ "strings"+ "time"+ "unicode/utf8"++ tea "github.com/charmbracelet/bubbletea"+ "github.com/charmbracelet/lipgloss"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/dashboard"+)++const loadLimit = 2000++type Store interface {+ List(query string) (dashboard.TraceListResultV1, error)+ Show(id string, eventTypes []string) (dashboard.TraceShowResultV1, bool, error)+}++type localStore struct {+ logPath string+}++func (s localStore) List(query string) (dashboard.TraceListResultV1, error) {+ return dashboard.ReadTraceList(s.logPath, dashboard.TraceQuery{+ EventQuery: dashboard.EventQuery{Q: query},+ Limit: loadLimit,+ })+}++func (s localStore) Show(id string, eventTypes []string) (dashboard.TraceShowResultV1, bool, error) {+ return dashboard.ShowTrace(s.logPath, id, dashboard.TraceQuery{+ Limit: loadLimit,+ EventTypes: eventTypes,+ })+}++type viewMode int++const (+ listMode viewMode = iota+ detailMode+)++type listLoaded struct {+ result dashboard.TraceListResultV1+ err error+}++type detailLoaded struct {+ result dashboard.TraceShowResultV1+ ok bool+ err error+}++type Model struct {+ store Store++ width, height int+ mode viewMode+ loading bool+ err error++ query string+ searchInput string+ searching bool+ traces []dashboard.TraceSummaryV1+ totalMatched int+ selected int+ listOffset int++ detail dashboard.TraceShowResultV1+ eventTypes []string+ filterLabel string+ eventIndex int+ detailScroll int+}++var (+ accentStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("99")).Bold(true)+ dimStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("245"))+ selectedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("15")).Background(lipgloss.Color("237")).Bold(true)+ errorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("203"))+ ruleStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("240"))+)++func NewModel(store Store) Model {+ return Model{store: store, loading: true, filterLabel: "all"}+}++func Run(logPath string, in io.Reader, out io.Writer) error {+ model := NewModel(localStore{logPath: logPath})+ program := tea.NewProgram(model, tea.WithAltScreen(), tea.WithInput(in), tea.WithOutput(out))+ _, err := program.Run()+ return err+}++func (m Model) Init() tea.Cmd {+ return m.loadList()+}++func (m Model) loadList() tea.Cmd {+ query := m.query+ return func() tea.Msg {+ result, err := m.store.List(query)+ return listLoaded{result: result, err: err}+ }+}++func (m Model) loadDetail() tea.Cmd {+ if len(m.traces) == 0 {+ return nil+ }+ id := m.traces[m.selected].ID+ eventTypes := append([]string(nil), m.eventTypes...)+ return func() tea.Msg {+ result, ok, err := m.store.Show(id, eventTypes)+ return detailLoaded{result: result, ok: ok, err: err}+ }+}++func (m Model) Update(message tea.Msg) (tea.Model, tea.Cmd) {+ switch msg := message.(type) {+ case tea.WindowSizeMsg:+ m.width, m.height = msg.Width, msg.Height+ m.ensureVisible()+ return m, nil+ case listLoaded:+ m.loading = false+ m.err = msg.err+ if msg.err == nil {+ m.traces = msg.result.Traces+ m.totalMatched = msg.result.TotalMatched+ m.selected, m.listOffset = 0, 0+ }+ return m, nil+ case detailLoaded:+ m.loading = false+ m.err = msg.err+ if msg.err == nil && !msg.ok {+ m.err = fmt.Errorf("trace is no longer available")+ }+ if m.err == nil {+ m.detail = msg.result+ m.eventIndex, m.detailScroll = 0, 0+ }+ return m, nil+ case tea.KeyMsg:+ if m.searching {+ return m.updateSearch(msg)+ }+ if msg.String() == "ctrl+c" || msg.String() == "q" {+ return m, tea.Quit+ }+ if m.mode == detailMode {+ return m.updateDetail(msg)+ }+ return m.updateList(msg)+ }+ return m, nil+}++func (m Model) updateSearch(msg tea.KeyMsg) (tea.Model, tea.Cmd) {+ switch msg.String() {+ case "esc":+ m.searching = false+ m.searchInput = m.query+ case "enter":+ m.searching = false+ m.query = strings.TrimSpace(m.searchInput)+ m.loading = true+ m.err = nil+ return m, m.loadList()+ case "backspace":+ if len(m.searchInput) > 0 {+ _, size := utf8.DecodeLastRuneInString(m.searchInput)+ m.searchInput = m.searchInput[:len(m.searchInput)-size]+ }+ default:+ if len(msg.Runes) > 0 {+ m.searchInput += string(msg.Runes)+ }+ }+ return m, nil+}++func (m Model) updateList(msg tea.KeyMsg) (tea.Model, tea.Cmd) {+ switch msg.String() {+ case "up", "k":+ if m.selected > 0 {+ m.selected--+ m.ensureVisible()+ }+ case "down", "j":+ if m.selected+1 < len(m.traces) {+ m.selected+++ m.ensureVisible()+ }+ case "pgup":+ m.selected -= m.visibleTraceCount()+ if m.selected < 0 {+ m.selected = 0+ }+ m.ensureVisible()+ case "pgdown":+ m.selected += m.visibleTraceCount()+ if m.selected >= len(m.traces) {+ m.selected = len(m.traces) - 1+ }+ m.ensureVisible()+ case "enter":+ if len(m.traces) > 0 {+ m.mode = detailMode+ m.loading = true+ m.err = nil+ return m, m.loadDetail()+ }+ case "/":+ m.searching = true+ m.searchInput = m.query+ case "c":+ if m.query != "" {+ m.query = ""+ m.searchInput = ""+ m.loading = true+ return m, m.loadList()+ }+ case "r":+ m.loading = true+ m.err = nil+ return m, m.loadList()+ }+ return m, nil+}++func (m Model) updateDetail(msg tea.KeyMsg) (tea.Model, tea.Cmd) {+ switch msg.String() {+ case "esc", "backspace":+ m.mode = listMode+ m.err = nil+ case "up", "k":+ if m.eventIndex > 0 {+ m.eventIndex--+ m.detailScroll = 0+ }+ case "down", "j":+ if m.eventIndex+1 < len(m.detail.Events) {+ m.eventIndex+++ m.detailScroll = 0+ }+ case "pgup", "ctrl+u":+ m.detailScroll -= m.detailPageHeight()+ if m.detailScroll < 0 {+ m.detailScroll = 0+ }+ case "pgdown", "ctrl+d":+ m.detailScroll += m.detailPageHeight()+ m.clampDetailScroll()+ case "1":+ return m.setFilter("all", nil)+ case "2":+ return m.setFilter("messages", []string{"user_message", "agent_message", "agent_reasoning"})+ case "3":+ return m.setFilter("tools", []string{"tool_call", "tool_result", "command", "file", "mcp"})+ case "4":+ return m.setFilter("errors", []string{"error"})+ case "r":+ m.loading = true+ m.err = nil+ return m, m.loadDetail()+ }+ return m, nil+}++func (m Model) setFilter(label string, eventTypes []string) (tea.Model, tea.Cmd) {+ m.filterLabel = label+ m.eventTypes = eventTypes+ m.loading = true+ m.err = nil+ return m, m.loadDetail()+}++func (m *Model) ensureVisible() {+ count := m.visibleTraceCount()+ if m.selected < m.listOffset {+ m.listOffset = m.selected+ }+ if m.selected >= m.listOffset+count {+ m.listOffset = m.selected - count + 1+ }+ if m.listOffset < 0 {+ m.listOffset = 0+ }+}++func (m *Model) clampDetailScroll() {+ if len(m.detail.Events) == 0 {+ m.detailScroll = 0+ return+ }+ lines := eventDetails(m.detail.Events[m.eventIndex], max(20, m.width-4))+ maxScroll := max(0, len(lines)-m.detailPageHeight())+ if m.detailScroll > maxScroll {+ m.detailScroll = maxScroll+ }+}++func (m Model) visibleTraceCount() int {+ // Reserve a possible date heading for every visible trace so traces from+ // different days never make the view taller than the terminal.+ count := (m.height - 7) / 3+ if count < 1 {+ return 1+ }+ return count+}++func (m Model) detailPageHeight() int {+ height := m.height - 16+ if height < 3 {+ return 3+ }+ return height+}++func (m Model) View() string {+ if m.width == 0 {+ return "Loading Beacon traces…"+ }+ if m.mode == detailMode {+ return m.detailView()+ }+ return m.listView()+}++func (m Model) listView() string {+ var b strings.Builder+ b.WriteString(" " + accentStyle.Render("B E A C O N T R A C E S") + "\n")+ b.WriteString(" " + ruleStyle.Render(strings.Repeat("─", max(1, m.width-4))) + "\n")+ if m.searching {+ b.WriteString(" Search › " + m.searchInput + "█\n")+ } else if m.query != "" {+ b.WriteString(fmt.Sprintf(" Search: %s %s\n", accentStyle.Render(m.query), dimStyle.Render("(c clear)")))+ } else {+ b.WriteString(" " + dimStyle.Render("Local endpoint traces · nothing is sent anywhere") + "\n")+ }+ if m.loading {+ b.WriteString("\n Loading traces…\n")+ return b.String()+ }+ if m.err != nil {+ b.WriteString("\n " + errorStyle.Render(m.err.Error()) + "\n")+ b.WriteString("\n " + dimStyle.Render("r retry · q quit") + "\n")+ return b.String()+ }+ if len(m.traces) == 0 {+ b.WriteString("\n No local traces found.\n")+ b.WriteString(" " + dimStyle.Render("Generate agent activity or press / to change the search.") + "\n")+ return b.String()+ }+ end := min(len(m.traces), m.listOffset+m.visibleTraceCount())+ lastDate := ""+ for i := m.listOffset; i < end; i++ {+ trace := m.traces[i]+ date, clock := displayTime(trace.UpdatedAt)+ if date != lastDate {+ b.WriteString(" " + dimStyle.Render(date) + "\n")+ lastDate = date+ }+ titleWidth := max(12, m.width-35)+ line := fmt.Sprintf("%-8s %-*s %s", clock, titleWidth, truncate(trace.Title, titleWidth), trace.Harness.Name)+ meta := fmt.Sprintf(" %s · %d events · %s", tracePath(trace), trace.EventCount, contentLabel(trace))+ if i == m.selected {+ b.WriteString(selectedStyle.Render(fit(" ❯ "+line, m.width)) + "\n")+ b.WriteString(selectedStyle.Render(fit(" "+meta, m.width)) + "\n")+ } else {+ b.WriteString(fit(" "+line, m.width) + "\n")+ b.WriteString(dimStyle.Render(fit(" "+meta, m.width)) + "\n")+ }+ }+ b.WriteString("\n " + dimStyle.Render(fmt.Sprintf("%d traces · ↑/↓ move · enter open · / search · r refresh · q quit", m.totalMatched)) + "\n")+ return b.String()+}++func (m Model) detailView() string {+ var b strings.Builder+ trace := m.detail.Trace+ title := trace.Title+ if title == "" && len(m.traces) > 0 {+ title = m.traces[m.selected].Title+ }+ b.WriteString(" " + accentStyle.Render(truncate(title, max(20, m.width-4))) + "\n")+ b.WriteString(" " + dimStyle.Render(fmt.Sprintf("%s · %s · %s%s · filter: %s",+ trace.Harness.Name, tracePath(trace), trace.UpdatedAt, traceUsageLabel(trace), m.filterLabel)) + "\n")+ b.WriteString(" " + ruleStyle.Render(strings.Repeat("─", max(1, m.width-4))) + "\n")+ if m.loading {+ b.WriteString("\n Loading events…\n")+ return b.String()+ }+ if m.err != nil {+ b.WriteString("\n " + errorStyle.Render(m.err.Error()) + "\n")+ return b.String()+ }+ if len(m.detail.Events) == 0 {+ b.WriteString("\n No events match this filter.\n")+ } else {+ start, end := eventWindow(m.eventIndex, len(m.detail.Events), 5)+ for i := start; i < end; i++ {+ event := m.detail.Events[i]+ line := fmt.Sprintf("#%-4d %-16s %s", event.Number, event.Type, eventTitle(event))+ if i == m.eventIndex {+ b.WriteString(selectedStyle.Render(fit(" ❯ "+line, m.width)) + "\n")+ } else {+ b.WriteString(fit(" "+line, m.width) + "\n")+ }+ }+ b.WriteString(" " + ruleStyle.Render(strings.Repeat("─", max(1, m.width-4))) + "\n")+ lines := eventDetails(m.detail.Events[m.eventIndex], max(20, m.width-4))+ if m.detailScroll >= len(lines) {+ m.detailScroll = max(0, len(lines)-1)+ }+ end = min(len(lines), m.detailScroll+m.detailPageHeight())+ for _, line := range lines[m.detailScroll:end] {+ b.WriteString(" " + line + "\n")+ }+ }+ b.WriteString("\n " + dimStyle.Render("esc back · ↑/↓ event · pgup/pgdn details · 1 all · 2 messages · 3 tools · 4 errors · q quit") + "\n")+ return b.String()+}++func eventDetails(event dashboard.TraceEventV1, width int) []string {+ lines := []string{+ accentStyle.Render(fmt.Sprintf("#%d %s", event.Number, event.Type)),+ dimStyle.Render(strings.TrimSpace(event.Timestamp + " " + event.Action)),+ }+ add := func(label, value string) {+ value = strings.TrimSpace(value)+ if value == "" {+ return+ }+ lines = append(lines, accentStyle.Render(label))+ lines = append(lines, wrapLines(value, width)...)+ }+ add("Summary", firstNonEmpty(contentText(event.Content), event.Summary))+ if event.Tool != nil {+ add("Tool", strings.TrimSpace(strings.Join([]string{event.Tool.Name, event.Tool.Command, event.Tool.Path}, " ")))+ addJSON := func(label string, value any) {+ if value == nil {+ return+ }+ data, _ := json.MarshalIndent(value, "", " ")+ add(label, string(data))+ }+ addJSON("Arguments", event.Tool.Arguments)+ addJSON("Result", event.Tool.Result)+ }+ if event.Command != nil {+ add("Command", event.Command.Command)+ if event.Command.Output != nil {+ add("Output", event.Command.Output.Text)+ }+ }+ if event.File != nil {+ add("File", strings.TrimSpace(event.File.Operation+" "+event.File.Path))+ if event.File.Diff != nil {+ add("Diff", event.File.Diff.Text)+ }+ }+ if event.MCP != nil {+ add("MCP", strings.TrimSpace(strings.Join([]string{event.MCP.Server, event.MCP.Tool, event.MCP.Method, event.MCP.ResourceURI}, " ")))+ }+ if event.Approval != nil {+ add("Approval", strings.TrimSpace(event.Approval.Decision+" "+event.Approval.Reason))+ }+ if event.Usage != nil {+ add("Usage", fmt.Sprintf("input %d · output %d · cache read %d · cost $%.6f",+ event.Usage.InputTokens, event.Usage.OutputTokens, event.Usage.CacheReadInputTokens, event.Usage.CostUSD))+ }+ return lines+}++func contentText(content *dashboard.TraceContentV1) string {+ if content == nil {+ return ""+ }+ return content.Text+}++func eventTitle(event dashboard.TraceEventV1) string {+ return truncate(firstNonEmpty(event.Title, event.Summary, contentText(event.Content), event.Action), 100)+}++func eventWindow(selected, total, size int) (int, int) {+ if total <= size {+ return 0, total+ }+ start := selected - size/2+ if start < 0 {+ start = 0+ }+ if start+size > total {+ start = total - size+ }+ return start, start + size+}++func displayTime(raw string) (string, string) {+ parsed, err := time.Parse(time.RFC3339Nano, raw)+ if err != nil {+ return "Unknown date", "--:--"+ }+ local := parsed.Local()+ return local.Format("Mon, Jan 2"), local.Format("3:04 PM")+}++func tracePath(trace dashboard.TraceSummaryV1) string {+ if trace.Session != nil && trace.Session.WorkingDirectory != "" {+ return trace.Session.WorkingDirectory+ }+ if trace.Repository != nil && trace.Repository.Path != "" {+ return trace.Repository.Path+ }+ return "local"+}++func contentLabel(trace dashboard.TraceSummaryV1) string {+ label := trace.Content.Retention+ if label == "" {+ label = "metadata"+ }+ if trace.Content.HasRedactions {+ label += ", redacted"+ }+ if trace.Content.HasTruncations {+ label += ", truncated"+ }+ return label+}++func traceUsageLabel(trace dashboard.TraceSummaryV1) string {+ if trace.TokenUsage == nil {+ return ""+ }+ total := trace.TokenUsage.InputTokens + trace.TokenUsage.OutputTokens+ if trace.TokenUsage.CostUSD > 0 {+ return fmt.Sprintf(" · %d tokens · $%.4f", total, trace.TokenUsage.CostUSD)+ }+ return fmt.Sprintf(" · %d tokens", total)+}++func wrapLines(value string, width int) []string {+ var out []string+ for _, raw := range strings.Split(value, "\n") {+ line := strings.TrimRight(raw, "\r")+ if line == "" {+ out = append(out, "")+ continue+ }+ for len([]rune(line)) > width {+ runes := []rune(line)+ out = append(out, string(runes[:width]))+ line = string(runes[width:])+ }+ out = append(out, line)+ }+ return out+}++func fit(value string, width int) string {+ return truncate(value, max(1, width))+}++func truncate(value string, width int) string {+ runes := []rune(strings.ReplaceAll(value, "\n", " "))+ if width <= 0 || len(runes) <= width {+ return string(runes)+ }+ if width == 1 {+ return "…"+ }+ return string(runes[:width-1]) + "…"+}++func firstNonEmpty(values ...string) string {+ for _, value := range values {+ if strings.TrimSpace(value) != "" {+ return strings.TrimSpace(value)+ }+ }+ return ""+}diff --git a/cli/beacon/internal/endpoint/traceview/traceview_test.go b/cli/beacon/internal/endpoint/traceview/traceview_test.gonew file mode 100644index 00000000..18caf6b0--- /dev/null+++ b/cli/beacon/internal/endpoint/traceview/traceview_test.go@@ -0,0 +1,167 @@+package traceview++import (+ "strings"+ "testing"++ tea "github.com/charmbracelet/bubbletea"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/dashboard"+)++type fakeStore struct {+ traces []dashboard.TraceSummaryV1+ events []dashboard.TraceEventV1+ listQueries []string+ showFilters [][]string+}++func (s *fakeStore) List(query string) (dashboard.TraceListResultV1, error) {+ s.listQueries = append(s.listQueries, query)+ return dashboard.TraceListResultV1{+ Traces: s.traces,+ TotalMatched: len(s.traces),+ Returned: len(s.traces),+ }, nil+}++func (s *fakeStore) Show(id string, eventTypes []string) (dashboard.TraceShowResultV1, bool, error) {+ s.showFilters = append(s.showFilters, append([]string(nil), eventTypes...))+ return dashboard.TraceShowResultV1{+ Trace: s.traces[0],+ Events: s.events,+ Range: dashboard.TraceRangeV1{TotalEvents: len(s.events), ReturnedEvents: len(s.events)},+ }, true, nil+}++func fixtureStore() *fakeStore {+ return &fakeStore{+ traces: []dashboard.TraceSummaryV1{{+ ID: "session:cursor:s1",+ Title: "Build the trace browser",+ UpdatedAt: "2026-09-21T08:00:00Z",+ EventCount: 2,+ Harness: dashboard.TraceHarnessV1{Name: "cursor"},+ Session: &dashboard.TraceSessionV1{WorkingDirectory: "/work/beacon"},+ TokenUsage: &dashboard.TraceUsageV1{InputTokens: 120, OutputTokens: 30, CostUSD: 0.0042},+ Content: dashboard.TraceContentSummaryV1{Retention: "full", HasRedactions: true},+ }},+ events: []dashboard.TraceEventV1{+ {Number: 1, Type: "user_message", Action: "prompt.submitted", Content: &dashboard.TraceContentV1{Text: "Create a TUI"}},+ {Number: 2, Type: "command", Action: "command.executed", Command: &dashboard.TraceCommandV1{Command: "go test ./..."}},+ },+ }+}++func runCmd(t *testing.T, model Model, cmd tea.Cmd) Model {+ t.Helper()+ if cmd == nil {+ return model+ }+ next, followup := model.Update(cmd())+ model = next.(Model)+ if followup != nil {+ next, _ = model.Update(followup())+ model = next.(Model)+ }+ return model+}++func key(value string) tea.KeyMsg {+ switch value {+ case "enter":+ return tea.KeyMsg{Type: tea.KeyEnter}+ case "esc":+ return tea.KeyMsg{Type: tea.KeyEsc}+ case "backspace":+ return tea.KeyMsg{Type: tea.KeyBackspace}+ default:+ return tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(value)}+ }+}++func TestModelLoadsAndRendersLocalTraceList(t *testing.T) {+ store := fixtureStore()+ model := NewModel(store)+ model.width, model.height = 100, 30+ model = runCmd(t, model, model.Init())++ view := model.View()+ for _, want := range []string{"B E A C O N", "Build the trace browser", "cursor", "/work/beacon", "full, redacted", "nothing is sent anywhere"} {+ if !strings.Contains(view, want) {+ t.Fatalf("view missing %q:\n%s", want, view)+ }+ }+ if len(store.listQueries) != 1 || store.listQueries[0] != "" {+ t.Fatalf("list queries = %#v", store.listQueries)+ }+}++func TestModelSearchesAndOpensTrace(t *testing.T) {+ store := fixtureStore()+ model := NewModel(store)+ model.width, model.height = 100, 30+ model = runCmd(t, model, model.Init())++ next, _ := model.Update(key("/"))+ model = next.(Model)+ for _, r := range "browser" {+ next, _ = model.Update(key(string(r)))+ model = next.(Model)+ }+ next, cmd := model.Update(key("enter"))+ model = runCmd(t, next.(Model), cmd)+ if got := store.listQueries[len(store.listQueries)-1]; got != "browser" {+ t.Fatalf("search query = %q, want browser", got)+ }++ next, cmd = model.Update(key("enter"))+ model = runCmd(t, next.(Model), cmd)+ if model.mode != detailMode || len(model.detail.Events) != 2 {+ t.Fatalf("detail state = mode %v events %d", model.mode, len(model.detail.Events))+ }+ for _, want := range []string{"Build the trace browser", "150 tokens", "$0.0042", "#1", "user_message", "Create a TUI"} {+ if view := model.View(); !strings.Contains(view, want) {+ t.Fatalf("detail view missing %q:\n%s", want, view)+ }+ }+}++func TestDetailFilterReloadsTrace(t *testing.T) {+ store := fixtureStore()+ model := NewModel(store)+ model.width, model.height = 100, 30+ model = runCmd(t, model, model.Init())+ next, cmd := model.Update(key("enter"))+ model = runCmd(t, next.(Model), cmd)++ next, cmd = model.Update(key("3"))+ model = runCmd(t, next.(Model), cmd)+ got := strings.Join(store.showFilters[len(store.showFilters)-1], ",")+ if got != "tool_call,tool_result,command,file,mcp" {+ t.Fatalf("tool filter = %q", got)+ }+ if model.filterLabel != "tools" {+ t.Fatalf("filter label = %q", model.filterLabel)+ }+}++func TestEventDetailsIncludesStructuredData(t *testing.T) {+ event := dashboard.TraceEventV1{+ Number: 7,+ Type: "tool_call",+ Action: "tool.invoked",+ Tool: &dashboard.TraceToolV1{+ Name: "shell",+ Arguments: map[string]interface{}{"command": "go test ./..."},+ Result: map[string]interface{}{"exit_code": float64(0)},+ },+ Usage: &dashboard.TraceUsageV1{InputTokens: 12, OutputTokens: 4, CostUSD: 0.001},+ }+ rendered := strings.Join(eventDetails(event, 80), "\n")+ for _, want := range []string{"shell", "go test ./...", "exit_code", "input 12", "$0.001000"} {+ if !strings.Contains(rendered, want) {+ t.Fatalf("event details missing %q:\n%s", want, rendered)+ }+ }+}diff --git a/docs/cli/endpoint-traces.mdx b/docs/cli/endpoint-traces.mdxindex 83d88678..f49ecb5d 100644--- a/docs/cli/endpoint-traces.mdx+++ b/docs/cli/endpoint-traces.mdx@@ -7,6 +7,16 @@ description: "Index and search local endpoint traces from Beacon runtime logs"`beacon endpoint traces` builds and reads a local trace index over the Beacon runtime JSONL log. Use it when you want a trace-oriented view of endpoint activity without starting the dashboard.+Run the top-level command on an interactive terminal to open the full-screen local trace browser:++```bash title="Browse local traces"+beacon traces+```++Use the arrow keys or `j`/`k` to move, `enter` to open a trace, `/` to search, and `1`–`4` to filter an open trace by event type. Page Up and Page Down scroll long event details. The browser reads only local Beacon state and does not contact the network.++When stdout or stdin is redirected, `beacon traces` falls back to a bounded tab-separated trace list instead of emitting terminal control sequences. The `beacon endpoint traces` commands below remain the stable JSON and scripting interface.+```bash title="Command syntax"beacon endpoint traces [command]```