-
Notifications
You must be signed in to change notification settings - Fork 0
docs: human-friendly README + three v2 relayflow use-case examples #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,65 +1,39 @@ | ||
| # flows | ||
| # relay(Flows) | ||
|
|
||
| **We are taking prompting and making it reliable, with natural rails and gates.** | ||
| **Step functions for coding agent workflows** | ||
|
|
||
| This is the clean-slate build of Relayflows: a durable execution engine that is | ||
| competitive with Temporal and Inngest and agentic-leading where they are | ||
| structurally blind. A Relayflow is a deterministic script that composes agentic | ||
| primitives — an LLM call, an agent, a virtual filesystem, memory, identity, | ||
| authorization — into anything from a one-shot pipeline to a resident harness to | ||
| an entire application. | ||
| Agent Relay is building infrastructure for autonomous agents. A relayflow is a readable step function | ||
| that runs on the relay and produces a verifiable artifact or result that can be paused | ||
| for human input and resumed from any step wherever needed. It is an agentic pipeline | ||
| that can load in any model + harness along with deterministic gates to generate | ||
| reliable results. | ||
|
|
||
| The constitution is [`docs/RFC-0001-everything-is-a-relayflow.md`](docs/RFC-0001-everything-is-a-relayflow.md). | ||
| Nothing in this repo may contradict it; changing it is a human decision. | ||
|
|
||
| ## Layout | ||
| ```ts | ||
| import { flow } from "@relayflows/surface"; | ||
|
|
||
| ``` | ||
| kernel/ relayflowd — Rust. Journal, scheduler, leases, timers, streams. One binary. | ||
| packages/sdk/ TypeScript-first authoring SDK. Compiles specs; speaks the journal protocol. | ||
| packages/surface/ @relayflows/surface — the TypeScript flow-authoring contract. | ||
| workflows/ The gates. Each gate is a relayflow; the build is orchestrated by relayflows. | ||
| docs/ RFC-0001 and design docs. | ||
| charter/ The Relayflow Lead. | ||
| ``` | ||
|
|
||
| ## Method | ||
|
|
||
| The rewrite is a program *of* relayflows: every capability ships as a relayflow, | ||
| and its acceptance gate is that it supports the real use case it exists for. | ||
| Nine gates, in `docs/RFC-0001` §3. Gate 1 first: a relayflow can run — the hello | ||
| ladder survives `kill -9` at every boundary. | ||
| export default flow("fix-failing-tests", async (f) => { | ||
| const result = await f | ||
| .run("npm test 2>&1; echo EXIT:$?") | ||
| .gate((out) => !out.includes("EXIT:0"), "tests are already green, nothing to fix"); | ||
|
|
||
| Private while we build. YC 2026-09-15 runs on this base. | ||
| const fix = await f | ||
| .agent("fixer", { | ||
| task: `The test suite is failing. Diagnose and fix it:\n${result}`, | ||
| workspace: "src/**: readwrite", | ||
| }) | ||
| .gate((r) => r.artifacts.length > 0, "the agent must actually change something"); | ||
|
|
||
| ## Cloud review swarm | ||
|
|
||
| Every pull request launches the cloud review swarm. Repository administrators | ||
| must configure three Actions secrets. The workflow fails during preflight, in | ||
| seconds and before submitting a run, when any of them is absent. | ||
|
|
||
| | Secret | What it is | How to obtain it | | ||
| |---|---|---| | ||
| | `RELAY_WORKSPACE_KEY` | Selects the messaging workspace the swarm runs in. | `agent-relay workspace key --reveal-secrets` | | ||
| | `CLOUD_API_ACCESS_TOKEN` | The Cloud **user session** access token. | `agent-relay cloud session --json --reveal-token` after a login dedicated to CI | | ||
| | `CLOUD_API_REFRESH_TOKEN` | That session's refresh token. | `~/.agentworkforce/relay/cloud-auth.json`, field `refreshToken`, from the same login | | ||
| f.done("success"); | ||
| }); | ||
| ``` | ||
|
|
||
| `CLOUD_API_URL` and `CLOUD_API_ACCESS_TOKEN_EXPIRES_AT` are not secret; the | ||
| workflow defaults them and either can be overridden with a repository variable | ||
| of the same name. | ||
| # Use Cases | ||
|
|
||
| A workspace key alone cannot run the swarm. `agent-relay cloud run` authenticates | ||
| to the Cloud API as a user session and as nothing else: the workspace key is read | ||
| only by the resolver that picks a messaging workspace, and `POST | ||
| /api/v1/workflows/prepare` — which `--sync-code` requires, and `--sync-code` is | ||
| how the swarm receives the PR diff — admits only a browser session or a token | ||
| carrying the `cli:auth` scope. Given no session, the CLI opens an interactive | ||
| device login that no runner can approve and exits after the grant expires. | ||
| Flows can be run locally or in production on our hosted cloud. We're built entire | ||
| applications using flows that are stacked to run in a sequence with review gates that | ||
| can run autonomously over days and weeks. Every agent session is observable and replayable. | ||
|
|
||
| **These tokens expire, and this is a stopgap.** A CLI login mints a 24-hour | ||
| access token backed by a 90-day refresh token, and every refresh rotates the | ||
| refresh token server-side — invalidating the copy held in the secret, which a | ||
| job cannot write back. Expect to re-mint `CLOUD_API_ACCESS_TOKEN` and | ||
| `CLOUD_API_REFRESH_TOKEN` roughly daily until Cloud can issue a long-lived, | ||
| non-refreshing CI token that carries `cli:auth` (the existing CI deployment | ||
| tokens carry only `deployments:ci:*` and cannot launch a workflow). | ||
| - Cloud pipeline to use agents to generate a social media post. The pipeline coordinates agents who do research, verify the post, check for authenticity, generate graphics, and gate on a human approval — [`examples/social-post-pipeline/`](examples/social-post-pipeline/) | ||
| - Pull request review pipeline with different agents looking at the pull request from different angles (security, optimization etc) and agents communicate when needed to reach consensus — [`examples/pr-review-pipeline/`](examples/pr-review-pipeline/) | ||
| - Dependency upgrade bot: deterministic check flags a dependency out of date which fires an agent who does the upgrade in a sandbox. This upgrade is gated on another agent verifying the entire application with computer use in another sandbox. If completely verified a pull request is opened up — [`examples/dependency-upgrade-bot/`](examples/dependency-upgrade-bot/) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,11 @@ consumers that tell gate-1 SDK work what `@relayflows/surface` must export. | |
| | Example | What it shows | | ||
| |---|---| | ||
| | [`research/`](research/) | Fan-out to three model lanes (Claude, Codex, Grok), two subagents each, one synthesis; postfix gates on the workspace; dynamic input. First real run: `research/runs/2026-09-02-agent-memory/`. | | ||
| | [`social-post-pipeline/`](social-post-pipeline/) | Research → draft → adversarial fact-check → graphic, gated on a human approval before anything publishes. Written directly against the real `@relayflows/surface` package. | | ||
| | [`pr-review-pipeline/`](pr-review-pipeline/) | Security/correctness/performance reviewer agents fan out in parallel, gated on writing their findings, then a consensus agent reconciles disagreement between them. | | ||
| | [`dependency-upgrade-bot/`](dependency-upgrade-bot/) | A deterministic check flags an outdated dependency; one agent upgrades it in a sandbox, a second, independent agent verifies the whole app with computer use in a separate sandbox before a PR opens. | | ||
|
|
||
| The last three are written directly against the real `@relayflows/surface` | ||
| package (`npm --prefix packages/surface run typecheck:examples`) rather than | ||
| against local shims — they typecheck today but don't run yet; each one's | ||
|
Comment on lines
+15
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This newly asserts that all three examples typecheck, but it provides only the command and no captured output. Repository evidence rules require every verification claim to carry both the literal command and its actual output, so add a reproducible transcript at an exact path or remove the verification claim. AGENTS.md reference: AGENTS.md:L90-L92 Useful? React with 👍 / 👎. |
||
| README says exactly what's real and what gate work it's waiting on. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # dependency-upgrade-bot | ||
|
|
||
| **Like I'm 5:** A checklist notices a library is out of date. A robot tries | ||
| upgrading it, but only in its own sandboxed corner where it can't break | ||
| anything real. A *second*, completely separate robot — in its own sandbox | ||
| that can't see the first robot's work except the summary — boots the | ||
| upgraded app and actually clicks through it like a real person would, to | ||
| make sure nothing broke. Only if that second robot is fully satisfied does | ||
| a pull request get opened. The upgrader saying "it works" counts for | ||
| nothing on its own. | ||
|
|
||
| ## The shape | ||
|
|
||
| ``` | ||
| npm outdated (deterministic, gated) → upgrade (agent, sandbox A) → verify with computer use (agent, sandbox B, gated) → open PR (deterministic, gated) → done | ||
| ``` | ||
|
|
||
| `dependency-upgrade-bot.flow.ts` is written against the real | ||
| `@relayflows/surface` package. The point of this example is the | ||
| **independence** of the two agent steps: | ||
|
|
||
| - The deterministic first gate refuses to even start an upgrade if nothing | ||
| is actually outdated — this isn't an agent's judgment call, it's | ||
| `npm outdated`'s own exit data. | ||
| - `upgrader` and `verifier` are given **different workspaces** | ||
| (`sandbox/upgrade` vs `sandbox/verify`). The verifier is deliberately never | ||
| told to trust the upgrader's summary of what it did — its task tells it to | ||
| boot the app and drive it itself. | ||
| - Both agent gates check for a **file the agent wrote** | ||
| (`sandbox/upgrade/CHANGES.md`, `sandbox/verify/PASSED`), not a string in | ||
| its response — an agent that says "all good!" without writing the marker | ||
| fails closed, same lesson as the other two examples in this directory. | ||
| - The PR only opens after the verifier's gate passes, and the final gate | ||
| checks that a real PR URL came back — not just that the `gh` command | ||
| exited 0. | ||
|
|
||
| ## Status: typechecks, does not run yet | ||
|
|
||
| ```sh | ||
| cd packages/surface && npm run typecheck:examples | ||
| ``` | ||
|
|
||
| - `f.agent(...)` builds a real step but parks without a worker attached, | ||
| same as every other example in this repo today. | ||
| - **The sandbox isolation is declared, not enforced.** RFC-0001 Appendix A | ||
| rule 1 (workspace-scoped permissions) is gate-8 kernel work; today nothing | ||
| stops the `upgrader` step from reading `sandbox/verify/` if the underlying | ||
| CLI isn't sandboxed itself. This flow is written so that the moment gate 8 | ||
| lands, "separate sandbox" starts meaning it. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| // dependency-upgrade-bot — a v2 relayflow (docs/SURFACE.md dialect). | ||
| // | ||
| // A deterministic check flags an out-of-date dependency, an agent performs | ||
| // the upgrade in its own sandboxed workspace, and a SECOND agent — in a | ||
| // SEPARATE sandbox, with no access to the upgrader's workspace — verifies | ||
| // the whole application still works using computer use (driving the app the | ||
| // way a person would, not just re-running unit tests) before a PR is ever | ||
| // opened. The upgrader's own claim of success is worth nothing on its own; | ||
| // only the independent verifier's passing artifact opens the PR. | ||
| // | ||
| // STATUS: typechecks against the real `@relayflows/surface` package (see | ||
| // ../tsconfig.json / `npm --prefix packages/surface run typecheck:examples`) | ||
| // but does not run yet — `f.agent` parks without an attached worker, and | ||
| // there is no kernel-enforced workspace isolation yet (RFC-0001 Appendix A | ||
| // rule 1 / gate 8), so today the "separate sandbox" boundary between | ||
| // upgrader and verifier is declared, not enforced. | ||
|
|
||
| import { flow } from "@relayflows/surface"; | ||
|
|
||
| export default flow( | ||
| "dependency-upgrade-bot", | ||
| { budget: "$4/run" }, | ||
| async (f) => { | ||
| const outdated = await f | ||
| .run("npm outdated --json 2>/dev/null || true") | ||
| .gate( | ||
| (out) => out.trim().length > 0 && out.trim() !== "{}", | ||
| "nothing is out of date — no upgrade to attempt", | ||
| ); | ||
|
|
||
| const upgrade = await f | ||
| .agent("upgrader", { | ||
| task: | ||
| `One or more dependencies are out of date:\n${outdated}\n\n` + | ||
| `Upgrade them, run the test suite, and fix anything the upgrade breaks. ` + | ||
| `Write a one-paragraph summary of what changed to sandbox/upgrade/CHANGES.md.`, | ||
| workspace: "sandbox/upgrade: readwrite", | ||
| }) | ||
| .gate( | ||
| (r) => r.artifacts.includes("sandbox/upgrade/CHANGES.md"), | ||
| "the upgrader must document what it changed", | ||
| ); | ||
|
|
||
| // A second agent, in a workspace the upgrader never touches, has to | ||
| // independently verify the result before anything ships. It gates on a | ||
| // file it wrote after actually driving the app, not on the upgrader's | ||
| // own summary. | ||
| const verification = await f | ||
| .agent("verifier", { | ||
| task: | ||
| `Read sandbox/upgrade/CHANGES.md. In this sandbox, install the ` + | ||
| `upgraded dependencies and boot the application. Using computer use, ` + | ||
| `click through the application's key flows the way a real user would. ` + | ||
| `If — and only if — everything works, write sandbox/verify/PASSED. ` + | ||
| `Otherwise write sandbox/verify/FAILED with exactly what broke.`, | ||
| workspace: "sandbox/verify: readwrite", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Once gate 8 enforces the declared workspace, this verifier can access only AGENTS.md reference: AGENTS.md:L3-L5 Useful? React with 👍 / 👎.
Comment on lines
+51
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 2182 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- flow excerpt ---'
cat -n examples/dependency-upgrade-bot/dependency-upgrade-bot.flow.ts | sed -n '1,100p'
printf '%s\n' '--- executor and workspace bindings ---'
rg -n -C 8 --glob '*.ts' \
'workspace|artifacts|materialize|snapshot|checkout|\.agent\(|\.run\(' \
packages/surface examplesRepository: AgentWorkforce/flows Length of output: 50376 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
cat -n examples/dependency-upgrade-bot/dependency-upgrade-bot.flow.ts | sed -n '1,100p'
rg -n -C 8 --glob '*.ts' 'workspace|artifacts|materialize|snapshot|checkout|\.agent\(|\.run\(' packages/surface examplesRepository: AgentWorkforce/flows Length of output: 50376 🤖 get_repo_knowledge executed:
Length of output: 2103 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- kernel workspace contract ---'
rg -n -C 6 --glob '*.{ts,md}' \
'workspace|artifact|diff|revision|cwd|isolation|materializ' \
kernel/relayflowd-core/src kernel/relayflowd/src docs/RFC-0001.md docs/SURFACE.md 2>/dev/null | head -n 300
printf '%s\n' '--- surface step execution contract ---'
cat -n packages/surface/src/context.ts | sed -n '1,180p'
cat -n packages/surface/src/step.ts | sed -n '1,180p'Repository: AgentWorkforce/flows Length of output: 6480 Make the verifier test the materialized upgrade revision.
🤖 Prompt for AI Agents |
||
| }) | ||
| .gate( | ||
| (r) => r.artifacts.includes("sandbox/verify/PASSED"), | ||
| "the upgrade only ships once an independent sandbox verifies it end to end", | ||
| ); | ||
|
|
||
| const pr = await f | ||
| .run( | ||
| 'gh pr create --title "Dependency upgrade (verified)" ' + | ||
| "--body-file sandbox/verify/PASSED", | ||
| ) | ||
|
Comment on lines
+65
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When GitHub accepts this request but the process crashes before the step completion is journaled, resuming retries AGENTS.md reference: AGENTS.md:L14-L15 Useful? React with 👍 / 👎.
Comment on lines
+65
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
All upgrade edits are made under Useful? React with 👍 / 👎. |
||
| .gate( | ||
| (out) => /https:\/\/github\.com\/.+\/pull\/\d+/.test(out), | ||
| "must actually open a PR, not just report success", | ||
| ); | ||
|
|
||
| f.done("success"); | ||
| }, | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # pr-review-pipeline | ||
|
|
||
| **Like I'm 5:** Instead of one reviewer reading your whole pull request, | ||
| three little reviewers each look for one thing — one only checks for | ||
| security holes, one only checks for logic bugs, one only checks for slow | ||
| code. They all work at the same time. Then a fourth robot reads what all | ||
| three wrote and specifically looks for fights — like one saying "this is | ||
| fine" and another saying "this is dangerous" about the exact same line. It | ||
| doesn't just let one opinion quietly win; it writes down that they disagree. | ||
|
|
||
| ## The shape | ||
|
|
||
| ``` | ||
| git diff → [security, correctness, performance] reviewers (parallel, gated) → consensus (agent, gated) → done | ||
| ``` | ||
|
|
||
| `pr-review-pipeline.flow.ts` is written against the real | ||
| `@relayflows/surface` package. It mirrors a real, shipping product's actual | ||
| mechanism — My Senior Dev's multi-agent PR review — in two layers: | ||
|
|
||
| - **Fan-out by lens, not by "review everything."** Each reviewer is told to | ||
| look at exactly one dimension and ignore the rest, and is gated on writing | ||
| its findings to its own file (`review/<lens>.json`) — even "no issues | ||
| found" has to be written down, so a reviewer can't pass by staying silent. | ||
| - **Reconciliation, not aggregation.** The `consensus` step's task is | ||
| explicitly to find *disagreement* between lenses on the same spot in the | ||
| diff and resolve or flag it — the same thing My Senior Dev's real | ||
| coordination engine does (`hasOppositeFixDirection`, | ||
| `looksLikeFalsePositiveDispute`) rather than just concatenating three | ||
| reports into one. | ||
|
|
||
| Unlike the other two examples in this directory, this one never calls | ||
| `f.human` — nothing here needs it to make sense as a demonstration. | ||
|
|
||
| ## Status: typechecks, does not run yet | ||
|
|
||
| ```sh | ||
| cd packages/surface && npm run typecheck:examples | ||
| ``` | ||
|
|
||
| `f.agent(...)` builds a real step but parks without a worker attached, same | ||
| as every other example in this repo today. Everything else in this flow — | ||
| the fan-out, the gates, the reconciliation step — is otherwise ordinary use | ||
| of the shipped `@relayflows/surface` contract. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| // pr-review-pipeline — a v2 relayflow (docs/SURFACE.md dialect). | ||
| // | ||
| // Multiple review agents look at the same diff from different angles — | ||
| // security, correctness, performance — in parallel, each gated on actually | ||
| // writing findings rather than just talking. A separate reconciliation agent | ||
| // then reads every lens's findings and resolves (or flags) disagreement | ||
| // between them: the same two-layer shape My Senior Dev's real multi-agent | ||
| // PR review uses — cheap fan-out first, then a reconciliation pass that | ||
| // looks specifically for conflicting verdicts rather than just concatenating | ||
| // opinions. | ||
| // | ||
| // STATUS: typechecks against the real `@relayflows/surface` package (see | ||
| // ../tsconfig.json / `npm --prefix packages/surface run typecheck:examples`) | ||
| // but does not run yet — `f.agent` parks without an attached worker. Unlike | ||
| // the other two examples, this one never calls `f.human`, so nothing here | ||
| // depends on that verb being wired up. | ||
|
|
||
| import { flow } from "@relayflows/surface"; | ||
|
|
||
| const LENSES = ["security", "correctness", "performance"] as const; | ||
| type Lens = (typeof LENSES)[number]; | ||
|
|
||
| export interface PrReviewInput { | ||
| /** e.g. "origin/main...HEAD", or a PR's merge-base range. */ | ||
| diffRange: string; | ||
| } | ||
|
|
||
| function findingsPath(lens: Lens): string { | ||
| return `review/${lens}.json`; | ||
| } | ||
|
|
||
| export default flow<PrReviewInput>( | ||
| "pr-review-pipeline", | ||
| { budget: "$3/run" }, | ||
| async (f, input) => { | ||
| const diff = await f | ||
| .run(`git diff ${input.diffRange}`) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🤖 get_repo_knowledge executed:
Length of output: 2122 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- flow example ---'
cat -n examples/pr-review-pipeline/pr-review-pipeline.flow.ts | sed -n '1,95p'
printf '%s\n' '--- run definitions and callers ---'
rg -n --glob '*.ts' --glob '*.tsx' --glob '*.js' --glob '*.mjs' '(^|[^[:alnum:]_])run\(|interface .*Run|type .*Run|class .*Run|diffRange|artifacts\.includes' packages examples | head -240Repository: AgentWorkforce/flows Length of output: 21627 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- surface run contract ---'
cat -n packages/surface/src/context.ts | sed -n '1,80p'
printf '%s\n' '--- authored executor ---'
cat -n packages/sdk/src/authored-flow-executor.ts | sed -n '90,140p'
printf '%s\n' '--- kernel command execution contract ---'
rg -n --glob '*.ts' --glob '*.md' --glob '*.json' 'shell|exec\(|spawn\(|command: string|step\.command|StepType\.Run|type: .run|type: .shell' packages kernel docs | head -240Repository: AgentWorkforce/flows Length of output: 8945 🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- documented run semantics ---'
cat -n docs/SURFACE.md | sed -n '160,195p'
printf '%s\n' '--- deterministic step schema and execution references ---'
cat -n packages/sdk/src/spec.ts | sed -n '110,140p;285,310p'
rg -n --glob '*.ts' --glob '*.rs' --glob '*.md' 'deterministic|/bin/sh -c|shell command|spawn.*command|Command::new|run\.spawned' kernel packages docs | head -260Repository: AgentWorkforce/flows Length of output: 38253 Injection (CWE-78): Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') Reachability: External · Exploitability: Moderate Do not interpolate
🤖 Prompt for AI Agents |
||
| .gate((out) => out.trim().length > 0, "nothing to review — the diff is empty"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
|
|
||
| await Promise.all( | ||
| LENSES.map((lens) => | ||
| f | ||
| .agent(`${lens}-reviewer`, { | ||
| task: | ||
| `Review this diff for ${lens} issues ONLY — ignore everything else. ` + | ||
| `Write every finding, or an explicit "no issues found", to ` + | ||
| `${findingsPath(lens)}.\n\n${diff}`, | ||
|
Comment on lines
+45
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
file='examples/pr-review-pipeline/pr-review-pipeline.flow.ts'
ast-grep outline "$file"
printf '\n--- target file ---\n'
cat -n "$file" | sed -n '1,120p'
printf '\n--- directly related symbols ---\n'
rg -n -C 3 'diffRange|f\.run|findingsPath|artifacts|PrReviewInput' examples/pr-review-pipeline packagesRepository: AgentWorkforce/flows Length of output: 38767 🤖 get_repo_knowledge executed:
Length of output: 8005 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- surface context ---'
cat -n packages/surface/src/context.ts | sed -n '1,180p'
printf '%s\n' '--- surface exports and agent/run contracts ---'
rg -n -C 5 'interface (Agent|Run|Step)|agent\s*[:(]|run\s*[:(]|artifacts|workspace|task' packages/surface/src packages/sdk/src docs/SURFACE.md
printf '%s\n' '--- executor command and agent handling ---'
rg -n -C 5 'git diff|spawn|exec|shell|AgentResult|artifacts|workspace|task' packages/sdk/src packages/surface/src kernel | head -n 320Repository: AgentWorkforce/flows Length of output: 50378 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- agent lowering and worker execution ---'
sed -n '130,170p' packages/sdk/src/compile.ts
sed -n '525,560p' packages/sdk/src/compile.ts
rg -n -C 5 'command|spawn|exec|shell|instruction|runAgentCli' packages/sdk/src/worker.ts packages/sdk/src/worker-cli.ts packages/sdk/src/compile.ts packages/sdk/src/authored-flow-executor.ts kernel/relayflowd/src
printf '%s\n' '--- relevant surface contract text ---'
sed -n '72,112p' docs/SURFACE.md
sed -n '120,175p' packages/sdk/src/spec.tsRepository: AgentWorkforce/flows Length of output: 50376 LLM Security (CWE-74): Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') Reachability: External · Exploitability: Moderate Treat the diff as untrusted data in agent prompts. The agent worker passes 🤖 Prompt for AI Agents |
||
| workspace: "review/: readwrite", | ||
| }) | ||
| .gate( | ||
| (r) => r.artifacts.includes(findingsPath(lens)), | ||
| `the ${lens} reviewer must write ${findingsPath(lens)}, even to report nothing`, | ||
|
Comment on lines
+51
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 8005 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- changed file excerpt ---'
sed -n '1,110p' examples/pr-review-pipeline/pr-review-pipeline.flow.ts
printf '%s\n' '--- direct definitions and related symbols ---'
rg -n -S "type PrReviewInput|interface PrReviewInput|findingsPath|artifacts|class .*Flow|f\.run|consensus|reviewer" examples/pr-review-pipeline . --glob '!node_modules' --glob '!dist' --glob '!build' | head -240Repository: AgentWorkforce/flows Length of output: 35400 🏁 Script executed: #!/bin/bash
set -eu
sed -n '1,110p' examples/pr-review-pipeline/pr-review-pipeline.flow.tsRepository: AgentWorkforce/flows Length of output: 3184 🤖 get_repo_knowledge executed:
Length of output: 8005 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- file ---'
cat -n examples/pr-review-pipeline/pr-review-pipeline.flow.tsRepository: AgentWorkforce/flows Length of output: 3736 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- surface artifact contracts ---'
rg -n -S "artifacts|interface .*Agent|type .*Agent|AgentResult|gate\(" packages docs examples README.md --glob '!dist' --glob '!build' | head -240
printf '%s\n' '--- surface package files ---'
git ls-files packages/surface packages/sdk | head -160Repository: AgentWorkforce/flows Length of output: 17384 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- surface result type ---'
cat -n packages/surface/src/context.ts
printf '%s\n' '--- artifact semantics in the repository ---'
sed -n '88,104p' examples/research/README.md
sed -n '1,115p' examples/research/research.flow.ts
printf '%s\n' '--- adapter artifact construction ---'
sed -n '235,260p' examples/research/shims/agent-cli.tsRepository: AgentWorkforce/flows Length of output: 9815 Validate artifact content before continuing.
🤖 Prompt for AI Agents |
||
| ), | ||
| ), | ||
| ); | ||
|
|
||
| // Reconciliation, not aggregation: this agent's job is to find the | ||
| // places two lenses disagree about the same spot in the diff (one says | ||
| // "fine", another says "block") and resolve or flag it, rather than let | ||
| // whichever verdict is read first silently win. | ||
| const consensus = await f | ||
| .agent("consensus", { | ||
| task: | ||
| `Read ${LENSES.map(findingsPath).join(", ")}. Where two reviewers ` + | ||
| `reached opposite verdicts on the same spot in the diff, resolve it ` + | ||
| `or mark it UNRESOLVED with both positions. Write your reconciled ` + | ||
| `verdict to review/consensus.json.`, | ||
| workspace: "review/: readwrite", | ||
| }) | ||
| .gate( | ||
| (r) => r.artifacts.includes("review/consensus.json"), | ||
| "the consensus step must write review/consensus.json", | ||
| ); | ||
|
|
||
| f.done("success"); | ||
| }, | ||
| ); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Match the final exit marker.
out.includes("EXIT:0")treats any occurrence as a successful test run. A failing test can print that text and cause the fixer to be skipped. Emit a unique marker and parse the final status line.🤖 Prompt for AI Agents