Skip to main content

lovelace chat

Interactive AI chat sessions with workspace context

Start conversational AI sessions directly in your terminal. The chat command provides an interactive interface for AI assistance that understands your codebase, asks clarifying questions, and maintains conversation context across multiple exchanges.

Overview

The chat command launches an interactive session where you can have natural conversations with AI about your code, architecture, bugs, or anything related to your project. Unlike simple command-line prompts, chat provides:

  • Multi-turn conversations - Build on previous exchanges and refine your questions
  • Workspace awareness - AI understands your project structure automatically
  • Session management - Save, resume, and search past conversations
  • Interactive questioning - AI asks clarifying questions when needed
  • Provider flexibility - Choose between Anthropic Claude, OpenAI, Google Gemini, or local models

Usage

bash
lovelace chat [options]

Options

OptionTypeDescriptionDefault
-m, --model <model>stringSpecific model to useProvider default
-p, --provider <provider>stringAI provider (anthropic, openai, ollama, google)From config
-s, --system <prompt>stringCustom system prompt-
-t, --temperature <temp>numberGeneration temperature (0.0-1.0)0.7
--max-tokens <tokens>numberMaximum tokens to generate4096
-l, --load <session>stringLoad specific session by ID or name-
--performancebooleanEnable performance trackingfalse
--debugbooleanShow debug informationfalse

Interactive Examples

Starting a Basic Chat

$ lovelace chat

šŸ¤– Lovelace CLI v1.0.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Connected to: claude-sonnet-4-5
Workspace: my-project
Project: /Users/dev/my-project

Type your message or use slash commands:
  /help    Show available commands
  /context Add files to conversation
  /clear   Clear conversation history
  /exit    End session

You: How does authentication work in this codebase?

šŸ¤– I can see you're working on a Next.js project with Auth. Let me analyze
   your authentication setup.

   Based on the code in `src/app/api/auth/[...auth]/route.ts`, your auth system uses:

   1. **OAuth Providers**: Google and GitHub OAuth
   2. **Session Strategy**: JWT-based sessions
   3. **Callbacks**: Custom JWT and session callbacks for user metadata

   Would you like me to explain any specific part in more detail?

You: Yes, explain the session callback

šŸ¤– The session callback in your setup does two things:

   [Detailed explanation with code references]

You: /exit

āœ“ Session saved: session_abc123

Multi-Turn Clarifying Conversation

$ lovelace chat

You: Help me add authentication to my app

šŸ¤– I'd be happy to help! To give you the best guidance, let me ask a few questions:

   1. What framework are you using?
      • Next.js
      • Express.js
      • Other

   2. What type of authentication do you need?
      • Email/password
      • OAuth (Google, GitHub, etc.)
      • Passkeys
      • Multiple methods

   3. Do you have a database set up?
      • Yes (which one?)
      • Not yet

You: Next.js 14 with App Router, OAuth with Google and GitHub, using Prisma with PostgreSQL

šŸ¤– Perfect! I'll help you implement OAuth authentication with Google and GitHub using:
   āœ“ Next.js 14 App Router
   āœ“ Auth v5 (Auth.js)
   āœ“ Prisma with PostgreSQL

   Let's start step-by-step. First, would you like me to:
   1. Show you the complete setup
   2. Walk through it step-by-step
   3. Explain the architecture first

You: 2

šŸ¤– Great! Here's our plan:

   **Step 1**: Install dependencies
   **Step 2**: Configure Auth
   **Step 3**: Set up OAuth providers
   **Step 4**: Create Prisma schema
   **Step 5**: Add API routes
   **Step 6**: Create login UI

   Ready to start with Step 1?

You: yes

šŸ¤– **Step 1: Install Dependencies**

   Run these commands:
   [Installation instructions with explanations]

Using Slash Commands

$ lovelace chat

You: /help

Available Commands:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Session Control:
  /exit          End chat session
  /clear         Clear conversation history
  /save          Save current session
  /resume <id>   Resume previous session

Context Management:
  /context <path>    Add file or directory to context
  /context list      Show current context
  /context clear     Clear all context

Settings:
  /model <name>      Switch AI model
  /provider <name>   Switch AI provider

You: /context src/auth/login.ts

āœ“ Added to context: src/auth/login.ts (234 lines)

Current context (1 file, 234 lines):
  • src/auth/login.ts

You: Review this code for security issues

šŸ¤– I've reviewed your login.ts file. Here are the security concerns I found:

   1. **Critical**: Password hashing missing
      Line 45: Passwords stored in plain text

      Fix:
      ```typescript
      import bcrypt from 'bcrypt';
      const hashedPassword = await bcrypt.hash(password, 10);
      ```

   [Additional security feedback...]

Resuming a Session

$ lovelace chat --load session_abc123

šŸ¤– Resuming session: Authentication implementation discussion
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Last message: "Would you like me to explain the session callback?"

Loaded context:
  • src/auth/login.ts
  • src/auth/register.ts
  • src/auth/session.ts

You: Yes, explain the session callback

šŸ¤– [Continues from where you left off...]

Choosing a Different Provider

$ lovelace chat --provider openai --model gpt-4

šŸ¤– Lovelace CLI v1.0.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Connected to: gpt-4
Provider: OpenAI
Workspace: my-project

You: Help me optimize this SQL query
[...]

Using Local Models

$ lovelace chat --provider ollama --model llama2

šŸ¤– Lovelace CLI v1.0.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Connected to: llama2 (local)
Provider: Ollama
Workspace: my-project
Note: Using local model - no API calls

You: Explain this function
[...]

Common Use Cases

Code Review

Get AI feedback on your code changes:

$ lovelace chat

You: /context src/api/user-service.ts

You: Review this code for potential issues and improvements

šŸ¤– I've analyzed your user service. Here's my review:

   **Issues Found:**
   1. Missing input validation (lines 23-45)
   2. No error handling for database failures
   3. Potential race condition in user creation

   **Suggested Improvements:**
   1. Add Zod schemas for validation
   2. Implement retry logic for transient failures
   3. Use database transactions for user creation

   Would you like me to show code examples for any of these?

Debugging

Get help understanding errors:

You: I'm getting this error: "Cannot read property 'id' of undefined"

šŸ¤– This error typically occurs when you're trying to access a property on a value
   that's undefined. To help you debug:

   1. Where is this error occurring? (file and line number)
   2. What operation were you performing?
   3. Can you share the relevant code?

You: It's in src/api/auth.ts line 67 when trying to get user.id

šŸ¤– Let me see that code:

You: /context src/api/auth.ts

šŸ¤– I can see the issue. On line 67, you're accessing `user.id`, but the user
   might be null if the database query doesn't find a match.

   Here's the fix:
   [Code example with null checking...]

Learning

Understand new concepts or frameworks:

You: Explain how React Server Components work

šŸ¤– React Server Components (RSC) are a new paradigm in React that allows components
   to render on the server and stream to the client. Here's how they work:

   **Key Concepts:**
   1. Server-only execution - No JavaScript shipped to client
   2. Direct database access - No API routes needed
   3. Automatic code splitting - Better performance

   Would you like me to:
   - Show practical examples
   - Explain the difference from traditional SSR
   - Demonstrate with your Next.js project

Slash Commands Reference

Session Control

CommandDescription
/exitEnd the current chat session
/clearClear conversation history
/saveSave current session with a name
/resume <id>Resume a previous session

Context Management

CommandDescription
/context <path>Add file or directory to conversation context
/context listShow all files currently in context
/context clearRemove all files from context

Settings

CommandDescription
/model <name>Switch to a different AI model
/provider <name>Switch to a different AI provider
/helpShow available commands

Environment Variables

VariableDescriptionDefault
LOVELACE_DEFAULT_PROVIDERDefault AI provideranthropic
LOVELACE_DEFAULT_MODELDefault model nameProvider default
ANTHROPIC_API_KEYAnthropic API key-
OPENAI_API_KEYOpenAI API key-
GOOGLE_API_KEYGoogle AI API key-

Session Storage

Chat sessions are automatically saved to ~/.lovelace/sessions/ and include:

  • Conversation history (all messages)
  • Context files (which files were loaded)
  • Model and provider used
  • Timestamps for each message
  • Session metadata (tags, description)

Tips & Best Practices

Effective Prompting

Be specific:

āŒ "Fix this code"
āœ… "Review user-service.ts authentication logic for SQL injection vulnerabilities"

Provide context:

āŒ "How should I structure this?"
āœ… "/context src/architecture.md
    How should I structure the new payment service based on our existing architecture?"

Iterate:

Start broad → Get specific → Refine based on responses

Managing Context

Start focused:

# Add only relevant files
/context src/auth/login.ts

Expand as needed:

# Add related files when discussion evolves
/context src/auth/session.ts
/context src/types/user.ts

Clear when switching topics:

/context clear
/context src/api/posts.ts

Session Management

Save important sessions:

/save "Authentication implementation discussion"

Resume where you left off:

lovelace chat --load session_abc123

Exit Codes

CodeMeaning
0Chat session completed successfully
1Error during chat session (network, authentication, etc.)
2Invalid options provided

Related Commands

Related Guides


See the Command Reference for all available commands.