data/commands/builtin/insights_command library

Classes

AggregatedData
Aggregated data across all sessions.
InsightResults
Results from all insight sections.
InsightsCommand
The /insights command — generates a usage report analyzing Neomage sessions.
InsightSection
Insight section definition for parallel generation.
InsightsExport
Export format for structured data.
LiteSessionInfo
Lightweight session info from filesystem metadata.
SessionFacets
Facets extracted from a session by the model.
SessionMeta
Metadata extracted from a single session.
ToolStatsResult
Result of extracting tool statistics from a session log.

Constants

extensionToLanguage → const Map<String, String>
File-extension to language mapping for stats collection.
facetExtractionPrompt → const String
Prompt for facet extraction from sessions.
labelMap → const Map<String, String>
Label map for cleaning up category names (matching Python reference).
outcomeOrder → const List<String>
satisfactionOrder → const List<String>
Fixed orderings for specific charts.

Functions

aggregateData(List<SessionMeta> sessions, Map<String, SessionFacets> facets) → AggregatedData
Aggregate data from all sessions and facets into a single report.
buildInsightSections() → List<InsightSection>
Build the set of insight section definitions for parallel generation.
categorizeToolError(String content) → String
Categorize a tool error based on its content.
deduplicateSessionBranches(List<SessionMeta> metas) → List<SessionMeta>
Deduplicate conversation branches within the same session.
detectMultiClauding(List<({String sessionId, List<String> timestamps})> sessions) → ({int overlapEvents, int sessionsInvolved, int userMessagesDuring})
Detect multi-session (using multiple Neomage sessions concurrently).
extractToolStats(List<Map<String, dynamic>> messages) → ToolStatsResult
Extract tool usage statistics from session messages.
getDataDir() → String
Get the usage data directory path.
getFacetsDir() → String
Get the facets cache directory path.
getLanguageFromPath(String filePath) → String?
Get language from file path extension.
getProjectsDir() → String
Get the projects directory path.
getSessionMetaDir() → String
Get the session meta cache directory path.
isMinimalSession(String sessionId, Map<String, SessionFacets> facets) → bool
Check if a session is minimal (warmup only).
isSubstantiveSession(SessionMeta meta) → bool
Check if a session is substantive (not minimal).
loadCachedFacets(String sessionId) → Future<SessionFacets?>
Load cached facets for a session.
loadCachedSessionMeta(String sessionId) → Future<SessionMeta?>
Load cached session metadata.
saveFacets(SessionFacets facets) → Future<void>
Save facets to cache.
saveSessionMeta(SessionMeta meta) → Future<void>
Save session metadata to cache.
scanAllSessions() → Future<List<LiteSessionInfo>>
Scan all project directories using filesystem metadata only. Returns a list of session file info sorted by mtime descending.