:LovelaceSession
View current session and workspace context information.
Command Signature
:LovelaceSession
Alias: :LSession
Description
The :LovelaceSession command displays information about your current session, including workspace association, user account details, and session metadata. This helps you understand the context in which your tasks are being executed.
What it shows:
- Current workspace name and ID
- User account information
- Session creation time
- Session ID for debugging
- Authentication status
When to use:
- Verifying which workspace you're working in
- Checking authentication status
- Debugging session-related issues
- Understanding task context
- Troubleshooting workspace association
Usage
Basic Usage
:LovelaceSession
Opens a split window with current session information.
From Lua
require("lovelace.commands").session()
Output Format
The session info buffer displays comprehensive session details:
# Session Information
## User Account
- **Email**: user@example.com
- **User ID**: usr_abc123def456
- **Account Type**: Professional
## Current Workspace
- **Name**: lovelace-platform
- **Workspace ID**: ws_xyz789ghi012
- **Path**: /Users/user/Projects/lovelace
- **Created**: 2025-12-15 08:00:00
## Session Details
- **Session ID**: sess_mno345pqr678
- **Created**: 2025-12-28 14:00:00
- **Duration**: 2h 30m
- **Authentication**: Active
## Tasks in This Session
- Total submitted: 15
- Completed: 12
- Running: 2
- Queued: 1
- Failed: 0
Press 'q' to close
Session Components
User Account Information
Your authenticated user account:
| Field | Description | Example |
|---|---|---|
| Account email address | user@example.com | |
| User ID | Unique user identifier | usr_abc123def456 |
| Account Type | Subscription tier | Professional, Free |
| Auth Status | Current authentication state | Active, Expired |
Workspace Information
The workspace context for task execution:
| Field | Description | Example |
|---|---|---|
| Name | Workspace display name | lovelace-platform |
| Workspace ID | Unique workspace identifier | ws_xyz789ghi012 |
| Path | Filesystem path to project root | /Users/user/Projects/lovelace |
| Created | When workspace was created | 2025-12-15 08:00:00 |
| Last Active | Most recent task submission | 2025-12-28 16:30:00 |
Session Metadata
Current session details:
| Field | Description | Example |
|---|---|---|
| Session ID | Unique session identifier (for debugging) | sess_mno345pqr678 |
| Created | When session started | 2025-12-28 14:00:00 |
| Duration | Time elapsed since session creation | 2h 30m |
| Tasks | Tasks submitted in this session | 15 total |
Session States
Active Session
Normal working state:
# Session Information
## User Account
- **Email**: user@example.com
- **Authentication**: ✓ Active
## Current Workspace
- **Name**: my-project
- **Path**: /Users/user/Projects/my-project
- **Status**: ✓ Active
## Session Details
- **Session ID**: sess_abc123
- **Created**: 2025-12-28 14:00:00
- **Duration**: 45m
What it means:
- Session is working normally
- User is authenticated
- Workspace is accessible
- Tasks can be submitted
Expired Session
Authentication expired:
# Session Information
## User Account
- **Email**: user@example.com
- **Authentication**: ✗ Expired (session expired 10 minutes ago)
## Current Workspace
- **Name**: my-project
- **Status**: ⚠ Inaccessible (authentication required)
## Action Required
Run :LovelaceAuth to re-authenticate
What it means:
- Authentication token expired
- Cannot submit new tasks
- Workspace temporarily inaccessible
- Need to re-authenticate
Action: Run :LovelaceAuth to restore session
No Workspace Associated
Session without workspace:
# Session Information
## User Account
- **Email**: user@example.com
- **Authentication**: ✓ Active
## Current Workspace
- **Status**: ⚠ No workspace associated
- **Current Directory**: /Users/user/Documents
## Action
Change to a project directory and run :LovelaceSession again
Or create a new workspace with workspace management commands
What it means:
- Session active but no workspace set
- Neovim opened outside a project directory
- Tasks cannot be submitted without workspace
Action: Navigate to project directory and reopen Neovim
Common Scenarios
Scenario 1: Verify Current Workspace
Check which workspace tasks will use:
" Before submitting important task
:LovelaceSession
" Verify workspace:
" ## Current Workspace
" - Name: lovelace-platform ✓ Correct!
" Submit task
:LovelaceTask
Use case: Ensure tasks target correct project
Scenario 2: Check Authentication Status
Verify authentication before batch operations:
:LovelaceSession
" Check auth status:
" ## User Account
" - Authentication: ✓ Active
" Safe to proceed with batch tasks
Use case: Pre-flight check before long workflow
Scenario 3: Debug Session Issues
Investigate why tasks aren't submitting:
:LovelaceSession
" Output shows:
" ## User Account
" - Authentication: ✗ Expired
" Found the issue! Re-authenticate:
:LovelaceAuth
Use case: Troubleshooting workflow failures
Scenario 4: Multiple Projects
Working across multiple projects:
" In project A
:LovelaceSession
" Workspace: project-a
" Switch to project B
:cd ~/Projects/project-b
:LovelaceSession
" Workspace: project-b ← Context updated!
Use case: Ensure correct project context when switching
Session Lifecycle
Session Creation
Session starts when:
- First command is run after starting Neovim
- Authentication completes successfully
- Workspace is detected or created
Timeline:
1. Start Neovim in project directory
2. Run :LovelaceHealth (or any Lovelace command)
3. Session created automatically
4. Workspace associated with current directory
Session Persistence
Sessions persist:
- ✅ Across Neovim restarts (if authenticated)
- ✅ When switching buffers/windows
- ✅ When changing directories (workspace updates)
- ❌ When authentication expires (requires re-auth)
Session Expiration
Sessions expire:
- After 24 hours of inactivity
- When authentication token expires
- When user logs out
- After daemon restart (manual re-authentication needed)
Recovery:
:LovelaceAuth
" Re-authenticate to create new session
Session vs Workspace
Understanding the difference:
| Concept | Scope | Lifetime | Purpose |
|---|---|---|---|
| Session | Current Neovim instance | Until auth expires | Track user activity |
| Workspace | Project directory | Permanent (unless deleted) | Group related tasks |
| User | Your account | Permanent | Identity and authentication |
Relationship:
User (user@example.com)
├── Session (sess_abc123) ← Current Neovim instance
│ └── Workspace (ws_xyz789) ← Current project
│ └── Tasks (task_001, task_002, ...) ← Your work
└── Other Sessions (other Neovim instances)
Workspace Context
How Workspaces Are Associated
Workspace association happens:
-
Automatic Detection (preferred):
bashcd /Users/user/Projects/my-project nvim # Workspace "my-project" automatically detected -
Git Repository Root:
- Searches for
.gitdirectory - Uses repository root as workspace
- Searches for
-
Current Directory:
- If no git repository found
- Uses current working directory
Changing Workspaces
Switch workspace by changing directory:
" Check current workspace
:LovelaceSession
" Workspace: project-a
" Change to different project
:cd ~/Projects/project-b
" Verify workspace updated
:LovelaceSession
" Workspace: project-b ← Updated!
Note: Session persists, workspace context updates
Troubleshooting
"Session not found" Error
Symptom: :LovelaceSession shows "Session not found"
Solutions:
-
Create session:
vim:LovelaceHealth " Triggers session creation :LovelaceSession " Now shows session info -
Re-authenticate:
vim:LovelaceAuth " Creates new session -
Check daemon connection:
vim:LovelaceHealth " Verify daemon is running
"Authentication expired" Warning
Symptom: Session shows authentication expired
## User Account
- Authentication: ✗ Expired (10 minutes ago)
Solution:
:LovelaceAuth
" Complete device authorization flow
:LovelaceSession
" Verify authentication restored
Wrong Workspace Associated
Symptom: Session shows incorrect workspace
Solutions:
-
Navigate to correct directory:
vim:cd /path/to/correct/project :LovelaceSession " Workspace should update -
Check git repository:
bash# In terminal cd /path/to/project git rev-parse --show-toplevel # Should show project root -
Restart Neovim in correct location:
bashcd /path/to/correct/project nvim
Session Duration Shows "N/A"
Symptom: Session duration not displayed
Reason: Session created very recently (< 1 second ago)
Action: Wait a few seconds and run :LovelaceSession again
Integration Patterns
Pre-Task Workflow Validation
" 1. Verify session context
:LovelaceSession
" 2. Check workspace is correct
" Workspace: lovelace-platform ✓
" 3. Verify authentication
" Authentication: Active ✓
" 4. Submit task with confidence
:LovelaceTask
Multi-Project Workflow
" Project A workflow
:cd ~/Projects/project-a
:LovelaceSession " Verify workspace
:LovelaceTask " Submit task for project A
" Switch to project B
:cd ~/Projects/project-b
:LovelaceSession " Verify workspace switched
:LovelaceTask " Submit task for project B
Session Health Monitoring
-- Check session health periodically
local function check_session_health()
local lovelace = require("lovelace")
local session = lovelace.get_session()
if not session then
vim.notify("No active session. Run :LovelaceAuth", vim.log.levels.WARN)
return false
end
if session.auth_status ~= "active" then
vim.notify("Authentication expired. Run :LovelaceAuth", vim.log.levels.WARN)
return false
end
return true
end
-- Run check before submitting tasks
vim.api.nvim_create_user_command("LovelaceTaskSafe", function()
if check_session_health() then
require("lovelace.commands").task()
end
end, {})
Advanced Usage
Programmatic Session Access
local lovelace = require("lovelace")
local connection = lovelace.get_connection()
connection:call("session.info", {}, function(result, error)
if result then
print("User: " .. result.user.email)
print("Workspace: " .. result.workspace.name)
print("Session ID: " .. result.session_id)
print("Duration: " .. result.duration_minutes .. " minutes")
end
end)
Custom Session Display
-- Create custom session status line component
local function session_status()
local lovelace = require("lovelace")
local session = lovelace.get_session()
if not session then
return "No Session"
end
if session.auth_status ~= "active" then
return "Auth Expired"
end
return session.workspace.name or "No Workspace"
end
-- Use in statusline
vim.o.statusline = "%f %{luaeval('session_status()')} %="
Session Activity Logging
-- Log session activity for analysis
local function log_session_activity()
local lovelace = require("lovelace")
local session = lovelace.get_session()
if session then
local log_entry = {
timestamp = os.time(),
user = session.user.email,
workspace = session.workspace.name,
task_count = session.task_count,
}
-- Append to log file
local log_file = vim.fn.stdpath("data") .. "/lovelace-session.log"
local f = io.open(log_file, "a")
f:write(vim.json.encode(log_entry) .. "\n")
f:close()
end
end
Related Commands
| Command | Purpose |
|---|---|
| :LovelaceAuth | Authenticate and create session |
| :LovelaceHealth | Check session connectivity |
| :LovelaceTasks | View tasks in current session |
Next Steps
- :LovelaceAuth - Authenticate and manage sessions
- Session Management Guide - Complete session workflows
- Configuration Deep Dive - Session-related settings
- Troubleshooting - Common session issues
Related Documentation
- Session Management Guide - Complete session and workspace concepts
- Authentication Guide - Device authorization flow
- Configuration Deep Dive - Session-related configuration