Skip to content

feat(quorum): add Kimi Code (kimi) as a native CLI quorum family#373

Merged
jobordu merged 2 commits into
mainfrom
nf/quick-433-kimi-cli-family
Jul 23, 2026
Merged

feat(quorum): add Kimi Code (kimi) as a native CLI quorum family#373
jobordu merged 2 commits into
mainfrom
nf/quick-433-kimi-cli-family

Conversation

@jobordu

@jobordu jobordu commented Jul 23, 2026

Copy link
Copy Markdown

What

Adds Kimi Code as a native quorum CLI family, so a kimi binary on PATH is auto-detected and dispatched like codex/gemini/copilot/opencode/antigravity.

Answers the user's question directly: "does nForma support Kimi Code as a slot?" — Kimi is both a Claude-Code preset (already supported as a Daintree/HTTP model slot) and a dedicated CLI. This PR adds the CLI-family half.

Verified against the real binary

~/.kimi-code/bin/kimi v0.27.0--help shows -p, --prompt <prompt> ("run one prompt non-interactively and print the response"), identical in shape to gemini/antigravity. Live end-to-end probe (the exact argv the quorum builds):

spawn: ~/.kimi-code/bin/kimi ["-p", "Reply with exactly: OK"]
exit code : 0
stdout    : "• OK"
VERDICT   : DISPATCH WORKS ✓

Wiring (mirrors antigravity PR #274; kimi is simpler — family name == binary name)

Registry Change
provider-arg-templates.cjs FAMILY_ARGS_TEMPLATE.kimi = ['-p','{prompt}'] — the dispatch contract
install.js both KNOWN_CLIS PATH-detection lists, NF_KEYWORD_MAP (mcp__kimi-1__), KNOWN_CLI_PREFIXES, install-hint
skill-mcp-lint.cjs VALID_TOOLS.kimimcp__kimi-1__kimi passes; wrong tool (ask) still flagged
nForma.cjs + update-agents.cjs install metadata (self-update via kimi upgrade; unknown installType → "unknown", no crash)
token-dashboard.cjs managed-oauth flat-fee (subscription)
update-scoreboard.cjs kimi already in VALID_MODELS — no change

Scope

Kimi as a quorum slot (a model nForma queries), not as an IDE install-target (a runtime nForma installs its own commands into). Kimi-code's acp/server modes are out of scope.

Tests — mutation-proven red against a committed baseline

RED-PROVEN ✓  kimi args_template
RED-PROVEN ✓  kimi mcp-lint (wrong-tool discriminator)
RED-PROVEN ✓  kimi positive test now non-vacuous

New kimi cases in provider-arg-templates.test.cjs, skill-mcp-lint.test.cjs, update-scoreboard.test.cjs (SC-TC11c). I caught that the initial recognizes the kimi family test was vacuous (a bare deepEqual([]) passes for an unknown slot too — the same anti-pattern CodeRabbit flagged on an earlier PR) and strengthened it to assert kimi is a registered family. 68/68 in the family suites; install-virgin / token-dashboard / nForma blast-radius suites green.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added Kimi as a supported quorum CLI family.
    • Added automatic detection and setup for the kimi command.
    • Added Kimi prompt dispatch and MCP tool support.
    • Added subscription-based cost handling for Kimi.
    • Added Kimi self-update metadata and installation guidance.
  • Bug Fixes

    • Improved validation to detect invalid Kimi MCP tools and stale slots.
  • Tests

    • Added coverage for Kimi dispatch, MCP validation, scoreboard voting, and argument handling.

Kimi Code ships a `kimi` binary (~/.kimi-code/bin/kimi, v0.27.0) with a
headless contract identical to gemini/antigravity: `-p/--prompt <prompt>`
runs one prompt non-interactively and prints the response (verified
against --help). Wires it as a quorum CLI family the same way antigravity
was added (PR #274) — kimi is simpler because its family name == its
binary name (no agy-style exception).

Wiring (mirrors antigravity across the family registries):
- provider-arg-templates.cjs: FAMILY_ARGS_TEMPLATE.kimi = ['-p','{prompt}']
  (the dispatch contract — unified-mcp-server invokes `kimi -p "<prompt>"`).
- install.js: both KNOWN_CLIS PATH-detection lists, NF_KEYWORD_MAP
  (mcp__kimi-1__ prefix), KNOWN_CLI_PREFIXES, and getInstallHint — so a
  `kimi` on PATH is auto-detected and wired as a slot on install.
- skill-mcp-lint.cjs: VALID_TOOLS.kimi = [kimi, identity, health_check,
  deep_health_check, help, ping] — so `mcp__kimi-1__kimi` passes the lint
  gate and the wrong-tool (`ask`) class is still flagged.
- nForma.cjs + update-agents.cjs: install metadata (installType
  'self-update', bin 'kimi', `kimi upgrade`); unknown installType falls
  through to null in the updater (shows 'unknown', no crash — same as
  antigravity's curl-script).
- token-dashboard.cjs: kimi = subscription (managed oauth, flat-fee).
- update-scoreboard.cjs: 'kimi' was already in VALID_MODELS — no change.

Scope: this adds kimi as a quorum SLOT (a model nForma queries), NOT as an
IDE install-target (a runtime nForma installs its own commands into) —
kimi-code's acp/server modes are out of scope for this change.

Tests: kimi cases added to provider-arg-templates.test.cjs (template exists,
-p dispatch, buildSpawnArgs), skill-mcp-lint.test.cjs (family recognized +
wrong-tool flagged), update-scoreboard.test.cjs (SC-TC11c: --model kimi
accepted). 68/68 in the three family suites; install-virgin, token-dashboard,
nForma blast-radius suites green.
Copilot AI review requested due to automatic review settings July 23, 2026 14:49
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jobordu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 52591fab-125c-494d-814b-8fea64d4277e

📥 Commits

Reviewing files that changed from the base of the PR and between 7dca0e9 and dcab5c4.

📒 Files selected for processing (3)
  • bin/nForma.cjs
  • bin/update-agents.cjs
  • bin/update-agents.test.cjs

Walkthrough

Kimi is registered as a native quorum CLI with canonical prompt dispatch, PATH and MCP discovery, tool validation, updater metadata, subscription accounting, changelog documentation, and regression tests.

Changes

Kimi quorum integration

Layer / File(s) Summary
Dispatch contract and validation
bin/provider-arg-templates.cjs, bin/provider-arg-templates.test.cjs, bin/update-scoreboard.test.cjs
Kimi uses -p {prompt} for dispatch, with template and scoreboard regression coverage.
Discovery and MCP slot integration
bin/install.js, bin/skill-mcp-lint.cjs, bin/skill-mcp-lint.test.cjs
Kimi is added to PATH detection, provider slot synchronization, MCP keyword mapping, and allowed-tool validation.
CLI lifecycle and cost metadata
bin/update-agents.cjs, bin/nForma.cjs, bin/token-dashboard.cjs, CHANGELOG.md
Kimi receives self-update metadata, subscription cost classification, and an Unreleased changelog entry.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • nForma-AI/nForma#232: Both changes extend MCP tool-name validation through the shared VALID_TOOLS allowlist.
  • nForma-AI/nForma#275: Both changes modify provider argument-template resolution used by quorum and MCP dispatch.

Suggested reviewers: copilot, glittercowboy

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed It clearly states the main change: adding Kimi Code as a native quorum CLI family.
Description check ✅ Passed It covers the change, rationale, testing, scope, and breaking-changes context, with only the exact template sections/checkboxes omitted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nf/quick-433-kimi-cli-family

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bin/update-agents.cjs`:
- Around line 30-33: Implement the self-update flow before registering Kimi: in
bin/update-agents.cjs around lines 30-33, update current/latest version
detection and runUpdate to support installType self-update using Kimi’s
configured upgrade command; in bin/nForma.cjs around line 2562, dispatch
self-update explicitly to kimi upgrade instead of the generic Copilot fallback.
Add regression tests covering both update flows.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 33bdc838-dded-43ba-95fd-5aa6a62d9299

📥 Commits

Reviewing files that changed from the base of the PR and between d5e7700 and 7dca0e9.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • bin/install.js
  • bin/nForma.cjs
  • bin/provider-arg-templates.cjs
  • bin/provider-arg-templates.test.cjs
  • bin/skill-mcp-lint.cjs
  • bin/skill-mcp-lint.test.cjs
  • bin/token-dashboard.cjs
  • bin/update-agents.cjs
  • bin/update-scoreboard.test.cjs

Comment thread bin/update-agents.cjs
…opilot's command

CodeRabbit (PR #373): the kimi self-update metadata didn't make kimi
updatable, and worse — nForma.cjs's update executor ran
`gh extension upgrade copilot` for EVERY non-npm-global family. That is a
pre-existing bug: antigravity (curl-script) hit the same wrong branch. And
update-agents.cjs's runUpdate had no branch for those types at all, so it
no-op'd and reported an error.

Root cause is duplication: nForma.cjs and update-agents.cjs each carried
their own copy of the routing (P3). Extracted one shared
`resolveUpdateCommand(meta)` in update-agents.cjs and routed both callers
through it:
- npm-global      → npm install -g <pkg>@latest
- gh-extension    → gh extension upgrade copilot
- curl-script /
  self-update /
  any installCommand → run meta.installCommand via shell (may contain a pipe)
- unknown         → null; callers surface "update manually" instead of
                    running a wrong command

So kimi now updates via `kimi upgrade`, antigravity via its curl installer,
and the copilot command is reached ONLY by copilot.

New bin/update-agents.test.cjs (7 cases) pins each family's command and
guards the specific defect (kimi/antigravity must never resolve to copilot;
a piped command must use shell; npm-global without pkg → null, never
`undefined@latest`). nForma.test.cjs 112/112 (stable across 3 runs; the one
transient fail was the known TUI-on-require flake).
Copilot AI review requested due to automatic review settings July 23, 2026 15:09

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@jobordu
jobordu merged commit f2885df into main Jul 23, 2026
22 of 23 checks passed
@jobordu
jobordu deleted the nf/quick-433-kimi-cli-family branch July 23, 2026 15:19
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