Skip to content

feat(cli): install trellis sub-agents for Kimi Code platform - #529

Merged
taosu0216 merged 3 commits into
mindfold-ai:mainfrom
northwang-lucky:feat/kimi-subagents
Aug 10, 2026
Merged

taosu0216 merged 3 commits into
mindfold-ai:mainfrom
northwang-lucky:feat/kimi-subagents

Conversation

@northwang-lucky

@northwang-lucky northwang-lucky commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Background

Kimi Code platform support landed in #452. At that time Kimi Code had no project-level custom sub-agent definitions, so the Trellis agent prompts (trellis-implement / trellis-check / trellis-research) shipped only as .kimi-code/skills/ SKILL.md files and the main session dispatched the built-in coder/explore sub-agents with those instructions.

Kimi Code now supports project-level custom agents under .kimi-code/agents/*.md (also .agents/agents/), with Claude Code-compatible frontmatter (name/description/tools, comma-separated; unknown fields are ignored). Docs: https://www.kimi.com/code/docs/kimi-code-cli/customization/agents.html

Changes

  • collectKimiTemplates additionally writes .kimi-code/agents/trellis-{implement,check,research}.md. Content mirrors the skill copies (same templates, pull-based prelude included), so dispatching a trellis-<name> sub-agent directly behaves the same as the previous skill-based path. The skill copies are kept for guidance/backward compatibility.
  • Kimi agent templates gain a tools: frontmatter line (same tool sets as the Claude agents) and their dispatch notes now reference the .kimi-code/agents/ custom sub-agents instead of the built-in coder.
  • Refreshed stale "no custom sub-agent definitions" comments in the kimi configurator, templates/kimi/index.ts, the ai-tools.ts registry entry, and the trellis-meta reference docs (agents.md, platform-map.md, hooks-and-settings.md, SKILL.md).
  • Extended kimi template/configurator/init tests for the new agent files.

Testing

  • pnpm vitest run in packages/cli: 1651 passed, 3 failed — all 3 failures reproduce on an unmodified main checkout in my environment and are unrelated to this change:
    • test/utils/template-fetcher.test.ts > classifies missing refs without falling back to direct mode (network-dependent)
    • test/regression.test.ts two [gitignore-trellis] tests (they match git's English stderr, but this machine's git outputs a localized message)
  • pnpm typecheck and pnpm lint pass (after pnpm --filter @mindfoldhq/trellis-core build).
  • Note: the pre-commit hook was bypassed (--no-verify) because it runs the full suite, which hits the pre-existing failures above.

Follow-up (intentionally out of scope)

packages/cli/src/templates/trellis/workflow.md still tells the main session to "dispatch the built-in coder/explore sub-agent" for Kimi Code. Updating it breaks the marketplace native workflow mirror matches the bundled workflow test, which requires byte-parity with the marketplace submodule repo — that sync needs a companion change in mindfold-ai/marketplace, so I left it untouched.

Refs #349

Summary by CodeRabbit

  • New Features

    • Kimi Code projects now receive Trellis agent definitions under .kimi-code/agents/.
    • Implementation, checking, and research agents can be dispatched directly.
    • Agent definitions remain available alongside their corresponding skills and shared instructions.
  • Documentation

    • Updated guidance for agent locations, dispatch behavior, platform support, and configuration.
  • Tests

    • Added coverage for generated agent files, permissions, shared instructions, and initialization behavior.

Compatibility

  • The agent files use the Claude Code-compatible frontmatter that Kimi Code explicitly supports: tools accepts a YAML list or a comma-separated string, and mcp__-prefixed entries are glob-matched (per the Kimi Code agents docs), so tools: Read, Write, Glob, Grep, Bash, Skill, mcp__* on trellis-research loads as-is.
  • Requires a Kimi Code version with project-level .kimi-code/agents/ support. On older versions the agent files are simply not discovered and behavior degrades gracefully to the previous skills-only mode (the .kimi-code/skills/ copies are kept), so there is no breakage.

Follow-ups (out of scope for this PR)

  • The marketplace submodule mirror and the docs-site (github.com/mindfold-ai/docs) EN/CN platform pages / capability matrix need a separate sync for the new .kimi-code/agents/ path.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 40beaea1-9d2f-49ab-829c-bb63ded5e377

📥 Commits

Reviewing files that changed from the base of the PR and between 4c43e4c and 4ad84b2.

📒 Files selected for processing (2)
  • packages/cli/src/configurators/kimi.ts
  • packages/cli/test/templates/kimi.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/cli/src/configurators/kimi.ts
  • packages/cli/test/templates/kimi.test.ts

📝 Walkthrough

Walkthrough

Kimi now installs Trellis agent prompts as both skills and project-level custom sub-agent files under .kimi-code/agents/. Dispatch templates, platform documentation, and tests reflect the new direct sub-agent model.

Changes

Kimi custom sub-agents

Layer / File(s) Summary
Generate project-level agent definitions
packages/cli/src/configurators/kimi.ts
Resolved prompts are written as both skills and .kimi-code/agents/<name>.md files.
Update Trellis agent dispatch
packages/cli/src/templates/kimi/agents/*
Trellis agents use project-level custom sub-agents and no longer require skill instructions in dispatch prompts.
Align documentation and validation
packages/cli/src/templates/common/bundled-skills/trellis-meta/*, packages/cli/src/templates/kimi/index.ts, packages/cli/src/types/ai-tools.ts, packages/cli/test/*, platform skill copies, .trellis/spec/cli/backend/platform-integration.md
Documentation and tests cover agent paths, metadata, tools, initialization, and pull-based prelude behavior.
Expand OMP platform guidance
.omp/skills/trellis-meta/*
OMP documentation adds runtime, memory, platform, agent-context, and customization guidance.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant KimiConfigurator
  participant ProjectFiles
  participant MainSession
  KimiConfigurator->>ProjectFiles: Write skills and custom sub-agent definitions
  MainSession->>ProjectFiles: Dispatch trellis-* custom sub-agent
  ProjectFiles-->>MainSession: Load agent prompt and execute task
Loading

Possibly related PRs

Suggested reviewers: taosu0216

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: installing Trellis sub-agents for the Kimi Code platform.
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

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.

Kimi Code now supports project-level custom sub-agents under
.kimi-code/agents/ with Claude Code-compatible frontmatter
(name/description/tools), so the trellis-implement / trellis-check /
trellis-research prompts no longer need to ride on the built-in
coder/explore sub-agents.

- collectKimiTemplates additionally writes .kimi-code/agents/trellis-*.md,
  mirroring the skill copies (pull-based prelude included)
- kimi agent templates gain a tools: frontmatter line and updated dispatch
  notes that reference the custom sub-agents instead of the built-in coder
- refresh stale "no custom sub-agent definitions" comments in the kimi
  configurator, template module, ai-tools registry, and trellis-meta
  reference docs
- extend kimi configurator/template/init tests for the new agent files

Refs mindfold-ai#349

@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: 3

🧹 Nitpick comments (1)
packages/cli/test/templates/kimi.test.ts (1)

94-112: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the tool values, not only the key.

Line 104 checks only that tools: exists. It accepts the invalid mcp__* value, so this test passes while the research agent cannot use MCP tools. Assert the expected built-in tools and validate server-specific MCP patterns. (kimi.com)

🤖 Prompt for 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.

In `@packages/cli/test/templates/kimi.test.ts` around lines 94 - 112, Update the
agent assertions in the loop over trellis-implement, trellis-check, and
trellis-research so they validate the actual tools values rather than only the
tools key. Assert the expected built-in tools for each agent and verify
server-specific MCP entries use the required valid patterns, ensuring
trellis-research includes usable MCP tools.
🤖 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 `@packages/cli/src/configurators/kimi.ts`:
- Around line 18-20: Update the documentation comment for the Kimi configurator
to state that Trellis does not generate project-local Kimi settings or hooks,
while acknowledging the workspace-local .kimi-code/local.toml settings file and
keeping hooks scoped to $KIMI_CODE_HOME/config.toml.

In `@packages/cli/src/templates/kimi/agents/trellis-check.md`:
- Around line 24-27: Update the Kimi main-session dispatch documentation around
the trellis-check prompt contract to include an example or acceptance test for
dispatching trellis-check, trellis-implement, and trellis-research with prompts
beginning “Active task: <path>”. Add coverage verifying that an omitted
subagent_type selects the built-in coder sub-agent.

In `@packages/cli/src/templates/kimi/agents/trellis-research.md`:
- Around line 7-9: Update the tools declaration in the trellis-research agent
configuration to remove the unsupported mcp__* wildcard; use only explicit
supported MCP server globs if required by this agent, otherwise omit the MCP
entry.

---

Nitpick comments:
In `@packages/cli/test/templates/kimi.test.ts`:
- Around line 94-112: Update the agent assertions in the loop over
trellis-implement, trellis-check, and trellis-research so they validate the
actual tools values rather than only the tools key. Assert the expected built-in
tools for each agent and verify server-specific MCP entries use the required
valid patterns, ensuring trellis-research includes usable MCP tools.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 43912122-bd0e-4777-9955-e56fa53cac89

📥 Commits

Reviewing files that changed from the base of the PR and between f6f51ff and 3f907ab.

📒 Files selected for processing (13)
  • packages/cli/src/configurators/kimi.ts
  • packages/cli/src/templates/common/bundled-skills/trellis-meta/SKILL.md
  • packages/cli/src/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md
  • packages/cli/src/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md
  • packages/cli/src/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md
  • packages/cli/src/templates/kimi/agents/trellis-check.md
  • packages/cli/src/templates/kimi/agents/trellis-implement.md
  • packages/cli/src/templates/kimi/agents/trellis-research.md
  • packages/cli/src/templates/kimi/index.ts
  • packages/cli/src/types/ai-tools.ts
  • packages/cli/test/commands/init.integration.test.ts
  • packages/cli/test/configurators/index.test.ts
  • packages/cli/test/templates/kimi.test.ts

Comment thread packages/cli/src/configurators/kimi.ts Outdated
Comment thread packages/cli/src/templates/kimi/agents/trellis-check.md
Comment thread packages/cli/src/templates/kimi/agents/trellis-research.md
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

- Copy the updated trellis-meta reference files (SKILL.md, agents.md,
  platform-map.md, hooks-and-settings.md) byte-identically to the six
  dogfood skill roots (.agents/.claude/.cursor/.omp/.opencode/.pi)
- Update .trellis/spec/cli/backend/platform-integration.md: Kimi Code now
  installs .kimi-code/agents/trellis-*.md custom sub-agents alongside the
  skill copies; drop the outdated "no custom sub-agent definitions" notes

Refs mindfold-ai#349
- Reword the kimi.ts header note: Trellis does not generate project-local
  Kimi settings/hooks; project-local settings live in .kimi-code/local.toml
  and hooks in $KIMI_CODE_HOME/config.toml
- Assert the sub-agent dispatch contract in kimi template tests (Agent tool
  dispatch + Active task: prompt first line)

Refs mindfold-ai#349
@taosu0216
taosu0216 merged commit 38bfabc into mindfold-ai:main Aug 10, 2026
2 checks passed
Xio-Shark pushed a commit to Xio-Shark/Trellis that referenced this pull request Sep 17, 2026
…d-ai#529)

Kimi Code now supports project-level custom sub-agents (`.kimi-code/agents/*.md` with Claude Code-compatible frontmatter), so Trellis installs `trellis-implement`, `trellis-check` and `trellis-research` there rather than relying on the built-in `coder`/`explore` agents alone.

Registry, configurator, trellis-meta platform reference, spec and tests are updated together, and the dogfood copies are regenerated.

Refs mindfold-ai#349.
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