This example demonstrates how to build a GitHub issue materializer that transforms problem statements in GitHub issues into pull requests using AI-generated code.
- Provider-agnostic AI execution using metaagent (supports Gemini and Claude)
- GitHub issue-based reconciliation using metareconciler
- Composable tools using the toolcall provider pattern
- Automatic PR creation from AI-generated code changes
The materializer operates in two modes:
When processing a new issue, the agent:
- Analyzes the problem statement from the issue body
- Explores the codebase using
list_directoryandsearch_codebasetools - Reads relevant files to understand patterns and conventions
- Implements the solution using
write_fileanddelete_filetools - Returns a summary and conventional commit message
When a PR exists with CI failures (findings):
- The agent examines findings from the previous attempt
- Uses
get_finding_detailsto understand what went wrong - Makes targeted fixes to address the specific failures
- Preserves working parts of the previous implementation
The materializer uses composed metaagent tools:
- WorktreeTools:
read_file,write_file,delete_file,list_directory,search_codebase - FindingTools:
get_finding_details(for iteration on CI failures)
Tools are composed using the provider pattern:
type materializerTools = toolcall.FindingTools[toolcall.WorktreeTools[toolcall.EmptyTools]]
tools := toolcall.NewFindingToolsProvider[*Result, toolcall.WorktreeTools[toolcall.EmptyTools]](
toolcall.NewWorktreeToolsProvider[*Result, toolcall.EmptyTools](
toolcall.NewEmptyToolsProvider[*Result](),
),
)The service is configured via environment variables:
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 8080 |
OCTO_IDENTITY |
OctoSTS identity for GitHub authentication | (required) |
METRICS_PORT |
Prometheus metrics port | 2112 |
ENABLE_PPROF |
Enable pprof endpoints | false |
MATERIALIZER_MODEL |
AI model to use | gemini-2.5-flash |
MATERIALIZER_REGION |
GCP region for the model | us-central1 |
The reconciler integrates with the GitHub webhook system:
- GitHub sends issue events to the workqueue
- The reconciler receives issue URLs and fetches the issue
- Issues with the
{identity}/managedlabel are processed - The agent implements the solution and creates/updates a PR
- CI runs and findings are recorded for iteration
See cmd/reconciler/ for the complete implementation:
main.go- Server setup and configurationagent.go- Agent configuration with prompts and response typesreconciler.go- Reconciler construction using metareconciler