HumanLayer Skills: instruction preservation and reviewable control loops
Read HumanLayer /iterate routing: role checks, PR markers and raw context
Trace the workflow preflight and Bun prompt helper while distinguishing a routing marker from authentication and commentary from trusted instructions.
What you will learn
- The preflight tries to route before expensive setup
- The helper assembles context rather than validating it all
- Follow the final side effects as well as prompt construction
Before you start
- Repository instructions and basic GitHub Actions concepts
- Understanding of review scope and persistent agent context
Design a bounded, inspectable workflow and distinguish template assumptions from tested behavior.
Key takeaways
- A hidden marker routes work; it is not a cryptographic trust proof.
- Raw PR context and missing memory need explicit handling.
- Prompt assembly can lead to real commit and push side effects.
The preflight tries to route before expensive setup
For issue comments, the template job condition checks that the issue is a PR, that the comment starts with /iterate and that author_association is OWNER, MEMBER or COLLABORATOR. A later step fetches the PR body and looks for the workflow’s hidden marker before checkout and dependency setup.
The marker identifies which workflow should handle the request. It is not a signature and should not be treated as independent authentication. Review the role condition and the trustworthiness of the selected PR branch separately; a matching string in a PR body does not make every file on that branch safe to execute with secrets.
The helper assembles context rather than validating it all
agent-iteration.ts has footer and prompt modes. Footer renders visible instructions and a hidden workflow marker. Prompt reads memory, fetches the PR and comments through GitHub CLI, and assembles them with the requested feedback. It includes raw PR bodies and comment text as context for the agent.
Its missing-or-unreadable memory helper returns an empty string, so the assembled prompt can continue with an empty-memory notice. That fallback is not evidence that standing exclusions were loaded. For consequential loops, decide whether unavailable memory should instead block execution and surface a diagnostic.
Follow the final side effects as well as prompt construction
The helper’s generated instructions ask the agent to update the existing branch, retain durable feedback and commit and push changes. The workflow also contains an iteration fallback that stages all changed files before committing. That broad staging behavior needs scope review before adapting the skeleton to a repository with unrelated modifications.
Our companion model exercises a stricter synthetic admission policy with explicit command boundaries and review-capacity behavior. It does not execute this Bun helper, GitHub expressions, Git operations or a real comment event. Passing that model is not proof of template security or successful credentialed iteration.
Decision guide
| Criterion | Option A | Option B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
Implementation steps
- 1
Trace job eligibility before marker lookup.
- 2
Check branch trust separately from comment routing.
- 3
Decide how missing memory affects admission.
- 4
Review every staging and push path before adoption.
Copy-ready example
{
"inspection": true,
"markerPurpose": "routing",
"markerIsSignature": false,
"memoryReadFailure": "upstream helper uses empty string",
"rawCommentsIncluded": true,
"credentialedIterationTested": false
}Frequently asked questions
Does the hidden marker authenticate a PR?
No. It is a routing convention, not a signature or complete trust check.
Did these tests execute GitHub iteration?
No. They exercised a separate synthetic policy model without network or Git mutations.