feat(parser): add gptme agent parser#678
Conversation
Adds gptme as a supported agent in AgentsView. gptme stores sessions as JSONL files under ~/.local/share/gptme/logs/<session-id>/conversation.jsonl with one JSON object per message containing role, content, timestamp, and optional metadata (model, usage) on assistant messages. - internal/parser/gptme.go: DiscoverGptmeSessions, FindGptmeSourceFile, ParseGptmeSession with full token accounting (input/output/cache tokens) - internal/parser/types.go: register AgentGptme in the Registry - internal/parser/gptme_test.go: tests for parse, discover, find, and session-name-to-project extraction - internal/parser/testdata/gptme/: fixture JSONL with 7 messages covering system/user/assistant/tool roles and token_usage fields gptme is an open-source terminal AI assistant (https://gptme.org) with support for Anthropic, OpenAI, Google, and local models via OpenRouter.
roborev: Combined Review (
|
…sing - Add classifyOnePath case for AgentGptme so discovered gptme files route to the sync engine instead of the unknown-agent branch - Add processGptme to the engine's processFile dispatch - Extend timestampLayouts with "2006-01-02T15:04:05.000000" to handle gptme's microsecond-precision timestamps (no timezone suffix) - Assert session.StartedAt, session.EndedAt, and msgs[0].Timestamp in TestParseGptmeSession to confirm timestamp parsing end-to-end Addresses roborev High + Medium findings on PR kenn-io#678.
|
Addressed the two roborev findings in High — sync engine missing AgentGptme dispatch Medium — microsecond timestamp format not parsed |
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
|
Addressed the latest roborev Medium finding in
Verified with:
|
roborev: Combined Review (
|
Summary
Adds gptme as a supported agent in AgentsView.
gptme is an open-source terminal AI assistant (Spring 2023, one of the earliest agent CLIs) supporting Anthropic, OpenAI, Google, DeepSeek, and local models via OpenRouter. Sessions are stored as JSONL files with one JSON object per message.
Session format
{"role": "system", "content": "...", "timestamp": "2026-06-13T10:00:00.000000", "pinned": true} {"role": "user", "content": "Write a hello world program in Python.", "timestamp": "..."} {"role": "assistant", "content": "I'll write...", "timestamp": "...", "metadata": {"model": "openrouter/anthropic/claude-sonnet-4-6", "usage": {"input_tokens": 120, "output_tokens": 42, "cache_read_tokens": 80, "cache_creation_tokens": 0}}} {"role": "tool", "content": "Saved file: hello.py", "timestamp": "..."}Session discovery path:
~/.local/share/gptme/logs/*/conversation.jsonlChanges
internal/parser/gptme.go—DiscoverGptmeSessions,FindGptmeSourceFile,ParseGptmeSessionwith full token accounting (input/output/cache read/cache write tokens)internal/parser/types.go— registerAgentGptmein the Registry withGPTME_DIRenv var andgptme_dirsconfig keyinternal/parser/gptme_test.go— tests for parse, discover, find, and session-name-to-project extractioninternal/parser/testdata/gptme/— fixture JSONL with 7 messages covering all role types and token_usage fieldsImplementation notes
"role": "tool") are mapped toRoleUserwithIsSystem: true, following the same pattern used for other agents' tool outputYYYY-MM-DD-topicorYYYY-MM-DD-HHMMSS-topic— the parser extracts the topic part as the project nameinput_tokens/output_tokens/cache_read_tokens/cache_creation_tokens(vs. Anthropic API'scache_read_input_tokens)Testing
All 4 tests pass.