Crate hindsight_copilot

Crate hindsight_copilot 

Source
Expand description

hindsight-copilot: GitHub Copilot log processing for hindsight-mcp

This library crate provides functionality to parse and process GitHub Copilot logs and chat sessions for consumption by the hindsight-mcp server.

§Log Locations

VS Code stores Copilot chat history in local SQLite databases and JSON files:

  • macOS: ~/Library/Application Support/Code/User/workspaceStorage/<workspace-id>/chatSessions/
  • Windows: %APPDATA%\Code\User\workspaceStorage\<workspace-id>\chatSessions\
  • Linux: ~/.config/Code/User/workspaceStorage/<workspace-id>/chatSessions/

§Log Format

Copilot logs follow JSON Stream / LSP Trace format when log level is set to Trace.

§Session Discovery

Use SessionDiscovery to find chat sessions across all workspaces:

use hindsight_copilot::session::{SessionDiscovery, parse_session_file};

let discovery = SessionDiscovery::new().expect("find storage");
for session in discovery.discover_sessions().expect("enumerate") {
    let parsed = parse_session_file(&session.path, &session.workspace_storage_id);
    println!("{:?}", parsed);
}

Re-exports§

pub use error::CopilotError;
pub use session::ChatMessage;
pub use session::ChatSession;
pub use session::DiscoveredSession;
pub use session::MessageRole;
pub use session::SessionDiscovery;
pub use session::Variable;
pub use session::WorkspaceInfo;
pub use session::default_chat_sessions_dir;
pub use session::parse_session_file;
pub use session::parse_session_json;

Modules§

error
Error types for hindsight-copilot
lsp
LSP types and parsing for Copilot logs
parser
JSON stream parser for Copilot logs
prelude
Re-export commonly used types
session
Chat session types, discovery, and parsing