Skip to content

docs: plan Kimi Code history import - #1

Open
Coldaine wants to merge 13 commits into
mainfrom
feat/kimi-history-import
Open

docs: plan Kimi Code history import#1
Coldaine wants to merge 13 commits into
mainfrom
feat/kimi-history-import

Conversation

@Coldaine

@Coldaine Coldaine commented Aug 24, 2026

Copy link
Copy Markdown

User description

Summary

  • document the observed local Kimi Code session and wire-log layout
  • define a safe, fixture-based historical importer plan with a closed-server compatibility gate
  • require harness-pattern review before authorized private live smoke validation

Validation

  • documentation-only; git diff --check passed

This PR intentionally contains no importer implementation and is the review gate before implementation begins.


CodeAnt-AI Description

Import Kimi Code session history, including child agents

What Changed

  • kcap import now discovers Kimi Code sessions from both current and legacy transcript locations.
  • Root and child-agent wire transcripts are uploaded with matching lifecycle events, vendor information, and per-stream resume points.
  • Re-running an import avoids resending accepted content, retries rejected child content, and repairs incomplete child lifecycle delivery.
  • --kimi selects Kimi history imports without adding Kimi to live setup or hook installation.
  • Private re-runs mark Kimi sessions private when previously missing child content is attached.
  • Added unit and integration coverage for discovery, filtering, resuming, retries, visibility, and both transcript layouts.

Impact

✅ Kimi Code history appears in the dashboard
✅ Child-agent transcripts remain attached to their parent session
✅ Fewer duplicate uploads and recoverable child import failures

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Copilot AI lite review requested due to automatic review settings August 24, 2026 06:22
@codeant-ai

codeant-ai Bot commented Aug 24, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed e5facd3 Aug 27, 2026 · 15:52 15:53
✅ Reviewed your PR 3ac55ad Aug 24, 2026 · 06:22 06:22

@codeant-ai

codeant-ai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@cursor

cursor Bot commented Aug 24, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_8a05266f-f076-4337-af50-e7f944f5444f)

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Aug 24, 2026

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Plan Kimi Code historical import with contract gate and fixture-first testing

📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Document observed Kimi Code session/wire.jsonl layout and event types for discovery/import.
• Define a phased, fixture-based importer plan gated by closed-server vendor/normalizer
 confirmation.
• Require independent harness-pattern review before any authorized live smoke validation.
Diagram

graph TD
  A["Kimi local sessions"] --> B["KimiPaths"] --> C["KimiWireReader"] --> D["KimiImportSource"] --> E["kcap-cli import"] --> F[("Closed server API")]
  subgraph Legend
    direction LR
    _loc["Local files"] ~~~ _mod["CLI module"] ~~~ _api[("Server API")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Start with a generic wire importer (no vendor=kimi)
  • ➕ Avoids blocking on server-side vendor/normalizer readiness
  • ➕ Can validate local discovery/parsing + watermark mechanics end-to-end sooner
  • ➖ Risks creating uploads the server cannot normalize or display usefully
  • ➖ May force later breaking changes when switching to vendor=kimi semantics/identity rules
2. Treat each agent stream as an independent session
  • ➕ Simplifies routing and avoids child-stream lifecycle semantics initially
  • ➖ Loses root/child relationship and can fragment a single Kimi session into multiple sessions
  • ➖ Likely conflicts with server expectations for child watermarks and session identity
3. Implement live capture first via polling/tailing without an official hook surface
  • ➕ Faster to demonstrate near-real-time ingestion without waiting on upstream plugin docs
  • ➖ High risk: brittle, privacy-sensitive, and can degrade Kimi UX; harder to make idempotent
  • ➖ Contradicts the plan’s safety requirement to avoid unsupported background polling

Recommendation: Keep the PR’s proposed gated approach: implement fixture-first historical import in the open-source CLI, but do not expose/claim vendor=kimi support until Phase 0 confirms the server contract (vendor acceptance, normalizer, lifecycle/watermark rules, and child-stream identity). This minimizes the risk of silently uploading unusable transcripts and keeps privacy controls enforceable via synthetic fixtures and constrained diagnostics.

Files changed (1) +327 / -0

Documentation (1) +327 / -0
2026-08-24-kimi-code-import-and-live-capture.mdAdd phased plan for Kimi Code historical import and optional live capture +327/-0

Add phased plan for Kimi Code historical import and optional live capture

• Introduces a detailed implementation plan documenting the observed ~/.kimi-code session/wire.jsonl layout and event taxonomy. Specifies privacy/fixture rules, a server-contract decision gate (vendor/normalizer/watermarks), and phased requirements for discovery, IImportSource implementation, registration, testing, and review-before-live-smoke procedures.

docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ac55ad393

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md Outdated
Comment thread docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md Outdated
Comment thread docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md Outdated
Comment thread docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md Outdated
Comment thread docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md Outdated
Comment thread docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md — previous warning resolved (stale plan doc removed)
Previous Review Summaries (5 snapshots, latest commit bc37d1d)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit bc37d1d)

