Publish artifact

From rp1-run/rp1 · View interactive version

Publish artifact is an AI agent skill from the GitHub repository rp1-run/rp1. Publish an rp1 artifact (investigation report, design doc, audit) from .rp1/work/ as an idempotent PR or issue comment instead of committing it to the repo; re-runs update the same comment in place.

How to use this skill

Skill file

Publish Artifact

Publish an rp1 artifact (markdown under .rp1/work/; frontmatter optional) as a PR or issue comment without committing the artifact file to the repo. Re-running updates the same comment in place.

The artifact file is never modified by this skill — it is read-only on the local side, write-only on the GitHub side.

### ⚠️ Always dry-run first on a real PR or issue

The skill writes to a real GitHub PR/issue comment by default. Before publishing to a PR/issue you care about (especially one with active reviewers), run with "dry_run": true first. A dry-run still resolves the target, validates, and runs the safety gates — it only skips the GitHub write — then returns the projected data.comment_body plus the data.action (post or patch) the real run would take. Once the projection looks right, re-run without dry_run to post.

When to invoke

When NOT to invoke

Gather the inputs

| Field | Required | How to determine |

|---|---|---|

| artifact_path | yes | The path to the artifact markdown the user wants to publish. A path outside .rp1/work/ is allowed (a warning is returned). |

| target | no | A PR/issue number or full GitHub PR/issue URL the user named. Omit it to default to the current branch's open PR. |

| dry_run | no | true when the user wants a preview, or on a first publish to a real target. Defaults to false (real post). |

| force | no | true only when the user explicitly wants to override a safety gate (closed/merged target, or a comment owned by another author). Defaults to false. See references/edge-cases.md. |

Procedure

The whole procedure runs as one command — the github-pr publish-comment agent-tool. Pipe a single JSON object on stdin and read the JSON result on stdout:

echo '{"artifact_path": "<path>", "target": "<pr-or-issue>", "dry_run": false, "force": false}' \
  | rp1 agent-tools github-pr publish-comment

Include only the fields you have: artifact_path is required; omit target, dry_run, and force when they are unset rather than guessing values.

That single process does everything: derive owner/repo from the git origin remote → resolve the PR/issue target → project the comment body → find any existing comment for this artifact via its marker → POST or PATCH (or, under dry_run, return the projected body and the action it would take, writing nothing). It calls the GitHub API directly; it never shells out to gh and never modifies the artifact file.

Run the one command. Do not re-implement these steps inline or call git/gh yourself.

The procedure threads state across steps — the projected body, the idempotency

doc_key, the chosen action, and the target comment id. The agent-tool holds

that state in one process. Pass the user's inputs straight through, read the JSON

output, and relay the result.

Reading the output

The command prints the standard agent-tools JSON envelope on stdout. The publish

fields are nested under data — read them as data.<field>, not at the top level:

{
  "success": true,
  "tool": "github-pr",
  "data": {
    "action": "post" | "patch",
    "comment_url": "https://github.com/...#issuecomment-...",
    "doc_key": "<rp1_doc_id or path:<relative-path>>",
    "size_bytes": 1234,
    "warnings": ["..."],
    "dry_run": false,
    "comment_body": "<projected body — present only on dry_run>"
  }
}

On success: relay data.action, data.comment_url, and any data.warnings.

On a refusal or error: the command exits non-zero and prints an error envelope on stderr — { "success": false, "tool": "github-pr", "data": null, "errors": [{ "message": "<reason>" }] }. Show the message verbatim (foreign-owned comment without force, multiple matching comments, size cap, no PR for the current branch, closed/merged target without force, auth/network error). The artifact and any existing comment are left untouched. For foreign-owned or closed/merged cases, the user can re-run with "force": true if they intend to override; multiple-match refusals require manual dedup and force does not bypass them.

References (read these — they encode the spec)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.