Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chrome Tab Context

Tiny macOS utility for capturing the active Chrome tab as reusable context.

With Chrome focused, press Caps Lock + T. It captures the active tab into this project and copies a short prompt to the clipboard. Paste that prompt into whichever AI chat or coding agent you want.

The macOS app is the main tool. The Chrome extension is optional and only improves capture-time diagnostics.

Captures are written to:

~/Library/Application Support/Chrome Tab Context/captures/

Each capture contains:

context.md
page.txt
page.html
network.json
console.json
extension.json
metadata.json

.chrome-tab-context/ and dist/ are ignored by Git for local development compatibility.

Install

Install the macOS capture app:

./scripts/install.sh /Applications

Installed piece:

/Applications/Chrome Tab Context.app

Then set up a keyboard shortcut with Karabiner, Raycast, Keyboard Maestro, BetterTouchTool, macOS Shortcuts, or any tool that can run a shell command. See Shortcut Setup.

The cleanup agent is optional:

./scripts/install-cleanup-agent.sh

It installs:

~/Library/LaunchAgents/com.bonapara.chromeTabContext.cleanup.plist

The app also cleans old captures when it runs.

Chrome Extension

The Chrome extension is optional. The core capture works without it.

Without the extension, the app still captures page text, selected text, HTML, metadata, and a best-effort Performance API network snapshot.

With the extension, Chrome pages get a tiny content-script bridge that lets the app request diagnostics from the page at capture time. This makes extension.json explicit and improves the optional network.json path.

To install it:

  1. Open chrome://extensions.
  2. Enable Developer mode.
  3. Click Load unpacked.
  4. Select this repo's extension/ folder.

Reload already-open tabs if you want the extension bridge available on them immediately.

The extension is intentionally low overhead:

  • no debugger permission
  • no background service worker
  • no polling
  • no console monkey-patching
  • no network interception

It only installs a tiny content-script message listener on normal http, https, and file pages. When the native capture app runs, it asks that listener for a capture-time performance snapshot.

Because of that constraint, network.json contains browser Performance API timing/resource entries, not full DevTools Network records. console.json is written, but historical console output is marked unavailable in this mode. Capturing full historical console output would require debugger attachment or patching console.*, which this extension avoids to keep Chrome performance unaffected.

Shortcut Setup

The app does not require Karabiner. Any shortcut tool can run:

/usr/bin/open -gj "/Applications/Chrome Tab Context.app"

For Karabiner-Elements, add a Complex Modification that runs that shell command. This example maps control + option + command + T in Chrome:

{
  "description": "Chrome: capture tab context",
  "manipulators": [
    {
      "type": "basic",
      "from": {
        "key_code": "t",
        "modifiers": {
          "mandatory": ["control", "option", "command"],
          "optional": ["any"]
        }
      },
      "to": [
        {
          "shell_command": "/usr/bin/open -gj '/Applications/Chrome Tab Context.app'"
        }
      ],
      "conditions": [
        {
          "type": "frontmost_application_if",
          "bundle_identifiers": ["^com\\.google\\.Chrome$"]
        }
      ]
    }
  ]
}

The bundled ./scripts/install-karabiner-rule.sh is optional and opinionated. It installs the author's Caps Lock layer shortcut (Caps Lock + T) and assumes the user's Karabiner config already defines a caps_lock pressed variable.

Permissions

Chrome may ask for Automation permission.

For page text and HTML capture, enable:

Chrome > View > Developer > Allow JavaScript from Apple Events

Accessibility access is no longer needed. Old applet, hotkey app, and earlier Accessibility entries are from experiments and can be ignored or removed.

Configuration

Defaults are intentionally plain:

CHROME_TAB_CONTEXT_RETENTION_DAYS=7
CHROME_TAB_CONTEXT_MAX_CHARS=80000
CHROME_TAB_CONTEXT_MAX_HTML_CHARS=0
CHROME_TAB_CONTEXT_MAX_NETWORK_ENTRIES=250
CHROME_TAB_CONTEXT_EXTENSION_WAIT_MS=150

Set CHROME_TAB_CONTEXT_MAX_HTML_CHARS to a positive number if you want HTML truncated. The old CODEX_CHROME_TAB_* names still work as compatibility aliases.

You can also set persistent local defaults in:

~/Library/Application Support/Chrome Tab Context/config.json

Example:

{
  "CHROME_TAB_CONTEXT_DIR": "/path/to/captures"
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages