NachschlagenQuellenregister

Dokumentationerreichbar

Claude Code, Run Claude Code pro­gram­ma­ti­cally

code.claude.com (externe Seite)

Die Her­stel­ler­do­ku­men­ta­tion 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 Pro­jekt­ein­stel­lung 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.2026
  • available as a CLI for scripts and CI/CDbestätigt 10.11.2026
  • 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.2026
  • Piping the diff means Claude doesn’t need Bash permission to read itbestätigt 10.11.2026
  • Claude 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.2026
  • Bare mode is useful for CI and scripts where you need the same result on every machine.bestätigt 10.11.2026
  • is the recommended mode for scripted and SDK calls, and will become the default forbestätigt 10.11.2026
  • In bare mode, Claude Code never reads OAuth credentials or the system keychain.bestätigt 10.11.2026
  • Error: --json-schema is not a valid JSON Schemabestätigt 10.11.2026
  • When a failure happens inside the run, such as missing authentication, Claude Code prints the failure as the result on stdout.bestätigt 10.11.2026
  • To end the turn instead, send SIGINT, or call the Agent SDK’sbestätigt 10.11.2026
  • message with the final response text, cost, and session metadatabestätigt 10.11.2026
  • so a CI gate can fail on a non-empty arraybestätigt 10.11.2026
  • these limits held only partlybestätigt 10.11.2026
  • This page covers using the Agent SDK via the CLIbestätigt 10.11.2026
  • even in a folder you’ve never trustedbestätigt 10.11.2026
  • the response payload includes total_cost_usd and a per-model cost breakdownbestätigt 10.11.2026
  • Without it, claude -p discovers and loads them as an interactive session wouldbestätigt 10.11.2026
  • Non-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.2026
  • Piped stdin is capped at 10MB.bestätigt 10.11.2026
  • Both figures are client-side estimates and can differ from your actual bill.bestätigt 10.11.2026
  • Actions covered by your --allowedTools entries or permissions.allow rules also run.bestätigt 10.11.2026
  • Actions that need no approval in Manual mode still run, such as file reads in your working directories and the read-only command setbestätigt 10.11.2026
  • Hooks still don’t run in bare mode when you pass them with --settingsbestätigt 10.11.2026
  • Before your script uses structured_output, check that the field is present.bestätigt 10.11.2026
  • A claude -p run doesn’t wait for MCP work in the backgroundbestätigt 10.11.2026
  • the call’s result is lostbestätigt 10.11.2026
  • In a -p run with no host, these requests are denied either waybestä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

Alle Quellen

↑↓ auswählenEnter öffnenDie Suche läuft im Browser. Nichts wird übertragen.