AI Gateway for OpenClaw-compatible protocol implementation.
SharpClaw is a sophisticated AI gateway project built on .NET 10 (preview) that implements an OpenClaw-compatible protocol for AI agent orchestration. The project features a modular design, comprehensive testing strategy, and security-conscious implementation.
- 37 source projects - Core functionality, protocols, execution providers
- 29 test projects - Unit, integration, and E2E tests
- Target Framework: .NET 10.0 (preview)
- Solution: Modern
.slnxformat with Central Package Management
- .NET 10 SDK (preview)
- Docker (for containerized execution)
- PostgreSQL (optional, SQLite available)
Copy appsettings.json and configure:
{
"Jwt": {
"SecretKey": "${JWT_SECRET_KEY}", // Min 32 characters
"Issuer": "SharpClaw",
"Audience": "SharpClawClients"
},
"RateLimiting": {
"TokenLimit": 1000,
"FeatureFlags": {
"UseNewRateLimiting": false // Toggle for migration
}
}
}dotnet build
dotnet run --project src/SharpClaw.Hostdocker-compose up -d # Requires POSTGRES_PASSWORD env var- JWT Authentication - HMAC-SHA256 signed tokens with key rotation
- Rate Limiting - Token bucket with backward compatibility
- Docker Security - Seccomp, AppArmor, capability dropping
- Security Headers - HSTS, CSP, X-Frame-Options
POST /api/runs- Execute codeGET /api/runs/{id}- Get run statusPOST /api/runs/{id}/events- Stream eventsGET /health- Health check
- Metrics - OpenTelemetry with custom business metrics
- Health Checks - Configurable endpoints
- Logging - Structured logging with correlation IDs
dotnet test --collect:"XPlat Code Coverage"Coverage threshold: 80%
See tests/SharpClaw.LoadTests/ for load testing scenarios.
Migrated from deprecated AspNetCoreRateLimit to System.Threading.RateLimiting:
- Feature flags control migration (
UseNewRateLimiting) - Backward compatible HTTP 429 responses
- Toggle via configuration
Replaced placeholder implementation with proper JWT:
- HMAC-SHA256 signing
- Key rotation support
- Proper claims structure
- Fork the repository
- Create a feature branch
- Run tests:
dotnet test - Ensure coverage > 80%
- Submit PR
MIT License - see LICENSE file