From c494828231a88aad18e18abc76b1cff03cf003f6 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 16 Apr 2026 11:57:02 +0000
Subject: [PATCH 1/3] Initial plan
From d1218eefeacdb09c765270d4b1d9b51898415091 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 16 Apr 2026 12:02:07 +0000
Subject: [PATCH 2/3] docs: add issue proposals for multi-ApiRunner repl
support
Agent-Logs-Url: https://github.com/counterfact/api-simulator/sessions/b28297e3-8729-426c-adda-86685faa0855
---
.../repl-multi-api-context-and-routes.md | 31 +++++++++++++++++++
...l-scenario-command-with-group-qualifier.md | 31 +++++++++++++++++++
...l-tab-completion-for-multi-api-scenario.md | 29 +++++++++++++++++
3 files changed, 91 insertions(+)
create mode 100644 .github/issue-proposals/repl-multi-api-context-and-routes.md
create mode 100644 .github/issue-proposals/repl-scenario-command-with-group-qualifier.md
create mode 100644 .github/issue-proposals/repl-tab-completion-for-multi-api-scenario.md
diff --git a/.github/issue-proposals/repl-multi-api-context-and-routes.md b/.github/issue-proposals/repl-multi-api-context-and-routes.md
new file mode 100644
index 000000000..418d329a1
--- /dev/null
+++ b/.github/issue-proposals/repl-multi-api-context-and-routes.md
@@ -0,0 +1,31 @@
+---
+title: "repl: expose multi-API context/routes by group name"
+labels:
+ - enhancement
+ - repl
+assignees: []
+milestone:
+---
+
+When Counterfact runs multiple `ApiRunner`s, the REPL currently uses only the first runner. This proposal updates REPL bootstrapping so all runners are available and scenario/route helpers can target each API by group key.
+
+## Context
+
+Multi-spec projects need to inspect and mutate state across APIs (for example `billing` and `inventory`) in one REPL session. Today, only the first runner is wired into `context`, `loadContext`, and `route`, so users cannot reliably operate on non-primary APIs.
+
+## Proposed change
+
+Update app/repl wiring so REPL receives all active runners and builds grouped affordances:
+
+- `context` becomes a map keyed by API group (`context.billing`, `context.inventory`, ...)
+- `routes` becomes a grouped map using the same keys
+- helper wiring is updated so grouped APIs can be addressed consistently
+- single-runner mode keeps current unqualified behavior for backwards compatibility
+
+## Acceptance criteria
+
+- [ ] REPL startup path passes all configured runners (not only the first) into REPL initialization
+- [ ] In multi-runner mode, `context` and `routes` are keyed by each runner's group name
+- [ ] Behavior for a single runner remains unchanged (`context` remains the root context object)
+- [ ] Group-key collisions or missing group names are handled deterministically and documented in code/tests
+- [ ] Unit tests cover single-runner and multi-runner REPL context wiring
diff --git a/.github/issue-proposals/repl-scenario-command-with-group-qualifier.md b/.github/issue-proposals/repl-scenario-command-with-group-qualifier.md
new file mode 100644
index 000000000..f2203105f
--- /dev/null
+++ b/.github/issue-proposals/repl-scenario-command-with-group-qualifier.md
@@ -0,0 +1,31 @@
+---
+title: "repl: add group-qualified .scenario command for multi-API"
+labels:
+ - enhancement
+ - repl
+assignees: []
+milestone:
+---
+
+Extend `.scenario` so multi-API sessions can choose which API runner's scenario registry and context are used.
+
+## Context
+
+Scenario scripts are loaded per runner (`//scenarios`). In multi-runner mode, `.scenario` needs an API qualifier to avoid ambiguity and to execute against the intended context/route helpers.
+
+## Proposed change
+
+Add dual command syntax:
+
+- single-runner: `.scenario ` (existing behavior)
+- multi-runner: `.scenario `
+
+The command should resolve the selected group, load that group's scenario module, and pass the group's `context`, `loadContext`, `route`, and `routes` into the scenario function.
+
+## Acceptance criteria
+
+- [ ] `.scenario ` executes scenarios for the selected group in multi-runner mode
+- [ ] Unknown group names produce a clear error message with available group keys
+- [ ] Invalid or missing arguments print mode-appropriate usage help
+- [ ] Single-runner `.scenario ` behavior remains unchanged
+- [ ] Unit tests cover parsing, error cases, and context binding for both single- and multi-runner modes
diff --git a/.github/issue-proposals/repl-tab-completion-for-multi-api-scenario.md b/.github/issue-proposals/repl-tab-completion-for-multi-api-scenario.md
new file mode 100644
index 000000000..3326682d6
--- /dev/null
+++ b/.github/issue-proposals/repl-tab-completion-for-multi-api-scenario.md
@@ -0,0 +1,29 @@
+---
+title: "repl: update tab completion for group-qualified .scenario"
+labels:
+ - enhancement
+ - repl
+assignees: []
+milestone:
+---
+
+Update REPL tab completion so `.scenario` completions reflect the new multi-API qualifier syntax while preserving the current single-API experience.
+
+## Context
+
+Current completion assumes `.scenario `. With multiple runners, users need completions for:
+
+1. available group keys after `.scenario `
+2. scenario paths/functions after `.scenario `
+
+## Proposed change
+
+Refactor the `.scenario` completer to operate in two stages for multi-runner mode and keep existing path/function completion for single-runner mode.
+
+## Acceptance criteria
+
+- [ ] In multi-runner mode, typing `.scenario ` offers available group keys
+- [ ] In multi-runner mode, typing `.scenario ` offers scenario path/function completions scoped to that group
+- [ ] Invalid groups do not crash completion and fall back gracefully
+- [ ] In single-runner mode, existing `.scenario ` completions are preserved
+- [ ] REPL tests assert completion behavior for both modes and nested scenario paths
From 2d9ebcf622ea1fe1919215ba61b99fff4316e1d1 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Thu, 16 Apr 2026 12:05:02 +0000
Subject: [PATCH 3/3] docs: link repl proposal files to parent issue 1893
Agent-Logs-Url: https://github.com/counterfact/api-simulator/sessions/b28297e3-8729-426c-adda-86685faa0855
---
.github/issue-proposals/repl-multi-api-context-and-routes.md | 1 +
.../repl-scenario-command-with-group-qualifier.md | 1 +
.../repl-tab-completion-for-multi-api-scenario.md | 1 +
3 files changed, 3 insertions(+)
diff --git a/.github/issue-proposals/repl-multi-api-context-and-routes.md b/.github/issue-proposals/repl-multi-api-context-and-routes.md
index 418d329a1..e9fb9e5d1 100644
--- a/.github/issue-proposals/repl-multi-api-context-and-routes.md
+++ b/.github/issue-proposals/repl-multi-api-context-and-routes.md
@@ -1,5 +1,6 @@
---
title: "repl: expose multi-API context/routes by group name"
+parentIssue: 1893
labels:
- enhancement
- repl
diff --git a/.github/issue-proposals/repl-scenario-command-with-group-qualifier.md b/.github/issue-proposals/repl-scenario-command-with-group-qualifier.md
index f2203105f..f606afeff 100644
--- a/.github/issue-proposals/repl-scenario-command-with-group-qualifier.md
+++ b/.github/issue-proposals/repl-scenario-command-with-group-qualifier.md
@@ -1,5 +1,6 @@
---
title: "repl: add group-qualified .scenario command for multi-API"
+parentIssue: 1893
labels:
- enhancement
- repl
diff --git a/.github/issue-proposals/repl-tab-completion-for-multi-api-scenario.md b/.github/issue-proposals/repl-tab-completion-for-multi-api-scenario.md
index 3326682d6..cdaec1c3f 100644
--- a/.github/issue-proposals/repl-tab-completion-for-multi-api-scenario.md
+++ b/.github/issue-proposals/repl-tab-completion-for-multi-api-scenario.md
@@ -1,5 +1,6 @@
---
title: "repl: update tab completion for group-qualified .scenario"
+parentIssue: 1893
labels:
- enhancement
- repl