[GH-ISSUE #1791] [Feature] Support Kimi Code in rea setup client integrations #602

Closed
opened 2026-10-15 18:26:32 +00:00 by bsakaguchi · 2 comments
Owner

Originally created by @yadnuses on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/1791

Current limitation

Kimi Code (kimi-cli / Kimi Code CLI, Moonshot's coding agent) has no REA client, so rea setup cannot register the MCP server for it. Users wire the stdio server into ~/.kimi-code/mcp.json by hand — the exact manual path the #1484 reproduction describes ("this is what the agent itself writes today, since kimi-cli is not a supported setup client"). Manual registration leaves setup detection, doctor, and uninstall blind to the entry, and rea update's maintenance plan never re-pins it.

A naive registration also reproduces the #1484 failure mode on current releases. Fresh measurements of tools/list from rea-agents@6.4.0 (2026-10-11, stdio, initialize + tools/list, compact UTF-8 byte counts of each inputSchema):

Measurement Value
Tools advertised 170
inputSchema over ~14 KB, full profile 5
Largest (compare_web_captures) 61,876 bytes
Also over the cap evaluate_reconstruction_coverage 21,240 · build_reconstruction_obligation_ledger 17,971 · compare_source_to_bundle 14,479 · capture_browser_scenario 14,425
inputSchema over ~14 KB with REA_MCP_INPUT_SCHEMA_PROFILE=compact 0
Largest under compact (compare_process_captures) 12,090 bytes

Because Moonshot rejects an entire request when any single advertised schema exceeds its per-schema cap, a registration that omits the compact presentation makes Kimi Code unusable while REA is connected — even for unrelated prompts (#1484).

Use cases

  • A Kimi Code user runs npx rea-agents setup and gets a Kimi Code checkbox, the way the OMP request in #1257 was resolved by #1301 and the Qwen Code request in #1409.
  • After setup, the agent loads both the MCP server and the reverse-engineer-anything workflow with no manual file edits, and no #1484-style 400 cascade on the first prompt.
  • rea doctor --client kimi_code and rea update keep the registration healthy and version-pinned the same way as the other 17 clients.

Desired outcome and success criteria

  • rea setup --client kimi_code and the interactive multi-select register a pinned stdio entry at mcpServers.rea in ~/.kimi-code/mcp.json (honoring KIMI_CODE_HOME, which Kimi resolves as a non-empty, unexpanded override of the default home), preserving unrelated entries through the same reviewed plan/backup transaction as the other JSON clients.
  • The written entry includes "env": { "REA_MCP_INPUT_SCHEMA_PROFILE": "compact" } so every advertised schema stays under the Moonshot per-schema cap (measured above). Setup already retains this key in existing server entries, so refreshes keep the protection.
  • Detection uses the ~/.kimi-code marker directory.
  • The bundled skill installs to the shared ~/.agents/skills, which Kimi Code already scans for personal skills — no client-specific skill family is needed (simpler than the Qwen Code case in #1409).
  • rea doctor --client kimi_code and rea uninstall --client kimi_code cover the registration like the existing clients.

Authority boundaries and non-goals

  • User-level configuration only: no project-level .kimi-code/mcp.json writes. Kimi Code lets a same-name project entry override the user entry (mirroring the Pi situation documented in docs/installation.md); setup configures user scope only.
  • Same package-runner entry shape as the other clients (npx -y rea-agents@<version> mcp); no third-party code execution.
  • No change to canonical tool contracts: REA_MCP_INPUT_SCHEMA_PROFILE is presentation-only advertising; full canonical inputs remain validated server-side.
  • Clients that cannot use the compact presentation and still trip the cap on the remaining structural outliers are out of scope here; that thread stays in #919 / #723 / #1329.

Alternatives considered

  • The documented manual MCP registration JSON works (it is what Kimi Code users run today, per #1484's reproduction), but detection, doctor, and uninstall stay blind to it and updates never re-pin it.
  • Registering without the compact env reproduces #1484 on 6.4.0 with the measurements above.
  • Client-side tool blocklists for the oversized schemas would work around the cap by dropping capabilities (compare_web_captures and the reconstruction tools) that serve fine under compact advertising; unnecessary loss.

Possible direction

Following the #1301 / #1409 pattern:

  • SupportedClients.ts — add a kimi_code definition with configPath .kimi-code/mcp.json, markerPath .kimi-code, format: "json". The default JSON dialect writes the mcpServers.<name> → {command, args} entry Kimi Code loads.
  • Registration defaults — seed REA_MCP_INPUT_SCHEMA_PROFILE=compact into the written entry's env map for this client, reusing the existing environment-retention machinery (explicit user values should keep precedence over the seed).
  • Skill destination — shared ~/.agents/skills default already matches Kimi Code's personal-skill discovery.
  • Boundary tests for path resolution and KIMI_CODE_HOME handling plus the register → read → uninstall round trip, a tests/fixtures/clientEnvironment.ts entry, and a docs/installation.md table row with a short Kimi Code note (restart required for MCP changes; Moonshot per-schema cap), per the CONTRIBUTING checks.

References

Originally created by @yadnuses on GitHub (Oct 11, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1791 ## Current limitation Kimi Code (kimi-cli / Kimi Code CLI, Moonshot's coding agent) has no REA client, so `rea setup` cannot register the MCP server for it. Users wire the stdio server into `~/.kimi-code/mcp.json` by hand — the exact manual path the #1484 reproduction describes ("this is what the agent itself writes today, since kimi-cli is not a supported setup client"). Manual registration leaves `setup` detection, `doctor`, and `uninstall` blind to the entry, and `rea update`'s maintenance plan never re-pins it. A naive registration also reproduces the #1484 failure mode on current releases. Fresh measurements of `tools/list` from `rea-agents@6.4.0` (2026-10-11, stdio, initialize + tools/list, compact UTF-8 byte counts of each `inputSchema`): | Measurement | Value | | --- | ---: | | Tools advertised | 170 | | `inputSchema` over ~14 KB, full profile | 5 | | Largest (`compare_web_captures`) | 61,876 bytes | | Also over the cap | `evaluate_reconstruction_coverage` 21,240 · `build_reconstruction_obligation_ledger` 17,971 · `compare_source_to_bundle` 14,479 · `capture_browser_scenario` 14,425 | | `inputSchema` over ~14 KB with `REA_MCP_INPUT_SCHEMA_PROFILE=compact` | 0 | | Largest under compact (`compare_process_captures`) | 12,090 bytes | Because Moonshot rejects an entire request when any single advertised schema exceeds its per-schema cap, a registration that omits the compact presentation makes Kimi Code unusable while REA is connected — even for unrelated prompts (#1484). ## Use cases - A Kimi Code user runs `npx rea-agents setup` and gets a Kimi Code checkbox, the way the OMP request in #1257 was resolved by #1301 and the Qwen Code request in #1409. - After setup, the agent loads both the MCP server and the `reverse-engineer-anything` workflow with no manual file edits, and no #1484-style 400 cascade on the first prompt. - `rea doctor --client kimi_code` and `rea update` keep the registration healthy and version-pinned the same way as the other 17 clients. ## Desired outcome and success criteria - `rea setup --client kimi_code` and the interactive multi-select register a pinned stdio entry at `mcpServers.rea` in `~/.kimi-code/mcp.json` (honoring `KIMI_CODE_HOME`, which Kimi resolves as a non-empty, unexpanded override of the default home), preserving unrelated entries through the same reviewed plan/backup transaction as the other JSON clients. - The written entry includes `"env": { "REA_MCP_INPUT_SCHEMA_PROFILE": "compact" }` so every advertised schema stays under the Moonshot per-schema cap (measured above). Setup already retains this key in existing server entries, so refreshes keep the protection. - Detection uses the `~/.kimi-code` marker directory. - The bundled skill installs to the shared `~/.agents/skills`, which Kimi Code already scans for personal skills — no client-specific skill family is needed (simpler than the Qwen Code case in #1409). - `rea doctor --client kimi_code` and `rea uninstall --client kimi_code` cover the registration like the existing clients. ## Authority boundaries and non-goals - User-level configuration only: no project-level `.kimi-code/mcp.json` writes. Kimi Code lets a same-name project entry override the user entry (mirroring the Pi situation documented in docs/installation.md); setup configures user scope only. - Same package-runner entry shape as the other clients (`npx -y rea-agents@<version> mcp`); no third-party code execution. - No change to canonical tool contracts: `REA_MCP_INPUT_SCHEMA_PROFILE` is presentation-only advertising; full canonical inputs remain validated server-side. - Clients that cannot use the compact presentation and still trip the cap on the remaining structural outliers are out of scope here; that thread stays in #919 / #723 / #1329. ## Alternatives considered - The documented manual MCP registration JSON works (it is what Kimi Code users run today, per #1484's reproduction), but detection, doctor, and uninstall stay blind to it and updates never re-pin it. - Registering without the compact env reproduces #1484 on 6.4.0 with the measurements above. - Client-side tool blocklists for the oversized schemas would work around the cap by dropping capabilities (`compare_web_captures` and the reconstruction tools) that serve fine under compact advertising; unnecessary loss. ## Possible direction Following the #1301 / #1409 pattern: - `SupportedClients.ts` — add a `kimi_code` definition with `configPath` `.kimi-code/mcp.json`, `markerPath` `.kimi-code`, `format: "json"`. The default JSON dialect writes the `mcpServers.<name>` → `{command, args}` entry Kimi Code loads. - Registration defaults — seed `REA_MCP_INPUT_SCHEMA_PROFILE=compact` into the written entry's `env` map for this client, reusing the existing environment-retention machinery (explicit user values should keep precedence over the seed). - Skill destination — shared `~/.agents/skills` default already matches Kimi Code's personal-skill discovery. - Boundary tests for path resolution and `KIMI_CODE_HOME` handling plus the register → read → uninstall round trip, a `tests/fixtures/clientEnvironment.ts` entry, and a `docs/installation.md` table row with a short Kimi Code note (restart required for MCP changes; Moonshot per-schema cap), per the CONTRIBUTING checks. ## References - Kimi Code MCP configuration (`mcp.json` user/project levels, `env` field): https://www.kimi.com/code/docs/en/kimi-code-cli/customization/mcp.html - #1484 — Moonshot per-schema size cap makes kimi-cli unusable while REA is connected (closed; measurements above extend it to 6.4.0) - Client-request precedent: #1257 resolved by #1301 (OMP), #1409 (Qwen Code)
Author
Owner

@matbrgz commented on GitHub (Oct 12, 2026):

Client Integration & Schema Budget Review

Adding Kimi Code support to rea setup requires managing Kimi's tool input schema byte cap:

  • Config Path: Registration in ~/.kimi-code/mcp.json should follow REA's standard additive, idempotent setup rules.
  • Budget Filtering / Profiles: Because Kimi CLI enforces an input schema size budget (~14 KB), registering REA with the full unpruned 170-tool catalog can exceed the client's token/schema limits. The client registration should default to an agent-tailored profile or compact schema mode to prevent client startup crashes.
<!-- gh-comment-id:6134564691 --> @matbrgz commented on GitHub (Oct 12, 2026): ### Client Integration & Schema Budget Review Adding Kimi Code support to `rea setup` requires managing Kimi's tool input schema byte cap: - **Config Path:** Registration in `~/.kimi-code/mcp.json` should follow REA's standard additive, idempotent setup rules. - **Budget Filtering / Profiles:** Because Kimi CLI enforces an input schema size budget (~14 KB), registering REA with the full unpruned 170-tool catalog can exceed the client's token/schema limits. The client registration should default to an agent-tailored profile or compact schema mode to prevent client startup crashes.
Author
Owner

@morluto commented on GitHub (Oct 15, 2026):

Implemented by merged #2744: github.com/morluto/rea@efc491ab4. Kimi Code is a supported setup/doctor client, with registration, skill discovery, and compact input-schema defaults; explicit stored/caller profile choices are preserved. Current main includes the subsequent setup/deadline corrections and passed full qualification: https://github.com/morluto/rea/actions/runs/38690953281. Closing the delivered setup-support request; unrelated client/gateway limits remain tracked separately.

<!-- gh-comment-id:6186031012 --> @morluto commented on GitHub (Oct 15, 2026): Implemented by merged #2744: https://github.com/morluto/rea/commit/efc491ab4. Kimi Code is a supported setup/doctor client, with registration, skill discovery, and compact input-schema defaults; explicit stored/caller profile choices are preserved. Current main includes the subsequent setup/deadline corrections and passed full qualification: https://github.com/morluto/rea/actions/runs/38690953281. Closing the delivered setup-support request; unrelated client/gateway limits remain tracked separately.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#602
No description provided.