Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Replace hand-written Claude workflows with generated ones (tend) (#1676)
Maximilian Roos4817604b8178
diff --git a/.claude/skills/fix-ci/SKILL.md b/.claude/skills/fix-ci/SKILL.mddeleted file mode 100644index dc0985849..000000000--- a/.claude/skills/fix-ci/SKILL.md+++ /dev/null@@ -1,68 +0,0 @@-----name: fix-ci-description: Debug and fix failing CI on main. Use when CI or docs workflow fails on main branch.-argument-hint: "[run-id and context]"-metadata:- internal: true------# Fix CI on Main--CI has failed on the main branch. Diagnose the root cause, fix it, and create-a PR.--**Failed run:** $ARGUMENTS--## Workflow--### 1. Check for existing fixes--```bash-gh pr list --state open --label "automated-fix" --json number,title,headRefName-gh pr list --state open --head "fix/ci-" --json number,title,headRefName-```--If an existing PR addresses the same failure, comment on it linking the new run-and stop.--### 2. Diagnose and fix--1. Get failure logs: `gh run view <run-id> --log-failed`-2. Identify the failing job and root cause β don't just fix the symptom-3. Search for the same pattern elsewhere in the codebase-4. Reproduce locally using test commands from CLAUDE.md-5. Fix at the right level (shared helper > per-file fix)--### 3. Create PR--Re-check for existing fix PRs (one may have been created while you worked).--```bash-git checkout -b fix/ci-<run-id>-git add <files>-git commit -m "fix: <description>--Co-Authored-By: Claude <[email protected]>"-git push -u origin fix/ci-<run-id>-```--Create the PR with `gh pr create --label "automated-fix"`. PR body format:--```-## Problem-[What failed and the root cause]--## Solution-[What was fixed and why this is the right level]--## Testing-[How the fix was verified]------π€ Automated fix for [failed run](run-url)-```--### 4. Monitor CI--Poll CI using the approach from `/running-in-ci`. If CI fails, diagnose with-`gh run view <run-id> --log-failed`, fix, commit, push, and repeat.diff --git a/.claude/skills/nightly-cleaner/SKILL.md b/.claude/skills/nightly-cleaner/SKILL.mddeleted file mode 100644index 40854dbe6..000000000--- a/.claude/skills/nightly-cleaner/SKILL.md+++ /dev/null@@ -1,98 +0,0 @@-----name: nightly-cleaner-description: Nightly code quality sweep β resolves bot PR conflicts, reviews recent commits, surveys existing code, and closes resolved issues.-metadata:- internal: true------# Nightly Code Quality Sweep--Three phases: resolve conflicts on bot PRs, review recent commits, and survey-a slice of existing code/docs.--## Step 1: Resolve conflicts on bot PRs--```bash-gh pr list --author worktrunk-bot --json number,title,mergeable,headRefName \- --jq '.[] | select(.mergeable == "CONFLICTING")'-```--For each conflicted PR, dispatch a subagent to:--1. Check out the PR: `gh pr checkout <number>`-2. Merge main: `git merge origin/main`-3. Resolve conflicts (read files, understand both sides), `git add`,- `git commit --no-edit`-4. Push and poll CI using the approach from `/running-in-ci`-5. If conflicts are too complex, `git merge --abort` and comment explaining- manual resolution is needed--Run subagents in parallel. Each must work in isolation-(`git worktree add /tmp/pr-<number> <branch>`). After all complete, clean up-temp worktrees and `git checkout main`.--Skip if no PRs have conflicts.--## Step 2: Review recent commits--```bash-git log --since='24 hours ago' --oneline main-```--If no commits in the past 24 hours, skip to Step 4.--Get the aggregate diff:--```bash-OLDEST=$(git log --since='24 hours ago' --format='%H' main | tail -1)-git diff ${OLDEST}^..HEAD-git log --since='24 hours ago' --format='%h %s' main-```--Review for: bugs, inconsistencies with existing patterns, missing/outdated-documentation (does `--help` still match?), missing test coverage, dead code,-non-canonical patterns, CLAUDE.md/skill drift.--## Step 3: Check existing issues and close resolved ones--```bash-gh issue list --state open --json number,title-gh pr list --state open --json number,title,headRefName-```--For each open issue, check whether recent commits or the current codebase-state already resolve it. If resolved, comment briefly and close with-`gh issue close`. Skip partially unresolved issues.--## Step 4: Rolling survey--Run `.github/scripts/todays-survey-files.sh` for today's file list (~10 files).--For each file, look for: bugs, stale documentation, dead code, simplification-opportunities, missing tests, CLAUDE.md/skill drift. Spend roughly equal time-per file.--## Step 5: Report findings--Before creating issues, check for duplicates:--```bash-gh issue list --state open --label nightly-cleanup --json number,title-```--For each finding (from both recent-commit review and rolling survey):--1. **Create a GitHub issue** with label `nightly-cleanup` β clear actionable- title, include file location and suggested fix-2. **For confident fixes** (clear bugs, stale docs, obvious missing tests):- branch `nightly/clean-$GITHUB_RUN_ID`, fix, test- (`cargo run -- hook pre-merge --yes`), commit, push, create PR, poll CI.- **Every bug fix must include a regression test that would have failed before- the fix.** Write the test, verify it passes with the fix, and confirm it- targets the specific behavior that was broken. If a test is not feasible- (e.g., pure documentation changes), note why in the PR description.--## Step 6: Summary--Report: commits reviewed, files surveyed, findings, actions taken, assessment-(clean / minor issues / needs attention).diff --git a/.claude/skills/review-pr/SKILL.md b/.claude/skills/review-pr/SKILL.mddeleted file mode 100644index f51f57256..000000000--- a/.claude/skills/review-pr/SKILL.md+++ /dev/null@@ -1,423 +0,0 @@-----name: review-pr-description: Reviews a pull request for idiomatic Rust, project conventions, and code quality. Use when asked to review a PR or when running as an automated PR reviewer.-argument-hint: "[PR number]"-metadata:- internal: true------# Worktrunk PR Review--Review a pull request to worktrunk, a Rust CLI tool for managing git worktrees.--**PR to review:** $ARGUMENTS--## Workflow--Follow these steps in order.--### 1. Pre-flight checks--Before reading the diff, run cheap checks to avoid redundant work. Shell state-doesn't persist between tool calls β re-derive `REPO` in each bash invocation or-combine commands.--```bash-REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')-BOT_LOGIN=$(gh api user --jq '.login')-HEAD_SHA=$(gh pr view <number> --json commits --jq '.commits[-1].oid')-PR_AUTHOR=$(gh pr view <number> --json author --jq '.author.login')--# Find the bot's most recent substantive review (any state).-# Include reviews with a non-empty body OR approvals (LGTM uses --approve -b "").-# Uses "| length > 0" instead of "!= \"\"" to avoid bash ! history expansion.-# IMPORTANT: `gh pr view --json reviews` returns `.commit.oid` (NOT `.commit_id`).-# The REST API (`gh api .../reviews`) uses `.commit_id` β don't confuse the two.-LAST_REVIEW_SHA=$(gh pr view <number> --json reviews \- --jq "[.reviews[] | select(.author.login == \"$BOT_LOGIN\" and ((.body | length) > 0 or .state == \"APPROVED\"))] | last | .commit.oid // empty")-```--If `LAST_REVIEW_SHA == HEAD_SHA`, this commit has already been reviewed β exit-silently. The only exception: an unanswered conversation question directed at-the bot (check below).--If the bot reviewed a previous commit (`LAST_REVIEW_SHA` exists but differs from-`HEAD_SHA`), check the incremental changes:--```bash-REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')-gh api "repos/$REPO/compare/$LAST_REVIEW_SHA...$HEAD_SHA" \- --jq '{total: ([.files[] | .additions + .deletions] | add), files: [.files[] | "\(.filename)\t+\(.additions)/-\(.deletions)"]}'-```--If the incremental changes are trivial, skip the full review **and do not-submit a new approval** β the existing review stands. Go directly to step 7 to-resolve any bot threads addressed by the new changes, then exit. Do NOT proceed-to steps 2, 3, or 4. Rough heuristic: changes under ~20 added+deleted lines-that don't introduce new functions, types, or control flow are typically-trivial.--Then read all previous bot feedback and conversation:--```bash-REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')-BOT_LOGIN=$(gh api user --jq '.login')-# Previous review bodies-gh api "repos/$REPO/pulls/<number>/reviews" \- --jq ".[] | select(.user.login == \"$BOT_LOGIN\" and (.body | length > 0)) | {state, body}"-# Inline review comments-gh api "repos/$REPO/pulls/<number>/comments" --paginate \- --jq ".[] | select(.user.login == \"$BOT_LOGIN\") | {path, line, body}"-# Conversation (catch questions directed at the bot)-gh api "repos/$REPO/issues/<number>/comments" --paginate \- --jq '.[] | {author: .user.login, body: .body}'-```--**Do not repeat any point from previous reviews** β cross-reference previous bot-comments before posting inline comments. When concurrent runs race (a new push-while the first run is still responding), both see the same unanswered-question β check whether a bot reply exists after the question's timestamp-before answering. Address unanswered questions in the review body (not via-`gh pr comment`).--### 2. Check for overlapping PRs--Before reading the diff, scan other open PRs for file overlap.-If another PR touches the same files with a similar fix, flag it in the review-so one can be closed as a duplicate.--### 3. Read and understand the change--1. Read the PR diff with `gh pr diff <number>`.-2. Before going deeper, look at the PR as a reader would β not just the code,- but the shape: what files are being added/changed, and does anything look- off?-3. Read the changed files in full (not just the diff) to understand context.--### 4. Review--Scale depth to the change. A docs-only PR or a mechanical rename needs a skim-for correctness, not the full checklist. A new algorithm or state-management-change needs trace analysis. Don't over-analyze trivial changes.--**Idiomatic Rust and project conventions:**--- Does the code follow Rust idioms? (Iterator chains over manual loops, `?` over- match-on-error, proper use of Option/Result, etc.)-- Does it follow the project's conventions documented in CLAUDE.md? (Cmd for- shell commands, error handling with anyhow, accessor naming conventions, etc.)-- Are there unnecessary allocations, clones, or owned types where borrows would- suffice?--**Code quality:**--- Is the code clear and well-structured?-- Are there simpler ways to express the same logic?-- Does it avoid unnecessary complexity, feature flags, or compatibility layers?--**Correctness:**--- Are there edge cases that aren't handled?-- Could the changes break existing functionality?-- Are error messages helpful and consistent with the project style?-- Does new code use `.expect()` or `.unwrap()` in functions returning `Result`?- These should use `?` or `bail!` instead.-- **Trace failure paths, don't just note error handling exists.** For code that- modifies state through multiple fallible steps, walk through what happens when- each `?` fires. What has already been mutated? Is the system left in a- recoverable state? Describing the author's approach ("ordered for safety") is- not the same as verifying it.--**Testing:**--- Are the changes adequately tested?-- Do the tests follow the project's testing conventions (see tests/CLAUDE.md)?--**Documentation accuracy:**--When a PR changes behavior, check that related documentation still matches:--- Does `after_long_help` in `src/cli/mod.rs` and `src/cli/config.rs` still- describe what the code does? (These are the primary sources for doc pages.)-- Do inline TOML comments in config examples match the actual behavior?-- If a new feature was added, does the relevant help text mention it?--**Same pattern elsewhere:**--When a PR fixes a bug or changes a pattern, search for the same pattern in-other files. If found in the diff, add inline suggestions; if found outside the-diff, offer to push a fix commit.--**Duplication check (for new functions/types):**--For every new public or module-level function added in the diff, search the-codebase for existing functions that do the same thing. LLM-generated code-frequently reinvents internal APIs β this is the highest-value check for-externally contributed PRs.--Two search strategies, both required:--1. **Similar names and signatures.** Search for functions with similar names,- return types, or parameter types:-- ```bash- # For a new `detect_pr_provider` function, search for existing detection- rg "fn detect.*provider|fn get.*platform|fn .*_provider" --type rust- ```--2. **Overlapping subgoals.** Identify the intermediate steps the new code- performs (e.g., iterating remotes, parsing URLs, resolving an org name) and- search for existing code that does the same sub-tasks:-- ```bash- # New code iterates remotes and parses URLs β who else does that?- rg "all_remote_urls|remote_url|GitRemoteUrl::parse" --type rust- ```--Flag duplicates β reuse is almost always better than a parallel implementation.--### 5. Submit--**If there are no issues, approve with an empty body β silence means correct.**--```bash-gh pr review <number> --approve -b ""-```--If there are actionable findings, submit as a review with inline suggestions-for concrete fixes. Every comment must give the author something to act on:--| Don't post (internal analysis) | Post (actionable) |-|---|---|-| "The fix correctly delegates to `default_config_path()`" | "The error hints still reference `$XDG_CONFIG_HOME` but the code uses `etcetera` now" |-| "The threshold logic is correct" | _(nothing β silence means correct)_ |-| "Good use of `Iterator::scan` here" | "This `.collect::<Vec<_>>()` is only iterated once β can stay as an iterator" |--Don't explain what the code does β the author wrote it. Don't nitpick-formatting β that's what linters are for. Explain *why* something should-change, not just *what*.--**Form your own opinion independently.** Do not factor in other reviewers'-comments or approvals when deciding whether to approve β the value of this-review is as an uncorrelated signal.--**When confidence is low**, go beyond checking the implementation β question the-approach: "Does this bypass or duplicate an existing API?" "What does this-change *not* handle?" If the design involves a judgment call, flag it for human-review as a COMMENT.--**Self-authored PRs** (`PR_AUTHOR == BOT_LOGIN`): Still perform the full review-(steps 2β3) β self-review catches real issues (lint failures, edge cases) and is-intentionally valuable. Do NOT attempt-`gh pr review --approve` β GitHub rejects self-approvals. Submit as COMMENT-when there are concerns, or stay silent and skip to step 6. Always post CI-failure analysis as a COMMENT, even on self-authored PRs.--**Not confident enough to approve** (unfamiliar module, subtle logic): Add a-`+1` reaction instead β no review needed unless there are specific observations.--```bash-gh api "repos/$REPO/issues/<number>/reactions" -f content="+1"-```--#### Posting mechanics--Before posting, verify HEAD hasn't moved and no review was already posted for-this commit:--```bash-REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')-BOT_LOGIN=$(gh api user --jq '.login')-CURRENT_HEAD=$(gh pr view <number> --json commits --jq '.commits[-1].oid')-[ "$CURRENT_HEAD" != "$HEAD_SHA" ] && echo "HEAD moved β skipping" && exit 0--# NOTE: REST API uses .commit_id (not .commit.oid from gh pr view --json)-ALREADY_POSTED=$(gh api "repos/$REPO/pulls/<number>/reviews" \- --jq "[.[] | select(.user.login == \"$BOT_LOGIN\" and .commit_id == \"$HEAD_SHA\")] | last | .submitted_at // empty")-[ -n "$ALREADY_POSTED" ] && echo "Already reviewed β skipping" && exit 0-```--Post exactly one review per run. Always give a verdict: **approve** or-**comment** (never "request changes"). Use `gh pr review` for reviews, not-`gh pr comment`. Note: `--comment` requires a non-empty body β if there's-nothing to say, use the approve-with-empty-body pattern.--**Inline suggestions are mandatory for concrete fixes.** Whenever there's a-concrete fix (typos, doc updates, naming, missing imports, minor refactors),-post it as an inline suggestion on the exact line β never as a code block in the-review body. Inline suggestions let the author apply with one click; code blocks-force them to find the line and copy-paste manually.--For fixes targeting lines outside the diff, offer to push a fix commit instead.--Post inline suggestions via the review API:--`````bash-cat > /tmp/review-body.md << 'EOF'-Summary of suggestions-EOF--cat > /tmp/review-payload.json << 'ENDJSON'-{- "event": "COMMENT",- "comments": [- {- "path": ".claude/skills/example/SKILL.md",- "line": 3,- "body": "```suggestion\ndescription: new text here\n```"- }- ]-}-ENDJSON--BODY=$(cat /tmp/review-body.md)-jq --arg body "$BODY" '.body = $body' /tmp/review-payload.json > /tmp/review-final.json--gh api "repos/$REPO/pulls/<number>/reviews" \- --method POST \- --input /tmp/review-final.json-`````--**Do not** use `-f 'comments[0][path]=...'` flag syntax β `gh api` converts-array indices to object keys, which GitHub rejects.--- If a review has both suggestions and prose observations, put the suggestions- as inline comments and the prose in the review body.-- Multi-line suggestions: set `start_line` and `line` to define the range.- GitHub **replaces** every line in that range with the suggestion content β any- line in the range that isn't reproduced in the replacement is **deleted**.-- **Before posting any multi-line suggestion, verify it:**-- 1. **Read the exact lines** `start_line` through `line` from the diff hunk.- 2. **Diff mentally**: every line in that range must either appear (possibly- modified) in the replacement text, or be a line you intend to delete. If- any line would be silently dropped, **shrink the range** or include the- line in the replacement.- 3. **Cap the range at ~10 lines.** Larger suggestions are error-prone and hard- to review. For changes spanning more than 10 lines, split into multiple- suggestions or push a fix commit instead.- 4. **Never span markdown fences.** If the range includes a `` ``` `` line,- GitHub's suggestion parser may consume it as a delimiter, corrupting the- result. Either shrink the range to avoid the fence or push a commit.--### 6. Monitor CI--After approving or staying silent, monitor CI using the approach from-/running-in-ci.--- **All required checks passed** β done.-- **A check failed** and it's related to the PR β post a follow-up COMMENT- review with analysis and inline suggestions, then dismiss the bot's approval:- ```bash- # Use PUT, not POST β the dismiss endpoint requires it- gh api "repos/$REPO/pulls/<number>/reviews/$REVIEW_ID/dismissals" \- -X PUT -f message="CI failed β <reason>"- ```- Skip if already dismissed. **Do not push fixes on human-authored PRs** β post- the analysis and offer to fix, then wait for the author to accept.-- **A check failed** and it's a transient flake (unrelated to the PR changes) β- 1. **Re-run the failed jobs** on any PR (bot or human-authored):- ```bash- gh run rerun <run-id> --failed- ```- 2. **Report the flake to the tracking issue.** Search for an open issue about- the specific flaky test (`gh issue list --search "<test name>" --state open`).- If found, check for a recent bot comment. Edit the existing comment to- append the new instance (PR number, platform, error snippet, run link)- rather than posting a new one β this keeps the issue tidy. If no recent bot- comment exists, add one. If no issue exists, open one.- ```bash- # Find the bot's last comment on the issue- LAST_COMMENT=$(gh issue view <issue-number> --json comments \- --jq '[.comments[] | select(.author.login == "worktrunk-bot")] | last | {id: .url, createdAt: .createdAt}')- # If the bot commented recently, edit that comment; otherwise post a new one- ```- Skip if the bot already commented today and the comment includes this PR.--### 7. Resolve handled suggestions--After submitting the review, check if any unresolved bot threads have been-addressed by the new changes. Resolve threads where the suggestion was applied.--**Only resolve if the substance was addressed.** Read both the suggestion and the-new code β if the author took a different approach, verify its technical accuracy-before resolving. "Different wording" is not "addressed" when the new wording is-less accurate than the suggestion. When in doubt, leave the thread open for a-human reviewer.--**Self-authored PRs are especially risky.** When the bot is both author and-reviewer, there is a bias toward accepting the code's own claims. Treat-self-authored thread resolution with extra skepticism β read the code and verify-the claim independently rather than trusting the doc comment or commit message.--```bash-cat > /tmp/review-threads.graphql << 'GRAPHQL'-query($owner: String!, $repo: String!, $number: Int!) {- repository(owner: $owner, name: $repo) {- pullRequest(number: $number) {- reviewThreads(first: 100) {- nodes {- id- isResolved- comments(first: 1) {- nodes {- author { login }- path- line- body- }- }- }- }- }- }-}-GRAPHQL--REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')-BOT_LOGIN=$(gh api user --jq '.login')-OWNER=$(echo "$REPO" | cut -d/ -f1)-NAME=$(echo "$REPO" | cut -d/ -f2)--gh api graphql -F query=@/tmp/review-threads.graphql \- -f owner="$OWNER" -f repo="$NAME" -F number=<number> \- | jq --arg bot "$BOT_LOGIN" '- .data.repository.pullRequest.reviewThreads.nodes[]- | select(.isResolved == false)- | select(.comments.nodes[0].author.login == $bot)- | {id, path: .comments.nodes[0].path, line: .comments.nodes[0].line, body: .comments.nodes[0].body}'--# Resolve a thread that has been addressed-cat > /tmp/resolve-thread.graphql << 'GRAPHQL'-mutation($threadId: ID!) {- resolveReviewThread(input: {threadId: $threadId}) {- thread { id }- }-}-GRAPHQL--gh api graphql -F query=@/tmp/resolve-thread.graphql -f threadId="THREAD_ID"-```--Outdated comments (null line) are best-effort β skip if the original context-can't be located.--### 8. Push mechanical fixes--**Bot PRs** (Dependabot, renovate, etc.): If the review found concrete, fixable-issues and there's no human author to act on feedback, commit and push the fix-directly to the PR branch.--**Human PRs**: Post inline suggestions first. Additionally, offer to push a-commit when the fixes are mechanical and correctness is obvious. Only push-after the author accepts.--```bash-gh pr checkout <number>-git add <files>-git commit -m "fix: <description>--Co-Authored-By: Claude <[email protected]>"-git push-```diff --git a/.claude/skills/review-reviewers/SKILL.md b/.claude/skills/review-reviewers/SKILL.mddeleted file mode 100644index ae4e4f234..000000000--- a/.claude/skills/review-reviewers/SKILL.md+++ /dev/null@@ -1,244 +0,0 @@-----name: review-reviewers-description: Hourly analysis of Claude CI session logs β identifies behavioral problems, skill gaps, and workflow issues.-metadata:- internal: true------# Review Reviewers--Analyze Claude-powered CI runs from the past hour. Identify behavioral problems,-skill gaps, and workflow issues β then create PRs or issues to fix them.--## Confidence and magnitude gates--Before creating a PR, every finding must pass two gates.--### Gate 1: Confidence β is this a real problem?--Rate each finding on the evidence scale:--| Evidence level | Meaning | Minimum occurrences to act |-|---|---|---|-| **Critical** | Clearly wrong outcome (closed wrong issue, merged broken code, deleted user data) | 1 |-| **High** | Consistent pattern across multiple sessions | 2β3 |-| **Medium** | Plausible problem seen once, could be noise | 5+ |-| **Low** | Nitpick or stylistic preference | Do not act |--Occurrences include both the current hour's sessions **and** historical evidence-from the tracking issue (see [Evidence accumulation](#evidence-accumulation)).--If a finding doesn't meet the threshold, **skip it** β don't create a PR, don't-create an issue, don't comment. Record it in the tracking issue so it can-accumulate evidence over future runs.--### Gate 2: Magnitude β is the fix proportionate?--Rate the proposed change:--| Change type | Examples | Evidence bar |-|---|---|---|-| **Removal / simplification** | Remove confusing sentence, delete dead guidance | Low (1 occurrence is enough) |-| **Targeted fix** | Fix a specific incorrect instruction, add a missing step | Normal (use Gate 1 thresholds) |-| **New paragraph or section** | Add explanation of a concept, new workflow guidance | High (need 3+ occurrences showing the gap) |-| **Structural change** | Reorganize a skill, add a new skill file, change workflow | Very high (need 5+ occurrences or a critical failure) |--**The larger the change, the more evidence required.** A one-line simplification-needs less justification than a new paragraph. Prefer small, targeted fixes over-broad rewrites.--### Applying the gates--For each finding, state:-1. The evidence level and occurrence count (current hour + historical)-2. The proposed change type-3. Whether it passes both gates--Only proceed to Step 5 for findings that pass both gates.--## Evidence accumulation--Each run only sees the past hour of CI sessions, but patterns may emerge over-days or weeks. Use a **monthly tracking issue** to accumulate evidence across-runs.--### Finding or creating the tracking issue--```bash-# Look for this month's tracking issue-MONTH=$(date +%Y-%m)-gh issue list --state open --label review-reviewers-tracking \- --json number,title --jq ".[] | select(.title | contains(\"$MONTH\"))"-```--If none exists for the current month, create one:--```bash-cat > /tmp/tracking-body.md << 'EOF'-Monthly tracking issue for review-reviewers findings that haven't yet met-the confidence threshold. Each run appends below-threshold findings as a-comment. Future runs read these to build cumulative evidence.--**Do not close manually** β a new issue is created each month.-EOF-gh issue create \- --title "review-reviewers tracking: $MONTH" \- --label review-reviewers-tracking \- -F /tmp/tracking-body.md-```--### Reading historical evidence--Before applying the gates, read the current tracking issue's comments to find-prior observations that overlap with this hour's findings:--```bash-TRACKING_NUMBER=<number from above>-gh issue view "$TRACKING_NUMBER" --json comments \- --jq '.comments[] | {author: .author.login, body: .body}'-```--Also check last month's tracking issue (if it exists) for recent carry-over.--When a historical entry looks like it might match a current finding, **download-and investigate the linked workflow's session logs** β don't rely on the summary-text alone, which lacks sufficient context to judge relatedness:--```bash-# Each tracking entry has a Run ID β use it to pull the actual logs-gh run download <run-id> --name claude-session-logs --dir /tmp/logs/<run-id>/-```--Trace the original decision chain in the session JSONL to confirm the historical-case is genuinely the same pattern, not just superficially similar. This is-laborious but necessary for accurate evidence counts.--Add confirmed matching historical occurrences to your tally when evaluating-gates.--### Recording below-threshold findings--After analysis, find **the bot's existing comment** on the tracking issue and-**append** new findings to it. If no bot comment exists yet, create one. This-avoids notification spam from hourly runs.--```bash-# Find existing bot comment on the tracking issue-REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')-BOT_LOGIN=$(gh api user --jq '.login')-EXISTING_COMMENT=$(gh api "repos/$REPO/issues/$TRACKING_NUMBER/comments" \- --jq "[.[] | select(.user.login == \"$BOT_LOGIN\")] | last | .id // empty")-```--If `EXISTING_COMMENT` is non-empty, download existing body, append new findings,-then PATCH. Never replace the body β prior entries contain per-run evidence-needed for gate evaluation.--```bash-gh api "repos/$REPO/issues/comments/$EXISTING_COMMENT" --jq '.body' > /tmp/existing.md-cat /tmp/existing.md /tmp/findings.md > /tmp/combined.md-gh api "repos/$REPO/issues/comments/$EXISTING_COMMENT" -X PATCH -F body=@/tmp/combined.md-```--Otherwise create a new comment.--Format each finding under a `## Run <run-id>` heading:--```-## Run <run-id> β <ISO timestamp>--### <short description>-- **Evidence level**: Medium-- **Occurrences this run**: 1-- **Run ID**: <run-id>-- **Workflow**: https://github.com/{owner}/{repo}/actions/runs/<run-id>-- **Session**: <session file>-- **Detail**: <brief description of what was observed>-```--Each run gets its own heading so future runs can count prior occurrences and-trace incidents to session logs.--## Step 1: Find recent runs--Run `.github/scripts/list-recent-runs.sh` for recently completed Claude CI runs.-If empty, report "no runs to review" and exit.--Include `claude-hourly-review-reviewers` runs β self-analysis is intentional so-we can catch bugs in the reviewer itself.--## Step 2: Download and analyze session logs--```bash-gh run download <run-id> --name claude-session-logs --dir /tmp/logs/<run-id>/-```--Skip runs without artifacts. Find JSONL files under `/tmp/logs/` and extract:--```bash-# Tool calls-jq -c 'select(.type == "assistant") | .message.content[]? |- select(.type == "tool_use") | {tool: .name, input: .input}' < file.jsonl--# Assistant reasoning-jq -r 'select(.type == "assistant") | .message.content[]? |- select(.type == "text") | .text' < file.jsonl-```--Trace decision chains: what did Claude decide, what evidence did it use, what-was the outcome?--## Step 3: Cross-check review sessions--For `claude-review` runs, compare what the bot said against what happened next:--```bash-HEAD_BRANCH=$(gh run view <run-id> --json headBranch --jq '.headBranch')-PR_NUMBER=$(gh pr list --head "$HEAD_BRANCH" --state all --json number --jq '.[0].number')-```--Check for subsequent commits that undid something the bot approved (gap in-review), and human review comments flagging issues the bot missed. Pull in the-full PR context β not just changes from the past hour.--CI polling time (including codecov timeouts on docs-only or test-only PRs) is-expected and acceptable β do not flag it. Wasted polling is a very low-priority-concern that does not warrant skill changes or PRs.--## Step 4: Deduplicate--Before creating issues or PRs, check exhaustively for existing ones:--```bash-gh issue list --state open --label claude-behavior --json number,title,body-gh issue list --state open --json number,title,body # also check unlabeled issues-gh pr list --state open --json number,title,headRefName,body-gh issue list --state closed --label claude-behavior --json number,title,closedAt --limit 30-```--Search titles AND bodies for related keywords. Only comment on existing issues-if you have material new cases that would change the approach or increase-prioritization. Do not comment with progress updates, fix-PR status, or-re-statements of evidence already in the issue.--## Step 5: Act on findings--**Prefer PRs over issues.** A PR with a clear description is immediately-actionable.--- **PR** (default): Branch `hourly/review-$GITHUB_RUN_ID`, fix, commit, push,- create with label `claude-behavior`. Put full analysis in PR description (run- ID, log excerpts, root cause, **gate assessment** including historical- evidence count). Don't also create a separate issue.-- **Issue** (fallback): Only for problems too large or ambiguous to fix- directly. Include run ID, log excerpts, root cause analysis.--Group multiple findings by broad theme. **Limit to at most 2 PRs per run** β-if you have more findings, pick the highest-confidence ones and note the rest-in the tracking issue.--## Step 6: Summary--If no problems found (or none passed the gates), report "all clear" with: runs-analyzed, sessions reviewed, brief quality assessment, and any below-threshold-findings recorded in the tracking issue.diff --git a/.claude/skills/running-in-ci/SKILL.md b/.claude/skills/running-in-ci/SKILL.mddeleted file mode 100644index dd1110a23..000000000--- a/.claude/skills/running-in-ci/SKILL.md+++ /dev/null@@ -1,295 +0,0 @@-----name: running-in-ci-description: CI environment rules for GitHub Actions workflows. Use when operating in CI β covers security, CI monitoring, comment formatting, and investigating session logs from other runs.-metadata:- internal: true------# Running in CI--## First Steps β Read Context--When triggered by a comment or issue, read the full context before responding.-The prompt provides a URL β extract the PR/issue number from it.--For PRs:--```bash-gh pr view <number> --json title,body,comments,reviews,state,statusCheckRollup-gh pr diff <number>-gh pr checks <number>-```--For issues:--```bash-gh issue view <number> --json title,body,comments,state-```--Read the triggering comment, the PR/issue description, the diff (for PRs), and-recent comments to understand the full conversation before taking action.--## Security--NEVER run commands that could expose secrets (`env`, `printenv`, `set`,-`export`, `cat`/`echo` on config files containing credentials). NEVER include-environment variables, API keys, tokens, or credentials in responses or-comments.--## PR Creation--When asked to create a PR, use `gh pr create` directly.--Before creating a branch or PR, check for existing work:--```bash-gh pr list --state open --json number,title,headRefName --jq '.[] | "#\(.number) [\(.headRefName)]: \(.title)"'-git branch -r --list 'origin/fix/*'-```--If an existing PR addresses the same problem, work on that PR instead.--## Pushing to PR Branches--Always use `git push` without specifying a remote β `gh pr checkout` configures-tracking to the correct remote, including for fork PRs. Specifying `origin`-explicitly can push to the wrong place.--If pushing fails (fork PR with edits disabled), fall back to posting code-snippets in a comment. Don't reference commit SHAs from temporary branches β-post code inline.--## CI Monitoring--After pushing, wait for CI before reporting completion.--**Use `run_in_background: true`** for the polling loop so it does not block the-session. When the background task completes you will be notified β check the-result and take any follow-up action (dismiss approval, post analysis) at that-point.--```bash-# Run with Bash tool's run_in_background: true-for i in $(seq 1 10); do- sleep 60- if ! gh pr checks <number> --required 2>&1 | grep -q 'pending\|queued\|in_progress'; then- gh pr checks <number> --required- exit 0- fi-done-echo "CI still running after 10 minutes"-exit 1-```--1. Poll `gh pr checks <number> --required` every 60 seconds until all required- checks complete (up to ~10 minutes). Ignore non-required checks (benchmarks).-2. If a required check fails, diagnose with `gh run view <run-id> --log-failed`,- fix, commit, push, repeat.-3. After required checks pass, poll `codecov/patch` separately β it is- mandatory despite being marked non-required. Use a polling loop (up to- ~5 minutes) since codecov often reports after the required checks finish:- ```bash- for i in $(seq 1 5); do- CODECOV=$(gh pr checks <number> 2>&1 | grep 'codecov/patch' || true)- if echo "$CODECOV" | grep -q 'pass'; then- echo "codecov/patch passed"; exit 0- elif echo "$CODECOV" | grep -q 'fail'; then- echo "codecov/patch FAILED"; exit 1- fi- sleep 60- done- echo "codecov/patch not reported after 5 minutes"- exit 1- ```- If it fails, investigate with `task coverage` and- `cargo llvm-cov report --show-missing-lines | grep <file>`.-4. Report completion only after all required checks **and** `codecov/patch` pass.--Never report "done" before CI passes β CI runs on Linux, Windows, and macOS.-Avoid `gh run watch` and `gh pr checks --watch` β both can hang indefinitely.--Before dismissing local test failures as "pre-existing", check main branch CI:--```bash-gh api "repos/{owner}/{repo}/actions/runs?branch=main&status=completed&per_page=3" \- --jq '.workflow_runs[] | {conclusion, created_at: .created_at}'-```--If you cannot verify, say "I haven't confirmed whether these failures are-pre-existing."--## Applying GitHub Suggestions--Apply the literal suggestion only β change the lines it covers, nothing more.-If surrounding lines also need updating, note that in your reply.--## Replying to Comments--Reply in context rather than creating new top-level comments:--- **Inline review comments** (`#discussion_r`): To read a single review- comment, use the comment ID **without** the PR number in the path:- ```bash- gh api repos/{owner}/{repo}/pulls/comments/{comment_id}- ```- To reply:- ```bash- cat > /tmp/reply.md << 'EOF'- Your response here- EOF- gh api repos/{owner}/{repo}/pulls/{number}/comments/{comment_id}/replies \- -F body=@/tmp/reply.md- ```--- **Conversation comments** (`#issuecomment-`): Post a regular comment (GitHub- doesn't support threading).--## Comment Formatting--Keep comments concise. Put supporting detail inside `<details>` tags β the-reader should get the gist without expanding. Don't collapse content that *is*-the answer (e.g., a requested analysis).--```-<details><summary>Detailed findings (6 files)</summary>--...details here...--</details>-```--Always use markdown links for files, issues, PRs, and docs. Prefer permalinks-(commit SHA URLs) over branch-based links for line references β line numbers-shift and `blob/main/...#L42` links go stale.--- **Files**: link to GitHub (`blob/main/...` for file-level,- `blob/<sha>/...#L42` for lines)-- **Issues/PRs**: `#123` shorthand-- **External**: `[text](url)` format--Don't add job links or footers β `claude-code-action` adds these automatically.--## Shell Quoting--Shell expansion corrupts `$` and `!` in arguments (bash history expansion-mangles `!` in double-quoted strings). Always use a temp file for comment bodies-and shell-sensitive arguments:--```bash-# Comments β ALWAYS use a file-cat > /tmp/comment.md << 'EOF'-Fixed β the `format!` macro needed its arguments on separate lines.-EOF-gh pr comment 1286 -F /tmp/comment.md--# Review replies β ALWAYS use a file-cat > /tmp/reply.md << 'EOF'-Good catch! Updated to use `assert_eq!` instead.-EOF-gh api repos/{owner}/{repo}/pulls/{number}/comments/{id}/replies \- -F body=@/tmp/reply.md--# GraphQL β write query to a file-cat > /tmp/query.graphql << 'GRAPHQL'-query($owner: String!, $repo: String!) { ... }-GRAPHQL-gh api graphql -F query=@/tmp/query.graphql -f owner="$OWNER"--# jq with ! β use a file-cat > /tmp/jq_filter << 'EOF'-select(.status != "COMPLETED")-EOF-gh api ... --jq "$(cat /tmp/jq_filter)"-```--Use `<< 'EOF'` (single-quoted delimiter) to prevent expansion. For file-based-bodies: `gh pr comment` uses `-F /tmp/file` (path directly), while `gh api`-uses `-F body=@/tmp/file` (field assignment with `@` prefix).--## Keeping PR Titles and Descriptions Current--When revising code after review feedback, update the title and description if-the approach changed:--```bash-gh api repos/{owner}/{repo}/pulls/{number} -X PATCH \- -f title="new title" -F body=@/tmp/updated-body.md-```--## Atomic PRs--Split unrelated changes into separate PRs β one concern per PR. If one change-could be reverted without affecting the other, they belong in separate PRs.--## Investigating Other CI Runs--The primary evidence for diagnosing bot behavior is the session log artifact β-not console output (`show_full_output` defaults to `false`).--```bash-gh run download <run-id> -n claude-session-logs -D /tmp/session-logs-<run-id>-```--The artifact contains JSONL files (path like-`-home-runner-work-worktrunk-worktrunk/<session-id>.jsonl`). Each line has a-`type` field (`user`, `assistant`, `system`).--```bash-# Skills loaded-jq -r 'select(.type == "assistant") | .message.content[]? |- select(.type == "tool_use" and .name == "Skill") | .input.skill' <FILE>.jsonl--# Tool calls-jq -r 'select(.type == "assistant") | .message.content[]? |- select(.type == "tool_use") |- "\(.name): \(.input | tostring | .[0:100])"' <FILE>.jsonl--# Assistant reasoning-jq -r 'select(.type == "assistant") | .message.content[]? |- select(.type == "text") | .text' <FILE>.jsonl-```--Find the right run among multiple workflows:--```bash-gh api 'repos/{owner}/{repo}/actions/runs?per_page=30' \- --jq '.workflow_runs[] | select(.name | startswith("claude-")) |- {id, name, event, head_branch, created_at, conclusion}'-```--Check for artifacts before downloading:--```bash-gh api repos/{owner}/{repo}/actions/runs/<run-id>/artifacts \- --jq '.artifacts[] | {name, size_in_bytes}'-```--Review-response runs triggered by `pull_request_review` or-`pull_request_review_comment` events sometimes produce no artifact when the-session is very short.--## Grounded Analysis--CI runs are not interactive β every claim must be grounded in evidence. The user-can't ask follow-up questions; treat every response as your final answer.--Read logs, code, and API data before drawing conclusions. Show evidence: cite-log lines, file paths, commit SHAs. Trace causation β if two things co-occur,-find the mechanism rather than saying "this may be related." Never claim a-failure is "pre-existing" without checking main branch CI history. Distinguish-what you verified from what you inferred.--## Tone--Raise observations, don't assign work. Never create checklists or task lists-for the PR author.--## PR Review Comments--For review comments on specific lines (`[Comment on path:line]`), read that file-and examine the code at that line before answering.--When the GitHub API returns a `diff_hunk`, the reviewer's comment targets the-**last line** of that hunk. Use this to disambiguate when multiple candidates-exist nearby β match the reviewer's request against the specific anchored line,-not the surrounding region.diff --git a/.claude/skills/running-tend/SKILL.md b/.claude/skills/running-tend/SKILL.mdnew file mode 100644index 000000000..7e3db57e9--- /dev/null+++ b/.claude/skills/running-tend/SKILL.md@@ -0,0 +1,66 @@+---+name: running-tend+description: Worktrunk-specific guidance for tend CI workflows. Adds codecov polling, Rust test commands, labels, and review criteria on top of the generic tend-* skills. Use when operating in CI.+metadata:+ internal: true+---++# Worktrunk Tend CI++Project-specific guidance for tend workflows running on worktrunk (a Rust+CLI for managing git worktrees). The generic skills (`tend-running-in-ci`,+`tend-review`, `tend-triage`, etc.) provide the workflow framework;+this skill adds worktrunk conventions.++## Codecov Monitoring++After required CI checks pass, poll `codecov/patch` β it is mandatory despite+being marked non-required:++```bash+for i in $(seq 1 5); do+ CODECOV=$(gh pr checks <number> 2>&1 | grep 'codecov/patch' || true)+ if echo "$CODECOV" | grep -q 'pass'; then+ echo "codecov/patch passed"; exit 0+ elif echo "$CODECOV" | grep -q 'fail'; then+ echo "codecov/patch FAILED"; exit 1+ fi+ sleep 60+done+```++If codecov fails, investigate with `task coverage` and+`cargo llvm-cov report --show-missing-lines | grep <file>`.++## Test Commands++```bash+cargo run -- hook pre-merge --yes # full suite + lints+cargo test --lib --bins # unit tests only+cargo test --test integration # integration tests only+```++CI runs on Linux, Windows, and macOS.++## Session Log Paths++Artifact paths: `-home-runner-work-worktrunk-worktrunk/<session-id>.jsonl`++## Labels++- `automated-fix` β fix PRs from triage and ci-fix workflows+- `nightly-cleanup` β nightly sweep issues and PRs++## Applying GitHub Suggestions++Apply the literal suggestion only β change the lines it covers, nothing more.+If surrounding lines also need updating, note that in your reply.++## Issue Triage++When a bug may already be fixed, ask the reporter: `wt --version`++## Per-Workflow References++- **PR review**: `@references/review-pr.md` β Rust idioms, documentation accuracy, duplication search+- **Nightly sweep**: `@references/nightly-cleaner.md` β survey script, branch namingdiff --git a/.claude/skills/running-tend/references/nightly-cleaner.md b/.claude/skills/running-tend/references/nightly-cleaner.mdnew file mode 100644index 000000000..e334833de--- /dev/null+++ b/.claude/skills/running-tend/references/nightly-cleaner.md@@ -0,0 +1,11 @@+# Nightly Sweep β Worktrunk Specifics++## Survey Script++```bash+.github/scripts/todays-survey-files.sh+```++## Branch Naming++`nightly/clean-$GITHUB_RUN_ID`diff --git a/.claude/skills/running-tend/references/review-pr.md b/.claude/skills/running-tend/references/review-pr.mdnew file mode 100644index 000000000..b2bca3965--- /dev/null+++ b/.claude/skills/running-tend/references/review-pr.md@@ -0,0 +1,46 @@+# PR Review β Worktrunk Specifics++## Review Criteria++**Idiomatic Rust and project conventions:**++- Does the code follow Rust idioms? (Iterator chains over manual loops, `?` over+ match-on-error, proper use of Option/Result, etc.)+- Does it follow the project's conventions documented in CLAUDE.md? (Cmd for+ shell commands, error handling with anyhow, accessor naming conventions, etc.)+- Are there unnecessary allocations, clones, or owned types where borrows would+ suffice?+- Does new code use `.expect()` or `.unwrap()` in functions returning `Result`?+ These should use `?` or `bail!` instead.++**Testing:**++- Do the tests follow the project's testing conventions (see tests/CLAUDE.md)?++**Documentation accuracy:**++When a PR changes behavior, check that related documentation still matches:++- Does `after_long_help` in `src/cli/mod.rs` and `src/cli/config.rs` still+ describe what the code does? (These are the primary sources for doc pages.)+- Do inline TOML comments in config examples match the actual behavior?+- If a new feature was added, does the relevant help text mention it?++**Duplication search patterns (Rust-specific):**++```bash+# For a new function, search for existing implementations+rg "fn detect.*provider|fn get.*platform|fn .*_provider" --type rust+# For code that iterates remotes and parses URLs+rg "all_remote_urls|remote_url|GitRemoteUrl::parse" --type rust+```++## Flake Tracking++When reporting flakes, use `worktrunk-bot` as the bot login for comment+deduplication:++```bash+LAST_COMMENT=$(gh issue view <issue-number> --json comments \+ --jq '[.comments[] | select(.author.login == "worktrunk-bot")] | last | {id: .url, createdAt: .createdAt}')+```diff --git a/.claude/skills/triage-issue/SKILL.md b/.claude/skills/triage-issue/SKILL.mddeleted file mode 100644index 4aef4b72e..000000000--- a/.claude/skills/triage-issue/SKILL.md+++ /dev/null@@ -1,248 +0,0 @@-----name: triage-issue-description: Triages new GitHub issues β classifies, reproduces bugs, attempts conservative fixes, and comments. Use when a new issue is opened and needs automated triage.-argument-hint: "[issue number]"-metadata:- internal: true------# Issue Triage--Triage a newly opened GitHub issue on this project (a Rust CLI tool for-managing git worktrees).--**Issue to triage:** $ARGUMENTS--## Step 1: Setup--Load `/running-in-ci` first (CI environment rules, security).--Follow the AD FONTES principle throughout: reproduce before fixing, evidence-before speculation, test before committing.--## Step 2: Read and classify the issue--```bash-gh issue view $ARGUMENTS --json title,body,labels,author-```--Classify into one of:--- **Bug report** β describes unexpected behavior, includes steps to reproduce or- error output. Descriptions of changed behavior ("no longer works", "used to- work") strongly signal a bug even with a terse body.-- **Feature request** β asks for new functionality or behavior changes-- **Question** β asks how to do something or how something works-- **Other** β doesn't fit the above categories--## Step 3: Check for duplicates--*Skip for questions and other.*--```bash-# Search open issues for similar problems-gh issue list --state open --json number,title,labels --limit 50--# Check for existing fix branches-git branch -r --list 'origin/fix/issue-*'-git branch -r --list 'origin/repro/issue-*'--# Check open PRs-gh pr list --state open --json number,title,headRefName --limit 50-```--If a duplicate or existing fix is found, note it for the comment in step 7.-Don't create a duplicate fix.--## Step 4: Investigate existing functionality--*Feature requests only.*--Search the codebase to check whether the requested feature already exists.--1. **Extract the core ask** β What specific behavior does the requester want?-2. **Search for implementations** β Grep for relevant function names, config- keys, CLI flags, and domain terms in `src/`, `src/cli/`, `docs/`, and config.-3. **Read key files** β If searches find hits, read the relevant source to- understand what already exists and how it works.-4. **Check docs and help text** β Look for user-facing documentation of the- feature (`--help`, `docs/content/`, config reference).--Record what you found (or didn't find) for use in step 7.--## Step 5: Reproduce the bug--*Bug reports only.*--1. **Understand the report** β What command was run? What was expected? What- actually happened?-2. **Find relevant code** β Search the codebase for the functionality described-3. **Write a failing test** β Add a test to the appropriate *existing* test file- that demonstrates the bug. Don't create new test files.-4. **Run the test** to confirm it fails:- ```bash- cargo test --lib --bins -- test_name- # or for integration tests:- cargo test --test integration -- test_name- ```--If the test passes (bug may already be fixed), note this for the comment.--If you cannot reproduce the bug (unclear steps, environment-specific, etc.),-note what you tried and skip to step 7. Do NOT proceed to Step 6 without a-failing test β a fix without reproduction evidence is not a conservative fix.--## Step 6: Fix (conservative)--*Bug reports only.*--**CRITICAL β gate check before proceeding:**--You MUST have a failing test from Step 5 before writing any fix. If you skipped-the test (couldn't write one, environment-specific bug, etc.), do NOT attempt a-fix β go directly to Step 7 and use the "Reproduction test only" or "Could not-reproduce" comment template. A fix without a reproduction test violates the AD-FONTES principle established in Step 1.--**Only attempt a fix if ALL of these conditions are met:**--- Bug is clearly reproducible (test written in Step 5 fails)-- Root cause is understood-- Fix is localized (1-3 files changed)-- Confident the fix is correct--### Skill text fixes--When the bug is about bot behavior (e.g., "bot didn't use links", "bot posted-wrong format"), the root cause is often a skill/prompt compliance issue, not-missing code. Before adding guidance to a skill:--1. **Check ALL co-loaded skills** β Skills loaded together in the same workflow- share context. If the guidance already exists in a co-loaded skill (e.g.,- `running-in-ci` is loaded alongside `review-pr` and `triage-issue`), the- issue is behavioral compliance, not missing instructions.-2. **Don't duplicate guidance across skills** β Adding the same rule to multiple- co-loaded skills creates maintenance burden and doesn't fix compliance gaps.--### If fixing--1. Fix the root cause (not just the symptom)-2. Confirm the test now passes-3. Run the full test suite and lints:- ```bash- cargo run -- hook pre-merge --yes- ```-4. Create branch, commit, push, and create PR:- ```bash- git checkout -b fix/issue-$ARGUMENTS- git add -A- git commit -m "fix: <description>-- Closes #$ARGUMENTS-- Co-Authored-By: Claude <[email protected]>"- git push -u origin fix/issue-$ARGUMENTS- gh pr create --title "fix: <description>" --label "automated-fix" --body "## Problem- [What the issue reported and the root cause]-- ## Solution- [What was fixed and why]-- ## Testing- [How the fix was verified β mention the reproduction test]-- ---- Closes #<issue-number> β automated triage"- ```-5. Monitor CI using the approach from /running-in-ci (poll required checks- and `codecov/patch`). If CI or codecov fails, diagnose and fix before- declaring done.--### If reproduction test works but fix is not confident--Commit just the failing test on a reproduction branch and open a PR:--```bash-git checkout -b repro/issue-$ARGUMENTS-git add -A-git commit -m "test: add reproduction for #$ARGUMENTS--Co-Authored-By: Claude <[email protected]>"-git push -u origin repro/issue-$ARGUMENTS-gh pr create --title "test: reproduction for #$ARGUMENTS" --label "automated-fix" --body "## Context-Adds a failing test that reproduces #$ARGUMENTS. The fix is not yet included β this PR captures the reproduction so a maintainer can investigate.------Automated triage for #<issue-number>"-```--Note the PR number for the comment.--## Step 7: Comment on the issue--Always comment via `gh issue comment`. Keep it brief, polite, and specific. A-maintainer will always review β never claim the issue is fully resolved by-automation alone.--**Stay within what you verified.** State facts you found in the codebase β don't-characterize something as "known" unless you find prior issues or documentation-about it. Don't speculate beyond the code you read. Follow the templates below-closely; they are deliberately scoped to leave authoritative analysis to-maintainers.--Use the heredoc pattern from `/running-in-ci` for `--body` arguments to avoid-shell quoting issues (e.g., `!` getting escaped as `\!`).--Choose the appropriate template:--### Fix PR created--> Thanks for reporting this! I was able to reproduce the issue and identified the root cause: [one-sentence explanation].->-> I've opened #PR_NUMBER with a fix. A maintainer will review it shortly.--### Reproduction test only (no fix attempted)--> Thanks for reporting this! I was able to reproduce the issue β #PR_NUMBER adds a failing test that demonstrates the bug.->-> Root cause appears to be [brief explanation if known, or "still under investigation"]. A maintainer will take a closer look.--### Could not reproduce--> Thanks for reporting this! I tried to reproduce this but wasn't able to with the information provided.->-> Could you share [specific information needed β exact command, config file, git repo structure, OS, shell, etc.]? That would help narrow it down.->-> A maintainer will also take a look.--### Bug already fixed--> Thanks for reporting this! I looked into this and it appears the behavior described may already be fixed on `main` (the relevant test passes).->-> Could you confirm which version you're running (`wt --version`)? If you're on an older release, updating should resolve this. A maintainer will confirm.--### Feature may already exist--> Thanks for the suggestion! It's possible that [existing feature β specific behavior, config/flag] already does what you're looking for: [brief description of how it works].->-> If that's not quite what you had in mind, could you clarify what additional behavior you're looking for? A maintainer will take a look either way.--### Feature does not exist--> Thanks for the suggestion! I searched the codebase and didn't find an existing implementation of this. [Optionally: the closest related functionality is X, which does Y.]->-> I'll leave it for a maintainer to evaluate and prioritize.--### Question--> Thanks for reaching out! This looks like a usage question rather than a bug report.->-> [Brief answer if obvious from the codebase, or pointer to relevant docs/help text.]->-> A maintainer can provide more detail if needed.--### Duplicate--> Thanks for reporting this! This appears to be related to #EXISTING_ISSUE-> [and/or PR #EXISTING_PR]. I'll leave it to a maintainer to confirm and-> link them.diff --git a/.config/tend.toml b/.config/tend.tomlnew file mode 100644index 000000000..a54391244--- /dev/null+++ b/.config/tend.toml@@ -0,0 +1,11 @@+bot_name = "worktrunk-bot"++[secrets]+bot_token = "WORKTRUNK_BOT_TOKEN"+claude_token = "CLAUDE_CODE_OAUTH_TOKEN"++[setup]+uses = ["./.github/actions/claude-setup"]++[workflows.ci-fix]+watched_workflows = ["ci", "publish-docs"]diff --git a/.github/CLAUDE.md b/.github/CLAUDE.mdindex b910dab50..27d090522 100644--- a/.github/CLAUDE.md+++ b/.github/CLAUDE.md@@ -1,180 +1,87 @@-# CI Automation Security Model+# CI Automation Security Model β Worktrunk-Five Claude-powered workflows automate issue triage, PR review, CI fixes, dependency updates, and `@worktrunk-bot` mentions.+See [tend-security-model.md](tend-security-model.md) for the generic security model+(security layers, token management, prompt injection, event types, workflow+modification rules). This file documents worktrunk-specific configuration.-## Security layers+## Bot identity-Two layers protect the repository, in order of importance:+`worktrunk-bot` is a regular GitHub user account (PAT-based), not a GitHub App.+Workflows check `user.login == 'worktrunk-bot'` directly.-1. **Merge restriction** β only the repo admin (`@max-sixty`) can merge to `main`, enforced by a ruleset. The bot has `write` role (not admin) and cannot merge regardless of review status.-2. **Environment protection** β release secrets (`CARGO_REGISTRY_TOKEN`, `AUR_SSH_PRIVATE_KEY`) are in a protected GitHub Environment (`release`) requiring deployment approval from `@max-sixty`, preventing exfiltration via modified workflows.+## Tokens-Token scoping (principle of least privilege) is a secondary practice, not a security boundary.+| Token | Used by |+|-------|---------|+| `WORKTRUNK_BOT_TOKEN` | All Claude workflows β consistent identity (`worktrunk-bot`) |+| `CLAUDE_CODE_OAUTH_TOKEN` | All β authenticates Claude Code to the Anthropic API |-## Branch protection on `main`--### Classic branch protection (current)--- **Required reviews**: none (the ruleset is the merge restriction, not approvals)-- **Required status checks**: `test (linux)`, `test (macos)`, `test (windows)`-- **Enforce admins**: off+## Merge restriction### Ruleset: "Merge access"- **Rule**: Restrict updates β only bypass actors can push to or merge into `main`- **Bypass**: Repository Admin role β **exempt** mode (silent, no checkbox)-The admin/write role distinction is the merge restriction. `worktrunk-bot` has `write` role (`admin: false`, `maintain: false`). Only the repo owner (`@max-sixty`, admin) can merge. This is enforced by the "Restrict updates" rule β GitHub treats merging a PR as a push to the base branch, so restricting updates blocks both direct pushes and PR merges.--The "exempt" bypass mode (added September 2025) silently skips the rule for the admin β no "bypass branch protections" checkbox. This differs from the older "always" bypass mode, which showed a disruptive checkbox on every merge.--**Why not CODEOWNERS?** CODEOWNERS creates a deadlock for solo maintainers: the code owner can't approve their own PRs (GitHub blocks self-approval), and there's no other code owner. Solving this requires `enforce_admins=off` which also bypasses CI checks, or a separate bypass ruleset which adds complexity. The "Restrict updates" ruleset is simpler: one rule, one bypass actor, CI remains enforced for everyone.--**Why not "Restrict who can push" (classic branch protection)?** That feature is only available for organization-owned repositories. This is a personal repo (`max-sixty/worktrunk`).--## Environment protection for release secrets--`CARGO_REGISTRY_TOKEN` and `AUR_SSH_PRIVATE_KEY` are stored in a protected GitHub Environment (`release`) requiring deployment approval from `@max-sixty`. The environment has a deployment branch policy restricting to `v*` tags.--**Why this matters:** If BOT_TOKEN leaks, an attacker can push a branch with a modified workflow that references `${{ secrets.CARGO_REGISTRY_TOKEN }}`. For same-repo PRs (not forks), all repo-level secrets are available to workflows. The modified workflow runs from the PR branch at CI time β before any merge. Branch protection doesn't prevent this because the secret leaks during CI, not at merge time.--Environment protection prevents this: secrets in a protected environment are only available to jobs that reference that environment AND pass the protection rules (manual approval).--## What each workflow needs to do--| Capability | Triage | Mention | Review | CI Fix | Renovate |-|------------|:---:|:---:|:---:|:---:|:---:|-| Read issues/PRs | Yes | Yes | Yes | Yes | β |-| Comment on issues | Yes | Yes | Yes | β | β |-| Create branches | Yes | Yes | Yes | Yes | Yes |-| Push commits | Yes | Yes | Yes | Yes | Yes |-| Create PRs | Yes | Yes | β | Yes | Yes |-| Post PR reviews | β | β | Yes | β | β |-| Resolve review threads | β | β | Yes | β | β |-| Monitor CI | Yes | Yes | Yes | Yes | Yes |-| **Pushes must trigger CI** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** |--The last row matters for CI: `GITHUB_TOKEN` pushes don't trigger downstream workflows (GitHub prevents infinite loops). Workflows that push code and need CI to run **must** use a PAT. All Claude workflows use `WORKTRUNK_BOT_TOKEN` for consistent identity.--## Token assignment--| Token | Used by | Why |-|-------|---------|-----|-| `WORKTRUNK_BOT_TOKEN` | all Claude workflows | Consistent identity (`worktrunk-bot`). The merge restriction (ruleset) is the security boundary, not token scoping. |-| `CLAUDE_CODE_OAUTH_TOKEN` | all | Authenticates Claude Code to the Anthropic API. |--### Why one token--BOT_TOKEN is equally safe in any workflow: the merge restriction (ruleset) caps the blast radius regardless of which token is used. Using BOT_TOKEN everywhere gives a consistent identity for reviews and comments, and avoids the `github-actions[bot]` branding.--### If a token leaks--| Token | Lifetime | If leaked, attacker can... | ...but cannot |-|-------|----------|---------------------------|---------------|-| `BOT_TOKEN` | Long-lived PAT | Push to unprotected branches, create PRs, approve non-own PRs, impersonate `worktrunk-bot` β **indefinitely** | Merge PRs (ruleset restricts updates to admin), push to `main`, access release secrets (environment-protected). |-| `CLAUDE_CODE_OAUTH_TOKEN` | Long-lived | Run Claude sessions billed to the account | Access GitHub |+`worktrunk-bot` has `write` role (`admin: false`, `maintain: false`). Only the+repo owner (`@max-sixty`, admin) can merge. GitHub treats merging a PR as a push+to the base branch, so restricting updates blocks both direct pushes and PR+merges.-`GITHUB_TOKEN` is ephemeral (single job) and automatically scoped by each workflow's `permissions:` block. Not a meaningful leak target.+The "exempt" bypass mode silently skips the rule for the admin β no "bypass+branch protections" checkbox.-**BOT_TOKEN is the high-value target.** Mitigations:-- "Restrict updates" ruleset blocks merging by non-admins-- Environment protection blocks exfiltration of release secrets-- Rotate `BOT_TOKEN` periodically+### Classic branch protection-### How tokens interact with `permissions:` and `actions/checkout`--Two independent authentication paths exist in every workflow:--1. **Git CLI** (`git push`): authenticates with the token from `actions/checkout`. When no explicit token is passed, this defaults to `GITHUB_TOKEN` scoped by the `permissions:` block. When an explicit token is passed (e.g. `token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}`), the PAT's scopes apply instead.-2. **GitHub API** (`gh pr create`, `gh api`): `claude-code-action` overwrites the `GITHUB_TOKEN` env var with its `github_token` input (BOT_TOKEN for all Claude workflows).--All workflows pass BOT_TOKEN to both paths.--## Prompt injection threat model--| Workflow | Injection surface | Attacker control | Mitigations |-|----------|-------------------|-------------------|-------------|-| **review** | PR diff content (initial review), review body on bot PRs (respond) | Full (any external PR) / Medium (anyone who can review bot PRs) | Fixed prompt, merge restriction |-| **triage** | Issue body | Partial (structured skill) | Fixed prompt, merge restriction, environment protection |-| **mention** | Comment body on any issue/PR, inline/conversation comments on bot-engaged PRs | Full | Fixed prompt, merge restriction, non-mention triggers verified against bot engagement via API |-| **ci-fix** | Failed CI/docs-build logs | Minimal (must break CI or docs build on main) | Fixed prompt, automatic trigger |-| **renovate** | None | None | Fixed prompt, scheduled trigger |--### Secret exfiltration via modified workflows--The most dangerous attack from a leaked BOT_TOKEN is not merging malicious code β it's exfiltrating other secrets:+- **Required reviews**: none (the ruleset is the merge restriction)+- **Required status checks**: `test (linux)`, `test (macos)`, `test (windows)`+- **Enforce admins**: off-1. Push a branch with a modified workflow that references `${{ secrets.CARGO_REGISTRY_TOKEN }}`-2. Create a PR β the modified workflow runs from the PR branch-3. For same-repo PRs, all **repo-level** secrets are available-4. Environment-protected secrets are NOT available (require deployment approval)+**Why not CODEOWNERS?** Deadlock for solo maintainers: the code owner can't+approve their own PRs. The "Restrict updates" ruleset is simpler: one rule, one+bypass actor, CI remains enforced for everyone.-This is why release secrets must be in a protected environment, not repo-level secrets.+**Why not "Restrict who can push"?** Only available for org-owned repos. This+is a personal repo (`max-sixty/worktrunk`).-## Future hardening+## Environment protection-- Migrate from PAT to GitHub App for ephemeral tokens (~1 hour lifetime vs indefinite PAT)-- Workflow dispatch isolation: split triage/mention into analysis (GITHUB_TOKEN) + push (separate workflow with BOT_TOKEN) so the token never touches untrusted input-- Disable "Allow GitHub Actions to create and approve pull requests" in repo settings to prevent GITHUB_TOKEN from ever approving PRs+`CARGO_REGISTRY_TOKEN` and `AUR_SSH_PRIVATE_KEY` are in a protected GitHub+Environment (`release`) requiring deployment approval from `@max-sixty`. The+environment has a deployment branch policy restricting to `v*` tags.## Triage β mention handoff-New issues are always handled by the triage workflow β `claude-mention` only+New issues are always handled by `tend-triage` β `tend-mention` onlytriggers on issue **edits** (not opens) to avoid two workflows racing to createfix PRs for the same bug.-- **New issue** (opened) β triage handles it, regardless of `@worktrunk-bot` mentions-- **Issue edited** to add `@worktrunk-bot` β mention handles it-- **Comment** on an issue/PR β mention handles it (via `issue_comment` trigger)+- **New issue** (opened) β triage, regardless of `@worktrunk-bot` mentions+- **Issue edited** to add `@worktrunk-bot` β mention+- **Comment** on an issue/PR β mention (via `issue_comment` trigger)-The mention workflow runs for any user who includes `@worktrunk-bot` β the merge restriction (ruleset) is the safety boundary, not access control on the workflow itself.+The mention workflow runs for any user who includes `@worktrunk-bot` β the merge+restriction is the safety boundary, not access control on the workflow.## Bot-engaged auto-response-`worktrunk-bot` is a regular GitHub user account (PAT-based), not a GitHub App. The workflows check `user.login == 'worktrunk-bot'` directly.-**Triggers a response:**-- Non-draft PR opened or updated β automatic code review (`claude-review`)-- Formal review submitted on a `worktrunk-bot`-authored PR, with body or non-approval β `claude-review` responds-- `@worktrunk-bot` mentioned in a new issue body β `claude-issue-triage` handles it (triage owns all new issues)-- `@worktrunk-bot` mentioned via issue edit β `claude-mention` responds-- `@worktrunk-bot` mentioned in any comment (issue or PR) β `claude-mention` responds-- Any comment on a PR or issue that `worktrunk-bot` has engaged with (authored, mentioned in the issue body, reviewed, or commented on) β `claude-mention` runs (verify step confirms engagement via API), but the prompt instructs Claude to only respond if the comment needs bot input β otherwise exit silently. When the bot authored the PR/issue, it leans toward responding since commenters expect the author to engage.+- Non-draft PR opened or updated β automatic code review (`tend-review`)+- Formal review submitted on a `worktrunk-bot`-authored PR, with body or non-approval β `tend-review` responds+- `@worktrunk-bot` mentioned in a new issue body β `tend-triage` handles it+- `@worktrunk-bot` mentioned via issue edit β `tend-mention` responds+- `@worktrunk-bot` mentioned in any comment β `tend-mention` responds+- Comment on a PR/issue where `worktrunk-bot` has engaged β `tend-mention` runs, responds only if helpful- Editing a comment or issue body re-triggers the mention workflow**Does not trigger:**-- Issues authored by `worktrunk-bot` (prevents self-triggering when bot-created issues incidentally mention `@worktrunk-bot` in body text)+- Issues authored by `worktrunk-bot` (prevents self-triggering)- `worktrunk-bot`'s own comments or reviews (loop prevention)-- Empty approvals on `worktrunk-bot` PRs (approved with no body)-- Comments on issues or PRs where `worktrunk-bot` hasn't engaged and no `@worktrunk-bot` mention-- Inline review comments from `worktrunk-bot` itself (loop prevention)+- Empty approvals on `worktrunk-bot` PRs+- Comments on issues/PRs where `worktrunk-bot` hasn't engaged and no mention+- Inline review comments from `worktrunk-bot` itself- Draft PRs-**Routing:** Formal reviews (`pull_request_review`) β `claude-review`. Inline comments (`pull_request_review_comment`) and conversation comments (`issue_comment`) β `claude-mention`.--## GitHub API: issue_comment vs pull_request_review_comment--GitHub treats PRs as a superset of issues. Comments on a PR arrive via two different event types depending on where they're posted:--- **Conversation tab** β `issue_comment` event. The PR is at `github.event.issue.pull_request` (a truthy object). The PR number is `github.event.issue.number`.-- **Files changed (inline)** β `pull_request_review_comment` event. The PR is at `github.event.pull_request`. There is no `github.event.issue`.--The `claude-mention` workflow handles both with separate checkout steps.--### pull_request_review--A third event type fires when a reviewer submits a formal review (approve, comment, or request changes):--- **Review submission** β `pull_request_review` event (type: `submitted`). The review is at `github.event.review` (includes `.body`, `.state`, `.user`). The PR is at `github.event.pull_request`.--Individual inline comments from a review also fire as separate `pull_request_review_comment` events. The `claude-review` workflow handles `pull_request_review` for bot-authored PRs; inline comments go through `claude-mention`.--## Rules for modifying workflows--- **No role-based gating**: Workflows should not check `author_association` (OWNER, MEMBER, etc.) to decide whether to run. The merge restriction (ruleset) is the security boundary β Claude cannot merge regardless of who triggers it. Use technical criteria instead: fork detection, loop prevention (exclude the bot's own comments), `@worktrunk-bot` trigger phrase.-- **Adding `allowed_non_write_users`** to a workflow with user-controlled prompts requires security review.-- **All Claude workflows** must include `--append-system-prompt "You are operating in a GitHub Actions CI environment. Use /running-in-ci before starting work."`.-- **Token choice**: All Claude workflows use `BOT_TOKEN` for consistent identity. The merge restriction (ruleset) is the security boundary.-- **`permissions:` block**: Set `contents: read` for read-only workflows.-- **Sensitive secrets** must be in protected environments, never repo-level.-- **Rotate `BOT_TOKEN`** periodically.+**Routing:** Formal reviews (`pull_request_review`) β `tend-review`. Inline+comments (`pull_request_review_comment`) and conversation comments+(`issue_comment`) β `tend-mention`.diff --git a/.github/actions/claude-setup/action.yaml b/.github/actions/claude-setup/action.yamlindex 6d8202fff..41305569a 100644--- a/.github/actions/claude-setup/action.yaml+++ b/.github/actions/claude-setup/action.yaml@@ -45,3 +45,10 @@ runs:run: |sudo apt-get updatesudo apt-get install -y zsh fish++ - name: Set build environment+ shell: bash+ run: |+ echo "CARGO_TERM_COLOR=always" >> "$GITHUB_ENV"+ echo "RUSTFLAGS=-C debuginfo=0" >> "$GITHUB_ENV"+ echo "RUSTDOCFLAGS=-Dwarnings" >> "$GITHUB_ENV"diff --git a/.github/scripts/list-recent-runs.sh b/.github/scripts/list-recent-runs.shindex e280e130a..1ffccc921 100755--- a/.github/scripts/list-recent-runs.sh+++ b/.github/scripts/list-recent-runs.sh@@ -14,8 +14,8 @@ set -euo pipefail# Prevent gh from emitting ANSI color codes in non-TTY contexts.export NO_COLOR=1-# Dynamically discover all claude-* workflows instead of maintaining a hardcoded list.-mapfile -t WORKFLOWS < <(gh workflow list --json name --jq '.[].name | select(startswith("claude-"))')+# Dynamically discover all tend-* workflows instead of maintaining a hardcoded list.+mapfile -t WORKFLOWS < <(gh workflow list --json name --jq '.[].name | select(startswith("tend-"))')CREATED_SINCE=$(date -d '3 hours ago' +%Y-%m-%dT%H:%M:%S)COMPLETED_AFTER=$(date -d '1 hour ago' +%s)diff --git a/.github/scripts/todays-survey-files.sh b/.github/scripts/todays-survey-files.shindex 639336b19..c7d288a0e 100755--- a/.github/scripts/todays-survey-files.sh+++ b/.github/scripts/todays-survey-files.sh@@ -9,10 +9,19 @@set -euo pipefail+# File extensions to survey. Override via arguments:+# ./todays-survey-files.sh '*.py' '*.md' '*.yaml'+# Defaults to common code/config extensions if no arguments given.+if [ $# -gt 0 ]; then+ PATTERNS=("$@")+else+ PATTERNS=('*.rs' '*.md' '*.toml' '*.yaml' '*.yml' '*.sh')+fi+CYCLE_LENGTH=28TODAY_BUCKET=$(( $(date +%s) / 86400 % CYCLE_LENGTH ))-git ls-files -- '*.rs' '*.md' '*.toml' '*.yaml' '*.yml' '*.sh' | while read -r f; do+git ls-files -- "${PATTERNS[@]}" | while read -r f; dohash=$(echo -n "$f" | cksum | awk '{print $1}')bucket=$(( hash % CYCLE_LENGTH ))if [ "$bucket" -eq "$TODAY_BUCKET" ]; thendiff --git a/.github/tend-security-model.md b/.github/tend-security-model.mdnew file mode 100644index 000000000..89d0b0114--- /dev/null+++ b/.github/tend-security-model.md@@ -0,0 +1,150 @@+# CI Automation Security Model++Generic security model for Claude-powered CI workflows. This document covers+the principles; each adopting repo should document its specific configuration+(admin accounts, token names, protected environments) in its own `.github/CLAUDE.md`.++## Security layers++Two layers protect a repository, in order of importance:++1. **Merge restriction** β only designated admins can merge to the default+ branch, enforced by a ruleset or branch protection. The bot has write access+ (not admin) and cannot merge regardless of review status.+2. **Environment protection** β release secrets (registry tokens, signing keys)+ are in a protected GitHub Environment requiring deployment approval,+ preventing exfiltration via modified workflows.++Token scoping (principle of least privilege) is a secondary practice, not a+security boundary.++## What each workflow needs to do++| Capability | Triage | Mention | Review | CI Fix | Nightly | Renovate |+|------------|:---:|:---:|:---:|:---:|:---:|:---:|+| Read issues/PRs | Yes | Yes | Yes | Yes | Yes | β |+| Comment on issues | Yes | Yes | Yes | β | Yes | β |+| Create branches | Yes | Yes | Yes | Yes | Yes | Yes |+| Push commits | Yes | Yes | Yes | Yes | Yes | Yes |+| Create PRs | Yes | Yes | β | Yes | Yes | Yes |+| Post PR reviews | β | β | Yes | β | β | β |+| Resolve review threads | β | β | Yes | β | β | β |+| Monitor CI | Yes | Yes | Yes | Yes | Yes | Yes |+| **Pushes must trigger CI** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** | **Yes** |++The last row matters: `GITHUB_TOKEN` pushes don't trigger downstream workflows+(GitHub prevents infinite loops). Workflows that push code and need CI to run+**must** use a PAT or GitHub App installation token.++## Token assignment++Use a single bot token across all Claude workflows for consistent identity.+The merge restriction (ruleset) caps blast radius regardless of which token+is used.++Two tokens are needed:++| Token | Purpose |+|-------|---------|+| Bot token (PAT or App) | GitHub API and git operations. Consistent bot identity. |+| Claude OAuth token | Authenticates Claude Code to the Anthropic API. |++### Why one bot token++The bot token is equally safe in any workflow because the merge restriction+caps the blast radius. Using a single token gives consistent identity for+reviews and comments and avoids the `github-actions[bot]` branding.++### If a token leaks++| Token | Lifetime | If leaked, attacker can... | ...but cannot |+|-------|----------|---------------------------|---------------|+| Bot token (PAT) | Long-lived | Push to unprotected branches, create PRs, impersonate bot β **indefinitely** | Merge PRs (merge restriction), push to default branch, access release secrets (environment-protected) |+| Bot token (App) | ~1 hour | Same as PAT, but only until token expires | Same + token auto-expires |+| Claude OAuth | Long-lived | Run Claude sessions billed to the account | Access GitHub |++`GITHUB_TOKEN` is ephemeral (single job) and automatically scoped by each+workflow's `permissions:` block. Not a meaningful leak target.++**Bot token is the high-value target.** Mitigations:+- Merge restriction blocks merging by non-admins+- Environment protection blocks exfiltration of release secrets+- With a GitHub App, tokens auto-expire in ~1 hour+- With a PAT, rotate periodically++### How tokens interact with `permissions:` and `actions/checkout`++Two independent authentication paths exist in every workflow:++1. **Git CLI** (`git push`): authenticates with the token from+ `actions/checkout`. When no explicit token is passed, this defaults to+ `GITHUB_TOKEN` scoped by the `permissions:` block. When an explicit token+ is passed, that token's scopes apply instead.+2. **GitHub API** (`gh pr create`, `gh api`): `claude-code-action` overwrites+ the `GITHUB_TOKEN` env var with its `github_token` input.++All workflows should pass the bot token to both paths.++## Prompt injection threat model++| Workflow | Injection surface | Attacker control | Mitigations |+|----------|-------------------|-------------------|-------------|+| **review** | PR diff content, review body on bot PRs | Full (any PR) / Medium (reviewers) | Fixed prompt, merge restriction |+| **triage** | Issue body | Partial (structured skill) | Fixed prompt, merge restriction, environment protection |+| **mention** | Comment body on any issue/PR | Full | Fixed prompt, merge restriction, engagement verification |+| **ci-fix** | Failed CI logs | Minimal (must break CI on default branch) | Fixed prompt, automatic trigger |+| **renovate** | None | None | Fixed prompt, scheduled trigger |++### Secret exfiltration via modified workflows++The most dangerous attack from a leaked bot token is not merging malicious+code β it's exfiltrating other secrets:++1. Push a branch with a modified workflow that references a secret+2. Create a PR β the modified workflow runs from the PR branch+3. For same-repo PRs, all **repo-level** secrets are available+4. Environment-protected secrets are NOT available (require deployment approval)++This is why release secrets must be in a protected environment, not repo-level+secrets.++## Future hardening++- Migrate from PAT to GitHub App for ephemeral tokens (~1 hour vs indefinite)+- Workflow dispatch isolation: split workflows into analysis (GITHUB_TOKEN) ++ push (separate workflow with bot token) so the token never touches untrusted+ input+- Disable "Allow GitHub Actions to create and approve pull requests" in repo+ settings++## GitHub API: event types for PR comments++GitHub treats PRs as a superset of issues. Comments on a PR arrive via+different event types depending on where they're posted:++- **Conversation tab** β `issue_comment` event. The PR is at+ `github.event.issue.pull_request`. The PR number is+ `github.event.issue.number`.+- **Files changed (inline)** β `pull_request_review_comment` event. The PR is+ at `github.event.pull_request`. There is no `github.event.issue`.+- **Review submission** β `pull_request_review` event (type: `submitted`). The+ review is at `github.event.review`. The PR is at+ `github.event.pull_request`.++Individual inline comments from a review also fire as separate+`pull_request_review_comment` events.++## Rules for modifying workflows++- **No role-based gating**: Don't check `author_association` (OWNER, MEMBER,+ etc.) to decide whether to run. The merge restriction is the security+ boundary. Use technical criteria: fork detection, loop prevention, trigger+ phrases.+- **Adding `allowed_non_write_users`** to a workflow with user-controlled+ prompts requires security review.+- **All Claude workflows** must include+ `--append-system-prompt "You are operating in a GitHub Actions CI environment. Use /tend-running-in-ci before starting work."`.+- **Token choice**: All Claude workflows use the bot token for consistent+ identity.+- **`permissions:` block**: Set `contents: read` for read-only workflows.+- **Sensitive secrets** must be in protected environments, never repo-level.diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yamlindex f1111eb0d..ee3e3564f 100644--- a/.github/workflows/ci.yaml+++ b/.github/workflows/ci.yaml@@ -1,7 +1,7 @@name: ci# Runner versions are pinned to avoid surprise breaking changes from -latest migrations.-# The claude-renovate workflow checks weekly for updates and creates PRs.+# The tend-renovate workflow checks weekly for updates and creates PRs.# - windows-2022: Pinned because windows-2025 lacks D: drive (actions/runner-images#12677)# - ubuntu-24.04, macos-15: Pinned to current -latest equivalentsdiff --git a/.github/workflows/claude-ci-fix.yaml b/.github/workflows/claude-ci-fix.yamldeleted file mode 100644index c20f9b98c..000000000--- a/.github/workflows/claude-ci-fix.yaml+++ /dev/null@@ -1,71 +0,0 @@-name: claude-ci-fix-# Runner versions pinned; see ci.yaml header comment for rationale.--# Trigger when CI or docs workflow fails on main-on:- workflow_run:- workflows: [ci, publish-docs]- types: [completed]- branches: [main]--# Consistent with ci.yaml for cache compatibility-env:- CARGO_TERM_COLOR: always- RUSTFLAGS: "-C debuginfo=0"- RUSTDOCFLAGS: "-Dwarnings"--jobs:- fix-ci:- # Only run when CI failed on main- if: github.event.workflow_run.conclusion == 'failure'- runs-on: ubuntu-24.04- permissions:- contents: write- pull-requests: write- actions: read- id-token: write- steps:- - name: π Checkout code- uses: actions/checkout@v6- with:- ref: main- fetch-depth: 0- fetch-tags: true- # Use bot token so pushed commits trigger CI workflows- token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π§ Setup build tools- uses: ./.github/actions/claude-setup-- - name: π€ Run Claude Code to fix CI- id: claude- uses: anthropics/claude-code-action@v1- with:- show_full_output: true- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}- # Use bot token so pushed commits trigger CI workflows- github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}- bot_id: "254187624"- bot_name: "worktrunk-bot"- additional_permissions: |- actions: read-- prompt: |- /fix-ci ${{ github.event.workflow_run.id }}- - Run URL: ${{ github.event.workflow_run.html_url }}- - Commit: ${{ github.event.workflow_run.head_sha }}- - Commit message: ${{ github.event.workflow_run.head_commit.message }}-- claude_args: |- --model opus- --allowedTools Bash,Edit,Read,Write,Glob,Grep,WebSearch,WebFetch,Task,Skill- --append-system-prompt "You are operating in a GitHub Actions CI environment. Use /running-in-ci before starting work."-- - name: π Upload Claude Code session logs- if: always()- uses: actions/upload-artifact@v7- with:- name: claude-session-logs- path: /home/runner/.claude/projects/- retention-days: 30- if-no-files-found: warndiff --git a/.github/workflows/claude-hourly-review-reviewers.yaml b/.github/workflows/claude-hourly-review-reviewers.yamldeleted file mode 100644index 3a8df62fa..000000000--- a/.github/workflows/claude-hourly-review-reviewers.yaml+++ /dev/null@@ -1,66 +0,0 @@-name: claude-hourly-review-reviewers-# Runner versions pinned; see ci.yaml header comment for rationale.--# Hourly analysis of Claude CI session logs β identifies behavioral problems,-# skill gaps, and workflow issues across all Claude-powered CI runs.-on:- schedule:- # Run at :47 past every hour (off-peak minute)- - cron: '47 * * * *'- workflow_dispatch:--# Consistent with ci.yaml for cache compatibility-env:- CARGO_TERM_COLOR: always- RUSTFLAGS: "-C debuginfo=0"- RUSTDOCFLAGS: "-Dwarnings"--jobs:- review-reviewers:- runs-on: ubuntu-24.04- permissions:- contents: write- pull-requests: write- issues: write- actions: read- id-token: write- steps:- - name: π Checkout code- uses: actions/checkout@v6- with:- ref: main- fetch-depth: 0- fetch-tags: true- # Use bot token so pushed commits trigger CI workflows- token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π§ Setup build tools- uses: ./.github/actions/claude-setup-- - name: π€ Run Claude Code to review reviewers- id: claude- uses: anthropics/claude-code-action@v1- with:- show_full_output: true- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}- github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}- bot_id: "254187624"- bot_name: "worktrunk-bot"- additional_permissions: |- actions: read-- prompt: /review-reviewers-- claude_args: |- --model opus- --allowedTools Bash,Edit,Read,Write,Glob,Grep,WebSearch,WebFetch,Task,Skill- --append-system-prompt "You are operating in a GitHub Actions CI environment. Use /running-in-ci before starting work."-- - name: π Upload Claude Code session logs- if: always()- uses: actions/upload-artifact@v7- with:- name: claude-session-logs- path: /home/runner/.claude/projects/- retention-days: 30- if-no-files-found: warndiff --git a/.github/workflows/claude-issue-triage.yaml b/.github/workflows/claude-issue-triage.yamldeleted file mode 100644index 31769d4bc..000000000--- a/.github/workflows/claude-issue-triage.yaml+++ /dev/null@@ -1,82 +0,0 @@-name: claude-issue-triage-# Runner versions pinned; see ci.yaml header comment for rationale.--# Automatic triage when new issues are opened.-on:- issues:- types: [opened]--concurrency:- group: ${{ github.workflow }}-${{ github.event.issue.number }}- cancel-in-progress: true--# Consistent with ci.yaml for cache compatibility-env:- CARGO_TERM_COLOR: always- RUSTFLAGS: "-C debuginfo=0"- RUSTDOCFLAGS: "-Dwarnings"--jobs:- triage:- # Skip bot-created issues and issues from worktrunk-bot (nightly workflows,- # ci-fix, etc.). Nightly workflows handle their own remediation because they- # have richer context (session logs, aggregate diffs) that would be lost if- # the triager re-derived it from the issue body alone.- #- # Issues mentioning @worktrunk-bot are handled here too β claude-mention- # only triggers on issue edits (not opens) to avoid duplicate workflows- # racing to create fix PRs.- if: >-- github.event.issue.user.type != 'Bot' &&- github.event.issue.user.login != 'worktrunk-bot'- runs-on: ubuntu-24.04- permissions:- contents: write- pull-requests: write- issues: write- id-token: write- actions: read- steps:- - name: π Checkout code- uses: actions/checkout@v6- with:- ref: main- fetch-depth: 0- fetch-tags: true- # Use bot token so pushed commits trigger CI workflows- token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π§ Setup build tools- uses: ./.github/actions/claude-setup-- - name: π€ Run Claude Code to triage issue- id: claude- uses: anthropics/claude-code-action@v1- with:- show_full_output: true- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}- # Use bot token so pushed commits trigger CI workflows- github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}- bot_id: "254187624"- bot_name: "worktrunk-bot"- # Triage runs for all new issues, including from external contributors- allowed_non_write_users: '*'- additional_permissions: |- actions: read-- prompt: |- triage-issue ${{ github.event.issue.number }}-- claude_args: |- --model opus- --allowedTools Bash,Edit,Read,Write,Glob,Grep,WebSearch,WebFetch,Task,Skill- --append-system-prompt "You are operating in a GitHub Actions CI environment. Use /running-in-ci before starting work."-- - name: π Upload Claude Code session logs- if: always()- uses: actions/upload-artifact@v7- with:- name: claude-session-logs- path: /home/runner/.claude/projects/- retention-days: 30- if-no-files-found: warndiff --git a/.github/workflows/claude-mention.yaml b/.github/workflows/claude-mention.yamldeleted file mode 100644index f0d22fc68..000000000--- a/.github/workflows/claude-mention.yaml+++ /dev/null@@ -1,263 +0,0 @@-name: claude-mention-# Runner versions pinned; see ci.yaml header comment for rationale.--on:- issues:- types: [edited]- issue_comment:- types: [created, edited]- pull_request_review_comment:- types: [created, edited]--# Consistent with ci.yaml for cache compatibility-env:- CARGO_TERM_COLOR: always- RUSTFLAGS: "-C debuginfo=0"- RUSTDOCFLAGS: "-Dwarnings"--jobs:- claude:- # Two triggers:- # 1. @worktrunk-bot mentions β explicit requests on any issue/PR.- # New issues (opened) go to claude-issue-triage instead; this- # workflow only handles issue edits that add @worktrunk-bot.- # 2. Bot-engaged PRs/issues β any non-bot comment on a PR or issue- # where the bot has authored, reviewed, or commented. The verify step- # checks engagement via API and skips the job if the bot has not- # participated. Formal review submissions- # (pull_request_review) go to claude-review instead.- #- # Runs in agent mode (prompt). The prompt tells Claude what happened- # and where to look; Claude reads the full context itself via gh/skills.- #- # Note: secrets cannot be used in job-level `if:` (actions/runner#520) β- # doing so causes GitHub to fail the workflow on push validation.- #- # Unlike `pull_request`, the `pull_request_review_comment` event runs on- # the base repo and has access to secrets even for fork PRs β no fork- # filter needed. (The `issue_comment` path already works on fork PRs- # for the same reason.)- if: |- (github.event_name == 'issues' &&- contains(github.event.issue.body, '@worktrunk-bot') &&- github.event.issue.user.login != 'worktrunk-bot') ||- (github.event_name == 'issue_comment' &&- github.event.comment.user.login != 'worktrunk-bot') ||- (github.event_name == 'pull_request_review_comment' &&- github.event.comment.user.login != 'worktrunk-bot')- # Job-level concurrency (not workflow-level) so that runs skipped by the- # `if:` above don't enter the concurrency group. Workflow-level concurrency- # is evaluated before job-level `if:`, so bot comments that will be filtered- # out still cancel in-progress runs. See #1292.- concurrency:- group: ${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number }}- cancel-in-progress: true- runs-on: ubuntu-24.04- permissions:- contents: write # Allow pushing commits- pull-requests: write # Allow commenting and updating PRs- issues: write # Allow commenting on issues- id-token: write- actions: read # Required for Claude to read CI results on PRs- steps:- # Verify bot engagement β gate for non-mention comments.- #- # Skipped (all subsequent steps run) when:- # - Event is not a comment (issues edited with @worktrunk-bot)- # - Comment body contains @worktrunk-bot (explicit mention)- #- # When it runs, checks engagement in order (first match exits 0):- #- # Plain issues:- # 1. Bot authored the issue- # 2. Issue body mentions @worktrunk-bot (catches the race where- # concurrency cancelled the initial run before the bot commented)- # 3. Bot has commented on the issue- #- # PRs:- # 1. Bot authored the PR- # 2. Bot has left a review- # 3. Bot has commented- #- # If none match β exit 1 (continue-on-error makes this non-fatal;- # subsequent steps check `steps.verify.outcome != 'failure'`).- - name: π Verify bot engagement- id: verify- continue-on-error: true- if: "github.event.comment && !contains(github.event.comment.body || '', '@worktrunk-bot')"- run: |- if [ "$GITHUB_EVENT_NAME" = "issue_comment" ]; then- ISSUE_NUMBER="${{ github.event.issue.number }}"-- if [ -z "${{ github.event.issue.pull_request.url }}" ]; then- ISSUE_AUTHOR="${{ github.event.issue.user.login }}"- if [ "$ISSUE_AUTHOR" = "worktrunk-bot" ]; then- exit 0- fi- if echo "$ISSUE_BODY" | grep -qF '@worktrunk-bot'; then- exit 0- fi- BOT_COMMENTS=$(gh api "repos/$GITHUB_REPOSITORY/issues/$ISSUE_NUMBER/comments" \- --jq '[.[] | select(.user.login == "worktrunk-bot")] | length')- if [ "$BOT_COMMENTS" -gt "0" ]; then- exit 0- fi- echo "::notice::Bot has not engaged with issue #$ISSUE_NUMBER β skipping"- exit 1- fi-- PR_NUMBER="$ISSUE_NUMBER"- else- PR_NUMBER="${{ github.event.pull_request.number }}"- fi-- PR_AUTHOR=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json author --jq '.author.login')- if [ "$PR_AUTHOR" = "worktrunk-bot" ]; then- exit 0- fi-- BOT_REVIEWS=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/reviews" \- --jq '[.[] | select(.user.login == "worktrunk-bot")] | length')- if [ "$BOT_REVIEWS" -gt "0" ]; then- exit 0- fi-- BOT_COMMENTS=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" \- --jq '[.[] | select(.user.login == "worktrunk-bot")] | length')- if [ "$BOT_COMMENTS" -gt "0" ]; then- exit 0- fi-- echo "::notice::Bot has not engaged with PR #$PR_NUMBER β skipping"- exit 1- env:- GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}- ISSUE_BODY: ${{ github.event.issue.body }}-- - name: π Checkout code- if: steps.verify.outcome != 'failure'- uses: actions/checkout@v6- with:- fetch-depth: 0- fetch-tags: true- # Use bot token so pushed commits trigger CI workflows- token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π React to comment- # Only react when explicitly mentioned. For bot-engaged conversations- # without a mention, the bot may exit silently β adding π would- # create a false expectation of a response.- if: >-- steps.verify.outcome != 'failure'- && github.event.comment- && contains(github.event.comment.body, '@worktrunk-bot')- run: |- # Try issue comment endpoint first, then review comment endpoint.- # One will match depending on the comment type.- gh api "repos/$REPO/issues/comments/$COMMENT_ID/reactions" -f content=eyes 2>/dev/null || \- gh api "repos/$REPO/pulls/comments/$COMMENT_ID/reactions" -f content=eyes 2>/dev/null || true- env:- REPO: ${{ github.repository }}- COMMENT_ID: ${{ github.event.comment.id }}- GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- # Setup build tools BEFORE checking out PR branch β the composite action- # lives on main and won't exist on PR branches created before #1273.- - name: π§ Setup build tools- if: steps.verify.outcome != 'failure'- uses: ./.github/actions/claude-setup-- - name: π Check out PR branch (conversation comment)- if: steps.verify.outcome != 'failure' && github.event.issue.pull_request- run: |- PR_STATE=$(gh pr view ${{ github.event.issue.number }} --json state --jq '.state')- if [ "$PR_STATE" = "OPEN" ]; then- gh pr checkout ${{ github.event.issue.number }}- else- echo "::warning::PR is $PR_STATE β staying on default branch"- fi- env:- GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π Check out PR branch (review comment)- if: steps.verify.outcome != 'failure' && github.event_name == 'pull_request_review_comment'- run: |- PR_STATE=$(gh pr view ${{ github.event.pull_request.number }} --json state --jq '.state')- if [ "$PR_STATE" = "OPEN" ]; then- gh pr checkout ${{ github.event.pull_request.number }}- else- echo "::warning::PR is $PR_STATE β staying on default branch"- fi- env:- GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π€ Run Claude Code- if: steps.verify.outcome != 'failure'- id: claude- uses: anthropics/claude-code-action@v1- with:- show_full_output: true- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}- # Use bot token so pushed commits trigger CI workflows- github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}- bot_id: "254187624"- bot_name: "worktrunk-bot"- allowed_non_write_users: '*'-- trigger_phrase: "@worktrunk-bot"- additional_permissions: |- actions: read-- # Always agent mode. The prompt tells Claude what happened; the- # /running-in-ci skill instructs it to read full context via gh.- #- # Four prompt paths:- # 1. Inline review comment (pull_request_review_comment) β reply in thread- # 2. Explicit @worktrunk-bot mention in a comment β always respond- # 3. Comment on bot-engaged issue/PR (no mention) β only if helpful- # 4. Issue edited with @worktrunk-bot mention β always respond- prompt: >-- ${{ github.event_name == 'pull_request_review_comment'- && (contains(github.event.comment.body, '@worktrunk-bot')- && format(- 'You were mentioned in an inline review comment on PR #{0} ({1}, review comment ID {2}). Read the full PR context (description, diff, recent comments, CI status) and respond. If they''re requesting changes, make the changes, commit, and push. If they''re asking a question, answer it. Reply in the review thread using `gh api repos/{3}/pulls/{0}/comments/{2}/replies -f body="..."` β do not create a new top-level comment.',- github.event.pull_request.number,- github.event.comment.html_url,- github.event.comment.id,- github.repository- )- || format(- 'A user left an inline review comment on a PR where you previously participated (PR #{0}, {1}, review comment ID {2}). Read the full context (description, diff, recent comments, CI status). Only respond if the comment is directed at you, asks a question you can help with, or requests changes you can make. If the conversation is between humans and doesn''t need your input, exit silently without commenting. Note: if you are the author of the PR or issue, commenters are probably expecting the author to engage β lean toward responding. Reply in the review thread using `gh api repos/{3}/pulls/{0}/comments/{2}/replies -f body="..."` β do not create a new top-level comment.',- github.event.pull_request.number,- github.event.comment.html_url,- github.event.comment.id,- github.repository- ))- || github.event.comment.html_url- && (contains(github.event.comment.body, '@worktrunk-bot')- && format(- 'You were mentioned in a comment ({0}). Read the full issue or PR (description, diff, recent comments, CI status) and respond. If they''re requesting changes, make the changes, commit, and push. If they''re asking a question, answer it. When suggesting code changes on a PR, use the review-pr skill for inline suggestions.',- github.event.comment.html_url- )- || format(- 'A user commented on an issue/PR where you previously participated ({0}). Read the full context (description, recent comments, CI status). Only respond if the comment is directed at you, asks a question you can help with, or requests changes you can make. A comment that responds to concerns you raised in a review is directed at you β briefly acknowledge that the concerns are resolved (or explain why they aren''t). If the conversation is between humans and doesn''t need your input, exit silently without commenting. Note: if you are the author of the PR or issue, commenters are probably expecting the author to engage β lean toward responding. When suggesting code changes on a PR, use the review-pr skill for inline suggestions.',- github.event.comment.html_url- ))- || format(- 'An issue was updated with a mention of you ({0}). Read it and respond.',- github.event.issue.html_url- ) }}-- claude_args: |- --model opus- --allowedTools Bash,Edit,Read,Write,Glob,Grep,WebSearch,WebFetch,Task,Skill- --append-system-prompt "You are operating in a GitHub Actions CI environment. Use /running-in-ci before starting work."-- - name: π Upload Claude Code session logs- if: always()- uses: actions/upload-artifact@v7- with:- name: claude-session-logs- path: /home/runner/.claude/projects/- retention-days: 30- if-no-files-found: warndiff --git a/.github/workflows/claude-nightly-cleaner.yaml b/.github/workflows/claude-nightly-cleaner.yamldeleted file mode 100644index 96628d267..000000000--- a/.github/workflows/claude-nightly-cleaner.yaml+++ /dev/null@@ -1,68 +0,0 @@-name: claude-nightly-cleaner-# Runner versions pinned; see ci.yaml header comment for rationale.--# Nightly code quality sweep β resolves merge conflicts on bot PRs, reviews all-# commits merged to main in the past 24 hours for bugs, inconsistencies, and-# improvement opportunities, closes open issues resolved by recent merges, and-# performs a rolling survey of existing code/docs (full repo every 28 days).-on:- schedule:- # Run at 6:17 AM UTC daily (off-peak minute)- - cron: '17 6 * * *'- workflow_dispatch:--# Consistent with ci.yaml for cache compatibility-env:- CARGO_TERM_COLOR: always- RUSTFLAGS: "-C debuginfo=0"- RUSTDOCFLAGS: "-Dwarnings"--jobs:- cleaner:- runs-on: ubuntu-24.04- permissions:- contents: write- pull-requests: write- issues: write- actions: read- id-token: write- steps:- - name: π Checkout code- uses: actions/checkout@v6- with:- ref: main- fetch-depth: 0- fetch-tags: true- # Use bot token so pushed commits trigger CI workflows- token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π§ Setup build tools- uses: ./.github/actions/claude-setup-- - name: π€ Run Claude Code for nightly cleanup- id: claude- uses: anthropics/claude-code-action@v1- with:- show_full_output: true- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}- github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}- bot_id: "254187624"- bot_name: "worktrunk-bot"- additional_permissions: |- actions: read-- prompt: /nightly-cleaner-- claude_args: |- --model opus- --allowedTools Bash,Edit,Read,Write,Glob,Grep,WebSearch,WebFetch,Task,Skill- --append-system-prompt "You are operating in a GitHub Actions CI environment. Use /running-in-ci before starting work."-- - name: π Upload Claude Code session logs- if: always()- uses: actions/upload-artifact@v7- with:- name: claude-session-logs- path: /home/runner/.claude/projects/- retention-days: 30- if-no-files-found: warndiff --git a/.github/workflows/claude-renovate.yaml b/.github/workflows/claude-renovate.yamldeleted file mode 100644index d776a8b08..000000000--- a/.github/workflows/claude-renovate.yaml+++ /dev/null@@ -1,138 +0,0 @@-name: claude-renovate--# Weekly renovation check - reviews CI dependencies and creates PRs for updates-on:- schedule:- # Run at 9:17 AM UTC every Sunday (off-peak minute)- - cron: '17 9 * * 0'- workflow_dispatch:--# Consistent with ci.yaml for cache compatibility-env:- CARGO_TERM_COLOR: always- RUSTFLAGS: "-C debuginfo=0"- RUSTDOCFLAGS: "-Dwarnings"--jobs:- renovate:- runs-on: ubuntu-24.04- permissions:- contents: write- pull-requests: write- actions: read- id-token: write- steps:- - name: π Checkout code- uses: actions/checkout@v6- with:- ref: main- fetch-depth: 0- fetch-tags: true- token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π§ Setup build tools- uses: ./.github/actions/claude-setup- with:- install-cargo-tools: "false"- install-shells: "false"-- - name: π€ Run Claude Code for renovation- id: claude- uses: anthropics/claude-code-action@v1- with:- show_full_output: true- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}- github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}- bot_id: "254187624"- bot_name: "worktrunk-bot"- additional_permissions: |- actions: read-- prompt: |- You are running as part of a weekly renovation workflow. Your job is to check for updates to CI dependencies and create PRs if updates are available.-- ## What to check-- 1. **GitHub Actions runner versions**:- - Check what the current `-latest` labels resolve to:- - `ubuntu-latest` - what Ubuntu version?- - `macos-latest` - what macOS version?- - `windows-latest` - what Windows version?- - Compare against what we have pinned in our workflow files- - Note: `windows-latest` has D: drive issues (actions/runner-images#12677), so stay on windows-2022-- 2. **GitHub Actions versions**:- - Check for updates to actions we use (actions/checkout, actions/cache, etc.)- - Look at the current versions in .github/workflows/*.yaml- - Check if newer versions are available-- 3. **Rust stable toolchain** (in `rust-toolchain.toml`):- - Check the latest stable Rust release (use `curl -s https://static.rust-lang.org/dist/channel-rust-stable.toml | head -20` or similar)- - Compare against the channel in `rust-toolchain.toml`- - Always bump to the latest stable version- - After bumping, re-evaluate pinned cargo tool versions β newer tools may now be compatible-- 4. **Rust nightly version** (in check-unused-dependencies job):- - We pin a specific nightly for cargo-udeps (check the actual version in ci.yaml)- - Periodically update to a recent nightly that works with cargo-udeps-- 5. **Pinned cargo tool versions**:- - All cargo tools are pinned with `version: "=X.Y.Z"` in workflow files to prevent surprise breakage from MSRV bumps- - Check if newer versions are available for: cargo-nextest, cargo-insta, lychee, worktrunk, cargo-msrv, cargo-udeps, cargo-llvm-cov- - To check: look up the tool's MSRV on crates.io or its repo and compare against the channel in `rust-toolchain.toml`- - Only update the pin if the new version is compatible with our rustc- - Update pins in ALL workflow files that use the tool (ci.yaml and .github/actions/claude-setup/action.yaml)-- ## How to check-- - Use `gh api` and web searches to find current versions- - Read our workflow files to see what we currently use- - Check the actions/runner-images repository for runner version info- - Check individual action repos for version updates-- ## If updates are available-- 1. Create a new branch: `git checkout -b chore/renovate-$(date +%Y%m%d)`- 2. Make the updates to workflow files- 3. Commit with a clear message explaining what was updated- 4. Push and create a PR with:-- ```- ## Summary- Weekly CI renovation check found the following updates:-- - [List each update]-- ## Changes- - [Describe each change]-- ## Notes- - [Any caveats or things to watch for]-- ---- π€ Automated weekly renovation- ```-- ## Clean up superseded PRs-- After creating the renovation PR, close any dependabot or other automated PRs that are fully superseded by your changes. For each:- 1. Leave a comment explaining the PR is superseded (e.g., "Superseded by #NNN which includes this update along with other renovations.")- 2. Close the PR with `gh pr close <number>`-- ## If no updates are needed-- Simply report that all dependencies are up to date. Don't create a PR.-- claude_args: |- --model opus- --allowedTools Bash,Edit,Read,Write,Glob,Grep,WebSearch,WebFetch,Task,Skill- --append-system-prompt "You are operating in a GitHub Actions CI environment. Use /running-in-ci before starting work."-- - name: π Upload Claude Code session logs- if: always()- uses: actions/upload-artifact@v7- with:- name: claude-session-logs- path: /home/runner/.claude/projects/- retention-days: 30- if-no-files-found: warndiff --git a/.github/workflows/claude-review.yaml b/.github/workflows/claude-review.yamldeleted file mode 100644index 53d67be76..000000000--- a/.github/workflows/claude-review.yaml+++ /dev/null@@ -1,106 +0,0 @@-name: claude-review-# Runner versions pinned; see ci.yaml header comment for rationale.--# Two modes in one job:-# - pull_request_target: automatic code review on non-draft PRs.-# - pull_request_review: respond to formal reviews on bot-authored PRs.-on:- pull_request_target:- types: [opened, synchronize, ready_for_review, reopened]- pull_request_review:- types: [submitted]--env:- CARGO_TERM_COLOR: always- RUSTFLAGS: "-C debuginfo=0"- RUSTDOCFLAGS: "-Dwarnings"--jobs:- claude:- if: |- (github.event_name == 'pull_request_target' &&- github.event.pull_request.draft == false) ||- (github.event_name == 'pull_request_review' &&- github.event.pull_request.user.login == 'worktrunk-bot' &&- github.event.review.user.login != 'worktrunk-bot' &&- (github.event.review.state != 'approved' || github.event.review.body))- # Job-level concurrency (not workflow-level) so that runs skipped by the- # `if:` above don't enter the concurrency group. Workflow-level concurrency- # is evaluated before job-level `if:`, so a bot review that will be filtered- # out still cancels the in-progress run handling that review. See #1305.- concurrency:- group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number }}- cancel-in-progress: true- runs-on: ubuntu-24.04- timeout-minutes: 60- permissions:- contents: write- pull-requests: write- issues: write- id-token: write- actions: read- steps:- - name: π Checkout merge commit (initial review)- if: github.event_name == 'pull_request_target'- uses: actions/checkout@v6- with:- ref: refs/pull/${{ github.event.pull_request.number }}/merge- fetch-depth: 0- token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π Checkout code (review response)- if: github.event_name == 'pull_request_review'- uses: actions/checkout@v6- with:- fetch-depth: 0- fetch-tags: true- token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- # Setup build tools BEFORE checking out PR branch β the composite action- # lives on main and won't exist on PR branches created before #1273.- - name: π§ Setup build tools- if: github.event_name == 'pull_request_review'- uses: ./.github/actions/claude-setup-- - name: π Check out PR branch- if: github.event_name == 'pull_request_review'- run: gh pr checkout ${{ github.event.pull_request.number }}- env:- GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}-- - name: π€ Run Claude Code- id: claude- uses: anthropics/claude-code-action@v1- with:- show_full_output: true- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}- github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}- bot_id: "254187624"- bot_name: "worktrunk-bot"- allowed_bots: "*"- allowed_non_write_users: "*"- additional_permissions: |- actions: read- trigger_phrase: "@worktrunk-bot"- use_sticky_comment: ${{ github.event_name == 'pull_request_target' }}- prompt: >-- ${{ github.event_name == 'pull_request_target'- && format('/review-pr {0}', github.event.pull_request.number)- || format(- 'A review was submitted on your PR #{0} ({1}). Read the review and full PR context (description, diff, comments, CI status), then respond appropriately. If changes were requested, make them, commit, and push. If questions were asked, answer them.',- github.event.pull_request.number,- github.event.review.html_url- ) }}- claude_args: |- --model opus- --allowedTools Bash,Edit,Read,Write,Glob,Grep,WebSearch,WebFetch,Task,Skill- --append-system-prompt "You are operating in a GitHub Actions CI environment. Use /running-in-ci before starting work."-- - name: π Upload Claude Code session logs- if: always()- uses: actions/upload-artifact@v7- with:- name: claude-session-logs- path: /home/runner/.claude/projects/- retention-days: 30- if-no-files-found: warndiff --git a/.github/workflows/tend-ci-fix.yaml b/.github/workflows/tend-ci-fix.yamlnew file mode 100644index 000000000..7827f000f--- /dev/null+++ b/.github/workflows/tend-ci-fix.yaml@@ -0,0 +1,39 @@+# Generated by tend. Regenerate with: uvx tend init++name: tend-ci-fix+on:+ workflow_run:+ workflows: ["ci", "publish-docs"]+ types: [completed]+ branches: [main]++jobs:+ fix-ci:+ if: github.event.workflow_run.conclusion == 'failure'+ runs-on: ubuntu-24.04+ timeout-minutes: 60+ permissions:+ contents: write+ pull-requests: write+ id-token: write+ actions: read+ steps:+ - uses: actions/checkout@v6+ with:+ ref: main+ fetch-depth: 0+ fetch-tags: true+ token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}++ - uses: ./.github/actions/claude-setup++ - uses: max-sixty/tend@v1+ with:+ github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}+ bot_name: worktrunk-bot+ prompt: |+ /tend:tend-ci-fix ${{ github.event.workflow_run.id }}+ - Run URL: ${{ github.event.workflow_run.html_url }}+ - Commit: ${{ github.event.workflow_run.head_sha }}+ - Commit message: ${{ github.event.workflow_run.head_commit.message }}diff --git a/.github/workflows/tend-mention.yaml b/.github/workflows/tend-mention.yamlnew file mode 100644index 000000000..af5d66afa--- /dev/null+++ b/.github/workflows/tend-mention.yaml@@ -0,0 +1,158 @@+# Generated by tend. Regenerate with: uvx tend init++name: tend-mention+on:+ issues:+ types: [edited]+ issue_comment:+ types: [created, edited]+ pull_request_review_comment:+ types: [created, edited]++jobs:+ verify:+ if: |+ (github.event_name == 'issues' &&+ contains(github.event.issue.body, '@worktrunk-bot') &&+ github.event.issue.user.login != 'worktrunk-bot') ||+ (github.event_name == 'issue_comment' &&+ github.event.comment.user.login != 'worktrunk-bot') ||+ (github.event_name == 'pull_request_review_comment' &&+ github.event.comment.user.login != 'worktrunk-bot')+ concurrency:+ group: ${{ github.workflow }}-${{ github.event.issue.number || github.event.pull_request.number }}+ cancel-in-progress: true+ runs-on: ubuntu-24.04+ outputs:+ should_run: ${{ steps.check.outputs.should_run }}+ steps:+ - name: Verify bot engagement+ id: check+ run: |+ # Mentions always run+ if [ "$EVENT_NAME" = "issues" ]; then+ echo "should_run=true" >> "$GITHUB_OUTPUT"+ exit 0+ fi++ if [ -n "$COMMENT_BODY" ] && printf '%s\n' "$COMMENT_BODY" | grep -qF '@worktrunk-bot'; then+ echo "should_run=true" >> "$GITHUB_OUTPUT"+ exit 0+ fi++ # Non-mention: check bot engagement+ if [ "$EVENT_NAME" = "issue_comment" ]; then+ ISSUE_NUMBER="$ISSUE_OR_PR_NUMBER"++ if [ -z "$PR_URL" ]; then+ if [ "$ISSUE_AUTHOR" = "worktrunk-bot" ]; then+ echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0+ fi+ if printf '%s\n' "$ISSUE_BODY" | grep -qF '@worktrunk-bot'; then+ echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0+ fi+ BOT_COMMENTS=$(gh api "repos/$GITHUB_REPOSITORY/issues/$ISSUE_NUMBER/comments" \+ --jq '[.[] | select(.user.login == "worktrunk-bot")] | length')+ if [ "$BOT_COMMENTS" -gt "0" ]; then+ echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0+ fi+ echo "should_run=false" >> "$GITHUB_OUTPUT"; exit 0+ fi++ PR_NUMBER="$ISSUE_NUMBER"+ else+ PR_NUMBER="$EVENT_PR_NUMBER"+ fi++ PR_AUTHOR=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json author --jq '.author.login')+ if [ "$PR_AUTHOR" = "worktrunk-bot" ]; then+ echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0+ fi++ BOT_REVIEWS=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/reviews" \+ --jq '[.[] | select(.user.login == "worktrunk-bot")] | length')+ if [ "$BOT_REVIEWS" -gt "0" ]; then+ echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0+ fi++ BOT_COMMENTS=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" \+ --jq '[.[] | select(.user.login == "worktrunk-bot")] | length')+ if [ "$BOT_COMMENTS" -gt "0" ]; then+ echo "should_run=true" >> "$GITHUB_OUTPUT"; exit 0+ fi++ echo "should_run=false" >> "$GITHUB_OUTPUT"+ env:+ GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ EVENT_NAME: ${{ github.event_name }}+ COMMENT_BODY: ${{ github.event.comment.body }}+ ISSUE_BODY: ${{ github.event.issue.body }}+ ISSUE_OR_PR_NUMBER: ${{ github.event.issue.number }}+ ISSUE_AUTHOR: ${{ github.event.issue.user.login }}+ PR_URL: ${{ github.event.issue.pull_request.url }}+ EVENT_PR_NUMBER: ${{ github.event.pull_request.number }}++ - name: React to mention+ if: |+ steps.check.outputs.should_run == 'true'+ && github.event.comment+ && contains(github.event.comment.body, '@worktrunk-bot')+ run: |+ gh api "repos/$REPO/issues/comments/$COMMENT_ID/reactions" -f content=eyes 2>/dev/null || \+ gh api "repos/$REPO/pulls/comments/$COMMENT_ID/reactions" -f content=eyes 2>/dev/null || true+ env:+ REPO: ${{ github.repository }}+ COMMENT_ID: ${{ github.event.comment.id }}+ GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}++ handle:+ needs: verify+ if: needs.verify.outputs.should_run == 'true'+ runs-on: ubuntu-24.04+ timeout-minutes: 60+ permissions:+ contents: write+ pull-requests: write+ id-token: write+ actions: read+ issues: write+ steps:+ - uses: actions/checkout@v6+ with:+ fetch-depth: 0+ fetch-tags: true+ token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}++ - name: Check out PR branch+ if: |+ (github.event_name == 'issue_comment' && github.event.issue.pull_request.url != '') ||+ github.event_name == 'pull_request_review_comment'+ run: |+ PR_STATE=$(gh pr view "$PR_NUMBER" --json state --jq '.state')+ if [ "$PR_STATE" = "OPEN" ]; then+ gh pr checkout "$PR_NUMBER"+ else+ echo "::warning::PR is $PR_STATE β staying on default branch"+ fi+ env:+ GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ PR_NUMBER: ${{ github.event_name == 'issue_comment' && github.event.issue.number || github.event.pull_request.number }}++ - uses: ./.github/actions/claude-setup++ - uses: max-sixty/tend@v1+ with:+ github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}+ bot_name: worktrunk-bot+ prompt: >-+ ${{ github.event_name == 'issues'+ && format('An issue was updated with a mention of you ({0}). Read it and respond.', github.event.issue.html_url)+ || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@worktrunk-bot')+ && format('You were mentioned in an inline review comment on PR #{0} ({1}, review comment ID {2}). Read the full PR context (description, diff, recent comments, CI status) and respond. If they are requesting changes, make the changes, commit, and push. Reply in the review thread using `gh api repos/{3}/pulls/{0}/comments/{2}/replies -f body="..."` β do not create a new top-level comment.', (github.event_name == 'issue_comment' && github.event.issue.number || github.event.pull_request.number), github.event.comment.html_url, github.event.comment.id, github.repository))+ || (github.event_name == 'pull_request_review_comment'+ && format('A user left an inline review comment on a PR where you previously participated (PR #{0}, {1}, review comment ID {2}). Read the full context. Only respond if the comment is directed at you or requests changes. Reply in the review thread using `gh api repos/{3}/pulls/{0}/comments/{2}/replies -f body="..."`.', (github.event_name == 'issue_comment' && github.event.issue.number || github.event.pull_request.number), github.event.comment.html_url, github.event.comment.id, github.repository))+ || (contains(github.event.comment.body, '@worktrunk-bot')+ && format('You were mentioned in a comment ({0}). Read the full issue or PR (description, diff, recent comments, CI status) and respond. If they are requesting changes, make the changes, commit, and push.', github.event.comment.html_url))+ || format('A user commented on an issue/PR where you previously participated ({0}). Read the full context. Only respond if the comment is directed at you, asks a question you can help with, or requests changes you can make. A comment that responds to concerns you raised in a review is directed at you β briefly acknowledge that the concerns are resolved (or explain why they are not). If the conversation is between humans, exit silently.', github.event.comment.html_url)+ }}diff --git a/.github/workflows/tend-nightly.yaml b/.github/workflows/tend-nightly.yamlnew file mode 100644index 000000000..7a3f8a79a--- /dev/null+++ b/.github/workflows/tend-nightly.yaml@@ -0,0 +1,35 @@+# Generated by tend. Regenerate with: uvx tend init++name: tend-nightly+on:+ schedule:+ - cron: '17 6 * * *'+ workflow_dispatch:++jobs:+ nightly:+ runs-on: ubuntu-24.04+ timeout-minutes: 60+ permissions:+ contents: write+ pull-requests: write+ id-token: write+ actions: read+ issues: write+ steps:+ - uses: actions/checkout@v6+ with:+ ref: main+ fetch-depth: 0+ fetch-tags: true+ token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}++ - uses: ./.github/actions/claude-setup++ - uses: max-sixty/tend@v1+ with:+ github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}+ bot_name: worktrunk-bot+ prompt: |+ /tend:tend-nightlydiff --git a/.github/workflows/tend-renovate.yaml b/.github/workflows/tend-renovate.yamlnew file mode 100644index 000000000..202b8606c--- /dev/null+++ b/.github/workflows/tend-renovate.yaml@@ -0,0 +1,35 @@+# Generated by tend. Regenerate with: uvx tend init++name: tend-renovate+on:+ schedule:+ - cron: '17 9 * * 0'+ workflow_dispatch:++jobs:+ renovate:+ runs-on: ubuntu-24.04+ timeout-minutes: 60+ permissions:+ contents: write+ pull-requests: write+ id-token: write+ actions: read+ issues: write+ steps:+ - uses: actions/checkout@v6+ with:+ ref: main+ fetch-depth: 0+ fetch-tags: true+ token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}++ - uses: ./.github/actions/claude-setup++ - uses: max-sixty/tend@v1+ with:+ github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}+ bot_name: worktrunk-bot+ prompt: |+ /tend:tend-renovatediff --git a/.github/workflows/tend-review.yaml b/.github/workflows/tend-review.yamlnew file mode 100644index 000000000..866eafb47--- /dev/null+++ b/.github/workflows/tend-review.yaml@@ -0,0 +1,70 @@+# Generated by tend. Regenerate with: uvx tend init++name: tend-review+on:+ pull_request_target:+ types: [opened, synchronize, ready_for_review, reopened]+ pull_request_review:+ types: [submitted]++jobs:+ review:+ if: |+ (github.event_name == 'pull_request_target' &&+ github.event.pull_request.draft == false) ||+ (github.event_name == 'pull_request_review' &&+ github.event.pull_request.user.login == 'worktrunk-bot' &&+ github.event.review.user.login != 'worktrunk-bot' &&+ (github.event.review.state != 'approved' || github.event.review.body))+ concurrency:+ group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number }}+ cancel-in-progress: true+ runs-on: ubuntu-24.04+ timeout-minutes: 60+ permissions:+ contents: write+ pull-requests: write+ id-token: write+ actions: read+ issues: write+ steps:+ - name: Checkout (initial review)+ if: github.event_name == 'pull_request_target'+ uses: actions/checkout@v6+ with:+ ref: refs/pull/${{ github.event.pull_request.number }}/merge+ fetch-depth: 0+ fetch-tags: true+ token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}++ - name: Checkout (review response)+ if: github.event_name == 'pull_request_review'+ uses: actions/checkout@v6+ with:+ fetch-depth: 0+ fetch-tags: true+ token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}++ - name: Check out PR branch (review response)+ if: github.event_name == 'pull_request_review'+ run: gh pr checkout "$PR_NUMBER"+ env:+ GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ PR_NUMBER: ${{ github.event.pull_request.number }}++ - uses: ./.github/actions/claude-setup++ - uses: max-sixty/tend@v1+ with:+ github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}+ bot_name: worktrunk-bot+ use_sticky_comment: ${{ github.event_name == 'pull_request_target' }}+ prompt: >-+ ${{ github.event_name == 'pull_request_target'+ && format('/tend:tend-review {0}', github.event.pull_request.number)+ || format(+ 'A review was submitted on your PR #{0} ({1}). Read the review and full PR context (description, diff, comments, CI status), then respond appropriately. If changes were requested, make them, commit, and push. If questions were asked, answer them.',+ github.event.pull_request.number,+ github.event.review.html_url+ ) }}diff --git a/.github/workflows/tend-triage.yaml b/.github/workflows/tend-triage.yamlnew file mode 100644index 000000000..be5234976--- /dev/null+++ b/.github/workflows/tend-triage.yaml@@ -0,0 +1,41 @@+# Generated by tend. Regenerate with: uvx tend init++name: tend-triage+on:+ issues:+ types: [opened]++concurrency:+ group: ${{ github.workflow }}-${{ github.event.issue.number }}+ cancel-in-progress: true++jobs:+ triage:+ if: >-+ github.event.issue.user.type != 'Bot' &&+ github.event.issue.user.login != 'worktrunk-bot'+ runs-on: ubuntu-24.04+ timeout-minutes: 60+ permissions:+ contents: write+ pull-requests: write+ id-token: write+ actions: read+ issues: write+ steps:+ - uses: actions/checkout@v6+ with:+ ref: main+ fetch-depth: 0+ fetch-tags: true+ token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}++ - uses: ./.github/actions/claude-setup++ - uses: max-sixty/tend@v1+ with:+ github_token: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}+ bot_name: worktrunk-bot+ prompt: |+ /tend:tend-triage ${{ github.event.issue.number }}