cpp

cpp is a cursor rule for Cursor from ClickHouse/ai-sdk-cpp. It costs 312 tokens per session, scanned A, original, Apache-2.0.

A set of coding rules for C++, a programming language commonly used for systems software and applications.

In plain words
What is it for?
It is for shaping C++ classes, pointers, functions, initialization, lambdas, and asynchronous work according to the listed rules.
Why use it?
It gives the agent consistent guidance about naming, ownership, concurrency, and modern C++ style instead of leaving those choices implicit.

Cursor rule for Cursor ✓ vendor

Written for Cursor: installed under .cursor/.

Good fit It is for shaping C++ classes, pointers, functions, initialization, lambdas, and asynchronous work according to the listed rules.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/clickhouse/ai-sdk-cpp/cpp
About the project

AI SDK CPP is a C++20 library that gives applications one interface for sending requests to AI model providers such as OpenAI and Anthropic. C++ developers use it to build AI applications and agents with features including streaming responses, multi-turn conversations, tool calls, and asynchronous tools. The catalogue entries provide rules for projects using the library.

ClickHouse/ai-sdk-cpp · 188 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/ClickHouse/ai-sdk-cpp

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cpp

README.md
[![agentmods](https://agentmods.dev/badge/rules/clickhouse/ai-sdk-cpp/cpp/github.svg)](https://agentmods.dev/rules/clickhouse/ai-sdk-cpp/cpp)
Your own site
<a href="https://agentmods.dev/rules/clickhouse/ai-sdk-cpp/cpp"><img src="https://agentmods.dev/badge/rules/clickhouse/ai-sdk-cpp/cpp/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cpp

Your own site · 80×15
<a href="https://agentmods.dev/rules/clickhouse/ai-sdk-cpp/cpp"><img src="https://agentmods.dev/badge/rules/clickhouse/ai-sdk-cpp/cpp.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 312 This file is loaded in full into every session.
When invoked 312 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00312 $0.00312
Opus 5.5 $0.00125 $0.00125
Sonnet 5.5 $0.00062 $0.00062
Haiku 4.5 $0.00031 $0.00031

Measured 13d ago against content hash 36a7f1d80827, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cpp scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/cpp.mdc · 34 lines

What it actually says

  1. prefer one class per file.
  2. use Google C++ coding styles.
  3. make classes immutable as much as possible.
  4. follow guidelines of effective modern c++.

Name methods (casing, etc) like "is_valid", "stream_text"

Lean on auto. Let the compiler deduce obvious types and keep code DRY.

Use nullptr, never 0 or NULL. A unique keyword prevents overload ambiguities and makes pointer intent explicit.

Express ownership with smart-pointers (std::unique_ptr, std::shared_ptr, std::weak_ptr). Raw pointers say nothing about lifetime.

Move more, copy less. Pass/return by value when cheap-to-move; use std::move to convey transfer of resources.

Mark intent with keywords (const, constexpr, noexcept, override, delete). They document guarantees and enable optimisations.

Prefer brace initialisation. It prevents narrowing, works with std::initializer_list, and unifies syntax.

Capture carefully in lambdas; avoid default capture ([=], [&]). Explicit captures beat accidental lifetime bugs.

Think tasks, not threads. Launch work with std::async, std::future, or std::packaged_task; join or detach thoughtfully.

Use std::atomic for inter-thread data, not volatile. Atomics give ordering guarantees; volatile is for hardware registers.

Emplace instead of insert / push_back. Construct elements in place to avoid extra moves or copies.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago First seen · 34 lines · 312 tokens per session scan A 36a7f1d80827

Subscribe to this mod's changes

cpp is a cursor rule published in the GitHub repository ClickHouse/ai-sdk-cpp (188 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 312 tokens to every session, about $0.0012 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-02.