Status: 1 Warning Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md 300 Plan doc claims "unexecuted" but implementation (KimiImportSource child-stream import, ImportChildrenAsync, registration, and tests) is already present in this PR — the file should be removed per its own Documentation-lifecycle rule and the repo's CHANGES.md/specs convention
Files Reviewed (4 files)
  • src/Capacitor.Cli/Commands/SetupCommand.cs — previous warning resolved ("ten" now correct)
  • src/Capacitor.Cli/Harness/Kimi/KimiImportSource.cs — no new issues
  • src/Capacitor.Cli.Core/Resources/help-import.txt — no new issues
  • docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md — 1 warning

Fix these issues in Kilo Cloud

Previous review (commit 0a4cf79)

Status: 1 Warning Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/Capacitor.Cli/Commands/SetupCommand.cs 783 XML doc comment says "nine supported import sources" but method now returns ten after adding Kimi
Files Reviewed (1 file)
  • src/Capacitor.Cli/Commands/SetupCommand.cs - 1 warning

Fix these issues in Kilo Cloud

Previous review (commit ed3a855)

Status: 2 Warnings Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md 13 Architecture description still misleading — calls Kiro/Pi "routed-source" when they lack child-stream routing and replay-privacy
docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md 114 "de-duplicate it with Pi's seen set" is ambiguous — could be read as sharing state with Pi rather than using the same pattern
Files Reviewed (1 file)
  • docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md - 2 warnings

Fix these issues in Kilo Cloud

Previous review (commit 168ea6f)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md

Review conducted by stepfun/step-3.7-flash:free (medium-reasoning model).

Resolution of Previous Findings

All 3 WARNINGs from the prior review at 3ac55ad are resolved in this increment:

Previous Issue Resolution
Architecture description misleading — Kiro/Pi are not routed importers Replaced with explicit role separation: Kiro/Pi for lifecycle/watermark mechanics, Gemini/Antigravity for child-stream routing and replay-privacy
Phase 0 decision gate contradicts Phase 1 registration Phase 1 §3 now gates registration behind Phase 0: "Register the importer only after Phase 0 passes"
HarnessCatalog conformance refactor left unspecified Added a numbered "Required importer-only selection contract" specifying the split between HarnessCatalog.All (live harnesses) and the import-only flag set

A new "Documentation lifecycle" section correctly prescribes promotion to docs/superpowers/specs/ and removal of the plan after execution, consistent with CLAUDE.md conventions.

Previous review (commit 3ac55ad)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 3
Issue Details (click to expand)

WARNING

File Line Issue
docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md 12 Architecture description misleading — Kiro/Pi are not routed importers
docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md 93 Phase 0 decision gate contradicts Phase 1 registration
docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md 163 HarnessCatalog conformance refactor left unspecified
Files Reviewed (1 file)
  • docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md - 3 issues

Review conducted by stepfun/step-3.7-flash:free (medium-reasoning model).

Additional Context

