Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature / UX suggestion: interactive session context management #62

Open
dlants opened this issue Sep 29, 2024 · 3 comments
Open

Feature / UX suggestion: interactive session context management #62

dlants opened this issue Sep 29, 2024 · 3 comments

Comments

@dlants
Copy link

dlants commented Sep 29, 2024

I've been using LLMs in coding more and more lately, especially using this plugin and some other nvim llm plugins. Thanks for your great contributions!

I've been running into an issue that I think some UX improvements may address.

The plugin and LLMs work great when you're starting with a new project, and you can basically shove the entire thing into a single rewrite / refactor command. However as the project grows, especially starting to create a single file that contains several logical pieces, or multiple files, the usefulness of the interactive mode commands (rewrite this, append here, etc...) starts to drop off significantly.

The project context helps some with this, as it lets you capture some general examples and preferences. However for a large project, the amount of context that you would need to include would be too large for a single file.

I think the solution for this is to allow the user to build up a context dynamically for a single project / session.

I'm kind of doing this currently through liberal use of PrtChatPaste - building up the context in the chat buffer. However, this is not ideal. It takes time to build up. It feels brittle. It gets less relevant with every interaction (as it gets pushed up with each question/response, sometimes past the token window), and there's no easy way to retain the context but add a new question.

Also, as far as I know the latest chat context is not attached to the interactive commands.

My dream UX would look something like:

  • commands to attach the current file, or the current visual selection to the context.
  • the ability to see the context and manage it - removing things from the context or reordering the items in the context, or possibly even adding exposition text.
  • the ability to retain the context when starting a new chat session, or the ability to easily inject the context into a new (clean) chat.
  • the context should be usable when using interactive commands like append or rewrite.

I feel like now that models have larger and larger context windows (128k for openAI, 200k for claude, even though they can't use all of the context window perfectly), being able to manage the context is going to be really valuable.

Thanks for your consideration!

@frankroeder
Copy link
Owner

frankroeder commented Sep 29, 2024

Hey @dlants, thank you for your uplifting feedback! It’s great to hear about your experiences and needs.

In short, I am currently working on a keyword-based approach similar to the cursor editor, which allows you to add a specific file with @file or an entire folder with @folder as context.
However, it will take a little more time before these changes make it into the main branch.

For know, you can utilize the .parrot.md file as a global context for your repository/project. Simply invoke PrtContext to open it. This file provides additional context for your interactive mode commands. I see potential for session management here.

Yes, you are right. The chat and the interactive command are to entirely separate things.

commands to attach the current file, or the current visual selection to the context.
the ability to see the context and manage it - removing things from the context or reordering the items in the context, or possibly even adding exposition text.
the context should be usable when using interactive commands like append or rewrite.

For now, copy & paste the content into the .parrot.md project file and manage it by opening it with PrtContext.

the ability to retain the context when starting a new chat session, or the ability to easily inject the context into a new (clean) chat.

This is something I have to think about.

@dlants
Copy link
Author

dlants commented Sep 30, 2024

Hey! I did some research about this today and I think the way zed does this is pretty much what I was looking for.

A common workflow when using the inline assistant is to create a context in the assistant panel, add the desired context through text, prompts and commands, and then use the inline assistant to generate and apply transformations.

They provide commands that insert a given file, symbols, etc... into the assistant window, which then becomes part of the context for inline edits.

Codecompanion has a bit of a similar feature (slash commands) to allow populating but does not seem to share this context between the chat window and inline edit mode.

I think one direction for this is something RAG like - find all references to the symbol in the code, and add them to the context. Or use vector search of the code (zed is experimenting with a search feature).

Anyways, hope this provides some inspiration. Thanks for your prompt reply!

@dlants
Copy link
Author

dlants commented Sep 30, 2024

Another point of inspiration / reference: magicalne/nvim.ai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants