# Set up ByteAsk Context

Paste one prompt into your coding agent. It registers the MCP server and, in Claude Code and Codex, installs one small hook script that it checks first and adds a short instruction block. Then sign in and choose what to index.

## Before you start

Your agent

Claude Code or Codex for the full setup; Cursor and other MCP clients get the MCP server. See [Questions](https://byteask.ai/context/setup#questions).

A compile database

A `compile_commands.json` for the repository. With CMake, configure with `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` and build once.

A git repository

The project is a git repository with at least one commit. A remote is optional: without one, ByteAsk names the repository by its first commit, in your account only.

Python

Python 3.8 or newer as `python3`, for the hook. It uses only the standard library.

Your system

Linux, or macOS with the Xcode Command Line Tools.

CMake: write compile_commands.json, then build once

`~ ❯ cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON`

`~ ❯ cmake --build build`

Check it is a git repository

`~ ❯ git rev-parse --show-toplevel`

## 1Paste the prompt

Open your coding agent in any folder and paste this. It follows ByteAsk’s setup guide, tells you the cost first ($0 on the Free plan) and shows you every change before it makes it.

```
Set up ByteAsk (https://byteask.ai) for me.

Here are your instructions: https://byteask.ai/agent-guide.txt
Read them in full and follow them step by step.
Ask me what you need in one message, then do the whole setup yourself.
Never spend money without asking me first.
```

[Manual setup](https://byteask.ai/docs/setup/)

Works with

- Claude Code
- Codex
- Cursor
- Windsurf
- VS Code

### What it changes in Claude Code

MCP server

Registers `https://context.byteask.ai/mcp` as `byteask` for all your projects, with its tools always loaded so Claude sees them from the first turn.

The hook

Downloads one Python script to `~/.byteask/context/byteask-context-hook.py` and checks its SHA-256 before anything runs it. Source: [byteask.ai/context/hook/v4/byteask-context-hook.py](https://byteask.ai/context/hook/v4/byteask-context-hook.py), SHA-256 `43df15e6215ebea295c41a11ea4d4e9fac39dea429f02f8f25231cadd56ed9a3`.

~/.claude/settings.json

Registers the hook for two Claude Code events. When you submit a task in a C or C++ git repository, it asks ByteAsk where the change most likely belongs and adds the answer to Claude’s context before Claude’s first step. When a session starts there, it adds one line naming the repository for ByteAsk. Your other settings and hooks are kept, with a backup.

~/.claude/CLAUDE.md

Adds a short block between byteask markers: start from ByteAsk’s answer when it is there, otherwise ask ByteAsk first about a C or C++ bug or change, unless Claude already knows the exact place.

Optional

If you say yes when asked, one more line in that block lets Claude index your C and C++ repositories without asking you each time.

Codex and Cursor

Codex gets the same server, the same two hooks and the same block, in `~/.codex`. Cursor gets the server in `~/.cursor/mcp.json` and the instruction text to paste into its User Rules.

## 2Sign in

1. During setup, your agent runs the `login` step and shows you a link and a code. Open the link, sign in to ByteAsk, check that the code matches, and choose **Allow**. The hook gets its own key: it can only ask where a task’s change belongs, and you can revoke it on your account page.
2. Restart Claude Code (exit, then run `claude` again) so it loads the server and the hook.
3. Type `/mcp`, select **byteask**, then **Authenticate**.
4. Your browser opens the ByteAsk sign-in. Sign in with GitHub, or with your email and the code we send you.
5. Choose **Allow**. Claude Code is connected.
6. In Codex, run `codex mcp login byteask` in a terminal, restart Codex and trust the two ByteAsk hooks when it asks. In Cursor, sign in from Cursor Settings, MCP.

## 3Index a repository

It asks first

The first time you work in a C or C++ repository, your agent asks before indexing it, unless you allowed indexing without asking during setup. In a run with no one to answer, it does the task without ByteAsk and suggests indexing at the end.

A preview

It lists exactly which files would be uploaded, grouped by folder. Nothing is sent yet.

Your choice

Tell it which folders to leave out.

The upload

Only what the build reads goes to ByteAsk’s servers: sources, headers, generated headers and the system headers they include. No docs, test data, assets or `.env` files.

How long

About a minute for a small repository, up to half an hour for a very large one.

## 4Use it

Work as you normally do. When you describe a bug or change in a C or C++ repository, the hook asks ByteAsk where the change most likely belongs, and Claude starts from those places with their code in front of it. Claude can also look up the code, callers and build settings of any function, and what else a change needs.

The hook waits at most 15 seconds for ByteAsk. If ByteAsk does not answer in time, the repository is not indexed yet, or anything fails, it adds nothing and Claude works as usual. Short messages (under 40 characters) and slash commands are not sent. Check it any time:

`~ ❯ python3 ~/.byteask/context/byteask-context-hook.py status`

When Claude asks ByteAsk again after editing, it first syncs only the changed files from your approved list, so answers cover your current code.

It can also search public C and C++ libraries ByteAsk has indexed, such as fmt, abseil and spdlog. [See an example answer](https://byteask.ai/context#example).

## Your repositories

See what is indexed at [app.byteask.ai](https://app.byteask.ai). Delete a repository, or your whole account, any time: access ends at once and copies are removed.

## Remove

Ask your agent to run the setup guide’s uninstall step (`sh install.sh uninstall`, with a dry run first): it removes only what setup added, for every agent.

Or, in Claude Code, by hand: remove the hook (it revokes its key, takes its entries out of `~/.claude/settings.json` and the byteask block out of `~/.claude/CLAUDE.md`, with backups), then unregister the MCP server:

`~ ❯ python3 ~/.byteask/context/byteask-context-hook.py uninstall`

`~ ❯ claude mcp remove --scope user byteask`

To delete your indexed code as well, delete your repositories or your account at [app.byteask.ai](https://app.byteask.ai).

## Manual setup

The same setup in Claude Code, by hand. Run these in a terminal, and check the hook’s SHA-256 before anything runs it: it must be `43df15e6215ebea295c41a11ea4d4e9fac39dea429f02f8f25231cadd56ed9a3`. If it differs, delete the file and stop.

Download the hook

`~ ❯ mkdir -p ~/.byteask/context && chmod 700 ~/.byteask ~/.byteask/context && curl -fsSL https://byteask.ai/context/hook/v4/byteask-context-hook.py -o ~/.byteask/context/byteask-context-hook.py`

Check it (macOS: shasum -a 256)

`~ ❯ sha256sum ~/.byteask/context/byteask-context-hook.py`

Register the MCP server for all projects

`~ ❯ claude mcp add-json --scope user byteask '{"type":"http","url":"https://context.byteask.ai/mcp","alwaysLoad":true}'`

Register the hook and the CLAUDE.md block

`~ ❯ python3 ~/.byteask/context/byteask-context-hook.py install`

Connect the hook to your account

`~ ❯ python3 ~/.byteask/context/byteask-context-hook.py login && python3 ~/.byteask/context/byteask-context-hook.py wait`

If `claude mcp get byteask` already lists a server, run the second command under [Remove](https://byteask.ai/context/setup#remove) first. Then follow [Sign in](https://byteask.ai/context/setup#sign-in). For Codex, Cursor and other MCP clients, the exact steps are in [the guide the prompt points to](https://byteask.ai/agent-guide.txt).

## Questions

### Does it work on a Mac?

Yes, with the Xcode Command Line Tools installed (`xcode-select --install`). Linux works too.

### Can I use it with Cursor, Codex or another agent?

Yes. The prompt sets up Codex in full, like Claude Code, and Cursor with the MCP server and its rules text. Any other MCP client that supports remote MCP servers with OAuth sign-in can connect to `https://context.byteask.ai/mcp`.

### What is uploaded?

No code until you approve a repository. Then only the files its build reads, from the folders you keep, and later only the files your agent changes. To rank where a task’s change belongs, a small OpenAI model reads short excerpts of candidate code through OpenAI’s API; under OpenAI’s API terms, that data is not used for training.

### What does the hook send?

In a C or C++ git repository only: the text of each task you type (40 characters or more) and the repository’s remote address (or, without a remote, its first commit’s id), to ByteAsk, before Claude starts. Its key goes in a request header, never in a URL. It keeps a local log of what it did, without your prompts or ByteAsk’s answers.

### Can I turn the hook off for a while?

Start Claude Code with `BYTEASK_HOOK=off` set, or remove it as shown under [Remove](https://byteask.ai/context/setup#remove). The MCP server and the CLAUDE.md block keep working without it.

### How do I delete my code?

Delete the repository, or your whole account, at [app.byteask.ai](https://app.byteask.ai). Access ends at once and copies are removed.

### What does it cost?

Context is on every ByteAsk plan. Free includes 1 private repository up to 100k lines, and public repositories are free on every plan. Lookups and indexing are not metered. Larger limits are on [the pricing page](https://byteask.ai/pricing).

### Can my company run it on its own server?

Yes, on a dedicated server or on-prem. [Contact us](https://byteask.ai/contact). Security details are in the [Trust Center](https://trust.byteask.ai).

---
HTML version: https://byteask.ai/context/setup
