Automation and integration
Separate review and posting
Configure GitHub credentials. Give the review job model credentials and the trusted poster GitHub write credentials. Transfer only the findings artifact between jobs. Upgrade producer and poster together. Obtain target facts from a trusted workflow event or live GitHub response. For a local run:
REPOSITORY_ROOT="$(git rev-parse --show-toplevel)"
REPOSITORY="$(gh repo view --json nameWithOwner --jq .nameWithOwner)"
PR_NUMBER="$(gh pr view --json number --jq .number)"
HEAD_SHA="$(gh pr view --json headRefOid --jq .headRefOid)"
BASE_REF="$(gh pr view --json baseRefName --jq .baseRefName)"
BOT_LOGIN='daydream[bot]'
Replace BOT_LOGIN with the installed App login.
Use a clean checkout at the approved head with the comparison base available locally.
Write an artifact without posting or applying fixes:
RUN_OUTPUT="$(mktemp -d)"
FINDINGS_ARTIFACT="$RUN_OUTPUT/findings.json"
daydream --review --non-interactive \
--pr-number "$PR_NUMBER" --approved-head-sha "$HEAD_SHA" \
--findings-out "$FINDINGS_ARTIFACT" \
--base "origin/$BASE_REF" "$REPOSITORY_ROOT"
In continuous integration (CI), obtain target facts again from the trusted poster's event context. Never accept target facts from review output. The following command validates artifact identity and writes pull request (PR) comments or a review:
daydream post-findings "$FINDINGS_ARTIFACT" \
--pr "$PR_NUMBER" --head-sha "$HEAD_SHA" \
--repo "$REPOSITORY" --bot-login "$BOT_LOGIN"
--target PATH selects the checkout for configuration, diagram evidence, and GitHub context. Default: Current directory.
--bot-login defaults to DAYDREAM_BOT_HANDLE. Retain the same bot identity for deduplication and stale-comment reconciliation.
Posting is not atomic. File comments can remain after final review creation fails.
Inspect existing comments before retrying.
See posting arguments and workflow trust boundaries.
Install a self-hosted bot
Authenticate gh with repository or organization access.
Set ANTHROPIC_API_KEY, or enter the key at the setup prompt.
Setup uses a browser callback to a local server for App registration.
Setup stores credentials and creates or reuses daydream/setup-bot.
Setup commits and pushes workflows, then opens a PR. Failures do not roll back earlier external changes.
daydream setup "$REPOSITORY_ROOT" --repo "$REPOSITORY"
Install the App when the browser opens its installation page. Merge the setup PR to enable workflows.
For organization secrets, replace --repo "$REPOSITORY" with --org ORGANIZATION.
--force repeats App registration.
Packaged workflows use Blacksmith runners. Change runs-on for other runners.
Use the setup guide for permissions, secrets, and manual installation.
Install one workflow variant per repository. Setup installs the split variant.
Owners, members, and collaborators request work through PR comments:
@BOT_HANDLE review
@BOT_HANDLE add sequence diagram
@BOT_HANDLE add flowchart
Replace BOT_HANDLE with the configured handle. Bot comments do not trigger work.
A changed head invalidates approval. Submit a new command comment for the new head.
Verify or recover setup
daydream setup "$REPOSITORY_ROOT" --repo "$REPOSITORY" --verify checks setup without writes.
Local App credentials enable installation and permission checks. --force has no effect with --verify.
After failed setup, inspect the App, setup branch, and PR before retrying.
See the verification contract for required components and credential limits.