From 8d8da52358d8ff7a29a3f534ad1c4e418daf229e Mon Sep 17 00:00:00 2001 From: FlowmemoryAI <283694809+FlowmemoryAI@users.noreply.github.com> Date: Wed, 13 May 2026 20:23:07 -0500 Subject: [PATCH] Add FlowChain real-value pilot goal pack --- .../flowchain-real-value-pilot/README.md | 103 +++++++++++++ .../pilot-bridge-relayer.md | 62 ++++++++ .../pilot-chain-runtime.md | 54 +++++++ .../pilot-contracts.md | 59 ++++++++ .../pilot-control-plane-dashboard.md | 56 +++++++ .../flowchain-real-value-pilot/pilot-hq.md | 55 +++++++ .../pilot-ops-installer.md | 59 ++++++++ .../pilot-wallet-operator.md | 55 +++++++ ...unch-flowchain-real-value-pilot-agents.ps1 | 138 ++++++++++++++++++ 9 files changed, 641 insertions(+) create mode 100644 docs/agent-goals/flowchain-real-value-pilot/README.md create mode 100644 docs/agent-goals/flowchain-real-value-pilot/pilot-bridge-relayer.md create mode 100644 docs/agent-goals/flowchain-real-value-pilot/pilot-chain-runtime.md create mode 100644 docs/agent-goals/flowchain-real-value-pilot/pilot-contracts.md create mode 100644 docs/agent-goals/flowchain-real-value-pilot/pilot-control-plane-dashboard.md create mode 100644 docs/agent-goals/flowchain-real-value-pilot/pilot-hq.md create mode 100644 docs/agent-goals/flowchain-real-value-pilot/pilot-ops-installer.md create mode 100644 docs/agent-goals/flowchain-real-value-pilot/pilot-wallet-operator.md create mode 100644 infra/scripts/launch-flowchain-real-value-pilot-agents.ps1 diff --git a/docs/agent-goals/flowchain-real-value-pilot/README.md b/docs/agent-goals/flowchain-real-value-pilot/README.md new file mode 100644 index 00000000..3125d944 --- /dev/null +++ b/docs/agent-goals/flowchain-real-value-pilot/README.md @@ -0,0 +1,103 @@ +# FlowChain Real-Value Pilot Goal Pack + +Status: copy-ready `/goal` prompts for a capped real-value bridge pilot. + +Last updated: 2026-05-14. + +## Target + +Build the missing path between the current local/product FlowChain testnet and a +capped real-value pilot that can be exercised by the project owner with a tiny +amount on Base public network chain ID `8453`. + +This goal pack is for implementation, deployment tooling, operator checks, and +emergency controls. It does not claim broad public readiness. + +## Current Baseline + +Current `main` already has: + +- local/private product testnet package; +- `npm run flowchain:product-e2e`; +- local chain runtime, token launch, DEX pool/liquidity/swap smoke; +- wallet signing and product transaction schemas; +- control-plane API, explorer/workbench surfaces, and bridge local-credit smoke; +- second-computer local verification. + +Current long-loop agents are also working in these worktrees: + +- `E:\FlowMemory\flowmemory-chain` +- `E:\FlowMemory\flowmemory-crypto` +- `E:\FlowMemory\flowmemory-indexer` +- `E:\FlowMemory\flowmemory-dashboard` +- `E:\FlowMemory\flowmemory-bridge-full` +- `E:\FlowMemory\flowmemory-contracts` +- `E:\FlowMemory\flowmemory-review` +- `E:\FlowMemory\flowmemory-hardware` +- `E:\FlowMemory\flowmemory-research` +- `E:\FlowMemory\flowmemory-hq-review-loop` + +Real-value pilot agents must inspect those worktrees before coding and reuse +their completed work where practical. Do not rebuild duplicate systems. + +## Final Stop Condition + +The pilot is complete only when all of these pass from `main`: + +```powershell +npm run flowchain:l1-e2e +npm run flowchain:real-value-pilot:e2e +``` + +`flowchain:real-value-pilot:e2e` must prove: + +1. Base chain ID `8453` is verified before any live transaction path. +2. A deployed lockbox address is loaded from local ignored config, not hardcoded + into public docs as a blanket endorsement. +3. Per-deposit and total pilot caps are enforced on-chain. +4. A pause path blocks new deposits while preserving recovery/release flows. +5. A tiny supported-asset deposit can be observed from Base public network. +6. The relayer derives a deterministic bridge observation and credit. +7. The local FlowChain runtime credits the matching local account once. +8. Replay of the same Base event is rejected or idempotent with evidence. +9. Withdrawal intent/release path is implemented for the pilot mode. +10. Operator can stop the bridge, revoke authority, export evidence, and recover + from restart. +11. Dashboard/API show exact live/degraded/error state. +12. No private key, seed phrase, mnemonic, RPC credential, API key, or webhook is + committed, logged, exported, or returned from public local routes. + +## Local Secret Boundary + +Agents may add `.env.example`, config schemas, and scripts that read local +environment variables. They must not commit real keys or RPC credentials. + +Required local env names should be explicit and scoped, for example: + +```text +FLOWCHAIN_BASE8453_RPC_URL +FLOWCHAIN_BASE8453_DEPLOYER_PRIVATE_KEY +FLOWCHAIN_BASE8453_LOCKBOX_ADDRESS +FLOWCHAIN_PILOT_MAX_DEPOSIT_WEI +FLOWCHAIN_PILOT_TOTAL_CAP_WEI +FLOWCHAIN_PILOT_OPERATOR_ACK +``` + +## Prompt Files + +- `pilot-hq.md` +- `pilot-contracts.md` +- `pilot-bridge-relayer.md` +- `pilot-chain-runtime.md` +- `pilot-wallet-operator.md` +- `pilot-control-plane-dashboard.md` +- `pilot-ops-installer.md` + +## Launcher + +```powershell +cd E:\FlowMemory\flowchain-release +powershell -ExecutionPolicy Bypass -File .\infra\scripts\launch-flowchain-real-value-pilot-agents.ps1 +``` + +Run with `-DryRun` first when checking worktree paths. diff --git a/docs/agent-goals/flowchain-real-value-pilot/pilot-bridge-relayer.md b/docs/agent-goals/flowchain-real-value-pilot/pilot-bridge-relayer.md new file mode 100644 index 00000000..fd1c8540 --- /dev/null +++ b/docs/agent-goals/flowchain-real-value-pilot/pilot-bridge-relayer.md @@ -0,0 +1,62 @@ +/goal You are the FlowChain Real-Value Pilot Bridge Relayer agent. + +Worktree: E:\FlowMemory\flowmemory-live-bridge +Branch: agent/real-value-pilot-bridge + +Goal: implement the relayer path that observes a tiny capped deposit on Base public network chain ID `8453`, derives a deterministic bridge credit, applies it to local FlowChain exactly once, and supports pilot withdrawal/release evidence. + +Inspect first: +- current `services/bridge-relayer`; +- E:\FlowMemory\flowmemory-bridge-full active bridge-testnet work; +- E:\FlowMemory\flowmemory-live-contracts if it exists; +- current runtime bridge-credit handoff shape. + +Allowed folders: +- services/bridge-relayer/ +- fixtures/bridge/ +- schemas/flowmemory/bridge*.json +- infra/scripts/bridge-*.ps1 +- infra/scripts/flowchain-real-value*.ps1 +- docs/bridge/ +- docs/agent-runs/real-value-pilot-bridge/ + +Forbidden folders: +- contracts/ except generated ABI fixture or read-only docs coordination +- crates/ except read-only handoff review +- apps/dashboard/ +- crypto/ secret internals +- hardware/ + +Create and maintain: +- docs/agent-runs/real-value-pilot-bridge/PLAN.md +- docs/agent-runs/real-value-pilot-bridge/CHECKLIST.md +- docs/agent-runs/real-value-pilot-bridge/EXPERIMENTS.md +- docs/agent-runs/real-value-pilot-bridge/NOTES.md + +Quantitative acceptance: +1. `npm test --prefix services/bridge-relayer` passes. +2. Existing `npm run bridge:local-credit:smoke` passes. +3. New mock pilot E2E passes without external RPC. +4. New Base public-network observer verifies `eth_chainId == 0x2105`. +5. Observer rejects wrong chain IDs and unapproved contract addresses. +6. Observer supports confirmation depth configuration. +7. Deposit observation writes deterministic observation, credit, and evidence files. +8. Duplicate deposit event replay is rejected or idempotent with explicit evidence. +9. Credit handoff applies to local runtime exactly once. +10. Withdrawal intent/release evidence path exists for pilot mode. +11. Script prints exact next operator command after every step. +12. No private key, seed phrase, mnemonic, RPC credential, API key, or webhook appears in committed fixtures, logs, exports, or API payloads. +13. `npm run flowchain:real-value-pilot:e2e` includes this bridge path. +14. `npm run flowchain:product-e2e` still passes or the breakage is assigned. + +Feedback loop: +- Run bridge tests. +- Run mock pilot E2E. +- Run wrong-chain negative tests. +- Run local-credit smoke. +- Run product E2E. + +PR output: +- Include exact commands for mock mode and live observer mode. +- Include env vars required. +- Include failure/retry/replay behavior. diff --git a/docs/agent-goals/flowchain-real-value-pilot/pilot-chain-runtime.md b/docs/agent-goals/flowchain-real-value-pilot/pilot-chain-runtime.md new file mode 100644 index 00000000..6ef85459 --- /dev/null +++ b/docs/agent-goals/flowchain-real-value-pilot/pilot-chain-runtime.md @@ -0,0 +1,54 @@ +/goal You are the FlowChain Real-Value Pilot Chain Runtime agent. + +Worktree: E:\FlowMemory\flowmemory-live-chain +Branch: agent/real-value-pilot-chain + +Goal: make the local FlowChain runtime consume real-value pilot bridge credits deterministically and expose receipts/state required by the relayer, control plane, and dashboard. + +Inspect first: +- current `crates/flowmemory-devnet`; +- E:\FlowMemory\flowmemory-chain active long-loop work; +- bridge handoff files from bridge relayer worktrees. + +Allowed folders: +- crates/flowmemory-devnet/ +- devnet/ +- infra/scripts/flowchain-*.ps1 +- docs/agent-runs/real-value-pilot-chain/ +- local runtime docs under docs/ + +Forbidden folders: +- contracts/ +- services/bridge-relayer/ +- apps/dashboard/ +- crypto/ secret internals +- hardware/ + +Create and maintain: +- docs/agent-runs/real-value-pilot-chain/PLAN.md +- docs/agent-runs/real-value-pilot-chain/CHECKLIST.md +- docs/agent-runs/real-value-pilot-chain/EXPERIMENTS.md +- docs/agent-runs/real-value-pilot-chain/NOTES.md + +Quantitative acceptance: +1. `cargo test --manifest-path crates/flowmemory-devnet/Cargo.toml` passes. +2. Runtime supports bridge-credit asset/account mapping for the pilot. +3. Bridge credits are included in blocks exactly once. +4. Replay of the same credit is rejected or idempotent with evidence. +5. Runtime exposes receipt by id and by Base event reference. +6. Restart preserves bridge credit, local balance, token, DEX, and receipt state. +7. Export/import preserves deterministic roots for pilot state. +8. Multi-node/local-network smoke remains passing or is updated. +9. `npm run flowchain:real-value-pilot:e2e` exercises runtime credit. +10. `npm run flowchain:product-e2e` still passes. + +Feedback loop: +- Run focused Rust tests. +- Run cargo test. +- Run network smoke if available. +- Run pilot E2E and product E2E. + +PR output: +- Include state/receipt shape. +- Include exact commands run. +- Include remaining integration blockers. diff --git a/docs/agent-goals/flowchain-real-value-pilot/pilot-contracts.md b/docs/agent-goals/flowchain-real-value-pilot/pilot-contracts.md new file mode 100644 index 00000000..310606f5 --- /dev/null +++ b/docs/agent-goals/flowchain-real-value-pilot/pilot-contracts.md @@ -0,0 +1,59 @@ +/goal You are the FlowChain Real-Value Pilot Contracts agent. + +Worktree: E:\FlowMemory\flowmemory-live-contracts +Branch: agent/real-value-pilot-contracts + +Goal: build the contract side of the capped Base public-network pilot bridge. Reuse existing bridge/settlement contracts and active worktree changes where practical. Do not create a parallel bridge architecture. + +Inspect first: +- current main contracts and tests; +- E:\FlowMemory\flowmemory-contracts active long-loop work; +- E:\FlowMemory\flowmemory-bridge-full bridge event expectations. + +Allowed folders: +- contracts/ +- tests/ +- script/ +- docs/bridge/ +- docs/agent-runs/real-value-pilot-contracts/ + +Forbidden folders: +- crates/ +- services/ +- apps/dashboard/ +- crypto/ +- hardware/ + +Create and maintain: +- docs/agent-runs/real-value-pilot-contracts/PLAN.md +- docs/agent-runs/real-value-pilot-contracts/CHECKLIST.md +- docs/agent-runs/real-value-pilot-contracts/EXPERIMENTS.md +- docs/agent-runs/real-value-pilot-contracts/NOTES.md + +Quantitative acceptance: +1. `forge test` passes. +2. `npm run contracts:hardening` passes. +3. Lockbox supports chain ID `8453` deployment configuration. +4. Contract enforces per-deposit cap and total pilot cap. +5. Contract supports allowlisted asset(s) only. +6. Pause blocks deposits. +7. Authorized release/recovery path remains possible while paused. +8. Replay protection prevents duplicate release/deposit accounting. +9. Events contain enough deterministic data for the relayer to derive bridge observation IDs without assuming txHash/logIndex inside the contract. +10. Dry-run deployment script exists. +11. Broadcast deployment script requires explicit local env ack and never commits keys. +12. Verification/source command or instructions exist. +13. Contract docs explain owner, release authority, cap, pause, replay, and emergency assumptions. +14. `npm run flowchain:product-e2e` still passes or the breakage is assigned. + +Feedback loop: +- Run focused forge tests. +- Run `forge test`. +- Run `npm run contracts:hardening`. +- Run deployment dry run against local Anvil if scripts support it. +- Run `git diff --check`. + +PR output: +- Include deployed-address handling design. +- Include exact commands run. +- Include remaining real-value pilot blockers. diff --git a/docs/agent-goals/flowchain-real-value-pilot/pilot-control-plane-dashboard.md b/docs/agent-goals/flowchain-real-value-pilot/pilot-control-plane-dashboard.md new file mode 100644 index 00000000..3f5b0d3a --- /dev/null +++ b/docs/agent-goals/flowchain-real-value-pilot/pilot-control-plane-dashboard.md @@ -0,0 +1,56 @@ +/goal You are the FlowChain Real-Value Pilot Control-Plane/Dashboard agent. + +Worktree: E:\FlowMemory\flowmemory-live-control-dashboard +Branch: agent/real-value-pilot-control-dashboard + +Goal: expose and render the real-value pilot bridge lifecycle end to end: Base deposit observed, local credit applied, replay/retry status, withdrawal intent/release evidence, emergency state, and exact operator next steps. + +Inspect first: +- current services/control-plane and apps/dashboard; +- E:\FlowMemory\flowmemory-indexer active long-loop work; +- E:\FlowMemory\flowmemory-dashboard active long-loop work; +- bridge relayer/runtimes handoff shapes. + +Allowed folders: +- services/control-plane/ +- services/shared/ +- apps/dashboard/ +- schemas/flowmemory/ +- docs/agent-runs/real-value-pilot-control-dashboard/ +- control-plane/dashboard docs under docs/ + +Forbidden folders: +- contracts/ +- crates/ +- crypto/ secret internals +- hardware/ implementation + +Create and maintain: +- docs/agent-runs/real-value-pilot-control-dashboard/PLAN.md +- docs/agent-runs/real-value-pilot-control-dashboard/CHECKLIST.md +- docs/agent-runs/real-value-pilot-control-dashboard/EXPERIMENTS.md +- docs/agent-runs/real-value-pilot-control-dashboard/NOTES.md + +Quantitative acceptance: +1. `npm test --prefix services/control-plane` passes. +2. `npm run control-plane:smoke` passes. +3. `npm test --prefix apps/dashboard` passes. +4. `npm run build --prefix apps/dashboard` passes. +5. API exposes pilot status, deposit observations, credits, withdrawal intents, release evidence, cap status, pause status, retry status, and emergency status. +6. API rejects or redacts private key, seed phrase, mnemonic, RPC credential, API key, and webhook-shaped material. +7. Dashboard shows exact live/degraded/error state and next operator command. +8. Dashboard labels the pilot as capped owner testing, not broad public readiness. +9. Browser stores no private keys or RPC secrets. +10. `npm run flowchain:real-value-pilot:e2e` verifies API and dashboard evidence. +11. `npm run flowchain:product-e2e` still passes. + +Feedback loop: +- Run control-plane tests/smoke. +- Run dashboard tests/build. +- Run browser verification if available. +- Run pilot E2E and product E2E. + +PR output: +- List API methods/endpoints and dashboard sections. +- Include exact commands run. +- Include screenshots or browser verification notes if possible. diff --git a/docs/agent-goals/flowchain-real-value-pilot/pilot-hq.md b/docs/agent-goals/flowchain-real-value-pilot/pilot-hq.md new file mode 100644 index 00000000..f51a434d --- /dev/null +++ b/docs/agent-goals/flowchain-real-value-pilot/pilot-hq.md @@ -0,0 +1,55 @@ +/goal You are the FlowChain Real-Value Pilot HQ agent. + +Worktree: E:\FlowMemory\flowmemory-live-hq +Branch: agent/real-value-pilot-hq + +Goal: coordinate the capped real-value pilot until `npm run flowchain:real-value-pilot:e2e` exists and passes on main, together with `npm run flowchain:l1-e2e`. + +Start by reading current main and inspecting these active worktrees for reusable work: +- E:\FlowMemory\flowmemory-chain +- E:\FlowMemory\flowmemory-bridge-full +- E:\FlowMemory\flowmemory-contracts +- E:\FlowMemory\flowmemory-crypto +- E:\FlowMemory\flowmemory-indexer +- E:\FlowMemory\flowmemory-dashboard +- E:\FlowMemory\flowmemory-review +- E:\FlowMemory\flowmemory-hq-review-loop + +Allowed folders: +- docs/ +- infra/scripts/ +- package.json +- .github/ +- README.md + +Forbidden folders: +- crates/ +- contracts/ +- services/ +- crypto/ +- apps/dashboard/ +- hardware/ + +Create and maintain: +- docs/agent-runs/real-value-pilot-hq/PLAN.md +- docs/agent-runs/real-value-pilot-hq/CHECKLIST.md +- docs/agent-runs/real-value-pilot-hq/EXPERIMENTS.md +- docs/agent-runs/real-value-pilot-hq/NOTES.md + +Quantitative acceptance: +1. Create docs/FLOWCHAIN_REAL_VALUE_PILOT.md. +2. Add or update `npm run flowchain:real-value-pilot:e2e` as the final pilot gate. +3. The gate must fail clearly until contracts, bridge relayer, chain runtime, wallet/operator, control-plane/dashboard, and ops pieces exist. +4. Create an integration matrix mapping every required proof to owning agent and command. +5. Create a pilot go/no-go checklist for the project owner. +6. Keep public-readiness claims out of docs; this is a capped owner pilot. +7. `node infra/scripts/check-unsafe-claims.mjs` passes. +8. `git diff --check` passes. +9. Existing `npm run flowchain:product-e2e` remains passing, or the failure is documented with owner and next action. +10. Open a PR with exact commands run and current blockers. + +Feedback loop: +- Run `git diff --check`. +- Run `node infra/scripts/check-unsafe-claims.mjs`. +- Run the new pilot gate in incomplete mode if needed. +- Run `npm run flowchain:product-e2e` before PR if practical. diff --git a/docs/agent-goals/flowchain-real-value-pilot/pilot-ops-installer.md b/docs/agent-goals/flowchain-real-value-pilot/pilot-ops-installer.md new file mode 100644 index 00000000..ee249968 --- /dev/null +++ b/docs/agent-goals/flowchain-real-value-pilot/pilot-ops-installer.md @@ -0,0 +1,59 @@ +/goal You are the FlowChain Real-Value Pilot Ops/Installer agent. + +Worktree: E:\FlowMemory\flowmemory-live-ops +Branch: agent/real-value-pilot-ops + +Goal: make the capped real-value pilot runnable by the project owner from a second Windows computer with explicit env setup, dry-run checks, live observer mode, emergency stop, export evidence, and restart recovery. + +Inspect first: +- current installer and second-computer docs; +- E:\FlowMemory\flowmemory-review active installer work; +- current product E2E and long-loop l1-e2e scripts. + +Allowed folders: +- infra/scripts/ +- docs/ +- README.md +- package.json +- .github/ +- docs/agent-runs/real-value-pilot-ops/ + +Forbidden folders: +- crates/ +- contracts/ +- services/ +- crypto/ +- apps/dashboard/ +- hardware/ + +Create and maintain: +- docs/agent-runs/real-value-pilot-ops/PLAN.md +- docs/agent-runs/real-value-pilot-ops/CHECKLIST.md +- docs/agent-runs/real-value-pilot-ops/EXPERIMENTS.md +- docs/agent-runs/real-value-pilot-ops/NOTES.md + +Quantitative acceptance: +1. `npm run flowchain:real-value-pilot:e2e` exists. +2. Dry-run mode passes without live RPC or keys. +3. Live mode refuses to run unless all required env vars and explicit operator ack are present. +4. Script verifies Base chain ID `8453` before live observer/deploy actions. +5. Script verifies cap env values are tiny and nonzero. +6. Script prints the exact next command after deploy, observe, credit, withdraw, pause, resume, export evidence, and restart. +7. Emergency stop script exists. +8. Evidence export bundle excludes `.git`, `node_modules`, build targets, local vaults, private keys, and env files. +9. Second-computer docs include a step-by-step owner pilot path. +10. Troubleshooting covers wrong chain, wrong contract, replay, stalled relayer, locked Cargo target, port conflict, and missing credentials. +11. `node infra/scripts/check-unsafe-claims.mjs` passes. +12. `git diff --check` passes. +13. `npm run flowchain:product-e2e` still passes. + +Feedback loop: +- Run script parser checks. +- Run dry-run pilot E2E. +- Run unsafe-claims scan. +- Run product E2E. + +PR output: +- Include exact owner commands. +- Include exact env var list. +- Include exact commands run. diff --git a/docs/agent-goals/flowchain-real-value-pilot/pilot-wallet-operator.md b/docs/agent-goals/flowchain-real-value-pilot/pilot-wallet-operator.md new file mode 100644 index 00000000..09742e34 --- /dev/null +++ b/docs/agent-goals/flowchain-real-value-pilot/pilot-wallet-operator.md @@ -0,0 +1,55 @@ +/goal You are the FlowChain Real-Value Pilot Wallet/Operator agent. + +Worktree: E:\FlowMemory\flowmemory-live-wallet +Branch: agent/real-value-pilot-wallet + +Goal: build the local operator/wallet support needed to run the capped real-value pilot without committing secrets and without browser-side private-key handling. + +Inspect first: +- current `crypto` wallet CLI; +- E:\FlowMemory\flowmemory-crypto active long-loop work; +- bridge relayer env/config needs. + +Allowed folders: +- crypto/ +- schemas/flowmemory/ +- fixtures/crypto/ +- infra/scripts/flowchain-wallet*.ps1 +- docs/agent-runs/real-value-pilot-wallet/ +- wallet/operator docs under docs/ + +Forbidden folders: +- crates/ +- contracts/ +- services/ except read-only integration review +- apps/dashboard/ +- hardware/ + +Create and maintain: +- docs/agent-runs/real-value-pilot-wallet/PLAN.md +- docs/agent-runs/real-value-pilot-wallet/CHECKLIST.md +- docs/agent-runs/real-value-pilot-wallet/EXPERIMENTS.md +- docs/agent-runs/real-value-pilot-wallet/NOTES.md + +Quantitative acceptance: +1. `npm test --prefix crypto` passes. +2. Existing product wallet smoke passes. +3. New pilot wallet/operator E2E command exists and passes. +4. Local operator config can be created from env without committing secrets. +5. Public metadata export excludes private keys, seed phrases, mnemonics, RPC credentials, API keys, and webhooks. +6. Signing supports bridge credit acknowledgment, withdrawal intent, release evidence, and emergency pause/revoke messages where relevant. +7. Verification rejects wrong chain ID, wrong contract address, wrong operator, mutated payload, replay nonce, expired message, and missing cap fields. +8. CLI prints exact next commands for deploy/observe/credit/release workflow. +9. Runtime/control-plane can validate public envelopes without loading secret vault code. +10. `npm run flowchain:product-e2e` still passes. + +Feedback loop: +- Run focused crypto tests. +- Run wallet E2E. +- Run product smoke. +- Run pilot E2E if available. + +PR output: +- Include env/config boundary. +- Include exact commands run. +- Include remaining integration blockers. diff --git a/infra/scripts/launch-flowchain-real-value-pilot-agents.ps1 b/infra/scripts/launch-flowchain-real-value-pilot-agents.ps1 new file mode 100644 index 00000000..92641f32 --- /dev/null +++ b/infra/scripts/launch-flowchain-real-value-pilot-agents.ps1 @@ -0,0 +1,138 @@ +param( + [switch] $DryRun, + [switch] $NoBranchPrepare +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version Latest + +$repoRoot = (& git rev-parse --show-toplevel).Trim() +if ([string]::IsNullOrWhiteSpace($repoRoot)) { + throw "Run this script inside the FlowMemory repository." +} + +$promptRoot = Join-Path $repoRoot "docs\agent-goals\flowchain-real-value-pilot" + +$agents = @( + @{ + Name = "pilot-hq" + Worktree = "E:\FlowMemory\flowmemory-live-hq" + Branch = "agent/real-value-pilot-hq" + Prompt = "pilot-hq.md" + }, + @{ + Name = "pilot-contracts" + Worktree = "E:\FlowMemory\flowmemory-live-contracts" + Branch = "agent/real-value-pilot-contracts" + Prompt = "pilot-contracts.md" + }, + @{ + Name = "pilot-bridge-relayer" + Worktree = "E:\FlowMemory\flowmemory-live-bridge" + Branch = "agent/real-value-pilot-bridge" + Prompt = "pilot-bridge-relayer.md" + }, + @{ + Name = "pilot-chain-runtime" + Worktree = "E:\FlowMemory\flowmemory-live-chain" + Branch = "agent/real-value-pilot-chain" + Prompt = "pilot-chain-runtime.md" + }, + @{ + Name = "pilot-wallet-operator" + Worktree = "E:\FlowMemory\flowmemory-live-wallet" + Branch = "agent/real-value-pilot-wallet" + Prompt = "pilot-wallet-operator.md" + }, + @{ + Name = "pilot-control-dashboard" + Worktree = "E:\FlowMemory\flowmemory-live-control-dashboard" + Branch = "agent/real-value-pilot-control-dashboard" + Prompt = "pilot-control-plane-dashboard.md" + }, + @{ + Name = "pilot-ops-installer" + Worktree = "E:\FlowMemory\flowmemory-live-ops" + Branch = "agent/real-value-pilot-ops" + Prompt = "pilot-ops-installer.md" + } +) + +function Invoke-Git { + param( + [Parameter(Mandatory = $true)] + [string] $WorkingDirectory, + + [Parameter(Mandatory = $true)] + [string[]] $Arguments + ) + + & git -C $WorkingDirectory @Arguments + if ($LASTEXITCODE -ne 0) { + throw "git $($Arguments -join ' ') failed in $WorkingDirectory" + } +} + +function Test-DirtyWorktree { + param([Parameter(Mandatory = $true)][string] $Path) + + $status = & git -C $Path status --short + if ($LASTEXITCODE -ne 0) { + throw "Could not inspect worktree: $Path" + } + return [bool] $status +} + +Write-Host "Fetching origin/main..." +Invoke-Git -WorkingDirectory $repoRoot -Arguments @("fetch", "origin", "main") + +foreach ($agent in $agents) { + $worktree = $agent.Worktree + $branch = $agent.Branch + $promptPath = Join-Path $promptRoot $agent.Prompt + + if (-not (Test-Path -LiteralPath $promptPath)) { + throw "Missing prompt file: $promptPath" + } + + if (-not (Test-Path -LiteralPath $worktree)) { + Write-Host "Creating worktree $worktree on $branch" + if (-not $DryRun) { + & git -C $repoRoot worktree add -B $branch $worktree origin/main + if ($LASTEXITCODE -ne 0) { + throw "Failed to create worktree $worktree" + } + } + } + + if (-not $NoBranchPrepare -and (Test-Path -LiteralPath $worktree)) { + if (Test-DirtyWorktree -Path $worktree) { + Write-Warning "Skipping branch switch for dirty worktree: $worktree" + } + else { + Write-Host "Preparing $($agent.Name): $branch from origin/main" + if (-not $DryRun) { + Invoke-Git -WorkingDirectory $worktree -Arguments @("switch", "-C", $branch, "origin/main") + } + } + } + + $command = @" +`$prompt = Get-Content -Raw -LiteralPath "$promptPath" +Set-Location -LiteralPath "$worktree" +codex --cd "$worktree" -s danger-full-access -a never `$prompt +"@ + + Write-Host "Launching $($agent.Name) in $worktree" + if (-not $DryRun) { + Start-Process powershell.exe -ArgumentList @( + "-NoExit", + "-ExecutionPolicy", + "Bypass", + "-Command", + $command + ) + } +} + +Write-Host "FlowChain real-value pilot agent launch complete."