Skip to content

Tangent mode 让 Kiro CLI 在主对话中临时创建 conversation checkpoint,用来探索旁支问题而不污染主线。本文用中文讲解如何启用 /tangent 或 Ctrl+T、如何用 tail 保留有价值问答、什么时候适合使用,以及常见限制和排障方法。

Kiro CLI Experimental Tangent Mode:不中断主线地探索旁支问题

Tangent mode 适合处理开发过程中随时冒出来的“旁支问题”。你正在和 Kiro 讨论一个主任务,比如重构组件、优化 SQL、写部署脚本,但中途想问一个概念、比较一个替代方案,或者查一下 Kiro CLI 的用法。普通提问会把这些内容加入主上下文,tangent mode 则会先创建 conversation checkpoint,让你临时探索,结束后回到原来的主线。

换句话说,它保护的是“对话上下文的干净程度”。旁支讨论有价值,但不一定应该长期留在主任务里。

启用 tangent mode

通过实验功能菜单启用:

bash
/experiment
# 从列表里选择 tangent mode

也可以用 settings 启用:

bash
kiro-cli settings chat.enableTangentMode true

基础用法

进入 tangent mode

输入 /tangent,或按 Ctrl+T:

text
> /tangent
Created a conversation checkpoint (↯). Use ctrl + t or /tangent to restore the conversation later.

Kiro 会在当前位置创建一个 conversation checkpoint。

在 tangent mode 中提问

进入后,你会在 prompt 中看到黄色 标记:

text
↯ > What is the difference between async and sync functions?

这个标记提醒你:当前讨论属于旁支,不会默认留在主线中。

退出 tangent mode

再次输入 /tangent,或按 Ctrl+T:

text
↯ > /tangent
Restored conversation from checkpoint (↯). - Returned to main conversation.

退出后,主对话会恢复到进入 tangent mode 前的 checkpoint。

/tangent tail 保留最后一组问答

如果旁支讨论的最后一个问题和回答对主线有价值,可以用:

bash
/tangent tail

它会回到 checkpoint,同时把最后一组 question + answer 带回主上下文。

text
↯ > /tangent tail
Restored conversation from checkpoint (↯) with last conversation entry preserved.

使用示例

示例 1:探索替代方案

text
> I need to process a large CSV file in Python. What's the best approach?

I recommend using pandas for CSV processing...

> /tangent
Created a conversation checkpoint (↯).

↯ > What about using the csv module instead of pandas?

The csv module is lighter weight...

↯ > /tangent
Restored conversation from checkpoint (↯).

> Thanks! I'll go with pandas. Can you show me error handling?

这里的 csv module 讨论只是辅助判断,不一定需要留在主线里。

示例 2:临时查询 Kiro CLI 帮助

text
> Help me write a deployment script

I can help you create a deployment script...

> /tangent
Created a conversation checkpoint (↯).

↯ > What Kiro CLI commands are available for file operations?

Kiro CLI provides read, write, shell...

↯ > /tangent
Restored conversation from checkpoint (↯).

> It's a Node.js application for AWS

这种“工具帮助类”问题很适合 tangent mode,因为它对主任务有帮助,但不一定应该长期占用主上下文。

示例 3:澄清需求

text
> I need to optimize this SQL query

Could you share the query you'd like to optimize?

> /tangent
Created a conversation checkpoint (↯).

↯ > What information do you need to help optimize a query?

To optimize SQL queries effectively, I need:
1. The current query
2. Table schemas and indexes...

↯ > /tangent
Restored conversation from checkpoint (↯).

> Here's my query: SELECT * FROM orders...

你可以先搞清楚 Kiro 需要什么信息,再回到主线补充材料。

示例 4:保留有价值信息

text
> Help me debug this Python error

I can help you debug that. Could you share the error message?

> /tangent
Created a conversation checkpoint (↯).

↯ > What are the most common Python debugging techniques?

Here are the most effective Python debugging techniques:
1. Use print statements strategically
2. Leverage the Python debugger (pdb)...

↯ > /tangent tail
Restored conversation from checkpoint (↯) with last conversation entry preserved.

> Here's my error: TypeError: unsupported operand type(s)...

