Conversation
| const pathHash = Buffer.from(wd.path).toString('base64').replace(/[^a-zA-Z0-9]/g, '').toLowerCase().slice(0, 32); | ||
| return pathHash === workDirHash || sessionDir.includes(workDirHash); | ||
| }); |
There was a problem hiding this comment.
This isn't a hash — it's base64 encoding with character filtering. No way this matches Kimi's actual hashing logic. The fallback sessionDir.includes(workDirHash) is worse — substring matching will cause false matches.
Either reverse-engineer the real hash or just use file mtime and skip the config lookup entirely.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/parsers/kimi.ts
Line: 273-275
Comment:
This isn't a hash — it's base64 encoding with character filtering. No way this matches Kimi's actual hashing logic. The fallback `sessionDir.includes(workDirHash)` is worse — substring matching will cause false matches.
Either reverse-engineer the real hash or just use file mtime and skip the config lookup entirely.
How can I resolve this? If you propose a fix, please make it concise.| } | ||
|
|
||
| if (reasoning.length > 0) notes.reasoning = reasoning; | ||
| if (totalTokens > 0) notes.tokenUsage = { input: Math.floor(totalTokens * 0.7), output: Math.floor(totalTokens * 0.3) }; |
There was a problem hiding this comment.
Arbitrary 70/30 split with zero justification. This is fake data.
If you don't have real input/output token counts, don't make them up. Either drop tokenUsage entirely or pass through the raw token_count as-is.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/parsers/kimi.ts
Line: 237
Comment:
Arbitrary 70/30 split with zero justification. This is fake data.
If you don't have real input/output token counts, don't make them up. Either drop tokenUsage entirely or pass through the raw `token_count` as-is.
How can I resolve this? If you propose a fix, please make it concise.| lines: messages.length, | ||
| bytes: fs.statSync(path.join(sessionDir, 'context.jsonl')).size, | ||
| createdAt: stats.birthtime, | ||
| updatedAt: new Date((metadata.wire_mtime || Date.now() / 1000) * 1000), |
There was a problem hiding this comment.
Date.now() / 1000 as fallback means you're timestamping historical sessions as "right now". Wrong.
Use stats.mtime if wire_mtime is missing.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/parsers/kimi.ts
Line: 290
Comment:
`Date.now() / 1000` as fallback means you're timestamping historical sessions as "right now". Wrong.
Use `stats.mtime` if `wire_mtime` is missing.
How can I resolve this? If you propose a fix, please make it concise.| thought.includes('remaining') | ||
| ) { | ||
| const taskText = String(block.think).trim(); | ||
| if (taskText.length > 0 && !pendingTasks.includes(taskText)) { |
There was a problem hiding this comment.
O(n) lookup on every insertion. Use a Set.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/parsers/kimi.ts
Line: 348
Comment:
O(n) lookup on every insertion. Use a Set.
How can I resolve this? If you propose a fix, please make it concise.| function extractKimiContent(content: string | Array<{ text?: string; type?: string }>): string { | ||
| return extractTextFromBlocks(content as string | Array<{ type: string; text?: string }>); | ||
| } |
There was a problem hiding this comment.
Wrapper function that adds nothing. Just call extractTextFromBlocks directly at the call sites.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/parsers/kimi.ts
Line: 82-84
Comment:
Wrapper function that adds nothing. Just call `extractTextFromBlocks` directly at the call sites.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.Add support for Kimi CLI (kimi code) to the continues tool.
Changes:
- Add 'kimi' to TOOL_NAMES in src/types/tool-names.ts
- Add Kimi message schemas in src/types/schemas.ts
- Create src/parsers/kimi.ts with full parser implementation
- Update src/parsers/index.ts to export Kimi parser
- Update src/parsers/registry.ts to register Kimi adapter
- Update test files to include Kimi
Kimi session storage:
- Sessions stored in ~/.kimi/sessions/{workdir_hash}/{session_id}/
- metadata.json contains session metadata (title, session_id, archived)
- context.jsonl contains conversation history
Features supported:
- Session discovery and listing
- Tool call extraction (bash, read, write, edit, grep, glob, etc.)
- Thinking block extraction for session notes
- Cross-tool handoff generation
- Native resume support (kimi --session <id>)
- Cross-tool resume with --prompt flag
Fixes:
- Use --prompt flag for cross-tool args instead of positional argument
- Append 'What would you like me to do next?' to keep Kimi interactive
Summary
This PR adds support for Kimi CLI to the continues tool, enabling seamless session handoffs between Kimi and other supported CLI tools.
Changes
Kimi Session Format
Kimi stores sessions in the following structure:
context.jsonl format
_checkpointentries: internal checkpointsuserentries: user messages with string contentassistantentries: assistant messages with content blocks (text, think, tool_calls)toolentries: tool results_usageentries: token countsFeatures Supported
continues list)continues resume <id> --print-only)kimi --session <id>)Testing
Example Output
Notes
Review all of them with eye of John Carmack-like simplicity with elegeance approach and apply the one only if required
Greptile Summary
This PR adds Kimi CLI support to the session handoff tool. The integration follows existing patterns (registry, schemas, exports), but the core parser has critical bugs:
The tool extraction logic (lines 112-207) correctly uses shared utilities and follows the established pattern from other parsers. Registry integration is clean.
Confidence Score: 2/5
Important Files Changed
Last reviewed commit: 4c4e7f3
(2/5) Greptile learns from your feedback when you react with thumbs up/down!