Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
325 commits
Select commit Hold shift + click to select a range
cc97bd6
Expose economy command readiness in routing
GenistarWynth May 29, 2026
1db46aa
Add runtime economy command health
GenistarWynth May 30, 2026
0d15b4c
Make Reasonix command setup conversational
GenistarWynth May 30, 2026
8769ef4
Update Patchbay skill routing guidance
GenistarWynth May 30, 2026
d004457
Accept explicit Reasonix command paths
GenistarWynth May 30, 2026
5d6d291
Add desktop Reasonix path setup
GenistarWynth May 30, 2026
0d0bc43
Recognize natural economy routing prompts
GenistarWynth May 30, 2026
fe167f7
Fix Chinese diagnostic view intents
GenistarWynth May 30, 2026
fc79742
Handle Chinese gated agent prompts
GenistarWynth May 30, 2026
a4bf407
Map localized desktop reply actions
GenistarWynth May 30, 2026
8377b99
Accept localized MCP host setup aliases
GenistarWynth May 30, 2026
3096d59
Recognize localized Reasonix setup prompts
GenistarWynth May 30, 2026
2b2bfb2
Document localized Reasonix agent prompts
GenistarWynth May 30, 2026
c9652f2
Map localized Reasonix actions in workbench
GenistarWynth May 30, 2026
5989be3
Return structured help actions
GenistarWynth May 30, 2026
1c7d17d
Recognize localized environment checks
GenistarWynth May 30, 2026
3f517ee
Recognize localized local agent prompts
GenistarWynth May 30, 2026
d646992
Map Chinese failure diagnostics in workbench
GenistarWynth May 30, 2026
6f4c394
Treat Skill and MCP setup prompts as local
GenistarWynth May 30, 2026
d599a9e
Return run-bound diagnostic view actions
GenistarWynth May 30, 2026
0fd2286
Target readiness prompts to MCP hosts
GenistarWynth May 30, 2026
85ab700
Handle next-step prompts as safe handoffs
GenistarWynth May 30, 2026
8d63f4c
Explain gate blockers through Agent
GenistarWynth May 30, 2026
de7fd9b
Render gate diagnosis in Workbench
GenistarWynth May 30, 2026
35ed36c
Treat routing questions as read-only
GenistarWynth May 30, 2026
907e740
Show structured local Agent replies
GenistarWynth May 30, 2026
10d8272
Keep local Agent actions in thread
GenistarWynth May 30, 2026
0dcebac
Preserve run references in local actions
GenistarWynth May 30, 2026
b7b3eac
Start fresh tasks from local Agent actions
GenistarWynth May 30, 2026
59e2074
Append selected-run status actions
GenistarWynth May 30, 2026
7cad263
Render diagnostic local Agent actions
GenistarWynth May 30, 2026
e12b3fc
Handle generic readiness actions
GenistarWynth May 30, 2026
94d60d8
Make doctor skip MCP probing by default
GenistarWynth May 30, 2026
36c22cc
Track background job completion
GenistarWynth May 30, 2026
adf520b
Report orphaned background jobs as failed
GenistarWynth May 30, 2026
f8acbd4
Expose normalized background job status
GenistarWynth May 30, 2026
d461a56
Show background jobs in workbench
GenistarWynth May 31, 2026
27d400a
Clarify economy route readiness
GenistarWynth May 31, 2026
f57741f
Route fix providers through fix registry
GenistarWynth May 31, 2026
ce7a938
Block economy phases until command ready
GenistarWynth May 31, 2026
34e35d6
Preserve Reasonix fix failure stage
GenistarWynth May 31, 2026
0e9c745
Surface blocked phase alternatives in workbench
GenistarWynth May 31, 2026
7cd7092
Make economy routing target configurable
GenistarWynth May 31, 2026
d8592ed
Preserve usage metrics for custom providers
GenistarWynth May 31, 2026
b771827
Check custom economy provider commands
GenistarWynth May 31, 2026
e5ea800
Use provider-specific command blockers
GenistarWynth May 31, 2026
a6ff8c9
Surface economy tier usage metrics
GenistarWynth May 31, 2026
66b605c
Add economy load handoff card
GenistarWynth May 31, 2026
cc63fa6
Read latest run metrics from agent prompts
GenistarWynth May 31, 2026
8500b45
Read latest run views from agent prompts
GenistarWynth May 31, 2026
f6500a6
Open latest run read-only replies in workbench
GenistarWynth May 31, 2026
3f19c95
Validate custom provider definitions before writing
GenistarWynth May 31, 2026
a4a9dc3
Activate custom providers as economy route
GenistarWynth May 31, 2026
6ab156d
Expose custom economy provider setup in agent
GenistarWynth May 31, 2026
8d6757a
Configure custom economy provider from agent
GenistarWynth May 31, 2026
48d879e
Document custom economy setup in skill
GenistarWynth May 31, 2026
d5d774b
Surface custom provider command fix action
GenistarWynth May 31, 2026
ab9c9b7
Cover custom economy command readiness action
GenistarWynth May 31, 2026
c653f28
Propagate custom provider command fix actions
GenistarWynth May 31, 2026
1126ca4
Prefer direct provider command fixes in health cards
GenistarWynth May 31, 2026
53a2ff6
Document custom provider command repair actions
GenistarWynth May 31, 2026
d38b726
Verify custom provider command copy fix
GenistarWynth May 31, 2026
69dbdf1
Support conversational custom provider command repair
GenistarWynth May 31, 2026
17ab189
Add inline custom provider command repair UI
GenistarWynth May 31, 2026
2530f9b
Expose provider command repair in MCP descriptions
GenistarWynth May 31, 2026
f076ad7
Expose economy efficiency summary
GenistarWynth May 31, 2026
8563038
Include run evidence in routing answers
GenistarWynth May 31, 2026
f215cec
Surface handoff efficiency evidence
GenistarWynth May 31, 2026
5d13d1f
Add handoff economy efficiency card
GenistarWynth May 31, 2026
ff7feb6
Return gate diagnosis for blocked apply
GenistarWynth May 31, 2026
65bae08
Expose next gate action
GenistarWynth May 31, 2026
8e35383
Wire gate actions into local replies
GenistarWynth May 31, 2026
d978627
Add host setup shortcuts to help
GenistarWynth May 31, 2026
5d0e2a2
Fix setup shortcut host routing
GenistarWynth May 31, 2026
53d67b6
Normalize setup host shortcuts
GenistarWynth May 31, 2026
d533d73
Route readiness shortcuts by host
GenistarWynth May 31, 2026
c667b0e
Expose host readiness help actions
GenistarWynth May 31, 2026
7b9cb8f
Surface action reasons in workbench
GenistarWynth May 31, 2026
fe88f3d
Tighten economy routing evidence
GenistarWynth May 31, 2026
e481f65
Expose safe background agent actions
GenistarWynth May 31, 2026
8de69a9
Add background job controls to workbench
GenistarWynth May 31, 2026
5c55b54
Wire overview background job controls
GenistarWynth May 31, 2026
54f5db6
Persist background job actions
GenistarWynth May 31, 2026
1e02ecf
Add background context polling actions
GenistarWynth May 31, 2026
c7ef06d
Auto-refresh background workbench jobs
GenistarWynth Jun 1, 2026
0f56a22
Expose structured Skill doctor actions
GenistarWynth Jun 1, 2026
ae035c2
Make background agent advances idempotent
GenistarWynth Jun 1, 2026
1d631d2
Support read-only agent context views
GenistarWynth Jun 1, 2026
032cd46
Open latest context replies in workbench
GenistarWynth Jun 1, 2026
48e83ed
Return events action for trace views
GenistarWynth Jun 1, 2026
9902c8b
Scope conversational setup actions
GenistarWynth Jun 1, 2026
3645d87
Preserve scoped setup actions in workbench
GenistarWynth Jun 1, 2026
289b1b3
Make Skill install a local Agent action
GenistarWynth Jun 1, 2026
f0789e7
Scope Skill doctor install actions
GenistarWynth Jun 1, 2026
e753f34
Honor MCP avoidance setup prompts
GenistarWynth Jun 1, 2026
bbeceb4
Expose local-only setup help action
GenistarWynth Jun 1, 2026
d0861d5
Suppress MCP followups for local setup
GenistarWynth Jun 1, 2026
cca83b7
Honor MCP avoidance in readiness
GenistarWynth Jun 1, 2026
25f0dee
Preserve no-MCP workbench actions
GenistarWynth Jun 1, 2026
e07b40b
Route terse DeepSeek writer intents
GenistarWynth Jun 1, 2026
37cc93f
Describe local-only setup in MCP schema
GenistarWynth Jun 1, 2026
e5ebcd7
Respect MCP avoidance in Skill guidance
GenistarWynth Jun 1, 2026
6003c9c
Add local-only setup controls to workbench
GenistarWynth Jun 1, 2026
0101886
Add explicit local-only readiness mode
GenistarWynth Jun 1, 2026
2206a59
Expose primary next-step action
GenistarWynth Jun 1, 2026
03067b3
Allow unattended plan approval for selected runs
GenistarWynth Jun 1, 2026
70ebc6b
Render primary next-step actions in workbench
GenistarWynth Jun 1, 2026
5ff7e6a
Route standalone no-MCP prompts to local mode
GenistarWynth Jun 1, 2026
1ae6057
Surface failed-run recovery in handoff actions
GenistarWynth Jun 1, 2026
b30ed02
Preview economy routing when starting agent runs
GenistarWynth Jun 1, 2026
72d5af5
Render start routing preview in workbench
GenistarWynth Jun 1, 2026
7bae002
Suppress MCP followups in local readiness
GenistarWynth Jun 1, 2026
fe043eb
Persist local-only readiness in workbench
GenistarWynth Jun 1, 2026
9fd5146
Persist local-only mode after setup
GenistarWynth Jun 1, 2026
dc60cf0
Clarify local-only readiness host selector
GenistarWynth Jun 1, 2026
f55138c
Expose workload policy for economy routing
GenistarWynth Jun 1, 2026
c3fba3e
Surface routing policy in readiness
GenistarWynth Jun 2, 2026
9739c73
Surface routing policy after setup
GenistarWynth Jun 2, 2026
c370d9c
Lift setup recommendations into next actions
GenistarWynth Jun 2, 2026
15c2651
Render setup recommendations in workbench
GenistarWynth Jun 2, 2026
04c4205
Surface custom provider command readiness action
GenistarWynth Jun 2, 2026
7baa926
Include setup recommendations in agent reply
GenistarWynth Jun 2, 2026
b84c7c9
Document setup recommendations in MCP schema
GenistarWynth Jun 2, 2026
b0648fd
Prioritize provider command repair actions
GenistarWynth Jun 2, 2026
3fed403
Align provider command action ordering docs
GenistarWynth Jun 2, 2026
a444ef0
Mention setup recommendation actions in help
GenistarWynth Jun 2, 2026
34f272d
Document custom provider agent prompts in Chinese README
GenistarWynth Jun 2, 2026
688283e
Surface custom provider prompts in English quickstart
GenistarWynth Jun 2, 2026
ba49115
List custom provider prompts in Patchbay Skill
GenistarWynth Jun 2, 2026
a14f80e
Add timeout diagnostics to agent CLI tests
GenistarWynth Jun 2, 2026
7dfc38a
Expose DeepSeek provider help action
GenistarWynth Jun 2, 2026
fd198d9
Handle generic local agent help actions
GenistarWynth Jun 2, 2026
7790607
Offer custom cheap writer setup from readiness
GenistarWynth Jun 2, 2026
f2377bb
Improve agent polling performance
GenistarWynth Jun 2, 2026
17712d3
Run generic local agent actions from workbench
GenistarWynth Jun 2, 2026
22db11c
Prefer conversational agent in Patchbay Skill
GenistarWynth Jun 2, 2026
07c8732
Expose context in background agent followups
GenistarWynth Jun 2, 2026
eae730e
Group structured agent followup actions
GenistarWynth Jun 2, 2026
70b72ec
Expose action groups for direct tools
GenistarWynth Jun 2, 2026
d2305d0
Group failure recovery actions
GenistarWynth Jun 2, 2026
140e9ee
Group failure recovery controls in web
GenistarWynth Jun 2, 2026
328048f
Group agent fallback recovery actions
GenistarWynth Jun 2, 2026
84d8733
Respect browser-skill MCP avoidance prompts
GenistarWynth Jun 2, 2026
5e21aca
Quote MCP install fallback paths
GenistarWynth Jun 2, 2026
acf1a25
Use bundled MCP server path for registration
GenistarWynth Jun 2, 2026
fc2741c
Accept Codex Skill host aliases
GenistarWynth Jun 2, 2026
2251cb6
Activate economy providers through web API
GenistarWynth Jun 2, 2026
572f6d0
Advertise Codex Skill aliases in MCP schema
GenistarWynth Jun 2, 2026
232077b
Reuse canonical MCP descriptions for legacy tools
GenistarWynth Jun 2, 2026
89bfcd3
Clean wheel metadata for bundled assets
GenistarWynth Jun 2, 2026
ad2964f
Detect installed Patchbay console scripts
GenistarWynth Jun 2, 2026
2f98027
Add guarded economy provider setup
GenistarWynth Jun 2, 2026
b65dbaa
Document guarded economy provider setup
GenistarWynth Jun 2, 2026
da6a515
Expose local economy prompts in MCP schema
GenistarWynth Jun 2, 2026
9ae9d75
Teach agent help local economy prompts
GenistarWynth Jun 2, 2026
5f9527d
Add local mode help action
GenistarWynth Jun 2, 2026
081c5eb
Persist web local mode from agent replies
GenistarWynth Jun 2, 2026
c556220
Explain economy workload policy in agent replies
GenistarWynth Jun 2, 2026
77547c7
Detect outdated installed Patchbay Skill
GenistarWynth Jun 2, 2026
0b93915
Surface outdated Skill drift in readiness
GenistarWynth Jun 2, 2026
c427ab0
Group readiness actions in web diagnostics
GenistarWynth Jun 2, 2026
32b3485
Match readiness action groups by command
GenistarWynth Jun 2, 2026
df94180
Preserve economy action groups in web replies
GenistarWynth Jun 3, 2026
b76bd21
Match local reply action groups by action keys
GenistarWynth Jun 3, 2026
dd7316c
Recognize natural unattended approval phrases
GenistarWynth Jun 3, 2026
968036b
Sync unattended approval wording in Skill docs
GenistarWynth Jun 3, 2026
d48b181
Advertise unattended approval in agent help
GenistarWynth Jun 3, 2026
ea7bc25
Document unattended approval in MCP schema
GenistarWynth Jun 3, 2026
01e7048
Render agent capabilities in web replies
GenistarWynth Jun 3, 2026
514f2ef
Document help capabilities for Skill clients
GenistarWynth Jun 3, 2026
74ffae4
Return run-aware agent help context
GenistarWynth Jun 3, 2026
de10753
Promote background polling in handoff context
GenistarWynth Jun 3, 2026
4060f06
Render background handoff polling in web UI
GenistarWynth Jun 3, 2026
02a7a15
Group handoff suggestions in web composer
GenistarWynth Jun 3, 2026
0610290
Document grouped composer suggestions
GenistarWynth Jun 3, 2026
95ccfe9
Group agent follow-up actions consistently
GenistarWynth Jun 3, 2026
6698bd8
Keep failure recovery visible in workbench
GenistarWynth Jun 3, 2026
eaa1e99
Show agent failure recovery in local replies
GenistarWynth Jun 3, 2026
ee59d2b
Slim Patchbay Skill contract loading
GenistarWynth Jun 3, 2026
6031164
Document progressive Patchbay Skill contract
GenistarWynth Jun 3, 2026
96f7456
Expose Patchbay Skill contract in agent help
GenistarWynth Jun 3, 2026
dfa8559
Share Patchbay Skill contract metadata
GenistarWynth Jun 3, 2026
ee25f66
Offer ready-state doctor followups
GenistarWynth Jun 3, 2026
5b0179f
Promote ready doctor actions in Agent replies
GenistarWynth Jun 3, 2026
6264324
Share routing context on direct plan
GenistarWynth Jun 3, 2026
bf9ac11
Require confirmation for direct apply
GenistarWynth Jun 3, 2026
2b8b601
Group copyable provider commands as commands
GenistarWynth Jun 3, 2026
44e5f29
Require Web apply confirmation payload
GenistarWynth Jun 3, 2026
38b2cd2
Document action group semantics
GenistarWynth Jun 3, 2026
d0fe83b
Group local command actions in web replies
GenistarWynth Jun 3, 2026
a57f907
Fix config profile apply schema matching
GenistarWynth Jun 3, 2026
ecb17b6
Document apply confirmation in user guides
GenistarWynth Jun 3, 2026
f03b251
Recognize Chinese low-cost routing prompts
GenistarWynth Jun 3, 2026
982cc2f
Add background job cancellation controls
GenistarWynth Jun 3, 2026
c931c39
Add structured runs inbox for multi-run workbench
GenistarWynth Jun 3, 2026
19a0e74
Select focused run from inbox priority
GenistarWynth Jun 3, 2026
bc537c2
Filter runs by inbox group
GenistarWynth Jun 3, 2026
91d125c
Add inbox action buttons to web workbench
GenistarWynth Jun 3, 2026
668a77b
Add CLI inbox views for runs
GenistarWynth Jun 3, 2026
fac4cf8
Document Skill inbox CLI views
GenistarWynth Jun 3, 2026
bb1dd08
Render Agent runs as local inbox
GenistarWynth Jun 3, 2026
ef9e001
Render readiness as local summary
GenistarWynth Jun 3, 2026
e7fcbd5
Render setup as local summary
GenistarWynth Jun 3, 2026
9f42ed2
Render profile routing as local summary
GenistarWynth Jun 3, 2026
e92aaad
Render metrics as local efficiency summary
GenistarWynth Jun 3, 2026
7d9a684
Render agent guidance as local summary
GenistarWynth Jun 3, 2026
4195a82
Render run diagnostics as local summaries
GenistarWynth Jun 3, 2026
848bf8a
Render diagnostic views as local summaries
GenistarWynth Jun 3, 2026
a4d1fb4
Render web trace diagnostics as summaries
GenistarWynth Jun 3, 2026
6911a71
Summarize web log artifact diagnostics
GenistarWynth Jun 3, 2026
d74d137
Summarize web config diagnostics
GenistarWynth Jun 3, 2026
ef5f81d
Summarize web diff diagnostics
GenistarWynth Jun 3, 2026
8582e1f
Summarize web provider diagnostics
GenistarWynth Jun 3, 2026
40b0f9a
Summarize web run snapshot
GenistarWynth Jun 3, 2026
d2f2dfa
Surface run inbox quick signals
GenistarWynth Jun 3, 2026
b0611d0
Surface start context routing
GenistarWynth Jun 4, 2026
d92c624
Persist no-MCP workbench preference
GenistarWynth Jun 4, 2026
3f8e474
Document persisted no-MCP Skill guidance
GenistarWynth Jun 4, 2026
c1d56cc
Allow reversible no-MCP workbench setup
GenistarWynth Jun 4, 2026
527f22d
Persist setup host preference
GenistarWynth Jun 4, 2026
91e02d4
Persist workbench session view
GenistarWynth Jun 4, 2026
9c66e5a
Persist workbench composer drafts
GenistarWynth Jun 4, 2026
08274b7
Persist workbench sidebar filters
GenistarWynth Jun 4, 2026
a9c48d0
Persist workbench local transcript
GenistarWynth Jun 4, 2026
c68019d
Persist trace message selection
GenistarWynth Jun 4, 2026
66005c7
Refresh selected run details
GenistarWynth Jun 4, 2026
2a07424
Persist new task view
GenistarWynth Jun 4, 2026
c0c946f
Make command copying reliable
GenistarWynth Jun 4, 2026
4ccf9b5
Throttle hidden idle polling
GenistarWynth Jun 4, 2026
c7c1c7c
Show workbench action failures
GenistarWynth Jun 4, 2026
91930f5
Show diagnostic action failures
GenistarWynth Jun 4, 2026
7ecdfce
Show local reply action failures
GenistarWynth Jun 4, 2026
506151b
Show topbar refresh failures
GenistarWynth Jun 4, 2026
1612d25
Show composer send failures
GenistarWynth Jun 4, 2026
2658c35
Show setup routing failures
GenistarWynth Jun 4, 2026
081b186
Name workbench loading failures
GenistarWynth Jun 4, 2026
8f5468c
Name missing latest run failures
GenistarWynth Jun 4, 2026
5814281
Show provider copy failures
GenistarWynth Jun 4, 2026
a1a4c68
Reset copy status on command changes
GenistarWynth Jun 4, 2026
ec32773
Recognize more unattended approval phrases
GenistarWynth Jun 4, 2026
770a06d
Show provider repair commands
GenistarWynth Jun 4, 2026
08c53a7
Recognize implicit browser skill local mode
GenistarWynth Jun 4, 2026
83fee96
Refresh workbench readiness after local browser preference
GenistarWynth Jun 4, 2026
9568a4f
Keep workbench local mode readiness in sync
GenistarWynth Jun 4, 2026
478d7a9
Accept more Chinese unattended approval phrases
GenistarWynth Jun 4, 2026
f6f4a67
Render background agent text controls
GenistarWynth Jun 4, 2026
1d2f495
Show background cancel state in workbench replies
GenistarWynth Jun 4, 2026
137af0d
Render failed background cancel details
GenistarWynth Jun 4, 2026
b78fbea
Document background cancel reply retention
GenistarWynth Jun 4, 2026
f57ef8b
Resolve stateless background job controls
GenistarWynth Jun 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .ai/patchbay.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ max_context_files = 30
max_patch_attempts = 3
max_repair_iterations = 2