因为调试技巧对后续主线有帮助,所以用 tail 保留下来。

配置项

修改快捷键

默认快捷键是 Ctrl+T。如果想修改触发键:

bash
kiro-cli settings chat.tangentModeKey y

之后就会使用新的按键组合。

Introspect 自动进入 tangent mode

如果你希望 Kiro CLI help 问题自动进入 tangent mode,可以启用:

bash
kiro-cli settings introspect.tangentMode true

这样查询 CLI 功能时更不容易污染主任务上下文。

视觉提示

  • 普通模式:>
  • Tangent mode:↯ >
  • 带 agent 时:[dev] ↯ >

看到 就说明你正在旁支里。结束前要决定:直接丢弃旁支,还是用 /tangent tail 保留最后一组问答。

什么时候适合使用?

适合:

  • 针对当前主题问一个澄清问题。
  • 在做决策前探索替代方案。
  • 临时查询 Kiro CLI 命令或功能。
  • 测试自己对某个概念的理解。
  • 问一个不需要留在主上下文里的短问题。

不适合:

  • 完全无关的话题:直接开新会话更清晰。
  • 很长、很复杂的讨论:用正常对话更自然。
  • 你确定旁支信息必须成为主上下文:那就不要用 tangent mode,或退出时用 tail

工作机制

创建 checkpoint

进入 tangent mode 时:

  1. 当前 conversation state 被保存为 checkpoint。
  2. 后续提问进入 tangent conversation。
  3. 旁支内容与主线程分离。

恢复主线

退出 tangent mode 时:

  1. 对话回到 checkpoint 状态。
  2. 旁支讨论被丢弃。
  3. 主线继续,就像旁支没有发生过。

Tail mode

使用 /tangent tail 时:

  1. 同样先回到 checkpoint。
  2. 保留 tangent conversation 的最后一组问答。
  3. 把这组问答加入主上下文。
  4. 适合保留对后续决策有帮助的信息。

限制

  • 退出后旁支内容会被丢弃,除非使用 tail
  • 只支持一层 tangent,不支持嵌套 tangent。
  • 这是 Experimental 功能,后续可能调整或移除。
  • 使用前必须显式启用。

常见排障

Tangent mode 不工作怎么办?

先确认已启用:

bash
/experiment
# 从列表里选择 tangent mode

或使用 settings:

bash
kiro-cli settings chat.enableTangentMode true

Ctrl+T 没反应怎么办?

检查快捷键配置:

bash
kiro-cli settings chat.tangentModeKey t

注意要按 Ctrl+T,而不是单独按 T。终端环境也可能占用某些快捷键,必要时换一个键。

忘了自己在 tangent mode 里怎么办?

看 prompt 是否有 。如果有,输入 /tangent 返回主线;如果最后一组问答有价值,用 /tangent tail

不小心丢掉了重要信息怎么办?

如果退出时没有使用 tail,tangent conversation 通常无法恢复。只能在主对话中重新提问。以后遇到可能有价值的旁支,建议用 /tangent tail 退出。

推荐工作流

  1. 开始主任务:让 Kiro 处理你的主要开发目标。
  2. 触发 tangent:遇到旁支问题时输入 /tangent
  3. 快速探索:只问和当前决策相关的问题。
  4. 判断是否 tail:有价值就 /tangent tail,否则直接 /tangent
  5. 返回主线:继续原任务。

示例:

text
> Help me refactor this React component

> /tangent
↯ > What's the difference between useMemo and useCallback?

↯ > /tangent tail

> Now I understand. Let's use useMemo for the expensive calculation...

相关功能

常见问题

Tangent mode 和 checkpointing 有什么区别?

Tangent mode 管的是对话上下文,帮助你临时探索旁支问题;checkpointing 管的是文件改动,帮助你比较和恢复工作区状态。

/tangent tail 会保留全部旁支讨论吗?

不会。它只保留最后一组 question + answer。如果整个旁支都很重要,应该在主对话中继续讨论,而不是依赖 tangent mode。

我应该什么时候直接开新会话?

当问题和当前主任务关系很弱,或者预计会展开成长讨论时,开新会话比 tangent mode 更合适。