Skip to content

ishandhanani/forky

Repository files navigation

Forky: Git-style Conversation Structure for LLMs

forky

Forky is a command-line interface (CLI) tool that implements a git-style conversation structure for interactions with the Claude API. It allows users to create, manage, and navigate through branching conversations, providing a unique way to explore different conversation paths with an AI assistant.

Features

  • Conversation Tree Structure: Manage conversations in a tree-like structure, allowing for branching and merging of dialogue paths.
  • Forking: Create new branches in the conversation to explore alternative dialogue paths.
  • Merging: Combine forked conversations back into the main thread with automatic summarization.
  • CLI Interface: Easy-to-use command-line interface for interacting with the conversation tree.
  • Visualization: ASCII-based tree visualization of the conversation structure.
  • History Tracking: View and manage the full conversation history.

Installation

  1. Clone the repository:

    git clone https://github.com/ishandhanani/forky.git
    cd forky
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    
  3. Set up your Anthropic API key:

    • Create a .env file in the project root.
    • Add your API key: ANTHROPIC_API_KEY=your_api_key_here

Usage

CLI

Run the CLI application:

python -m cli.main chat

Web Interface (Beta)

You can also run the web interface for a richer visualization:

frontend

  1. Start the Backend Server:

    export PYTHONPATH=$PYTHONPATH:. 
    python3 server/app.py

    The server runs on http://localhost:8000.

  2. Start the Frontend:

    cd web
    npm install  # First time only
    npm run dev

    The web app runs on http://localhost:5173.

Commands

  • Type your message to chat with Claude
  • /fork: Create a new branch in the conversation
  • /merge: Merge the current branch back into the main conversation
  • /status: View the current conversation state
  • /visualize: See an ASCII representation of the conversation tree
  • /history: View the full conversation history
  • quit: Exit the application

Project Structure

  • api_client.py: Handles communication with the Claude API
  • cli.py: Implements the command-line interface
  • conversation_node.py: Defines the ConversationNode class for tree structure
  • conversation_tree.py: Manages the overall conversation tree and operations

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A git-style way of managing LLM chats

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •