Technical documentation
Claude Code integration guide
The repository contains an implemented Node CLI that renders AdFrolic sponsored creative through Claude Code's scriptable statusline. The package remains private, so the npm command below describes intended setup after authorised distribution rather than current public npm availability.
Availability
The implementation lives in extensions/claude-code. Its package name is @adfrolic/claude-code-integration, but the package metadata currently sets private: true. Do not treat repository implementation as proof of public npm distribution.
Why the statusline is the implemented surface
Claude Code does not expose a runtime hook that lets AdFrolic replace the thinking spinner for each request. The implemented integration instead uses the genuinely scriptable statusline below the prompt input.
That surface can invoke a developer-provided command on refresh, so the CLI can read cached approved creative, render a concise sponsored message and report eligible impression lifecycle events without modifying prompt content.
Intended setup after package distribution
# Intended after the package is distributed through an authorised channel
npm install -g @adfrolic/claude-code-integration
adfrolic auth
# Claude Code settings.json
{
"statusLine": {
"type": "command",
"command": "adfrolic statusline"
}
}The current public site does not claim that this private package is already downloadable from npm.
Device-authorisation sign in
The CLI cannot depend on an embedded browser OAuth session, so adfrolic auth uses a short browser-assisted device flow. The CLI receives a short code, opens the AdFrolic confirmation page and polls until the developer approves the request.
The resulting local session is written to the AdFrolic user directory with restrictive file permissions. The device code is short-lived and single-use on the server.
Five-minute local creative cache
Claude Code may refresh the statusline much more frequently than a sponsored creative needs to change. The CLI therefore caches the current creative locally for five minutes so most statusline invocations can render from disk without making a network request.
This keeps the sponsored path lightweight and means normal statusline refreshes do not depend on network latency.
Impression qualification
The CLI does not treat every command invocation as a billable impression. It tracks the cached creative's display lifecycle and sends the qualification call when the minimum eligible display duration has elapsed, then records locally that qualification has been attempted so it is not sent repeatedly.
Current limitation: display-only
The Claude Code statusline does not expose a dependable interactive click target. The current AdFrolic integration therefore treats this placement as display-only instead of claiming click-through functionality the host cannot reliably provide.
The integration also does not replace the thinking spinner. Both limitations are intentional descriptions of the current host surface, not missing marketing copy.
Privacy and failure behaviour
Source code, prompts, AI responses and terminal contents are outside the advertising request contract. Selection, budgeting, fraud checks and billing remain server-side.
The statusline command is designed to print nothing and exit successfully on a network error, slow response or missing session. Advertising should disappear before it disrupts the Claude Code session.
Client responsibility
Authenticate, request, display and report the impression lifecycle.
Server responsibility
Campaign selection, budgets, moderation, fraud controls, billing and developer earnings accounting.