Welcome to MemoryKit! This guide will get you up and running in minutes.
- .NET 9.0 SDK (download)
- Visual Studio 2022, VS Code, or Rider
- Git
MemoryKit/
├── src/ # Source code
│ ├── MemoryKit.Domain/ # Core business logic
│ ├── MemoryKit.Application/ # Use cases & orchestration
│ ├── MemoryKit.Infrastructure/ # External services
│ └── MemoryKit.API/ # REST API
├── tests/ # Unit & integration tests
├── samples/ # Demo applications
├── docs/ # Documentation
└── MemoryKit.sln # Solution file
git clone https://github.com/antoniorapozo/memorykit.git
cd memorykitdotnet restore
dotnet builddotnet testcd src/MemoryKit.API
dotnet runThe API will be available at https://localhost:5001 with Swagger UI at https://localhost:5001/swagger.
MemoryKit uses a 4-layer memory hierarchy:
- Working Memory (L3): Recent context, sub-5ms retrieval
- Semantic Memory (L2): Facts and entities, ~30ms retrieval
- Episodic Memory (L1): Full conversation history, ~120ms retrieval
- Procedural Memory (P): Learned patterns and routines
Different queries use different layers:
- Continuation: "Continue..." → L3 only
- Fact Retrieval: "What was..." → L2+L3
- Deep Recall: "Quote exactly..." → L1+L2+L3
- Complex: "Compare X and Y..." → All layers
- Procedural: "Write code..." → L3+P
- Domain: Entities, interfaces, business rules
- Application: CQRS handlers, DTOs, validation
- Infrastructure: Azure services, LLM integration
- API: REST controllers, HTTP handling
In Domain/Entities/:
public class MyEntity : Entity<string>
{
public string Name { get; private set; }
public static MyEntity Create(string name)
{
return new MyEntity
{
Id = Guid.NewGuid().ToString(),
Name = name
};
}
}Create in Application/UseCases/{UseCaseName}/:
// Command/Query
public record MyCommand(string Data) : IRequest<MyResponse>;
// Handler
public class MyHandler : IRequestHandler<MyCommand, MyResponse>
{
public async Task<MyResponse> Handle(MyCommand request, CancellationToken ct)
{
// Implementation
}
}In API/Controllers/:
[HttpPost("endpoint")]
public async Task<IActionResult> MyEndpoint(
[FromBody] MyRequest request,
CancellationToken ct)
{
var command = new MyCommand(request.Data);
var result = await _mediator.Send(command, ct);
return Ok(result);
}- Use PascalCase for classes and methods
- Use camelCase for parameters and private fields
- Add XML documentation to public members
- Follow SOLID principles
- Write async code for I/O operations
- Use dependency injection for services
Example:
/// <summary>
/// Processes a command with optional timeout.
/// </summary>
/// <param name="command">The command to process</param>
/// <param name="timeout">Optional timeout in seconds</param>
/// <returns>The processing result</returns>
public async Task<Result> ProcessAsync(Command command, int? timeout = null)
{
// Implementation
}# All tests
dotnet test
# Specific project
dotnet test tests/MemoryKit.Domain.Tests
# With coverage
dotnet test /p:CollectCoverage=true
# Watch mode
dotnet test --watchUse xUnit and name tests descriptively:
[Fact]
public async Task RetrieveContext_WithValidQuery_ReturnsMemoryContext()
{
// Arrange
var query = "test query";
// Act
var result = await _service.RetrieveAsync(query);
// Assert
Assert.NotNull(result);
}- Set breakpoints
- Press F5 or Debug → Start Debugging
- Use Debug Console for inspection
- Install C# Dev Kit
- Create
.vscode/launch.json(comes with extension) - Press F5
Problem: Port 5001 already in use
dotnet run --urls "https://localhost:5002"Problem: NuGet package restore fails
dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org
dotnet restoreProblem: Build fails with SDK version
dotnet --version
# Update to .NET 9.0 if neededMemoryKit supports two storage providers:
No setup required.
{
"MemoryKit": {
"StorageProvider": "InMemory"
}
}Enterprise-grade persistent storage with automatic failover.
Required Resources:
- Azure Cache for Redis (Working Memory)
- Azure Storage Account (Semantic/Procedural/Episodic)
- Azure AI Search (Vector search)
Configuration:
{
"MemoryKit": {
"StorageProvider": "Azure",
"Azure": {
"RedisConnectionString": "${AZURE_REDIS_CONNECTION_STRING}",
"StorageConnectionString": "${AZURE_STORAGE_CONNECTION_STRING}",
"SearchEndpoint": "${AZURE_SEARCH_ENDPOINT}",
"SearchApiKey": "${AZURE_SEARCH_API_KEY}"
}
}
}See DEPLOYMENT.md for detailed Azure setup.
- ARCHITECTURE.md: Deep dive into system design
- API.md: REST API reference
- DEPLOYMENT.md: Azure deployment guide
- COGNITIVE_MODEL.md: Neuroscience inspiration
- Fork the repository
- Create feature branch:
git checkout -b feature/my-feature - Make changes and commit:
git commit -m "Add my feature" - Push:
git push origin feature/my-feature - Create Pull Request
See CONTRIBUTING.md for detailed guidelines.
- 📖 Check documentation in /docs
- 🐛 Report bugs on GitHub Issues
- 💬 Ask questions in Discussions
- 📧 Contact maintainers
MIT License - see LICENSE file
Ready to contribute? See CONTRIBUTING.md to get started! 🚀