The docs/superpowers/plans/ directory contains 50+ plan files dated April–August 2026. Many correspond to features already implemented per docs/CHANGES.md (e.g., AI-613 history import scope, DEV-1579 history import UX, AI-1648 IPC hardening, AI-1655 Plans A/B/C). Per the repo's own conventions in CLAUDE.md: "docs/CHANGES.md carries the reasoning per feature; docs/superpowers/specs/ holds the designs." Executed plans should be removed and their information migrated to CHANGES.md/specs. Several older plans also still reference the old kapacitor project name and src/kapacitor/ paths, which no longer match the current kcap/Capacitor.Cli codebase.

Fix these issues in Kilo Cloud


Reviewed by step-3.7-flash:free · Input: 83.7K · Output: 3.9K · Cached: 266.6K

Comment thread docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md Outdated
Comment thread docs/superpowers/plans/2026-08-24-kimi-code-import-and-live-capture.md Outdated
Comment thread src/Capacitor.Cli/Commands/SetupCommand.cs Outdated
@Coldaine

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc37d1d491

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

ct.ThrowIfCancellationRequested();
if (!Guid.TryParse(candidate.DashedId, out var guid)) continue;
var sessionId = guid.ToString("N");
if (!seen.Add(sessionId) || (sessionFilter is not null && !string.Equals(sessionId, sessionFilter, StringComparison.Ordinal))) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Deduplicate Kimi candidates only after filtering

When the same session UUID exists under both supported roots and the first .kimi-code copy does not match --cwd while the legacy .kimi copy does, this marks the UUID as seen before reading metadata and applying the filter. Since .kimi-code candidates are enumerated first, the matching legacy copy is then skipped, causing the requested session to disappear from the import; mark the UUID only after accepting a candidate, or group duplicate candidates before filtering.

Useful? React with 👍 / 👎.

Comment thread README.md
[![built with](https://img.shields.io/badge/.NET%2010-NativeAOT-512bd4?logo=dotnet&logoColor=white)](#)

**Kurrent Capacitor** (`kcap`) records your coding-agent sessions and forwards them to a Capacitor server, where a real-time dashboard and PR-review tools surface the context no diff can give you: *why* code changed, what alternatives were weighed, and how it was actually built. It works across nine agents — Claude Code, Codex, Cursor, GitHub Copilot, Gemini, Kiro, Pi, OpenCode, and Antigravity — capturing the full picture: session lifecycle, transcripts, subagent trees, tool calls, and token usage.
**Kurrent Capacitor** (`kcap`) records your coding-agent sessions and forwards them to a Capacitor server, where a real-time dashboard and PR-review tools surface the context no diff can give you: *why* code changed, what alternatives were weighed, and how it was actually built. It works across ten agents — Claude Code, Codex, Cursor, GitHub Copilot, Gemini, Kiro, Kimi Code, Pi, OpenCode, and Antigravity — capturing the full picture: session lifecycle, transcripts, subagent trees, tool calls, and token usage.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Qualify Kimi support as historical-only

For Kimi users, this opening claim groups Kimi with the agents that kcap records automatically and says it captures the complete lifecycle in real time, but this change deliberately adds only historical import: Kimi is absent from the harness catalog and plugin/setup paths, and the later Kimi section explicitly says no plugin or hook is installed. This can lead users to expect new Kimi sessions to be recorded after setup, so the headline should distinguish historical-only Kimi support until live capture is implemented.

Useful? React with 👍 / 👎.


## Documentation lifecycle

This is an unexecuted implementation plan and remains in

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[WARNING]: Plan doc is stale — claims "unexecuted" but implementation is already in this PR

Line 300 says "This is an unexecuted implementation plan", yet KimiImportSource.cs now contains the child-stream import implementation (ImportChildrenAsync, AttachesChildContentOnReplay => true, failOnError: true), Program.cs registers KimiImportSource, VendorSelection.cs exposes --kimi, and integration/unit tests verify the behavior. The plan's own "Documentation lifecycle" section prescribes removal once executed; this file should be deleted and its validated architecture/contract moved to docs/superpowers/specs/ with execution evidence recorded in docs/CHANGES.md.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

The plan was written into kurrent-io/kcap-cli's own docs/superpowers/plans/
directory, which is upstream's design-doc folder (referenced by their
CLAUDE.md), not ours. Phase 1 — the historical importer — is implemented and
tested, so the plan has served its purpose here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KbSTrWJs9TnWBjhXwH8rpn
@codeant-ai

codeant-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@cursor

cursor Bot commented Aug 27, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_07914f3d-de4c-4340-bead-af3f3ac1c3ec)

