# 12-services-layer

12-services-layer — a prompt that configures Claude Code CLI background services: analytics, policy limits, remote settings, session memory, and bootstrap data.

- prompt · `type=prompt` · Claude Code, ChatGPT · ★ 3444 repo stars
- Author: codeaashu
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/codeaashu/claude-code/tree/HEAD/prompts/12-services-layer.md
- Updated: 2026-10-14
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/prompts/12-services-layer

## What it does

The prompt walks through wiring six services that run in the background of the CLI: GrowthBook for feature flags and OpenTelemetry traces, rate and quota checks from the Anthropic backend, server-pushed configuration, conversation history persistence across invocations, initial data from the API, and token cost tracking. Most of these call Anthropic servers and will fail in a dev build.

It breaks the task into seven parts: first it asks you to document the init sequence in `src/entrypoints/init.ts`, then makes GrowthBook optional (feature checks return `false` on failure), stubs `policyLimits` so it does not block requests, ensures remote settings and bootstrap fall back to defaults, verifies that `SessionMemory` works with the local filesystem, and wires up `cost-tracker.ts` to display locally without remote reporting. Bootstrap will fail without an API key — the prompt requires sensible defaults in that case.

At the end you create `scripts/test-services.ts`: a script that runs `init()` and logs which service broke. The check is `bun scripts/test-services.ts` completing without a crash, unavailable services log warnings, and the app starts even when Anthropic's backend is unreachable.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/12-services-layer.md`

### ChatGPT

**How to use**
- Paste the text at the start of a chat or into project instructions

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/codeaashu/claude-code/tree/HEAD/prompts/12-services-layer.md

## When to use it
- connect GrowthBook, policy limits, remote settings, session memory, and bootstrap to the CLI
- keep services from crashing the app when Anthropic backend is down
- set up token cost tracking for local display
- write a smoke test for all background services

## Example prompts
- Walk through the 12-services-layer prompt and set up the services layer
- Create `scripts/test-services.ts` following the 12-services-layer instructions
- Stub policy limits so they don't block requests in dev builds

## Similar
- [kranz-services](https://affpapa.org/en/nevibecode/skills/kranz-services.md) — skill · ★ 62 repo stars
- [omni-version-manager](https://affpapa.org/en/nevibecode/skills/omni-version-manager.md) — skill · 1300 installs
- [feature-flags-architect](https://affpapa.org/en/nevibecode/plugins/feature-flags-architect.md) — plugin · ★ 30251 repo stars
- [agentmemory-hooks](https://affpapa.org/en/nevibecode/skills/agentmemory-hooks.md) — skill · 11700 installs
- [growthbook](https://affpapa.org/en/nevibecode/plugins/growthbook.md) — plugin · ★ 29 repo stars
- [growthbook-mcp](https://affpapa.org/en/nevibecode/mcp/growthbook-mcp.md) — MCP server · ★ 26 repo stars

From the same set: [codeaashu/claude-code](https://affpapa.org/en/nevibecode/by/codeaashu/claude-code.md) — 17 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
