← Reddit

Built a naming CLI that runs on my Max subscription through headless claude -p. Hit two nested-claude bugs along the way.

Reddit · heeeeyYaaa · August 11, 2026
A developer built a CLI tool that generates startup name candidates and validates domain availability on a Claude Max subscription through Claude Code without requiring API keys. Development surfaced two bugs: nested Claude processes inheriting excessive effort levels that caused timeouts, and accumulated feedback from previous rounds interfering with current iterations, both resolved through environment variable scrubbing and prompt reorganization.

Detailed Analysis

A developer building a startup naming tool has surfaced a pair of undocumented behaviors in Claude Code's subprocess handling that offer a window into how Anthropic's CLI manages headless execution and environment inheritance. The tool, called namehunt, uses an LLM to generate candidate business names, checks real-time domain availability via RDAP across chosen TLDs, and feeds the results plus user feedback back into subsequent generation rounds—an iterative refinement loop that took eight rounds and 210 checked names to land on a viable name. The technically notable piece is its `--provider claudecode` mode, which shells out to `claude -p` using the user's existing Max subscription login rather than requiring separate API credentials, explicitly stripping `ANTHROPIC_API_KEY` from the subprocess environment to prevent silent fallback to metered API billing.

The two bugs the developer encountered both stem from Claude Code's practice of propagating session-level environment variables into child processes it spawns. The first involved `CLAUDE_CODE_EFFORT_LEVEL` being inherited by nested `claude -p` calls: because the parent session was set to "max" effort, every subprocess generation task inherited that setting and spent eight-plus minutes deliberating over a simple twenty-name generation task, causing timeouts. The fix required explicitly scrubbing `CLAUDE*`-prefixed variables from the child environment and pinning a lower effort level for the subprocess. The second bug was a prompt-engineering issue rather than an environment one: accumulated user feedback across multiple rounds diluted the model's attention, causing it to weight stale early-round notes as heavily as current-round steering, which the developer resolved by demoting older feedback and foregrounding only the most recent notes under a clearly labeled header.

These findings matter because they expose a gap between Claude Code's design as an interactive coding assistant and its emerging use as a building block for programmatically orchestrated, multi-agent-style workflows. When developers use `claude -p` in headless mode as a callable subprocess within their own tools, they're implicitly relying on undocumented inheritance behavior of session state—effort levels, environment variables, and presumably other session context—that wasn't designed with recursive or nested invocation in mind. The developer's open question about whether "scrubbing CLAUDE* vars is reasonable or if there's a better way" reflects a genuine ergonomics gap: there's no first-class API for isolating a spawned Claude subprocess from parent session state, forcing developers to reverse-engineer safe defaults through trial and error.

More broadly, this fits a pattern of developers pushing consumer-tier Claude subscriptions (Max plans, in this case) into automation and agentic pipelines that were originally conceived as pay-per-token API use cases—a workaround Anthropic tolerates for personal, non-commercial use but explicitly disallows for shipped products under claude.ai login terms. This tension between subscription economics and API metering is becoming a recurring theme in the Claude developer community, as users build increasingly sophisticated tools (feedback loops, TDD-enforced build pipelines, multi-agent orchestration) on top of login-based CLI access rather than API keys. The project's engineering discipline—spec-first development, strict TDD with pre-committed failing tests, network-blocking test fixtures, and a Stop hook enforcing test suite passage before a Claude session can end—also illustrates how practitioners are building guardrails around agentic coding tools to keep autonomous LLM-driven development from producing untested or network-dependent code, a concern that grows more salient as Claude Code becomes a substrate for other developers' tooling rather than just an end-user product.

Read original article →