Skip to main content

:LovelaceSession

View current session and workspace context information.

Command Signature

vim
: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

vim
:LovelaceSession

Opens a split window with current session information.

From Lua

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:

FieldDescriptionExample
EmailAccount email addressuser@example.com
User IDUnique user identifierusr_abc123def456
Account TypeSubscription tierProfessional, Free
Auth StatusCurrent authentication stateActive, Expired

Workspace Information

The workspace context for task execution:

FieldDescriptionExample
NameWorkspace display namelovelace-platform
Workspace IDUnique workspace identifierws_xyz789ghi012
PathFilesystem path to project root/Users/user/Projects/lovelace
CreatedWhen workspace was created2025-12-15 08:00:00
Last ActiveMost recent task submission2025-12-28 16:30:00

Session Metadata

Current session details:

FieldDescriptionExample
Session IDUnique session identifier (for debugging)sess_mno345pqr678
CreatedWhen session started2025-12-28 14:00:00
DurationTime elapsed since session creation2h 30m
TasksTasks submitted in this session15 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:

vim
" 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:

vim
: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:

vim
: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:

vim
" 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:

vim
:LovelaceAuth
" Re-authenticate to create new session

Session vs Workspace

Understanding the difference:

ConceptScopeLifetimePurpose
SessionCurrent Neovim instanceUntil auth expiresTrack user activity
WorkspaceProject directoryPermanent (unless deleted)Group related tasks
UserYour accountPermanentIdentity 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:

  1. Automatic Detection (preferred):

    bash
    cd /Users/user/Projects/my-project
    nvim
    # Workspace "my-project" automatically detected
    
  2. Git Repository Root:

    • Searches for .git directory
    • Uses repository root as workspace
  3. Current Directory:

    • If no git repository found
    • Uses current working directory

Changing Workspaces

Switch workspace by changing directory:

vim
" 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:

  1. Create session:

    vim
    :LovelaceHealth
    " Triggers session creation
    
    :LovelaceSession
    " Now shows session info
    
  2. Re-authenticate:

    vim
    :LovelaceAuth
    " Creates new session
    
  3. 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:

vim
:LovelaceAuth
" Complete device authorization flow

:LovelaceSession
" Verify authentication restored

Wrong Workspace Associated

Symptom: Session shows incorrect workspace

Solutions:

  1. Navigate to correct directory:

    vim
    :cd /path/to/correct/project
    :LovelaceSession
    " Workspace should update
    
  2. Check git repository:

    bash
    # In terminal
    cd /path/to/project
    git rev-parse --show-toplevel
    # Should show project root
    
  3. Restart Neovim in correct location:

    bash
    cd /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

vim
" 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

vim
" 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

lua
-- 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

lua
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

lua
-- 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

lua
-- 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

CommandPurpose
:LovelaceAuthAuthenticate and create session
:LovelaceHealthCheck session connectivity
:LovelaceTasksView tasks in current session

Next Steps

Related Documentation