@codeant-ai codeant-ai Bot added size:XL This PR changes 500-999 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels Aug 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5facd35fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (!await PostAsync(ctx.HttpClient, ctx.BaseUrl, "session-start/kimi", start, ct)) return ImportOutcome.Failed;
var startLine = classification.Status switch { ImportCommand.ClassificationStatus.Partial => classification.ResumeFromLine, ImportCommand.ClassificationStatus.AlreadyLoaded => classification.TotalLines, _ => 0 };
int sent;
try { sent = await SessionImporter.SendTranscriptBatches(ctx.HttpClient, ctx.BaseUrl, classification.SessionId, path, null, startLine, vendor: Vendor, failOnError: true); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exclude incomplete JSONL tails from strict batches

When an active Kimi process is partway through appending its final JSON object—or a crashed session leaves a truncated tail—SendTranscriptBatches treats that unterminated nonblank text as a complete line and this strict send makes the server reject the batch during normalization. That prevents even the valid records earlier in the same batch from being imported, and a permanently truncated session can never succeed; validate or defer an incomplete tail while preserving its physical line index.

Useful? React with 👍 / 👎.

@Coldaine

Copy link
Copy Markdown
Author

Reviewed the diff directly (checks are meaningless today — org-wide Actions billing block).

Major diff-vs-claim mismatch — this is the headline finding. The PR title is "docs: plan Kimi Code history import" and the (human-written) User description says explicitly:

This PR intentionally contains no importer implementation and is the review gate before implementation begins.

Validation

  • documentation-only; git diff --check passed

That is not what's in the diff. The actual changeset is +727/-23 and includes a complete, working importer:

  • src/Capacitor.Cli/Harness/Kimi/KimiImportSource.cs — 232 lines implementing IImportSource in full: discovery of both ~/.kimi-code/sessions/**/session_<id>/agents/main/wire.jsonl and legacy ~/.kimi/sessions/<group>/<id>/wire.jsonl layouts, classification against server watermarks, root+child transcript upload, subagent lifecycle posting with strict-repair semantics, retry-without-double-send handling.
  • Wiring into Program.cs, SetupCommand.cs (BuildImportSources), and VendorSelection.cs (new --kimi flag, KnownImportVendorFlags split from KnownHarnessVendorFlags).
  • README.md and help-import.txt updates describing --kimi as a shipped, working flag ("kcap walks all ten the same way").
  • Two new test files (KimiImportSourceImportTests.cs, 243 lines; KimiImportSourceTests.cs, 75 lines) plus edits to six existing test files, covering the full lifecycle including retry-of-rejected-child-batch behavior.

The PR's own auto-generated CodeAnt-AI description (further down the body) correctly describes this as a shipped feature ("kcap import now discovers Kimi Code sessions...", "Added unit and integration coverage for discovery, filtering, resuming, retries, visibility..."), directly contradicting the human-written summary above it. Either the description is stale (written for an earlier, doc-only version of this branch and never updated as implementation was added), or this is the wrong diff for this PR. Either way, the stated "review gate before implementation begins" has already been bypassed — the implementation this PR says it's gating landed in the same PR.

Recommendation: do not merge. Reconcile the title/description with the actual diff first — if the intent is really to ship the Kimi importer now, retitle/rebody the PR accordingly and let it get reviewed as an implementation PR (the code itself looks reasonably careful — path-layout handling for both Kimi Code and legacy Kimi, idempotent resume-from-watermark, child-lifecycle repair without resending accepted content — but that's exactly the kind of change that needs an implementation review, not a docs-only rubber stamp). If the intent was genuinely to land only the plan first, this PR needs to be split.

No CI signal used in this assessment (checks are known-broken org-wide today) — this is a diff-content finding, independent of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files 🕐 10-20 Minutes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants