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
lovelace chat [options]
Options
| Option | Type | Description | Default |
|---|---|---|---|
-m, --model <model> | string | Specific model to use | Provider default |
-p, --provider <provider> | string | AI provider (anthropic, openai, ollama, google) | From config |
-s, --system <prompt> | string | Custom system prompt | - |
-t, --temperature <temp> | number | Generation temperature (0.0-1.0) | 0.7 |
--max-tokens <tokens> | number | Maximum tokens to generate | 4096 |
-l, --load <session> | string | Load specific session by ID or name | - |
--performance | boolean | Enable performance tracking | false |
--debug | boolean | Show debug information | false |
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 NextAuth.js. Let me analyze
your authentication setup.
Based on the code in `src/app/api/auth/[...nextauth]/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
ā NextAuth.js 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 NextAuth.js
**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:
- Missing input validation (lines 23-45)
- No error handling for database failures
- Potential race condition in user creation
Suggested Improvements:
- Add Zod schemas for validation
- Implement retry logic for transient failures
- 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:
- Where is this error occurring? (file and line number)
- What operation were you performing?
- 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:
- Server-only execution - No JavaScript shipped to client
- Direct database access - No API routes needed
- 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
| Command | Description |
|---------|-------------|
| `/exit` | End the current chat session |
| `/clear` | Clear conversation history |
| `/save` | Save current session with a name |
| `/resume <id>` | Resume a previous session |
### Context Management
| Command | Description |
|---------|-------------|
| `/context <path>` | Add file or directory to conversation context |
| `/context list` | Show all files currently in context |
| `/context clear` | Remove all files from context |
### Settings
| Command | Description |
|---------|-------------|
| `/model <name>` | Switch to a different AI model |
| `/provider <name>` | Switch to a different AI provider |
| `/help` | Show available commands |
## Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `LOVELACE_DEFAULT_PROVIDER` | Default AI provider | `anthropic` |
| `LOVELACE_DEFAULT_MODEL` | Default model name | Provider default |
| `ANTHROPIC_API_KEY` | Anthropic API key | - |
| `OPENAI_API_KEY` | OpenAI API key | - |
| `GOOGLE_API_KEY` | Google 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
| Code | Meaning |
|------|---------|
| `0` | Chat session completed successfully |
| `1` | Error during chat session (network, authentication, etc.) |
| `2` | Invalid options provided |
## Related Commands
- **[lovelace sessions](./sessions)** - Manage and search chat history
- **[lovelace config](./config)** - Configure default provider and model
- **[lovelace workspace](./workspace)** - Manage project context
## Related Guides
- **[Interactive Chat Guide](../../guides/interactive-chat)** - Complete guide to chat features
- **[Product Requirements Example](../../examples/product-requirements)** - Using chat for PM work
- **[Hackathon Project Example](../../examples/hackathon-project)** - Building apps with chat assistance
---
**See the [Command Reference](../command-reference)** for all available commands.