Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

preserve backwards compatibility

Justin D'Souza11b59451f692
diff --git a/cli/beacon/internal/endpoint/activity/activity.go b/cli/beacon/internal/endpoint/activity/activity.go
index 661c9631..c9bf6adf 100644
--- a/cli/beacon/internal/endpoint/activity/activity.go
+++ b/cli/beacon/internal/endpoint/activity/activity.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/dashboard"
+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/schema"
)
const DefaultLimit = 100
@@ -381,15 +382,21 @@ func summarizeRecord(record dashboard.EventRecord) EventSummary {
if event.Policy != nil {
summary.Policy = &PolicySummary{ID: event.Policy.ID, Name: event.Policy.Name, Decision: event.Policy.Decision, Enforcement: event.Policy.Enforcement, Reason: event.Policy.Reason}
}
- if event.Truncated {
- summary.Content = contentSummary(event.Truncated)
+ if event.Content != nil || event.Truncated {
+ summary.Content = contentSummary(event.Content, event.Truncated)
summary.Caveats = append(summary.Caveats, contentCaveats(summary.Content)...)
}
return summary
}
-func contentSummary(fieldTruncated bool) *ContentSummary {
+func contentSummary(content *schema.ContentInfo, fieldTruncated bool) *ContentSummary {
summary := &ContentSummary{FieldTruncated: fieldTruncated}
+ if content != nil {
+ summary.Retention = content.Retention
+ summary.Included = content.Included
+ summary.Redacted = content.Redacted
+ summary.Truncated = content.Truncated
+ }
return summary
}
diff --git a/cli/beacon/internal/endpoint/activity/activity_test.go b/cli/beacon/internal/endpoint/activity/activity_test.go
index f69230f0..349f1b1f 100644
--- a/cli/beacon/internal/endpoint/activity/activity_test.go
+++ b/cli/beacon/internal/endpoint/activity/activity_test.go
@@ -35,6 +35,29 @@ func TestSearchReturnsTruncationSummary(t *testing.T) {
}
}
+func TestSearchReturnsHistoricalContentSummary(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "runtime.jsonl")
+ event := testEvent("2026-05-13T01:00:00Z", "claude", "prompt.submitted", "prompt")
+ event.Prompt = &schema.PromptInfo{Text: "summarize local MCP use"}
+ event.Content = &schema.ContentInfo{Retention: schema.ContentRetentionMetadata, Included: false}
+ writeLog(t, path, event)
+
+ result, err := Search(Query{LogPath: path, Harness: "claude", Limit: 10})
+ if err != nil {
+ t.Fatalf("Search returned error: %v", err)
+ }
+ if result.Meta.TotalMatched != 1 || len(result.Events) != 1 {
+ t.Fatalf("matched events = total %d len %d, want 1/1", result.Meta.TotalMatched, len(result.Events))
+ }
+ got := result.Events[0]
+ if got.Content == nil || got.Content.Retention != schema.ContentRetentionMetadata {
+ t.Fatalf("content summary = %#v, want historical content metadata", got.Content)
+ }
+ if len(got.Caveats) != 0 {
+ t.Fatalf("unexpected retention caveat for historical content metadata: %#v", got.Caveats)
+ }
+}
+
func TestListFiltersIncludesRotatedArchives(t *testing.T) {
path := filepath.Join(t.TempDir(), "runtime.jsonl")
active := testEvent("2026-05-13T01:02:00Z", "cursor", "prompt.submitted", "prompt")
diff --git a/cli/beacon/internal/endpoint/config/config_test.go b/cli/beacon/internal/endpoint/config/config_test.go
index 462f0766..c23a80b3 100644
--- a/cli/beacon/internal/endpoint/config/config_test.go
+++ b/cli/beacon/internal/endpoint/config/config_test.go
@@ -3,6 +3,7 @@ package config
import (
"os"
"path/filepath"
+ "strings"
"testing"
)
@@ -67,6 +68,13 @@ func TestSaveLoadRoundTrip(t *testing.T) {
if len(loaded.EventCategories) != 2 || loaded.EventCategories[1] != "session" {
t.Fatalf("EventCategories did not round-trip: %#v", loaded.EventCategories)
}
+ data, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatalf("read saved config: %v", err)
+ }
+ if strings.Contains(string(data), "content_retention") {
+ t.Fatalf("saved config unexpectedly contains legacy content_retention: %s", string(data))
+ }
}
func TestSaveLoadSplunkHECRoundTripAndPrivatePermissions(t *testing.T) {
@@ -167,6 +175,36 @@ func TestSaveRejectsIncompleteFalconHEC(t *testing.T) {
}
}
+func TestLoadIgnoresLegacyContentRetention(t *testing.T) {
+ home := t.TempDir()
+ t.Setenv("HOME", home)
+ path := filepath.Join(home, UserConfigPath)
+ if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
+ t.Fatalf("mkdir config dir: %v", err)
+ }
+ if err := os.WriteFile(path, []byte(`{"user_mode":true,"content_retention":"metadata"}`), 0644); err != nil {
+ t.Fatalf("write config: %v", err)
+ }
+
+ loaded, err := Load(true)
+ if err != nil {
+ t.Fatalf("Load returned error: %v", err)
+ }
+ if !loaded.UserMode {
+ t.Fatal("UserMode = false, want true")
+ }
+ if _, err := Save(loaded); err != nil {
+ t.Fatalf("Save returned error: %v", err)
+ }
+ data, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatalf("read saved config: %v", err)
+ }
+ if strings.Contains(string(data), "content_retention") {
+ t.Fatalf("saved config unexpectedly preserved legacy content_retention: %s", string(data))
+ }
+}
+
func TestLoadRejectsCorruptJSON(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)
diff --git a/cli/beacon/internal/endpoint/dashboard/events.go b/cli/beacon/internal/endpoint/dashboard/events.go
index 84a7227f..5fed6fc2 100644
--- a/cli/beacon/internal/endpoint/dashboard/events.go
+++ b/cli/beacon/internal/endpoint/dashboard/events.go
@@ -464,6 +464,18 @@ func searchFields(record EventRecord) []string {
if event.Prompt != nil {
fields = append(fields, event.Prompt.Text)
}
+ if event.Content != nil {
+ fields = append(fields, event.Content.Retention)
+ if event.Content.Included {
+ fields = append(fields, "content included")
+ }
+ if event.Content.Redacted {
+ fields = append(fields, "redacted")
+ }
+ if event.Content.Truncated {
+ fields = append(fields, "truncated")
+ }
+ }
if event.Destination != nil {
fields = append(fields, event.Destination.Type, event.Destination.Mode, event.Destination.Status)
}
diff --git a/cli/beacon/internal/endpoint/dashboard/static/app.js b/cli/beacon/internal/endpoint/dashboard/static/app.js
index e5fae17d..3f52de68 100644
--- a/cli/beacon/internal/endpoint/dashboard/static/app.js
+++ b/cli/beacon/internal/endpoint/dashboard/static/app.js
@@ -453,7 +453,9 @@ function artifactCell(event) {
function retentionCell(record) {
const event = record.event || {};
const labels = [];
+ if (event.content?.retention) labels.push(badge(event.content.retention, "badge-muted"));
if (event.field_truncated) labels.push(badge("truncated", "badge-warn"));
+ if (event.content?.redacted) labels.push(badge("redacted", "badge-warn"));
return labels.join(" ") || badge("default", "badge-muted");
}
@@ -473,6 +475,7 @@ function detailSummary(record) {
["Artifact", event.prompt?.text ? "" : primaryArtifact(event)],
["Approval", event.approval ? [event.approval.decision, event.approval.reason].filter(Boolean).join(": ") : ""],
["Policy", event.policy ? [event.policy.decision, event.policy.name, event.policy.reason].filter(Boolean).join(": ") : ""],
+ ["Content", event.content ? `${event.content.retention}${event.content.redacted ? ", redacted" : ""}${event.content.truncated ? ", truncated" : ""}` : ""],
].filter(([, value]) => value);
return rows
.map(([label, value]) => {
diff --git a/cli/beacon/internal/endpoint/schema/event.go b/cli/beacon/internal/endpoint/schema/event.go
index 06a51572..24888380 100644
--- a/cli/beacon/internal/endpoint/schema/event.go
+++ b/cli/beacon/internal/endpoint/schema/event.go
@@ -60,6 +60,7 @@ type MCPSessionInfo = asymptoteobserve.MCPSessionInfo
type ApprovalInfo = asymptoteobserve.ApprovalInfo
type PolicyInfo = asymptoteobserve.PolicyInfo
type PromptInfo = asymptoteobserve.PromptInfo
+type ContentInfo = asymptoteobserve.ContentInfo
type DestinationInfo = asymptoteobserve.DestinationInfo
type HealthInfo = asymptoteobserve.HealthInfo
type GenAIInfo = asymptoteobserve.GenAIInfo
@@ -89,4 +90,10 @@ type Event = asymptoteobserve.Event
type NewEventOptions = asymptoteobserve.NewEventOptions
type Envelope = asymptoteobserve.Envelope
+const (
+ ContentRetentionMetadata = asymptoteobserve.ContentRetentionMetadata
+ ContentRetentionRedacted = asymptoteobserve.ContentRetentionRedacted
+ ContentRetentionFull = asymptoteobserve.ContentRetentionFull
+)
+
var NewEvent = asymptoteobserve.NewEvent
diff --git a/collector-builder/exporter/beaconjsonexporter/config.go b/collector-builder/exporter/beaconjsonexporter/config.go
index 14e4eee0..a31bca80 100644
--- a/collector-builder/exporter/beaconjsonexporter/config.go
+++ b/collector-builder/exporter/beaconjsonexporter/config.go
@@ -15,6 +15,7 @@ type Config struct {
RotateBytes int64 `mapstructure:"rotate_bytes"`
RotateArchives int `mapstructure:"rotate_archives"`
RedactSecrets bool `mapstructure:"redact_secrets"`
+ ContentRetention string `mapstructure:"content_retention"` // Deprecated no-op; retained for older collector configs.
IncludeRuntimeMetrics bool `mapstructure:"include_runtime_metrics"`
IncludeCodexSpans bool `mapstructure:"include_codex_spans"`
}
diff --git a/collector-builder/exporter/beaconjsonexporter/event.go b/collector-builder/exporter/beaconjsonexporter/event.go
index 63bc295f..59260343 100644
--- a/collector-builder/exporter/beaconjsonexporter/event.go
+++ b/collector-builder/exporter/beaconjsonexporter/event.go
@@ -23,6 +23,7 @@ type commandInfo = beaconevent.CommandInfo
type mcpInfo = beaconevent.MCPInfo
type approvalInfo = beaconevent.ApprovalInfo
type promptInfo = beaconevent.PromptInfo
+type contentInfo = beaconevent.ContentInfo
type beaconEvent = beaconevent.Event
func newBeaconEvent(action, category, severity, harnessName string, ts time.Time) beaconEvent {
diff --git a/collector-builder/exporter/beaconjsonexporter/exporter_test.go b/collector-builder/exporter/beaconjsonexporter/exporter_test.go
index e61a5087..2e549f38 100644
--- a/collector-builder/exporter/beaconjsonexporter/exporter_test.go
+++ b/collector-builder/exporter/beaconjsonexporter/exporter_test.go
@@ -29,6 +29,30 @@ func TestConfigValidateRequiresPath(t *testing.T) {
}
}
+func TestNewExporterAcceptsDeprecatedContentRetention(t *testing.T) {
+ cfg := &Config{
+ Path: filepath.Join(t.TempDir(), "runtime.jsonl"),
+ MaxEventBytes: defaultMaxEventBytes,
+ RotateBytes: defaultRotateBytes,
+ RedactSecrets: true,
+ ContentRetention: "metadata",
+ }
+ exp, err := newExporter(cfg, exporter.Settings{})
+ if err != nil {
+ t.Fatalf("newExporter returned error: %v", err)
+ }
+ if exp.cfg.ContentRetention != "metadata" {
+ t.Fatalf("ContentRetention = %q, want deprecated value preserved", exp.cfg.ContentRetention)
+ }
+ record := plog.NewLogs().ResourceLogs().AppendEmpty().ScopeLogs().AppendEmpty().LogRecords().AppendEmpty()
+ record.Attributes().PutStr("beacon.event.action", "prompt.submitted")
+ record.Attributes().PutStr("gen_ai.prompt", "hello")
+ event := exp.eventFromLog(nil, record)
+ if event.Content != nil {
+ t.Fatalf("deprecated content retention should not emit content marker: %#v", event.Content)
+ }
+}
+
func TestDefaultConfigUsesBoundedRotation(t *testing.T) {
cfg := createDefaultConfig()
if cfg.RotateBytes != defaultRotateBytes {
diff --git a/collector-builder/exporter/beaconjsonexporter/falconhecexporter/config.go b/collector-builder/exporter/beaconjsonexporter/falconhecexporter/config.go
index 1f9b73be..60efaed5 100644
--- a/collector-builder/exporter/beaconjsonexporter/falconhecexporter/config.go
+++ b/collector-builder/exporter/beaconjsonexporter/falconhecexporter/config.go
@@ -22,6 +22,7 @@ type Config struct {
Timeout time.Duration `mapstructure:"timeout"`
QueueSettings exporterhelper.QueueConfig `mapstructure:"sending_queue"`
RetrySettings configretry.BackOffConfig `mapstructure:"retry_on_failure"`
+ ContentRetention string `mapstructure:"content_retention"` // Deprecated no-op; retained for older collector configs.
IncludeRuntimeMetrics bool `mapstructure:"include_runtime_metrics"`
IncludeCodexSpans bool `mapstructure:"include_codex_spans"`
}
diff --git a/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/event.go b/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/event.go
index 34dd30b5..d78f32ce 100644
--- a/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/event.go
+++ b/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/event.go
@@ -29,6 +29,7 @@ type MCPSessionInfo = asymptoteobserve.MCPSessionInfo
type ApprovalInfo = asymptoteobserve.ApprovalInfo
type PolicyInfo = asymptoteobserve.PolicyInfo
type PromptInfo = asymptoteobserve.PromptInfo
+type ContentInfo = asymptoteobserve.ContentInfo
type GenAIInfo = asymptoteobserve.GenAIInfo
type GenAIAgentInfo = asymptoteobserve.GenAIAgentInfo
type GenAIConversationInfo = asymptoteobserve.GenAIConversationInfo
@@ -74,6 +75,7 @@ type Event struct {
Approval *ApprovalInfo `json:"approval,omitempty"`
Policy *PolicyInfo `json:"policy,omitempty"`
Prompt *PromptInfo `json:"prompt,omitempty"`
+ Content *ContentInfo `json:"content,omitempty"`
Destination *asymptoteobserve.DestinationInfo `json:"destination,omitempty"`
Health *asymptoteobserve.HealthInfo `json:"health,omitempty"`
GenAI *GenAIInfo `json:"gen_ai,omitempty"`
diff --git a/pkg/asymptoteobserve/event.go b/pkg/asymptoteobserve/event.go
index 43c4e37e..e37b550a 100644
--- a/pkg/asymptoteobserve/event.go
+++ b/pkg/asymptoteobserve/event.go
@@ -159,6 +159,19 @@ type PromptInfo struct {
Text string `json:"text,omitempty"`
}
+type ContentInfo struct {
+ Retention string `json:"retention"`
+ Included bool `json:"included"`
+ Redacted bool `json:"redacted,omitempty"`
+ Truncated bool `json:"truncated,omitempty"`
+}
+
+const (
+ ContentRetentionMetadata = "metadata"
+ ContentRetentionRedacted = "redacted"
+ ContentRetentionFull = "full"
+)
+
type GenAIAgentInfo struct {
Description string `json:"description,omitempty"`
ID string `json:"id,omitempty"`
@@ -332,6 +345,7 @@ type Event struct {
Approval *ApprovalInfo `json:"approval,omitempty"`
Policy *PolicyInfo `json:"policy,omitempty"`
Prompt *PromptInfo `json:"prompt,omitempty"`
+ Content *ContentInfo `json:"content,omitempty"`
Destination *DestinationInfo `json:"destination,omitempty"`
Health *HealthInfo `json:"health,omitempty"`
GenAI *GenAIInfo `json:"gen_ai,omitempty"`
@@ -420,5 +434,12 @@ func (e Event) Validate() error {
return errors.New("origin must be local, cloud, or ci")
}
}
+ if e.Content != nil {
+ switch e.Content.Retention {
+ case ContentRetentionMetadata, ContentRetentionRedacted, ContentRetentionFull:
+ default:
+ return errors.New("content.retention must be metadata, redacted, or full")
+ }
+ }
return nil
}
diff --git a/pkg/asymptoteobserve/event_test.go b/pkg/asymptoteobserve/event_test.go
index 6dcd3abe..64b0f11e 100644
--- a/pkg/asymptoteobserve/event_test.go
+++ b/pkg/asymptoteobserve/event_test.go
@@ -39,6 +39,7 @@ func TestNewEventSetsRequiredInvariants(t *testing.T) {
event.Command = &CommandInfo{Command: "go test ./..."}
event.MCP = &MCPInfo{Server: "github", Tool: "get_issue", Method: &MCPMethodInfo{Name: "tools/call"}}
event.Prompt = &PromptInfo{Text: "Summarize this file"}
+ event.Content = &ContentInfo{Retention: ContentRetentionMetadata, Included: false}
event.GenAI = &GenAIInfo{
Provider: &GenAIProviderInfo{Name: "openai"},
Request: &GenAIRequestInfo{Model: "gpt-4o"},
@@ -49,6 +50,22 @@ func TestNewEventSetsRequiredInvariants(t *testing.T) {
}
}
+func TestValidateContentRetentionValuesForCompatibility(t *testing.T) {
+ for _, retention := range []string{ContentRetentionMetadata, ContentRetentionRedacted, ContentRetentionFull} {
+ t.Run(retention, func(t *testing.T) {
+ event := NewEvent(NewEventOptions{
+ Action: "tool.invoked",
+ Harness: HarnessInfo{Name: "cursor"},
+ })
+ event.Content = &ContentInfo{Retention: retention, Included: retention != ContentRetentionMetadata}
+
+ if err := event.Validate(); err != nil {
+ t.Fatalf("Validate rejected retention %q: %v", retention, err)
+ }
+ })
+ }
+}
+
func TestValidateOriginValues(t *testing.T) {
for _, origin := range []Origin{"", OriginLocal, OriginCloud, OriginCI} {
t.Run(string(origin), func(t *testing.T) {
diff --git a/pkg/asymptoteobserve/pipeline.go b/pkg/asymptoteobserve/pipeline.go
index e076711f..6346633a 100644
--- a/pkg/asymptoteobserve/pipeline.go
+++ b/pkg/asymptoteobserve/pipeline.go
@@ -170,6 +170,10 @@ func copyEvent(event Event) Event {
prompt := *event.Prompt
out.Prompt = &prompt
}
+ if event.Content != nil {
+ content := *event.Content
+ out.Content = &content
+ }
if event.Destination != nil {
destination := *event.Destination
out.Destination = &destination