Set up ByteAsk Context
Paste one prompt into Claude Code. It registers the MCP server, installs one small hook script that it checks first, and adds a short block to CLAUDE.md. Then sign in and choose what to index.
Before you start
- Your agent
- Claude Code. Other agents: see Questions.
- A compile database
- A
compile_commands.jsonfor the repository. With CMake, configure with-DCMAKE_EXPORT_COMPILE_COMMANDS=ONand build once. - A git remote
- The repository has a git
originremote. - 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 -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON~ ❯ cmake --build build~ ❯ git remote get-url origin1Paste the prompt
Open Claude Code in any folder and paste this. It shows you every change and applies them after one OK.
Please set up ByteAsk Context for C/C++ in Claude Code.
ByteAsk Context is a code-intelligence service for C and C++ (https://byteask.ai/context).
This setup registers the ByteAsk MCP server, installs one small hook script
(Python, standard library only) and adds a short block to ~/.claude/CLAUDE.md.
Show me all the changes first, then apply them after one OK from me.
1. Download the hook and check it before anything runs it (this changes no settings):
mkdir -p ~/.byteask/context && chmod 700 ~/.byteask ~/.byteask/context
curl -fsSL https://byteask.ai/context/hook/v1/byteask-context-hook.py -o ~/.byteask/context/byteask-context-hook.py
Its SHA-256 must be:
905aaf7c04c3425d5eea96f73e25b47d85a8cc29c3edd766d05fa09bdba122da
(sha256sum, or shasum -a 256 on macOS). If it differs, delete the file and stop.
Then show me what it would change:
python3 ~/.byteask/context/byteask-context-hook.py install --dry-run
2. Register the ByteAsk MCP server for all projects, with its tools always loaded.
If `claude mcp get byteask` already lists it, first run:
claude mcp remove --scope user byteask
claude mcp add-json --scope user byteask '{"type":"http","url":"https://context.byteask.ai/mcp","alwaysLoad":true}'
3. Register the hook in ~/.claude/settings.json and the block in ~/.claude/CLAUDE.md:
python3 ~/.byteask/context/byteask-context-hook.py install
When you show me the changes, ask whether ByteAsk may index my C/C++ repositories
without asking me each time. Only if I say yes, add --allow-indexing to that command.
4. Connect the hook to my ByteAsk account:
python3 ~/.byteask/context/byteask-context-hook.py login
Show me the link and the code it prints. I open the link, sign in and choose Allow.
Then run: python3 ~/.byteask/context/byteask-context-hook.py wait
(it waits up to 5 minutes for my Allow; give the command a 6-minute timeout).
When all of that is done, tell me to restart Claude Code (exit, then run claude),
then type /mcp, select "byteask", choose "Authenticate" and allow it in my browser.
Then tell me how to see it work: open Claude Code in a C or C++ git repository that has
a compile_commands.json and describe a real bug or change in my own words. The
first time, Claude offers to index it: it downloads ByteAsk's collect script, shows
me which files the build reads, and uploads only after I agree.
For my information:
- In a C or C++ git repository, the hook sends each request I type (40 characters
or more) and the repository's remote address to ByteAsk, before Claude starts,
and adds ByteAsk's answer to Claude's context. Anywhere else it sends nothing.
It never blocks Claude Code: after 15 seconds, or on any error, it adds nothing.
- No code is uploaded until I approve indexing a repository. Indexing uploads that
repository's source files to ByteAsk to build its index.
- To rank where a change belongs, ByteAsk sends short excerpts of candidate code to
a model provider (OpenAI) through its API.
- Check the hook any time: python3 ~/.byteask/context/byteask-context-hook.py status
- Setup guide: https://byteask.ai/context/setup
- Security: https://trust.byteask.ai
- To remove: python3 ~/.byteask/context/byteask-context-hook.py uninstall
then claude mcp remove --scope user byteaskWhat it changes
- MCP server
- Registers
https://context.byteask.ai/mcpasbyteaskfor 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.pyand checks its SHA-256 before anything runs it. Source: byteask.ai/context/hook/v1/byteask-context-hook.py, SHA-256905aaf7c04c3425d5eea96f73e25b47d85a8cc29c3edd766d05fa09bdba122da. - ~/.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.
2Sign in
During setup, Claude runs the hook’s
loginstep 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.Restart Claude Code (exit, then run
claudeagain) so it loads the server and the hook.Type
/mcp, select byteask, then Authenticate.Your browser opens the ByteAsk sign-in. Sign in with GitHub, or with your email and the code we send you.
Choose Allow. Claude Code is connected.
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
.envfiles. - 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 statusWhen 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.
Your repositories
See what is indexed at app.byteask.ai. Delete a repository, or your whole account, any time: access ends at once and copies are removed.
Remove
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 byteaskTo delete your indexed code as well, delete your repositories or your account at app.byteask.ai.
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?
Any MCP client that supports remote MCP servers with OAuth sign-in can connect to https://context.byteask.ai/mcp. The prompt on this page is written for Claude Code.
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, 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. 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. Access ends at once and copies are removed.
What does it cost?
Early access is free for now.
Can my company run it on its own server?
Yes, on a dedicated server or on-prem. Contact us. Security details are in the Trust Center.