Generative AI Conversations

The Pieces CLI offers versatile tools for interacting with generative AI. It allows you to quickly gain insights and generate code to fit your specific use case, all from within your terminal.


Accessing Copilot Chat in your Terminal

There are two ways to manage your Copilot chats in the Pieces CLI.

Starting a New Copilot Chat

To quickly start a conversation with Pieces Copilot:

1

Open a Terminal

Opening a terminal on your device depends on your platform: Open your OS’ search bar and enter terminal (macOS/Linux) or CMD (Windows).

2

Enter Ask Command

You can launch Pieces CLI by typing pieces run., Then, you can type ask query, where query is your question.

If you’re not in Pieces CLI, in your terminal, you can type pieces ask query, replacing query with your question.

Opening Previous Chats

To resume or explore an earlier conversation:

  • chats: Show all your conversations. The one highlighted in green is where new questions go by default.

  • chat: Display the messages in your current conversation.

  • chat <number>: Switch to conversation <number> and show its messages.

Use these flags with your chat command to manage conversations as you go:

  • chat --new, chat -n: Create a new conversation and switch to it.

  • chat --delete, chat -d: Delete the conversation you’re currently viewing.

  • chat --rename [name], chat -r [name]: Rename the conversation you’re viewing. If you don’t provide [name], the assistant will suggest one.

Read more about what commands are available in the Pieces CLI.

Contextualized Chats

You can narrow Copilot’s focus by feeding it specific materials or files when you ask a question.

via Material Index

1

Open a Terminal

Opening a terminal on your device depends on your platform: Open your OS’ search bar and enter terminal(macOS/Linux) or CMD(Windows).

2

List your materials

Run pieces list to view all saved materials and note the index of the one you need.

3

Ask with a Material

Use the -m flag and that index when you ask: pieces ask "Explain the data model here" -m 4

Pieces Copilot will load material #4 as context.

via File Path

Use a folder of specific file as context for Pieces Copilot by initiating the conversation at a specified path.

1

Select Your File or Folder

Decide which file (or directory) you want Copilot to reference.

2

Open a Terminal

Opening a terminal on your device depends on your platform: Open your OS’ search bar and enter terminal(macOS/Linux) or CMD(Windows).

3

Ask with a File

Use the -f flag and the path, pieces ask "How does this component render?" -f src/components/Button.jsx.

Pieces Copilot will read that file before answering.

4

Provide Multiple Contexts

Mix flags to supply more than one source pieces ask "Compare this code to the design spec" -m 2 -f design/specs.md.

Copilot loads material #2 and specs.md before generating its response.

Pieces MCP

The Pieces MCP offers several useful commands within the Pieces CLI, from setting up the MCP to learning more about it. Discover the different commands:

Setup

Automatically sets up MCP for VS Code, Goose, or Cursor.

1

Enter MCP Command

Within the Pieces CLI, enter mcp setup this will open up a new MCP setup menu.

2

Select MCP Platform

In the new window, select one of the three options that appear:

  • VS Code

  • Goose

  • Cursor

After selecting the environment you plan to set up Pieces MCP with, you’ll be prompted with the next set of questions.

3

Select Workspace

The new menu will have you select a workspace:

  • User Settings — Make the MCP available in any project you work on within VS Code.

  • Workspace Settings — Save the MCP locally to the current project you’re working on.

When you select the workspace you want to set up, Pieces CLI will automatically add the configuration for you and guide you through using Pieces MCP within the platform you chose.

List

The mcp list command displays the current implementations of Pieces MCP on your development platforms.

Currently, the Pieces CLI supports integration with GitHub Copilot, Goose, and Cursor.

Docs

The mcp docs command displays all of the mcp documentation correlated with the supported development environments with the Pieces CLI and Pieces MCP.

Repair

The mcp repair command checks how the Pieces MCP is set up in the platforms supported by Pieces CLI.

If it finds any issues, it will automatically fix them and ask you to type y for yes or n for no. Then, press return (macOS) or enter (Windows/Linux) to confirm your choice.

Status

Running mcp status within the Pieces CLI will automatically check all implemented platforms to make sure the Pieces MCP implementation is running correctly.

If it finds that an implementation is broken, it will ask if you want to auto-repair the MCP server.

Type y for yes or n for no, and press return (macOS) or enter (Windows/Linux) to confirm your choice.

Improving Code Consistency & Standardization

The Pieces Copilot enhances code quality by identifying inconsistencies and providing practical suggestions for standardization.

Naming Inconsistencies

Suppose functions across your workspace use inconsistent naming patterns (e.g., authenticateUser in authHandler.go vs. retrieveUserProfile in userHandler.go).

In that case, Pieces Copilot can suggest adopting a standardized naming convention for better readability and maintainability, like this:

func authenticateUser(ctx context.Context, credentials Credentials) (User, error) {
    if credentials.Username == "" || credentials.Password == "" {
        return User{}, errors.New("missing credentials")
    }
}

Inconsistent Error Handling

If error-handling strategies differ across files (e.g., structured errors in authService.go vs. inconsistent handling in userService.go), Pieces Copilot can help unify the approach:

func LoginUser(credentials Credentials) (string, error) {
    token, err := authenticate(credentials)
    if err != nil {
        return "", fmt.Errorf("login failed: %w", err)
    }
    return token, nil
}
Updated on