Turn a GitHub repo into a template, keep it current with an hourly scheduled rebuild and a startup script pull, and give an agent a prompt that commits a change and opens a pull request. Read when you want each session to start on the latest main and end with a PR.
A template built from your GitHub repo rebuilds every hour, so every session boots on a recent main. A startup script pulls once more at boot to close the gap between rebuilds. An agent on that template takes one prompt, adds a markdown file under memories/, and opens a pull request through Runtime. The PR shows up in GitHub with verified commits and only the agent’s change in the diff.The example repo is deliberately small: a memories/ folder where every run adds one .md file. Swap in your own repo and your own prompt once the loop works.
If the goal is for the agent to remember things across sessions, keep that memory in Notion or Confluence instead of a repo. Your team can read and edit it directly, and it needs no PR or rebuild. That is the recommended approach: Give an agent persistent memory in Notion or Confluence. Use this recipe when the change has to land in git.
Commit this file as scripts/runtm-start.sh on main. It runs on every session boot and pulls whatever landed after the last rebuild.
#!/usr/bin/env bash# Runs on every Runtime session boot. Pulls changes merged since the last template rebuild.cd "$(git rev-parse --show-toplevel)" || exit 0git pull --rebase --autostash --quiet || echo "startup pull failed; continuing on the snapshot" >&2
The script lives in the repo, so you can change it without rebuilding the template. The next pull picks up your edit.
2
Create the template from the repo
On Templates, create a template from the repo and the main branch, then build it. A repo of markdown files needs no AI setup step, so skip it.
3
Point the template at the startup script
Open the template, and on the Overview tab click Edit next to Template Settings. Set Startup Script Path to scripts/runtm-start.sh, switch Restart Services at Startup to Enabled so the script runs when a session boots, and save.
Template Settings in edit mode. The path is relative to the working directory.
4
Rebuild every hour
On the same Overview tab, set Auto Rebuild to Hourly. It saves right away. Each tick pulls the latest main and saves a fresh snapshot. When only the repo changed, it takes the fast rebuild path and skips the dependency install.
Auto Rebuild on the template's Overview tab. Times are UTC.
5
Create the agent
On Agents, create an agent and set its Default template to the one above. Give it short instructions so every run ends the same way.
You work in the memories repo. Every change ends with a pull request opened with runtm-pr. Never push to main.
6
Send the prompt that opens the PR
Start a session as the agent, from the dashboard or from a trigger, and send:
Run git pull --rebase. Add a file memories/<UTC timestamp>.md with a short note on today’s date and the latest commit on main. Commit it, then open a PR with runtm-pr "Add memory <UTC timestamp>". Reply with the PR URL.
runtm-pr is installed in every session. It creates the branch, pushes it and opens the PR in one step. To add commits to a PR the session already opened, the agent commits and runs runtm-push.
The session’s last reply is a PR URL. In GitHub, the PR adds exactly one file under memories/, its commits show Verified, and its base is the commit that was on main when the session started. On the template, the build history shows a rebuild at the top of every hour.
To get one PR per day without anyone sending the prompt, put the same prompt on a scheduled agent that runs on this template. Create it disabled, run it once, then enable it, as in Test a scheduled agent before enabling it.
Use runtm-pr, not git push or gh pr create. Raw pushes from the sandbox are unsigned, so repos that require signed commits block the merge. They also carry template setup changes, such as dependency installs, into the diff.
The startup script replaces the default service launch. When the script exists, Runtime runs it instead of the template’s per-service start commands. If the repo has a dev server, start it at the end of the script.
The startup pull runs in the background. It may still be running when the first prompt arrives. That is why the prompt starts with git pull --rebase. The hourly rebuild keeps the gap small either way.
Cron is in UTC.Hourly is 0 * * * *. A rebuild schedule needs Cloud Scheduler on the deployment; a 503 when saving means it is not configured there.
Running sessions keep their snapshot. A rebuild only affects sessions started after it.
Templates
What a snapshot contains, builds and fast rebuilds, and template secrets.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"Runtime","colors":{"primary":"#18181b","light":"#71717a","dark":"#18181b"},"favicon":"https://mintcdn.com/runtm/5BRbZxh1joq_9si2/images/favicon.svg?fit=max\u0026auto=format\u0026n=5BRbZxh1joq_9si2\u0026q=85\u0026s=957716cbd1f84c5995ece94d6ac63ffd","logo":{"light":"https://mintcdn.com/runtm/5BRbZxh1joq_9si2/images/logo-light.svg?fit=max\u0026auto=format\u0026n=5BRbZxh1joq_9si2\u0026q=85\u0026s=dd91f6d3dfa4840b854b016d7add405d","dark":"https://mintcdn.com/runtm/5BRbZxh1joq_9si2/images/logo-dark.svg?fit=max\u0026auto=format\u0026n=5BRbZxh1joq_9si2\u0026q=85\u0026s=996520fef61624cf8b0b4583342e3300"},"api":{"mdx":{"server":"https://app.runtm.com/api/cloud","auth":{"method":"bearer","name":null}}},"appearance":{"default":"light","strict":null},"background":{"decoration":null,"color":{"light":"#fafafa","dark":"#18181b"}},"footer":{"socials":{"github":"https://github.com/runtm-ai/runtm","x":"https://twitter.com/runtm_ai"}},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"GitHub","href":"https://github.com/runtm-ai/runtm","icon":"github"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"runtm","hasAudioNarration":false,"actualSubdomain":"runtm","customDomains":["docs.runtm.com"],"gitSource":{"type":"github","owner":"runtm-ai","repo":"runtm","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae513ed05ddb97afbab990f","collectionId":"63d087b9-cc50-4139-8512-4005e4c5a340","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae513ed05ddb97afbab990f"},"entitlements":{},"buildId":"6ae513ed05ddb97afbab990f","clientVersion":"0.0.4044","searchFilterCounts":[{"language":"default","tag":"API Reference","count":222},{"language":"default","tag":"Open Source","count":49},{"language":"default","tag":"Sessions","count":47},{"language":"default","tag":"Documentation","count":24},{"language":"default","tag":"Templates","count":22},{"language":"default","tag":"Context","count":21},{"language":"default","tag":"Guides","count":19},{"language":"default","tag":"CLI Reference","count":17},{"language":"default","tag":"Linear","count":16},{"language":"default","tag":"Skills","count":14}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"guides/recipes/repo-agent-opens-prs","slug":"/guides/recipes/repo-agent-opens-prs","pageMetadata":{"title":"Agent that opens a PR on your GitHub repo","sidebarTitle":"Agent that opens PRs on GitHub","description":"Turn a GitHub repo into a template, keep it current with an hourly scheduled rebuild and a startup script pull, and give an agent a prompt that commits a change and opens a pull request. Read when you want each session to start on the latest main and end with a PR.","keywords":["github","pull request","PR","runtm-pr","scheduled rebuild","auto rebuild","startup script","git pull","sync","memories","claude code"],"href":"/guides/recipes/repo-agent-opens-prs"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Turn a GitHub repo into a template, keep it current with an hourly scheduled rebuild and a startup script pull, and give an agent a prompt that commits a change and opens a pull request. Read when you want each session to start on the latest main and end with a PR.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,blockquote:`blockquote`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Card,CodeBlock,Frame,Heading,OptimizedImage,Step,Steps,Tip,Visibility}=_components;if(!Card)_missingMdxReference(`Card`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Visibility)_missingMdxReference(`Visibility`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`outcome`,children:`Outcome`}),`\n`,_jsxs(_components.p,{children:[`A template built from your GitHub repo rebuilds every hour, so every session boots on a recent `,_jsx(_components.code,{children:`main`}),`. A startup script pulls once more at boot to close the gap between rebuilds. An agent on that template takes one prompt, adds a markdown file under `,_jsx(_components.code,{children:`memories/`}),`, and opens a pull request through Runtime. The PR shows up in GitHub with verified commits and only the agent’s change in the diff.`]}),`\n`,_jsxs(_components.p,{children:[`The example repo is deliberately small: a `,_jsx(_components.code,{children:`memories/`}),` folder where every run adds one `,_jsx(_components.code,{children:`.md`}),` file. Swap in your own repo and your own prompt once the loop works.`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`If the goal is for the agent to remember things across sessions, keep that memory in Notion or Confluence instead of a repo. Your team can read and edit it directly, and it needs no PR or rebuild. That is the recommended approach: `,_jsx(_components.a,{href:`/guides/recipes/agent-memory-in-notion-or-confluence`,children:`Give an agent persistent memory in Notion or Confluence`}),`. Use this recipe when the change has to land in git.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`before-you-start`,children:`Before you start`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`The GitHub App is installed on the repo, so Runtime can clone it and open PRs.`}),`\n`,_jsx(_components.li,{children:`You are an org admin or owner. Creating, building and scheduling templates needs one of those roles.`}),`\n`,_jsxs(_components.li,{children:[`The repo has a `,_jsx(_components.code,{children:`memories/`}),` folder on `,_jsx(_components.code,{children:`main`}),` (an empty `,_jsx(_components.code,{children:`memories/.gitkeep`}),` is enough).`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`do-it`,children:`Do it`}),`\n`,_jsxs(Steps,{children:[_jsxs(Step,{title:`Add a startup script to the repo`,children:[_jsxs(_components.p,{children:[`Commit this file as `,_jsx(_components.code,{children:`scripts/runtm-start.sh`}),` on `,_jsx(_components.code,{children:`main`}),`. It runs on every session boot and pulls whatever landed after the last rebuild.`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`#!/usr/bin/env bash`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Runs on every Runtime session boot. Pulls changes merged since the last template rebuild.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`cd`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"$(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`git`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rev-parse `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`--show-toplevel`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`)\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ||`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` exit`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`git`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` pull`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --rebase`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --autostash`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --quiet`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ||`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` echo`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"startup pull failed; continuing on the snapshot\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >\u00262`})]}),`\n`]})})}),_jsx(_components.p,{children:`The script lives in the repo, so you can change it without rebuilding the template. The next pull picks up your edit.`})]}),_jsxs(Step,{title:`Create the template from the repo`,children:[_jsxs(_components.p,{children:[`On `,_jsx(_components.strong,{children:`Templates`}),`, create a template from the repo and the `,_jsx(_components.code,{children:`main`}),` branch, then build it. A repo of markdown files needs no AI setup step, so skip it.`]}),_jsx(Visibility,{for:`agents`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli: runtm-api template create --display-name \"Memories\" --github-repo \u003cowner>/\u003crepo> --github-branch main --skip-agent`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli-verify: runtm-api template get \u003ctemplate_id> | jq '{build_status}'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})})]}),_jsxs(Step,{title:`Point the template at the startup script`,children:[_jsxs(_components.p,{children:[`Open the template, and on the `,_jsx(_components.strong,{children:`Overview`}),` tab click `,_jsx(_components.strong,{children:`Edit`}),` next to `,_jsx(_components.strong,{children:`Template Settings`}),`. Set `,_jsx(_components.strong,{children:`Startup Script Path`}),` to `,_jsx(_components.code,{children:`scripts/runtm-start.sh`}),`, switch `,_jsx(_components.strong,{children:`Restart Services at Startup`}),` to `,_jsx(_components.strong,{children:`Enabled`}),` so the script runs when a session boots, and save.`]}),_jsx(Frame,{caption:`Template Settings in edit mode. The path is relative to the working directory.`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-startup-script.png?fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=6b320a9086fceeba49a09af7a0614b18`,alt:`Template Settings form with Restart Services at Startup enabled and Startup Script Path set to scripts/runtm-start.sh`,\"data-og-width\":`1720`,width:`1720`,\"data-og-height\":`1164`,height:`1164`,\"data-path\":`images/dashboard/template-startup-script.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-startup-script.png?w=280\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=01c19965e6d0c79d4ad72820be3beda5 280w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-startup-script.png?w=560\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=cb038c92f160ec56f6f1b55684caf046 560w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-startup-script.png?w=840\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=dc2f1a2fac595db54231bfb7a6058925 840w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-startup-script.png?w=1100\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=69e9cd0fce85f1083b3cafcb1a35e2b1 1100w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-startup-script.png?w=1650\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=48b407126bad6a7678238598811929ff 1650w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-startup-script.png?w=2500\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=164aec2c138064a8415a3c6dc1db6d1e 2500w`})}),_jsx(Visibility,{for:`agents`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli: runtm-api template update \u003ctemplate_id> --startup-script scripts/runtm-start.sh --restart-at-startup`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})})]}),_jsxs(Step,{title:`Rebuild every hour`,children:[_jsxs(_components.p,{children:[`On the same `,_jsx(_components.strong,{children:`Overview`}),` tab, set `,_jsx(_components.strong,{children:`Auto Rebuild`}),` to `,_jsx(_components.strong,{children:`Hourly`}),`. It saves right away. Each tick pulls the latest `,_jsx(_components.code,{children:`main`}),` and saves a fresh snapshot. When only the repo changed, it takes the fast rebuild path and skips the dependency install.`]}),_jsx(Frame,{caption:`Auto Rebuild on the template's Overview tab. Times are UTC.`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-auto-rebuild.png?fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=22f7cdd8cfb501af6643c94421eee7a3`,alt:`Auto Rebuild dropdown open with Off, Every 30 minutes, Hourly, Every 2 hours and Daily options, Hourly selected`,\"data-og-width\":`1720`,width:`1720`,\"data-og-height\":`502`,height:`502`,\"data-path\":`images/dashboard/template-auto-rebuild.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-auto-rebuild.png?w=280\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=937fb386feb0dde3d042718285829566 280w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-auto-rebuild.png?w=560\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=de9a38b02f4eac33c790ac58272d6909 560w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-auto-rebuild.png?w=840\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=321023e0b72f5420a5fe761665976e3a 840w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-auto-rebuild.png?w=1100\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=20f4e3855c0a0014f13c607a0d2afe57 1100w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-auto-rebuild.png?w=1650\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=2a5fc5e4a9dcf8c8f1b256f0969c056e 1650w, https://mintcdn.com/runtm/iJWxKfbB60RR5Rab/images/dashboard/template-auto-rebuild.png?w=2500\u0026fit=max\u0026auto=format\u0026n=iJWxKfbB60RR5Rab\u0026q=85\u0026s=659294ffcc45754b1944ee8bcf41f109 2500w`})}),_jsx(Visibility,{for:`agents`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli: runtm-api template update \u003ctemplate_id> --rebuild-schedule '0 * * * *'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli-verify: runtm-api template get \u003ctemplate_id> | jq '{rebuild_schedule}'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})})]}),_jsxs(Step,{title:`Create the agent`,children:[_jsxs(_components.p,{children:[`On `,_jsx(_components.strong,{children:`Agents`}),`, create an agent and set its `,_jsx(_components.strong,{children:`Default template`}),` to the one above. Give it short instructions so every run ends the same way.`]}),_jsxs(_components.blockquote,{children:[`\n`,_jsxs(_components.p,{children:[`You work in the memories repo. Every change ends with a pull request opened with `,_jsx(_components.code,{children:`runtm-pr`}),`. Never push to `,_jsx(_components.code,{children:`main`}),`.`]}),`\n`]}),_jsx(Visibility,{for:`agents`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli: runtm-api agents create --name \"Memory Keeper\" --template \u003ctemplate_id> --agent claude-code --instructions \"You work in the memories repo. Every change ends with a pull request opened with runtm-pr. Never push to main.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})})]}),_jsxs(Step,{title:`Send the prompt that opens the PR`,children:[_jsx(_components.p,{children:`Start a session as the agent, from the dashboard or from a trigger, and send:`}),_jsxs(_components.blockquote,{children:[`\n`,_jsxs(_components.p,{children:[`Run `,_jsx(_components.code,{children:`git pull --rebase`}),`. Add a file `,_jsx(_components.code,{children:`memories/\u003cUTC timestamp>.md`}),` with a short note on today’s date and the latest commit on main. Commit it, then open a PR with `,_jsx(_components.code,{children:`runtm-pr \"Add memory \u003cUTC timestamp>\"`}),`. Reply with the PR URL.`]}),`\n`]}),_jsx(Visibility,{for:`agents`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli: runtm-api session create --template-id \u003ctemplate_id> --agent-id \u003cagent_id> --agent claude-code`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli: runtm-api session prompt \u003csession_id> \"Run git pull --rebase. Add a file memories/\u003cUTC timestamp>.md with a short note on today's date and the latest commit on main. Commit it, then open a PR with runtm-pr \\\\\"Add memory \u003cUTC timestamp>\\\\\". Reply with the PR URL.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})}),_jsxs(_components.p,{children:[_jsx(_components.code,{children:`runtm-pr`}),` is installed in every session. It creates the branch, pushes it and opens the PR in one step. To add commits to a PR the session already opened, the agent commits and runs `,_jsx(_components.code,{children:`runtm-push`}),`.`]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`verify`,children:`Verify`}),`\n`,_jsxs(_components.p,{children:[`The session’s last reply is a PR URL. In GitHub, the PR adds exactly one file under `,_jsx(_components.code,{children:`memories/`}),`, its commits show `,_jsx(_components.strong,{children:`Verified`}),`, and its base is the commit that was on `,_jsx(_components.code,{children:`main`}),` when the session started. On the template, the build history shows a rebuild at the top of every hour.`]}),`\n`,_jsx(Visibility,{for:`agents`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli-verify: runtm-api session status \u003csession_id>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli-verify: runtm-api template build-logs-history \u003ctemplate_id> | jq '.logs[0].content'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})}),`\n`,_jsx(Heading,{level:`2`,id:`run-it-on-a-schedule`,children:`Run it on a schedule`}),`\n`,_jsxs(_components.p,{children:[`To get one PR per day without anyone sending the prompt, put the same prompt on a scheduled agent that runs on this template. Create it disabled, run it once, then enable it, as in `,_jsx(_components.a,{href:`/guides/recipes/test-scheduled-agent-before-enabling`,children:`Test a scheduled agent before enabling it`}),`.`]}),`\n`,_jsx(Visibility,{for:`agents`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`cli: runtm-api scheduled-agents create --name \"Daily memory\" --cron \"0 9 * * *\" --template \u003ctemplate_id> --agent claude-code --prompt \"\u003cthe prompt above>\" --disabled`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})}),`\n`,_jsx(Heading,{level:`2`,id:`gotchas`,children:`Gotchas`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Use `,_jsx(_components.code,{children:`runtm-pr`}),`, not `,_jsx(_components.code,{children:`git push`}),` or `,_jsx(_components.code,{children:`gh pr create`}),`.`]}),` Raw pushes from the sandbox are unsigned, so repos that require signed commits block the merge. They also carry template setup changes, such as dependency installs, into the diff.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`The startup script replaces the default service launch.`}),` When the script exists, Runtime runs it instead of the template’s per-service start commands. If the repo has a dev server, start it at the end of the script.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`The startup pull runs in the background.`}),` It may still be running when the first prompt arrives. That is why the prompt starts with `,_jsx(_components.code,{children:`git pull --rebase`}),`. The hourly rebuild keeps the gap small either way.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Cron is in UTC.`}),` `,_jsx(_components.strong,{children:`Hourly`}),` is `,_jsx(_components.code,{children:`0 * * * *`}),`. A rebuild schedule needs Cloud Scheduler on the deployment; a 503 when saving means it is not configured there.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Running sessions keep their snapshot.`}),` A rebuild only affects sessions started after it.`]}),`\n`]}),`\n`,_jsx(Card,{title:`Templates`,icon:`layer-group`,href:`/concepts/templates`,children:_jsx(_components.p,{children:`What a snapshot contains, builds and fast rebuilds, and template secrets.`})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Agent that opens a PR on your GitHub repo","sidebarTitle":"Agent that opens PRs on GitHub","description":"Turn a GitHub repo into a template, keep it current with an hourly scheduled rebuild and a startup script pull, and give an agent a prompt that commits a change and opens a pull request. Read when you want each session to start on the latest main and end with a PR.","keywords":["github","pull request","PR","runtm-pr","scheduled rebuild","auto rebuild","startup script","git pull","sync","memories","claude code"],"href":"/guides/recipes/repo-agent-opens-prs"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Outcome","slug":"outcome","depth":2,"children":[]},{"title":"Before you start","slug":"before-you-start","depth":2,"children":[]},{"title":"Do it","slug":"do-it","depth":2,"children":[]},{"title":"Verify","slug":"verify","depth":2,"children":[]},{"title":"Run it on a schedule","slug":"run-it-on-a-schedule","depth":2,"children":[]},{"title":"Gotchas","slug":"gotchas","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"runtm","siteName":"Runtime","title":"Agent that opens a PR on your GitHub repo - Runtime","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-30T17:18:43.919Z","originalFileLocation":"guides/recipes/repo-agent-opens-prs.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Turn a GitHub repo into a template, keep it current with an hourly scheduled rebuild and a startup script pull, and give an agent a prompt that commits a change and opens a pull request. Read when you want each session to start on the latest main and end with a PR.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Runtime\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Agent that opens a PR on your GitHub repo - Runtime\">\u003cmeta data-mint-head property=\"og:description\" content=\"Turn a GitHub repo into a template, keep it current with an hourly scheduled rebuild and a startup script pull, and give an agent a prompt that commits a change and opens a pull request. Read when you want each session to start on the latest main and end with a PR.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Runtime\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://runtm.mintlify.app/_mintlify/api/og/v2?division=Recipes\u0026amp;title=Agent+that+opens+a+PR+on+your+GitHub+repo\u0026amp;description=Turn+a+GitHub+repo+into+a+template%2C+keep+it+current+with+an+hourly+scheduled+rebuild+and+a+startup+script+pull%2C+and+give+an+agent+a+prompt+that+commits+a+change\u0026amp;theme=091400d6292a704b2a8cfd77\u0026amp;signature=79feaf78d7ae008752a72a0fdc93e70446ee9a0af6f6d1fc14c8253f0ecc6216\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Agent that opens a PR on your GitHub repo - Runtime\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Turn a GitHub repo into a template, keep it current with an hourly scheduled rebuild and a startup script pull, and give an agent a prompt that commits a change and opens a pull request. Read when you want each session to start on the latest main and end with a PR.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://runtm.mintlify.app/_mintlify/api/og/v2?division=Recipes\u0026amp;title=Agent+that+opens+a+PR+on+your+GitHub+repo\u0026amp;description=Turn+a+GitHub+repo+into+a+template%2C+keep+it+current+with+an+hourly+scheduled+rebuild+and+a+startup+script+pull%2C+and+give+an+agent+a+prompt+that+commits+a+change\u0026amp;theme=091400d6292a704b2a8cfd77\u0026amp;signature=79feaf78d7ae008752a72a0fdc93e70446ee9a0af6f6d1fc14c8253f0ecc6216\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/runtm/FI6B-a_qdEC-_rSp/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Runtime\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#18181b\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/recipes/repo-agent-opens-prs.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.runtm.com/#organization\",\"name\":\"Runtime\",\"url\":\"https://docs.runtm.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/runtm/5BRbZxh1joq_9si2/images/logo-light.svg?fit=max\u0026auto=format\u0026n=5BRbZxh1joq_9si2\u0026q=85\u0026s=dd91f6d3dfa4840b854b016d7add405d\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.runtm.com#website\",\"name\":\"Runtime\",\"url\":\"https://docs.runtm.com\",\"publisher\":{\"@id\":\"https://docs.runtm.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs#webpage\",\"url\":\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs\",\"name\":\"Agent that opens a PR on your GitHub repo\",\"description\":\"Turn a GitHub repo into a template, keep it current with an hourly scheduled rebuild and a startup script pull, and give an agent a prompt that commits a change and opens a pull request. Read when you want each session to start on the latest main and end with a PR.\",\"dateModified\":\"2026-10-30T17:18:43.919Z\",\"isPartOf\":{\"@id\":\"https://docs.runtm.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Recipes\",\"item\":\"https://docs.runtm.com/guides/recipes/connect-stripe-read-only\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Agent that opens a PR on your GitHub repo\",\"item\":\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs#article\",\"headline\":\"Agent that opens a PR on your GitHub repo\",\"name\":\"Agent that opens a PR on your GitHub repo\",\"description\":\"Turn a GitHub repo into a template, keep it current with an hourly scheduled rebuild and a startup script pull, and give an agent a prompt that commits a change and opens a pull request. Read when you want each session to start on the latest main and end with a PR.\",\"url\":\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs\",\"mainEntityOfPage\":{\"@id\":\"https://docs.runtm.com/guides/recipes/repo-agent-opens-prs#webpage\"},\"dateModified\":\"2026-10-30T17:18:43.919Z\",\"keywords\":\"github, pull request, PR, runtm-pr, scheduled rebuild, auto rebuild, startup script, git pull, sync, memories, claude code\",\"publisher\":{\"@id\":\"https://docs.runtm.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.runtm.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Runtime\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Runtime","nav":{"global":{"anchors":[{"anchor":"GitHub","href":"https://github.com/runtm-ai/runtm","icon":"github"}]},"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/introduction"}]},{"tab":"Guides","groups":[{"group":"Guides","pages":[{"title":"Guides","href":"/guides/overview"}]},{"group":"Payments operations","pages":[{"title":"Payment support agent","href":"/guides/payments/support-agent"},{"title":"Fraud and risk review agent","href":"/guides/payments/fraud-risk-agent"},{"title":"Merchant underwriting agent","href":"/guides/payments/underwriting-agent"},{"title":"Multi-agent: underwriting re-review with two approval gates","href":"/guides/payments/multi-agent-underwriting"}]},{"group":"Recipes","pages":[{"title":"Connect Stripe with a restricted read-only key","href":"/guides/recipes/connect-stripe-read-only"},{"title":"Add a KYB provider as a custom tool provider","href":"/guides/recipes/add-kyb-provider"},{"title":"Add an MCP server with an API-token connection","href":"/guides/recipes/add-mcp-server-with-token"},{"title":"Route one Linear team to a different template","href":"/guides/recipes/route-linear-team-to-template"},{"title":"Test a scheduled agent before enabling it","href":"/guides/recipes/test-scheduled-agent-before-enabling"},{"title":"Request an approval from inside a run","href":"/guides/recipes/request-approval-from-a-run"},{"title":"Delegate work to another agent","href":"/guides/recipes/delegate-to-another-agent"},{"title":"Give an agent persistent memory in Notion or Confluence","sidebarTitle":"Persistent memory in Notion or Confluence","description":"Connect Notion or Confluence to one agent and make a playbook page and a memory page its source of truth, so every run reads what earlier runs learned and writes back what it learned. Read when an agent should remember across sessions, or when your team already keeps playbooks in a wiki.","href":"/guides/recipes/agent-memory-in-notion-or-confluence"},{"title":"Agent that opens a PR on your GitHub repo","sidebarTitle":"Agent that opens PRs on GitHub","href":"/guides/recipes/repo-agent-opens-prs"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/cloud-api/overview"}]},{"tab":"Open Source","pages":[{"title":"Open Source","href":"/open-source/overview"}]},{"tab":"Release notes","pages":[{"title":"Release notes","href":"/release-notes"}]}]},"basePath":"","title":"Agent that opens a PR on your GitHub repo - Runtime","buildId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","deploymentId":"dpl_DeHjVRGfFnhYQwHnfC2pjeXXv8h9","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-DXXFP6nH.js","DynamicMarkdown-B54_zNBF.js","zoom-image-lightbox-BG6oD64b.js","lightbox-handle-r17bVUz3.js"]}