Skip to content

feat(bridge): Phase 2-4 — vision testing, e2e actions, BrowserOS integration + demo #3

@gHashTag

Description

@gHashTag

TASK: Phase 2-4 — Vision Test → E2E Actions → BrowserOS Integration

Phase 0+1 Status: COMPLETE

  • trios-mcp-bridge running on port 9200 (Hono + Bun)
  • ✅ 10 MCP tools exposed
  • ✅ GitButler MCP connected (but mcp --internal)
  • ✅ BrowserOS MCP graceful fallback
  • /mcp endpoint live
  • --help correct

Bridge is alive. Now we make it see and act.

PHI LOOP: edit spec → seal hash → gen → test → verdict → experience → skill commit → git commit


Phase 2 — Vision Testing (Days 1-2)

Goal: gitbutler_analyze_ui accurately reads real GitButler screenshots

Step 1: Capture real fixture

# Open GitButler with some uncommitted changes
# Call the tool:
curl -X POST http://127.0.0.1:9200/mcp/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name": "gitbutler_screenshot", "arguments": {}}'

# Save output base64 PNG to:
mkdir -p tests/fixtures
# Save as tests/fixtures/gb_with_changes.png

Step 2: Test gitbutler_analyze_ui accuracy

curl -X POST http://127.0.0.1:9200/mcp/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name": "gitbutler_analyze_ui", "arguments": {}}'

# Expected output:
# {
#   "activeBranch": "feature-xyz",
#   "changedFiles": [{"path": "src/main.rs", "status": "modified", "staged": false}],
#   "stacks": [{"name": "...", "commits": 2}],
#   "hasUncommitted": true
# }

Refine vision prompt if needed:

  • If fields are null → improve LLM prompt in src/bridge-server.ts gitbutler_analyze_ui
  • Key: extract file paths (not just counts), staged vs unstaged, branch name exactly
  • Test on 3 different GB states: empty, staged only, mixed

Deliverable:

echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] PHASE2: vision accuracy tested | fields: activeBranch, changedFiles, stacks, hasUncommitted | accuracy: X/3 states correct" \
  >> experience/trios/phase2_vision_accuracy.trinity

Phase 3 — E2E Actions + Error Recovery (Days 3-5)

Goal: agent commits, branches, pushes via natural language

Test 1: gitbutler_commit_visible

curl -X POST http://127.0.0.1:9200/mcp/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name": "gitbutler_commit_visible", "arguments": {"message": "test: e2e commit via trios bridge"}}'

# Verify: GitButler UI shows new commit
# Verify: `git log --oneline -1` matches message

Test 2: gitbutler_create_branch

curl -X POST http://127.0.0.1:9200/mcp/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name": "gitbutler_create_branch", "arguments": {"name": "agent-test-branch"}}'
# Verify: branch appears in GB UI

Test 3: gitbutler_push_stack

curl -X POST http://127.0.0.1:9200/mcp/tools/call \
  -H 'Content-Type: application/json' \
  -d '{"name": "gitbutler_push_stack", "arguments": {}}'
# Verify: stack pushed to remote

Error recovery requirements:

  • If but mcp call fails → retry once, then return structured error (not 500)
  • If GitButler not open → clear message: "GitButler is not running. Start the app first."
  • If no uncommitted changes → "Nothing to commit. Workspace is clean."

Undo support:

// tools: gitbutler_absorb already exists
// Add: gitbutler_undo_last_commit (calls but mcp undo/amend)

Deliverable:

echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] PHASE3: e2e tests passed | commit+branch+push working | error recovery implemented" \
  >> experience/trios/phase3_e2e_actions.trinity

Phase 4 — BrowserOS Integration + Demo (Days 6-7)

Goal: agent commits from chat in BrowserOS

Step 1: Register trios-bridge in BrowserOS MCP config

Find BrowserOS MCP server list (likely in packages/browseros-agent/apps/server/src/ or .browseros/config.json):

// Add to MCP server registry:
{
  name: "trios-git",
  url: "http://127.0.0.1:9200/mcp",
  description: "Git + GitButler orchestrator with vision"
}

Step 2: Full demo flow

User (in BrowserOS chat):
"I see GitButler is open with some changes. Commit them to a new branch called 'fix-auth-flow'"

Agent:
1. calls gitbutler_screenshot
2. calls gitbutler_analyze_ui → sees 3 modified files
3. calls gitbutler_create_branch({name: 'fix-auth-flow'})
4. calls gitbutler_commit_visible({message: 'fix: auth flow improvements'})
5. replies: "✅ Committed 3 files to branch 'fix-auth-flow' (SHA: abc1234)"

Step 3: Record demo

  • Terminal + GitButler UI side by side
  • BrowserOS chat on right
  • Show: 1 chat message → new branch + commit in GB UI

Laws

Law Rule
L1 Closes #3 in every PR
L3 ASCII-only, English identifiers
L4 Tests for all 10 tools
L7 NO .sh files

Success Criteria

  • gitbutler_analyze_ui correctly reads: branch, files, staged status (3/3 test states)
  • gitbutler_commit_visible creates real commit in GitButler
  • gitbutler_create_branch creates virtual branch in GB
  • gitbutler_push_stack pushes to remote without error
  • Error messages are human-readable (no raw stack traces)
  • trios-bridge registered in BrowserOS MCP config
  • Demo: 1 chat message → commit in GitButler UI
  • All .trinity experience files committed
  • bun test green

Commit template

git commit -m "feat(bridge): Phase 2-4 vision+e2e+BrowserOS integration

- Phase 2: gitbutler_analyze_ui vision accuracy validated
- Phase 3: e2e commit/branch/push + error recovery
- Phase 4: BrowserOS MCP registration + demo
- experience: phase2+3+4 .trinity files sealed
Closes #3"

Agent returns:

✅ TASK phase2-4-trios-bridge COMPLETED | SHA: xxxxxxxxx | DEMO: agent committed from chat

φ² + 1/φ² = 3 | TRINITY | GO.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions