Remedy Blueprint
How Critique constructs a Remedy execution blueprint — goals, allowed write scope, validation commands, and stop conditions.
When a user starts Remedy, Critique constructs a blueprint — a structured execution plan that constrains what the coding agent can do. The blueprint is the mechanism that makes Remedy bounded rather than open-ended.
Blueprint structure
version: '2026-03-23'
repository — owner, name, fullName
pullRequest — number, title, headSha, headRef, baseSha, clone URL
review — verdict, summary, body, strictness
execution:
maxLoops — 2 (hardcoded)
allowedWriteFiles — explicit list of files the agent may modify
suggestedValidationCommands — commands to run after patching
goals — what the agent is trying to accomplish
stopConditions — when the agent must stop
operatorInstructions — optional human-provided guidance
findings — structured findings from the review run
prompt — the fully assembled system promptGoals
Goals are built from the review findings:
- If there are findings: up to 6 findings are mapped to goals —
"Address {severity} finding \"{title}\" in {filePath}." - If there are no findings: two cautious goals are generated:
- "Review the existing artifact and confirm whether a code change is necessary before editing anything."
- "If no safe fix is justified, stop and return a human handoff instead of making speculative edits."
- If
operatorInstructionsis set, a prefixed goal is prepended:"Follow this operator request: {instructions}".
Allowed write files
The write scope is derived from the review:
- If findings have file paths: allowed files = finding file paths + related test files.
- If no finding paths exist: allowed files = up to 12 evidence files + up to 12 related test files.
- All paths are deduplicated.
The agent is explicitly told it cannot modify files outside this list. If a fix requires broader changes, the agent must stop and return a human handoff.
Validation commands
Validation commands are added based on the evidence:
- If any evidence file ends in
.ts,.tsx,.js, or.jsx→npm test - Always:
npm run lint - Always:
npm run build
Commands are deduplicated and trimmed.
Stop conditions
Four hardcoded stop conditions:
- Stop when all targeted findings are resolved and validation passes.
- Stop immediately if the required fix exceeds the allowed write scope.
- Stop after the second failed execution loop and return a human handoff.
Prompt assembly
The blueprint prompt is a single string with these sections in order:
- Identity: "You are Remedy, the execution layer for Critique."
- Context: Repository full name, PR number.
- Task: "Apply the smallest safe fix that resolves the review findings without widening scope."
- Operator instructions: Verbatim or "n/a".
- Review summary: Verbatim or "n/a".
- Findings list: Each finding as
- [{SEVERITY}] {title} @ {filePath}:{startLine}: {summary}, or a fallback message if none. - Allowed write scope: Bulleted file paths.
- Validation commands: Bulleted commands.
- Constraints:
- Stop after at most 2 execution loops.
- Prefer modifying existing files over introducing new architecture.
- If the fix requires broader repo surgery or unclear product decisions, stop and return a human handoff.
- Do not touch unrelated files.
- Reference review body: The full review body or "n/a".
Execution backends
| Backend | Description |
|---|---|
opencode-server | Runs against a self-hosted OpenCode server |
opencode-e2b | Runs in an E2B sandbox with isolation |
byoa | Bring-your-own agent — external execution surface |
The backend determines the RemedyRunnerDescriptor:
| Property | Description |
|---|---|
kind | Backend identifier |
label | Human-readable name |
executionSurface | Where code runs |
supportsIsolation | Whether the environment is sandboxed |
supportsValidationLoop | Whether validation commands can be re-run after patches |
Execution lifecycle
Remedy emits events as it progresses:
sandbox-created → repo-cloned → prompt-started → patch-produced
→ validation-started → validation-passed / validation-failed
→ validation-retrying (up to maxLoops)
→ committed → pushed → completedIf something goes wrong: scope-rejected, push-failed, or halted.
Each event includes a phase, status (running / completed / failed), detail, and createdAt.
Execution result
When Remedy finishes, it produces:
| Field | Description |
|---|---|
runner | Which backend executed |
session | Session ID and title |
sandbox | Sandbox ID and template (if applicable) |
diff | File diffs with before/after content and line counts |
validation | Validation command results (command, exit code, stdout, stderr, passed) |
events | Timeline of execution events |
push | Whether a commit was pushed, the SHA, URL, and message |
Max loops
Remedy is hardcoded to a maximum of 2 execution loops. If both loops fail validation, the agent halts and returns a human handoff rather than continuing to modify code. This is a safety constraint, not a configuration option.