Skip to content

Conversation

@uriyyo
Copy link

@uriyyo uriyyo commented Jul 19, 2025

Hi,

Thanks for clai, I'm using it all the time 🙌

One minor feature that I miss is the ability to continue the last conversation, cause my usage looks like this:

clai "first question"
clai "next question that basically related to first one"

So now it will be possible:

clai "first question"
clai -c "next question that basically related to first one"

I'm not sure if -c is a good option name, as it is usually used for configuration, so maybe -r/--resume would be a better option. I will be happy to update the implementation with better naming.

@hyperlint-ai
Copy link
Contributor

hyperlint-ai bot commented Jul 19, 2025

PR Change Summary

Added the ability to continue the last conversation in the clai CLI tool.

  • Introduced the '-c' option to continue the last conversation instead of starting a new one.
  • Updated usage instructions in the README to reflect the new option.
  • Provided a suggestion for renaming the option to '-r/--resume' for clarity.

Modified Files

  • clai/README.md

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

@uriyyo
Copy link
Author

uriyyo commented Jul 20, 2025

I don't know why coverage is not 100%(

@Kludex Kludex requested review from Kludex July 21, 2025 09:08
@Kludex
Copy link
Member

Kludex commented Jul 21, 2025

Hi @uriyyo 👋 Good to see you here. :)

Instead of just continuing the last conversation, can we select the session we want to continue? It would be nice to have a drop-down where the user could select the session. We can use the prompt-toolkit package for it.

@Kludex Kludex self-assigned this Jul 21, 2025
@uriyyo
Copy link
Author

uriyyo commented Jul 21, 2025

👋 Good to see you here. :)

@Kludex Long time no see, good to see you again!

@fswair
Copy link
Contributor

fswair commented Jul 22, 2025

Can we extend this with: #1981 @uriyyo @Kludex

@uriyyo uriyyo force-pushed the feature/clai-continue-conversation branch from 00b521a to 2990a68 Compare July 26, 2025 09:25
@uriyyo
Copy link
Author

uriyyo commented Jul 26, 2025

Instead of just continuing the last conversation, can we select the session we want to continue? It would be nice to have a drop-down where the user could select the session. We can use the prompt-toolkit package for it.

@Kludex Sounds interesting, any suggestions on how it should look like?

I imagine adding input query slugify that will assign session specific slug, and then you can continue session based on a generated slug.

For instance if we are doing query like this:

clai "How to start thread in python?"

Slug might look like this - python-start-thread (eventually it will be generated by LLM).

And then you can continue this session:

clai "and how can I start 10 threads" --session python-start-thread

Also, it makes sense to add /sessions and maybe /session [session] commands for interactive mode?

Where:
/sessions - show list of available sessions.
/session - show info about the current session.
/session $session-name - switch to a specific session.

I still would love to have ability to continue just last conversation, but it can be implemented around sessions.

@uriyyo uriyyo force-pushed the feature/clai-continue-conversation branch from 2990a68 to 8884141 Compare August 5, 2025 08:52
@uriyyo uriyyo force-pushed the feature/clai-continue-conversation branch from 8884141 to cf3b691 Compare August 12, 2025 17:33
@Kludex
Copy link
Member

Kludex commented Aug 14, 2025

Instead of just continuing the last conversation, can we select the session we want to continue? It would be nice to have a drop-down where the user could select the session. We can use the prompt-toolkit package for it.

@Kludex Sounds interesting, any suggestions on how it should look like?

I imagine adding input query slugify that will assign session specific slug, and then you can continue session based on a generated slug.

For instance if we are doing query like this:

clai "How to start thread in python?"

Slug might look like this - python-start-thread (eventually it will be generated by LLM).

And then you can continue this session:

clai "and how can I start 10 threads" --session python-start-thread

Also, it makes sense to add /sessions and maybe /session [session] commands for interactive mode?

Where: /sessions - show list of available sessions. /session - show info about the current session. /session $session-name - switch to a specific session.

I still would love to have ability to continue just last conversation, but it can be implemented around sessions.

I'm sorry. I thought I had replied.

I think we can store the session with an uuid as file name, and then when resuming, we should see the first message truncated as part of that selection. This selection should be using prompt-toolkit.

@Kludex
Copy link
Member

Kludex commented Aug 14, 2025

Feel free to reach me on our Slack, in case I take more than a day to reply.

@DouweM
Copy link
Collaborator

DouweM commented Sep 30, 2025

@uriyyo Are you still interested in working on this?

@uriyyo
Copy link
Author

uriyyo commented Sep 30, 2025

@DouweM Yup, I will try to wrap it all this week

@github-actions
Copy link

github-actions bot commented Nov 2, 2025

This PR is stale, and will be closed in 3 days if no reply is received.

@github-actions github-actions bot added the Stale label Nov 2, 2025
@uriyyo
Copy link
Author

uriyyo commented Nov 3, 2025

Hi all, sorry for no response. Does it still make sense for me to work on this feature? If yes, I will try to do it ASAP

@DouweM
Copy link
Collaborator

DouweM commented Nov 3, 2025

@uriyyo Yes go for it!

@DouweM DouweM removed the Stale label Nov 3, 2025
Copilot AI review requested due to automatic review settings November 3, 2025 21:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new feature to continue the last conversation in the Pydantic AI CLI instead of starting fresh each time. The key functionality enables users to use the -c or --continue flag to resume their previous conversation.

  • Added conversation persistence to JSON files in the .pydantic-ai directory
  • Implemented -c/--continue CLI flag to resume previous conversations
  • Added error handling for corrupted conversation files

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
pydantic_ai_slim/pydantic_ai/_cli.py Implemented conversation storage/loading functions and integrated them into the CLI workflow with the new --continue flag
tests/test_cli.py Added tests for the continue conversation feature and updated existing test assertions to include the new history parameter
clai/README.md Updated CLI usage documentation to include the new -c/--continue flag option

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@uriyyo uriyyo requested a review from Copilot November 3, 2025 22:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants