Kiro CLI的context详解

Kiro CLI提供3种类型的context

  • Agent Resources,常用的文件或skills
  • Session Context,临时用的文件或skills
  • Knowledge Bases,比较大(>10MB)的文件或大量的文件

1. 查看当前的context

在Kiro CLI chat中,执行命令**/context show**

1% > /context show

Agent (kiro_default)

(no matches)

  • ~/.kiro/skills/*/SKILL.md

(no matches)

Session (temporary)

<none>

No files in the current directory matched the rules above.

1% >

2. 定义Agent时,通过resources设置context

{

"name": "my-agent",

"description": "My agent",

"resources ": [

"file://README.md",

"file://docs/**/*.md",

"skill://~/.kiro/skills/*/SKILL.md"

]

}

在建立Kiro CLI chat会话时,Agent的resources设置将被加载到会话的context。

3. 设置临时的Session context

在Kiro CLI chat中,执行**/context** add命令添加文件或目录到context

2% > /context add .

Added 1 path(s) to context.

Note: Context modifications via slash command is temporary.

2% >

执行**/context** remove命令从context中删除文件或目录

2% > /context remove .

Removed 1 path(s) from context.

Note: Context modifications via slash command is temporary.

2% >

执行**/context** clear命令从清除所有Session context

2% > /context clear

Cleared context

Note: Context modifications via slash command is temporary.

2% >

4. 设置Knowledge Bases context

Knowledge Bases默认没有开启。

2% > /knowledge show

Knowledge tool is disabled. Enable it with: kiro-cli settings chat.enableKnowledge true

💡 Your knowledge base data is preserved and will be available when re-enabled.

2% >

执行如下命令,开启Knowledge Bases

$ kiro-cli settings chat.enableKnowledge true

$ kiro-cli settings list

chat.enableKnowledge = true (global)

再次打开一个Kiro CLI chat会话,Knowledge Bases已经可用了。

1% > /knowledge show

Agent (kiro_default):

<none>

1% >

1% > /knowledge add -n mypom -p ./pom.xml

Started indexing 'mypom'

Path: ./pom.xml

Operation ID: dfdad1fc

1% > /knowledge show

Agent (kiro_default):

📂 mypom (a79b545c)

./pom.xml

1 items • Best • 04/23 08:43

1% > /knowledge remove mypom

Removed agent knowledge base entry with name 'mypom'

1% > /knowledge show

Agent (kiro_default):

<none>

1% >

相关推荐
用户0595401744617 小时前
Redis缓存回滚踩坑实录:一个配置失误,让我在凌晨3点丢了3000条数据
前端·css
kyriewen18 小时前
别再这样写条件渲染了——你的React组件里藏着这5种定时炸弹
前端·javascript·react.js
IT_陈寒19 小时前
Redis缓存击穿把我坑惨了,原来这样设过期时间才靠谱
前端·人工智能·后端
用户9385156350719 小时前
从"坐电梯"到"前端路由"——深入理解 Hash 路由原理
前端·typescript·全栈
梦想CAD控件19 小时前
网页端CAD的图形选择、编辑与夹点操作教程
前端·javascript·node.js
妙码生花19 小时前
从 PHP 到 AI + Golang,程序员自救转型手记(五十二):管理员权限检查中间件,AI 随意放行预闯大祸
前端·后端·go
月月大王的3D日记19 小时前
Three.js 入门系列(8):六种光源全解析 —— 关灯了,开光!
前端·javascript
属于自己的天空20 小时前
每天省去重复 Prompt:我用 Skills 把 CRUD 生成标准化了
前端·后端
卡卡罗特AI20 小时前
GitHub怎么用?零基础,保姆级使用教程-上!建议收藏
前端·后端·github