Skip to content

TUI ignores --agent-file at launch; startup session binds default agent (works in -p print mode) #2767

Description

@mohidmakhdoomi

What version of Kimi Code is running?

0.38.0

Which open platform/subscription were you using?

Kimi Code (kimi.com/code)

Which model were you using?

K3-256k thinking

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 unknown

What issue are you seeing?

Launching the interactive TUI with --agent-file <path> silently ignores the flag: the startup session binds the built-in default agent instead of the agent defined in the file. The same flag works correctly in non-interactive print mode (kimi -p), so the agent file itself parses fine — the defect is specific to the interactive TUI startup path.

Evidence from the session wire log (~/.kimi-code/sessions/<wd>/<session>/agents/main/wire.jsonl):

  • profile.bind records profileName: "agent" (the default) with the stock ~20.9 KB system prompt; the agent file content appears nowhere in the log.
  • --yolo passed on the same command line DOES take effect (a second permission.set_mode: "yolo" event is recorded right after the config default), so this is not a general "TUI drops all launch flags" issue — it is specific to --agent-file.
  • No warning is emitted to the session log or the global diagnostic log (~/.kimi-code/logs/kimi-code.log) — the flag is dropped silently.

Print-mode control test on the same version and file binds correctly, with both syntaxes:

kimi -p "Reply with exactly: ok" --agent-file=test.md   # → profileName: "codev-builder"
kimi --agent-file test.md -p "Reply with exactly: ok"   # → profileName: "codev-builder"

What steps can reproduce the bug?

  1. Create an agent file, e.g. test.md:

    ---
    name: codev-builder
    description: Codev builder role
    ---
    # Custom instructions
    ...
  2. Launch the TUI: kimi --yolo --agent-file test.md

  3. Send any prompt.

  4. Inspect the session wire log:

    grep -o "\"profileName\":\"[^\"]*\"" \
      ~/.kimi-code/sessions/<wd>/<session>/agents/main/wire.jsonl

Reproduced across two separate TUI launches; both startup sessions bound the default agent.

What is the expected behavior?

profile.bind shows profileName: "codev-builder" and the agent file content is inlined into the system prompt, per the docs: "--agent-file registers a single agent file at the highest priority for this launch only and selects it ... in the TUI the flags bind only the startup session."

Additional information

Possibly related reports with the same "interactive TUI fails to apply agent profile configuration; -p print mode works" shape:

Contribution

  • I am willing to submit a PR for this bug fix myself (please wait for maintainer approval in this issue first)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions