claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Feature request: verbose & print mode together

Open joesarre opened this issue 1 year ago • 15 comments

I'm very excited about this tool. Thank you for releasing it. I'd love to run this in a github action every time I comment "/claude-fix" in a PR review. I have this working using --print mode, but I would like to use --verbose mode non-interactively. --print only outputs a very high level summary at the end. That means I can't see the process to get there, and that in turns means I can't effectively iterate on my prompts.

joesarre avatar Mar 06 '25 16:03 joesarre

Hey there! What sort of output would you expect for --verbose -- would you want to see the whole conversation, as opposed to just the last message?

bcherny avatar Mar 06 '25 17:03 bcherny

Hi! Yes, the whole conversation would be ideal. Like if I ran it interactively and kept saying "yes". I specifically want to see what files it's editing, what commands it's executing and their outputs, and why.

For context I'm also using --dangerously-skip-permissions and I'm running in a docker container using the dockerfile and init_firewall scripts from your .devcontainer.

joesarre avatar Mar 06 '25 19:03 joesarre

On further thought, the ideal would be to have the complete train of thought logged to a file, but still to output the succinct summary on stdout. That would allow me to grab the succinct summary in the happy case and use it as a commit message, and also to view the chain of reasoning if it goes off track.

joesarre avatar Mar 06 '25 21:03 joesarre

To extend this request further: it would be nice to get out the whole trace at the end, AND be able to resume a conversation starting from that trace. i.e. to be able to transition from non-interactive to interactive if desired.

dbieber avatar Mar 07 '25 03:03 dbieber

I've published the action here if you want to test with it: https://github.com/joesarre/claude-code-action/tree/v1. It's just the bit that runs claude code, not the full workflow as that is currently tightly coupled to my project

joesarre avatar Mar 07 '25 19:03 joesarre

👍 to this feature. I use --print to enable "background process" where I'm able to set up N tasks and then have them execute in the background ("find 100 files with lint errors, and fan them out to 1 session per file to fix"). I still want to be able to later inspect the actions taken to understand what it did and why. It also allows for a meta "reprocessing" of the output to pass to another agent to ask questions EG "At any point in this session, did we decide to duplicate an element instead of reuse it?"

This probably ideally would look like a JSONL-ish log file with a line per action with meta descriptions about it (tool call, thinking, etc), and that is appended to in real time to be able to monitor the process as actions occur, without having to wait till the end.

DylanNWatt avatar Mar 13 '25 20:03 DylanNWatt

I've published the action here if you want to test with it: https://github.com/joesarre/claude-code-action/tree/v1. It's just the bit that runs claude code, not the full workflow as that is currently tightly coupled to my project

@joesarre I took the liberty of forking your claude-code-action repo (and I'm sorry about all the accidental PRs back to your repo). Really awesome stuff.

sjswerdloff avatar Mar 20 '25 06:03 sjswerdloff

Using --print mode in CI makes it super hard to understand when permissions are failing. It'll say "I had permissions issues doing X" but it doesn't really call out what command it ran so it's really hard to build the --allowedTools list. I've tried adding things like

As you work on this, please print any output to the file and well as a summary of each command you execute to ./.git/claude-code-output.txt with a timestamp.

or

if you run into any issues please tell me which command failed and why

but never works

maschwenk avatar Mar 20 '25 18:03 maschwenk

Also ran into this while trying to make a bin/fix-issue script. I have no idea if it's working, if it's failing, or what it needs, because no output shows up until it's done.

filipesilva avatar Mar 31 '25 12:03 filipesilva

This is shipped in 0.2.60! Docs incoming.

bcherny avatar Apr 02 '25 17:04 bcherny

FWIW I've tried using this like:

 claude --verbose --print "Can you add the word zerb to the README.md" --json

And noticed that --verbose and --print mean you are forced to use --json. Which makes some sense, but then the output is something you'd have to parse. When we use claude in CI, because it can take 5-10 minutes it's actually pretty nice to have the output streaming to console. @robstolarz setup a pretty convoluted but functional means of getting that behavior by spinning up an Overmind process that just continually presses the enter key to simulate a human doing so.

Especially while we're experimenting with Claude in CI, having it run in a way where it's not outputting anything until the end is kinda scary, considering sometimes it tries to do...scary stuff (forking/creating repos).

Totally understand why it was implemented this way, but just figured I'd share the usability downside that is not immediately apparent.

maschwenk avatar Apr 05 '25 00:04 maschwenk

I second what @maschwenk said, was not expecting forced json either. Also would love streaming printing there, especially for testing these "scripts".

filipesilva avatar Apr 07 '25 16:04 filipesilva

Mind filing a separate issue for that request? I think it's worth tracking.

ashwin-ant avatar Apr 07 '25 17:04 ashwin-ant

@ashwin-ant PTAL https://github.com/anthropics/claude-code/issues/733

filipesilva avatar Apr 07 '25 18:04 filipesilva

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 11 '25 14:08 github-actions[bot]