[profiles.economy]
provider = "reasonix_cli"
model = "deepseek-v4-pro"
command_key = "reasonix"
label = "Reasonix/DeepSeek"

[workflow]
require_plan_approval = true
default_branch_prefix = "patchbay"
worktree_root = "../.patchbay-worktrees"
fail_on_dirty_workspace = true
apply_to_current_workspace_only_after_review_pass = true
allow_apply_without_tests = false # set true only for demo/mock repos that intentionally skip tests

[commands_allowlist]
test = [
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
.ai-flow-worktrees/
__pycache__/
*.pyc
web/node_modules/
web/dist/
web/*.tsbuildinfo
web/vite.config.d.ts
web/vite.config.js
14 changes: 8 additions & 6 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ secret-like files, absolute paths, and path-traversal patterns.
configuration, mock mode, and safety enforcement are implemented.

**Recently shipped (v0.1.0 → current):**
- **Unified handoff context**: `patchbay context <run_id>` and `patchbay_context` synthesize status, gate state, next safe action, provider trail, artifacts, and timeline into one cross-host resume payload.
- **Cross-host visibility**: `events.jsonl` per run + `patchbay events` CLI + `patchbay_events` MCP tool. Any host can inspect what every phase/agent did, including provider, model, action, and timestamps.
- **Free phase-to-provider routing**: Any configured provider that advertises a role (plan/write/review/fix) can be assigned to any phase. Unsupported assignments fail with a clear error.
- **Interactive configuration**: `patchbay config` wizard + `patchbay config set k v` + `patchbay doctor`. No hand-editing TOML required.
Expand All @@ -74,24 +75,25 @@ configuration, mock mode, and safety enforcement are implemented.

The project is actively maintained.

## Next Planned Feature: Custom Providers
## Custom Providers

User-defined provider entries (`[providers.<id>]` TOML blocks) are planned for a
future release. The design covers:
User-defined CLI provider entries (`[providers.<id>]` TOML blocks) are implemented
for the current runtime via `patchbay config provider add-cli`. The broader design
continues to track additional modes and stronger provider-specific controls:

- Four execution modes: `cli_stdin`, `cli_stdout`, `http_api`, `acp`
- Role capability mask (a single provider can be registered for planner, writer,
reviewer, fixer, or any combination)
- Output parsing contract (sentinel markers, JSON paths)
- Safety constraints (path allowlists, deny patterns, execution blocking)

**This is a design document only — not yet implemented.** See
[docs/custom-providers-plan.md](docs/custom-providers-plan.md) for the full plan.
See [docs/custom-providers-plan.md](docs/custom-providers-plan.md) for the current
CLI baseline and the remaining HTTP/ACP roadmap.

## Pointers

- [README.md](README.md) — English readme, quick start, config reference
- [README.zh-CN.md](README.zh-CN.md) — Chinese readme
- [docs/patchbay.md](docs/patchbay.md) — Full documentation (Chinese)
- [docs/custom-providers-plan.md](docs/custom-providers-plan.md) — Custom providers design (planned)
- [docs/custom-providers-plan.md](docs/custom-providers-plan.md) — Custom providers baseline and roadmap
- [AGENTS.md](AGENTS.md) — Agent instruction block for MCP hosts
133 changes: 120 additions & 13 deletions README.md

Large diffs are not rendered by default.

149 changes: 133 additions & 16 deletions README.zh-CN.md

Large diffs are not rendered by default.

38 changes: 24 additions & 14 deletions docs/custom-providers-plan.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Custom Provider Support — Planning Document
# Custom Provider Support

> **Status: plan only, not yet implemented.**
> This document enumerates the design, schema, safety constraints, and test surface for user-defined provider entries. No runtime code, registry changes, or config parsing for custom providers ships yet.
> **Status: CLI baseline implemented; broader provider modes remain roadmap.**
> Runtime support now covers TOML-defined CLI providers with `roles`, `command`, `args`, `prompt_mode`, and `output_contract`, plus `patchbay config provider add-cli`. This document keeps the shipped CLI contract and the remaining HTTP/ACP/safety roadmap in one place.

## Motivation

Patchbay currently hard-codes a fixed set of providers in each role registry (`PLANNERS`, `WRITERS`, `REVIEWERS`, `FIXERS`). Users who want to plug in a different CLI agent, a local model server, or an HTTP endpoint must edit Python adapter code in `scripts/ai_flow/adapters/`. A declarative `[providers.<id>]` TOML block lets users define new providers in `.ai/patchbay.toml` without touching the codebase.
Patchbay ships built-in providers in each role registry (`PLANNERS`, `WRITERS`, `REVIEWERS`, `FIXERS`) and can also register custom CLI providers from `.ai/patchbay.toml`. Users who want to plug in a different CLI agent can do so without editing Python adapter code. Local model servers, HTTP endpoints, and generic ACP providers remain future expansion points.

## Scope (in scope, future implementation)
## Scope

- TOML-driven provider registration under `[providers.<id>]`.
- Four modes: `cli_stdin` (prompt on stdin, output on stdout), `cli_stdout` (prompt as CLI arg), `http_api` (OpenAI-compatible Chat Completions), `acp` (Agent Communication Protocol, JSON-RPC over stdio).
- Per-provider role capability mask: a single provider can be registered for one or more of `planner`, `writer`, `reviewer`, `fixer`.
- Phase resolution (`resolve_phase`) reads providers from config and merges them into the existing registries at resolution time.
- Output parsing contract: define sentinel markers, regex, or JSON paths to extract the relevant content from provider output.
- Safety constraints: path allowlists, deny patterns, execution blocking, timeout enforcement.
- Mock harness: built-in mock provider that exercises the generic adapter path.
- Full test surface: unit tests for config parsing, provider dispatch, output parsing, safety enforcement, and integration tests for end-to-end flow.
- Shipped: TOML-driven CLI provider registration under `[providers.<id>]`.
- Shipped: `roles` capability mask using `plan`, `write`, `review`, and `fix`.
- Shipped: CLI prompt delivery through `prompt_mode = "stdin" | "arg" | "file"`.
- Shipped: output contracts `plan_json`, `review_verdict`, `writer_diff`, and `worktree_diff`.
- Shipped: phase resolution registers configured providers into the existing registries at load time.
- Shipped: custom provider IDs are rejected before registration or `add-cli` writes when they collide with built-ins (`reasonix_cli`, `claude_cli`, `codex_cli`, `gemini_cli`, `mock`).
- Shipped: `patchbay config provider add-cli --activate-economy` registers a custom write/fix provider and immediately makes it the low-cost economy route.
- Roadmap: HTTP API mode, generic ACP mode, provider-specific path allowlists/denylists, execution blocking, and richer output extraction.

## Out of scope

Expand Down Expand Up @@ -114,6 +114,16 @@ If a provider is referenced in a phase but doesn't list that role, Patchbay rais
| `http_api` | OpenAI-compatible POST to `base_url/chat/completions` | JSON response body | Local model servers, proxies |
| `acp` | JSON-RPC over stdio (ACP protocol) | ACP transcript | Agents that speak the ACP wire format |

### Usage reporting contract

For every custom CLI provider invocation, Patchbay sets `PATCHBAY_USAGE_FILE` to a JSON sidecar path inside the run directory. Wrappers can write either a JSON object or JSONL records there with OpenAI/Claude-style fields such as `usage.prompt_tokens`, `usage.completion_tokens`, `usage.input_tokens`, `usage.output_tokens`, `usage.cache_read_input_tokens`, `total_cost_usd`, or `estimated_cost_usd`.

Patchbay merges usage found in stdout, stderr, and the sidecar, then preserves it through all output contracts, including `worktree_diff`. The merged totals flow into `events.jsonl`, `patchbay metrics`, `run_metrics.provider_usage`, `run_metrics.tier_usage`, and the Web workbench efficiency panel, so cheap high-volume writer/fixer routes can be verified with actual token/cost/duration evidence instead of provider names alone. `tier_usage.economy` groups write/fix, `tier_usage.supervision` groups plan/review, and `tier_usage.execution` groups test/apply so teams can see whether simple bulk work is actually consuming the expected low-cost share.

When a custom provider is used as `[profiles.economy]`, readiness, metrics, and write/fix preflight gates also validate `providers.<id>.command`. Missing or unresolved commands are reported as `command_not_ready` with a copyable `configure_economy_provider_command` action before `inspect_economy_provider_command`, then leave the run in its prior durable state. The built-in Reasonix path continues to use the dedicated `configure_reasonix_command` action for `commands.reasonix`.

`patchbay config provider add-cli` validates provider IDs, roles, command, prompt mode, and output contract before writing `.ai/patchbay.toml`. Invalid definitions fail without mutating the project config, so a bad low-cost provider setup cannot poison later doctor/setup runs. Add `--activate-economy --economy-model <model> --economy-label <label>` to write `[profiles.economy]`, `[phases.write]`, and `[phases.fix]` in the same update; this requires both `write` and `fix` roles so a write-only provider cannot be accidentally chosen for repair loops.

---

## Provider Registry Integration
Expand Down Expand Up @@ -194,7 +204,7 @@ When implementing, every item below must be addressed:
- [ ] Provider output is redacted: any value from the provider's `env` that appears in stdout/stderr is replaced with `***REDACTED***` in logs.
- [ ] Provider process is killed on timeout; orphan cleanup is handled.
- [ ] Custom providers are never allowed to modify `.git/`, `.env*`, secret-like files, or paths outside the worktree (same rules as built-in providers).
- [ ] Custom providers cannot override built-in provider IDs (`reasonix_cli`, `claude_cli`, `codex_cli`, `gemini_cli`, `mock`).
- [x] Custom providers cannot override built-in provider IDs (`reasonix_cli`, `claude_cli`, `codex_cli`, `gemini_cli`, `mock`).

---

Expand Down
Loading