Deploy the Git Bot
A GitHub Action that reviews every pull request touching a prompt file and posts one comment: verdict, findings, suggested fixes. It runs in your CI on GitHub's own token - no Hosho GitHub App, no new permissions. The key at the bottom is the only step that needs an account.
Hosho Git (GitHub Action)
Runs in your CI. When a pull request changes a prompt file, it posts a comment on that PR in GitHub with the verdict and the fixes.
No Hosho GitHub App needed - it runs on GitHub’s own token, in your CI.
- 1.Add your
pfr_...key as a repo secret namedHOSHO_API_KEY- Settings → Secrets and variables → Actions → New repository secret. Create it below. - 2.Create
.github/workflows/hosho-prompt-review.ymlwith this content: - 3.Tell Hosho which model each prompt runs on - commit a
.github/hosho/models.md(below). Without it, model-specific checks are guessed or skipped.
name: Hosho Prompt Review
run-name: >-
Hosho Prompt Review -
${{ github.event_name == 'pull_request'
&& format('PR #{0}', github.event.pull_request.number)
|| github.event_name == 'issue_comment'
&& format('PR #{0} (slash cmd)', github.event.issue.number)
|| inputs.prompt_file }}
on:
pull_request:
paths:
- '**/*system-prompt*.md' # Adjust to match your prompt file naming pattern
# To match multiple patterns, add more lines:
# - '**/*user-prompt*.md'
issue_comment:
types: [created] # Enables /hosho-review and /hosho-improve slash commands
workflow_dispatch:
inputs:
prompt_file:
description: "Path to prompt file to review"
required: true
concurrency:
group: hosho-review-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
issues: write # Required - GitHub's PR comment API uses the issues endpoint
actions: write # Optional - enables showing prompt names in the run list
jobs:
review:
runs-on: ubuntu-latest
if: >-
github.event_name == 'workflow_dispatch'
|| (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
|| (github.event_name == 'issue_comment'
&& github.event.issue.pull_request != null
&& (contains(github.event.comment.body, '/hosho-review')
|| contains(github.event.comment.body, '/hosho-improve')))
steps:
# Slash commands need to look up the PR branch before checkout
- name: Get PR branch (slash command only)
if: github.event_name == 'issue_comment'
id: pr_details
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=${{ github.event.issue.number }}
PR_BRANCH=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json headRefName -q '.headRefName')
if [ -z "$PR_BRANCH" ]; then
echo "::error::Could not find PR branch for #$PR_NUMBER"
exit 1
fi
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
echo "pr_branch=$PR_BRANCH" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
if: github.event_name != 'issue_comment'
with:
fetch-depth: 0 # Required - the action needs git history to compare versions
- uses: actions/checkout@v4
if: github.event_name == 'issue_comment'
with:
fetch-depth: 0
ref: ${{ steps.pr_details.outputs.pr_branch }}
- uses: HOSHO-AI/Hosho-prompt-optimization-public@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Provided automatically by GitHub - do not create this secret
with:
api_key: ${{ secrets.HOSHO_API_KEY }}
file_pattern: '**/*system-prompt*.md'
prompt_file: ${{ github.event.inputs.prompt_file || '' }}
pr_number: ${{ steps.pr_details.outputs.pr_number || '' }}
models_config: .github/hosho/models.md # which model each prompt runs on - see step 3Adjust the file_pattern/paths glob to match your own prompt file naming.
Model pairing
For model-specific review, Hosho needs to know which model each prompt runs on - the workflow above reads .github/hosho/models.md. Without it, those checks are guessed from your architecture notes, or skipped if there are none.
It’s a markdown table mapping a path glob to a model (family or family/class). Most-specific glob wins.
# Models - which model each prompt runs on | Prompt path (glob) | Model | | -------------------- | ---------------- | | `agents/router/**` | openai/reasoning | | `agents/**` | claude | | `**/*prompt*.md` | gemini |
Families: claude · openai · gemini · deepseek · qwen · kimi · glm. Class is reasoning or standard (default standard). A path you don’t list falls back to Hosho’s own detection, and a typo never fails a review - so add rows as you go.
CI only. In the editor and the MCP you pick the model when you review - models.md doesn’t change those.
Your API key
One pfr_... key for the Git, the MCP and your coding agent. It starts on the Free plan - 5 review runs and 5 PR reviews a month, and unlimited checks.
Free, one click, and you come straight back to this page. The key is the only step that needs an account.