Thankfully the official Agent SDK Quickstart guide says that you can: https://platform.claude.com/docs/en/agent-sdk/quickstart
In particular, this bit:
"After installing Claude Code onto your machine, run claude in your terminal and follow the prompts to authenticate. The SDK will use this authentication automatically."
This project uses the Agents SDK so it should be kosher in regards to terms of service. I couldn't figure out how to get the SDK running inside the containers to properly use the authenticated session from the host machine so I went with a hacky way of injecting the oauth token into the container environment. It still should be above board for TOS but it's the one security flaw that I know about (malicious person in a WhatsApp group with you can prompt inject the agent to share the oauth key).
If anyone can help out with getting the authenticated session to work properly with the agents running in containers it would be much appreciated.
Did you get it working in the end? I assume you didn't share your setup/config anywhere?
More or less what it says in the README:
fence -t code -- claude --dangerously-skip-permissions
Or wrap it in a function as an alias # cat prompt.md | ralph
function ralph() {
fence -t code -- \
claude --verbose --dangerously-skip-permissions --output-format stream-json -p "$@" \
| jq -r 'select(.type == "assistant") | .message.content[]? | select(.type? == "text") | .text'
}