183 lines
4.8 KiB
Plaintext
183 lines
4.8 KiB
Plaintext
# AI Agent Configuration for NT8 SDK
|
|
|
|
## Overview
|
|
This configuration ensures AI agents maintain .NET Framework 4.8 compatibility and follow established patterns when working on the NT8 SDK project.
|
|
|
|
## Required Reading
|
|
AI agents MUST review these documents before making any changes:
|
|
1. `AI_DEVELOPMENT_GUIDELINES.md` - Core compatibility requirements
|
|
2. `CODE_STYLE_GUIDE.md` - Required code patterns
|
|
3. `CODE_REVIEW_CHECKLIST.md` - Pre-commit verification
|
|
4. `NET_FRAMEWORK_CONVERSION.md` - Background on compatibility changes
|
|
|
|
## Project Constraints
|
|
|
|
### Hard Requirements (Non-Negotiable)
|
|
- **Framework**: .NET Framework 4.8 ONLY
|
|
- **Language**: C# 5.0 features ONLY
|
|
- **Architecture**: Risk-first design pattern
|
|
- **Testing**: MSTest framework ONLY
|
|
- **Build**: Must pass `.\verify-build.bat` with zero errors
|
|
|
|
### Forbidden Technologies
|
|
- .NET Core/.NET 5+/.NET 6+/.NET 9+
|
|
- C# 6+ language features (records, nullable refs, string interpolation)
|
|
- Microsoft.Extensions.* packages
|
|
- xUnit, NUnit (use MSTest only)
|
|
- Modern async patterns (use traditional async/await)
|
|
|
|
## Development Workflow
|
|
|
|
### Before Starting Any Task
|
|
1. Run `.\verify-build.bat` to confirm baseline
|
|
2. Review existing code patterns in the module you're working on
|
|
3. Check `AI_DEVELOPMENT_GUIDELINES.md` for specific requirements
|
|
|
|
### During Development
|
|
1. Follow patterns in `CODE_STYLE_GUIDE.md` exactly
|
|
2. Use only C# 5.0 compatible syntax
|
|
3. Maintain risk-first architecture
|
|
4. Add unit tests for new functionality
|
|
|
|
### Before Committing
|
|
1. Run `.\verify-build.bat` - MUST pass
|
|
2. Complete `CODE_REVIEW_CHECKLIST.md`
|
|
3. Verify no warnings in build output
|
|
4. Ensure tests have adequate coverage
|
|
|
|
## Common Patterns to Follow
|
|
|
|
### Class Creation
|
|
```csharp
|
|
// Always follow this pattern
|
|
public class NewClassName
|
|
{
|
|
private readonly ILogger _logger;
|
|
|
|
public Type PropertyName { get; set; }
|
|
|
|
public NewClassName(ILogger logger, Type parameter)
|
|
{
|
|
if (logger == null) throw new ArgumentNullException("logger");
|
|
_logger = logger;
|
|
PropertyName = parameter;
|
|
}
|
|
}
|
|
```
|
|
|
|
### Method Implementation
|
|
```csharp
|
|
public ReturnType MethodName(Type parameter)
|
|
{
|
|
if (parameter == null) throw new ArgumentNullException("parameter");
|
|
|
|
try
|
|
{
|
|
// Implementation using C# 5.0 syntax only
|
|
var result = ProcessParameter(parameter);
|
|
_logger.LogDebug("Method completed: {0}", result);
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError("Method failed: {0}", ex.Message);
|
|
throw;
|
|
}
|
|
}
|
|
```
|
|
|
|
## Testing Requirements
|
|
|
|
### Test Class Pattern
|
|
```csharp
|
|
[TestClass]
|
|
public class NewClassNameTests
|
|
{
|
|
private NewClassName _target;
|
|
private ILogger _logger;
|
|
|
|
[TestInitialize]
|
|
public void TestInitialize()
|
|
{
|
|
_logger = new BasicLogger("NewClassNameTests");
|
|
_target = new NewClassName(_logger, /* parameters */);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void MethodName_ValidInput_ShouldSucceed()
|
|
{
|
|
// Arrange, Act, Assert pattern
|
|
}
|
|
}
|
|
```
|
|
|
|
## Error Prevention
|
|
|
|
### Build Verification
|
|
Always run this before committing:
|
|
```bash
|
|
.\verify-build.bat
|
|
```
|
|
|
|
### Quick Syntax Check
|
|
Common mistakes to avoid:
|
|
- Using `record` instead of `class`
|
|
- Using `string?` instead of `string`
|
|
- Using `$"..."` instead of `String.Format()`
|
|
- Using `new Dictionary<>() { ["key"] = value }` instead of `.Add()`
|
|
|
|
## Integration Points
|
|
|
|
### Risk Management Integration
|
|
ALL trading logic must go through:
|
|
```csharp
|
|
var riskDecision = _riskManager.ValidateOrder(intent, context, config);
|
|
if (!riskDecision.Allow)
|
|
{
|
|
// Handle rejection
|
|
return;
|
|
}
|
|
```
|
|
|
|
### Logging Integration
|
|
Use the custom logging system:
|
|
```csharp
|
|
_logger.LogInformation("Operation completed: {0}", result);
|
|
_logger.LogError("Operation failed: {0}", error.Message);
|
|
```
|
|
|
|
## Phase 1 Specific Guidelines
|
|
|
|
### Current Focus Areas
|
|
- NT8 adapter implementations
|
|
- Market data integration
|
|
- Order execution system
|
|
- Enhanced risk controls (Tier 2 only)
|
|
|
|
### Do NOT Implement
|
|
- Features from Phases 2-6
|
|
- UI components
|
|
- Advanced analytics
|
|
- Performance optimizations (until specified)
|
|
|
|
## Quality Gates
|
|
|
|
Every commit must pass:
|
|
1. ✅ Compilation with zero errors
|
|
2. ✅ Zero build warnings
|
|
3. ✅ All tests passing
|
|
4. ✅ C# 5.0 syntax compliance
|
|
5. ✅ Architecture compliance
|
|
6. ✅ Code style compliance
|
|
|
|
Failure of any quality gate = automatic rejection.
|
|
|
|
## Support and Escalation
|
|
|
|
If you encounter:
|
|
- **Compatibility issues**: Review this configuration and guidelines
|
|
- **Architecture questions**: Check existing implementations for patterns
|
|
- **Build failures**: Run verification script and review error messages
|
|
- **Uncertainty**: Flag for human review rather than guessing
|
|
|
|
Remember: **Maintaining NT8 compatibility is the highest priority.** When in doubt, use simpler, more traditional approaches. |