get_session_history
Retrieve session progress including completed tasks, modified files, tool usage, and git commits to track development work.
Instructions
Get what has been accomplished this session - completed todos, files modified, tool calls, git commits.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| working_directory | No | Working directory for git operations. Defaults to current directory. |
Implementation Reference
- src/ccsession/server.py:237-293 (handler)The `_get_session_history` function is the handler responsible for gathering Accomplished todos, modified files, tool calls, and recent git commits.
async def _get_session_history(arguments: dict[str, Any]) -> dict: """Get what has been accomplished this session.""" working_dir = arguments.get("working_directory") or _get_working_directory() # Get transcript info transcript_parser = TranscriptParser() session_start = transcript_parser.get_session_start_time() # Get files modified from transcript files_modified = transcript_parser.get_files_modified() # Get agents spawned agents_spawned = transcript_parser.get_agents_spawned() # Get tool calls summary tool_calls = transcript_parser.get_tool_calls() bash_commands = [ tc["params"].get("command", "") for tc in tool_calls if tc["name"] == "Bash" and tc["params"].get("command") ] # Get session ID and completed todos session_id = None if transcript_parser.transcript_path: todo_parser = TodoParser() session_id = todo_parser.extract_session_id_from_transcript_path( transcript_parser.transcript_path ) completed_todos = [] if session_id: todo_parser = TodoParser() todos = todo_parser.get_todos_for_session(session_id) completed_todos = [t.content for t in todos.completed] # Get git commits since session start git = GitUtils(working_dir) git_commits = [] if session_start and git.is_git_repo(): commits = git.get_recent_commits(n=20, since=session_start) git_commits = [ {"sha": c.sha[:7], "message": c.message} for c in commits ] return { "completed_todos": completed_todos, "files_modified": files_modified, "tool_calls": { "bash_commands": bash_commands[:20], # Limit to recent "agents_spawned": agents_spawned, "files_read": sum(1 for tc in tool_calls if tc["name"] == "Read"), "files_written": sum(1 for tc in tool_calls if tc["name"] in ("Write", "Edit")), }, "git_commits": git_commits, } - src/ccsession/server.py:67-79 (registration)The tool `get_session_history` is defined in the `list_tools` registration function in `src/ccsession/server.py`.
name="get_session_history", description="Get what has been accomplished this session - completed todos, files modified, tool calls, git commits.", inputSchema={ "type": "object", "properties": { "working_directory": { "type": "string", "description": "Working directory for git operations. Defaults to current directory.", } }, "required": [], }, ),