How We Built an Authenticated Local Loopback Bridge for Browser AI Chats
Description and use
A local loopback bridge securely delivers repository context to AI chats, eliminating the need to upload ZIP files.
Problem
Keeping AI models informed of repository state via web interfaces requires uploading messy zips or manual copy‑pasting of many files.
Outcome
The bridge pre‑warms repository context in 340 ms and serves it securely over 127.0.0.1:4545, enabling instant AI prompt injection without exposing local files.
Workflow
- Start the bridge in the project directory with
tokencap serve --daemon - Read the output URL and pairing token
- Open ChatGPT or Claude in Chrome
- Open the TokenCap Companion popup
- Type the task (e.g., "refactor billing controller")
- Click "Inject Into Chat" to send context to the model
Evidence
Browser extensions cannot access local disk storage. To pass structured repository context without compromising security, we defined Bridge Contract v1:
Start the bridge in your project directory: tokencap serve --daemon
Bridge context pre-warmed in 340ms. Serving intelligence for: /Users/dev/projects/my-api
- Record date: 2026-10-01T20:10:49.081Z