Skip to content

feat(parsing): add Kiro source support - #253

Merged
richardopenrefinery merged 1 commit into
rayward-external:mainfrom
ssoonngg123:feat/kiro-source-support
Nov 17, 2026
Merged

richardopenrefinery merged 1 commit into
rayward-external:mainfrom
ssoonngg123:feat/kiro-source-support

Conversation

@ssoonngg123

Copy link
Copy Markdown
Contributor

What this adds

ClawJournal now discovers and parses sessions from Kiro, both the Kiro CLI and the Kiro IDE, as a new kiro source. Kiro sessions show up in scan, list, inbox, export, and the workbench alongside the other agents, grouped by working directory as kiro:<dir>.

Kiro has changed its on-disk format several times, and one install can hold sessions in more than one of them. This reads four stores:

Store Location Written by
Event log ~/.kiro/sessions/[<workspace-hash>/]sess_<id>/messages.jsonl + session.json current Kiro CLI and IDE
CLI database <Kiro CLI data dir>/data.sqlite3, tables conversations_v2 and conversations Kiro CLI 1.x / 2.x
CLI JSONL ~/.kiro/sessions/cli/<id>.jsonl + <id>.json Kiro CLI 2.x
IDE session <IDE storage>/workspace-sessions/<base64url(cwd)>/<id>.json, plus the execution logs it references earlier Kiro IDE

The CLI data dir is ~/Library/Application Support/kiro-cli on macOS and ~/.local/share/kiro-cli on Linux. IDE storage is globalStorage/kiro.kiroagent under the Kiro user-data dir.

Main implementation decisions

  • One kiro source for CLI and IDE. The current event-log store is shared by both, so they cannot be cleanly split into two sources. Where the store does identify the client, the session carries client_origin (cli / desktop) and the workbench labels it "Kiro CLI" or "Kiro IDE"; otherwise plain "Kiro". This mirrors how Claude Code and Claude Desktop share the claude source.
  • Projects are keyed by working directory, as for Codex and OpenCode.
  • A conversation is read once. The same session ID can exist in more than one store, so stores are scanned newest format first and an ID already seen is skipped. Within the CLI database, the most recently updated row wins when a conversation is stored under several directories.
  • One assistant message per model response. Kiro stores text, reasoning, tool calls and tool results as separate records. A small _KiroTranscript accumulator, shared by all four formats, folds them into the existing message shape and attaches each tool result to the call it answers.
  • IDE edits are stored as a diff. An IDE edit action records the whole file before and after; the parser keeps the path plus a unified diff so a trace does not carry two full copies of every edited file.
  • Nested tool-input paths are anonymized. _parse_tool_input leaves nested containers alone, and Kiro's fs_read puts paths inside a list of operations, so Kiro tool inputs get a recursive pass.
  • Timestamps are normalized to ISO-8601 UTC. The stores mix ISO strings with local offsets, epoch seconds, epoch milliseconds, and milliseconds as a string.

Wiring outside the parser: CLI --source choices and labels, the workbench scanner's source set, the doctor's on-disk client probe, the excluded-project prefix list (without kiro: there, an excluded kiro:proj would be rewritten to claude:kiro:proj), the analytics by-agent breakdown, and the frontend source badges.

How it was checked

  • tests/parsing/test_kiro.py: 33 tests covering discovery, each store, cross-store de-duplication, tool-result pairing, anonymization, malformed input, and timestamp normalization. All fixtures are synthetic.
  • Mutation checks: nine deliberate breaks in the Kiro parser (dropping de-duplication, dropping nested anonymization, ignoring the execution log, and so on) each make at least one test fail.
  • Full Python suite: 5927 passed, 1 skipped on Python 3.12; the parser and config tests also pass on Python 3.10 (unmodified main: 5894 passed, 1 skipped).
  • End to end: built a throwaway home directory containing all four stores, ran clawjournal scan --source kiro (4 sessions indexed), ran it again (no new or updated sessions), and opened the workbench to confirm the list, the Kiro CLI / Kiro IDE / Kiro badges, and the session detail view with thinking and tool calls.
  • Frontend: npm run build (type check and bundle) passes. I could not get a useful local signal from npm test: all 185 frontend tests fail on my machine on unmodified main as well (Node 26 locally, CI uses Node 20), so the frontend unit tests are only verified by CI here.

Known limitations

  • Not verified against a real Kiro install. I did not have Kiro installed, so the formats come from Kiro's session management docs and from two open-source readers, agentsview and codeburn, whose parsers and fixtures agree on the layouts above. A pass against real Kiro data before or shortly after merge would be valuable. The parts with the least corroboration:
    • ToolUseResults / CancelledToolUses turns in the CLI database, and the 1.x conversations table. These follow the conversation schema of the open-source Amazon Q Developer CLI (Kiro CLI's predecessor) as I understand it; the reference fixtures only cover Prompt, Response and ToolUse.
    • The Windows locations (%APPDATA%\kiro-cli, %APPDATA%\Kiro).
    • IDE execution logs: the directory is derived as sha256(workspace)[:32] and only say actions and actions with an input are replayed. If a log cannot be found or read, the parser falls back to the reply text in the session file.
  • Legacy IDE .chat files are not imported. Each one is a per-execution snapshot of the whole conversation, so importing them directly would create many overlapping sessions. Grouping them is follow-up work.
  • Subagent transcripts are not separate sessions. A subagent spawn and its result are recorded as an invoke_subagent tool call on the parent; the subagent's own sub-executions/*.jsonl transcript is not read.
  • No token counts. Kiro records usage in credits, not tokens, so Kiro sessions show 0 tokens and no cost estimate.
  • IDE sessions have no per-message timestamps. The session spans from the listing's creation time to the session file's last write.
  • Scoring and recurring-upload scopes are unchanged. kiro is not added to FAILURE_VALUE_SOURCE_SCOPE, and recurring uploads stay limited to the audited Claude Code and Codex sources. clawjournal score --source kiro works when asked for explicitly.
  • A KIRO_HOME override and the remote dev-server storage path (~/.kiro-server/...) are not handled.
  • CONTRIBUTING asks for an issue first on larger changes; there is none for this.

🤖 Generated with Claude Code

Read Kiro (https://kiro.dev) sessions from the four stores a Kiro CLI or
Kiro IDE install can hold:

- the current event log under ~/.kiro/sessions/<workspace>/sess_<id>/
- the Kiro CLI SQLite database (conversations_v2 and the 1.x
  conversations table)
- Kiro CLI 2.x JSONL transcripts under ~/.kiro/sessions/cli/
- earlier Kiro IDE workspace-sessions files, with the execution logs
  that hold what the agent said and edited in each turn

Sessions are grouped by working directory as `kiro:<dir>`. A conversation
present in more than one store is read once, from the newest format.
Separate text, reasoning, tool-call and tool-result records are folded
into one assistant message per model response, with each tool result
attached to its call.

`kiro` is wired into the CLI source choices, the workbench scanner, the
doctor's on-disk client probe, excluded-project prefixes, and the
workbench labels (Kiro CLI / Kiro IDE / Kiro).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@richardopenrefinery
richardopenrefinery merged commit 341a396 into rayward-external:main Nov 17, 2026
6 checks passed
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.

2 participants