Shaunebu.Common.Intelligence 1.0.0

dotnet add package Shaunebu.Common.Intelligence --version 1.0.0
                    
NuGet\Install-Package Shaunebu.Common.Intelligence -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Shaunebu.Common.Intelligence" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Shaunebu.Common.Intelligence" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Shaunebu.Common.Intelligence" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Shaunebu.Common.Intelligence --version 1.0.0
                    
#r "nuget: Shaunebu.Common.Intelligence, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Shaunebu.Common.Intelligence@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Shaunebu.Common.Intelligence&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Shaunebu.Common.Intelligence&version=1.0.0
                    
Install as a Cake Tool

A powerful, privacy-first local intelligence framework for .NET applications. Analyze user behavior, generate insights, and discover patterns entirely offline without external dependencies.

https://img.shields.io/badge/NuGet-Ready-blue https://img.shields.io/badge/Privacy-First-green https://img.shields.io/badge/100%2525-Offline-orange

NuGet Version

NET Support NET Support NET Support Support

๐ŸŒŸ Features

๐ŸŽฏ Core Intelligence

  • Local Behavior Tracking - Monitor user interactions and feature usage

  • Automatic Insight Generation - Get recommendations and suggestions based on usage patterns

  • Pattern Detection - Discover usage sequences, correlations, and time-based patterns

  • Real-time Analytics - Analyze behavior as it happens

๐Ÿ›ก๏ธ Enterprise Ready

  • 100% Offline - No internet connection required

  • Privacy First - All data stays on device

  • Thread Safe - Built for multi-threaded environments

  • Error Resilient - Robust error handling and recovery

  • Performance Optimized - Efficient memory and storage usage

๐Ÿ“Š Advanced Analytics

  • Usage Frequency - Track most-used features

  • Behavior Sequences - Discover common workflow patterns

  • Time-based Analysis - Identify peak usage times

  • Feature Correlations - Find related features

  • Confidence Scoring - Measure pattern reliability

๐Ÿ“Š Feature Comparison Table

Feature Shaunebu.Common.Intelligence Application Insights Microsoft.ML LiteDB + Custom Google Analytics Mixpanel
Core Intelligence
๐ŸŽฏ Local Behavior Tracking โœ… Built-in โœ… โŒ โš ๏ธ Custom โœ… โœ…
๐Ÿค– Automatic Insight Generation โœ… AI-like โŒ โš ๏ธ Manual setup โŒ โŒ โš ๏ธ Basic
๐Ÿ” Pattern Detection โœ… Automatic โš ๏ธ Manual queries โœ… โŒ โš ๏ธ Limited โš ๏ธ Limited
๐Ÿ“ˆ Real-time Analytics โœ… Local โœ… Cloud โŒ โš ๏ธ Custom โœ… Cloud โœ… Cloud
Privacy & Data
๐Ÿ›ก๏ธ 100% Offline โœ… No internet โŒ โœ… โœ… โŒ โŒ
๐Ÿ”’ Privacy First โœ… Data stays local โŒ โœ… โœ… โŒ โŒ
๐Ÿ“ฑ GDPR Compliant โœ… By design โš ๏ธ Configurable โœ… โœ… โš ๏ธ Configurable โš ๏ธ Configurable
๐Ÿ’พ Encrypted Storage โœ… AES optional โŒ โŒ โš ๏ธ Custom โŒ โŒ
Enterprise Features
๐Ÿงต Thread Safe โœ… Built-in โœ… โœ… โš ๏ธ Custom โœ… โœ…
๐Ÿ›ก๏ธ Error Resilient โœ… Auto-recovery โœ… โš ๏ธ Basic โš ๏ธ Custom โœ… โœ…
โšก Performance Optimized โœ… Configurable โœ… โœ… โš ๏ธ Custom โœ… โœ…
๐Ÿ“Š Rate Limiting โœ… Built-in โŒ โŒ โŒ โœ… โœ…
Advanced Analytics
๐Ÿ“… Usage Frequency โœ… Automatic โœ… โŒ โš ๏ธ Custom โœ… โœ…
๐Ÿ”„ Behavior Sequences โœ… Pattern detection โš ๏ธ Manual โœ… โŒ โš ๏ธ Limited โœ…
โฐ Time-based Analysis โœ… Built-in โœ… โš ๏ธ Custom โŒ โœ… โœ…
๐Ÿ”— Feature Correlations โœ… Automatic โŒ โœ… โŒ โŒ โš ๏ธ Limited
๐ŸŽฏ Confidence Scoring โœ… Pattern reliability โŒ โœ… โŒ โŒ โŒ
Development Experience
๐Ÿš€ Setup Time โœ… Minutes โœ… Quick โŒ Complex โŒ High โœ… Quick โœ… Quick
๐Ÿ“š Learning Curve โœ… Low โœ… Low โŒ High โš ๏ธ Medium โœ… Low โœ… Low
๐Ÿ”ง Configuration โœ… Simple DI โœ… Simple โŒ Complex โŒ High โœ… Simple โœ… Simple
๐ŸŽฏ .NET Integration โœ… Native โœ… Native โœ… Native โœ… Native โš ๏ธ REST API โš ๏ธ REST API
Cost & Licensing
๐Ÿ’ฐ Cost โœ… Free ๐Ÿ’ฐ Pay-per-use โœ… Free โœ… Free ๐Ÿ’ฐ Freemium ๐Ÿ’ฐ Expensive
๐Ÿ“œ Licensing โœ… MIT โœ… Proprietary โœ… MIT โœ… MIT โœ… Proprietary โœ… Proprietary
๐Ÿ”ง Infrastructure โœ… None โ˜๏ธ Azure โœ… None โœ… None โ˜๏ธ Google Cloud โ˜๏ธ Mixpanel

