@bridge_gpt/mcp-server 0.2.58 → 0.2.60

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 (127) hide show
  1. package/README.md +231 -113
  2. package/build/agent-guidance.generated.js +1 -1
  3. package/build/agent-notes.js +7 -1
  4. package/build/agent-registry.js +15 -0
  5. package/build/agent-utils.js +16 -8
  6. package/build/claude-user-config-doctor.js +1 -35
  7. package/build/codex-bridge-profile.js +1 -1
  8. package/build/commands.generated.js +7 -8
  9. package/build/conductor/bridge-api-client.js +202 -2
  10. package/build/conductor/bring-up-facts.js +1 -1
  11. package/build/conductor/claude-hook.js +16 -16
  12. package/build/conductor/doctor.js +279 -72
  13. package/build/conductor/epic-implementer-cli.js +38 -5
  14. package/build/conductor/epic-reconcile.js +1 -1
  15. package/build/conductor/epic-runtime.js +21 -12
  16. package/build/conductor/errors.js +3 -3
  17. package/build/conductor/file-scope-guard.js +4 -4
  18. package/build/conductor/git-ci-types.js +1 -1
  19. package/build/conductor/git-inspection.js +2 -2
  20. package/build/conductor/install-doctor.js +28 -6
  21. package/build/conductor/local-merge.js +319 -26
  22. package/build/conductor/merge-execution-contract.js +61 -0
  23. package/build/conductor/merge-execution-eligibility.js +129 -0
  24. package/build/conductor/merge-ledger.js +2 -2
  25. package/build/conductor/pr-ci-producer.js +6 -6
  26. package/build/conductor/pr-review-producer.js +2 -2
  27. package/build/conductor/producer-ledger.js +2 -0
  28. package/build/conductor/readiness-sections.js +166 -9
  29. package/build/conductor/readiness.js +97 -16
  30. package/build/conductor/recovery-cli.js +243 -12
  31. package/build/conductor/recovery-operations.js +64 -6
  32. package/build/conductor/repair-contract.js +38 -4
  33. package/build/conductor/spec-review-producer.js +6 -6
  34. package/build/conductor/store.js +10 -10
  35. package/build/conductor/supervisor-config.js +14 -14
  36. package/build/conductor/supervisor-ledger.js +2 -2
  37. package/build/conductor/supervisor-message-relay.js +2 -2
  38. package/build/conductor/worker-ledger-cli.js +19 -19
  39. package/build/conductor-bundle-artifacts.js +2 -2
  40. package/build/connect-bitbucket-api.js +6 -1
  41. package/build/connect-bitbucket.js +398 -88
  42. package/build/credential-store.js +16 -0
  43. package/build/docs.generated.js +2 -2
  44. package/build/doctor.js +199 -303
  45. package/build/drive-epic.js +88 -71
  46. package/build/epic-implementer-bin.js +22 -17
  47. package/build/epic-implementer-claude-hook-bin.js +4 -2
  48. package/build/epic-implementer-env.js +184 -0
  49. package/build/epic-integration-pr.js +2 -2
  50. package/build/executor/ci-rerun-job.js +269 -0
  51. package/build/executor/cli.js +31 -0
  52. package/build/executor/credentials.js +11 -0
  53. package/build/executor/env.js +79 -8
  54. package/build/executor/heartbeat.js +1 -1
  55. package/build/executor/index.js +21 -4
  56. package/build/executor/job-errors.js +3 -3
  57. package/build/executor/job-runner.js +127 -1
  58. package/build/executor/job-types.js +12 -2
  59. package/build/executor/merge-job.js +46 -5
  60. package/build/executor/observation.js +1 -1
  61. package/build/executor/preflight.js +1 -1
  62. package/build/executor/prompt-spec.js +1 -1
  63. package/build/executor/reconcile-overlap-job.js +10 -130
  64. package/build/executor/reconcile-overlap-types.js +1 -1
  65. package/build/executor/runner.js +1 -1
  66. package/build/executor/service-lifecycle.js +136 -0
  67. package/build/executor/service-unit.js +427 -9
  68. package/build/executor/types.js +5 -0
  69. package/build/index.js +320 -342
  70. package/build/init.js +20 -28
  71. package/build/install-bridge-conductor.js +208 -15
  72. package/build/install-bridge.js +555 -37
  73. package/build/mcp-host-entry-adapter.js +6 -0
  74. package/build/mcp-host-targets.js +2 -0
  75. package/build/mcp-install-state.js +42 -4
  76. package/build/mcp-invoke.js +5 -5
  77. package/build/mcp-profile.js +2 -2
  78. package/build/mcp-provisioning.js +2 -2
  79. package/build/mcp-server-invocation.js +3 -3
  80. package/build/merge-pull-request.js +118 -10
  81. package/build/merge-workflow-codeowners.js +224 -0
  82. package/build/merge-workflow-config.js +133 -0
  83. package/build/merge-workflow-drift.js +66 -0
  84. package/build/merge-workflow-install.js +638 -0
  85. package/build/merge-workflow.js +572 -0
  86. package/build/model-routing-host.js +25 -0
  87. package/build/model-routing-preferences.js +99 -0
  88. package/build/pipelines.generated.js +10 -10
  89. package/build/{plan-epic-conductor-eligibility.js → plan-epic-implementer-eligibility.js} +18 -16
  90. package/build/plan-execution-ledger.js +8 -0
  91. package/build/plane/cli.js +24 -2
  92. package/build/plane/member-roster.js +5 -5
  93. package/build/plane/preflight.js +68 -0
  94. package/build/plane/supervisor.js +1 -1
  95. package/build/plane/types.js +5 -5
  96. package/build/readiness-check.js +1 -1
  97. package/build/readme.generated.js +1 -1
  98. package/build/review-tickets.js +4 -4
  99. package/build/run-unit-tests-launcher.js +5 -0
  100. package/build/setup-epic.js +171 -17
  101. package/build/start-tickets-conductor.js +32 -32
  102. package/build/start-tickets-prereqs.js +4 -9
  103. package/build/start-tickets.js +475 -91
  104. package/build/version.generated.js +3 -3
  105. package/docs/CONDUCTOR.md +69 -18
  106. package/docs/install/mcp-tool-integrations.md +2 -1
  107. package/package.json +4 -4
  108. package/pipelines/implement-ticket.json +1 -1
  109. package/pipelines/plan-epic.json +2 -2
  110. package/build/conduct-epic/bridge-client.js +0 -773
  111. package/build/conduct-epic/checkpoint-store.js +0 -542
  112. package/build/conduct-epic/cli.js +0 -3145
  113. package/build/conduct-epic/cut-protocol.js +0 -392
  114. package/build/conduct-epic/lock.js +0 -302
  115. package/build/conduct-epic/pr-state.js +0 -286
  116. package/build/conduct-epic/spawn.js +0 -113
  117. package/build/conductor/cli.js +0 -1278
  118. package/build/conductor-bundle-cli.js +0 -256
  119. package/build/direct-ticket-tools.js +0 -70
  120. package/build/executor/reconcile-overlap-governance.js +0 -129
  121. package/build/implement-epic/checkpoint-store.js +0 -542
  122. package/build/implement-epic/cli.js +0 -3158
  123. package/build/implement-epic/lock.js +0 -302
  124. package/build/implement-epic/pr-state.js +0 -286
  125. package/build/implement-epic/spawn.js +0 -113
  126. /package/build/{implement-epic → epic-shared}/bridge-client.js +0 -0
  127. /package/build/{implement-epic → epic-shared}/cut-protocol.js +0 -0
