Objective
Add a kilocode source adapter for Kilo Code task logs, reusing the same parsing path as Roo Code instead of introducing duplicate logic.
Source shape to support
- directory-backed task source under
.../kilocode.kilo-code/tasks/**/ui_messages.json
- log shape mirrors Roo Code task logs
- sibling
api_conversation_history.json can provide model/agent metadata
- task log payloads can include explicit cost and token counts
Implementation plan
-
Adapter file
- add
src/sources/kilocode/kilocode-source-adapter.ts
- implement
SourceAdapter with id = 'kilocode'
-
Shared parser strategy
- do not copy/paste Roo Code parsing logic
- either reuse a helper owned by the Roo Code source implementation or extract a small shared helper for Roo Code + Kilo Code task-log parsing
- keep one decisive parsing path so future fixes land once
-
Discovery
- discover
ui_messages.json task files deterministically
- keep the source directory-backed via
--source-dir kilocode=...
-
Parsing
- parse
api_req_started task log entries only
- preserve explicit cost and token counts
- resolve
sessionId from the task directory name
- load sibling
api_conversation_history.json when available for model/agent metadata
- if shared helper uses sibling metadata, make sure parse dependencies include that file so cache invalidation remains correct
-
Wiring
- register
kilocode in src/sources/create-default-adapters.ts
- update supported-source count/order/help expectations
-
Tests and docs
- add
tests/sources/kilocode-source-adapter.test.ts
- prove shared-parser behavior with Roo Code rather than parallel implementations drifting over time
- update shared registry/help tests and
README.md
Code paths to touch
src/sources/kilocode/kilocode-source-adapter.ts
- shared parser/helper used by Roo Code + Kilo Code
src/sources/create-default-adapters.ts
src/utils/discover-files.ts
src/domain/usage-event.ts
tests/sources/kilocode-source-adapter.test.ts
tests/sources/roocode-source-adapter.test.ts or shared-helper coverage
tests/sources/create-default-adapters.test.ts
tests/cli/create-cli.test.ts
README.md
Verification
- parser fixtures cover:
- valid Kilo task logs
- reuse of the shared task-log parser
- sibling metadata extraction
- explicit cost preservation
- malformed/irrelevant entries skipped cleanly
- Roo Code and Kilo Code fixtures both pass through the same parser path
llm-usage daily --source kilocode --source-dir kilocode=<fixture-dir> works
- full validation passes:
pnpm run lint
pnpm run typecheck
pnpm run test
pnpm run format:check
Objective
Add a
kilocodesource adapter for Kilo Code task logs, reusing the same parsing path as Roo Code instead of introducing duplicate logic.Source shape to support
.../kilocode.kilo-code/tasks/**/ui_messages.jsonapi_conversation_history.jsoncan provide model/agent metadataImplementation plan
Adapter file
src/sources/kilocode/kilocode-source-adapter.tsSourceAdapterwithid = 'kilocode'Shared parser strategy
Discovery
ui_messages.jsontask files deterministically--source-dir kilocode=...Parsing
api_req_startedtask log entries onlysessionIdfrom the task directory nameapi_conversation_history.jsonwhen available for model/agent metadataWiring
kilocodeinsrc/sources/create-default-adapters.tsTests and docs
tests/sources/kilocode-source-adapter.test.tsREADME.mdCode paths to touch
src/sources/kilocode/kilocode-source-adapter.tssrc/sources/create-default-adapters.tssrc/utils/discover-files.tssrc/domain/usage-event.tstests/sources/kilocode-source-adapter.test.tstests/sources/roocode-source-adapter.test.tsor shared-helper coveragetests/sources/create-default-adapters.test.tstests/cli/create-cli.test.tsREADME.mdVerification
llm-usage daily --source kilocode --source-dir kilocode=<fixture-dir>workspnpm run lintpnpm run typecheckpnpm run testpnpm run format:check