kiki-agent 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/README.md +3 -3
  2. package/dist/cpu-worker.mjs +52744 -0
  3. package/dist/docs/en/configuration/config-files.md +121 -46
  4. package/dist/docs/en/configuration/data-locations.md +34 -7
  5. package/dist/docs/en/configuration/env-vars.md +37 -9
  6. package/dist/docs/en/configuration/overrides.md +20 -9
  7. package/dist/docs/en/configuration/providers.md +114 -9
  8. package/dist/docs/en/customization/agent-profiles.md +1 -1
  9. package/dist/docs/en/customization/agents-and-subagents.md +55 -12
  10. package/dist/docs/en/customization/hooks.md +3 -3
  11. package/dist/docs/en/customization/personas.md +36 -2
  12. package/dist/docs/en/customization/plugins.md +56 -3
  13. package/dist/docs/en/customization/prompt-fields.md +65 -5
  14. package/dist/docs/en/customization/recipes.md +77 -0
  15. package/dist/docs/en/customization/skins.md +2 -2
  16. package/dist/docs/en/customization/themes.md +1 -1
  17. package/dist/docs/en/features/agent-workflows.md +8 -8
  18. package/dist/docs/en/features/browser-and-computer.md +40 -0
  19. package/dist/docs/en/features/daily.md +13 -13
  20. package/dist/docs/en/features/ecosystem.md +6 -6
  21. package/dist/docs/en/features/extend.md +11 -10
  22. package/dist/docs/en/features/freedom.md +9 -9
  23. package/dist/docs/en/features/index.md +58 -28
  24. package/dist/docs/en/features/long-work.md +18 -14
  25. package/dist/docs/en/features/look.md +6 -6
  26. package/dist/docs/en/features/people.md +6 -6
  27. package/dist/docs/en/features/phone.md +13 -3
  28. package/dist/docs/en/features/spaces.md +12 -12
  29. package/dist/docs/en/features/workbench.md +8 -8
  30. package/dist/docs/en/getting-started/desktop-app.md +4 -8
  31. package/dist/docs/en/getting-started/first-launch.md +1 -1
  32. package/dist/docs/en/guides/goals.md +4 -2
  33. package/dist/docs/en/guides/interface.md +32 -10
  34. package/dist/docs/en/guides/memory.md +64 -10
  35. package/dist/docs/en/guides/sessions.md +21 -9
  36. package/dist/docs/en/guides/settings.md +64 -40
  37. package/dist/docs/en/index.md +3 -1
  38. package/dist/docs/en/reference/command.md +90 -31
  39. package/dist/docs/en/reference/model-vocabulary.md +2 -2
  40. package/dist/docs/en/reference/slash-commands.md +1 -1
  41. package/dist/docs/en/reference/tools.md +65 -20
  42. package/dist/docs/en/server/acp.md +9 -3
  43. package/dist/docs/en/server/local-server.md +19 -27
  44. package/dist/docs/en/server/mcp.md +9 -5
  45. package/dist/docs/en/server/rest-api.md +350 -22
  46. package/dist/docs/en/server/script-tools.md +268 -0
  47. package/dist/docs/zh/configuration/config-files.md +121 -46
  48. package/dist/docs/zh/configuration/data-locations.md +34 -7
  49. package/dist/docs/zh/configuration/env-vars.md +37 -9
  50. package/dist/docs/zh/configuration/overrides.md +20 -9
  51. package/dist/docs/zh/configuration/providers.md +114 -9
  52. package/dist/docs/zh/customization/agent-profiles.md +1 -1
  53. package/dist/docs/zh/customization/agents-and-subagents.md +55 -12
  54. package/dist/docs/zh/customization/hooks.md +3 -3
  55. package/dist/docs/zh/customization/personas.md +36 -2
  56. package/dist/docs/zh/customization/plugins.md +56 -3
  57. package/dist/docs/zh/customization/prompt-fields.md +65 -5
  58. package/dist/docs/zh/customization/recipes.md +77 -0
  59. package/dist/docs/zh/customization/skins.md +2 -2
  60. package/dist/docs/zh/customization/themes.md +1 -1
  61. package/dist/docs/zh/features/agent-workflows.md +10 -10
  62. package/dist/docs/zh/features/browser-and-computer.md +40 -0
  63. package/dist/docs/zh/features/daily.md +13 -13
  64. package/dist/docs/zh/features/ecosystem.md +6 -6
  65. package/dist/docs/zh/features/extend.md +10 -9
  66. package/dist/docs/zh/features/freedom.md +9 -9
  67. package/dist/docs/zh/features/index.md +58 -28
  68. package/dist/docs/zh/features/long-work.md +17 -13
  69. package/dist/docs/zh/features/look.md +6 -6
  70. package/dist/docs/zh/features/people.md +5 -5
  71. package/dist/docs/zh/features/phone.md +13 -3
  72. package/dist/docs/zh/features/spaces.md +12 -12
  73. package/dist/docs/zh/features/workbench.md +8 -8
  74. package/dist/docs/zh/getting-started/desktop-app.md +4 -8
  75. package/dist/docs/zh/getting-started/first-launch.md +1 -1
  76. package/dist/docs/zh/guides/goals.md +4 -2
  77. package/dist/docs/zh/guides/interface.md +32 -10
  78. package/dist/docs/zh/guides/memory.md +64 -10
  79. package/dist/docs/zh/guides/sessions.md +21 -9
  80. package/dist/docs/zh/guides/settings.md +64 -40
  81. package/dist/docs/zh/index.md +4 -2
  82. package/dist/docs/zh/reference/command.md +90 -31
  83. package/dist/docs/zh/reference/model-vocabulary.md +2 -2
  84. package/dist/docs/zh/reference/slash-commands.md +1 -1
  85. package/dist/docs/zh/reference/tools.md +65 -20
  86. package/dist/docs/zh/server/acp.md +9 -3
  87. package/dist/docs/zh/server/local-server.md +19 -27
  88. package/dist/docs/zh/server/mcp.md +9 -5
  89. package/dist/docs/zh/server/rest-api.md +338 -21
  90. package/dist/docs/zh/server/script-tools.md +268 -0
  91. package/dist/external-harness/agy-cli-acp.mjs +168 -162
  92. package/dist/external-harness/agy-hook-registration.mjs +69 -30
  93. package/dist/external-harness/agy-mcp-plugin.mjs +19 -0
  94. package/dist/external-harness/agy-permission-hook.mjs +29 -2
  95. package/dist/hostRunner.mjs +112 -3
  96. package/dist/mailbox-worker.mjs +403 -0
  97. package/dist/main.mjs +2 -2
  98. package/dist/memory-worker.mjs +1008 -0
  99. package/dist/native/windows-process-helper.exe +0 -0
  100. package/dist/query-store-worker.mjs +487 -0
  101. package/dist/sqlite-indexer.mjs +255 -403
  102. package/dist/sqlite-query-worker.mjs +261 -249
  103. package/dist/usage-parser-worker.mjs +3977 -9
  104. package/dist/usage-read-model-worker.mjs +761 -0
  105. package/dist/web/assets/AppErrorBoundary-B5Fc4f6-.js +1 -0
  106. package/dist/web/assets/NavScopeBoundary-C7MnGQio.js +1 -0
  107. package/dist/web/assets/{arc-DYDCMlOS.js → arc-DGB9OVgQ.js} +1 -1
  108. package/dist/web/assets/{architectureDiagram-3BPJPVTR-C9Y7T0O2.js → architectureDiagram-3BPJPVTR-glnQCMub.js} +1 -1
  109. package/dist/web/assets/{blockDiagram-GPEHLZMM-CdUrp-tD.js → blockDiagram-GPEHLZMM-bM0tnGby.js} +1 -1
  110. package/dist/web/assets/{c4Diagram-AAUBKEIU-PrwvB9IJ.js → c4Diagram-AAUBKEIU-DMf_rTtt.js} +1 -1
  111. package/dist/web/assets/channel-Cj8SKJ38.js +1 -0
  112. package/dist/web/assets/{chunk-2J33WTMH-BL56g_Es.js → chunk-2J33WTMH-mTccJ3tW.js} +1 -1
  113. package/dist/web/assets/{chunk-4BX2VUAB-DvJD5M9M.js → chunk-4BX2VUAB-DhqPYMjY.js} +1 -1
  114. package/dist/web/assets/{chunk-55IACEB6-C8f-nzvx.js → chunk-55IACEB6-BujrYRoO.js} +1 -1
  115. package/dist/web/assets/{chunk-727SXJPM-DOGkWKkV.js → chunk-727SXJPM-ciMmSI4G.js} +1 -1
  116. package/dist/web/assets/{chunk-AQP2D5EJ-fFOuz7g6.js → chunk-AQP2D5EJ-CZW9pKTc.js} +1 -1
  117. package/dist/web/assets/{chunk-FMBD7UC4-BpeXZ9LM.js → chunk-FMBD7UC4-hdALNnnU.js} +1 -1
  118. package/dist/web/assets/{chunk-ND2GUHAM-CRUh76fb.js → chunk-ND2GUHAM-CgKyqUdb.js} +1 -1
  119. package/dist/web/assets/{chunk-QZHKN3VN-uNfxaPk0.js → chunk-QZHKN3VN-B2mmUz_E.js} +1 -1
  120. package/dist/web/assets/classDiagram-4FO5ZUOK-f8V9p-dD.js +1 -0
  121. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-f8V9p-dD.js +1 -0
  122. package/dist/web/assets/client-ClWQBErG.js +3 -0
  123. package/dist/web/assets/connection-C0J3BPgk.js +1 -0
  124. package/dist/web/assets/{cose-bilkent-S5V4N54A-BNkxG-qX.js → cose-bilkent-S5V4N54A-UV3uPjkK.js} +1 -1
  125. package/dist/web/assets/{dagre-BM42HDAG-BerioUei.js → dagre-BM42HDAG-Zjy-gQ6C.js} +1 -1
  126. package/dist/web/assets/{diagram-2AECGRRQ-Czv2SR07.js → diagram-2AECGRRQ-DL-kilIf.js} +1 -1
  127. package/dist/web/assets/{diagram-5GNKFQAL-Uzi1weGK.js → diagram-5GNKFQAL-CjB_xR5B.js} +1 -1
  128. package/dist/web/assets/{diagram-KO2AKTUF-W36h_ff3.js → diagram-KO2AKTUF-CjN4i3b9.js} +1 -1
  129. package/dist/web/assets/{diagram-LMA3HP47-FG4dDk52.js → diagram-LMA3HP47-CPCAMndo.js} +1 -1
  130. package/dist/web/assets/{diagram-OG6HWLK6-CQoEjIAY.js → diagram-OG6HWLK6-DVeBWBKd.js} +1 -1
  131. package/dist/web/assets/{erDiagram-TEJ5UH35-Ck06KVyZ.js → erDiagram-TEJ5UH35-CHKzBHrr.js} +1 -1
  132. package/dist/web/assets/export-CXoWon32.js +2 -0
  133. package/dist/web/assets/{flowDiagram-I6XJVG4X-C5hgxdFZ.js → flowDiagram-I6XJVG4X-C5rQa2pq.js} +1 -1
  134. package/dist/web/assets/{ganttDiagram-6RSMTGT7-BS52Pw5_.js → ganttDiagram-6RSMTGT7-BrLjEsNJ.js} +1 -1
  135. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-DLlQKZHs.js → gitGraphDiagram-PVQCEYII-3DRR5VZj.js} +1 -1
  136. package/dist/web/assets/highlighted-body-OFNGDK62-Bdj5SJfv.js +1 -0
  137. package/dist/web/assets/index-2Vx5mHRn.js +1 -0
  138. package/dist/web/assets/index-B1UXw2C9.js +1 -0
  139. package/dist/web/assets/{index-CM-nNfuV.js → index-BJxtlf4P.js} +4 -4
  140. package/dist/web/assets/{index-DKIysLbI.js → index-BY7jPurv.js} +1 -1
  141. package/dist/web/assets/index-Bq79v-Sa.js +1 -0
  142. package/dist/web/assets/index-BqD3iTIl.js +1 -0
  143. package/dist/web/assets/index-Br3AlBrQ.js +1 -0
  144. package/dist/web/assets/{index-Ca607_hK.js → index-BvRBCpc6.js} +2 -2
  145. package/dist/web/assets/index-BxYCSNg_.js +3 -0
  146. package/dist/web/assets/{index-B2Pu0Iuu.js → index-C62wjCF_.js} +1 -1
  147. package/dist/web/assets/index-CBvwNH_H.js +1 -0
  148. package/dist/web/assets/{index-BNch_a4L.js → index-CG9e6lgq.js} +1 -1
  149. package/dist/web/assets/{index-ByiwExpV.js → index-CPSWYh_R.js} +2 -2
  150. package/dist/web/assets/index-CS4xJLZV.js +1 -0
  151. package/dist/web/assets/index-CjvqtF2I.js +1 -0
  152. package/dist/web/assets/index-CprdjRRk.js +13 -0
  153. package/dist/web/assets/{index-Bg99yVX_.js → index-CypTtrCB.js} +1 -1
  154. package/dist/web/assets/{index-BwcG86o3.js → index-DDJQGcUL.js} +1 -1
  155. package/dist/web/assets/index-DLWzxUOO.js +1 -0
  156. package/dist/web/assets/index-DQxkxZmn.js +7 -0
  157. package/dist/web/assets/index-DRo5Y_9p.js +1 -0
  158. package/dist/web/assets/index-De_LkTZx.js +1 -0
  159. package/dist/web/assets/{index-CZX3qUe2.js → index-DfUpwUTM.js} +2 -2
  160. package/dist/web/assets/{index-BLU8_Um7.js → index-Dkbz748K.js} +2 -2
  161. package/dist/web/assets/index-DmwFFSkV.js +1 -0
  162. package/dist/web/assets/index-DpcWEDhW.js +1 -0
  163. package/dist/web/assets/index-Dqq1RDP4.js +1 -0
  164. package/dist/web/assets/index-H1uMvIoa.css +1 -0
  165. package/dist/web/assets/index-ICHWJ2SM.js +1 -0
  166. package/dist/web/assets/index-O5fSd569.js +229 -0
  167. package/dist/web/assets/index-odjtqLLS.js +1 -0
  168. package/dist/web/assets/index-v_yAQ0Am.js +1 -0
  169. package/dist/web/assets/{infoDiagram-5YYISTIA-CD4XJGFm.js → infoDiagram-5YYISTIA-CCwV4Z0v.js} +1 -1
  170. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-fu5E3_CT.js → ishikawaDiagram-YF4QCWOH-BwwZcGyZ.js} +1 -1
  171. package/dist/web/assets/{journeyDiagram-JHISSGLW-CXcnKBfJ.js → journeyDiagram-JHISSGLW-Dc6WqniQ.js} +1 -1
  172. package/dist/web/assets/{kanban-definition-UN3LZRKU-BawKH6Pl.js → kanban-definition-UN3LZRKU-DVUqULOS.js} +1 -1
  173. package/dist/web/assets/{linear-BplJuXph.js → linear-d6rWsNOU.js} +1 -1
  174. package/dist/web/assets/memoryAdvisor-DBQXJB1o.js +1 -0
  175. package/dist/web/assets/mermaid-GHXKKRXX-Ik6SkVDT.js +642 -0
  176. package/dist/web/assets/{mindmap-definition-RKZ34NQL-DA1SE2uy.js → mindmap-definition-RKZ34NQL-_JHAkhHL.js} +1 -1
  177. package/dist/web/assets/navViewState-DaCMIYWA.js +1 -0
  178. package/dist/web/assets/{pieDiagram-4H26LBE5-6i021QeX.js → pieDiagram-4H26LBE5-BlhlygGy.js} +1 -1
  179. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-CcKSZDMT.js → quadrantDiagram-W4KKPZXB-jn6R_C0S.js} +1 -1
  180. package/dist/web/assets/{requirementDiagram-4Y6WPE33-lYVuWRuD.js → requirementDiagram-4Y6WPE33-B9fXCHBr.js} +1 -1
  181. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-4Zfb4_h4.js → sankeyDiagram-5OEKKPKP-fPJwIxkl.js} +1 -1
  182. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-DqltKmlY.js → sequenceDiagram-3UESZ5HK-1v1DTNGt.js} +1 -1
  183. package/dist/web/assets/{spaces-CjuXbmxF.js → spaces-CvL2DRZM.js} +1 -1
  184. package/dist/web/assets/{stateDiagram-AJRCARHV-HFdhqxzx.js → stateDiagram-AJRCARHV-CEc_PLov.js} +1 -1
  185. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-iAMctzaT.js +1 -0
  186. package/dist/web/assets/theme-LRSmy8mD.js +1 -0
  187. package/dist/web/assets/{timeline-definition-PNZ67QCA-HNRxaB3t.js → timeline-definition-PNZ67QCA-CEjhuitj.js} +1 -1
  188. package/dist/web/assets/{vennDiagram-CIIHVFJN-DwsCTyaD.js → vennDiagram-CIIHVFJN-CActt9h9.js} +1 -1
  189. package/dist/web/assets/{wardley-L42UT6IY-BWW2wtVO.js → wardley-L42UT6IY-Bp3q2izt.js} +1 -1
  190. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-C-ktKm7v.js → wardleyDiagram-YWT4CUSO-C_zutiQ2.js} +1 -1
  191. package/dist/web/assets/{xychartDiagram-2RQKCTM6-48AxNW9k.js → xychartDiagram-2RQKCTM6-CRafvv33.js} +1 -1
  192. package/dist/web/icons/apple-touch-icon.png +0 -0
  193. package/dist/web/icons/icon-192.png +0 -0
  194. package/dist/web/icons/icon-512.png +0 -0
  195. package/dist/web/icons/maskable-512.png +0 -0
  196. package/dist/web/index.html +12 -2
  197. package/dist/web/manifest.webmanifest +16 -0
  198. package/native/auth-native/prebuilds/linux-arm64/auth-native.node +0 -0
  199. package/native/auth-native/prebuilds/linux-x64/auth-native.node +0 -0
  200. package/native/auth-native/prebuilds/win32-arm64/auth-native.node +0 -0
  201. package/native/auth-native/prebuilds/win32-x64/auth-native.node +0 -0
  202. package/package.json +23 -4
  203. package/dist/search-worker.mjs +0 -14177
  204. package/dist/web/assets/AppErrorBoundary-DiGMUg4r.js +0 -1
  205. package/dist/web/assets/LifeMark-CL6-HWDu.js +0 -1
  206. package/dist/web/assets/NavScopeBoundary-CFCnvZR0.js +0 -1
  207. package/dist/web/assets/channel-Bj_gZ_Lv.js +0 -1
  208. package/dist/web/assets/classDiagram-4FO5ZUOK-ssCwe2R4.js +0 -1
  209. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-ssCwe2R4.js +0 -1
  210. package/dist/web/assets/client-DGj93bGT.js +0 -3
  211. package/dist/web/assets/connection-Bpf-EjrL.js +0 -1
  212. package/dist/web/assets/export-T_izwEkQ.js +0 -2
  213. package/dist/web/assets/highlighted-body-OFNGDK62-Btm6MuZ4.js +0 -1
  214. package/dist/web/assets/index-5_yzg61S.js +0 -1
  215. package/dist/web/assets/index-B-6LiYTY.js +0 -1
  216. package/dist/web/assets/index-B4iu4SJW.js +0 -1
  217. package/dist/web/assets/index-B9MlqF7J.js +0 -1
  218. package/dist/web/assets/index-BECSk4If.js +0 -1
  219. package/dist/web/assets/index-BFcyN2Zw.js +0 -1
  220. package/dist/web/assets/index-BIebkSEI.css +0 -1
  221. package/dist/web/assets/index-BMWid2q9.js +0 -1
  222. package/dist/web/assets/index-BeMvPEXs.js +0 -1
  223. package/dist/web/assets/index-Bezli3SF.js +0 -1
  224. package/dist/web/assets/index-BkPV0psm.js +0 -1
  225. package/dist/web/assets/index-CG8uIlD7.js +0 -1
  226. package/dist/web/assets/index-CJ92kLtO.js +0 -1
  227. package/dist/web/assets/index-CRDDqofN.js +0 -1
  228. package/dist/web/assets/index-Cd62y0wD.js +0 -1
  229. package/dist/web/assets/index-CgcJPsK6.js +0 -3
  230. package/dist/web/assets/index-Cy8C_eFR.js +0 -7
  231. package/dist/web/assets/index-D8z7lcQn.js +0 -166
  232. package/dist/web/assets/index-D_oPSlBL.js +0 -1
  233. package/dist/web/assets/index-Dceu0bqY.js +0 -1
  234. package/dist/web/assets/index-eUyF-8Sq.js +0 -1
  235. package/dist/web/assets/index-hG2s2Spn.js +0 -13
  236. package/dist/web/assets/mermaid-GHXKKRXX-BO9hkP3Z.js +0 -621
  237. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-Dx28QuZF.js +0 -1
  238. package/dist/web/assets/theme-beWE_6f8.js +0 -1
