@bridge_gpt/mcp-server 0.2.58 → 0.2.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +105 -109
  2. package/build/agent-registry.js +15 -0
  3. package/build/agent-utils.js +16 -8
  4. package/build/claude-user-config-doctor.js +1 -35
  5. package/build/codex-bridge-profile.js +1 -1
  6. package/build/commands.generated.js +5 -6
  7. package/build/conductor/bridge-api-client.js +149 -0
  8. package/build/conductor/bring-up-facts.js +1 -1
  9. package/build/conductor/claude-hook.js +16 -16
  10. package/build/conductor/doctor.js +24 -19
  11. package/build/conductor/epic-implementer-cli.js +38 -5
  12. package/build/conductor/epic-reconcile.js +1 -1
  13. package/build/conductor/epic-runtime.js +10 -10
  14. package/build/conductor/errors.js +3 -3
  15. package/build/conductor/file-scope-guard.js +4 -4
  16. package/build/conductor/git-ci-types.js +1 -1
  17. package/build/conductor/git-inspection.js +2 -2
  18. package/build/conductor/install-doctor.js +6 -6
  19. package/build/conductor/merge-ledger.js +2 -2
  20. package/build/conductor/pr-ci-producer.js +6 -6
  21. package/build/conductor/pr-review-producer.js +2 -2
  22. package/build/conductor/producer-ledger.js +2 -0
  23. package/build/conductor/readiness-sections.js +7 -7
  24. package/build/conductor/readiness.js +2 -2
  25. package/build/conductor/recovery-cli.js +243 -12
  26. package/build/conductor/recovery-operations.js +56 -4
  27. package/build/conductor/repair-contract.js +38 -4
  28. package/build/conductor/spec-review-producer.js +6 -6
  29. package/build/conductor/store.js +10 -10
  30. package/build/conductor/supervisor-config.js +14 -14
  31. package/build/conductor/supervisor-ledger.js +2 -2
  32. package/build/conductor/supervisor-message-relay.js +2 -2
  33. package/build/conductor/worker-ledger-cli.js +19 -19
  34. package/build/conductor-bundle-artifacts.js +2 -2
  35. package/build/doctor.js +16 -294
  36. package/build/drive-epic.js +65 -71
  37. package/build/epic-implementer-bin.js +22 -17
  38. package/build/epic-implementer-claude-hook-bin.js +4 -2
  39. package/build/epic-implementer-env.js +155 -0
  40. package/build/epic-integration-pr.js +2 -2
  41. package/build/epic-shared/bridge-client.js +773 -0
  42. package/build/epic-shared/cut-protocol.js +392 -0
  43. package/build/executor/env.js +19 -8
  44. package/build/executor/heartbeat.js +1 -1
  45. package/build/executor/job-errors.js +3 -3
  46. package/build/executor/job-runner.js +1 -1
  47. package/build/executor/merge-job.js +35 -3
  48. package/build/executor/observation.js +1 -1
  49. package/build/executor/preflight.js +1 -1
  50. package/build/executor/prompt-spec.js +1 -1
  51. package/build/executor/reconcile-overlap-job.js +10 -130
  52. package/build/executor/reconcile-overlap-types.js +1 -1
  53. package/build/executor/runner.js +1 -1
  54. package/build/implement-epic/cli.js +1 -1
  55. package/build/index.js +181 -218
  56. package/build/init.js +20 -28
  57. package/build/install-bridge-conductor.js +7 -7
  58. package/build/install-bridge.js +199 -7
  59. package/build/mcp-host-entry-adapter.js +6 -0
  60. package/build/mcp-host-targets.js +2 -0
  61. package/build/mcp-invoke.js +5 -5
  62. package/build/mcp-profile.js +2 -2
  63. package/build/mcp-provisioning.js +2 -2
  64. package/build/mcp-server-invocation.js +3 -3
  65. package/build/merge-pull-request.js +15 -0
  66. package/build/model-routing-host.js +25 -0
  67. package/build/model-routing-preferences.js +99 -0
  68. package/build/pipelines.generated.js +9 -9
  69. package/build/plan-epic-implementer-eligibility.js +215 -0
  70. package/build/plan-execution-ledger.js +8 -0
  71. package/build/plane/member-roster.js +5 -5
  72. package/build/plane/supervisor.js +1 -1
  73. package/build/plane/types.js +5 -5
  74. package/build/readiness-check.js +1 -1
  75. package/build/readme.generated.js +1 -1
  76. package/build/review-tickets.js +4 -4
  77. package/build/setup-epic.js +8 -8
  78. package/build/start-tickets-conductor.js +32 -32
  79. package/build/start-tickets-prereqs.js +4 -9
  80. package/build/start-tickets.js +475 -91
  81. package/build/version.generated.js +3 -3
  82. package/docs/CONDUCTOR.md +69 -18
  83. package/docs/install/mcp-tool-integrations.md +2 -1
  84. package/package.json +2 -2
  85. package/pipelines/implement-ticket.json +1 -1
  86. package/pipelines/plan-epic.json +2 -2
package/README.md CHANGED
@@ -2,6 +2,44 @@
2
2
 