package/README.md CHANGED
@@ -64,6 +64,7 @@ account — it will ask.
64
64
  - [Custom Pipelines](#custom-pipelines)
65
65
  - [Environment Variables](#environment-variables)
66
66
  - [Worktree credentials and the `mcp-invoke` shim](#worktree-credentials-and-the-mcp-invoke-shim)
67
+ - [Personal model routing preferences](#personal-model-routing-preferences)
67
68
  - [Reference](#reference)
68
69
 
69
70
  For advanced epic/multi-agent orchestration, see [CONDUCTOR.md](./docs/CONDUCTOR.md).
@@ -368,7 +369,7 @@ later boot.
368
369
  "mcpServers": {
369
370
  "bridge": {
370
371
  "command": "npx",
371
- "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"],
372
+ "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.60", "serve"],
372
373
  "env": {
373
374
  "BAPI_BASE_URL": "https://bridgegpt-api.com",
374
375
  "BAPI_REPO_NAME": "your-repo",
@@ -390,7 +391,7 @@ later boot.
390
391
  "bridge": {
391
392
  "type": "stdio",
392
393
  "command": "npx",
393
- "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"],
394
+ "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.60", "serve"],
394
395
  "env": {
395
396
  "BAPI_BASE_URL": "https://bridgegpt-api.com",
396
397
  "BAPI_REPO_NAME": "your-repo",
@@ -412,7 +413,7 @@ later boot.
412
413
  "bridge": {
413
414
  "type": "stdio",
414
415
  "command": "npx",
415
- "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"],
416
+ "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.60", "serve"],
416
417
  "env": {
417
418
  "BAPI_BASE_URL": "https://bridgegpt-api.com",
418
419
  "BAPI_REPO_NAME": "your-repo",
@@ -435,7 +436,7 @@ Windsurf only supports global MCP configuration.
435
436
  "mcpServers": {
436
437
  "bridge": {
437
438
  "command": "npx",
438
- "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"],
439
+ "args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.60", "serve"],
439
440
  "env": {
440
441
  "BAPI_BASE_URL": "https://bridgegpt-api.com",
441
442
  "BAPI_REPO_NAME": "your-repo",
@@ -454,7 +455,7 @@ Windsurf only supports global MCP configuration.
454
455
  ```toml
455
456
  [mcp_servers.bridge]
456
457
  command = "npx"
457
- args = ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.58", "serve"]
458
+ args = ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.60", "serve"]
458
459
 
459
460
  [mcp_servers.bridge.env]
460
461
  BAPI_BASE_URL = "https://bridgegpt-api.com"
@@ -567,7 +568,7 @@ The tools worth knowing for most tickets.
567
568
  - **What it does:** Creates one git worktree per ticket and spawns an agent session in each to implement them in parallel.
568
569
  - **When it's useful:** (Implementation | Automation) When you're ready to start building one or more refined tickets concurrently.
569
570
  - **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.
571
+ - **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
572
 
572
573
  **3. Review and Start**
573
574
  - **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.
@@ -575,16 +576,16 @@ The tools worth knowing for most tickets.
575
576
  - **How to use it:** `/review-and-start BAPI-248 BAPI-250` (single or multiple keys flow through the identical code path).
576
577
  - **Flags:** `--auto` auto-approves both the review and the implementation phase of every spawned session · `--rounds=1|2` forwarded to the review phase · `--agent`, `--base-branch`, `--max-parallel`, `--dry-run` mirror `/start-tickets`.
577
578
 
578
- **4. Explore Ticket**
579
- - **What it does:** Maps the code paths, dependencies, and project conventions a task would touch, settles its acceptance criteria with you on a decision page, then compares the viable implementation approaches and their trade-offs and writes up a proposed design. Along the way it surfaces the ambiguities that still need deciding and can pull in optional web or deep research where the answer is not in the code.
579
+ **4. Define Tickets**
580
+ - **What it does:** Analyzes a single task or feature specification to define, refine, and structure one or more actionable Jira tickets. It maps the code paths, dependencies, and project conventions the task would touch, settles acceptance criteria with you on a decision page, then compares the viable implementation approaches and their trade-offs so the ticket work is grounded in the real codebase. Along the way it surfaces the ambiguities that still need deciding and can pull in optional web or deep research where the answer is not in the code.
580
581
  - **When it's useful:** (Architecture | Refinement) Before writing a ticket or a plan, when you're unsure how a change would fit the existing code and want the open questions and the realistic options laid out first.
581
- - **How to use it:** `/explore-ticket <task>` — *"Explore the codebase for how we'd add a Mistral LLM provider and recommend 2–3 implementation options."*
582
+ - **How to use it:** `/define-tickets <task>` — *"Define the tickets we'd need to add a Mistral LLM provider."*
582
583
  - **Flags:** None.
583
584
 
584
- **5. Council**
585
+ **5. AI Council**
585
586
  - **What it does:** Fans your problem out to two different models and returns their approaches, in technical, design, discovery, or general mode.
586
587
  - **When it's useful:** (Architecture | Refinement) Early, when you want a spread of approaches — technical for how to build it, design for how it should look, discovery for what still needs figuring out before a real ticket exists, general for a quick brief-driven pass before the repository is indexed.
587
- - **How to use it:** `/council <question>`
588
+ - **How to use it:** `/ai-council <question>`
588
589
  - **Flags:** `--mode` selects one of four modes, passed to the underlying `request_council` tool as e.g. `mode: "discovery"`: `technical` (the default — implementation/architecture approaches), `design` (UI/UX and visual direction), `discovery` (stakeholder discovery questions, grouped into `Technical Discovery Questions` and `Business / Stakeholder Discovery Questions` and tagged `[HUMAN]`/`[CODE]`/`[TICKET]`), and `general` (brief-driven ideation from your task description alone). `technical` and `discovery` are codebase-grounded and need an indexed repository; `general` needs no code index at all, so it works immediately after install. The legacy boolean `design=true` still works and maps to `mode: "design"`.
589
590
 
590
591
  **6. Deep Research**
@@ -667,43 +668,49 @@ Useful once in a while.
667
668
  - **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
669
  - **Flags:** A long comment can be attached as a file instead of inlined.
669
670
 
670
- **6. Read Comments**
671
+ **6. Report MCP Bug**
672
+ - **What it does:** Reports a Bridge MCP failure; after receipt, a response and apology will follow. Never include secrets, PII, or proprietary code.
673
+ - **When it's useful:** (Support) When a Bridge MCP tool misbehaves and you need to report it.
674
+ - **How to use it:** Ask your agent to report the failed MCP tool, with no secrets, PII, or proprietary code.
675
+ - **Flags:** Critical reports trigger an immediate page; successful reports receive a response and apology follow-up.
676
+
677
+ **7. Read Comments**
671
678
  - **What it does:** Reads the comment thread on a ticket.
672
679
  - **When it's useful:** (Refinement | Implementation) When the discussion on a ticket matters and you want the agent to read it before acting.
673
680
  - **How to use it:** Ask your agent — "Read the comments on BAPI-123 and summarize what was decided."
674
681
  - **Flags:** None.
675
682
 
676
- **7. Ticket Attachments**
683
+ **8. Ticket Attachments**
677
684
  - **What it does:** Downloads files from a ticket to your disk, or attaches a local file to a ticket.
678
685
  - **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
686
  - **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
687
  - **Flags:** Choose the direction (download from the ticket, or upload to it) and, for a download, where the files should land.
681
688
 
682
- **8. Estimate Epic**
689
+ **9. Estimate Epic**
683
690
  - **What it does:** Estimates an epic, or an explicit group of tickets you name.
684
691
  - **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
692
  - **How to use it:** `/estimate-epic BAPI-123`
686
693
  - **Flags:** Pass an epic key, or an explicit list of ticket keys to estimate as one group.
687
694
 
688
- **9. Regression Check**
695
+ **10. Regression Check**
689
696
  - **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
697
  - **When it's useful:** (Correctness) Before merging a change, to see which real callers, tests, or config it leaves unaccounted for.
691
698
  - **How to use it:** `/regression-check` reviews the working tree against `HEAD` by default; `/regression-check --diff main...HEAD` reviews an explicit range.
692
699
  - **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
700
 
694
- **10. Scan Test Coverage**
701
+ **11. Scan Test Coverage**
695
702
  - **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
703
  - **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
704
  - **How to use it:** `/scan-test-coverage` runs incrementally from the last recorded marker in `docs/test-coverage/STATE.md`.
698
705
  - **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
706
 
700
- **11. Estimate Ticket**
707
+ **12. Estimate Ticket**
701
708
  - **What it does:** One-ticket shortcut over the existing epic estimation capability: estimates a single Jira ticket via the same `estimate_epic` tool.
702
709
  - **When it's useful:** (Estimation) When you want one ticket's estimate without typing out an epic key or an explicit ticket list.
703
710
  - **How to use it:** `/estimate-ticket BAPI-123`
704
711
  - **Flags:** `--allow-partial` the sole optional flag.
705
712
 
706
- **12. Draft Ticket**
713
+ **13. Draft Ticket**
707
714
  - **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
715
  - **When it's useful:** (Refinement) When you want a reviewable local ticket draft before committing to an upload workflow.
709
716
  - **How to use it:** `/draft-ticket <description>`
@@ -712,7 +719,7 @@ Useful once in a while.
712
719
 
713
720
  ### Workflow commands
714
721
 
715
- Slash commands that drive several tools at once. Start Tickets, Review and Start, and Explore Ticket are documented above under [Regularly useful](#regularly-useful); Create Decision Page is documented above under [Occasionally useful](#occasionally-useful); Regression Check and Scan Test Coverage are documented above under [Now and then](#now-and-then) — the rest live here.
722
+ Slash commands that drive several tools at once. Start Tickets, Review and Start, and Define Tickets are documented above under [Regularly useful](#regularly-useful); Create Decision Page is documented above under [Occasionally useful](#occasionally-useful); Regression Check and Scan Test Coverage are documented above under [Now and then](#now-and-then) — the rest live here.
716
723
 
717
724
  **1. Implement Ticket**
718
725
  - **What it does:** Full build for one ticket: generate a plan, write the code, commit, open a PR, and monitor CI.
@@ -740,7 +747,7 @@ Slash commands that drive several tools at once. Start Tickets, Review and Start
740
747
 
741
748
  #### Ticket-authoring posture
742
749
 
743
- `/explore-ticket`, `/idea-to-ticket`, and `/plan-epic` all decide ticket shape
750
+ `/define-tickets`, `/idea-to-ticket`, and `/plan-epic` all decide ticket shape
744
751
  the same way, as does the `jira-ticket-writer` agent they draft through. A fresh install inherits this with no configuration
745
752
  step and no server call; the full rationale and the closed exception list ship as
746
753
  `docs/bridge-ticket-authoring.md`.
@@ -792,16 +799,37 @@ Repository and ticket housekeeping commands, beyond the tiers above. Implementat
792
799
  | `/parse-repository` | Queue a background job to index the repository for Bridge AI agents |
793
800
  | `/scan-tickets` | Sync recently-updated Jira tickets and backfill workflow timestamps |
794
801
 
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.
802
+ > **GitHub Copilot modes.** Bridge supports Copilot workflow commands in two
803
+ > VS Code chat modes only. The recorded live results live in
804
+ > [`smoke-test/COPILOT-COMMAND-SMOKE.md`](smoke-test/COPILOT-COMMAND-SMOKE.md),
805
+ > which is the authoritative discovery contract.
806
+ >
807
+ > | Copilot mode | Artifact Bridge writes | How you invoke it |
808
+ > |---|---|---|
809
+ > | VS Code Local agent | `.github/prompts/<command>.prompt.md` | `/<command>`, for example `/define-tickets` |
810
+ > | VS Code Agent Host | `.github/skills/<command>/SKILL.md` (a separately verified project skill; prompt files are not loaded in this mode) | `/<command>` |
811
+ > | Copilot CLI, Copilot cloud coding agent | None | Out of scope |
812
+ >
813
+ > - **When they are written.** `--init` writes both artifacts for every packaged
814
+ > command whenever the project has a `.vscode/` directory. `.vscode/` is only
815
+ > Bridge's VS Code project heuristic; it does not prove that GitHub Copilot is
816
+ > installed or enabled.
817
+ > - **Input.** A prompt file reads its input from `${input:task}`. Text supplied
818
+ > after the slash command takes precedence when present, and the agent asks
819
+ > you for the task when both are empty.
820
+ > - **Tools.** Bridge MCP tools come from the generated `.vscode/mcp.json`
821
+ > registration. Prompt files carry no `tools` frontmatter restriction.
822
+ > - **Reserved names.** `.github/prompts/<packaged-command>.prompt.md` and
823
+ > `.github/skills/<packaged-command>/SKILL.md` are Bridge-managed. Rerunning
824
+ > init overwrites a changed file at one of those paths and reports
825
+ > `Overwritten (content changed)`. Files with any other name are never
826
+ > modified.
827
+ > - **Agent definitions are separate.** `.github/agents/*.agent.md` holds agent
828
+ > definitions, not reusable workflow commands.
829
+ > - **If a command is not discovered.** Open VS Code's Chat Customizations
830
+ > diagnostics and confirm the workspace is trusted. If Agent Host is recorded
831
+ > as `UNSUPPORTED_DISCOVERY`, switch the chat session to the Local agent and
832
+ > use the `.github/prompts/` prompt files instead.
805
833
 
806
834
  ### Extra Capabilities
807
835
 
@@ -1004,14 +1032,15 @@ npx -y @bridge_gpt/mcp-server start-tickets [flags] KEY [KEY ...]
1004
1032
  | `--agent claude\|cursor-agent` | `claude` | Agent command to launch in each worktree |
1005
1033
  | `--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
1034
  | `--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. |
1035
+ | `--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`. |
1036
+ | `--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
1037
  | `--terminal terminal\|iterm` | auto-detect via `$TERM_PROGRAM` | Override the macOS terminal app (honored on macOS only) |
1009
1038
  | `--dry-run` | off | Print intended actions; create no worktrees, open no tabs (any OS) |
1010
1039
  | `--branch KEY=BRANCH` | `feature/<KEY>` | Use a custom branch for that ticket (repeatable) |
1011
1040
  | `--base-branch <BRANCH>` | `main` | Cut new worktrees from `<BRANCH>` and refresh `origin/<BRANCH>` instead of `main` |
1012
1041
  | `--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
1042
  | `--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>'`. |
1043
+ | `--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
1044
  | `-h`, `--help` | — | Show usage |
1016
1045
 
1017
1046
  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 +1053,11 @@ npx -y @bridge_gpt/mcp-server start-tickets --agent cursor-agent BAPI-248
1024
1053
 
1025
1054
  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
1055
 
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.
1056
+ **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).
1057
+
1058
+ **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.
1059
+
1060
+ **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
1061
 
1029
1062
  **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
1063
 
@@ -1080,12 +1113,12 @@ your project can actually run:
1080
1113
  npx -y @bridge_gpt/mcp-server drive-epic <EPIC>
1081
1114
  ```
1082
1115
 
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,
1116
+ You are never asked to choose. `drive-epic` routes to exactly one conductor, the
1117
+ v2 engine — one transition authority per epic is what keeps an epic from wedging.
1118
+ Readiness green routes to the v2 bootstrap below (pass `--plan-file`
1119
+ and `drive-epic` runs it for you); readiness not green reports that the v2 engine
1120
+ is not ready to drive this epic — there is no alternative conductor to fall back
1121
+ to — and prints no conductor invocation. If readiness is **unknown** — unreachable,
1089
1122
  unauthorized, or malformed — it escalates and prints no conductor invocation at
1090
1123
  all, because an unknown owner is not the same as a not-ready one. No branch,
1091
1124
  including every error path, ever offers you two paths.
@@ -1200,85 +1233,132 @@ Once the plan is approved, the **server-side reconciler** picks the run up withi
1200
1233
  npx -y @bridge_gpt/mcp-server executor --repo <name>
1201
1234
  ```
1202
1235
 
1203
- ### `implement-epic`
1236
+ ### Conductor (epic & multi-agent orchestration)
1237
+
1238
+ 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.)
1239
+
1240
+ > The v1 `epic-implementer epic-tick` command is **frozen** — it throws on every invocation. There is nothing to schedule locally, and `epic-implementer doctor` flags any epic-tick schedule left over from an earlier release so you can cancel it.
1204
1241
 
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.
1242
+ <!-- BEGIN GENERATED: merge-workflow-install (managed by mcp_server/scripts/sync-readme-merge-workflow.js — DO NOT EDIT BY HAND) -->
1243
+ ### `install-bridge conductor --merge-workflow`
1244
+
1245
+ Generates the Epic Implementer **merge workflow** plus its CODEOWNERS fragment
1246
+ and repository-rule guidance, commits them on a managed branch, pushes with
1247
+ **your own git identity**, and opens a pull request with **your own `gh`**.
1211
1248
 
1212
1249
  ```
1213
- npx -y @bridge_gpt/mcp-server implement-epic <verb> [flags]
1250
+ npx -y @bridge_gpt/mcp-server install-bridge conductor --merge-workflow --codeowner <@org/team|@user>
1214
1251
  ```
1215
1252
 
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.
1253
+ `--codeowner` is **required** and takes exactly one `@user` or `@org/team`. It is
1254
+ never inferred from repository metadata, and a documentation placeholder is
1255
+ rejected. `--dry-run` prints the plan and performs **no** write: no branch, no
1256
+ file, no install-state write, no commit, no push, and no pull request.
1276
1257
 
1277
- ### Conductor (epic & multi-agent orchestration)
1258
+ **Bridge performs no repository write, and the pull request is never merged for
1259
+ you.** Reviewing the workflow before it lands is the security control — it is the
1260
+ one file in your repository that can perform a privileged merge.
1278
1261
 
1279
- 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.)
1262
+ #### Files it generates
1280
1263
 
1281
- > The v1 `epic-implementer epic-tick` command is **frozen** — it throws on every invocation. There is nothing to schedule locally, and `epic-implementer doctor` flags any epic-tick schedule left over from an earlier release so you can cancel it.
1264
+ | Path | What it is |
1265
+ |---|---|
1266
+ | `.github/workflows/epic-implementer-merge.yml` | The merge workflow, contract version 1. |
1267
+ | `.bridge/merge-workflow/CODEOWNERS.fragment` | A CODEOWNERS rule for that path. Not in force until you merge it into your active CODEOWNERS file. |
1268
+ | `.bridge/merge-workflow/REPOSITORY-RULES.md` | The setup steps, including the repository rule that actually enforces review. |
1269
+
1270
+ #### The four content outcomes
1271
+
1272
+ Re-running is safe and reports exactly one of these:
1273
+
1274
+ | Outcome | What happens |
1275
+ |---|---|
1276
+ | **not installed** | The workflow and companions are written on a managed branch and a pull request is opened. |
1277
+ | **managed version is older** | The same, labelled explicitly as an *upgrade* in the branch, commit, pull request title, and terminal summary. |
1278
+ | **identical** | A clean no-op. Nothing is written and no pull request is opened. |
1279
+ | **modified/unrecognized** | Fail-closed. Your file is preserved untouched and never overwritten — including a file that merely *claims* an older version in its marker. |
1280
+
1281
+ An already-open installation or upgrade pull request is **reported, not
1282
+ duplicated**: the command verifies its branch, base, and file set and prints its
1283
+ URL instead of creating a second branch, commit, push, or pull request.
1284
+
1285
+ #### What you must do after merging
1286
+
1287
+ 1. Create a repository Actions **secret** named `BAPI_API_KEY` holding a Bridge API key for the repository. Its value must **never** be passed to the installer, committed, printed, or placed in `--dry-run` output — the CLI has no flag, prompt, or file field that accepts one.
1288
+ 2. Merge the generated CODEOWNERS rule into your active CODEOWNERS file. The fragment enforces nothing by itself.
1289
+ 3. Add a default-branch repository rule requiring a pull request and code-owner review. **Until this rule exists, the workflow path is not protected.**
1290
+
1291
+ Optionally set a repository Actions **variable** named `BAPI_BASE_URL` to point the workflow at a non-default Bridge deployment (default `https://bridgegpt-api.com`). A variable, not a workflow input: the base URL decides which server authorizes a merge.
1292
+
1293
+ #### Merge credentials (`local` and `machine_token` modes)
1294
+
1295
+ No merge path reads an ambient `gh` login. Each mode reads exactly one
1296
+ process-launch configuration key, with **no fallback** between them and none to
1297
+ an inherited `GH_TOKEN`, `GITHUB_TOKEN`, a `gh auth` session, or the Bridge
1298
+ credential store. Bridge never stores either value.
1299
+
1300
+ | Mode | Key | Provenance |
1301
+ |---|---|---|
1302
+ | `local` | `BAPI_LOCAL_MERGE_TOKEN` | A configured local scoped credential. |
1303
+ | `machine_token` | `BAPI_MACHINE_MERGE_TOKEN` | Your machine user's credential. |
1304
+
1305
+ Supply them at process launch, or from an approved external secret manager.
1306
+
1307
+ | Preflight outcome | Remediation |
1308
+ |---|---|
1309
+ | `*_credential_missing` | Set the mode's key in the environment this MCP server is launched with. |
1310
+ | `*_credential_invalid` | GitHub rejected the configured credential. Rotate it and relaunch. |
1311
+ | `*_credential_unpermitted` | It authenticates but cannot write to this repository. Grant it merge permission. |
1312
+ | `local_gh_unavailable` | Install the GitHub CLI (`gh`) on the machine running this MCP server. |
1313
+
1314
+ #### What the workflow does and does not do
1315
+
1316
+ - It **never checks out** the repository and never runs pull-request content.
1317
+ - It uses **no third-party action** and no `uses:` step — only runner-provided bash, curl, jq, and `gh`.
1318
+ - It merges only under an **expected-head-SHA precondition**.
1319
+ - It **refuses a fork-origin** or otherwise unverifiable head.
1320
+ - It **refuses any base that is the repository default branch**, without retrying.
1321
+ - It **reports** the result to Bridge after the merge and read-back; the report decides nothing.
1322
+
1323
+ `workflow_dispatch` always runs the workflow definition on the **trusted default
1324
+ branch**, so a pull request that edits the file cannot change the version that runs
1325
+ against it.
1326
+
1327
+ #### Canonical template
1328
+
1329
+ Git blob SHA of the rendered workflow: `3d4956c9447223c37075069352cdd9aae2d561dc`
1330
+
1331
+ ```yaml
1332
+ name: Epic Implementer merge
1333
+
1334
+ env:
1335
+ x-bridge-merge-contract-version: 1
1336
+
1337
+ on:
1338
+ workflow_dispatch:
1339
+ inputs:
1340
+ action_key:
1341
+ description: >-
1342
+ Durable merge-action key naming the approved attempt. A wake-up and a
1343
+ correlator only; it authorizes nothing by itself.
1344
+ required: true
1345
+ type: string
1346
+ lease_owner:
1347
+ description: >-
1348
+ Per-attempt lease secret proving this run is the live attempt. Never
1349
+ printed, never echoed, never written to an output.
1350
+ required: true
1351
+ type: string
1352
+
1353
+ permissions:
1354
+ contents: write
1355
+ pull-requests: write
1356
+
1357
+ concurrency:
1358
+ group: epic-implementer-merge-${{ inputs.action_key }}
1359
+ cancel-in-progress: false
1360
+ ```
1361
+ <!-- END GENERATED: merge-workflow-install -->
1282
1362
 
1283
1363
  ## Custom Pipelines
1284
1364
 
@@ -1559,18 +1639,56 @@ there is no fallback path for it.
1559
1639
  informational only: it cannot confirm the next worker spawn will authenticate,
1560
1640
  and it never blocks the doctor run or changes its exit code.
1561
1641
 
1642
+ ## Personal model routing preferences
1643
+
1644
+ Create `~/.config/bridge/model-routing.json` to choose ordered providers for
1645
+ ticket review, Second Opinion, and AI Council without changing shared project
1646
+ configuration. The file is personal and uncommitted, contains no credentials,
1647
+ and is reread for every request. The repository key must exactly match Bridge's
1648
+ `repo_name`:
1649
+
1650
+ ```json
1651
+ {
1652
+ "version": 1,
1653
+ "defaults": {
1654
+ "review_ticket": ["gemini", "anthropic"],
1655
+ "second_opinion": ["anthropic", "gemini"],
1656
+ "council": ["anthropic", "gemini"]
1657
+ },
1658
+ "repositories": {
1659
+ "my-repo": { "council": ["gemini"] }
1660
+ }
1661
+ }
1662
+ ```
1663
+
1664
+ A repository entry replaces the machine entry only for a feature key it
1665
+ contains. Remove a key or set it to `[]` to restore automatic selection for
1666
+ that feature; an empty repository entry suppresses the machine entry. Delete
1667
+ the file to clear every preference. Malformed, unreadable, or unsafe files are
1668
+ ignored with a bounded local warning. Keep the file owned by your user and not
1669
+ writable by your group or others.
1670
+
1671
+ Only the exact initialized MCP client names `codex` and `claude-code`, or their
1672
+ installer markers, identify the Codex and Claude Code families. Cursor, GitHub
1673
+ Copilot, and unlisted clients remain neutral. Automatic Codex requests prefer
1674
+ eligible Anthropic then Gemini; Claude Code requests prefer eligible OpenAI
1675
+ then Gemini. Explicit per-call choices override this personal order but must
1676
+ still pass model support, project restrictions, and feature entitlement. A
1677
+ populated project Allowed Providers list can reduce an automatic request or
1678
+ refuse an incompatible explicit request.
1679
+
1562
1680
  ## Reference
1563
1681
 
1564
1682
  The full surface, for when you need the complete enumeration. Day-to-day, use [Usage Documentation](#usage-documentation) instead — you don't call MCP tools directly; you ask your AI assistant to perform a task, or compose tools into a pipeline.
1565
1683
 
1566
1684
  ### MCP tools
1567
1685
 
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).
1686
+ 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
1687
 
1570
1688
  - **Connectivity & identity** — `ping` (its JSON also carries `docs_dir`, `role`, and `customer_type`)
1571
1689
  - **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
1690
  - **Jira tickets** — `get_tickets`, `get_ticket`, `create_ticket`, `update_ticket_description`, `add_comment`, `get_comments`
1573
- - **Attachments** — `attachment` (operations: `upload`, `download`, `list`)
1691
+ - **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
1692
  - **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
1693
  - **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
1694
  - **Other AI** — `second_opinion`, `generate_image`, `generate_decision_page`, `visual_diff` (deterministic pixel diff of a rendered URL vs a design comp)
@@ -1587,7 +1705,7 @@ Pipelines are declarative, multi-step workflows your AI agent executes step-by-s
1587
1705
  | Pipeline | Description | Invoke with |
1588
1706
  |---|---|---|
1589
1707
  | `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` |
1708
+ | `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
1709
  | `idea-to-ticket` | Turn an idea into a Jira Task/Spike (or Epic + children) with research, dedup, and critique | `/idea-to-ticket "<idea>"` |
1592
1710
  | `plan-epic` | Decompose an epic into sub-tasks with a structured exploration doc for each | `/plan-epic "<epic>"` |
1593
1711
  | `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>"` |
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED — do not edit manually. Regenerate with: npm run build
2
2
  // This file is produced by scripts/bundle-agent-guidance.js from mcp_server/agent-guidance.md
3
- export const AGENT_GUIDANCE = "### Get Project Standards (`get_project_standards`)\n\n**When to use it:** (Implementation | Refinement) Before writing or reviewing code, so the agent applies this project's recorded coding standards instead of generic defaults.\n\n**How to use it:** Call the `get_project_standards` MCP tool directly — it takes no required input and returns the project's recorded standards text.\n\n### Second Opinion (`second_opinion`)\n\n**When to use it:** (Architecture | Refinement | Implementation) Any time you want a quick sanity check on a plan, draft, or decision from a fresh perspective.\n\n**How to use it:** Ask your agent — \"Get a second opinion from Gemini on whether the BAPI-123 plan's migration step is safe to run against production.\"\n\n### Council (`request_council`)\n\n**When to use it:** (Architecture | Refinement) Early, when you want a spread of approaches — technical for how to build it, design for how it should look, discovery for what still needs figuring out before a real ticket exists, general for a quick brief-driven pass before the repository is indexed.\n\n**How to use it:** `/council <question>`\n\n### Review Ticket (`request_ticket_review`)\n\n**When to use it:** (Refinement) Right after a ticket is drafted, before anyone starts building — to surface gaps and tighten it.\n\n**How to use it:** `/review-tickets BAPI-123` (command only — \"review\" as free text is easily mistaken for a freehand agent review). A single key reviews inline in the current session — no terminal tab, no worktree. For several tickets at once, `/review-tickets BAPI-123 BAPI-456` opens one terminal tab per ticket and reviews them in parallel with no worktrees; every review flag applies, and `--review KEY=auto,rounds=N` sets per-ticket overrides.";
3
+ export const AGENT_GUIDANCE = "### Get Project Standards (`get_project_standards`)\n\n**When to use it:** (Implementation | Refinement) Before writing or reviewing code, so the agent applies this project's recorded coding standards instead of generic defaults.\n\n**How to use it:** Call the `get_project_standards` MCP tool directly — it takes no required input and returns the project's recorded standards text.\n\n### Second Opinion (`second_opinion`)\n\n**When to use it:** (Architecture | Refinement | Implementation) Any time you want a quick sanity check on a plan, draft, or decision from a fresh perspective.\n\n**How to use it:** Ask your agent — \"Get a second opinion from Gemini on whether the BAPI-123 plan's migration step is safe to run against production.\"\n\n### AI Council (`request_council`)\n\n**When to use it:** (Architecture | Refinement) Early, when you want a spread of approaches — technical for how to build it, design for how it should look, discovery for what still needs figuring out before a real ticket exists, general for a quick brief-driven pass before the repository is indexed.\n\n**How to use it:** `/ai-council <question>`\n\n### Review Ticket (`request_ticket_review`)\n\n**When to use it:** (Refinement) Right after a ticket is drafted, before anyone starts building — to surface gaps and tighten it.\n\n**How to use it:** `/review-tickets BAPI-123` (command only — \"review\" as free text is easily mistaken for a freehand agent review). A single key reviews inline in the current session — no terminal tab, no worktree. For several tickets at once, `/review-tickets BAPI-123 BAPI-456` opens one terminal tab per ticket and reviews them in parallel with no worktrees; every review flag applies, and `--review KEY=auto,rounds=N` sets per-ticket overrides.";
@@ -33,6 +33,7 @@ const AGENTS_MD_PLATFORMS = new Set([
33
33
  export function resolveAgentNotesTargets(selectedPlatforms) {
34
34
  const targets = new Set();
35
35
  const unsupported = new Set();
36
+ const supported = new Set();
36
37
  for (const platform of selectedPlatforms) {
37
38
  if (platform === "windsurf") {
38
39
  unsupported.add(platform);
@@ -40,6 +41,7 @@ export function resolveAgentNotesTargets(selectedPlatforms) {
40
41
  }
41
42
  if (AGENTS_MD_PLATFORMS.has(platform)) {
42
43
  targets.add("AGENTS.md");
44
+ supported.add(platform);
43
45
  }
44
46
  // Claude Code additionally gets a CLAUDE.md pointer — never a substitute
45
47
  // for AGENTS.md, since @AGENTS.md would otherwise dangle.
@@ -52,7 +54,11 @@ export function resolveAgentNotesTargets(selectedPlatforms) {
52
54
  ordered.push("AGENTS.md");
53
55
  if (targets.has("CLAUDE.md"))
54
56
  ordered.push("CLAUDE.md");
55
- return { targets: ordered, unsupportedPlatforms: [...unsupported] };
57
+ return {
58
+ targets: ordered,
59
+ unsupportedPlatforms: [...unsupported],
60
+ supportedPlatforms: [...supported],
61
+ };
56
62
  }
57
63
  /** The one-line pointer note CLAUDE.md's owned region carries (BAPI-1207). */
58
64
  const CLAUDE_NOTES_POINTER_NOTE = "Bridge MCP usage guidance is maintained in AGENTS.md — see the section above.";
@@ -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