Dokumentationerreichbar
Claude Code, Run Claude Code programmatically
code.claude.com (externe Seite)
Die Herstellerdokumentation zum Lauf ohne Terminal mit claude -p. Im Abschnitt zu unbeaufsichtigten Läufen steht, was mit einer Rückfrage geschieht, die niemand beantwortet: Ohne angeschlossenes Programm wird sie abgelehnt und der Lauf geht weiter. Mit einem Programm als Antwortgeber, etwa über das Agent SDK, wartet der Lauf auf dessen Antwort, bis ein eigener Schalter das abstellt. Mit --output-format stream-json steht jede Ablehnung als eigene Meldung im Ausgabestrom, die Schlussmeldung zählt sie unter permission_denials auf. Ohne den Schalter --bare führt ein solcher Lauf die Hooks aus der Projekteinstellung aus und verbindet die Server aus der .mcp.json, auch in einem Ordner, dem nie jemand vertraut hat. Abgerufen am 09.10.2026.
geprüft 10.11.2026
Worauf sich diese Seite beruft, wörtlich, abgerufen am 09.10.2026:
Without the flag, your run waits for that host to answer each permission request.
bestätigt 10.11.2026available as a CLI for scripts and CI/
bestätigt 10.11.2026CD Claude Code exits with code 0 on success and a non-zero code when the run fails, so your scripts can branch on the exit status.
bestätigt 10.11.2026Piping the diff means Claude doesn’t need Bash permission to read it
bestätigt 10.11.2026Claude Code denies every call that would otherwise prompt, which is useful for locked-down CI runs, though a mod you installed can still approve some of those calls.
bestätigt 10.11.2026Bare mode is useful for CI and scripts where you need the same result on every machine.
bestätigt 10.11.2026is the recommended mode for scripted and SDK calls, and will become the default for
bestätigt 10.11.2026In bare mode, Claude Code never reads OAuth credentials or the system keychain.
bestätigt 10.11.2026Error: --json-schema is not a valid JSON Schema
bestätigt 10.11.2026When a failure happens inside the run, such as missing authentication, Claude Code prints the failure as the result on stdout.
bestätigt 10.11.2026To end the turn instead, send SIGINT, or call the Agent SDK’s
bestätigt 10.11.2026message with the final response text, cost, and session metadata
bestätigt 10.11.2026so a CI gate can fail on a non-empty array
bestätigt 10.11.2026these limits held only partly
bestätigt 10.11.2026This page covers using the Agent SDK via the CLI
bestätigt 10.11.2026even in a folder you’ve never trusted
bestätigt 10.11.2026the response payload includes total_cost_usd and a per-model cost breakdown
bestätigt 10.11.2026Without it, claude -p discovers and loads them as an interactive session would
bestätigt 10.11.2026Non-interactive mode reads stdin, so you can pipe data in and redirect the response out like any other command-line tool.
bestätigt 10.11.2026Piped stdin is capped at 10MB.
bestätigt 10.11.2026Both figures are client-side estimates and can differ from your actual bill.
bestätigt 10.11.2026Actions covered by your --allowed
bestätigt 10.11.2026Tools entries or permissions.allow rules also run. Actions that need no approval in Manual mode still run, such as file reads in your working directories and the read-only command set
bestätigt 10.11.2026Hooks still don’t run in bare mode when you pass them with --settings
bestätigt 10.11.2026Before your script uses structured_output, check that the field is present.
bestätigt 10.11.2026A claude -p run doesn’t wait for MCP work in the background
bestätigt 10.11.2026the call’s result is lost
bestätigt 10.11.2026In a -p run with no host, these requests are denied either way
bestätigt 10.11.2026
02 Die Werkzeuge08 Berechtigungen und Rechtemodi10 Texte und Dateien in Ordnern11 Eine Wissensbasis aufbauen12 Rechner und Netz pflegen29 Skripte und CI