Add project documentation and reference materials

Include Luna AI Assistant design docs covering channels, configuration,
core architecture, memory, scheduler, and skills. Add reference docs
from OpenClaw and ZeroClaw projects, plus Mistral and OpenAI API specs.
This commit is contained in:
2026-04-04 04:14:06 +02:00
parent 969e4d6e37
commit 9929941748
39 changed files with 55467 additions and 0 deletions
@@ -0,0 +1,112 @@
# Configuration
## Overview
Luna uses the standard .NET Options pattern for managing application settings. The configuration system relies on `IOptions<T>` and `IOptionsMonitor<T>` to provide typed access to settings defined in `appsettings.json`. This approach ensures type safety and allows for easy validation at startup.
The configuration is centralized in the `Luna.Configuration` project. Settings are bound during application startup using the `.BindConfiguration().ValidateDataAnnotations().ValidateOnStart()` pattern.
## Options Classes
### AgentOptions
These settings define the behavior and identity of AI agents like the [[Core]] agent or the Librarian. Agents retrieve their specific configuration using `IOptionsMonitor<AgentOptions>.Get(name)`.
```csharp
public class AgentOptions
{
public required string Name { get; set; }
public string? DisplayName { get; init; }
public string? Description { get; init; }
public required string Provider { get; init; }
public required string ModelId { get; init; }
public required string Instructions { get; init; }
public required int MaxContextTokens { get; init; }
}
```
### ProviderOptions
Configures the connection details for AI model providers such as Mistral or OpenAI.
```csharp
public class ProviderOptions
{
public required string ApiKey { get; init; }
public required string ApiUrl { get; init; }
public required string[] Models { get; init; }
}
```
### SessionOptions
Controls how [[Memory]] and conversation sessions are managed. It specifically dictates when the session context should be compacted to save tokens.
```csharp
public class SessionOptions
{
public required float ContextTokenThreshold { get; init; }
public required int RetainedMessagesAfterCompacting { get; init; }
}
```
### TelegramOptions
Specific settings for the Telegram [[Channels]] adapter, including bot authentication and user access control.
```csharp
public class TelegramOptions
{
public required string BotToken { get; init; }
public string? WebhookUrl { get; init; }
public int PollingTimeoutSeconds { get; init; } = 30;
public string[] AllowedUserIds { get; init; } = [];
}
```
## Example Configuration
The following `appsettings.json` structure demonstrates how these options are populated:
```json
{
"Agents": {
"Core": {
"Name": "Core",
"Provider": "Mistral",
"ModelId": "mistral-small-latest",
"Instructions": "You are Luna, a helpful AI assistant.",
"MaxContextTokens": 8192
},
"Librarian": {
"Name": "Librarian",
"Provider": "Mistral",
"ModelId": "mistral-small-latest",
"Instructions": "Summarize conversations concisely.",
"MaxContextTokens": 4096
}
},
"Providers": {
"Mistral": {
"ApiKey": "YOUR_API_KEY",
"ApiUrl": "https://api.mistral.ai",
"Models": ["mistral-small-latest"]
}
},
"Session": {
"ContextTokenThreshold": 0.7,
"RetainedMessagesAfterCompacting": 5
},
"Channels": {
"Telegram": {
"BotToken": "YOUR_BOT_TOKEN",
"PollingTimeoutSeconds": 30,
"AllowedUserIds": []
}
}
}
```
## Dependencies
The configuration module depends on the following NuGet packages:
- Microsoft.Extensions.DependencyInjection.Abstractions
- Microsoft.Extensions.FileProviders.Embedded
- Microsoft.Extensions.Options
- Tomlyn (for parsing embedded TOML resources)