Convert all AI services to use plugin-based structured output: - Create dedicated plugins for code intelligence, review, docs, issues, and workflows - Replace JSON parsing with SendForStructuredOutputAsync - Add PluginHelpers for consistent deserialization - Remove inline prompt instructions in favor of plugin definitions - Eliminate brittle JSON parsing and error handling - Improve type safety and maintainability across all AI features Affected services: CodeIntelligence, CodeReview, Documentation, Issue, Workflow inspection
GitCaddy AI Service
AI-powered code intelligence service for GitCaddy. Provides code review, documentation generation, issue triage, and agentic workflows.
Features
- Code Review: AI-powered pull request and commit reviews with security analysis
- Code Intelligence: Explain code, suggest fixes, summarize changes
- Issue Management: Auto-triage issues, suggest labels, generate responses
- Documentation: Generate docs for code, commit messages
- Agentic Workflows: Multi-step AI workflows for complex tasks
- Chat Interface: Interactive AI assistant for developers
Architecture
The AI service runs as a sidecar alongside the GitCaddy server. It exposes two gRPC services on the same port (HTTP/2 + HTTP/1.1):
- GitCaddyAIService - AI operations (review, triage, docs, chat) called by the server's AI client
- PluginService - Plugin lifecycle protocol (initialize, health, events) managed by the server's external plugin manager
┌──────────────────────────────────────────────────────────────────────┐
│ GitCaddy Server (Go) │
│ ├── AI Client (gRPC) ──────────────── GitCaddyAIService │
│ │ ReviewPullRequest, TriageIssue, │ │
│ │ ExplainCode, GenerateDocumentation │ │
│ │ │ │
│ └── External Plugin Manager (gRPC) ─── PluginService │
│ Initialize, HealthCheck (30s), │ │
│ OnEvent, Shutdown ▼ │
│ ┌──────────────────────────┐ │
│ │ GitCaddy AI (.NET 9) │ │
│ │ Port 5000 (h2c + HTTP) │ │
│ │ ├── AI Providers │ │
│ │ │ (Claude/OpenAI/ │ │
│ │ │ Gemini) │ │
│ │ └── License Validation │ │
│ └──────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘
Quick Start
Prerequisites
- .NET 9.0 SDK
- Docker (optional)
- API key for Claude, OpenAI, or Gemini
Development
# Clone the repository
git clone https://git.marketally.com/gitcaddy/gitcaddy-ai.git
cd gitcaddy-ai
# Set environment variables
export Providers__Claude__ApiKey="your-api-key"
# Run the service
cd src/GitCaddy.AI.Service
dotnet run
Docker
# Set environment variables
export CLAUDE_API_KEY="your-api-key"
export GITCADDY_AI_LICENSE="your-license-key"
# Run with Docker Compose
docker-compose up -d
Configuration
Configuration is done via appsettings.json or environment variables:
{
"AIService": {
"DefaultProvider": "Claude",
"DefaultModel": "claude-sonnet-4-20250514",
"MaxTokens": 4096,
"Temperature": 0.7
},
"Providers": {
"Claude": {
"ApiKey": "sk-ant-...",
"Enabled": true
},
"OpenAI": {
"ApiKey": "sk-...",
"Enabled": true
}
},
"License": {
"LicenseKey": "your-license-key"
}
}
Environment variable format: AIService__DefaultProvider=Claude
API Reference
The service exposes two gRPC services on port 5000 (cleartext HTTP/2):
AI Operations (protos/gitcaddy_ai.proto)
Code Review
rpc ReviewPullRequest(ReviewPullRequestRequest) returns (ReviewPullRequestResponse);
rpc ReviewCommit(ReviewCommitRequest) returns (ReviewCommitResponse);
Code Intelligence
rpc SummarizeChanges(SummarizeChangesRequest) returns (SummarizeChangesResponse);
rpc ExplainCode(ExplainCodeRequest) returns (ExplainCodeResponse);
rpc SuggestFix(SuggestFixRequest) returns (SuggestFixResponse);
Issue Management
rpc TriageIssue(TriageIssueRequest) returns (TriageIssueResponse);
rpc SuggestLabels(SuggestLabelsRequest) returns (SuggestLabelsResponse);
rpc GenerateIssueResponse(GenerateIssueResponseRequest) returns (GenerateIssueResponseResponse);
Documentation
rpc GenerateDocumentation(GenerateDocumentationRequest) returns (GenerateDocumentationResponse);
rpc GenerateCommitMessage(GenerateCommitMessageRequest) returns (GenerateCommitMessageResponse);
Workflows & Chat
rpc StartWorkflow(StartWorkflowRequest) returns (stream WorkflowEvent);
rpc ExecuteTask(ExecuteTaskRequest) returns (ExecuteTaskResponse);
rpc Chat(stream ChatRequest) returns (stream ChatResponse);
Plugin Protocol (protos/plugin.proto)
The plugin protocol allows the GitCaddy server to manage this service as an external plugin:
rpc Initialize(InitializeRequest) returns (InitializeResponse);
rpc Shutdown(ShutdownRequest) returns (ShutdownResponse);
rpc HealthCheck(PluginHealthCheckRequest) returns (PluginHealthCheckResponse);
rpc GetManifest(GetManifestRequest) returns (PluginManifest);
rpc OnEvent(PluginEvent) returns (EventResponse);
rpc HandleHTTP(HTTPRequest) returns (HTTPResponse);
The server calls Initialize on startup, HealthCheck every 30 seconds, OnEvent for subscribed events (e.g., license:updated), and Shutdown on server stop. The service declares its capabilities (routes, permissions, license tier) via the PluginManifest returned during initialization.
Client Libraries
.NET Client
using GitCaddy.AI.Client;
var client = new GitCaddyAIClient("http://localhost:5000");
var response = await client.ReviewPullRequestAsync(new ReviewPullRequestRequest
{
RepoId = 1,
PullRequestId = 42,
PrTitle = "Add feature X",
Files = { new FileDiff { Path = "src/foo.cs", Patch = "..." } }
});
Console.WriteLine(response.Summary);
Go Client
import ai "git.marketally.com/gitcaddy/gitcaddy-ai/go/gitcaddy-ai-client"
client, err := ai.NewClient("localhost:5000")
if err != nil {
log.Fatal(err)
}
defer client.Close()
resp, err := client.ReviewPullRequest(ctx, &pb.ReviewPullRequestRequest{
RepoId: 1,
PullRequestId: 42,
PrTitle: "Add feature X",
Files: []*pb.FileDiff{{Path: "src/foo.go", Patch: "..."}},
})
Licensing
GitCaddy AI is licensed under the Business Source License 1.1 (BSL-1.1).
License Tiers
| Tier | Features |
|---|---|
| Standard | Code review, code intelligence, documentation, chat |
| Professional | + Issue management, agentic workflows |
| Enterprise | + Custom models, audit logging, SSO integration |
Trial Mode
Without a license key, the service runs in trial mode with Standard tier features for 30 days.
Development
Building
dotnet build
Testing
dotnet test
Generating Proto Files
For Go client:
cd go/gitcaddy-ai-client
go generate
Integration with GitCaddy Server
Add both sections to the server's app.ini:
1. AI client configuration (how the server calls AI operations):
[ai]
ENABLED = true
SERVICE_URL = localhost:5000
DEFAULT_PROVIDER = claude
DEFAULT_MODEL = claude-sonnet-4-20250514
CLAUDE_API_KEY = sk-ant-...
See the server README for the full [ai] reference.
2. Plugin registration (how the server manages the sidecar's lifecycle):
[plugins]
ENABLED = true
HEALTH_CHECK_INTERVAL = 30s
[plugins.gitcaddy-ai]
ENABLED = true
ADDRESS = localhost:5000
HEALTH_TIMEOUT = 5s
SUBSCRIBED_EVENTS = license:updated
With both sections configured, the server will:
- Call AI operations (review, triage, etc.) via
[ai] SERVICE_URL - Manage the sidecar's lifecycle via the plugin protocol on
[plugins.gitcaddy-ai] ADDRESS - Health-check the sidecar every 30 seconds and log status changes
- Dispatch subscribed events (e.g., license updates) to the sidecar in real-time
Transport: All communication uses cleartext HTTP/2 (h2c). The sidecar's Kestrel server is configured for Http1AndHttp2 on port 5000, supporting both gRPC (HTTP/2) and REST (HTTP/1.1) on the same port.
Support
- Documentation: https://docs.gitcaddy.com/ai
- Issues: https://git.marketally.com/gitcaddy/gitcaddy-ai/issues
- Email: support@marketally.com
License
Copyright 2026 MarketAlly. All rights reserved.
Licensed under the Business Source License 1.1 (BSL-1.1).
Business Source License 1.1
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
"Business Source License" is a trademark of MariaDB Corporation Ab.
-----------------------------------------------------------------------------
Parameters
Licensor: MarketAlly LLC
Licensed Work: GitCaddy AI Service
The Licensed Work is (c) 2026 MarketAlly LLC
Additional Use Grant: You may make use of the Licensed Work, provided that
you do not use the Licensed Work for an AI Service.
An "AI Service" is a commercial offering that allows
third parties (other than your employees and contractors
acting on your behalf) to access the functionality of
the Licensed Work by means of AI-powered code
intelligence features.
Change Date: Four years from the date the Licensed Work is published.
Change License: MIT License
-----------------------------------------------------------------------------
Terms
The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production use of the Licensed Work. The
Licensor may make an Additional Use Grant, above, permitting limited
production use.
Effective on the Change Date, or the fourth anniversary of the first publicly
available distribution of a specific version of the Licensed Work under this
License, whichever comes first, the Licensor hereby grants you rights under
the terms of the Change License, and the rights granted in the paragraph
above terminate.
If your use of the Licensed Work does not comply with the requirements
currently in effect as described in this License, you must purchase a
commercial license from the Licensor, its affiliated entities, or authorized
resellers, or you must refrain from using the Licensed Work.
All copies of the original and modified Licensed Work, and derivative works
of the Licensed Work, are subject to this License. This License applies
separately for each version of the Licensed Work and the Change Date may vary
for each version of the Licensed Work released by Licensor.
You must conspicuously display this License on each original or modified copy
of the Licensed Work. If you receive the Licensed Work in original or
modified form from a third party, the terms and conditions set forth in this
License apply to your use of that work.
Any use of the Licensed Work in violation of this License will automatically
terminate your rights under this License for the current and all other
versions of the Licensed Work.
This License does not grant you any right in any trademark or logo of
Licensor or its affiliates (provided that you may use a trademark or logo of
Licensor as expressly required by this License).
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.
MarketAlly LLC hereby grants you permission to use this License's text to
license your works, and to refer to it using the trademark "Business Source
License", as long as you comply with the Covenants of Licensor below.
-----------------------------------------------------------------------------
Covenants of Licensor
In consideration of the right to use this License's text and the "Business
Source License" name and trademark, Licensor covenants to MariaDB, and to all
other recipients of the licensed work to be provided by Licensor:
1. To specify as the Change License the MIT License, or a license
that is no less permissive than the MIT License, as the Change License.
2. To either: (a) specify an Additional Use Grant that does not impose any
additional restriction on use of the Licensed Work beyond those set forth
in this License, or (b) insert the text "None" to indicate no Additional
Use Grant.
3. To specify a Change Date.
4. Not to modify this License in any other way.
-----------------------------------------------------------------------------
Notice
The Business Source License (this document, or the "License") is not an Open
Source license. However, the Licensed Work will eventually be made available
under an Open Source License, as stated in this License.