Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions examples/06-openclaw-pr-triage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 06 — PR & Issue Triage for High-Volume Repos

A TaskSpawner that automatically triages every PR and issue on a fast-moving
repo like [OpenClaw](https://github.com/openclaw/openclaw). Inspired by
[@steipete's problem](https://x.com/steipete/status/2023057089346580828):
hundreds of PRs per day, many duplicates, no way to keep up manually.

## What It Does

For every new PR or issue, an agent:

1. **De-duplicates** — searches all open PRs/issues for semantic overlap and
flags duplicates with links.
2. **Reviews quality** (PRs) — reads the diff and rates code quality, test
coverage, scope, and description.
3. **Checks vision alignment** — flags PRs that stray from the project's
core principles (open-source, privacy-first, self-hosted).
4. **Posts a triage comment** — a structured report with a clear
recommendation (MERGE / REVISE / CLOSE AS DUPLICATE / NEEDS MAINTAINER REVIEW).

## Resources

| File | Kind | Purpose |
|------|------|---------|
| `credentials-secret.yaml` | Secret | Claude OAuth token |
| `github-token-secret.yaml` | Secret | GitHub token for repo access and commenting |
| `workspace.yaml` | Workspace | Points to `openclaw/openclaw` |
| `taskspawner.yaml` | TaskSpawner | Polls PRs + issues, spawns triage agents |

## Steps

1. **Edit the secrets** — replace placeholders in both secret files.

2. **Apply:**

```bash
kubectl apply -f examples/06-openclaw-pr-triage/
```

3. **Watch it work:**

```bash
kubectl get taskspawners -w
kubectl get tasks -w
```

4. **Cleanup:**

```bash
kubectl delete -f examples/06-openclaw-pr-triage/
```

## Tuning

- `pollInterval: 3m` — how often to check for new PRs/issues.
- `maxConcurrency: 5` — how many triage agents run in parallel.
- `ttlSecondsAfterFinished: 600` — completed tasks are cleaned up after 10 min
so the spawner can re-process if new activity appears.
- Edit the vision statement in `promptTemplate` to match your project's values.
- Add `excludeLabels: ["triaged"]` to skip already-processed items.
8 changes: 8 additions & 0 deletions examples/06-openclaw-pr-triage/credentials-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: openclaw-claude-oauth
type: Opaque
stringData:
# TODO: Replace with your Claude OAuth token
CLAUDE_CODE_OAUTH_TOKEN: "REPLACE-ME"
9 changes: 9 additions & 0 deletions examples/06-openclaw-pr-triage/github-token-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: openclaw-github-token
type: Opaque
stringData:
# TODO: Replace with your GitHub token
# Required permissions: repo, pull_requests (read/write for comments)
GITHUB_TOKEN: "ghp_REPLACE-ME"
84 changes: 84 additions & 0 deletions examples/06-openclaw-pr-triage/taskspawner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
apiVersion: axon.io/v1alpha1
kind: TaskSpawner
metadata:
name: openclaw-pr-triage
spec:
when:
githubIssues:
types:
- pulls
- issues
state: open
taskTemplate:
type: claude-code
workspaceRef:
name: openclaw
credentials:
type: oauth
secretRef:
name: openclaw-claude-oauth
promptTemplate: |
You are a triage agent for the OpenClaw project (github.com/openclaw/openclaw).
Your job is to analyze the following {{.Kind}} and post a single triage comment using `gh`.

---
{{.Kind}} #{{.Number}}: {{.Title}}
{{.Body}}
{{if .Comments}}
Comments:
{{.Comments}}
{{end}}
---

## Your tasks

### 1. Duplicate detection
Search for other open PRs and issues that address the same thing:
- `gh pr list --state open --limit 100 --json number,title,body,labels`
- `gh issue list --state open --limit 100 --json number,title,body,labels`
Look for semantic overlap, not just title similarity. Two PRs that fix the
same bug in different ways are duplicates. Flag every duplicate you find with
its number and a one-line explanation of why they overlap.

### 2. Quality signals (PRs only)
If this is a pull request, evaluate:
- **Code quality**: Read the diff with `gh pr diff {{.Number}}`. Look for
correctness, test coverage, error handling, and style consistency.
- **Description quality**: Is the problem clearly stated? Is the approach explained?
- **Scope**: Is it a focused change or does it bundle unrelated modifications?
- **Test coverage**: Does it add or update tests for the changed behavior?
- **Breaking changes**: Does it modify public APIs or config formats?
Rate the PR: STRONG / ACCEPTABLE / NEEDS WORK / REJECT.

### 3. Vision alignment
OpenClaw's vision: a personal AI assistant that is open-source, privacy-first,
and runs on user-owned hardware. Any PR that undermines these principles
(e.g., adding telemetry, requiring a hosted service, removing self-host
capability) should be flagged as MISALIGNED with a clear explanation.

## Output
Post exactly one comment on this {{.Kind}} using:
`gh {{if eq .Kind "pull_request"}}pr{{else}}issue{{end}} comment {{.Number}} --body "..."`

Format the comment as:

```
## Axon Triage Report

**Duplicates found**: #X (reason), #Y (reason) — or "None found"

**Quality** (PRs only): STRONG / ACCEPTABLE / NEEDS WORK / REJECT
- Code: ...
- Tests: ...
- Scope: ...

**Vision alignment**: ALIGNED / MISALIGNED
- ...

**Recommendation**: MERGE / REVISE / CLOSE AS DUPLICATE / NEEDS MAINTAINER REVIEW
```

Do NOT open PRs, push code, or modify any files. Read-only analysis only.
ttlSecondsAfterFinished: 3600
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: TTL value inconsistent with README: the YAML sets 3600 (1 hour), but the README documents 600 (10 min) and explicitly says "completed tasks are cleaned up after 10 min". One of them needs to be updated to match the other.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At examples/06-openclaw-pr-triage/taskspawner.yaml, line 82:

<comment>TTL value inconsistent with README: the YAML sets `3600` (1 hour), but the README documents `600` (10 min) and explicitly says "completed tasks are cleaned up after 10 min". One of them needs to be updated to match the other.</comment>

<file context>
@@ -0,0 +1,84 @@
+      ```
+
+      Do NOT open PRs, push code, or modify any files. Read-only analysis only.
+    ttlSecondsAfterFinished: 3600
+  pollInterval: 3m
+  maxConcurrency: 5
</file context>
Fix with Cubic

pollInterval: 3m
maxConcurrency: 5
9 changes: 9 additions & 0 deletions examples/06-openclaw-pr-triage/workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: axon.io/v1alpha1
kind: Workspace
metadata:
name: openclaw
spec:
repo: https://github.com/openclaw/openclaw.git
ref: main
secretRef:
name: openclaw-github-token
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Ready-to-use patterns and YAML manifests for orchestrating AI agents with Axon.
| [03-taskspawner-github-issues](03-taskspawner-github-issues/) | Automatically create Tasks from labeled GitHub issues |
| [04-taskspawner-cron](04-taskspawner-cron/) | Run agent tasks on a cron schedule |
| [05-task-with-agentconfig](05-task-with-agentconfig/) | Inject reusable instructions and plugins via AgentConfig |
| [06-openclaw-pr-triage](06-openclaw-pr-triage/) | Triage PRs and issues at scale: de-dupe, review, vision-check |

## How to Use

Expand Down