← ClaudeAtlas

claudeloop-agent-sdklisted

Explains how claudeloop integrates with claude-agent-sdk (ClaudeAgentOptions, ClaudeSDKClient vs query(), RateLimitEvent, ResultMessage, AssistantMessage, session discovery via list_sessions()) and the never-block-on-a-human design (permission_mode, can_use_tool, AskUserQuestion handling, hooks). Use this whenever building or modifying src/claudeloop/infrastructure/agent/ (the M2+ agent gateway, options builder, message translation, session catalog, capacity probe), whenever the user asks about the Claude Agent SDK, ClaudeAgentOptions fields, session resumption, rate-limit events, or why a run might block on a human. Make sure to consult this before writing any code that calls claude_agent_sdk directly — infrastructure/agent/ is the ONLY place that import is allowed, per the onion architecture (see the claudeloop-architecture skill), and getting the never-block guarantees wrong here defeats the entire purpose of this project.
the-vibey-project/vibey · ★ 2 · AI & Automation · score 68
Install: claude install-skill the-vibey-project/vibey
# claudeloop + claude-agent-sdk integration > **Codex skill mirror** of `.claude/skills/claudeloop-agent-sdk/SKILL.md`. When this guidance changes, update Claude skill, Cursor rule, and `.agents/skills/` in the same PR. `infrastructure/agent/` is the only place `claude_agent_sdk` may be imported — see the `claudeloop-architecture` skill for the enforced onion rule. This skill covers the SDK integration specifics; consult `claudeloop-domain-model` for how the resulting signals get classified. ## `ClaudeSDKClient` over `query()` — this is not optional `query()` (single-shot) raises a **plain `Exception`** after yielding an error `ResultMessage`, and the underlying process exits non-zero. A streaming-input `ClaudeSDKClient` **stays alive** across error results — you can keep sending messages on one live process with no resume/respawn. The `AgentGateway` adapter (infrastructure/agent/gateway.py::ClaudeAgentGateway) MUST use `ClaudeSDKClient`, not `query()`, or the whole point of collapsing the legacy respawn loop is lost. See ADR 0002 for the full reasoning. ## Key `ClaudeAgentOptions` fields for this project - **`permission_mode="bypassPermissions"`** — required for autonomy. Note: the Python SDK has **no `dangerously_skip_permissions` field**; this is its equivalent. Do not go looking for a field that doesn't exist. - **`can_use_tool`** — a defensive callback that must NEVER await input. Intercepts `AskUserQuestion` specifically and **denies with guidance** (not