@@ -4,19 +4,25 @@ Kiki uses environment variables to control a small number of runtime behaviors
4
4
 
5
5
  Kiki-owned runtime controls use the `KIKI_*` prefix. Provider credential key names such as `KIMI_API_KEY` and `KIMI_BASE_URL` remain upstream-facing and are documented separately. Treat the exact names listed on this page as authoritative.
6
6
 
7
- ::: warning Important: API keys are not configured here
8
- Credential variables such as `KIMI_API_KEY`, `ANTHROPIC_API_KEY`, and `OPENAI_API_KEY` are **not** read automatically from shell environment variables. Running `export KIMI_API_KEY=xxx` in the terminal does not give any provider its key — they must be written in the config files under `[providers.<name>]` or its `[providers.<name>.env]` sub-table. API keys live in the companion `credentials.toml`; `config.toml` never carries a plaintext credential.
9
-
10
- The only exception is the `KIKI_MODEL_*` family, which is an explicit channel that *does* read credentials from the shell — see [Define a model from environment variables](#define-a-model-from-environment-variables-kiki-model).
7
+ ::: warning
8
+ Provider API key variables are **not** read automatically. To use one, set `api_key_env = "YOUR_PROVIDER_KEY"` in the provider's `config.toml` table and supply that variable to the Kiki process. See [credential priority and example](./overrides.md#provider-credentials). Stored key values remain in `credentials.toml`; the environment reference stores only the variable name.
11
9
 
12
- For background, see [Config overrides: provider credentials](./overrides.md#provider-credentials).
10
+ The separate `KIKI_MODEL_*` family can supply a temporary model and key — see [Define a model from environment variables](#define-a-model-from-environment-variables-kiki-model).
13
11
  :::
14
12
 
15
13
  ## Core paths
16
14
 
15
+ ### Current Kiki home
16
+
17
+ `<home>` means the resolved Kiki home for the current Space on the server host. For a subcommand that supports `--home`, Kiki resolves it in this order: explicit `--home` > `KIKI_HOME` > the OS home default `~/.kiki`. Only subcommands that document `--home` accept that explicit override; the root `kiki` command does not. `KIMI_CODE_HOME` does not select this home — it is reserved for vendor Kimi Code integrations, such as an external Kimi CLI or its OAuth credential directory.
18
+
19
+ Local child processes inherit the current Space's Kiki home by default. An explicit `KIKI_HOME` supplied in a child environment still overrides that default. SSH and other remote children do not receive the local Kiki home; they resolve their own home on the remote host.
20
+
21
+ Use `<home>` for current config, sessions, memory, and logs. A base home can supply selected inherited resources, and shared credentials may use that base when configured; this does not mean every file moves to or is shared from the same path. In shell examples, quote paths as `"$KIKI_HOME/..."` when `KIKI_HOME` names the current home.
22
+
17
23
  ### `KIKI_HOME`
18
24
 
19
- Overrides the data root directory; the default is `~/.kiki`. Once set, the config and credentials files, sessions, logs, OAuth credentials, and all other data land under the new path. The desktop app's OAuth credentials follow `KIKI_HOME` too: unset, they default to the compatibility home `~/.kimi-code/` (see [Data locations](./data-locations.md)).
25
+ Selects the runtime home when no supported command-specific `--home` is supplied; the default is `~/.kiki`. Once resolved, config and credentials files, sessions, logs, OAuth credentials, and other runtime data use that home subject to the inheritance and shared-credential rules above. The desktop app's OAuth credentials follow `KIKI_HOME` too: when it is unset, they default to the compatibility home `~/.kimi-code/` (see [Data locations](./data-locations.md)).
20
26
 
21
27
  ```sh
22
28
  export KIKI_HOME="/path/to/custom/kiki"
@@ -36,7 +42,7 @@ Switch models temporarily without modifying `config.toml` — when `KIKI_MODEL_N
36
42
 
37
43
  ## Provider credential key names
38
44
 
39
- The key names below are not read from the shell. They are keys written inside the `[providers.<name>.env]` sub-table, used as fallback values for `api_key` / `base_url`. Secret keys go in the companion `credentials.toml`; the non-secret `*_BASE_URL` keys stay in `config.toml`.
45
+ The names below are the conventional keys for the `[providers.<name>.env]` sub-table, used as fallback values for `api_key` / `base_url`. Secret keys go in the companion `credentials.toml`; the non-secret `*_BASE_URL` keys stay in `config.toml`. To read an API key from the process instead, explicitly reference its variable name with [`api_key_env`](./overrides.md#provider-credentials).
40
46
 
41
47
  ```toml
42
48
  # ~/.kiki/credentials/credentials.toml
@@ -68,7 +74,7 @@ Key names per provider:
68
74
  | `GOOGLE_CLOUD_LOCATION` | Vertex AI, together with `GOOGLE_CLOUD_PROJECT` | None |
69
75
 
70
76
  ::: warning
71
- `GOOGLE_APPLICATION_CREDENTIALS` (path to a service account JSON file) is the only exception that goes through the system environment variable mechanism — it is read by the Google SDK directly via the standard ADC flow, and the CLI does not participate. All other key names must be placed in the `[providers.<name>.env]` sub-table to take effect — the secret ones in `credentials.toml`, the `*_BASE_URL` ones in `config.toml`.
77
+ `GOOGLE_APPLICATION_CREDENTIALS` (path to a service account JSON file) is read directly by the Google SDK through the standard ADC flow. Project, location, and base URL values still come from the provider's config sub-table; `api_key_env` opts in only the named API key, not other shell variables.
72
78
  :::
73
79
 
74
80
  For the full provider type and field reference, see [Providers and models](./providers.md).
@@ -146,7 +152,7 @@ Switches that control the behavior of subsystems such as background tasks, the b
146
152
  | `KIKI_MCP_TOOL_TIMEOUT_MS` | Global default single tool-call timeout (ms) for all MCP servers; takes higher priority than `[mcp] tool_timeout_ms` in `config.toml`, but a per-server `toolTimeoutMs` in `mcp.json` still wins (default `60000`) | Integer from `1` to `2147483647`; invalid values are ignored |
147
153
  | `KIKI_LOOP_MAX_STEPS_PER_TURN` | Maximum Agent steps per turn; takes higher priority than `[loop_control] max_steps_per_turn` in `config.toml` (unset or `0` means unlimited) | Non-negative integer; invalid values are ignored |
148
154
  | `KIKI_LOOP_MAX_ATTEMPTS_PER_STEP` | Maximum total attempts for a failing step (including the initial attempt); takes higher priority than `[loop_control] max_attempts_per_step` in `config.toml` (default `5`) | Non-negative integer; invalid values are ignored |
149
- | `KIKI_INFINITE_RETRY` | Retry every failed LLM request indefinitely — turn steps and background operations such as compaction alike — instead of failing the task; waits use exponential backoff (capped at 32 s) and honor the server's `Retry-After` header, and aborting still cancels immediately. Intended for long-running unattended evaluations against endpoints that may fail temporarily | Truthy: `1`/`true`/`yes`/`on`; falsy: `0`/`false`/`no`/`off` |
155
+ | `KIKI_INFINITE_RETRY` | Retry failed LLM requests indefinitely, including turn steps, compaction, HTTP 400/404, and quota errors. Waits use exponential backoff (capped at 32 s) and honor `Retry-After`. Connection interruptions in native turns still use the [bounded retry budget](./config-files.md#retry), so this setting does not replay partial responses indefinitely. Does not override cancellation, local admission denials, refusals, provider-hosted tool output, `retry = false`, or per-request `retry: 'never'`; the one-use [`Continue.` request](./config-files.md#loop-control) is never retried. Context overflow still uses context recovery. Intended for unattended evaluations against temporarily failing endpoints | Truthy: `1`/`true`/`yes`/`on`; falsy: `0`/`false`/`no`/`off` |
150
156
  | `KIKI_TOKEN_COUNTING_STRATEGY` | Which context token count is reported externally (the context-size display); takes higher priority than `[token_counting] strategy` in `config.toml` (default `measured+estimated`) | `measured+estimated`, `measured`, `estimated` (case-insensitive); invalid values are ignored |
151
157
  | `NB_SEARCH_CONFIG` | Path to a canonical JSON configuration for the built-in search and retrieval module, loaded before Kiki's `[nb_search]` patch | File path |
152
158
  | `NB_SEARCH_HOME` | Data directory for the built-in search and retrieval module | Directory path |
@@ -166,6 +172,28 @@ Switches that control the behavior of subsystems such as background tasks, the b
166
172
  | `KIKI_MODEL_THINKING_KEEP` | Preserved-thinking passthrough; on `kimi` sent as `thinking.keep`, on `anthropic` (Claude and Kimi's Anthropic-compatible mode) sent as a `context_management` `clear_thinking_20251015` edit (enabling keep routes Anthropic requests to the beta Messages API); overrides `[thinking] keep` (which defaults to `"all"`); only injected while Thinking is on | A value the API accepts, e.g. `all`; an off-value (`false`/`0`/`no`/`off`/`none`/`null`) disables it |
167
173
  | `KIKI_DISABLE_CRON` | Disable the scheduled-task tool (a `Cron` call with `action: "create"` is refused; existing tasks do not fire) | `1` to disable |
168
174
 
175
+ ## Resource overrides
176
+
177
+ The hardware-scaled defaults are described in [configuration files](./config-files.md#hardware-scaled-resource-defaults). The variables below override only the named resource; they do not rewrite `config.toml`.
178
+
179
+ | Variable | Purpose | Valid values and timing |
180
+ | --- | --- | --- |
181
+ | `KIKI_CPU_MAX_WORKERS` | Override `[cpu_workers].max_workers` | Positive integer; read when the App service starts. The effective pool still caps at `C - 1` |
182
+ | `KIKI_CPU_MAX_QUEUE` | Override `[cpu_workers].max_queue` | Positive integer; read when the App service starts |
183
+ | `KIKI_CPU_MAX_QUEUED_BYTES` | Override `[cpu_workers].max_queued_bytes` | Positive integer bytes; read when the App service starts |
184
+ | `KIKI_CPU_TIMEOUT_MS` | Override `[cpu_workers].timeout_ms` | Positive integer up to `2147483647`; read when the App service starts |
185
+ | `KIKI_SEARCH_INDEXER_SOFT_MB` / `KIKI_SEARCH_INDEXER_HARD_MB` | Override the search indexer's soft or hard RSS budget | Positive integer MiB. An explicit search-host option wins, then the environment variable, then the hardware default `2H + 256` / `3H + 256` MiB |
186
+ | `KIKI_DESKTOP_BUNDLED` | Mark the process as the bundled desktop sidecar for watchdog defaults | `1` enables bundled defaults; unset or another value leaves defaults off unless a threshold override is set |
187
+ | `KIKI_SERVER_HEAP_RESTART_MB` | Override the desktop sidecar heap watchdog threshold | Positive integer MiB; `0` disables the heap metric. The default is 75% of the effective V8 heap |
188
+ | `KIKI_SERVER_RSS_RESTART_MB` | Override the desktop sidecar RSS watchdog threshold | Positive integer MiB; `0` disables the RSS metric. The default is `max(3 GiB, 35% of total memory)` |
189
+ | `KIKI_SERVER_EXTERNAL_RESTART_MB` | Override the desktop sidecar external-memory watchdog threshold | Positive integer MiB; `0` disables the external metric. The default is `max(1.5 GiB, total memory / 16)` and it remains eligible only when RSS is at least 3 GiB |
190
+
191
+ The desktop watchdog samples every 30 seconds. Its defaults apply to the bundled desktop sidecar; explicit variables apply on any host. The desktop launcher injects a sidecar target of `max(8192, floor(totalmem / MiB / 4))` MiB. Native SEA profiles use `execArgv=[]` and `execArgvExtension="env"`, so the user's `NODE_OPTIONS` remains authoritative. Foreground `serve`, non-login `acp`, and in-process prompt runs (`-p`, `--prompt`, or `--prompt-file`) re-exec at most once when the current heap is below 90% of the target and no user heap override exists. The default interactive `kiki`, resume/continue, `web`, and `serve --ensure/--query/--stop` are daemon clients and do not auto-restart. A newly spawned daemon receives its target before launch. `--version`, tool calls, and completion do not restart.
192
+
193
+ The CLI accepts legacy `--node-options` only for heap-related flags; other flags produce an error rather than being discarded. Put other supported Node flags in `NODE_OPTIONS`. Entrypoints preserve the user's original `NODE_OPTIONS` and remove only Kiki's one-time heap override before spawning child processes.
194
+
195
+ Kiki-owned CLI/SEA entries enable independent worker heaps once before creating workers. SDK imports do not change process-wide flags. If an SDK host starts Node with `--max-old-space-size` or its percentage form, that global setting can override `Worker.resourceLimits`. To opt in to independent limits, call `enableIndependentWorkerHeaps` from `@kiki/node-sdk/worker-heap-policy` before creating workers. This changes the V8 default for all later isolates in the host process, not just Kiki workers, and depends on Node/V8 behavior; set the main heap at process startup. Workers warn if their observed heap limit differs substantially from the requested budget.
196
+
169
197
  Subagent concurrency has no environment-variable override. Configure [`[subagent]`](./config-files.md#subagent) with `max_direct_children` and `max_total_subagents`; their defaults are `16` and `0` (unlimited), respectively.
170
198
 
171
199
  `[subagent].default_model` supplies a model only when dispatch parameters and effective pins do not. It never inherits the caller's model, and neither it nor a forced environment value can bypass a profile's hard model rules. `[subagent].default_effort` was removed and is no longer read — startup warns about it; set an effort pin on the profile, route, or caller lease, or let the selected model use its own default.
@@ -25,7 +25,7 @@ For ordinary runtime parameters such as model alias, Plan mode, yolo mode, and S
25
25
  A small number of environment variables explicitly override specific config file fields — for example, `KIKI_BACKGROUND_KEEP_ALIVE_ON_EXIT` has higher priority than `[background].keep_alive_on_exit`. These exceptions are noted in [Environment variables](./env-vars.md) and in the relevant field descriptions in [Configuration files](./config-files.md).
26
26
 
27
27
  ::: warning
28
- **Ordinary runtime parameters do not fall back to shell environment variables.** Provider `api_key` / `base_url` are read only from the config files — secrets from `credentials.toml`, everything else from `config.toml` — and do not fall back to `export`-ed shell variables. The only exception is the explicit `KIKI_MODEL_*` channel — see [Define a model from environment variables](./env-vars.md#define-a-model-from-environment-variables-kiki-model).
28
+ **Ordinary runtime parameters do not fall back to shell environment variables.** A provider reads a shell credential only when you explicitly name it with `api_key_env`, as described below. The separate `KIKI_MODEL_*` channel can also supply a temporary model and key — see [Define a model from environment variables](./env-vars.md#define-a-model-from-environment-variables-kiki-model).
29
29
  :::
30
30
 
31
31
  The CLI reads user-level configuration from `KIKI_HOME` (default `~/.kiki`) and project-local settings from `<project-root>/.kiki/local.toml`. The legacy `.kimi-code/local.toml` path is not read. To isolate config between different projects, point `KIKI_HOME` at different data directories — see [Common scenarios](#common-scenarios) below.
@@ -36,15 +36,26 @@ Provider credentials (`api_key`, `base_url`) follow their own resolution rules,
36
36
 
37
37
  Provider API keys are stored in `credentials/credentials.toml` under the data root. Kiki reads the two files as one document, and on a shared TOML path the value in `credentials.toml` wins; `config.toml` never holds a plaintext credential. See [Provider credentials](./config-files.md#provider-credentials) for the file, its permissions, and the first-load migration.
38
38
 
39
- For a single provider, credentials are resolved in this order:
39
+ A model's own API key or OAuth reference takes priority over its provider's credential. For an API-key provider, the remaining order is:
40
40
 
41
- 1. `[providers.<name>].api_key` — the key stored in `credentials.toml`; highest priority
42
- 2. The matching key inside the `[providers.<name>.env]` sub-table (`KIMI_API_KEY`, `ANTHROPIC_API_KEY`, etc.) — consulted only when `api_key` is empty; these secret values live in `credentials.toml` too
43
- 3. If both are absent — startup fails with an error indicating the provider is missing credentials
41
+ 1. `[providers.<name>].api_key` — the stored key; a non-empty value wins over environment sources.
42
+ 2. If `api_key_env` is set, read that variable from `[providers.<name>.env]` when the same name is present there; otherwise read it from the Kiki process environment. An explicitly empty sub-table value does not fall back to the process. A missing or blank variable leaves the API key unconfigured and does not try a different variable.
43
+ 3. If `api_key_env` is not set, use the provider type's existing key in `[providers.<name>.env]` (`KIMI_API_KEY`, `ANTHROPIC_API_KEY`, etc.). These stored secret values live in `credentials.toml` too; there is no implicit shell fallback.
44
44
 
45
- `base_url` is resolved the same way: first `[providers.<name>].base_url`, then the `*_BASE_URL` key in `[providers.<name>.env]`. `base_url` is not a secret, so it stays in `config.toml`.
45
+ To keep the key in the environment, store only its name in `config.toml`:
46
46
 
47
- > The `[providers.<name>.env]` sub-table is just a TOML section in the config files — it does not write anything into the shell environment. It is only consulted when the corresponding direct field (`api_key` / `base_url`) is empty.
47
+ ```toml
48
+ [providers.gateway]
49
+ type = "openai"
50
+ base_url = "https://api.example.com/v1"
51
+ api_key_env = "YOUR_PROVIDER_KEY"
52
+ ```
53
+
54
+ Start Kiki from a process that has `YOUR_PROVIDER_KEY` set. A desktop app launched from a shortcut may not inherit variables from your terminal. To switch an existing provider from a stored key, clear its `api_key`; otherwise the stored key still wins. Kiki does not copy the resolved environment value into its credential store. Provider readiness, model requests, and model discovery use the same resolution rule; readiness means a value is available, not that the remote service has accepted it.
55
+
56
+ A provider's OAuth reference still uses its existing token flow. As with a stored key, a resolved environment key cannot be combined with OAuth at that same provider layer.
57
+
58
+ `base_url` is unchanged: first `[providers.<name>].base_url`, then the `*_BASE_URL` key in `[providers.<name>.env]`. It is not a secret, so it stays in `config.toml`. The `env` sub-table does not write values into the shell environment.
48
59
 
49
60
  For the full list of credential key names, see [Environment variables: provider credential key names](./env-vars.md#provider-credential-key-names).
50
61
 
@@ -89,7 +100,7 @@ When a profile binds — a new main session, a new subagent, a model switch, or
89
100
 
90
101
  If none of those produces a value, or the resulting effort is not one the model supports, the bind fails as a configuration error rather than silently picking something. With no model configured at all, the bind asks for both a model and an effort. You do not have to pass an effort when a route, lease, profile pin, or model default already supplies one; you need one only when nothing else does, in which case configure that pin or pass `effort` for this call.
91
102
 
92
- This applies to profile binding only. A plain resume that keeps an existing valid binding is not recomputed, so an effort saved earlier keeps working. Changing only `effort` keeps the saved model, and changing model on resume still requires `allow_model_change: true`.
103
+ This applies to profile binding only. A plain resume that keeps an existing valid binding is not recomputed, so an effort saved earlier keeps working. Changing only `effort` keeps the saved model, and changing model on resume requires an explicit [`context_mode`](../customization/agents-and-subagents.md#named-child-agents) or the legacy `allow_model_change: true` / `new_window: true` confirmation.
93
104
 
94
105
  Paths that do not bind a profile are unchanged: the global `[thinking]` section still supplies its fallback, and `[thinking].enabled = false` still resolves an unpinned effort to Off there.
95
106
 
@@ -107,7 +118,7 @@ Every surface accepts `files` and `fields`. Files load from the Kiki home direct
107
118
  KIKI_HOME="$PWD/.kiki-sandbox" kiki
108
119
  ```
109
120
 
110
- **One-off test key** — since provider credentials are read only from the config files, write a test key into `credentials.toml`:
121
+ **Test key saved in a config file** — write it into `credentials.toml`. For an environment-only key, use the `api_key_env` example above:
111
122
 
112
123
  ```toml
113
124
  # ~/.kiki/credentials/credentials.toml
@@ -4,7 +4,7 @@ Kiki can connect to multiple model providers at once. An API key is the most gen
4
4
 
5
5
  ## Supported provider types
6
6
 
7
- The `type` field in the `providers` table sets the default request format (the API payload and endpoint), which individual models can override with `protocol`:
7
+ The `type` field in the `providers` table selects the connection's request format (the API payload and endpoint). Chat models can override their connection's format with `protocol`; decision connections use the format of the connection itself:
8
8
 
9
9
  | Type | Protocol | Typical use |
10
10
  | --- | --- | --- |
@@ -14,10 +14,40 @@ The `type` field in the `providers` table sets the default request format (the A
14
14
  | `openai_responses` | OpenAI Responses API | OpenAI's newer Responses interface |
15
15
  | `google-genai` | Google GenAI | Gemini API |
16
16
  | `vertexai` | Google GenAI on Vertex | Google Cloud Vertex AI |
17
+ | `system_one` | System One | Decision services such as Jev; permission review and memory recommendations |
18
+ | `pair_score` | Reranking scores | Memory ranking with compatible rerankers or classifiers |
17
19
 
18
- All providers communicate with models in streaming mode by default. Capabilities such as thinking, vision, and tool use are matched automatically by model name prefix — you typically do not need to declare them manually.
20
+ Chat connections stream by default. Capabilities such as thinking, vision, and tool use are matched automatically by model name prefix — you typically do not need to declare them manually. Decision connections return judgments or scores and do not add entries to the chat model catalog.
19
21
 
20
- **Credential priority**: `api_key` direct field > `[providers.<name>.env]` sub-table key > if both are absent, startup fails with an error. Both are read from the config files — `credentials.toml` overlays `config.toml` — and the CLI does not fall back to shell environment variables for credentials. See [Config overrides: provider credentials](./overrides.md#provider-credentials).
22
+ **Credential priority**: a model's own credential wins; otherwise Kiki uses the provider's `api_key`, then its explicitly configured `api_key_env` variable. Without `api_key_env`, the existing `[providers.<name>.env]` credential fallback remains unchanged. The `system_one` type provides the TypeSafe default address; its implicit `TYPESAFE_API_KEY` fallback applies only to the `https://api.typesafe.ai` origin. For another service, select its key or environment variable explicitly, or leave credentials unset when it needs none. See [Config overrides: provider credentials](./overrides.md#provider-credentials) for the full priority and an environment-variable example.
23
+
24
+ ### Decision connections
25
+
26
+ A decision connection owns its address, protocol and credentials. Permission review and [Memory Advisor](../guides/memory.md#memory-advisor) can reference the same connection, while each keeps its own source choice and behavior settings. Use a compatible service's address and remote model name; no local chat model or context size is needed.
27
+
28
+ This example shares one Jev connection, using the server's existing environment variable:
29
+
30
+ ```toml
31
+ [providers.judgment]
32
+ type = "system_one"
33
+ base_url = "https://api.typesafe.ai/v1"
34
+ api_key_env = "TYPESAFE_API_KEY"
35
+ default_model = "jev-latest"
36
+
37
+ [permission.reviewer]
38
+ source = { kind = "connection", connection = "judgment" }
39
+
40
+ [memory.advisor]
41
+ source = { kind = "connection", connection = "judgment" }
42
+ ```
43
+
44
+ `default_model` is the name sent to the remote decision service. A source can override it with `model`, or select an existing chat alias with `{ kind = "model", model = "review-model" }`. Changing one consumer's source does not change the other. [Memory Advisor](../guides/memory.md#memory-advisor) uses the source when enabled; saving a source preserves an existing off switch.
45
+
46
+ For a reranker, use `type = "pair_score"`, its `base_url`, and its remote `default_model`. Pair scores support memory **Rank**, not **Select** or permission review. By default, requests append `/systemone` or `/rerank` to the base path. Set `decision_endpoint` to a path or complete URL when the service needs another route; it must share the base URL's scheme, host and port and contain no embedded credentials.
47
+
48
+ Both types use the existing provider credential fields and custom headers. A service that accepts unauthenticated HTTP requests can leave credentials unset. An explicitly selected `api_key_env` that has no value and no alternative authentication reports an authentication issue; an upstream 401 or 403 does too. Store API keys through the existing connection credential field or `credentials.toml`, not a second consumer-specific key field. The [decision probe](../server/rest-api.md#decision-connections) tests the selected service with synthetic content.
49
+
50
+ Existing Reviewer `backend = "jev"` and advisor `selector` configurations continue working. The explicit [move Reviewer key](../server/rest-api.md#decision-connections) action transfers a saved legacy key on the server, switches the Reviewer source, then clears that old key. A partial result preserves newer settings: refresh and check the connection and Reviewer before retrying. If the Reviewer key has changed while the target connection still holds the old key, choose a new connection name; conflicting connections are never overwritten. Environment-variable connections require no key transfer.
21
51
 
22
52
  ### Model request format overrides
23
53
 
@@ -44,6 +74,75 @@ Replace the example endpoint and remote IDs with your service's values. Both mod
44
74
 
45
75
  The [model REST API](../server/rest-api.md#models-and-providers) reports the saved `protocol` separately from `effective_protocol`, the resolved request format. Saving a format does not test connectivity.
46
76
 
77
+ ## Request compression
78
+
79
+ Request compression stays off until you configure it. `[request_compression]` applies to every provider that does not set its own table. A provider table replaces individual fields and inherits the rest: an omitted `targets` list, `min_bytes`, or `dictionary` stays as the system set it. `targets`, when set, replaces the system list in order; Kiki does not add the two lists together. Leave the provider key unset to inherit. `encoding = "off"` on a provider turns compression off for that provider even when the system table turns it on. With no system table, only providers that already set `request_compression` compress.
80
+
81
+ ```toml
82
+ [request_compression]
83
+ encoding = "zstd"
84
+ targets = ["https://example.com/v1"]
85
+ min_bytes = 1024
86
+ dictionary = true
87
+
88
+ [providers.gateway.request_compression]
89
+ min_bytes = 0
90
+ ```
91
+
92
+ The provider above keeps zstd, the same targets, and dictionary consent, and changes only the size threshold. Omit `dictionary` to keep the system choice. `dictionary = false` refuses retention for that provider. `dictionary` applies only to zstd. Saving either table applies on the next model request; a request already in flight keeps the settings it started with. `POST /api/config` writes the system table. `GET /api/providers` returns a provider table as saved, including a partial table, `encoding` set to `"off"`, and the original `targets` order.
93
+
94
+ For a gateway that explicitly supports compressed request bodies, this applies to Responses, Messages, and Chat Completions; other protocols keep their existing transport. A saved target does not skip the gateway's own compression support.
95
+
96
+ ```toml
97
+ [providers.gateway.request_compression]
98
+ encoding = "gzip"
99
+ targets = ["https://example.com/v1"]
100
+ min_bytes = 1024
101
+ ```
102
+
103
+ `targets` lists supported HTTP(S) API base URLs. A request must match the origin and path boundary; changing a model to another endpoint does not enable compression there. `min_bytes` counts UTF-8 body bytes and defaults to 1024. Empty, smaller, streaming, already encoded, and non-JSON bodies are left unchanged. Kiki uses the compressed body only when it is smaller. Remove the provider table to inherit again, or set `encoding = "off"` to disable compression for that provider. Remove the system table to leave every unset provider uncompressed.
104
+
105
+ To use ordinary zstd instead, set `encoding = "zstd"`. Neither gzip nor ordinary zstd asks the gateway to retain request bodies. If the gateway also implements the Portway request-dictionary extension, you may explicitly consent to temporary body retention:
106
+
107
+ ```toml
108
+ [providers.gateway.request_compression]
109
+ encoding = "zstd"
110
+ targets = ["https://example.com/v1"]
111
+ dictionary = true
112
+ ```
113
+
114
+ `dictionary = true` asks the gateway to cache exact request bytes, which can include messages, media, tool results, and signatures. Kiki keeps acknowledged dictionaries only in bounded process memory, for up to ten minutes. A dictionary acknowledgement confirms cached bytes, not completed model generation. Every request is still built from the full local history; a changed or compacted history is never reconstructed from guessed model output.
115
+
116
+ Only a marked, pre-execution decoding rejection permits an encoding fallback, with at most three attempts. Transport failures and temporary provider errors before any output use the existing [request retry policy](./config-files.md#retry), even when delivery is uncertain. Native agent turns also retry connection interruptions after partial output by default: Kiki discards the failed attempt's output before resending, and tools run only after a complete response. Failed generations may incur additional charges; set `[retry] retry_partial_responses = false` to disable partial-response replay. Completed tool results remain in local history and are not executed again by this retry. If a target does not support compression, disable it before starting a new request rather than relying on automatic format probing.
117
+
118
+ ## Incremental Responses over WebSocket
119
+
120
+ Responses WebSocket stays off until you configure it. `[responses_web_socket]` applies to every provider that does not set its own table. A provider table replaces that value as a whole. `targets`, when set on the provider, replaces the system list in order and is not added to it. Omit the provider key to inherit. `off = true` keeps that provider on ordinary HTTP even when the system table lists targets. With no system table, only providers that set `responses_web_socket` open a socket. Saving either table applies before the next send, including attempts waiting for a request slot or retry backoff. Each attempt checks the current targets and `off` setting after it gets a slot. An idle socket closes immediately; an already-sent request drains until it completes, fails, or is canceled. If the socket retires during the handshake before sending the request, the attempt uses ordinary HTTP. The next attempt uses a fresh connection or ordinary HTTP under the current setting.
121
+
122
+ For a gateway that advertises the version 1 `X-Responses-WebSocket-Capabilities` handshake, opt in to connection-local Responses history:
123
+
124
+ ```toml
125
+ [responses_web_socket]
126
+ targets = ["https://example.com/v1"]
127
+
128
+ [providers.gateway]
129
+ type = "openai_responses"
130
+ base_url = "https://example.com/v1"
131
+
132
+ [providers.other.responses_web_socket]
133
+ off = true
134
+ ```
135
+
136
+ The target must match the origin and path boundary of the Responses endpoint. A saved target does not skip the handshake. Kiki uses the official OpenAI SDK, keeps one socket per Agent, and sends only new input when the previous completed response still matches the local history. Helper requests, other Agents, and forks do not share that history. Canceling a request closes its socket; model, credentials, policy, and context changes reset the connection or send a full request. Remove the provider table to inherit again, or set `off = true` to keep ordinary HTTP for that provider. Remove the system table to leave every unset provider on ordinary HTTP.
137
+
138
+ The gateway temporarily retains native request and response items on the connection. Unlike HTTP request dictionaries, this state follows completed generation, not dictionary acknowledgements. Unknown output fields are retained in an in-memory sidecar and sent in full rather than used for an incremental request.
139
+
140
+ If the gateway explicitly reports missing history before execution, Kiki sends the full current history once. A pre-execution unsupported upstream format or prompt policy can fall back to a full HTTP request. The transport does not use this fallback for access denials or partial responses. This path supports `response.create` generation only; it does not enable background generation, steering, or `generate:false` warmup.
141
+
142
+ Connection interruptions use the [request retry policy](./config-files.md#retry), including closes before the terminal event with code 1000, 1001, 1006, 1012, or no code. A retry retires the old socket and sends the full current history on a new connection; `previous_response_id` is not a continuation cursor for the interrupted response. A `websocket_connection_limit_reached` event or a structured `websocket_close_error` with an eligible close code is a connection interruption even when a gateway forwards it over HTTP streaming (SSE). An error message alone does not qualify. After 55 minutes of connection use, Kiki proactively replaces its socket before the next request without interrupting a response in progress.
143
+
144
+ Native agent turns can discard partial text, thinking (including encrypted thinking), and unfinished local tool calls before resending. Refusals, provider-hosted tool output, explicit non-retryable errors, and cancellation still stop replay. Each retry appears in the UI and logs, with at most five attempts including the first; configuration can lower this limit but cannot raise it. Failure and retry logs include `transport` (`ws` or `sse`), `webSocketCapabilities`, `webSocketCapabilityVersion`, and `webSocketConnectionAgeMs` for Kiki's local connection; unavailable values are `null`. When the retry budget is exhausted, the final turn error and task failure include the total attempts and configured limit alongside the original provider error. A child task keeps its existing context for `AgentRun` resume.
145
+
47
146
  ## `/provider` — interactive provider management
48
147
 
49
148
  Prefer not to edit TOML by hand? Type `/provider` in the TUI to open the **provider manager**, where you can interactively add or remove providers.
@@ -61,15 +160,17 @@ Two paths when adding:
61
160
 
62
161
  ### Fetching model suggestions
63
162
 
64
- In GUI **Settings → Models & providers**, click **Get models** to fetch suggestions from configured providers. API-key providers and custom registries are fetched only on request, not at startup or on a timer. Fetching does not change your providers, configured models, or default model. Choose a suggestion and save it separately to add a model; an upstream removal does not delete an existing model.
163
+ In GUI **Settings → Models & providers → Providers & accounts**, expand the folded **Maintenance** section at the bottom and click **Get models** to fetch suggestions from every connection. API-key providers and custom registries are fetched only on request, not at startup or on a timer. Fetching these suggestions does not change your providers, configured models, or default model. Choose a suggestion and save it separately to add a model; an upstream removal does not delete an existing model.
164
+
165
+ Kimi Code account sign-in maintains its managed catalog separately. When that catalog refreshes and no global default is set, Kiki selects a managed model even if the catalog itself has not changed. An unchanged catalog preserves explicit defaults, including a choice made while the refresh was in progress.
65
166
 
66
167
  Suggestions are kept in server memory and disappear when the server restarts. Changing or deleting a provider connection discards its cached suggestions. A failed fetch shows an error while retaining the last successful suggestions; a successful empty response clears them. Models already configured for that provider are excluded even if their local aliases differ from the upstream model IDs.
67
168
 
68
- In the GUI, open **Settings → Models & providers → Providers & accounts**. Under **Connect with an API key**, choose one of five protocol entries (`openai`, `openai_responses`, `anthropic`, `google-genai`, `vertexai`) or search for a service by name. A matching service, including DeepSeek, GLM, Kimi, Ollama, LM Studio, or OpenRouter, fills in its protocol and base URL. If there is no match, choose a protocol and enter the base URL yourself. Then enter the key if required and add a model.
169
+ In the GUI, open **Settings → Models & providers → Providers & accounts**. Under **Connect with an API key**, choose one of five protocol entries (`openai`, `openai_responses`, `anthropic`, `google-genai`, `vertexai`) or search for a service by name. A matching service, including DeepSeek, GLM, Kimi, Ollama, LM Studio, or OpenRouter, fills in its protocol and base URL. If there is no match, choose a protocol and enter the base URL yourself. Then enter the key if required, use **Add model** inside the connection form, and choose **Save provider**.
69
170
 
70
171
  Ollama and LM Studio use the same API-key path as other OpenAI-compatible services; their local servers may not require a key. The five quick starts are OpenAI, Anthropic, Google Gemini, DeepSeek, and Moonshot (Kimi) — the Kimi shortcut configures the `kimi` provider described below.
71
172
 
72
- **Available models** lists configured models across providers: search by name or ID, inspect context size and capabilities, and star a model to set the global default. The provider and model also retain their own per-provider default and remote ID. A manually entered Kimi API key uses the same suggestion-only flow as other API-key connections; account sign-in provisions its own models.
173
+ **Providers & accounts** lists configured connections and their **Models** lists. Search by connection name or by the IDs and names of its models; expand a connection to inspect context size and capabilities, then click a model row to open the full editor in a side panel. A model star sets the global new-session default; the **New sessions use** bar above the tabs does the same. **Remove model** is at the bottom of the editor and asks for confirmation. The provider and model also retain their own per-provider default and remote ID. A manually entered Kimi API key uses the same suggestion-only flow as other API-key connections; account sign-in provisions its own models.
73
174
 
74
175
  ::: warning
75
176
  Kimi Code OAuth managed accounts logged in via `/login` do not appear in `/provider`. Use `/login` and `/logout` to manage them.
@@ -83,7 +184,11 @@ For connecting to Moonshot AI's OpenAI-compatible interface, including the Kimi
83
184
 
84
185
  - Default `base_url`: `https://api.moonshot.ai/v1`
85
186
  - Credential key names: `KIMI_API_KEY`, `KIMI_BASE_URL` — these are entries of the `[providers.<name>.env]` sub-table, not shell environment variables
86
- - Additional capability: supports video upload
187
+ - Additional capabilities: video upload and stored image attachment references
188
+
189
+ For `type = "kimi"` models using Chat Completions or Messages on the official endpoints listed in this section, Kiki uploads stored image attachments with the current provider credentials and sends a file reference. Local originals remain unchanged. Remote copies follow the provider's retention policy; closing or deleting the local session does not delete them. Each cached reference is checked with the current credentials before reuse, and a deleted or expired file is uploaded again. Cache entries are isolated by endpoint, protocol, provider, and credentials. Other endpoints and inline image inputs keep their existing inline transport. A temporary upload failure uses the image inline; authentication failures use the existing sign-in recovery.
190
+
191
+ Kiki keeps the attachment size limits enforced by the composer and does not discard older media to meet an additional 20 MiB provider request budget.
87
192
 
88
193
  Kimi Code subscription keys pair with the managed base URL `https://api.kimi.com/coding/v1` (configured automatically by `/login`). Open-platform keys pair with the endpoint of the portal that issued the key: `https://api.moonshot.cn/v1` for keys from [platform.kimi.com](https://platform.kimi.com), or the default `https://api.moonshot.ai/v1` for keys from [platform.kimi.ai](https://platform.kimi.ai).
89
194
 
@@ -134,7 +239,7 @@ api_key = "sk-ant-xxxxx"
134
239
 
135
240
  For connecting to the OpenAI Chat Completions protocol, as well as any third-party service compatible with that protocol (override `base_url` as needed).
136
241
 
137
- Third-party reasoning models (DeepSeek, Qwen, One API, etc.) work out of the box: the CLI automatically handles the `reasoning_content` field and `reasoning_effort` injection. If your gateway returns reasoning content under a non-standard field name, set `reasoning_key` on the model alias to override.
242
+ Third-party reasoning models (DeepSeek, Qwen, One API, etc.) work out of the box: the CLI automatically handles the `reasoning_content` field and `reasoning_effort` injection. OpenAI-compatible Chat connections also retain structured `reasoning_details`, including encrypted records, when restoring conversations and sending subsequent requests. Summaries are shown only when no nonempty string reasoning is returned; encrypted records stay out of the transcript. If your gateway returns reasoning content under a non-standard field name, set `reasoning_key` on the model alias to override.
138
243
 
139
244
  For both `openai` and `openai_responses`, Kiki does not send an output-length limit of its own when you have not set one and the model's capability is unknown — the request carries no `max_tokens`, `max_completion_tokens` or `max_output_tokens`, and the server's own default applies. A limit you set yourself, a known model output capability, a tighter session or profile limit, and a remaining-window budget are all still honored; the context window size on its own is not treated as an output limit. That maximum is a ceiling, not a promise about answer length — what the model returns still depends on the task and on when it stops — and you are billed for the response you actually get.
140
245
 
@@ -296,7 +401,7 @@ GUI **Settings → Models & providers → Identity** is the central page: the le
296
401
  | --- | --- | --- |
297
402
  | Global default | Settings → Models & providers → Identity | `[request_identity]` |
298
403
  | Provider | Settings → Models & providers → provider editor → Request identity | `[providers.<name>.request_identity]` |
299
- | Model | Settings → Models & providers → model editor → Request identity | `[models."<alias>".request_identity]` |
404
+ | Model | Settings → Models & providers → Providers & accounts → expand connection → Models → model row → Request identity | `[models."<alias>".request_identity]` |
300
405
 
301
406
  Later layers override earlier ones (global → provider → model). With no layer set, an ordinary API-key connection uses the built-in Kimi Code identity, and a provider authenticated through the Codex or Grok Build OAuth flows uses that provider's default identity. Choosing a compatible preset clears the lower layers first, then applies that layer's optional sparse `overrides` (for example `lineage.format`, `client.user_agent`, `request.logical_id`). Sending one provider's traffic as OpenCode takes only:
302
407
 
@@ -99,7 +99,7 @@ For **subagent bindings** these rules apply in the GUI, the CLI, `AgentRun` and
99
99
  - **Other hard rules still apply.** The menu intersects with every applicable `allowed_models` list, and a `deny_models` match always rejects. `"*"` cannot widen it. A menu equal to an `allowed_models` list is redundant, not an error; differing lists intersect, and neither layer is ignored.
100
100
  - **`when` is a hint, not a gate.** It is text for the caller and is never evaluated, so a missing or apparently unmet hint changes nothing. `preferred_*` and `discouraged_models` stay advice, and menu order is not a fallback chain.
101
101
  - **An empty set permits nothing.** An empty menu with a default restricts binding to that one model; with neither menu nor default, no candidates, or an empty intersection with another hard domain, the binding is rejected.
102
- - **Resuming does not widen anything.** `resume` revalidates the frozen menu and saved hard rules plus the caller and machine rules in force now, and a rejection leaves the saved binding as it was. Changing the model still needs `allow_model_change: true`, which is not permission to leave the menu. Editing the file does not rewrite existing snapshots: a new binding uses the new definition, an existing session needs an explicit rebind or a new session.
102
+ - **Resuming does not widen anything.** `resume` revalidates the frozen menu and saved hard rules plus the caller and machine rules in force now, and a rejection leaves the saved binding as it was. Changing the model needs an explicit [`context_mode`](./agents-and-subagents.md#named-child-agents) or the legacy `allow_model_change: true` / `new_window: true` confirmation; none permits leaving the menu. Editing the file does not rewrite existing snapshots: a new binding uses the new definition, an existing session needs an explicit rebind or a new session.
103
103
 
104
104
  To get past a subagent rejection, pick a menu entry that also satisfies the other hard rules, or edit the profile. A pin, a manual selection, or confirming a model change are not ways around the menu.
105
105
 
@@ -23,6 +23,12 @@ The main agent dispatches sub-agents on its own as the work calls for it, and yo
23
23
 
24
24
  Each dispatch appears as an approval request unless it matches an allow rule or YOLO mode is active, so you can read the task description before it runs. A sub-agent can run in the background and returns its result to the main agent on completion; you can also resume an existing sub-agent to continue the same task.
25
25
 
26
+ Results also return when a child starts another turn on its own, such as after its background `Bash` finishes or a scheduled prompt fires. A completed turn with a final written result gets a new parent-owned task receipt, including an `output.log` pointer. If the previous task failed, the new `completed` receipt names that task and its status; the earlier `failed` record stays unchanged. If the parent is no longer live or the session is archived, the receipt is retained in the parent's task history for later inspection rather than waking it.
27
+
28
+ A live background-task completion wakes an idle main agent, including while its goal is paused or after the goal completes, is removed, or is replaced. Receiving a result does not resume a paused goal or start its automatic follow-up turns; use `/goal resume` for that. A completion queued just as a successful turn ends is delivered in a new turn without another user message.
29
+
30
+ Cancelling the turn that launched a task or exhausting the current goal's budget prevents its result from waking the idle main agent. Held results are delivered when it next runs, such as when you send another message. Tasks launched after a cancellation can still wake it. A restored `lost` receipt also waits for an available turn and joins an explicit resume instead of starting a competing turn; the external execution outcome remains unconfirmed.
31
+
26
32
  ## Named child agents
27
33
 
28
34
  The main `agent` profile gets three child-agent tools with no experiment flag: `AgentRun`, `AgentList` and `AgentSend`. Built-in subagent profiles do not. Each caller sees only the children it created itself — a grandchild or another caller's child is not a valid target.
@@ -35,14 +41,35 @@ The main `agent` profile gets three child-agent tools with no experiment flag: `
35
41
  | `profile_file` | A subagent role Markdown file, absolute or workspace-relative. It is a role definition rather than a shared prompt template, and cannot be combined with `profile`, `route` or `resume`. |
36
42
  | `route` | A named route of the base profile. |
37
43
  | `name` | A handle for addressing this child again: `^[a-z0-9_]+$`, not `root`, unique within the session. |
44
+ | `source_ref` | A server-generated agent-reference ID from a visible user message. Links the run to that message when its profile and engine match; it does not select a target or change permissions. |
38
45
  | `background` | Omitted, main runs it in the background and a subagent waits in the foreground. `true` and `false` force background and synchronous waiting respectively. |
39
46
  | `model_alias`, `effort` | Omitted, the saved or default values are kept. |
40
47
 
48
+ Each non-native executor descriptor also projects a reserved native target named `engine:<executor-id>`, for example `engine:codex-app-server`, `engine:claude-acp`, `engine:agy-cli` and `engine:grok-acp`. Pass that stable name as `AgentRun`'s `profile` to launch a bare child with the engine's own configuration; no Markdown role profile is required. Ordinary named role profiles keep their existing behavior. If a registered profile already uses the same `engine:<executor-id>` name, that registered definition remains in effect; the virtual projection does not replace it.
49
+
50
+ For a bare engine target, model selection is `AgentRun.model_alias` → `[agent_executor_overrides."<id>".defaults].model_alias` → the vendor's default, and Kiki does not resolve the vendor model through native `[models]` or provider settings. It has no Kiki role, system prompt or profile body, and it does not receive the Kiki MCP bridge merely because it is a child. Explicit per-engine defaults still apply.
51
+
52
+ An explicit `allowed_subagents` list is not widened by projecting these targets; include the exact `engine:<executor-id>` name when the caller may use it. Hard model and effort constraints remain active. If the vendor default cannot be verified against an `allowed_models`, `deny_models` or `allowed_efforts` rule, select an explicit permitted vendor model or effort instead of relying on that default.
53
+
41
54
  A child runs inside the current session and inherits its working directory and declared additional workspace directories by default. A new child may instead set typed `workDir` and `additionalDirs` roots for an already admitted independent writer directory; these roots are mapped through the selected runtime and become the child's actual tool and external-executor roots. Mentioning a path in `prompt` does not add it. `resume` rejects `workDir` and `additionalDirs` and keeps the roots frozen from the original launch. For a separate working directory or worktree owned by a whole conversation, configure that session's working directory first, then dispatch its children.
42
55
 
43
- Workspace inheritance provides context, not a new directory sandbox. Kiki does not invent extra input roots or override an external engine's sandbox; unset model, effort and permission choices keep the [engine's own configuration](#direct-external-execution). Explicitly declared additional directories go through the executor's supported directory interface; an ACP executor that does not declare support records `additional_directories_dropped`. Declaring a directory does not disable explicit permission rules, persisted worktree restrictions or the engine's own sandbox.
56
+ Workspace inheritance provides context, not a new directory sandbox. It does not invent extra input roots or override an external engine's sandbox; unset model, effort and permission choices keep the [engine's own configuration](#direct-external-execution). Explicitly declared additional directories go through the executor's supported directory interface; an ACP executor that does not declare support records `additional_directories_dropped`. Declaring a directory does not disable explicit permission rules, persisted worktree restrictions or the engine's own sandbox.
57
+
58
+ To continue a direct child, set `resume` to its name or agent id; it rejects `name`, `profile`, `profile_file` and `route`. The child must be idle. Choose `context_mode` explicitly when you need to control its next context window:
59
+
60
+ | `context_mode` | Continuation |
61
+ | --- | --- |
62
+ | `direct` | Keep the current context. This is also the default for an ordinary resume. |
63
+ | `compact` | Summarize the current window with the currently bound model, then continue from that summary and saved task state. |
64
+ | `fresh` | Build a new window from saved task state and history references without calling the old model. |
65
+
66
+ All three keep the same child ID, task notes, Todo, full history and workspace roots. Omit `model_alias` and `effort` to keep the saved binding; this also lets you compact or start fresh without changing models. An explicit `model_alias` that selects a different canonical model is confirmed by the chosen `context_mode`, within the same profile, caller, route and machine rules. `compact` and `fresh` rebuild native Kiki context only; external executors reject them rather than replacing the remote session. `[model_switch].default_mode` does not change the ordinary resume default.
44
67
 
45
- To continue a direct child, set `resume` to its name or agent id; it rejects `name`, `profile`, `profile_file` and `route`. `allow_model_change` only matters on `resume` with an explicit `model_alias` that resolves to a different canonical model.
68
+ For example, `AgentRun({ resume: "saved_child", context_mode: "compact", prompt: "Continue the remaining checks.", description: "Continue remaining checks" })` summarizes first and continues with the same model. Add a permitted `model_alias` to continue with a different model after the summary.
69
+
70
+ The legacy parameters remain supported: `allow_model_change: true` confirms a model change while keeping context, and `new_window: true` selects fresh context and also confirms a model change. `new_window: true` takes precedence when both legacy flags are true; `new_window: false` does not veto `allow_model_change: true`. `allow_model_change` requires `resume` and `model_alias`; `new_window` requires `resume`. Do not combine either legacy parameter with `context_mode`, even with a false value.
71
+
72
+ A failed or cancelled summary before commit keeps the old binding and context. If saving the switch fails after commit, recover the original operation before starting new work; the committed summary is reused. If a native child has older prompts held after reopening, an explicit `resume` runs the requested work while keeping that older queue held.
46
73
 
47
74
  A completed provider response is not itself a task receipt. If a completed response contains real thinking but no text or tool calls, Kiki continues within the same turn until text or a tool call arrives, whether or not the thinking has a signature. Existing signatures and usage are preserved without adding another user prompt; step budgets, cancellation and permanent provider errors still stop the turn. Text-free tool steps remain valid, but an agent task still needs a final written result.
48
75
 
@@ -50,7 +77,7 @@ A native child that ends with no content or tool calls fails with `loop.empty_co
50
77
 
51
78
  Inspect the original turn and any saved work before resuming the same child with a new prompt asking it to finish and report the result. SDK callers must use a new prompt ID; repeating an already-settled ID replays its recorded outcome. Kiki does not automatically retry these failures or rewrite earlier task records.
52
79
 
53
- A new launch picks its model from the concrete `model_alias` parameter, then the effective profile, route or caller-lease pin, then an explicitly configured `[subagent].default_model`. With none of those it fails with `model.not_configured` and no child is created, and an unknown alias is an error. Effort resolves separately, from the tool call, the route, the caller lease, the profile, or the model itself — [the full order is below](#named-profile-routes-experimental). Omitted `model_alias` and `effort` on `resume` keep the saved binding; an alias resolving to the same canonical model is a no-op, and a different one needs `allow_model_change: true`.
80
+ A new ordinary role-profile launch picks its model from the concrete `model_alias` parameter, then the effective profile, route or caller-lease pin, then an explicitly configured `[subagent].default_model`. With none of those it fails with `model.not_configured` and no child is created, and an unknown alias is an error. Engine targets use the vendor-default order described above instead. Effort resolves separately, from the tool call, the route, the caller lease, the profile, or the model itself — [the full order is below](#named-profile-routes-experimental). Omitted `model_alias` and `effort` on `resume` keep the saved binding; an alias resolving to the same canonical model is a no-op, and a different one needs an explicit `context_mode` or the legacy `allow_model_change: true` / `new_window: true` confirmation.
54
81
 
55
82
  `preferred_models`, `discouraged_models`, `preferred_efforts` and route or caller-lease pins are soft: a hard-permitted override runs with a structured advisory. `allowed_models`, `deny_models` and `allowed_efforts` are hard in every scope. Machine `[subagent].deny_models`, unsupported model capabilities, route identity, a missing model-change confirmation and executor or thread restrictions are hard errors, and an external executor that cannot change a resumed thread binding returns an error rather than recreating the thread or executor.
56
83
 
@@ -64,7 +91,9 @@ For `AgentRun` model choices, a profile's menu is a candidate list rather than a
64
91
 
65
92
  `AgentList` returns direct children. By default it lists running children and children with no tracking task; pass `include_finished: true` to also get children whose latest background task has already finished or failed. At most 50 entries come back, running ones first.
66
93
 
67
- `AgentSend` gives a direct child the input it needs to continue. A running native child receives it at the next step boundary. Codex and a steer-capable ACP child can receive it during the run. A stopped child, including one whose run ends as the message arrives, continues with the same model, profile, tools, and context, and the parent is notified when that run finishes. Saved messages stay in order on that same binding. `queued` means the message is saved, not that a run is already going. If a continuation cannot start, the saved message stays queued and the sender receives the reason, the error code, the target, and the original message id. Resume that same child with AgentRun: set resume to the target agent id, set prompt to an empty string, and set description to a short label. Do not call AgentSend again, do not repeat the saved message in the prompt, and do not set new_window. A failed external resume does not open a new remote session. Address the child by `name` or agent id.
94
+ Native child turns automatically retry [upstream connection interruptions](../configuration/providers.md#incremental-responses-over-websocket), discarding incomplete output before resending. When the retry budget is exhausted, the task becomes `failed` and its notification includes recovery instructions. Use `AgentRun` with `resume` set to that child's id to continue with its existing context.
95
+
96
+ `AgentSend` gives a direct child the input it needs to continue. A running native child receives it at the next step boundary. Codex and a steer-capable ACP child can receive it during the run. A stopped child, including one whose run ends as the message arrives, continues with the same model, profile, tools, and context, and the parent is notified when that run finishes. Saved messages stay in order on that same binding. `queued` means the message is saved, not that a run is already going. If a continuation cannot start, the saved message stays queued and the sender receives the reason, the error code, the target, and the original message id. Resume that same child with AgentRun: set resume to the target agent id, set prompt to an empty string, and set description to a short label. Do not call AgentSend again, do not repeat the saved message in the prompt, and do not set new_window. A failed external resume does not open a new remote session. ACP recovery uses the saved original session regardless of how permission mode is configured. If the process reconnects before prompt delivery, Kiki restores and verifies the actual session's model, thinking and permission controls before sending; unsupported resume/load, a changed binding or unverifiable controls stop delivery. If startup failed before any remote session or prompt existed, `AgentRun` can retry construction. Kiki saves ACP session and Codex thread references before sending a prompt. An external resume whose delivery was attempted or whose result is unknown is not sent again for the same operation, including after a Kiki restart; inspect the original remote session and saved task result before deciding what to do next. A confirmed pre-send failure remains retryable. Address the child by `name` or agent id.
68
97
 
69
98
  `AgentNotify` goes the other way and is available only to subagents: it queues a fire-and-forget message in the parent agent's mailbox, read at the parent's next step boundary or next run. The main agent has no parent and never receives it. `[agents] notify_parent = false` in `config.toml` turns it off globally; it is on by default.
70
99
 
@@ -74,6 +103,8 @@ Peer-thread communication lets a main agent coordinate other Kiki sessions on th
74
103
 
75
104
  A thread reference identifies a host, workspace and session. `ThreadList` returns the references later calls need, `ThreadRead` reads completed main-agent turns without resuming a cold session, `ThreadSend` derives the source from the current main-agent session, and `ThreadWait` waits up to 60 seconds for activity from up to eight threads. Messages cannot cross hosts.
76
105
 
106
+ During local history preparation, `ThreadRead` may return `turns: []` and `incomplete: "history_preparing"`; that state is not an empty thread. Continue with the returned `nextCursor` in the same scope. Large local input or output can also be previewed with `contentRefs`; use `content_ref` to continue its bounded segment read. [Collaboration Tools](../reference/tools.md#collaboration-tools) documents cursor compatibility, ordering, rewrite invalidation, and segment limits.
107
+
77
108
  A message is recorded as coming from a peer only when the source thread's own main agent calls `ThreadSend`. REST and the `global.threads` Klient facade take target-addressed input only and record it as external-client input, so an external client cannot claim a source thread or a direct human origin.
78
109
 
79
110
  Leave `[thread_communication] enabled` unset to allow the tools and keep the default off. Set `enabled = false` to turn them completely off. A conversation’s own on/off is in the right-hand capabilities list and applies on the next step. Sending can resume a cold target session and consume model quota. A workspace can persist a disable override, but it cannot turn the tools on after a hard off. See [Server API](../server/rest-api.md#session-leases-and-peer-threads) for those interfaces.
@@ -108,9 +139,11 @@ Agent files are watched and reloaded on change. An agent already running or resu
108
139
 
109
140
  ### Choosing the engine and its profile
110
141
 
111
- The control at the left of the composer's status line answers one question — what runs this session — in one panel. Kiki itself is the first entry; each external engine follows, and under each engine sit that engine's own main profiles. The first row of every engine is that harness **as it is**: no Kiki profile, no Kiki prompt, no injected tools, and the harness's own model, effort and approval mode. Picking a profile under an engine takes both at once, so the two halves can never disagree.
142
+ The **Profile** menu at the left of the composer's status line lets you choose Kiki, an external engine, or a named profile. Selecting a profile also selects its engine. For an external engine, its built-in passthrough entry runs the harness **as it is**: no Kiki profile, no Kiki prompt or injected tools, and the harness's own model, effort and approval mode.
143
+
144
+ On the **New session** page, the same menu also has a **Personas** group. Select a [persona](../features/people.md) there; its name and avatar appear in the composer.
112
145
 
113
- The panel also runs a profile straight from a Markdown file. Select the small file button in the search row: on a local desktop, Kiki opens the native file picker and previews the selected file before you choose **Use**; on an SSH, remote, browser or other host without a native path picker, enter the path and choose **Check file** instead. Relative paths resolve against the session's working directory or workspace, and a remote path is read on the host running the session rather than on your machine. A file that is not a main profile — `main: false`, or one that overrides a built-in — works the same way. Nothing is registered or imported: the file is not added to the profile catalog, no existing profile is replaced, and cancelling or closing the picker/form changes neither your draft nor the current selection. A file that cannot be read is refused in place, with the server's own reason.
146
+ The menu also runs a profile straight from a Markdown file. Choose **Use a profile file…**: on a local desktop, Kiki opens the native file picker and previews the selected file before you choose **Use this profile**; on an SSH, remote, browser or other host without a native path picker, enter the path and choose **Check file** instead. Relative paths resolve against the session's working directory or workspace, and a remote path is read on the host running the session rather than on your machine. A file that is not a main profile — `main: false`, or one that overrides a built-in — works the same way. Nothing is registered or imported: the file is not added to the profile catalog, no existing profile is replaced, and cancelling or closing the picker/form changes neither your draft nor the current selection. A file that cannot be read is refused in place, with the server's own reason.
114
147
 
115
148
  Picking a file takes its engine with it — a file declaring an external `executor` runs that engine — so one choice answers both halves. The file supplies what it declares: leave the model and approval controls alone and the file's choices apply, while changing one yourself wins for that message. A session that runs a file keeps running it; changing only the model on the next message carries the same file instead of falling back to the bare harness. **Rebuild context** reads the file again.
116
149
 
@@ -130,9 +163,17 @@ A harness chooses the execution program; a profile is optional customization, an
130
163
 
131
164
  Direct execution preserves the configured launch environment, home and working directory, but the program must resolve to the same executable and settings sources as the CLI you expect. An ACP adapter may launch an SDK-provided binary or a configured override instead of the CLI on PATH; omitting a profile does not make those programs identical. An unknown login observation alone does not prevent launch.
132
165
 
133
- An unset permission mode keeps the engine's own mode, including its auto, YOLO or manual behavior; a native Kiki default or an inherited parent mode is not an external override. An explicit session, profile, harness setting or agent-level permission change applies to the engine. Explicit deny or ask rules, finite tool declarations and a session's persisted worktree isolation still apply. Kiki's native visible-tool catalog is not an allowlist for the engine's own tools.
166
+ An unset permission mode keeps the engine's own mode, including its auto, YOLO or manual behavior; a native Kiki default or an inherited parent mode is not an external override. An explicit session, profile, harness setting or agent-level permission change applies through the engine's native controls. Named external profiles also inherit the harness's `permission_mode` default when they do not declare one, and save that choice with their binding.
134
167
 
135
- Changing only permission mode keeps the remote conversation. Clearing an override returns to the remaining profile or harness setting; when none remains, ACP and Codex restore the engine's saved pre-override policy, including after reopening the Kiki session. An adapter that cannot apply the requested mode or restore its saved policy reports an error rather than silently starting another conversation.
168
+ The engine owns permissions for its native tools. Kiki does not translate those calls into Kiki tool names or file-path approvals, and unknown native tools are not rejected for lacking that translation. Kiki's visible-tool catalog is not an engine allowlist. Kiki-only `review` mode, finite tool allowlists, `disallowed_tools`, deny or ask `permission.rules`, execution restrictions and persisted worktree write isolation cannot currently be enforced through these native interfaces. Such bindings fail before a prompt is sent, naming the unsupported fields; use the native Kiki executor for those restrictions or configure the external engine's own permissions.
169
+
170
+ Changing only permission mode keeps the remote conversation. Clearing an override returns to the remaining profile or harness setting; when none remains, ACP and Codex restore the engine's saved pre-override policy, including after reopening the Kiki session. Codex restores both approval and sandbox policies after Full access. An adapter that cannot apply the requested mode or restore its saved policy reports an error rather than silently starting another conversation.
171
+
172
+ The bundled AGY CLI adapter applies overrides with session-only `--settings`, without writing the engine's global settings: `manual` selects `request-review` with the default agent mode, `auto` selects `request-review` with AGY's auto agent mode, and Full access selects `always-proceed`, `accept-edits`, non-workspace access and no terminal sandbox, plus `--dangerously-skip-permissions`. AGY's explicit deny rules still apply. An idle mode change restarts only the adapter's own CLI process with `--conversation` for the same native conversation; an active turn must finish first. The adapter installs no permission `PreToolUse` hook; its separate steering hook and MCP bootstrap remain available.
173
+
174
+ Resuming a child launched through `engine:<executor-id>` keeps the saved native engine-session contract. Kiki does not silently replace an unavailable or unverifiable native session with a new one; the resume fails with the engine's diagnostic instead. Resume, load and control support still varies by vendor, so a target can be launchable without supporting every recovery operation.
175
+
176
+ An ordinary resume, or `context_mode: "direct"`, with no model override keeps the existing engine session. Changing `effort` requires an explicit vendor model; Kiki does not infer one from the engine-default binding. `context_mode: "compact"`, `context_mode: "fresh"` and legacy `new_window: true` cannot rebuild an external engine's context and return an error without replacing its session.
136
177
 
137
178
  Approval delivery is separate from that choice of policy. ACP and Codex approval requests appear in Kiki's approval interaction when the adapter supports them. A headless CLI that asks for approval but has no supported response channel cannot complete that request: use an adapter with an approval bridge or explicitly choose a supported permission mode for that task, rather than changing the engine's global defaults.
138
179
 
@@ -166,7 +207,7 @@ The bridge attaches to the **existing session**, without creating a separate sea
166
207
 
167
208
  A child's completion is queued back to the same main agent without blocking the child: if the main agent is busy, delivery waits for its turn to settle; if it is idle, the receipt wakes it. An allowed `AgentNotify` call reaches the real parent's mailbox and remains subject to `allow_parent_notify` and the configured notification policy. Closing the executor releases its bridge; a released seat or a destroyed and recreated agent cannot reuse the old connection.
168
209
 
169
- Codex app-server MCP tool calls can require a separate vendor approval, mapped to Kiki's persistent approval interaction. Explicit Kiki Full access (YOLO), without deny or ask rules, finite tool declarations, execution restrictions or worktree isolation, sets Codex's `approvalPolicy` to `never` rather than forcing an approval callback. Other explicit modes or those constraints use `on-request` so Kiki can apply its tool permission checks. Kiki does not widen the Codex sandbox.
210
+ Codex app-server approval requests appear in Kiki's persistent approval interaction with the vendor's decisions intact. Explicit Full access (YOLO) sends `approvalPolicy: "never"` and `sandboxPolicy: { type: "dangerFullAccess" }` for the turn. Explicit `manual` and `auto` use `on-request` approvals and retain the engine's sandbox; Kiki-only restrictions are rejected as described under [direct external execution](#direct-external-execution). Calls through the Kiki MCP bridge still execute as that agent's native Kiki tools, with its existing authorization.
170
211
 
171
212
  Explicit YOLO also adds per-server tool pre-approval for the attached `kiki-harness` MCP server only; native Kiki capability and execution policies still govern its calls. An ambient parent YOLO mode enables neither override. Clearing the explicit mode follows the [permission restoration behavior above](#direct-external-execution).
172
213
 
@@ -210,9 +251,11 @@ Claude and Codex `PreCompact` hooks prepare an auditable handoff snapshot rather
210
251
 
211
252
  ### Rebuilding a session context
212
253
 
213
- After editing prompt sources, open the profile selector in the session composer and choose **Rebuild context**. Kiki reloads the current profile, prompt-field overrides, Agent Skills, `AGENTS.md` instructions and plugin prompt or session-start injections from disk, reconciles the other runtime context injections, and uses the rebuilt snapshot for later requests. Sources added since the session started are picked up as well, while anything you switched off stays off.
254
+ After editing prompt sources, open the **+** menu in the session composer, choose **Rebuild context**, and confirm. Kiki reloads the current profile, prompt-field overrides, Agent Skills, `AGENTS.md` instructions and plugin prompt or session-start injections from disk, reconciles the other runtime context injections, and uses the rebuilt snapshot for later requests. Sources added since the session started are picked up as well, while anything you switched off stays off.
255
+
256
+ A saved session can be rebuilt even after Kiki has released its inactive runtime: Kiki restores that same session for the action. Its messages, history, draft, permissions and execution binding are kept, and the rebuild itself sends nothing to the model. It applies to the main agent and is unavailable while a turn is running or queued. Notifications waiting for the next turn stay queued and do not block rebuilding. If rebuilding fails, the error appears in the conversation; correct the reported source problem and choose **Rebuild context** again.
214
257
 
215
- Rebuilding stays inside the same conversation: its messages, history and draft are kept, and the rebuild itself sends nothing to the model. It applies to the main agent and needs a turn boundary, so it is unavailable while a turn is running or while the queue still holds work. It is not a way to switch the agent, engine or model. The conversation's MCP servers are re-read as part of it: a server the configuration enabled since the session started joins the list, and a server you switched off here stays off. The **+** menu's **MCP servers** row is where one is added or removed for this conversation (see [Interface overview](../guides/interface.md#input-box)).
258
+ Rebuilding is not a way to switch the agent, engine or model. For an external engine, Kiki refreshes its host-side sources without restarting the external session or sending it a new prompt. The conversation's MCP servers are re-read as part of it: a server the configuration enabled since the session started joins the list, and a server you switched off here stays off. The **+** menu's **MCP servers** row is where one is added or removed for this conversation (see [Interface overview](../guides/interface.md#input-box)).
216
259
 
217
260
  **Child agents** on a profile is where you decide whether this agent may start others. Open **Settings → Models & agents → Agents** and that section on the profile. **Allow creating child agents** is separate from whether a saved model, profile, or effort is still valid: **Not declared** follows the layer above, **Allowed** permits child agents, and **Off** stops presets, routes, and a definition supplied by path. **Preset list** chooses which named presets and routes it may start. **Recommended first** is only an order: it does not grant or deny a child, and a name outside that list stays allowed when the preset list allows it. **Never dispatch** refuses those names even when the preset list would allow them. A model or preset the catalog does not have is reported on the profile; a catalog that is still loading does not by itself invalidate a saved choice, and this check does not ask an external provider whether it is up. [Plan mode](../reference/tools.md#plan-mode) can still limit a launch to read-only research. If a model, profile, or effort is unavailable, pick a valid value before sending.
218
261
 
@@ -433,7 +476,7 @@ Resume never reselects or switches a route: the journal stores the canonical bas
433
476
 
434
477
  A new child picks its model from the concrete `model_alias` parameter, then the pin on the effective profile, route or caller lease, then an explicitly configured `[subagent].default_model`; with none of them the spawn fails with `model.not_configured` and no child is created, and the caller's model is not a silent fallback. Set `model_alias: inherit` in a profile, route or caller lease to bind the caller's resolved model explicitly — `AgentRun` itself rejects `model_alias: "inherit"`, so pass a concrete name or omit the parameter. With configured inheritance the caller's effort follows too, unless a tool `effort` or an applicable `thinking_effort` pin takes priority; otherwise effort resolves as tool `effort` → the route's locked effort, or the caller lease's when the route pins none → matching `model_profiles` effort → profile `thinking_effort` when the bound model matches the profile pin → the bound model's own default. When none supplies an effort, a model known not to support thinking uses `off`; a thinking model without a resolvable default still needs an explicit effort. Unknown capabilities do not imply `off`, and an unknown alias is an error wherever it came from.
435
478
 
436
- On `resume`, omitting both `model_alias` and `effort` keeps the saved binding, and an alias resolving to the same canonical model is a no-op. Changing only `effort` applies it to the next idle run. Changing `model_alias` to a different canonical model needs `allow_model_change: true`, and with `effort` also omitted the target model's own default is re-resolved rather than carried over. Profile, lease, model-profile and inherited hard rules are checked at resume admission, and a rejection leaves the saved binding unchanged; an effort the provider cannot honor, a machine model denial and executor thread-binding restrictions are hard errors too.
479
+ On `resume`, omitting both `model_alias` and `effort` keeps the saved binding, and an alias resolving to the same canonical model is a no-op. Changing only `effort` applies it to the next idle run. Changing `model_alias` to a different canonical model needs an explicit `context_mode` or the legacy `allow_model_change: true` / `new_window: true` confirmation, and with `effort` also omitted the target model's own default is re-resolved rather than carried over. Profile, lease, model-profile and inherited hard rules are checked at resume admission, and a rejection leaves the saved binding unchanged; an effort the provider cannot honor, a machine model denial and executor thread-binding restrictions are hard errors too.
437
480
 
438
481
  Omit `model_alias` and `effort` to use the target's defaults for a new child. The model catalog lists hard-permitted configured models and marks the preferences coming from the effective profile, lease, route and model-profile entries; a model listed for another target is neither preferred nor allowed here. Pair `preferred_models` with a default `model_alias` to publish a preferred pool, and keep `model_profiles` for per-model defaults and guidance. A route's `service_tier`, including `service_tier: null`, does not clear a configured model-level tier.
439
482