Hack with us on OpenCodeGraph, an experimental OSS project for code context

Quinn Slack

NOTE: The OpenCtx project was originally called OpenCodeGraph. This blog post has been updated to use the new name (OpenCtx).

In time for holiday hacking, we’re releasing an experiment we’re calling OpenCtx, a way to see contextual info about code from your dev tools in your editor, in code review, and anywhere else you read code.

For example, you can click from a GitHub PR to production metrics dashboards: Click on a metric in code to see the Prometheus dashboard

Or, in your editor, you can see what a React component looks like (according to your UI component library):

See what a React component looks like, using OpenCtx

Or you can make it so everyone who reviews a PR on GitHub sees contextual links to your internal docs (so they stop asking you the same questions and actually RTFM):

See contextual links in a GitHub PR

It’s easy to add support for:

  • more providers: any service that knows stuff about code: logging, o11y, static analysis, docs, infra, etc.
  • more clients: today it supports VS Code, GitHub (in code and PR views via a Chrome extension) and Sourcegraph Code Search, and soon it’ll support Cody

All this contextual info about code is obviously helpful for humans, but it will also help code AI tools such as Cody that will eventually consume this information (sneak preview). After all, a code AI tool probably needs to see the docs, metrics, and logs (not just the code) to fix the damn bug, just like a human would.

Get started at openctx.org, see the code in sourcegraph/openctx (Apache 2.0), follow @sqs for updates, and discuss stuff in the forum. We’ll be hacking on it over the holidays, adding support for a lot more context providers and clients. (And if this OpenCtx experiment goes as we hope, it’ll make Sourcegraph Code Search and Cody better in the future.)

Get Cody, the AI coding assistant

Cody makes it easy to write, fix, and maintain code.