Skip to content

Add conversation attachment handler for referencing existing conversation content #235

@JeanMertz

Description

@JeanMertz

Add a new attachment handler that allows attaching the full content of existing conversations as context for new conversations.

Context

When working with LLMs, it is often valuable to get second opinions or continue discussions with different models while preserving the full context of previous conversations. Currently, the attachment system supports various external content types but lacks the ability to attach conversation content from existing conversations.

While it is possible to continue an existing conversation using a different model using jp query --model, that would use the existing conversation as if it was communicated with the new model, instead of attaching it as an "external conversation" that the new model can read, but won't interpret as its own conversation.

Alternatives

Alternative approaches include conversation forking, manual copy-paste, or summarization, but these do not provide the same flexibility.

Proposed Implementation

Implement a new ConversationHandler struct in a jp_attachment_conversation crate following the existing attachment handler pattern.

For now, two URIs are accepted:

  • conversation://<local id> which would be the directory name (without the free-form title) in .jp/conversation
  • conversation://<global-id> which would be the global JP ID for conversations (seen using jp conversation ls, such as jp-c17534214039-otvo8)

We could optionally add a summary=true parameter to use an llm to summarize an existing conversation and attach that, to limit the number of used tokens.

Tasks

  • Create new jp_attachment_conversation crate
  • Implement ConversationHandler struct
  • Add support for local and global ID formats
  • Add conversation content retrieval logic
  • Register handler in distributed slice system
  • Add comprehensive tests
  • Update documentation

Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions