pulse

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package pulse provides in-process analytics for the Synapses MCP server. Previously a separate HTTP sidecar (synapses-pulse), the collector and store are now embedded directly so no external process or port is required.

All public methods are fire-and-forget: errors are silently discarded so that pulse never degrades the MCP hot path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDBPath

func DefaultDBPath() (string, error)

DefaultDBPath returns the canonical path for the pulse SQLite database.

Types

type AgentDrillDown

type AgentDrillDown struct {
	AgentID       string                       `json:"agent_id"`
	Days          int                          `json:"days"`
	Summary       *pulsestore.Summary          `json:"summary"`
	LearningCurve []WeeklyEfficiency           `json:"learning_curve"`
	FirstSessions []SessionPerformance         `json:"first_sessions"`
	ToolPrefs     []pulsestore.AgentToolPref   `json:"tool_preferences"`
	Efficiency    []pulsestore.AgentEfficiency `json:"efficiency_scores"`
}

AgentDrillDown is a composite view of a single agent's analytics.

type AgentLLMUsageEvent

type AgentLLMUsageEvent = types.AgentLLMUsageEvent

AgentLLMUsageEvent re-exports types.AgentLLMUsageEvent.

type BrainUsageEvent

type BrainUsageEvent = types.BrainUsageEvent

BrainUsageEvent re-exports types.BrainUsageEvent.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the in-process analytics collector. It replaces the HTTP sidecar. Create with New; call Close when the daemon shuts down.

func New

func New(dbPath string) (*Client, error)

New creates and starts an in-process pulse collector backed by a SQLite store at dbPath. Returns an error if the database cannot be opened.

func NewClient deprecated

func NewClient(_ string, _ int) *Client

NewClient is a backwards-compatible constructor for code that still calls NewClient(url, timeout). It ignores both arguments and calls New with the default DB path; errors are silently swallowed (pulse is optional).

Deprecated: prefer New(dbPath) for explicit control.

func (*Client) Close

func (c *Client) Close()

Close stops the collector (flushing remaining events) and closes the store. Bug 64 — PIPE-E6: measures drain time and records a lifecycle event.

func (*Client) CountToolCallsSinceDelivery

func (c *Client) CountToolCallsSinceDelivery(sessionID, entity string) int

CountToolCallsSinceDelivery returns the number of tool calls in a session since the most recent context delivery for the given entity (P6-11).

func (*Client) DeleteByAgent

func (c *Client) DeleteByAgent(agentID string) int64

DeleteByAgent removes all data for a specific agent across all tables.

func (*Client) DeleteByProject

func (c *Client) DeleteByProject(projectID string) int64

DeleteByProject removes all data for a specific project across all tables.

func (*Client) ExportRawData

func (c *Client) ExportRawData(days int) *pulsestore.ExportData

ExportRawData returns a raw data export for the last N days (Bug 56).

func (*Client) FetchEffectiveness

func (c *Client) FetchEffectiveness(projectID string, minSignals int) []EntityEffectiveness

FetchEffectiveness returns per-entity effectiveness scores from the local store. Returns nil if no data is available or the store returns an error.

func (*Client) GetAgentDrillDown

func (c *Client) GetAgentDrillDown(agentID string, days int) *AgentDrillDown

GetAgentDrillDown returns a composite view of a single agent's analytics (P12-1).

func (*Client) GetAgentEntityOverlap

func (c *Client) GetAgentEntityOverlap(days, windowMinutes int) []pulsestore.AgentEntityOverlap

GetAgentEntityOverlap returns entities accessed by multiple agents within a time window. Useful for detecting concurrent agent conflicts (P10-4).

func (*Client) GetAgentFirstSessionsPerformance

func (c *Client) GetAgentFirstSessionsPerformance(agentID string, nSessions int) []SessionPerformance

GetAgentFirstSessionsPerformance returns per-session efficiency for the first N sessions (P8-6).

func (*Client) GetAgentLearningCurve

func (c *Client) GetAgentLearningCurve(agentID string, weeks int) []WeeklyEfficiency

GetAgentLearningCurve returns weekly efficiency trend for an agent (P5 — Item 14).

func (*Client) GetBrainCostStats

func (c *Client) GetBrainCostStats(days int) []pulsestore.BrainCostStat

GetBrainCostStats returns per-model brain LLM cost breakdown (P4-1).

func (*Client) GetBrainEnrichmentUplift

func (c *Client) GetBrainEnrichmentUplift(days int) float64

GetBrainEnrichmentUplift returns the enrichment quality uplift ratio (P5 — Item 16).

func (*Client) GetDecayEffectiveness

func (c *Client) GetDecayEffectiveness(days int) DecayStats

GetDecayEffectiveness returns knowledge decay hit rate buckets (P5 — Item 18).

func (*Client) GetDecliningTools

func (c *Client) GetDecliningTools(days, minCallThreshold int) []pulsestore.DecliningTool

GetDecliningTools returns tools whose usage is trending downward.

func (*Client) GetDeliveryOutcomes

func (c *Client) GetDeliveryOutcomes(days int) []DeliveryOutcome

GetDeliveryOutcomes returns delivery-to-outcome linkages (P5 — Item 11).

func (*Client) GetEntityQualityDetailsBatch

func (c *Client) GetEntityQualityDetailsBatch(entities []string, projectID string) map[string]pulsestore.EntityQualityDetail

GetEntityQualityDetailsBatch returns quality details (score + negative signal count) for a set of entity names. Entities without a quality record are absent.

func (*Client) GetEntityQualityScore

func (c *Client) GetEntityQualityScore(entity, projectID string) (float64, bool)

GetEntityQualityScore returns the quality score for a single entity (Sprint 15 #2). Returns (score, true) when a quality record exists, or (0, false) when none.

func (*Client) GetEntityQualityScores

func (c *Client) GetEntityQualityScores(projectID string, limit int) []EntityQuality

GetEntityQualityScores returns entity context quality scores (P5 — Item 10).

func (*Client) GetEntityQualityScoresBatch

func (c *Client) GetEntityQualityScoresBatch(entities []string, projectID string) map[string]float64

GetEntityQualityScoresBatch returns quality scores for a specific set of entities (Sprint 15 #2 — BFS/PPR lookup). Fetches only the requested IDs in one SQL round-trip; entities with no quality record are absent from the result map.

func (*Client) GetFirstContextRightRate

func (c *Client) GetFirstContextRightRate(days int) float64

GetFirstContextRightRate returns the fraction of context deliveries that did not require correction. Returns 1.0 if no data is available.

func (*Client) GetGraphFreshnessScore

func (c *Client) GetGraphFreshnessScore() float64

GetGraphFreshnessScore returns the graph freshness score for today (P5 — Item 21).

func (*Client) GetHealthSnapshot

func (c *Client) GetHealthSnapshot() map[string]interface{}

GetHealthSnapshot returns a lightweight health check payload (P5 — Item 23).

func (*Client) GetImplementationQualityGap

func (c *Client) GetImplementationQualityGap(days int) float64

GetImplementationQualityGap returns pre/post implementation quality gap (P5 — Item 15).

func (*Client) GetLastIndexTime

func (c *Client) GetLastIndexTime() string

GetLastIndexTime returns the timestamp of the most recent full index event, or "" when no index has been recorded yet.

func (*Client) GetLatestEmbeddingModelStatus

func (c *Client) GetLatestEmbeddingModelStatus() string

GetLatestEmbeddingModelStatus returns the model_status from the most recent embedding event ("loaded" | "downloading" | "failed" | "none").

func (*Client) GetLatestGraphSnapshot

func (c *Client) GetLatestGraphSnapshot() *pulsestore.GraphSnapshotRow

GetLatestGraphSnapshot returns the most recent graph topology snapshot (P4-7).

func (*Client) GetLifetimeSummary

func (c *Client) GetLifetimeSummary() *PulseSummary

GetLifetimeSummary returns aggregated analytics across all time. Returns nil if pulse is unavailable.

func (*Client) GetMemoryFailurePreventionRate

func (c *Client) GetMemoryFailurePreventionRate(days int) float64

GetMemoryFailurePreventionRate returns the memory failure prevention rate (P5 — Item 17).

func (*Client) GetMonthlyROIReport

func (c *Client) GetMonthlyROIReport(year, month int) *MonthlyROI

GetMonthlyROIReport returns the monthly ROI report (P5 — Item 20).

func (*Client) GetMostRecentDeliveryID

func (c *Client) GetMostRecentDeliveryID(entity string) int

GetMostRecentDeliveryID returns the most recent context delivery ID for an entity (P5 — Item 11).

func (*Client) GetRecallChannelWeights

func (c *Client) GetRecallChannelWeights(projectID string) map[string]float64

GetRecallChannelWeights returns recall channel attribution weights (P5 — Item 12).

func (*Client) GetRecentEffectivenessTrend

func (c *Client) GetRecentEffectivenessTrend(days int, agentID string) []DailyEffectiveness

GetRecentEffectivenessTrend returns daily effectiveness averages (P5 — Item 13).

func (*Client) GetSearchStats

func (c *Client) GetSearchStats(days int) *pulsestore.SearchStats

GetSearchStats returns aggregated search analytics for the last N days (P4-8).

func (*Client) GetSessionContextHitRate

func (c *Client) GetSessionContextHitRate(sessionID string) float64

GetSessionContextHitRate returns the cache hit rate for context deliveries in a specific session. Returns 0 if no data.

func (*Client) GetSessionDeliveryStats

func (c *Client) GetSessionDeliveryStats(sessionID string) (total, firstFetch, tokensSaved int)

GetSessionDeliveryStats returns total deliveries, first-fetch count, and token savings for a session. All zeroes when pulse is unavailable or sessionID is empty (Sprint 15 #5).

func (*Client) GetSessionDetail

func (c *Client) GetSessionDetail(sessionID string) *pulsestore.SessionDetail

GetSessionDetail returns full analytics detail for a specific session (Bug 55).

func (*Client) GetSessionEffectiveness

func (c *Client) GetSessionEffectiveness(sessionID string) *SessionEffectiveness

GetSessionEffectiveness returns a specific session's effectiveness record (P5 — Item 13).

func (*Client) GetSummary

func (c *Client) GetSummary(days int) *PulseSummary

GetSummary returns aggregated analytics for the last N days including per-tool, per-agent, 14-day timeline, and top queried entities. Returns nil summary and empty slices if pulse is unavailable.

func (*Client) GetSummaryForProject

func (c *Client) GetSummaryForProject(days int, projectID string) *PulseSummary

GetSummaryForProject returns aggregated analytics for the last N days filtered to projectID. Returns a PulseSummary with only Summary populated (no per-tool/agent breakdowns).

func (*Client) GetSummarySectioned

func (c *Client) GetSummarySectioned(days int, sections map[string]bool) *PulseSummary

GetSummarySectioned returns a PulseSummary with only the requested sections populated. Valid sections: summary, tools, agents, timeline, entities, insights, phase4, phase5, llm. Core "summary" is always included. Sections not requested are left at zero/nil. This avoids ~30 queries per request when the caller only needs a subset (P12-3).

func (*Client) GetTimelineRaw

func (c *Client) GetTimelineRaw(days int) []pulsestore.TimelinePoint

GetTimelineRaw returns the daily timeline for the last N days (P4-1).

func (*Client) GetTokenSavingsByIntent

func (c *Client) GetTokenSavingsByIntent(days int) map[string]int64

GetTokenSavingsByIntent returns per-intent token savings (P5 — Item 22).

func (*Client) GetToolLatencyPercentiles

func (c *Client) GetToolLatencyPercentiles(toolName string, days int) *DurationBuckets

GetToolLatencyPercentiles returns p50, p95, p99 latency for a specific tool (P8-5).

func (*Client) GetToolSequences

func (c *Client) GetToolSequences(sessionID string) []ToolSequenceEntry

GetToolSequences returns tool call sequences for a session (P5 — SA-C1).

func (*Client) GetToolStatsRaw

func (c *Client) GetToolStatsRaw(days int) []pulsestore.ToolStats

GetToolStatsRaw returns raw per-tool stats for the last N days (P4-1).

func (*Client) GetToolTimeline

func (c *Client) GetToolTimeline(toolName string, days int) []pulsestore.ToolTimelinePoint

GetToolTimeline returns per-tool call counts across daily data points (Bug 54).

func (*Client) GetToolsPerSessionPercentiles

func (c *Client) GetToolsPerSessionPercentiles(days int) SessionPercentiles

GetToolsPerSessionPercentiles returns tools-per-session percentile distribution (P5 — Item 45).

func (*Client) GetValidateToVerifyRate

func (c *Client) GetValidateToVerifyRate(days int) float64

GetValidateToVerifyRate returns the fraction of sessions that called validate_plan and also called verify_implementation.

func (*Client) GetWeekOverWeek

func (c *Client) GetWeekOverWeek() *pulsestore.WoWComparison

GetWeekOverWeek returns week-over-week metric comparisons from daily_rollups. Returns nil on error (best-effort).

func (*Client) InsertDeliveryOutcome

func (c *Client) InsertDeliveryOutcome(deliveryID int, sessionID, entity, signalType string, toolsBetween int, success bool)

InsertDeliveryOutcome records a delivery-to-outcome linkage. Fire-and-forget (P5 — Item 11).

func (*Client) InsertSessionEffectiveness

func (c *Client) InsertSessionEffectiveness(ev SessionEffectiveness)

InsertSessionEffectiveness records a computed session effectiveness row. Fire-and-forget (P5 — Item 13).

func (*Client) NotifySSE

func (c *Client) NotifySSE(eventType string, count int)

NotifySSE broadcasts an SSE event to all subscribers. Non-blocking: if a subscriber's buffer is full, the notification is dropped for that subscriber. Called from the collector after each flush.

func (*Client) RecordAgentLLMUsage

func (c *Client) RecordAgentLLMUsage(ev AgentLLMUsageEvent)

RecordAgentLLMUsage enqueues an agent-reported LLM usage event (Option B). Fire-and-forget.

func (*Client) RecordBackgroundQueueDepth

func (c *Client) RecordBackgroundQueueDepth(depth int)

RecordBackgroundQueueDepth updates the peak queue depth (P9-4). Called from goBackground on each enqueue with the current queue length.

func (*Client) RecordBackgroundWorkerDrop

func (c *Client) RecordBackgroundWorkerDrop()

RecordBackgroundWorkerDrop increments the bgDropped counter (P2-5).

func (*Client) RecordBackgroundWorkerEnqueue

func (c *Client) RecordBackgroundWorkerEnqueue()

RecordBackgroundWorkerEnqueue increments the bgEnqueued counter (P2-5).

func (*Client) RecordBackgroundWorkerPanic

func (c *Client) RecordBackgroundWorkerPanic()

RecordBackgroundWorkerPanic increments the bgPanics counter (P2-5).

func (*Client) RecordBrainUsage

func (c *Client) RecordBrainUsage(ev BrainUsageEvent)

RecordBrainUsage enqueues a brain LLM inference event. Fire-and-forget. Used to track deterministic vs. Ollama call ratios in the brain enricher.

func (*Client) RecordConfigReload

func (c *Client) RecordConfigReload(ev ConfigReloadEvent)

RecordConfigReload enqueues a configuration hot-reload event. Fire-and-forget (Bug 68 — COV-9).

func (*Client) RecordContextDelivery

func (c *Client) RecordContextDelivery(ev ContextDeliveryEvent)

RecordContextDelivery enqueues a context delivery event. Fire-and-forget.

func (*Client) RecordEmbeddingEvent

func (c *Client) RecordEmbeddingEvent(ev EmbeddingEvent)

RecordEmbeddingEvent enqueues an embedding batch event. Fire-and-forget (P2-6).

func (*Client) RecordEnrichmentEvent

func (c *Client) RecordEnrichmentEvent(ev EnrichmentEvent)

RecordEnrichmentEvent enqueues a code enrichment pass outcome event. Fire-and-forget (Bug 70 — COV-Subsys).

func (*Client) RecordFederationEvent

func (c *Client) RecordFederationEvent(ev FederationDetectEvent)

RecordFederationEvent enqueues a federation detection event. Fire-and-forget (P5 — COV-8).

func (*Client) RecordGraphSnapshot

func (c *Client) RecordGraphSnapshot(ev GraphSnapshotEvent)

RecordGraphSnapshot enqueues a graph topology snapshot. Fire-and-forget (P2-7).

func (*Client) RecordGuardEvent

func (c *Client) RecordGuardEvent(ev GuardEvent)

RecordGuardEvent enqueues a loop-guard or rate-limiter block event. Fire-and-forget (P3-2/P3-3).

func (*Client) RecordHeartbeat

func (c *Client) RecordHeartbeat()

RecordHeartbeat enqueues a system uptime heartbeat tick. Fire-and-forget (P5 — ROI-E1).

func (*Client) RecordIndexEvent

func (c *Client) RecordIndexEvent(ev IndexEvent)

RecordIndexEvent enqueues a full-index completion event. Fire-and-forget (P2-8).

func (*Client) RecordLifecycleEvent

func (c *Client) RecordLifecycleEvent(eventType string, valueMs float64, projectID string)

RecordLifecycleEvent records a daemon lifecycle event (startup, shutdown, drain). Fire-and-forget; errors are silently discarded.

func (*Client) RecordMemoryOp

func (c *Client) RecordMemoryOp(ev MemoryOperationEvent)

RecordMemoryOp enqueues a recall hit/miss or memory write event. Fire-and-forget (P3-4).

func (*Client) RecordOutcomeSignal

func (c *Client) RecordOutcomeSignal(ev OutcomeSignalEvent)

RecordOutcomeSignal enqueues an intent alignment outcome signal. Fire-and-forget.

func (*Client) RecordParseEvent

func (c *Client) RecordParseEvent(ev ParseEvent)

RecordParseEvent enqueues a per-file parse event. Fire-and-forget (P2-2).

func (*Client) RecordPersistenceEvent

func (c *Client) RecordPersistenceEvent(ev PersistenceEvent)

RecordPersistenceEvent enqueues a store write duration/size event. Fire-and-forget (Bug 69 — COV-12).

func (*Client) RecordReparseEvent

func (c *Client) RecordReparseEvent(ev ReparseEvent)

RecordReparseEvent enqueues an incremental reparse event. Fire-and-forget (P2-3).

func (*Client) RecordRuleEvalEvent

func (c *Client) RecordRuleEvalEvent(ev RuleEvalEvent)

RecordRuleEvalEvent enqueues an architecture rule evaluation event. Fire-and-forget (Bug 71 — COV-Subsys).

func (*Client) RecordSearchEvent

func (c *Client) RecordSearchEvent(ev SearchEvent)

RecordSearchEvent enqueues a search or find_entity analytics event. Fire-and-forget (P4-8).

func (*Client) RecordSessionEvent

func (c *Client) RecordSessionEvent(agentID, projectID, eventType string)

RecordSessionEvent enqueues a session lifecycle event. Fire-and-forget. If sessionID is provided, it is used directly (preferred — avoids session ID collision). If empty, falls back to the legacy synthetic ID format for backward compatibility.

func (*Client) RecordSessionEventFull

func (c *Client) RecordSessionEventFull(sessionID, agentID, projectID, eventType, agentVersion string)

RecordSessionEventFull enqueues a session lifecycle event with agent version (Bug 16 — DQ-C.6). If sessionID is empty, the event is silently dropped.

func (*Client) RecordSessionEventWithID

func (c *Client) RecordSessionEventWithID(sessionID, agentID, projectID, eventType string)

RecordSessionEventWithID enqueues a session lifecycle event with an explicit session UUID from the main store. If sessionID is empty, the event is silently dropped — callers must resolve the session ID before calling.

func (*Client) RecordSessionModel

func (c *Client) RecordSessionModel(agentID, projectID, model, provider string)

RecordSessionModel records which model the agent declared in session_init (Option A). Fire-and-forget; errors are silently discarded.

func (*Client) RecordSessionModelWithID

func (c *Client) RecordSessionModelWithID(sessionID, agentID, projectID, model, provider string)

RecordSessionModelWithID records the model with an explicit session UUID. If sessionID is empty, the event is silently dropped.

func (*Client) RecordToolCall

func (c *Client) RecordToolCall(ev ToolCallEvent)

RecordToolCall enqueues a tool call event. Fire-and-forget.

func (*Client) RecordToolSequenceEntry

func (c *Client) RecordToolSequenceEntry(sessionID, toolName string, position int, success bool)

RecordToolSequenceEntry enqueues a tool call sequence entry. Fire-and-forget (P5 — SA-C1).

func (*Client) RecordValidationEvent

func (c *Client) RecordValidationEvent(ev ValidationEvent)

RecordValidationEvent enqueues a validate_plan or verify_implementation outcome event. Fire-and-forget (P3-5).

func (*Client) SetSessionIntent

func (c *Client) SetSessionIntent(sessionID, intent string)

SetSessionIntent sets the intent field on a Pulse session row (P8-1). Fire-and-forget; errors are silently discarded.

func (*Client) SetSessionTermination

func (c *Client) SetSessionTermination(sessionID, reason string)

SetSessionTermination records termination reason and duration. Fire-and-forget (P5 — Item 32).

func (*Client) SubscribeSSE

func (c *Client) SubscribeSSE() chan SSEEvent

SubscribeSSE returns a channel that receives SSE events after each collector flush. The caller must call UnsubscribeSSE when done to prevent leaks. Channel has a small buffer to avoid blocking the flush path (P12-7).

func (*Client) UnsubscribeSSE

func (c *Client) UnsubscribeSSE(ch chan SSEEvent)

UnsubscribeSSE removes a subscriber channel and closes it. Safe to call multiple times — only the first call closes the channel.

func (*Client) UpdateRecallChannelStats

func (c *Client) UpdateRecallChannelStats(projectID string)

UpdateRecallChannelStats recomputes recall channel attribution weights. Fire-and-forget (P5 — Item 12).

func (*Client) WriteErrors

func (c *Client) WriteErrors() int64

WriteErrors returns the total collector write errors (P5 — DQ-Integrity.1 / Item 35).

type ConfigReloadEvent

type ConfigReloadEvent = types.ConfigReloadEvent

ConfigReloadEvent re-exports types.ConfigReloadEvent.

type ContextDeliveryEvent

type ContextDeliveryEvent = types.ContextDeliveryEvent

ContextDeliveryEvent re-exports types.ContextDeliveryEvent.

type DailyEffectiveness

type DailyEffectiveness = types.DailyEffectiveness

DailyEffectiveness re-exports types.DailyEffectiveness.

type DecayStats

type DecayStats = types.DecayStats

DecayStats re-exports types.DecayStats.

type DeliveryOutcome

type DeliveryOutcome = types.DeliveryOutcome

DeliveryOutcome re-exports types.DeliveryOutcome.

type DurationBuckets

type DurationBuckets = types.DurationBuckets

DurationBuckets re-exports types.DurationBuckets.

type EmbeddingEvent

type EmbeddingEvent = types.EmbeddingEvent

EmbeddingEvent re-exports types.EmbeddingEvent.

type EnrichmentEvent

type EnrichmentEvent = types.EnrichmentEvent

EnrichmentEvent re-exports types.EnrichmentEvent.

type EntityEffectiveness

type EntityEffectiveness = types.EntityEffectiveness

EntityEffectiveness re-exports types.EntityEffectiveness.

type EntityQuality

type EntityQuality = types.EntityQuality

EntityQuality re-exports types.EntityQuality.

type FederationDetectEvent

type FederationDetectEvent = types.FederationDetectEvent

FederationDetectEvent re-exports types.FederationDetectEvent.

type GraphSnapshotEvent

type GraphSnapshotEvent = types.GraphSnapshotEvent

GraphSnapshotEvent re-exports types.GraphSnapshotEvent.

type GuardEvent

type GuardEvent = types.GuardEvent

GuardEvent re-exports types.GuardEvent.

type IndexEvent

type IndexEvent = types.IndexEvent

IndexEvent re-exports types.IndexEvent.

type MemoryOperationEvent

type MemoryOperationEvent = types.MemoryOperationEvent

MemoryOperationEvent re-exports types.MemoryOperationEvent.

type MonthlyROI

type MonthlyROI = types.MonthlyROI

MonthlyROI re-exports types.MonthlyROI.

type OutcomeSignalEvent

type OutcomeSignalEvent = types.OutcomeSignalEvent

OutcomeSignalEvent re-exports types.OutcomeSignalEvent.

type ParseEvent

type ParseEvent = types.ParseEvent

ParseEvent re-exports types.ParseEvent.

type PersistenceEvent

type PersistenceEvent = types.PersistenceEvent

PersistenceEvent re-exports types.PersistenceEvent.

type PulseSummary

type PulseSummary struct {
	Days        int                        `json:"days"`
	Summary     *pulsestore.Summary        `json:"summary"`
	Tools       []pulsestore.ToolStats     `json:"tools"`
	Agents      []pulsestore.AgentStats    `json:"agents"`
	Timeline    []pulsestore.TimelinePoint `json:"timeline"`
	TopEntities []pulsestore.EntityCount   `json:"top_entities"`
	Insights    []EntityEffectiveness      `json:"insights"`
	LLMStats    []pulsestore.AgentLLMStats `json:"llm_stats"`
	RuleHits    []pulsestore.RuleHitStat   `json:"rule_hits"`
	// Phase 4 analytics extensions.
	TopEntitiesBySavings        []pulsestore.EntitySavings       `json:"top_entities_by_savings,omitempty"`
	CostSavingsByModel          []pulsestore.ModelCostStat       `json:"cost_savings_by_model,omitempty"`
	AgentTokenEfficiency        []pulsestore.AgentEfficiencyStat `json:"agent_token_efficiency,omitempty"`
	ContextReuseRate            float64                          `json:"context_reuse_rate,omitempty"`
	EngagementScore             float64                          `json:"engagement_score,omitempty"`
	OnboardingLatencyMs         float64                          `json:"onboarding_latency_ms,omitempty"`
	MultiSessionCampaigns       int                              `json:"multi_session_campaigns,omitempty"`
	AgentToolPreferences        []pulsestore.AgentToolPref       `json:"agent_tool_preferences,omitempty"`
	AgentEfficiencyScores       []pulsestore.AgentEfficiency     `json:"agent_efficiency_scores,omitempty"`
	ModelComparison             []pulsestore.ModelComparisonStat `json:"model_comparison,omitempty"`
	ErrorRecoveryPatterns       []pulsestore.ErrorRecovery       `json:"error_recovery_patterns,omitempty"`
	ToolPairCorrelation         []pulsestore.ToolPairStat        `json:"tool_pair_correlation,omitempty"`
	DiscoveryToolEffective      float64                          `json:"discovery_tool_effectiveness,omitempty"`
	MemoryTypeDistribution      map[string]int                   `json:"memory_type_distribution,omitempty"`
	CancellationReasons         []pulsestore.CancellationStat    `json:"cancellation_reasons,omitempty"`
	PlanComplexityVsOutcome     []pulsestore.PlanComplexityStat  `json:"plan_complexity_vs_outcome,omitempty"`
	BlockedTaskCount            int                              `json:"blocked_task_count,omitempty"`
	MessageVolumeStats          *pulsestore.MessageVolumeStat    `json:"message_volume_stats,omitempty"`
	CrossProjectQueryVolume     int                              `json:"cross_project_query_volume,omitempty"`
	ApprovalGateUsage           int                              `json:"approval_gate_usage,omitempty"`
	ModelEfficiencyComparison   []pulsestore.ModelEfficiency     `json:"model_efficiency_comparison,omitempty"`
	ProjectEfficiencyComparison []pulsestore.ProjectEfficiency   `json:"project_efficiency_comparison,omitempty"`
	HypotheticalCostUSD         float64                          `json:"hypothetical_cost_usd,omitempty"`
	WithSynapsesCostUSD         float64                          `json:"with_synapses_cost_usd,omitempty"`
	LatencyP50Ms                float64                          `json:"latency_p50_ms,omitempty"`
	LatencyP95Ms                float64                          `json:"latency_p95_ms,omitempty"`
	LatencyP99Ms                float64                          `json:"latency_p99_ms,omitempty"`
	ContextPrecision            float64                          `json:"context_precision,omitempty"`
	ContextRecall               float64                          `json:"context_recall,omitempty"`
	ContextF1                   float64                          `json:"context_f1,omitempty"`
	BrainCostStats              []pulsestore.BrainCostStat       `json:"brain_cost_stats,omitempty"`
	SearchStats                 *pulsestore.SearchStats          `json:"search_stats,omitempty"`
	GraphSnapshot               *pulsestore.GraphSnapshotRow     `json:"graph_snapshot,omitempty"`
	AvgTaskDurationMs           float64                          `json:"avg_task_duration_ms,omitempty"`
	// Phase 5: self-refining loop, coverage & observability.
	EntityQualityScores      []types.EntityQuality      `json:"entity_quality_scores,omitempty"`
	RecallChannelWeights     map[string]float64         `json:"recall_channel_weights,omitempty"`
	EffectivenessTrend       []types.DailyEffectiveness `json:"effectiveness_trend,omitempty"`
	ImplementationQualityGap float64                    `json:"implementation_quality_gap,omitempty"`
	BrainEnrichmentUplift    float64                    `json:"brain_enrichment_uplift,omitempty"`
	MemoryFailurePrevRate    float64                    `json:"memory_failure_prevention_rate,omitempty"`
	DecayEffectiveness       types.DecayStats           `json:"decay_effectiveness,omitempty"`
	GraphFreshnessScoreP5    float64                    `json:"graph_freshness_score_p5,omitempty"`
	TokenSavingsByIntent     map[string]int64           `json:"token_savings_by_intent,omitempty"`
	SessionPercentiles       types.SessionPercentiles   `json:"session_percentiles,omitempty"`
	CollectorWriteErrors     int64                      `json:"collector_write_errors,omitempty"`
	CrossSessionReuseRate    float64                    `json:"cross_session_reuse_rate,omitempty"`
	ConcurrentAgentsMax      int                        `json:"concurrent_agents_max,omitempty"`
}

PulseSummary is the response shape for GET /api/admin/pulse/summary.

type ReparseEvent

type ReparseEvent = types.ReparseEvent

ReparseEvent re-exports types.ReparseEvent.

type RuleEvalEvent

type RuleEvalEvent = types.RuleEvalEvent

RuleEvalEvent re-exports types.RuleEvalEvent.

type SSEEvent

type SSEEvent struct {
	EventType string `json:"event_type"` // "flush", "tool_call", "context_delivery", etc.
	Count     int    `json:"count"`      // number of events in this flush batch
	Timestamp string `json:"timestamp"`
}

SSEEvent is a lightweight notification sent to SSE subscribers after collector flush.

type SearchEvent

type SearchEvent = types.SearchEvent

SearchEvent re-exports types.SearchEvent.

type SessionEffectiveness

type SessionEffectiveness = types.SessionEffectiveness

SessionEffectiveness re-exports types.SessionEffectiveness.

type SessionEvent

type SessionEvent = types.SessionEvent

SessionEvent re-exports types.SessionEvent.

type SessionPercentiles

type SessionPercentiles = types.SessionPercentiles

SessionPercentiles re-exports types.SessionPercentiles.

type SessionPerformance

type SessionPerformance = types.SessionPerformance

SessionPerformance re-exports types.SessionPerformance.

type ToolCallEvent

type ToolCallEvent = types.ToolCallEvent

ToolCallEvent re-exports types.ToolCallEvent so callers use pulse.ToolCallEvent.

type ToolSequenceEntry

type ToolSequenceEntry = types.ToolSequenceEntry

ToolSequenceEntry re-exports types.ToolSequenceEntry.

type ValidationEvent

type ValidationEvent = types.ValidationEvent

ValidationEvent re-exports types.ValidationEvent.

type WeeklyEfficiency

type WeeklyEfficiency = types.WeeklyEfficiency

WeeklyEfficiency re-exports types.WeeklyEfficiency.

Directories

Path Synopsis
Package aggregator pre-computes daily rollup metrics for fast dashboard queries.
Package aggregator pre-computes daily rollup metrics for fast dashboard queries.
Package collector implements an async event buffer that decouples ingestion from SQLite writes.
Package collector implements an async event buffer that decouples ingestion from SQLite writes.
Package store implements the SQLite persistence layer for synapses-pulse.
Package store implements the SQLite persistence layer for synapses-pulse.
Package types defines the shared event types for the pulse analytics subsystem.
Package types defines the shared event types for the pulse analytics subsystem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL