npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

context-bridge-cli

v0.1.0

Published

Bridge coding context between AI terminal agents — seamlessly transfer sessions between Claude, Gemini, Aider, and more

Readme

Context Bridge (cb)

Bridge coding context between AI agents. Seamlessly transfer session history, decisions, file modifications, and conversation context from one AI coding assistant to another.

Why?

When you switch between AI coding tools mid-task (Claude Code → Gemini, Aider → Claude, etc.), you lose all the context the previous agent built up. Context Bridge captures that context, compresses it into a token-efficient handoff prompt, and delivers it to your next agent.

Supported Agents

| Agent | Status | History Location | |-------|--------|-----------------| | Claude Code | ✅ Full | ~/.claude/projects/ | | Gemini CLI | ✅ Full | ~/.gemini/ | | Aider | ✅ Full | .aider.chat.history.md | | OpenCode | ✅ Full | ~/.local/share/opencode/ | | Cursor | 🔜 Placeholder | — | | Windsurf | 🔜 Placeholder | — |

Installation

# Clone the repo
git clone https://github.com/your-username/context-bridge.git
cd context-bridge

# Install dependencies
npm install

# Build
npm run build

# Link globally (makes `cb` available anywhere)
npm link

From npm (once published)

npm install -g context-bridge

Quick Start

# Run interactive setup (auto-detects agents, sets defaults)
cb init

# Or set up a global config (applies to all projects)
cb init --global

This walks you through choosing your default output mode, token budget, and shorthand aliases — then writes .cbrc.json so you never have to configure per-project.

Usage

Scan for agent histories

cb list
cb list -p /path/to/project

Shows which agents have session history in the current project and how many sessions exist.

Capture a session

# Capture latest Claude session
cb capture claude

# Capture a specific session and save to file
cb capture gemini -s session-id -o context.json

Outputs the full StandardCodingContext (decisions, files modified, errors, conversation history).

Bridge context between agents

# Bridge Claude → Gemini (output to stdout)
cb bridge --from claude --to gemini

# Bridge to clipboard for easy pasting
cb bridge --from aider --to claude -o clipboard

# Save to file
cb bridge --from gemini --to aider -o file -f handoff.md

# Preview without saving (dry run)
cb bridge --from claude --to gemini --dry-run

# Custom token budget
cb bridge --from claude --to gemini -t 8000

Configuration

Create a .cbrc.json in your project root or home directory:

{
  "defaultMaxTokens": 6000,
  "defaultOutput": "clipboard",
  "defaultOutputPath": ".context_bridge.md",
  "aliases": {
    "c": "claude",
    "g": "gemini",
    "a": "aider"
  }
}

Config is loaded from (first match wins):

  1. <project>/.cbrc.json
  2. <project>/.context-bridge.json
  3. ~/.cbrc.json

With aliases configured, you can use shorthand:

cb bridge --from c --to g

CLI Reference

cb init [-g] [-p path]                    Interactive setup, writes .cbrc.json
  -g, --global              Write to ~/.cbrc.json (all projects)
  -p, --path <path>         Project path (default: cwd)

cb list [-p path]                         Scan for agent histories

cb capture <agent> [-p path] [-s id] [-o file]   Capture session context

cb bridge --from <agent> --to <agent>     Bridge context between agents
  -p, --path <path>       Project path (default: cwd)
  -s, --session <id>      Specific session ID
  -t, --max-tokens <n>    Max tokens for output (default: 4000)
  -o, --output <mode>     clipboard | file | stdout (default: stdout)
  -f, --file <path>       Output file path (default: .context_bridge.md)
  --dry-run               Preview output without copying/saving

How It Works

  1. Detect — Adapter scans known locations for agent session files
  2. Parse — Raw session data (JSONL, JSON, markdown) is normalized into a StandardCodingContext
  3. Extract — Key decisions, modified files, and errors are pulled via pattern matching and tool-use block analysis
  4. Refine — Context is compressed to fit a token budget with target-agent-specific instructions
  5. Deliver — Output goes to clipboard, file, or stdout

Development

# Watch mode
npm run dev

# Build
npm run build

# Run without global install
npx ts-node src/cli.ts list

Adding a New Adapter

Create src/adapters/myagent.ts implementing the AgentAdapter interface:

import type { AgentAdapter } from '../types.js';

export const myAgentAdapter: AgentAdapter = {
  name: 'myagent',
  displayName: 'My Agent',
  detect: async (projectPath) => { /* return true if history exists */ },
  getSessions: async (projectPath) => { /* return SessionInfo[] */ },
  capture: async (projectPath, sessionId?) => { /* return StandardCodingContext */ },
};

Then register it in src/adapters/index.ts.

License

MIT