An autonomous .NET 10 C# console agent that connects to Outlook mailboxes via Microsoft Graph and intelligently removes spam emails using the Microsoft Agent Framework.
The Spam Removal Agent is designed for unattended, continuous operation with conservative spam detection to ensure legitimate emails are never deleted. It prioritizes false negatives over false positpositives with a strict ≥90% confidence threshold.
- Conservative Spam Detection: ≥90% confidence threshold required for deletion
- Autonomous Operation: Runs continuously as a background service
- Microsoft Graph Integration: Secure OAuth 2.0 authentication with minimal permissions (Mail.ReadWrite)
- Multi-layer Validation: Sender reputation, content analysis, and pattern matching
- Comprehensive Logging: Structured logging with Application Insights telemetry
- .NET Aspire Orchestration: Development-time observability dashboard
- Graceful Error Handling: Resilient operation with exponential backoff and circuit breaker patterns
- .NET 10 - Latest C# features
- Microsoft Agent Framework -
Microsoft.Agents.AIfor autonomous operations - Microsoft Graph .NET SDK - Secure Outlook mailbox access
- .NET Aspire - Orchestration and observability
- Application Insights - Production telemetry and monitoring
- xUnit - Test-driven development
The authentication system is production ready with comprehensive testing:
- ✅ Multi-environment support (Windows/Azure/GitHub Actions)
- ✅ Interactive PKCE and Service Principal flows
- ✅ Secure token storage (Windows Credential Manager, Azure Key Vault)
- ✅ Proactive token refresh with 5-minute buffer
- ✅ Retry logic and throttling middleware
- ✅ Application Insights telemetry integration
- ✅ 38 tests passing (100% pass rate)
- ✅ Zero build warnings
See: specs/002-oauth-2-0/FEATURE_COMPLETE.md for details
Next feature specification in development.
src/
├── SpamRemovalAgent/ # Main console application
│ ├── Agents/ # AIAgent implementations
│ ├── Services/ # Graph, spam detection, rule engine
│ ├── Authentication/ # OAuth 2.0 (✅ COMPLETE)
│ ├── Hosting/ # IHostedService implementation
│ ├── Observability/ # Application Insights telemetry
│ └── Models/ # Domain models
├── SpamRemovalAgent.AppHost/ # .NET Aspire orchestration
└── tests/
└── SpamRemovalAgent.Tests/ # Unit, integration, agent tests (38 passing)
This project follows Spec-Driven Development (SDD) using GitHub Spec Kit, where specifications in .specify/memory/specs/ drive implementation.
- .NET 10 SDK
- Visual Studio 2025 or VS Code
- Azure AD App Registration (for Microsoft Graph access)
- Windows 10+ (deployment target)
- Clone the repository
- Configure OAuth credentials in Windows Credential Manager
- Update
appsettings.jsonwith your Azure AD app details - Build the solution:
dotnet build - Run tests:
dotnet test - Launch with Aspire:
dotnet run --project src/SpamRemovalAgent.AppHost
All development must comply with .specify/memory/constitution.md:
- Conservative deletion - Never delete legitimate emails
- Microsoft Graph only - No IMAP/POP3
- Agent Framework integration - Use
AIAgentinterface - Comprehensive logging - Log all decisions with reasoning
- OAuth tokens stored in Windows Credential Manager (never plaintext)
- Minimal permissions:
Mail.ReadWriteonly - Local processing - no external service transmission
- No sensitive data in logs
- Target: 100+ emails/minute
- Rate limiting: Respects Graph API quotas
- Retry logic: Exponential backoff (2s → 32s max)
- Circuit breaker: Graceful degradation on failures
[Add your license here]
This project follows spec-driven development. See .specify/memory/project-docs/spec-driven-development.md for the workflow.