-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture
gsd-orchestrator is structured around a deterministic 9-state workflow engine that drives all GitHub operations through a stdio-spawned MCP server, with Claude handling all natural language tasks (analysis, editing, PR authoring, review comments).
stateDiagram-v2
direction LR
[*] --> Idle
Idle --> Analyzing
Analyzing --> Branching
Branching --> Editing
Editing --> Validating
Validating --> Committing
Committing --> PrCreating
PrCreating --> Reviewing
Reviewing --> Documenting
Documenting --> [*]
-
Idle — Calls
get_repositoryandget_issuevia MCP; populates IssueContext with the issue title, body, labels, and default branch name. - Analyzing — Sends the issue body to Claude; retries up to 3 times on JSON parse failure; produces an AnalysisPlan containing the feature branch name, list of files to modify, and a change summary.
- Branching — Creates the feature branch from the default branch; idempotent — if the workflow was interrupted, resumes from the existing branch without re-creating it.
-
Editing — Runs a ReAct loop per file (max 20 turns per file); reads the current file content via MCP, sends it to Claude with the issue context, then commits the result via
create_or_update_file. -
Validating — Applies four safety gates: file safety blocklist (rejects changes to
.pem,.key, or CI workflow files), merge conflict pre-flight, diff size guard, and test coverage intent check. -
Committing — Calls
get_branchto confirm the final commit SHA is present in the branch; records the commit URL for the PR body. - PrCreating — Checks for an existing PR from the same branch (idempotent on retry); generates the PR title and body via Claude; opens the pull request.
-
Reviewing — Posts a bot review comment explaining what changed and why; requests reviewers from
GSD_REVIEWERSif the variable is configured. -
Documenting — Updates
docs/github-mcp-tools.mdandCHANGELOG.mdon the default branch; squash-merges the PR ifGSD_AUTO_MERGE=true. - Done / Failed — Terminal states. Done indicates the full workflow completed. Any state may transition to Failed on an unhandled exception.
flowchart LR
subgraph Orchestrator["GSD Orchestrator (.NET 10)"]
SM[GsdStateMachine]
MCP[McpStdioClient]
LLM[Anthropic.SDK]
CP[FileCheckpointStore]
end
subgraph GitHub["GitHub"]
MCPS[github-mcp-server.exe]
GHAPI[GitHub API]
end
subgraph Anthropic["Anthropic"]
CLAUDE[Claude API]
end
subgraph Storage["Local Storage"]
CKPT[.gsd/state/]
end
SM --> MCP
MCP -->|stdio| MCPS
MCPS --> GHAPI
SM --> LLM
LLM --> CLAUDE
SM --> CP
CP --> CKPT
The Data Flow through gsd-orchestrator takes a GitHub Issue as input and produces a reviewed pull request (and optionally an auto-merged squash commit) as output. The transformation proceeds as follows:
Input: A GitHub issue body and its labels — free-form natural language describing a code change, bug fix, or feature request.
Transformation:
- The Analyzing state extracts a structured change plan from the issue text: which files to touch and what to change in each.
- The Branching state isolates the work on a dedicated feature branch.
- The Editing state reads each target file and rewrites it through a Claude-powered ReAct loop, committing the result via MCP.
- The Validating state applies safety gates to prevent accidental secret exposure or unsafe file modifications.
- The PrCreating state opens a pull request with a Claude-generated description.
- The Reviewing state posts a bot review comment summarising the changes.
- The Documenting state records the MCP tools used and updates the changelog.
Output: A feature branch containing one or more commits, a pull request with a bot review comment, and optional auto-merge. If GSD_AUTO_MERGE=true, the PR is squash-merged after Documenting completes.