๐Ÿš€ Quick Start

Installation

dotnet add package Shaunebu.Common.Intelligence

Basic Usage

using Microsoft.Extensions.DependencyInjection;
using Shaunebu.Common.Intelligence.Extensions;

// Setup DI
var services = new ServiceCollection();
services.AddLocalIntelligence();

var provider = services.BuildServiceProvider();
var intelligence = provider.GetRequiredService<ILocalIntelligenceService>();

// Track user behavior
await intelligence.TrackFeatureUsageAsync("ExportData", "clicked", new Dictionary<string, object>
{
    ["FileType"] = "PDF",
    ["SizeKB"] = 2048
});

// Get insights
var insights = await intelligence.GetActiveInsightsAsync();
foreach (var insight in insights)
{
    Console.WriteLine($"{insight.Title}: {insight.Message}");
}

๐Ÿ“– Documentation

Configuration

services.AddLocalIntelligence(options =>
{
    options.StoragePath = "path/to/your/data";
    options.DataRetentionPeriod = TimeSpan.FromDays(90);
    options.MaxBehaviorsInMemory = 5000;
    options.RateLimitPerMinute = 100;
    options.EnableEncryption = true;
    options.MinimumBehaviorsForAnalysis = 10;
});

Tracking Behavior

// Simple feature tracking
await intelligence.TrackFeatureUsageAsync("Search", "executed");

// With metadata
await intelligence.TrackFeatureUsageAsync("DocumentEdit", "saved", new Dictionary<string, object>
{
    ["DocumentType"] = "Presentation",
    ["Changes"] = 15,
    ["DurationSeconds"] = 45
});

// Custom behavior object
var behavior = new UserBehavior
{
    Feature = "Export",
    Action = "completed",
    Duration = TimeSpan.FromSeconds(30),
    Metadata = new Dictionary<string, object>
    {
        ["Format"] = "PDF",
        ["Pages"] = 25
    }
};
await intelligence.TrackBehaviorAsync(behavior);

Generating Insights

// Generate insights from current data
var newInsights = await intelligence.GenerateInsightsAsync();

// Get active insights
var activeInsights = await intelligence.GetActiveInsightsAsync();

// Dismiss an insight
await intelligence.DismissInsightAsync(insightId);

Analytics & Patterns

// Get usage patterns
var patterns = await intelligence.GetUsagePatternsAsync(TimeSpan.FromDays(30));

// Top features
var topFeatures = await intelligence.GetTopFeaturesAsync(5);

// Behavior sequences
var sequences = await intelligence.GetBehaviorSequencesAsync();

// Feature correlations  
var correlations = await intelligence.GetFeatureCorrelationsAsync();

// Analysis summary
var summary = await intelligence.GetAnalysisSummaryAsync();

Data Management

// Export data
await intelligence.ExportDataAsync("path/to/export.json");

// Clear old data
await intelligence.ClearOldDataAsync(TimeSpan.FromDays(365));

// Get statistics
var totalBehaviors = await intelligence.GetTotalBehaviorsCountAsync();
var counters = intelligence.GetPerformanceCounters();

๐ŸŽฏ Use Cases

Document Processing App

public class DocumentService
{
    private readonly ILocalIntelligenceService _intelligence;
    
    public async Task ProcessDocumentAsync(string filePath)
    {
        await _intelligence.TrackFeatureUsageAsync("DocumentImport", "started");
        
        // Process document...
        
        await _intelligence.TrackFeatureUsageAsync("DocumentImport", "completed", new Dictionary<string, object>
        {
            ["FileSize"] = new FileInfo(filePath).Length,
            ["ProcessingTime"] = stopwatch.ElapsedMilliseconds
        });
        
        // Check for insights
        var insights = await _intelligence.GetActiveInsightsAsync();
        await ShowRelevantInsightsAsync(insights);
    }
}

E-commerce App

public class ProductService
{
    public async Task TrackUserJourneyAsync(string userId, string action, Dictionary<string, object> metadata)
    {
        await _intelligence.TrackFeatureUsageAsync($"User.{action}", "performed", metadata);
        
        // Insights might reveal:
        // - "Users who view electronics often check reviews"
        // - "Peak shopping time is 7-9 PM"
        // - "Mobile users prefer one-click checkout"
    }
}

๐Ÿ”ง Advanced Usage

Custom Insight Engine

public class CustomInsightEngine : IInsightEngine
{
    public async Task<List<LocalInsight>> AnalyzeBehaviorsAsync(List<UserBehavior> behaviors)
    {
        var insights = new List<LocalInsight>();
        
        // Your custom analysis logic
        if (behaviors.Count(b => b.Feature == "PremiumFeature") > 10)
        {
            insights.Add(new LocalInsight
            {
                Type = InsightType.Recommendation,
                Title = "Power User Detected",
                Message = "You're using premium features frequently. Consider upgrading?",
                Priority = InsightPriority.Medium
            });
        }
        
        return insights;
    }
}

// Registration
services.AddLocalIntelligenceWithCustomStorage<CustomInsightEngine>();

Custom Storage

public class DatabaseStorage : IBehaviorStorage
{
    public async Task SaveBehaviorsAsync(IEnumerable<UserBehavior> behaviors)
    {
        // Save to your database
        await _dbContext.Behaviors.AddRangeAsync(behaviors);
        await _dbContext.SaveChangesAsync();
    }
    
    // Implement other methods...
}

// Registration
services.AddLocalIntelligenceWithCustomStorage<DatabaseStorage>();

๐Ÿ“Š Insight Types

Type Description Example
Recommendation Suggested actions "Try this feature you might like"
Reminder Helpful reminders "You haven't used X in a while"
Suggestion Usage tips "This shortcut might help"
Pattern Discovered patterns "You usually do X after Y"
Optimization Performance tips "This setting could speed things up"

๐Ÿ›ก๏ธ Privacy & Security

  • No Data Leaves Device - All processing happens locally

  • Encrypted Storage - Optional AES encryption for stored data

  • PII Filtering - Automatic filtering of sensitive information

  • Data Retention Control - Configurable data lifespan

  • Export Control - Full control over data exports

๐Ÿ“ˆ Performance

  • Memory Efficient - Configurable in-memory limits

  • Background Processing - Non-blocking operations

  • Rate Limiting - Prevents excessive tracking

  • Optimized Storage - Efficient serialization and compression

๐Ÿ” Monitoring

// Get performance metrics
var counters = intelligence.GetPerformanceCounters();
Console.WriteLine($"Behaviors tracked: {counters.TotalBehaviorsTracked}");
Console.WriteLine($"Insights generated: {counters.InsightsGenerated}");
Console.WriteLine($"Storage operations: {counters.StorageOperations}");

// Health check
try
{
    var count = await intelligence.GetTotalBehaviorsCountAsync();
    Console.WriteLine("Service is healthy");
}
catch (Exception ex)
{
    Console.WriteLine($"Service health check failed: {ex.Message}");
}

๐Ÿ› Troubleshooting

Common Issues

Q: Getting "Lock timeout" errors?
A: Ensure all lock acquisitions have matching releases in finally blocks. Q: Insights not generating?
A: Check MinimumBehaviorsForAnalysis configuration and ensure enough data is collected. Q: Storage corruption?
A: The library includes automatic recovery mechanisms. Use RecoverFromCorruptedDataAsync() if needed. Q: Performance issues?
A: Adjust MaxBehaviorsInMemory and enable compression in options.

Logging

Enable detailed logging to monitor operations:

services.AddLogging(builder => 
    builder.AddConsole().SetMinimumLevel(LogLevel.Debug));
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 241 10/30/2025