Skip to content

feat(kiro): add Kiro CLI session discovery and parsing#476

Open
inola-ww wants to merge 1 commit into
getagentseal:mainfrom
inola-ww:feat/kiro-cli-sessions
Open

feat(kiro): add Kiro CLI session discovery and parsing#476
inola-ww wants to merge 1 commit into
getagentseal:mainfrom
inola-ww:feat/kiro-cli-sessions

Conversation

@inola-ww

Copy link
Copy Markdown

Summary

The Kiro provider currently only detects sessions from the Kiro IDE (VS Code-based) stored in globalStorage/kiro.kiroagent. This adds support for Kiro CLI (kiro-cli chat) sessions stored in ~/.kiro/sessions/cli/.

Problem

Users running kiro-cli chat have their sessions stored in a different location (~/.kiro/sessions/cli/*.jsonl) with a different format than the IDE. Codeburn currently cannot detect these sessions.

Changes

  • CLI session discovery: scans ~/.kiro/sessions/cli/ for .jsonl files, reads project name from companion .json metadata
  • CLI JSONL parser: extracts per-turn data (user messages, assistant output, tool usage) from the Prompt/AssistantMessage/ToolResults entry format
  • Cost from metering: uses metering_usage credits from the session metadata (actual cost, not estimated)
  • CLI tool name mappings: adds read, write, shell, grep, glob to toolNameMap
  • KIRO_HOME env var: respects the override for users who relocated their .kiro directory
  • Testability: third optional param cliSessionsDirOverride on createKiroProvider (defaults to non-scanning when IDE dir is overridden, so existing tests are unaffected)

CLI session format

~/.kiro/sessions/cli/
├── <session-uuid>.jsonl    # conversation transcript (NDJSON: Prompt, AssistantMessage, ToolResults, Clear)
├── <session-uuid>.json     # session metadata (session_id, cwd, model_info, user_turn_metadatas with metering)
├── <session-uuid>.history  # input history
└── <session-uuid>.lock     # session lock

Testing

  • All 32 existing Kiro tests pass unchanged
  • 4 new unit tests covering CLI discovery and parsing
  • Verified against real Kiro CLI sessions on Linux
  • Cross-platform safe: Kiro CLI uses $HOME/.kiro/ on all platforms (confirmed from binary), and path.join(homedir(), '.kiro', ...) resolves correctly everywhere

The Kiro provider previously only detected sessions from the Kiro IDE
(VS Code-based) stored in globalStorage. This adds support for Kiro CLI
(`kiro-cli chat`) sessions stored in ~/.kiro/sessions/cli/.

CLI sessions use a different format:
- .jsonl files with Prompt/AssistantMessage/ToolResults entries
- Companion .json files with session metadata, model info, and
  per-turn metering usage (credits)

Changes:
- Add CLI session discovery (scans ~/.kiro/sessions/cli/ for .jsonl)
- Add CLI JSONL parser that extracts turns, tools, and cost from
  metering_usage credits
- Add CLI tool name mappings (read, write, shell, grep, glob)
- Make CLI sessions dir configurable via third param to
  createKiroProvider for testability
- Add unit tests for CLI session discovery and parsing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant