Skip to content

Commit 1c8a1e6

Browse files
authored
Merge pull request #76 from ClaydeCode/clayde/issue-75-simplified-gh-workflow
Fix #75: Rework clayde GitHub integration
2 parents 290181a + f0d7364 commit 1c8a1e6

25 files changed

Lines changed: 910 additions & 3335 deletions

README.md

Lines changed: 24 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,28 @@ Clayde is a persistent autonomous AI software agent that lives on a dedicated VM
1212

1313
Clayde is assigned GitHub issues in software repositories. For each issue it:
1414

15-
1. Researches the codebase and writes a **preliminary plan**, posting it as a GitHub comment
16-
2. Waits for human approval (a 👍 reaction) before continuing
17-
3. For **large issues**: writes a **detailed implementation plan** and posts it as another comment, then waits for approval again before touching any code. For **small issues**: skips directly to implementation after preliminary approval.
18-
4. Implements the solution on a new branch, opens a pull request, and posts a summary comment
19-
5. Addresses any review comments left on the PR
15+
1. Checks for new whitelist-visible activity since its last access
16+
2. Invokes Claude with the full issue context — Claude decides what to do next: ask clarifying questions, post a plan, implement the solution, or address review comments
17+
3. Posts a summary comment after each work cycle
18+
4. Opens a pull request (Claude creates the PR directly with a description and, for diffs spanning more than 3 files, a recommended reading order) and assigns the issue author as reviewer
19+
5. Monitors the PR and addresses review comments when they appear
2020

21-
At any point while waiting for approval, new comments on the issue will trigger a plan update — Clayde revises the plan and posts a summary of what changed.
22-
23-
Clayde runs as a Docker container in a continuous loop (default: every 5 minutes), driven by a state machine persisted in `data/state.json`.
21+
Clayde runs as a Docker container in a continuous loop (default: every 5 minutes). Rather than a rigid state machine, it uses **timestamp-based activity detection**: each issue records the last time it was processed, and only new visible activity since that timestamp triggers a new Claude invocation.
2422

2523
---
2624

27-
## State Machine
28-
29-
Each issue moves through the following states:
30-
31-
```mermaid
32-
stateDiagram-v2
33-
[*] --> preliminary_planning
34-
preliminary_planning --> awaiting_preliminary_approval
35-
awaiting_preliminary_approval --> awaiting_preliminary_approval: new comment → plan updated
36-
awaiting_preliminary_approval --> planning: 👍 approved (large issue)
37-
awaiting_preliminary_approval --> implementing: 👍 approved (small issue)
38-
planning --> awaiting_plan_approval
39-
awaiting_plan_approval --> awaiting_plan_approval: new comment → plan updated
40-
awaiting_plan_approval --> implementing: 👍 approved
41-
implementing --> pr_open
42-
pr_open --> addressing_review: review comments received
43-
addressing_review --> pr_open
44-
pr_open --> done: PR approved
45-
implementing --> failed: error
46-
done --> [*]
47-
failed --> [*]
48-
```
25+
## How It Works
4926

50-
| State | Description |
51-
|---|---|
52-
| `preliminary_planning` | Claude explores the codebase and writes a short overview with clarifying questions |
53-
| `awaiting_preliminary_approval` | Preliminary plan posted; waiting for 👍 from an approver. New comments trigger a plan update. Small issues skip to `implementing` on approval; large issues proceed to `planning`. |
54-
| `planning` | Claude writes a detailed implementation plan |
55-
| `awaiting_plan_approval` | Full plan posted; waiting for 👍 from an approver. New comments trigger a plan update. |
56-
| `implementing` | Claude implements the solution on a new branch |
57-
| `pr_open` | PR opened; monitoring for review comments |
58-
| `addressing_review` | Claude is addressing PR review comments |
59-
| `done` | PR approved; issue complete |
60-
| `failed` | Error occurred; requires manual reset to retry |
61-
| `interrupted` | Claude hit a usage/rate limit; retried automatically next cycle |
27+
Clayde's loop is event-driven and stateless by design:
28+
29+
1. **Fetch assigned issues** from GitHub.
30+
2. **For each issue**: check whether there is new whitelist-visible activity (comments or PR reviews) since `last_seen_at`. If the issue has never been seen, or a previous run was interrupted, it is always processed.
31+
3. **Invoke Claude once** with the full context: issue body, all visible comments, and any open PR reviews. Claude decides the next action — no hard phases.
32+
4. **Detect PR**: after each run, check for an open PR on the working branch and persist its URL.
33+
5. **Update `last_seen_at`** to the current time so Clayde's own reply comments don't re-trigger a cycle.
34+
6. **Crash recovery**: `in_progress` is set before invoking Claude and cleared after. If the process crashes mid-run, the next cycle retries automatically.
35+
7. **Pure PR approvals** (no comments) update `last_seen_at` without invoking Claude.
36+
8. **Closed issues** are pruned from state automatically.
6237

6338
---
6439

@@ -70,10 +45,7 @@ Clayde uses **content filtering** rather than gatekeeping which issues to work o
7045
- If an issue has no visible content at all, it is skipped.
7146
- Blocked issues (those with "blocked by #N" or "depends on #N" in the body) are also skipped.
7247

73-
Two approval gates then guard forward progress:
74-
75-
1. **Preliminary plan approval** — a 👍 from a whitelisted user on the preliminary plan comment is required before the full plan is written.
76-
2. **Plan approval** — a 👍 from a whitelisted user on the full plan comment is required before implementation begins.
48+
There are no hard approval gates — Claude engages with the issue as soon as there is visible content, and the human can steer the conversation by replying in the issue thread.
7749

7850
Whitelisted users are configured via `CLAYDE_WHITELISTED_USERS` in `data/config.env`.
7951

@@ -82,11 +54,14 @@ Whitelisted users are configured via `CLAYDE_WHITELISTED_USERS` in `data/config.
8254
## Capabilities
8355

8456
- **Multi-repo support**: Clones and works on any GitHub repository it has access to
85-
- **Two-phase planning**: Preliminary exploration followed by a detailed plan, each gated by human approval
86-
- **Full issue lifecycle**: Plan → approval → implement → PR, with comments at each stage
57+
- **Event-driven loop**: Only invokes Claude when there is new visible activity — no wasted cycles
58+
- **Natural conversation**: Claude engages directly in the issue comment thread, asking questions and posting plans as needed
59+
- **Full issue lifecycle**: Engage → implement → PR → review, all driven by new activity
60+
- **PR creation by Claude**: Claude writes the PR description and a recommended reading order for larger diffs
8761
- **PR review handling**: Reads and addresses reviewer feedback automatically
8862
- **Rate-limit resilience**: Detects Claude usage limits and automatically retries
89-
- **Safety gates**: Whitelist + approval checks prevent unauthorized work
63+
- **Crash recovery**: `in_progress` flag ensures interrupted runs are retried next cycle
64+
- **Safety filtering**: Whitelist-based content filtering prevents acting on unauthorized content
9065
- **Observability**: OpenTelemetry tracing with JSONL file export
9166
- **Dual Claude backend**: Use the Anthropic API (pay-per-token) or the Claude Code CLI (subscription-based)
9267

0 commit comments

Comments
 (0)