Skip to content
Docs/Agent Sessions

Agent Sessions

Every time an AI agent (Copilot CLI, Claude CLI, or Gemini CLI) works in your repo, it leaves a rich trace — summaries, intents, tool calls, and conversation history. vem reads these sessions to give you and your agents cross-session awareness and help auto-enrich project memory.

What are agent sessions?

vem supports three AI CLI tools, each storing sessions in a different location and format:

Copilot CLI
~/.copilot/session-state/<uuid>/

workspace.yaml (metadata) + events.jsonl (structured event stream with intents, tool calls, user messages).

Claude CLI
~/.claude/projects/<encoded-path>/<uuid>.jsonl

Event log per session. Each line has type (user/assistant/system), cwd, gitBranch, and message content.

Gemini CLI
~/.gemini/tmp/<project>/chats/session-*.json

Session file with sessionId, startTime, lastUpdated, messages[], and an optional summary field.

vem reads these files locally — no network calls, no data leaving your machine — and surfaces the information through the CLI and the MCP server.

What you can do

Browse recent sessions

See every Copilot agent session that worked on this repository — what branch it ran on, when it ran, and what its summary says — all in a single table.

Import sessions into .vem/ memory

Turn a session's summary into a changelog entry, or attach its evidence to an active task — interactively, in one command.

Give agents cross-session awareness

Agents can call list_agent_sessions() at startup to see what previous sessions worked on, avoiding duplicated effort and staying aligned with ongoing work.

Trace intent history

Every report_intent call in a session is captured. Agents and developers can see the sequence of high-level goals pursued in past sessions.

CLI: vem sessions

vem sessions

List recent agent sessions (Copilot, Claude, Gemini) for the current repository. Shows source, session ID, summary, branch, and last-updated timestamp.

Usage

vem sessions [--limit <n>] [--branch <branch>] [--source <source>] [--all]

Options

--limit <n>Number of sessions to show (default: 20)
--branch <branch>Filter by branch name
--source <source>Filter by agent tool: copilot | claude | gemini
--allShow sessions from all repositories, not just the current one

Example

$ vem sessions
┌──────────────────────────────────────────────────────────────────────────────────────┐
│ Source  │ ID          │ Summary                        │ Branch      │ Updated        │
├─────────┼─────────────┼────────────────────────────────┼─────────────┼────────────────┤
│ copilot │ 2903b920…   │ Explain Copilot Session Aware… │ ai-service  │ Mar 4, 11:25   │
│ claude  │ 003d07af…   │ Check the AI service billing   │ ai-service  │ Mar 3, 16:40   │
│ gemini  │ 944a54e0…   │ Back to app button redirect    │ ai-service  │ Mar 3, 14:15   │
│ copilot │ 1846a878…   │ Run All Typechecks And Format… │ ai-service  │ Mar 4, 03:30   │
└──────────────────────────────────────────────────────────────────────────────────────┘

vem sessions import <id>

Interactively import a session into vem project memory. Shows the session's summary, intents, and first user message, then prompts you to add a changelog entry and/or link it to an active task.

Usage

vem sessions import <id>

Options

<id>Full session UUID or a short prefix (e.g. 2903b9)

Example

$ vem sessions import 2903b9

📋 Session Summary
  ID:       2903b920-0500-48dd-9676-1c4427f43ebf
  Source:   copilot
  Branch:   ai-service
  Updated:  Mar 4, 11:25 PM
  Summary:  Explain Copilot Session Awareness

🎯 Intents recorded in this session:
  • Fetching Copilot docs
  • Exploring vem codebase
  • Implementing session reader

? Add session summary as a changelog entry? › Yes
✓ Changelog entry added.
? Link this session to an active task (add evidence)? › Yes
? Which task? › TASK-042 — Copilot session integration
✓ Linked to task TASK-042 with evidence.

✅ Done.

MCP tool: list_agent_sessions

The list_agent_sessions MCP tool is available to any AI agent running the vem-mcp server. It returns recent sessions for the current repository from all three sources (Copilot CLI, Claude CLI, Gemini CLI), filtered to the git root automatically.

list_agent_sessions

List recent agent sessions (Copilot CLI, Claude CLI, Gemini CLI) for this repository. Call this at the start of a session to understand what previous sessions worked on and avoid duplicating effort.

Input

{
  "limit": 10,                          // optional, default 10
  "branch": "main",                     // optional, filter by branch
  "sources": ["copilot", "claude", "gemini"]  // optional, filter by tool
}

Output (per session)

{
  "id": "2903b920-...",
  "source": "copilot",
  "summary": "Explain Copilot Session Awareness",
  "branch": "ai-service",
  "repository": "vem-dev/vem",
  "created_at": "2026-03-04T23:22:50.283Z",
  "updated_at": "2026-03-04T23:25:00.000Z",
  "intents": ["Fetching Copilot docs", "Exploring vem codebase"],
  "user_messages": ["copilot extension for vscode..."]
}

💡 Recommended agent workflow

Call list_agent_sessions() as one of your first tools when starting a new session. The returned intents and summaries tell you exactly what was worked on recently — so you can pick up where the last agent left off or avoid re-doing work that is already done.

How it works

vem reads sessions from each tool's local storage directory and filters by the current repository's git root. All three sources are merged and sorted newest-first.

  • Copilot CLI — matched via git_root in workspace.yaml; intents extracted from report_intent tool calls in events.jsonl
  • Claude CLI — matched via encoded path directory; user messages and git branch read from per-line JSON events
  • Gemini CLI — matched via ~/.gemini/projects.json path-to-name mapping; uses the session's built-in summary field when available

All reads are local disk operations. No data is uploaded to any external service during the read phase.

Next steps