3
3
  The Bridge MCP is an end-to-end accelerator for shipping code within SFCC, powered by [Bridge API](https://bridgegpt-api.com). Works with Claude Code, Github Copilot, Cursor, Windsurf, and OpenAI Codex.
4
4
 
5
+ ## Personal model routing preferences
6
+
7
+ Create `~/.config/bridge/model-routing.json` to choose ordered providers for
8
+ ticket review, Second Opinion, and Council without changing shared project
9
+ configuration. The file is personal and uncommitted, contains no credentials,
10
+ and is reread for every request. The repository key must exactly match Bridge's
11
+ `repo_name`:
12
+
13
+ ```json
14
+ {
15
+ "version": 1,
16
+ "defaults": {
17
+ "review_ticket": ["gemini", "anthropic"],
18
+ "second_opinion": ["anthropic", "gemini"],
19
+ "council": ["anthropic", "gemini"]
20
+ },
21
+ "repositories": {
22
+ "my-repo": { "council": ["gemini"] }
23
+ }
24
+ }
25
+ ```
26
+
27
+ A repository entry replaces the machine entry only for a feature key it
28
+ contains. Remove a key or set it to `[]` to restore automatic selection for
29
+ that feature; an empty repository entry suppresses the machine entry. Delete
30
+ the file to clear every preference. Malformed, unreadable, or unsafe files are
31
+ ignored with a bounded local warning. Keep the file owned by your user and not
32
+ writable by your group or others.
33
+
34
+ Only the exact initialized MCP client names `codex` and `claude-code`, or their
35
+ installer markers, identify the Codex and Claude Code families. Cursor, GitHub
36
+ Copilot, and unlisted clients remain neutral. Automatic Codex requests prefer
37
+ eligible Anthropic then Gemini; Claude Code requests prefer eligible OpenAI
38
+ then Gemini. Explicit per-call choices override this personal order but must
39
+ still pass model support, project restrictions, and feature entitlement. A
40
+ populated project Allowed Providers list can reduce an automatic request or
41
+ refuse an incompatible explicit request.
42
+
5
43
  ## Install
6
44
 
7
45
  From your **project root**, run:
@@ -368,7 +406,7 @@ later boot.
368
406
  "mcpServers": {
369
407
  "bridge": {
370
408
  "command": "npx",
371
- "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"],
409
+ "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.59", "serve"],
372
410
  "env": {
373
411
  "BAPI_BASE_URL": "https://bridgegpt-api.com",
374
412
  "BAPI_REPO_NAME": "your-repo",
@@ -390,7 +428,7 @@ later boot.
390
428
  "bridge": {
391
429
  "type": "stdio",
392
430
  "command": "npx",
393
- "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"],
431
+ "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.59", "serve"],
394
432
  "env": {
395
433
  "BAPI_BASE_URL": "https://bridgegpt-api.com",
396
434
  "BAPI_REPO_NAME": "your-repo",
@@ -412,7 +450,7 @@ later boot.
412
450
  "bridge": {
413
451
  "type": "stdio",
414
452
  "command": "npx",
415
- "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"],
453
+ "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.59", "serve"],
416
454
  "env": {
417
455
  "BAPI_BASE_URL": "https://bridgegpt-api.com",
418
456
  "BAPI_REPO_NAME": "your-repo",
@@ -435,7 +473,7 @@ Windsurf only supports global MCP configuration.
435
473
  "mcpServers": {
436
474
  "bridge": {
437
475
  "command": "npx",
438
- "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"],
476
+ "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.59", "serve"],
439
477
  "env": {
440
478
  "BAPI_BASE_URL": "https://bridgegpt-api.com",
441
479
  "BAPI_REPO_NAME": "your-repo",
@@ -454,7 +492,7 @@ Windsurf only supports global MCP configuration.
454
492
  ```toml
455
493
  [mcp_servers.bridge]
456
494
  command = "npx"
457
- args = ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"]
495
+ args = ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.59", "serve"]
458
496
 
459
497
  [mcp_servers.bridge.env]
460
498
  BAPI_BASE_URL = "https://bridgegpt-api.com"
@@ -567,7 +605,7 @@ The tools worth knowing for most tickets.
567
605
  - **What it does:** Creates one git worktree per ticket and spawns an agent session in each to implement them in parallel.
568
606
  - **When it's useful:** (Implementation | Automation) When you're ready to start building one or more refined tickets concurrently.
569
607
  - **How to use it:** `/start-tickets BAPI-248 BAPI-250` (see [CLI Subcommands](#cli-subcommands) for the full flag table and cross-platform behavior).
570
- - **Flags:** `--auto` skip the approval gates · `--base-branch <branch>` branch off something other than the default · `--workflow implement|review-and-implement` selects which slash command each spawned worktree runs · `--rounds=1|2` forwarded to the review phase, valid only with `--workflow review-and-implement` · `--tier cheap|basic|premium` coarse model-routing override.
608
+ - **Flags:** `--auto` skip the approval gates · `--base-branch <branch>` branch off something other than the default · `--workflow implement|review-and-implement` selects which slash command each spawned worktree runs · `--rounds=1|2` forwarded to the review phase, valid only with `--workflow review-and-implement` · `--tier cheap|basic|premium` strict manual model-routing override · `--auto-tier cheap|basic|premium` machine-carried raw tier for chained automation (posture-adjusted; used internally by the `/review-and-implement` handoff), mutually exclusive with `--tier`.
571
609
 
572
610
  **3. Review and Start**
573
611
  - **What it does:** Spawns one worktree per ticket; each session reviews the ticket inline and, after a per-ticket proceed/halt gate, hands off to a **fresh implementation session** that reuses the same worktree — review and implementation run in two separate agent contexts, not one shared session.
@@ -667,43 +705,49 @@ Useful once in a while.
667
705
  - **How to use it:** Ask your agent — "Post a comment on BAPI-123: blocked on the expired Atlassian token — will retry after it is rotated."
668
706
  - **Flags:** A long comment can be attached as a file instead of inlined.
669
707
 
670
- **6. Read Comments**
708
+ **6. Report MCP Bug**
709
+ - **What it does:** Reports a Bridge MCP failure; after receipt, a response and apology will follow. Never include secrets, PII, or proprietary code.
710
+ - **When it's useful:** (Support) When a Bridge MCP tool misbehaves and you need to report it.
711
+ - **How to use it:** Ask your agent to report the failed MCP tool, with no secrets, PII, or proprietary code.
712
+ - **Flags:** Critical reports trigger an immediate page; successful reports receive a response and apology follow-up.
713
+
714
+ **7. Read Comments**
671
715
  - **What it does:** Reads the comment thread on a ticket.
672
716
  - **When it's useful:** (Refinement | Implementation) When the discussion on a ticket matters and you want the agent to read it before acting.
673
717
  - **How to use it:** Ask your agent — "Read the comments on BAPI-123 and summarize what was decided."
674
718
  - **Flags:** None.
675
719
 
676
- **7. Ticket Attachments**
720
+ **8. Ticket Attachments**
677
721
  - **What it does:** Downloads files from a ticket to your disk, or attaches a local file to a ticket.
678
722
  - **When it's useful:** (Refinement | Implementation) When a ticket has design files or logs you need locally, or you want to attach output back to it.
679
723
  - **How to use it:** Ask your agent — "Download the design mockups attached to BAPI-123 into my docs folder," or "Attach build-log.txt to BAPI-123."
680
724
  - **Flags:** Choose the direction (download from the ticket, or upload to it) and, for a download, where the files should land.
681
725
 
682
- **8. Estimate Epic**
726
+ **9. Estimate Epic**
683
727
  - **What it does:** Estimates an epic, or an explicit group of tickets you name.
684
728
  - **When it's useful:** (Architecture | Refinement) When you need a sizing pass across an epic, or across a set of tickets you name explicitly.
685
729
  - **How to use it:** `/estimate-epic BAPI-123`
686
730
  - **Flags:** Pass an epic key, or an explicit list of ticket keys to estimate as one group.
687
731
 
688
- **9. Regression Check**
732
+ **10. Regression Check**
689
733
  - **What it does:** Runs the deterministic regression-reviewer (lightweight mode) against a proposed code change and reports its blast radius — which real call-sites, tests, mocks, or config the change does and doesn't account for.
690
734
  - **When it's useful:** (Correctness) Before merging a change, to see which real callers, tests, or config it leaves unaccounted for.
691
735
  - **How to use it:** `/regression-check` reviews the working tree against `HEAD` by default; `/regression-check --diff main...HEAD` reviews an explicit range.
692
736
  - **Flags:** `--diff <range>` review a specific diff/PR range instead of the working tree vs. `HEAD` · `--symbols a,b,c` review a not-yet-diffed planned change by naming its symbols directly.
693
737
 
694
- **10. Scan Test Coverage**
738
+ **11. Scan Test Coverage**
695
739
  - **What it does:** Scans recently shipped tickets from git history and reports which features have or could gain integration tests, and which can only be smoke tested.
696
740
  - **When it's useful:** (Testing) Periodically, to find recently shipped features still missing integration-test coverage and how each could be smoke tested instead.
697
741
  - **How to use it:** `/scan-test-coverage` runs incrementally from the last recorded marker in `docs/test-coverage/STATE.md`.
698
742
  - **Flags:** `--since=YYYY-MM-DD` override the window start date · `--full` ignore the marker and use a 6-month lookback · `--limit=N` cap the number of features investigated.
699
743
 
700
- **11. Estimate Ticket**
744
+ **12. Estimate Ticket**
701
745
  - **What it does:** One-ticket shortcut over the existing epic estimation capability: estimates a single Jira ticket via the same `estimate_epic` tool.
702
746
  - **When it's useful:** (Estimation) When you want one ticket's estimate without typing out an epic key or an explicit ticket list.
703
747
  - **How to use it:** `/estimate-ticket BAPI-123`
704
748
  - **Flags:** `--allow-partial` the sole optional flag.
705
749
 
706
- **12. Draft Ticket**
750
+ **13. Draft Ticket**
707
751
  - **What it does:** Delegates to the Jira Ticket Writer to create only a local Markdown draft — it does not create or update a Jira issue.
708
752
  - **When it's useful:** (Refinement) When you want a reviewable local ticket draft before committing to an upload workflow.
709
753
  - **How to use it:** `/draft-ticket <description>`
@@ -792,16 +836,37 @@ Repository and ticket housekeeping commands, beyond the tiers above. Implementat
792
836
  | `/parse-repository` | Queue a background job to index the repository for Bridge AI agents |
793
837
  | `/scan-tickets` | Sync recently-updated Jira tickets and backfill workflow timestamps |
794
838
 
795
- > **GitHub Copilot modes.** On VS Code's Local agent, Bridge provisions one
796
- > `.github/prompts/<command>.prompt.md` prompt per packaged command, including
797
- > `/explore-ticket`. On VS Code Agent Host, prompt files are not loaded, so the
798
- > installer provisions the same canonical command as a project skill at
799
- > `.github/skills/<command>/SKILL.md`; invoke that skill by its slash-command
800
- > name. Bridge does not claim Copilot CLI or cloud-agent workflow support from
801
- > this scaffold alone. If either artifact is not discovered, use VS Code's Chat
802
- > Customizations diagnostics, confirm the workspace is trusted, and invoke the
803
- > workflow manually with its full instructions rather than assuming the slash
804
- > command is available.
839
+ > **GitHub Copilot modes.** Bridge supports Copilot workflow commands in two
840
+ > VS Code chat modes only. The recorded live results live in
841
+ > [`smoke-test/COPILOT-COMMAND-SMOKE.md`](smoke-test/COPILOT-COMMAND-SMOKE.md),
842
+ > which is the authoritative discovery contract.
843
+ >
844
+ > | Copilot mode | Artifact Bridge writes | How you invoke it |
845
+ > |---|---|---|
846
+ > | VS Code Local agent | `.github/prompts/<command>.prompt.md` | `/<command>`, for example `/explore-ticket` |
847
+ > | VS Code Agent Host | `.github/skills/<command>/SKILL.md` (a separately verified project skill; prompt files are not loaded in this mode) | `/<command>` |
848
+ > | Copilot CLI, Copilot cloud coding agent | None | Out of scope |
849
+ >
850
+ > - **When they are written.** `--init` writes both artifacts for every packaged
851
+ > command whenever the project has a `.vscode/` directory. `.vscode/` is only
852
+ > Bridge's VS Code project heuristic; it does not prove that GitHub Copilot is
853
+ > installed or enabled.
854
+ > - **Input.** A prompt file reads its input from `${input:task}`. Text supplied
855
+ > after the slash command takes precedence when present, and the agent asks
856
+ > you for the task when both are empty.
857
+ > - **Tools.** Bridge MCP tools come from the generated `.vscode/mcp.json`
858
+ > registration. Prompt files carry no `tools` frontmatter restriction.
859
+ > - **Reserved names.** `.github/prompts/<packaged-command>.prompt.md` and
860
+ > `.github/skills/<packaged-command>/SKILL.md` are Bridge-managed. Rerunning
861
+ > init overwrites a changed file at one of those paths and reports
862
+ > `Overwritten (content changed)`. Files with any other name are never
863
+ > modified.
864
+ > - **Agent definitions are separate.** `.github/agents/*.agent.md` holds agent
865
+ > definitions, not reusable workflow commands.
866
+ > - **If a command is not discovered.** Open VS Code's Chat Customizations
867
+ > diagnostics and confirm the workspace is trusted. If Agent Host is recorded
868
+ > as `UNSUPPORTED_DISCOVERY`, switch the chat session to the Local agent and
869
+ > use the `.github/prompts/` prompt files instead.
805
870
 
806
871
  ### Extra Capabilities
807
872
 
@@ -1004,14 +1069,15 @@ npx -y @bridge_gpt/mcp-server start-tickets [flags] KEY [KEY ...]
1004
1069
  | `--agent claude\|cursor-agent` | `claude` | Agent command to launch in each worktree |
1005
1070
  | `--workflow implement\|review-and-implement` | `implement` | Slash command each spawned worktree runs. `review-and-implement` reviews the ticket, then hands approval to a fresh implementation session in the same worktree. `--auto` applies to both phases. |
1006
1071
  | `--rounds 1\|2` | unset | Review round count forwarded to the review phase. Review-only — valid only with `--workflow review-and-implement`. |
1007
- | `--tier cheap\|basic\|premium` | unset (difficulty routing) | Coarse model-routing override. Bypasses **only** the per-ticket difficulty/tier lookup (`GET /jira/tickets/{KEY}/model-tier`) and applies this one tier to every ticket; Claude/Cursor use their registry aliases and repository overrides, while Codex uses the authenticated Bridge catalog. It is **not** a raw `--model` alias and never carries an API key or credential. A malformed value fails open to premium routing when its alias is available. Used by the `/review-and-implement` handoff to reuse the review-time tier. |
1072
+ | `--tier cheap\|basic\|premium` | unset (difficulty routing) | Strict manual model-routing override. Bypasses **only** the per-ticket difficulty/tier lookup (`GET /jira/tickets/{KEY}/model-tier`) and applies this one tier to every ticket exactly as supplied, with no per-session posture adjustment; Claude/Cursor use their registry aliases and repository overrides, while Codex uses the authenticated Bridge catalog. It is **not** a raw `--model` alias and never carries an API key or credential. A malformed value fails open to premium routing when its alias is available. Mutually exclusive with `--auto-tier`. |
1073
+ | `--auto-tier cheap\|basic\|premium` | unset | Internal/advanced machine-carried raw backend tier for chained automation (BAPI-1236). Bypasses the per-ticket lookup like `--tier`, but remains subject to the launching session's own `maximize_subscription` downshift. Used by the `/review-and-implement` handoff to reuse the review-time raw tier snapshot without silently skipping that downshift. Mutually exclusive with `--tier`. |
1008
1074
  | `--terminal terminal\|iterm` | auto-detect via `$TERM_PROGRAM` | Override the macOS terminal app (honored on macOS only) |
1009
1075
  | `--dry-run` | off | Print intended actions; create no worktrees, open no tabs (any OS) |
1010
1076
  | `--branch KEY=BRANCH` | `feature/<KEY>` | Use a custom branch for that ticket (repeatable) |
1011
1077
  | `--base-branch <BRANCH>` | `main` | Cut new worktrees from `<BRANCH>` and refresh `origin/<BRANCH>` instead of `main` |
1012
1078
  | `--no-refresh-main` | off (the configured base branch is refreshed) | Skip refresh of the configured base branch (default `main`). Historical flag name preserved for backward compatibility — despite the name, it now skips refresh of whatever `--base-branch` resolves to. |
1013
1079
  | `--max-parallel N` | `3` | Max worktrees created concurrently |
1014
- | `--conductor` | off | Opt into the Conductor system (per-worker `BAPI_CONDUCTOR_*` env + Claude hook injection, lifecycle ledger events, and a supervisor peer tab). **Default off** — a plain run spawns `cd <worktree> && <agent> '/implement-ticket <KEY>'`. |
1080
+ | `--conductor` | off | Opt into the Conductor system (per-worker `BAPI_EPIC_IMPLEMENTER_*` env + Claude hook injection, lifecycle ledger events, and a supervisor peer tab). **Default off** — a plain run spawns `cd <worktree> && <agent> '/implement-ticket <KEY>'`. |
1015
1081
  | `-h`, `--help` | — | Show usage |
1016
1082
 
1017
1083
  Each `KEY` must match `[A-Z]+-[0-9]+` (e.g., `BAPI-248`). The CLI creates/switches each worktree up front (throttled by `--max-parallel`), then opens one tab/session per successful worktree running the selected agent. Claude is the default. Cursor with `--auto` runs headlessly after a bounded authentication/readiness check; manual Cursor runs remain interactive for human review gates. To launch Cursor Agent instead of Claude Code:
@@ -1024,7 +1090,11 @@ npx -y @bridge_gpt/mcp-server start-tickets --agent cursor-agent BAPI-248
1024
1090
 
1025
1091
  For Codex, `GET /jira/codex-model-catalog?repo_name=...` is the sole tier-to-model authority. Bridge derives its three bare CLI IDs and SHA-256 mapping revision at request time from `MODEL_REGISTRY`; the launcher fetches and validates that catalog once per invocation. Repository `difficulty_model_tier_overrides` do not apply to Codex. A failed access, config, tier, catalog, revision, or alias check omits `--model` and launches the configured Codex default. The catalog expresses **Bridge provider policy only**: it cannot confirm that the local Codex login or subscription can use a model. The CLI has no supported non-interactive entitlement probe, so routing emits that limitation as a diagnostic and never uses Bridge's OpenAI API key as proof of local access.
1026
1092
 
1027
- **Coarse `--tier` override.** Passing `--tier cheap|basic|premium` bypasses only the per-ticket difficulty lookup and applies that tier to every ticket. Claude/Cursor use the same alias resolution as normal routing; Codex uses the fetched catalog. It is never a raw model alias, and no API key or credential belongs in the spawned command. A malformed tier requests the premium fallback when its alias is available; otherwise the agent default launches. `/review-and-implement` uses this flag to hand its review-time tier snapshot to the fresh implementation session.
1093
+ **Maximize-subscription posture (BAPI-1224, extended by BAPI-1236).** The per-repository `optimization_posture` config field (`quality` | `speed` | `maximize_subscription`; unset/NULL, malformed, or unreadable all resolve to `quality`) is read once per invocation, isolated from the routing-config fetch above, and applied to a tier resolved by either the automatic per-ticket difficulty lookup **or** a carried `--auto-tier` raw snapshot — both paths share the same posture resolution and downshift call site. Only `maximize_subscription` downshifts that tier one level — `premium -> basic`, `basic -> cheap`, `cheap -> cheap` (the fixed floor) — before alias resolution; `quality`, `speed`, and every degraded posture outcome preserve current (Quality) routing unchanged. Claude and Cursor still resolve the downshifted tier through their unmodified registry aliases, and Codex still indexes the fetched catalog (`catalog.models[effectiveTier]`) — no maximize-specific alias table exists anywhere. An explicit `--tier` override remains an exact manual override (the posture is never even read on that path), and the harness-local premium fallback used when no usable tier is available stays on `premium` regardless of posture. A degraded posture read never fails a spawn; it appends a secret-free `optimization-posture-unavailable` warning to affected rows and stamps at most one de-duplicated diagnostic per invocation (stderr-only, never Sentry). A separate, additive `[model-routing]` stderr line (never stdout) reports the source/baseline/posture/adjustment/effective-tier/alias for every successfully baseline-routed row, across all three routing paths (`--tier`, `--auto-tier`, and the automatic difficulty lookup).
1094
+
1095
+ **Coarse `--tier` override.** Passing `--tier cheap|basic|premium` bypasses only the per-ticket difficulty lookup and applies that tier to every ticket exactly as supplied — posture is never read on this path. Claude/Cursor use the same alias resolution as normal routing; Codex uses the fetched catalog. It is never a raw model alias, and no API key or credential belongs in the spawned command. A malformed tier requests the premium fallback when its alias is available; otherwise the agent default launches.
1096
+
1097
+ **Machine-carried `--auto-tier` handoff (BAPI-1236).** Passing `--auto-tier cheap|basic|premium` also bypasses the per-ticket difficulty lookup, but — unlike `--tier` — the carried tier IS routed through the launching session's own `maximize_subscription` downshift, exactly once. A malformed, empty, or repeated `--auto-tier` value is a hard parser error (no fail-open sentinel), and `--tier`/`--auto-tier` are mutually exclusive regardless of order. `/review-and-implement` uses this flag, never `--tier`, to hand its review-time raw tier snapshot to the fresh implementation session — so a `maximize_subscription` repo still gets the downshift on the chained handoff instead of silently skipping it.
1028
1098
 
1029
1099
  **Conductor observability (opt-in via `--conductor`, BAPI-394).** Conductor is **off by default**. With `--conductor`, a run mints a conductor `run_id`, emits events into the local ledger (`~/.config/bridge/events.db`), opens a supervisor peer tab, and (for Claude Code) injects a secret-free lifecycle hook into each worktree; it also sets `BRIDGE_MCP_PROFILE=conductor` so workers get the conductor MCP tools. Observability is best-effort — a conductor failure never blocks a spawn, and `--dry-run` performs no conductor side effects. (Epic-tick dispatch always enables conductor internally.) See **[CONDUCTOR.md](./docs/CONDUCTOR.md)** for the full observability, git-hook, done-gate, and auto-merge reference.
1030
1100
 
@@ -1080,12 +1150,12 @@ your project can actually run:
1080
1150
  npx -y @bridge_gpt/mcp-server drive-epic <EPIC>
1081
1151
  ```
1082
1152
 
1083
- You are never asked to choose. Bridge currently has two conductors and a standing
1084
- rule that they must never operate on the same epic — two transition authorities on
1085
- one epic wedge it permanently — so the choice is made structurally rather than by
1086
- judgement. Readiness green routes to the v2 bootstrap below (pass `--plan-file`
1087
- and `drive-epic` runs it for you); readiness not green prints the interactive
1088
- pilot instruction instead. If readiness is **unknown** — unreachable,
1153
+ You are never asked to choose. `drive-epic` routes to exactly one conductor, the
1154
+ v2 engine — one transition authority per epic is what keeps an epic from wedging.
1155
+ Readiness green routes to the v2 bootstrap below (pass `--plan-file`
1156
+ and `drive-epic` runs it for you); readiness not green reports that the v2 engine
1157
+ is not ready to drive this epic — there is no alternative conductor to fall back
1158
+ to — and prints no conductor invocation. If readiness is **unknown** — unreachable,
1089
1159
  unauthorized, or malformed — it escalates and prints no conductor invocation at
1090
1160
  all, because an unknown owner is not the same as a not-ready one. No branch,
1091
1161
  including every error path, ever offers you two paths.
@@ -1200,80 +1270,6 @@ Once the plan is approved, the **server-side reconciler** picks the run up withi
1200
1270
  npx -y @bridge_gpt/mcp-server executor --repo <name>
1201
1271
  ```
1202
1272
 
1203
- ### `implement-epic`
1204
-
1205
- The deterministic half of the `/conduct-epic` loop: it owns the epic branch, a
1206
- versioned local checkpoint, a per-epic lock, and the read-only probes the loop
1207
- decides on. It never creates or mutates an `epic_run` — that is the server-side
1208
- v2 reconciler's job, and `init` refuses to start when one is already active.
1209
- This is EPIC-LEVEL orchestration, distinct from the ticket-level
1210
- `implement-ticket` command.
1211
-
1212
- ```
1213
- npx -y @bridge_gpt/mcp-server implement-epic <verb> [flags]
1214
- ```
1215
-
1216
- **Verbs**
1217
-
1218
- | Verb | Flags |
1219
- | --- | --- |
1220
- | `init <EPIC>` | `--tickets K1,K2,…` (required), `--base-branch <b>`, `--checkpoint-path <p>`, `--dry-run`, `--json` |
1221
- | `status <EPIC>` | `--json` (required), `--checkpoint-path <p>` |
1222
- | `checkpoint set <EPIC>` | `--ticket <KEY>` (required), `--field <name> <value>` (repeatable), `--journal "<line>"`, `--checkpoint-path <p>` |
1223
- | `finish <EPIC>` | `--checkpoint-path <p>`, `--json` |
1224
- | `spawn <EPIC>` | `--ticket <KEY>` and `--prompt-file <path>` (required), `--agent claude\|cursor-agent`, `--checkpoint-path <p>`, `--json` |
1225
-
1226
- **Local state.** Everything lives *outside* the repository, under
1227
- `~/.config/bridge/conduct/<repo>/` (honoring `XDG_CONFIG_HOME`), so it resolves
1228
- identically from the main checkout and from any worktree and can never be
1229
- committed by an agent running `git add`:
1230
-
1231
- | Path | Purpose |
1232
- | --- | --- |
1233
- | `<EPIC>.json` | the version-1 checkpoint (file `0600`, directory `0700`) |
1234
- | `<EPIC>.json.prev` | the previous valid checkpoint, retained on every write |
1235
- | `<EPIC>.lock` | the per-epic lock |
1236
- | `<EPIC>/prompts/<KEY>-<kind>-<n>.md` | prompt files the caller writes for `spawn` |
1237
-
1238
- `status` prints the resolved `checkpoint_path`. To unpark a run a human edits the
1239
- checkpoint (`needs_human` → `null`, plus the ticket's `status`/counters);
1240
- `last_seen_head`, `ci_last_poll`, and `lock` are observational and are never
1241
- hand-edited.
1242
-
1243
- **`init` runs ONE preflight** that reports *every* failure in a single pass and
1244
- writes nothing unless all of them pass: `gh auth status`; Worktrunk resolves
1245
- (honoring `BAPI_WORKTRUNK_BIN`); Bridge credentials resolve; `auto_merge_enabled`
1246
- is on — or is turned on by PUTting the *complete* effective config back with just
1247
- that flag flipped, which prints a line beginning `announced:`; at least one
1248
- required CI check exists (an empty required set would make the done gate pass
1249
- vacuously); no active server-side `epic_run` for the key; the lock is free or its
1250
- owner is provably dead; the base branch exists on `origin` after `git fetch`; and
1251
- the indexed-branch override is either absent or this epic's own — a re-`init`
1252
- after a crash is accepted and its `original_base_branch` becomes the default base,
1253
- while a *foreign* override is refused by name. `resolve-ci-checks` is called
1254
- exactly once either way, because that call is what warms the `poll-ci-checks`
1255
- cache the first `status` depends on. Only then does `init` push
1256
- `epic/<EPIC>` to `origin` at the fetched base tip (no local checkout), repoint the
1257
- index, write the checkpoint, and take the lock. `--dry-run` prints the validated
1258
- plan and mutates nothing. A second `init` refuses with `already initialized`.
1259
-
1260
- **Failure posture is split on purpose.** In `status`, each probe fails *open*: a
1261
- `gh`, CI, review, or parse failure leaves that sub-object `null`, adds an entry to
1262
- `probe_errors`, and the command still exits `0` with a complete object — the loop
1263
- must be able to read its own checkpoint during a GitHub outage. Everything else
1264
- fails *closed*: a corrupt or wrong-version checkpoint makes every verb but `init`
1265
- exit non-zero **without rewriting it**, and `checkpoint set`, `spawn`, and
1266
- `finish` refuse a lock held by another live process. `status` never takes the lock.
1267
-
1268
- **Exit codes.** `0` on success — including a missing checkpoint
1269
- (`checkpoint_exists: false`) and an idempotent second `finish`. Non-zero on any
1270
- other failure, with a one-line reason on stderr. With `--json`, stdout is exactly
1271
- one JSON object carrying `ok`.
1272
-
1273
- **Credentials** resolve only from `BAPI_API_KEY` or the user-scoped
1274
- `bapi:<repo>` credential target, travel only in the `X-API-Key` header, and never
1275
- appear in a command argument, in stdout/stderr, or in a journal line.
1276
-
1277
1273
  ### Conductor (epic & multi-agent orchestration)
1278
1274
 
1279
1275
  Conductor is an **opt-in, off-by-default** layer for epic supervision, inter-agent messaging, done-gate evaluation, local git-hook event producers, and conditional auto-merge. Its full reference — the v2 architecture (server-side reconciler + local executor), `setup-epic`, `epic-implementer install-git-hooks`, the supervisor `done_gate_config` / `auto_merge_enabled` settings, and the observability stream — lives in **[CONDUCTOR.md](./docs/CONDUCTOR.md)**. (The event-ledger CLI was renamed from `conductor` to `epic-implementer`; the retained `conductor` bin name is now a fixed migration pointer.)
@@ -1565,12 +1561,12 @@ The full surface, for when you need the complete enumeration. Day-to-day, use [U
1565
1561
 
1566
1562
  ### MCP tools
1567
1563
 
1568
- The authoritative tool catalog covers **75 tools** (enumerated below). What's actually registered in a session depends on `BRIDGE_MCP_PROFILE`: the default `core` profile loads a trimmed subset, and the conductor/pipeline-authoring/SFCC tools are added only under their respective profiles (see [Environment Variables](#environment-variables)). Async AI tools follow a request/get pattern: call the `request_*` tool to kick off generation, then the matching `get_*` tool to retrieve the result (or pass `wait_for_result: true` to poll automatically).
1564
+ The authoritative tool catalog covers **77 tools** (enumerated below). What's actually registered in a session depends on `BRIDGE_MCP_PROFILE`: the default `core` profile loads a trimmed subset, and the conductor/pipeline-authoring/SFCC tools are added only under their respective profiles (see [Environment Variables](#environment-variables)). Async AI tools follow a request/get pattern: call the `request_*` tool to kick off generation, then the matching `get_*` tool to retrieve the result (or pass `wait_for_result: true` to poll automatically).
1569
1565
 
1570
1566
  - **Connectivity & identity** — `ping` (its JSON also carries `docs_dir`, `role`, and `customer_type`)
1571
1567
  - **Team & access** — `invite_member` (admin-only; mints a scoped access key for a teammate on an already-configured project — the plaintext key is shown exactly once)
1572
1568
  - **Jira tickets** — `get_tickets`, `get_ticket`, `create_ticket`, `update_ticket_description`, `add_comment`, `get_comments`
1573
- - **Attachments** — `attachment` (operations: `upload`, `download`, `list`)
1569
+ - **Attachments** — `attachment` (operations: `upload`, `download`, `list`, `delete`); `publish_reviewed_attachment` appends only a captured review's fixed Markdown copy during auto review, leaving older Jira attachments intact.
1574
1570
  - **AI generation (request/get)** — `request_plan_generation`/`get_plan`, `create_doc`/`get_doc` (design docs by `doc_type`: tdd/architecture/fsd/prd, where `architecture` is an alias of `tdd`), `request_ticket_review` (writes both `get_clarifying_questions` and `get_ticket_critique`), `request_reimplement_context`/`get_reimplement_context`, `request_council`/`get_council`, `request_deep_research`/`get_deep_research`
1575
1571
  - **Bounded waits** — `wait_for_ticket_review`, `wait_for_ci_checks`. Each returns `state: "ready" | "pending" | "error"`; review waits default to 20 s and CI waits default to 240 s (both accept up to 240 s explicitly). `pending` is a normal, resumable result you call again on, never a failure. They exist so an agent can wait without a foreground `sleep` and without binding a long server-side operation to the 900 s MCP client deadline. `wait_for_ci_checks` reports only that checks are **terminal** — deciding pass or fail stays with the caller.
1576
1572
  - **Other AI** — `second_opinion`, `generate_image`, `generate_decision_page`, `visual_diff` (deterministic pixel diff of a rendered URL vs a design comp)
@@ -1587,7 +1583,7 @@ Pipelines are declarative, multi-step workflows your AI agent executes step-by-s
1587
1583
  | Pipeline | Description | Invoke with |
1588
1584
  |---|---|---|
1589
1585
  | `implement-ticket` | Generate a plan, execute the implementation, commit, open a PR, and monitor CI | `/implement-ticket PROJ-123` |
1590
- | `review-ticket` | Full ticket quality review: clarifying questions + critique plus an automatic second-opinion pass, then evaluation and decision capture. The backend owns round orchestration; pass `--rounds=1` for a single-pass review or `--rounds=2` to force the full second-opinion review, or omit `--rounds` to let the backend decide adaptively. Internal atomic pipeline invoked by `/review-tickets` (inline for one key, spawned per tab for several) and by `/review-and-implement`, `/review-and-start`, `/start-tickets`, and `/conduct-epic`. | `/review-tickets PROJ-123` |
1586
+ | `review-ticket` | Full ticket quality review: clarifying questions + critique plus an automatic second-opinion pass, then evaluation and decision capture. The backend owns round orchestration; pass `--rounds=1` for a single-pass review or `--rounds=2` to force the full second-opinion review, or omit `--rounds` to let the backend decide adaptively. Internal atomic pipeline invoked by `/review-tickets` (inline for one key, spawned per tab for several) and by `/review-and-implement`, `/review-and-start`, and `/start-tickets`. | `/review-tickets PROJ-123` |
1591
1587
  | `idea-to-ticket` | Turn an idea into a Jira Task/Spike (or Epic + children) with research, dedup, and critique | `/idea-to-ticket "<idea>"` |
1592
1588
  | `plan-epic` | Decompose an epic into sub-tasks with a structured exploration doc for each | `/plan-epic "<epic>"` |
1593
1589
  | `full-automation` | Client-side wrapper: runs the `idea-to-ticket` recipe, then hands the created keys to `/review-and-start --auto` | `/idea-to-pr "<idea>"` |
@@ -24,6 +24,21 @@ export function isValidModelAlias(value) {
24
24
  export function isModelTier(value) {
25
25
  return value === "cheap" || value === "basic" || value === "premium";
26
26
  }
27
+ /**
28
+ * BAPI-1224 — downshift one model tier: `premium -> basic`, `basic -> cheap`,
29
+ * `cheap -> cheap` (the fixed floor). Total and exhaustive: no permissive
30
+ * default branch, so extending `ModelTier` forces an explicit decision here.
31
+ */
32
+ export function downshiftModelTier(tier) {
33
+ switch (tier) {
34
+ case "premium":
35
+ return "basic";
36
+ case "basic":
37
+ return "cheap";
38
+ case "cheap":
39
+ return "cheap";
40
+ }
41
+ }
27
42
  /**
28
43
  * The registry: the ONLY place mapping an agent name to its command/spec. Seeded
29
44
  * with `claude` (default), `cursor-agent`, and `codex`. `as const satisfies` keeps
@@ -115,10 +115,18 @@ export function translateAgentToCopilot(frontmatter, body) {
115
115
  * command catalog.
116
116
  */
117
117
  function commandDescription(source, commandName) {
118
- const line = source
119
- .split(/\r?\n/)
120
- .map((candidate) => candidate.trim())
121
- .find((candidate) => candidate.length > 0 && candidate !== "$ARGUMENTS" && !candidate.startsWith("#"));
118
+ const lines = source.split(/\r?\n/).map((candidate) => candidate.trim());
119
+ // Some commands open with host-parsed YAML frontmatter; its delimiters and
120
+ // keys are metadata, not a summary, so drop the block before scanning.
121
+ if (lines[0] === "---") {
122
+ const close = lines.indexOf("---", 1);
123
+ if (close > 0)
124
+ lines.splice(0, close + 1);
125
+ }
126
+ const line = lines.find((candidate) => candidate.length > 0 &&
127
+ candidate !== "$ARGUMENTS" &&
128
+ !candidate.startsWith("#") &&
129
+ !/^[-*_\s]+$/.test(candidate));
122
130
  return line ?? `Run the Bridge ${commandName} workflow.`;
123
131
  }
124
132
  function commandBodyForPrompt(source) {
@@ -136,17 +144,17 @@ function commandBodyForSkill(source) {
136
144
  export function translateCommandToCopilot(filename, source) {
137
145
  const commandName = filename.replace(/\.md$/, "");
138
146
  const description = commandDescription(source, commandName);
147
+ // No `tools:` frontmatter: Bridge MCP tools reach Copilot through the
148
+ // generated `.vscode/mcp.json` registration, not a prompt-level restriction.
139
149
  const prompt = [
140
150
  "---",
141
151
  `description: ${quoteYamlValue(description)}`,
142
152
  "argument-hint: \"[task or ticket key]\"",
143
- "tools:",
144
- " - bridge/*",
145
153
  "---",
146
154
  "",
147
155
  `# Bridge ${commandName} workflow`,
148
156
  "",
149
- "The user input is available as `${input:task}`. Follow the canonical workflow below.",
157
+ "The workflow input is `${input:task}`. When text is supplied after the slash command, that text takes precedence; if neither contains input, ask the user for the task before continuing. Follow the canonical workflow below.",
150
158
  "",
151
159
  commandBodyForPrompt(source),
152
160
  ].join("\n");
@@ -160,7 +168,7 @@ export function translateCommandToCopilot(filename, source) {
160
168
  "",
161
169
  `# Bridge ${commandName} workflow`,
162
170
  "",
163
- "Use the text supplied after this slash command as the workflow input. Follow the canonical workflow below.",
171
+ "Use the text supplied after this slash command as the workflow input; if no text was supplied, ask the user for the task before continuing. Follow the canonical workflow below.",
164
172
  "",
165
173
  commandBodyForSkill(source),
166
174
  ].join("\n");
@@ -52,21 +52,6 @@ const CLAUDE_USER_CONFIG_FILENAME = ".claude.json";
52
52
  export function resolveClaudeUserConfigPath(homeDirectory, platform) {
53
53
  return pathApiForProvisioningPlatform(platform).join(homeDirectory, CLAUDE_USER_CONFIG_FILENAME);
54
54
  }
55
- /**
56
- * RETIRED (BAPI-790) — this override is now behaviorally inert.
57
- *
58
- * It used to downgrade a confirmed shadowing collision from a refusal to a loud
59
- * warning. There is no refusal left to downgrade: strict flag-scoped MCP loading
60
- * means an operator registration cannot shadow a worker, so the finding is always
61
- * advisory and setting this variable changes nothing.
62
- *
63
- * The constant is kept exported, and {@link isClaudeMcpShadowingOverrideEnabled}
64
- * with it, so an operator who still has it set in a service unit or shell profile
65
- * gets no error — and so the name stays greppable to whoever wonders why it stopped
66
- * mattering. Nothing in the policy consults it. Do not reintroduce a branch on it
67
- * without re-establishing that shadowing can affect a worker again.
68
- */
69
- export const CONDUCTOR_ALLOW_CLAUDE_MCP_SHADOWING_ENV = "BAPI_CONDUCTOR_ALLOW_CLAUDE_MCP_SHADOWING";
70
55
  /** A plain, non-array object. */
71
56
  function asRecord(value) {
72
57
  if (!value || typeof value !== "object" || Array.isArray(value))
@@ -262,27 +247,8 @@ export async function inspectClaudeUserConfigForMcpShadowing(input, deps) {
262
247
  return { findings, diagnostics };
263
248
  }
264
249
  // ---------------------------------------------------------------------------
265
- // Override + shared policy
250
+ // Shared policy
266
251
  // ---------------------------------------------------------------------------
267
- /** Documented truthy override values (trimmed, case-insensitive). */
268
- const OVERRIDE_TRUTHY = new Set(["1", "true", "yes", "on"]);
269
- /**
270
- * True only for a trimmed, case-insensitive `1`, `true`, `yes`, or `on`. Absent,
271
- * blank, `0`, `false`, `no`, `off`, and anything else are disabled.
272
- *
273
- * RETIRED (BAPI-790): no policy branches on this any more — see
274
- * {@link CONDUCTOR_ALLOW_CLAUDE_MCP_SHADOWING_ENV}. Retained as a pure predicate
275
- * so the parsing rule stays documented and testable rather than being deleted and
276
- * re-guessed if the override is ever revived.
277
- */
278
- export function isClaudeMcpShadowingOverrideEnabled(env) {
279
- const raw = env?.[CONDUCTOR_ALLOW_CLAUDE_MCP_SHADOWING_ENV];
280
- if (typeof raw !== "string")
281
- return false;
282
- return OVERRIDE_TRUTHY.has(raw.trim().toLowerCase());
283
- }
284
- /** The exact wording every override path emits, pinned by tests. */
285
- export const CLAUDE_MCP_SHADOWING_OVERRIDE_WARNING = `Proceeding anyway because ${CONDUCTOR_ALLOW_CLAUDE_MCP_SHADOWING_ENV} is set`;
286
252
  /** Human-readable scope labels (fixed strings, never derived from the config). */
287
253
  const SCOPE_LABELS = {
288
254
  user: "user scope (mcpServers)",
@@ -13,7 +13,7 @@ export const BRIDGE_WORKFLOW_TOOLS = [
13
13
  "ping", "get_ticket", "get_pipeline_recipe", "request_ticket_review",
14
14
  "wait_for_ticket_review", "fresh_base", "generate_decision_page",
15
15
  "capture_review_decisions", "request_plan_generation", "get_plan",
16
- "attachment",
16
+ "attachment", "publish_reviewed_attachment",
17
17
  "get_phase_context", "record_phase_result", "create_pull_request",
18
18
  "update_jira_status", "config_field", "resolve_ci_checks", "poll_ci_checks",
19
19
  "wait_for_ci_checks",