kiki-agent 0.5.0 → 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 (230) 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 +92 -30
  4. package/dist/docs/en/configuration/data-locations.md +14 -9
  5. package/dist/docs/en/configuration/env-vars.md +32 -2
  6. package/dist/docs/en/configuration/overrides.md +1 -1
  7. package/dist/docs/en/configuration/providers.md +44 -10
  8. package/dist/docs/en/customization/agent-profiles.md +1 -1
  9. package/dist/docs/en/customization/agents-and-subagents.md +49 -10
  10. package/dist/docs/en/customization/hooks.md +3 -3
  11. package/dist/docs/en/customization/personas.md +1 -1
  12. package/dist/docs/en/customization/plugins.md +16 -3
  13. package/dist/docs/en/customization/prompt-fields.md +62 -6
  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/browser-and-computer.md +5 -5
  18. package/dist/docs/en/features/daily.md +3 -3
  19. package/dist/docs/en/features/ecosystem.md +1 -1
  20. package/dist/docs/en/features/extend.md +2 -2
  21. package/dist/docs/en/features/freedom.md +1 -1
  22. package/dist/docs/en/features/index.md +15 -1
  23. package/dist/docs/en/features/long-work.md +9 -5
  24. package/dist/docs/en/features/look.md +1 -1
  25. package/dist/docs/en/features/phone.md +11 -3
  26. package/dist/docs/en/features/spaces.md +5 -5
  27. package/dist/docs/en/getting-started/desktop-app.md +4 -8
  28. package/dist/docs/en/getting-started/first-launch.md +1 -1
  29. package/dist/docs/en/guides/goals.md +4 -2
  30. package/dist/docs/en/guides/interface.md +18 -8
  31. package/dist/docs/en/guides/memory.md +64 -10
  32. package/dist/docs/en/guides/sessions.md +15 -7
  33. package/dist/docs/en/guides/settings.md +49 -38
  34. package/dist/docs/en/index.md +3 -1
  35. package/dist/docs/en/reference/command.md +35 -33
  36. package/dist/docs/en/reference/model-vocabulary.md +2 -2
  37. package/dist/docs/en/reference/slash-commands.md +1 -1
  38. package/dist/docs/en/reference/tools.md +40 -15
  39. package/dist/docs/en/server/acp.md +6 -2
  40. package/dist/docs/en/server/local-server.md +19 -27
  41. package/dist/docs/en/server/mcp.md +4 -4
  42. package/dist/docs/en/server/rest-api.md +240 -23
  43. package/dist/docs/en/server/script-tools.md +268 -0
  44. package/dist/docs/zh/configuration/config-files.md +92 -30
  45. package/dist/docs/zh/configuration/data-locations.md +14 -9
  46. package/dist/docs/zh/configuration/env-vars.md +32 -2
  47. package/dist/docs/zh/configuration/overrides.md +1 -1
  48. package/dist/docs/zh/configuration/providers.md +44 -10
  49. package/dist/docs/zh/customization/agent-profiles.md +1 -1
  50. package/dist/docs/zh/customization/agents-and-subagents.md +49 -10
  51. package/dist/docs/zh/customization/hooks.md +3 -3
  52. package/dist/docs/zh/customization/personas.md +1 -1
  53. package/dist/docs/zh/customization/plugins.md +16 -3
  54. package/dist/docs/zh/customization/prompt-fields.md +62 -6
  55. package/dist/docs/zh/customization/recipes.md +77 -0
  56. package/dist/docs/zh/customization/skins.md +2 -2
  57. package/dist/docs/zh/customization/themes.md +1 -1
  58. package/dist/docs/zh/features/browser-and-computer.md +5 -5
  59. package/dist/docs/zh/features/daily.md +3 -3
  60. package/dist/docs/zh/features/ecosystem.md +1 -1
  61. package/dist/docs/zh/features/extend.md +2 -2
  62. package/dist/docs/zh/features/freedom.md +1 -1
  63. package/dist/docs/zh/features/index.md +16 -2
  64. package/dist/docs/zh/features/long-work.md +9 -5
  65. package/dist/docs/zh/features/look.md +1 -1
  66. package/dist/docs/zh/features/phone.md +11 -3
  67. package/dist/docs/zh/features/spaces.md +5 -5
  68. package/dist/docs/zh/getting-started/desktop-app.md +4 -8
  69. package/dist/docs/zh/getting-started/first-launch.md +1 -1
  70. package/dist/docs/zh/guides/goals.md +4 -2
  71. package/dist/docs/zh/guides/interface.md +18 -8
  72. package/dist/docs/zh/guides/memory.md +64 -10
  73. package/dist/docs/zh/guides/sessions.md +15 -7
  74. package/dist/docs/zh/guides/settings.md +49 -38
  75. package/dist/docs/zh/index.md +4 -2
  76. package/dist/docs/zh/reference/command.md +35 -33
  77. package/dist/docs/zh/reference/model-vocabulary.md +2 -2
  78. package/dist/docs/zh/reference/slash-commands.md +1 -1
  79. package/dist/docs/zh/reference/tools.md +40 -15
  80. package/dist/docs/zh/server/acp.md +6 -2
  81. package/dist/docs/zh/server/local-server.md +19 -27
  82. package/dist/docs/zh/server/mcp.md +4 -4
  83. package/dist/docs/zh/server/rest-api.md +229 -23
  84. package/dist/docs/zh/server/script-tools.md +268 -0
  85. package/dist/external-harness/agy-cli-acp.mjs +168 -162
  86. package/dist/external-harness/agy-hook-registration.mjs +69 -30
  87. package/dist/external-harness/agy-mcp-plugin.mjs +19 -0
  88. package/dist/external-harness/agy-permission-hook.mjs +29 -2
  89. package/dist/hostRunner.mjs +24 -6
  90. package/dist/mailbox-worker.mjs +111 -5
  91. package/dist/main.mjs +2 -2
  92. package/dist/memory-worker.mjs +1008 -0
  93. package/dist/native/windows-process-helper.exe +0 -0
  94. package/dist/query-store-worker.mjs +52 -11
  95. package/dist/sqlite-indexer.mjs +32 -2
  96. package/dist/sqlite-query-worker.mjs +35 -0
  97. package/dist/usage-parser-worker.mjs +3953 -4
  98. package/dist/usage-read-model-worker.mjs +761 -0
  99. package/dist/web/assets/{AppErrorBoundary-BN6IDdP1.js → AppErrorBoundary-B5Fc4f6-.js} +1 -1
  100. package/dist/web/assets/NavScopeBoundary-C7MnGQio.js +1 -0
  101. package/dist/web/assets/{arc-C7IAvCCJ.js → arc-DGB9OVgQ.js} +1 -1
  102. package/dist/web/assets/{architectureDiagram-3BPJPVTR-CbwFBxn7.js → architectureDiagram-3BPJPVTR-glnQCMub.js} +1 -1
  103. package/dist/web/assets/{blockDiagram-GPEHLZMM-B20N4t8r.js → blockDiagram-GPEHLZMM-bM0tnGby.js} +1 -1
  104. package/dist/web/assets/{c4Diagram-AAUBKEIU-3BYtlcP-.js → c4Diagram-AAUBKEIU-DMf_rTtt.js} +1 -1
  105. package/dist/web/assets/channel-Cj8SKJ38.js +1 -0
  106. package/dist/web/assets/{chunk-2J33WTMH-CpjgczxM.js → chunk-2J33WTMH-mTccJ3tW.js} +1 -1
  107. package/dist/web/assets/{chunk-4BX2VUAB-BScxUF5G.js → chunk-4BX2VUAB-DhqPYMjY.js} +1 -1
  108. package/dist/web/assets/{chunk-55IACEB6-CrcLYJXd.js → chunk-55IACEB6-BujrYRoO.js} +1 -1
  109. package/dist/web/assets/{chunk-727SXJPM-BwlyIOjw.js → chunk-727SXJPM-ciMmSI4G.js} +1 -1
  110. package/dist/web/assets/{chunk-AQP2D5EJ-DKKIRkRv.js → chunk-AQP2D5EJ-CZW9pKTc.js} +1 -1
  111. package/dist/web/assets/{chunk-FMBD7UC4-CVDMj2kX.js → chunk-FMBD7UC4-hdALNnnU.js} +1 -1
  112. package/dist/web/assets/{chunk-ND2GUHAM-CL-PM6r8.js → chunk-ND2GUHAM-CgKyqUdb.js} +1 -1
  113. package/dist/web/assets/{chunk-QZHKN3VN-DPV2KbKZ.js → chunk-QZHKN3VN-B2mmUz_E.js} +1 -1
  114. package/dist/web/assets/classDiagram-4FO5ZUOK-f8V9p-dD.js +1 -0
  115. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-f8V9p-dD.js +1 -0
  116. package/dist/web/assets/client-ClWQBErG.js +3 -0
  117. package/dist/web/assets/connection-C0J3BPgk.js +1 -0
  118. package/dist/web/assets/{cose-bilkent-S5V4N54A-D1CEiQM6.js → cose-bilkent-S5V4N54A-UV3uPjkK.js} +1 -1
  119. package/dist/web/assets/{dagre-BM42HDAG-BlFV941E.js → dagre-BM42HDAG-Zjy-gQ6C.js} +1 -1
  120. package/dist/web/assets/{diagram-2AECGRRQ-BC0ldkFY.js → diagram-2AECGRRQ-DL-kilIf.js} +1 -1
  121. package/dist/web/assets/{diagram-5GNKFQAL-B22Iej6G.js → diagram-5GNKFQAL-CjB_xR5B.js} +1 -1
  122. package/dist/web/assets/{diagram-KO2AKTUF-B75UNw6D.js → diagram-KO2AKTUF-CjN4i3b9.js} +1 -1
  123. package/dist/web/assets/{diagram-LMA3HP47-CypI7IJM.js → diagram-LMA3HP47-CPCAMndo.js} +1 -1
  124. package/dist/web/assets/{diagram-OG6HWLK6-OsXumvcD.js → diagram-OG6HWLK6-DVeBWBKd.js} +1 -1
  125. package/dist/web/assets/{erDiagram-TEJ5UH35-3756GOvS.js → erDiagram-TEJ5UH35-CHKzBHrr.js} +1 -1
  126. package/dist/web/assets/export-CXoWon32.js +2 -0
  127. package/dist/web/assets/{flowDiagram-I6XJVG4X-DB6Y_UDg.js → flowDiagram-I6XJVG4X-C5rQa2pq.js} +1 -1
  128. package/dist/web/assets/{ganttDiagram-6RSMTGT7-CHJeuoAY.js → ganttDiagram-6RSMTGT7-BrLjEsNJ.js} +1 -1
  129. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-Dj85554Y.js → gitGraphDiagram-PVQCEYII-3DRR5VZj.js} +1 -1
  130. package/dist/web/assets/highlighted-body-OFNGDK62-Bdj5SJfv.js +1 -0
  131. package/dist/web/assets/index-2Vx5mHRn.js +1 -0
  132. package/dist/web/assets/index-B1UXw2C9.js +1 -0
  133. package/dist/web/assets/{index-C6qeLCPw.js → index-BJxtlf4P.js} +4 -4
  134. package/dist/web/assets/{index-DxUmR9aV.js → index-BY7jPurv.js} +1 -1
  135. package/dist/web/assets/index-Bq79v-Sa.js +1 -0
  136. package/dist/web/assets/index-BqD3iTIl.js +1 -0
  137. package/dist/web/assets/index-Br3AlBrQ.js +1 -0
  138. package/dist/web/assets/{index-DZMkZKhW.js → index-BvRBCpc6.js} +2 -2
  139. package/dist/web/assets/index-BxYCSNg_.js +3 -0
  140. package/dist/web/assets/{index-CJqIcuAl.js → index-C62wjCF_.js} +1 -1
  141. package/dist/web/assets/index-CBvwNH_H.js +1 -0
  142. package/dist/web/assets/{index-DRMjjql1.js → index-CG9e6lgq.js} +1 -1
  143. package/dist/web/assets/{index-C7mOS2T4.js → index-CPSWYh_R.js} +2 -2
  144. package/dist/web/assets/index-CS4xJLZV.js +1 -0
  145. package/dist/web/assets/index-CjvqtF2I.js +1 -0
  146. package/dist/web/assets/index-CprdjRRk.js +13 -0
  147. package/dist/web/assets/{index-bYtKyBMB.js → index-CypTtrCB.js} +1 -1
  148. package/dist/web/assets/{index-DqK8MfQN.js → index-DDJQGcUL.js} +1 -1
  149. package/dist/web/assets/index-DLWzxUOO.js +1 -0
  150. package/dist/web/assets/index-DQxkxZmn.js +7 -0
  151. package/dist/web/assets/index-DRo5Y_9p.js +1 -0
  152. package/dist/web/assets/index-De_LkTZx.js +1 -0
  153. package/dist/web/assets/{index-0tHq8zh2.js → index-DfUpwUTM.js} +2 -2
  154. package/dist/web/assets/{index-D--cw39y.js → index-Dkbz748K.js} +2 -2
  155. package/dist/web/assets/index-DmwFFSkV.js +1 -0
  156. package/dist/web/assets/index-DpcWEDhW.js +1 -0
  157. package/dist/web/assets/index-Dqq1RDP4.js +1 -0
  158. package/dist/web/assets/index-H1uMvIoa.css +1 -0
  159. package/dist/web/assets/index-ICHWJ2SM.js +1 -0
  160. package/dist/web/assets/index-O5fSd569.js +229 -0
  161. package/dist/web/assets/index-odjtqLLS.js +1 -0
  162. package/dist/web/assets/index-v_yAQ0Am.js +1 -0
  163. package/dist/web/assets/{infoDiagram-5YYISTIA-DeDPIdEH.js → infoDiagram-5YYISTIA-CCwV4Z0v.js} +1 -1
  164. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-ButuBiBW.js → ishikawaDiagram-YF4QCWOH-BwwZcGyZ.js} +1 -1
  165. package/dist/web/assets/{journeyDiagram-JHISSGLW-Dlbmqm-j.js → journeyDiagram-JHISSGLW-Dc6WqniQ.js} +1 -1
  166. package/dist/web/assets/{kanban-definition-UN3LZRKU-tlQK1cOz.js → kanban-definition-UN3LZRKU-DVUqULOS.js} +1 -1
  167. package/dist/web/assets/{linear-iXuNfUWp.js → linear-d6rWsNOU.js} +1 -1
  168. package/dist/web/assets/memoryAdvisor-DBQXJB1o.js +1 -0
  169. package/dist/web/assets/mermaid-GHXKKRXX-Ik6SkVDT.js +642 -0
  170. package/dist/web/assets/{mindmap-definition-RKZ34NQL-2qPv-mwT.js → mindmap-definition-RKZ34NQL-_JHAkhHL.js} +1 -1
  171. package/dist/web/assets/navViewState-DaCMIYWA.js +1 -0
  172. package/dist/web/assets/{pieDiagram-4H26LBE5-CrLe1C-O.js → pieDiagram-4H26LBE5-BlhlygGy.js} +1 -1
  173. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-DfeIFxc0.js → quadrantDiagram-W4KKPZXB-jn6R_C0S.js} +1 -1
  174. package/dist/web/assets/{requirementDiagram-4Y6WPE33-BWtjdxie.js → requirementDiagram-4Y6WPE33-B9fXCHBr.js} +1 -1
  175. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-B5TxJ6mb.js → sankeyDiagram-5OEKKPKP-fPJwIxkl.js} +1 -1
  176. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-Cf92ZCl1.js → sequenceDiagram-3UESZ5HK-1v1DTNGt.js} +1 -1
  177. package/dist/web/assets/{spaces-DqMTtCXX.js → spaces-CvL2DRZM.js} +1 -1
  178. package/dist/web/assets/{stateDiagram-AJRCARHV-NR9I-Q4d.js → stateDiagram-AJRCARHV-CEc_PLov.js} +1 -1
  179. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-iAMctzaT.js +1 -0
  180. package/dist/web/assets/theme-LRSmy8mD.js +1 -0
  181. package/dist/web/assets/{timeline-definition-PNZ67QCA-CBAOVMfm.js → timeline-definition-PNZ67QCA-CEjhuitj.js} +1 -1
  182. package/dist/web/assets/{vennDiagram-CIIHVFJN-C68x6TdS.js → vennDiagram-CIIHVFJN-CActt9h9.js} +1 -1
  183. package/dist/web/assets/{wardley-L42UT6IY-DuZZr5jm.js → wardley-L42UT6IY-Bp3q2izt.js} +1 -1
  184. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-D6dVGtHd.js → wardleyDiagram-YWT4CUSO-C_zutiQ2.js} +1 -1
  185. package/dist/web/assets/{xychartDiagram-2RQKCTM6-DYLUhZX4.js → xychartDiagram-2RQKCTM6-CRafvv33.js} +1 -1
  186. package/dist/web/icons/apple-touch-icon.png +0 -0
  187. package/dist/web/icons/icon-192.png +0 -0
  188. package/dist/web/icons/icon-512.png +0 -0
  189. package/dist/web/icons/maskable-512.png +0 -0
  190. package/dist/web/index.html +12 -2
  191. package/dist/web/manifest.webmanifest +16 -0
  192. package/native/auth-native/prebuilds/linux-arm64/auth-native.node +0 -0
  193. package/native/auth-native/prebuilds/linux-x64/auth-native.node +0 -0
  194. package/native/auth-native/prebuilds/win32-arm64/auth-native.node +0 -0
  195. package/native/auth-native/prebuilds/win32-x64/auth-native.node +0 -0
  196. package/package.json +22 -3
  197. package/dist/web/assets/LifeMark-UBMVaTWr.js +0 -1
  198. package/dist/web/assets/NavScopeBoundary-BCryw-UG.js +0 -1
  199. package/dist/web/assets/channel-BJs5vJuh.js +0 -1
  200. package/dist/web/assets/classDiagram-4FO5ZUOK-BookeACB.js +0 -1
  201. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BookeACB.js +0 -1
  202. package/dist/web/assets/client-CXcrCawx.js +0 -3
  203. package/dist/web/assets/connection-C8nwzwXB.js +0 -1
  204. package/dist/web/assets/export-Bn8PqPg4.js +0 -2
  205. package/dist/web/assets/highlighted-body-OFNGDK62-DMgPHetp.js +0 -1
  206. package/dist/web/assets/index-7ySDqvaN.css +0 -1
  207. package/dist/web/assets/index-B0KPRi1U.js +0 -166
  208. package/dist/web/assets/index-B599VnpP.js +0 -1
  209. package/dist/web/assets/index-BFK-GypQ.js +0 -1
  210. package/dist/web/assets/index-BPX8gmpB.js +0 -1
  211. package/dist/web/assets/index-BSGYc1tb.js +0 -1
  212. package/dist/web/assets/index-BTt9Q5iv.js +0 -1
  213. package/dist/web/assets/index-BWzUsoY_.js +0 -1
  214. package/dist/web/assets/index-BYlSV3FO.js +0 -3
  215. package/dist/web/assets/index-BpXQ1q-u.js +0 -1
  216. package/dist/web/assets/index-BqPxpGUh.js +0 -1
  217. package/dist/web/assets/index-C8OFfbEs.js +0 -1
  218. package/dist/web/assets/index-CI7yuMGZ.js +0 -1
  219. package/dist/web/assets/index-CTRJmDep.js +0 -1
  220. package/dist/web/assets/index-CXGCKoId.js +0 -1
  221. package/dist/web/assets/index-CsY571EL.js +0 -13
  222. package/dist/web/assets/index-CwQG_9rB.js +0 -1
  223. package/dist/web/assets/index-D260jsUJ.js +0 -1
  224. package/dist/web/assets/index-DJjmEXx4.js +0 -1
  225. package/dist/web/assets/index-DUxOVxHS.js +0 -1
  226. package/dist/web/assets/index-GK8aa9pT.js +0 -7
  227. package/dist/web/assets/index-wxHFHTgD.js +0 -1
  228. package/dist/web/assets/mermaid-GHXKKRXX-sDJax95P.js +0 -624
  229. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-BiegFWxE.js +0 -1
  230. package/dist/web/assets/theme-6OL1RXgY.js +0 -1
@@ -33,10 +33,30 @@ Reloading a file and applying a setting have different timing:
33
33
  | Setting | When it takes effect |
34
34
  | --- | --- |
35
35
  | [`request_governance`](#request-governance) | Re-evaluates waiting requests and agent admissions as soon as the edit is loaded; active work finishes normally |
36
+ | [`cpu_workers`](#cpu-workers) | Next process start; the pool reads the section when the App service is created |
37
+ | [`session_residency`](#session-residency) | The next restore or eviction decision; changing restore limits wakes queued restores, but does not interrupt an active restore. The sweep timer interval is set when the service starts |
38
+ | [`transcript_memory`](#transcript-memory) | The next cache admission, eviction, or residency-maintenance pass; an in-progress read is not canceled |
36
39
  | Session defaults such as `default_model`, `default_permission_mode`, and `default_plan_mode` | New sessions; an existing session keeps its own choices |
37
40
  | [`identity`](#identity) | Next process start |
38
41
  | [`tui.toml`](#tui-toml) | Next start, or `/reload-tui` in the TUI |
39
42
 
43
+ The resource formulas below are resolved from the host hardware when the process starts. Explicit values from `config.toml` or an environment variable override the formula exactly; they are not rewritten to the old upper bounds.
44
+
45
+ ## Hardware-scaled resource defaults
46
+
47
+ When a resource field is omitted, Kiki derives it from the host instead of using one fixed machine size. Let `C = os.availableParallelism()`, `M = floor(totalmem / MiB)`, `H = max(512, floor(M / 64))` MiB, and `W = max(1, min(C - 1, floor(M / 4 / H)))`. The `C - 1` term leaves one parallelism slot for the host, while the minimums keep small machines usable.
48
+
49
+ | Area | Adaptive default | What remains configurable or unchanged |
50
+ | --- | --- | --- |
51
+ | CPU workers | `max_workers = W`; `max_queue = max(128, 16W)`; `max_queued_bytes = max(64, floor(M / 128))` MiB | `KIKI_CPU_MAX_WORKERS`, `KIKI_CPU_MAX_QUEUE`, `KIKI_CPU_MAX_QUEUED_BYTES`, and `KIKI_CPU_TIMEOUT_MS` still override the matching fields. `timeout_ms` remains 30 seconds. The actual pool size is still capped at `C - 1` |
52
+ | Session residency | `max_live_sessions = max(16, floor(M / 128))`; `max_concurrent_restores = W`; `max_queued_restores = max(128, 16C)`; `max_resident_heap_bytes = min(max(256, floor(M / 8)) MiB, 60% of the effective V8 heap)` | Idle and sweep timers remain 10 minutes, 1 minute, and 30 seconds. Explicit session values remain overrides |
53
+ | Worker-backed storage and parsing | SQLite query, mailbox, memory, usage, and kap parser workers use `H` MiB; storage-worker waiting queues default to `max(128, 16C)` | SQLite keeps a single writer; parser backpressure is unchanged |
54
+ | Search | The one query worker uses `H` MiB, keeps 8 active slots, and queues `max(128, 16C)` requests. The indexer child uses `H` MiB with soft RSS `2H + 256` MiB and hard RSS `3H + 256` MiB | Explicit indexer options still win over `KIKI_SEARCH_INDEXER_SOFT_MB` / `KIKI_SEARCH_INDEXER_HARD_MB`, which win over these defaults. Search keeps one writer |
55
+ | Transcript detail | The single-detail cache defaults to `H` MiB | `tail_turns = 20` and `max_agent_bytes = 16` MiB remain unchanged; each single-page read is still independently bounded |
56
+ | Request governance | `max_queue_size = max(1024, 4 × max(128, 16C))` | `rules = []` and the 300-second wait budget remain unchanged. User rules and an explicitly configured queue size still win; this local queue is not a provider rate limit |
57
+
58
+ The resource values in the sections below are explicit override examples, not the hardware defaults. The desktop launcher gives a sidecar an explicit target heap of `max(8192, floor(totalmem / MiB / 4))` MiB. Native SEA profiles use no CLI heap flag and let `NODE_OPTIONS` remain the user's authoritative override. 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 that target and the user has not supplied a heap override. Default interactive `kiki`, resume/continue, `web`, and `serve --ensure/--query/--stop` are daemon clients and do not auto-restart; newly spawned daemons receive their target before launch. Short-lived commands such as `--version`, tool calls, and completion do not restart. Do not assume one fixed V8 heap size across machines.
59
+
40
60
  `/reload` remains available in the TUI to explicitly reload `config.toml` and `tui.toml`. Settings with a turn or session snapshot use the timing documented in their own section; automatic file reload does not replace an in-progress request.
41
61
 
42
62
  ## Complete example
@@ -105,7 +125,7 @@ pattern = "Bash(rm -rf*)"
105
125
  [[hooks]]
106
126
  event = "PreToolUse"
107
127
  matcher = "Bash"
108
- command = "node ~/.kiki/hooks/check-bash.mjs"
128
+ command = "node \"$KIKI_HOME/hooks/check-bash.mjs\""
109
129
  timeout = 5
110
130
  ```
111
131
 
@@ -123,7 +143,11 @@ kiki_context = []
123
143
  allow_kiki_subagents = false
124
144
  ```
125
145
 
126
- Omit model, effort and permission fields to let the harness choose them. `kiki_context` accepts `memory`, `board`, `cron`, `threads`, `history` and `hooks`; `[]` explicitly disables all groups, and `allow_kiki_subagents = false` explicitly disables delegation. An omitted profile field inherits the harness settings in this execution path. Changing settings does not rewrite an existing binding: select the execution again or explicitly rebuild its context to adopt them.
146
+ Omit model, effort and permission fields to let the harness choose them. `kiki_context` accepts `memory`, `board`, `cron`, `threads`, `history` and `hooks`; `[]` explicitly disables all groups, and `allow_kiki_subagents = false` explicitly disables delegation. An omitted profile field inherits the harness settings in this execution path. Named external role profiles also inherit `defaults.permission_mode` when they do not declare a mode. External permission support and rejected Kiki-only restrictions are described under [direct external execution](../customization/agents-and-subagents.md#direct-external-execution). Changing settings does not rewrite an existing binding: select the execution again or explicitly rebuild its context to adopt them.
147
+
148
+ Every non-native executor descriptor also projects a reserved native target named `engine:<executor-id>`, such as `engine:codex-app-server`, `engine:claude-acp`, `engine:agy-cli` or `engine:grok-acp`. `AgentRun` can use that name as its `profile` to start a child with the engine's own configuration; it does not require a Markdown role profile. Ordinary named role profiles keep their existing behavior. For a bare engine target, model selection is explicit `AgentRun` value → `[agent_executor_overrides."<id>".defaults].model_alias` → the vendor's own default. The model ID is not resolved through Kiki's native `[models]` or provider settings.
149
+
150
+ A bare engine target has no Kiki role, system prompt or profile body by default, and being a child does not by itself open the Kiki MCP bridge. Explicit per-engine defaults remain in force: `inject_kiki_mcp`, `kiki_context`, `allow_kiki_subagents` and `executor_prompt` can still request the corresponding bridge, context or prompt behavior when the engine supports it. The bridge itself is still filtered by the existing tool, path and approval rules.
127
151
 
128
152
  `native_agent` selects the vendor's own agent. It is a session override or a value in these defaults, not a profile field. JSON `null` on the session override clears that choice and inherits the defaults value. Omit it, or set `engine-default`, to keep the vendor's default agent; Kiki then does not send a custom agent selection. A newly chosen value must be one the executor has already advertised. Missing discovery keeps an existing choice when the executor, that agent, and the descriptor revision still match; a discovery list that omits the value is rejected and the current binding stays.
129
153
 
@@ -301,7 +325,7 @@ max_context_size = 1048576
301
325
 
302
326
  ### Legacy model parameter migration
303
327
 
304
- Older configurations put `temperature` / `top_p` and `max_completion_tokens` / `service_tier` in different places. **Settings → Models & providers → Available models → Legacy model parameter migration** can copy them into a model's `parameters` table.
328
+ Older configurations put `temperature` / `top_p` and `max_completion_tokens` / `service_tier` in different places. **Settings → Models & providers → Providers & accounts → Maintenance → Legacy model parameter migration** can copy them into a model's `parameters` table.
305
329
 
306
330
  **Preview migration** first, which lists the model aliases, parameter names, review reasons, a revision and the backup name it would use, and writes nothing. Unambiguous values are copied; ambiguous or conflicting ones are left for you to decide. Your existing fields are not removed, so read the preview instead of assuming anything changed.
307
331
 
@@ -549,7 +573,7 @@ The compaction point resolves in this order: the session's per-model token overr
549
573
 
550
574
  `max_steps_per_turn` can be overridden by the `KIKI_LOOP_MAX_STEPS_PER_TURN` environment variable, and `max_attempts_per_step` by `KIKI_LOOP_MAX_ATTEMPTS_PER_STEP`; both take higher priority than the config file.
551
575
 
552
- Retries only apply to transient failures — connection errors, timeouts, HTTP 429 rate limits, and eligible HTTP 500–599 server errors. Partial output, safety refusals, and exhausted quota stop rather than replaying the request.
576
+ Retries apply to transient failures — connection errors, timeouts, HTTP 429 rate limits, and eligible HTTP 500–599 server errors. Partial output normally stops rather than replaying the request; for native agent turns, a connection interruption after output can be retried when `[retry].retry_partial_responses` is `true` (the default). HTTP 429 or 500–599 failures after output, safety refusals, and exhausted quota still stop without replaying the request.
553
577
 
554
578
  When a provider confirms a normal end with non-empty thinking but no answer, tool call, or refusal, Kiki keeps the thinking and its signature and sends a `Continue.` user message at most once per turn. A gateway's exact `antigravity_thinking_only` event can also qualify, but only when Kiki retained the actual thinking and confirmed that no other output, grounding, or refusal occurred. Cancellation, missing terminal events, interrupted streams, and token-limit stops do not qualify. The follow-up counts as a real model request with its own usage. A second empty response or failure stops the turn—even HTTP 429 or a temporary server error is not retried for this follow-up.
555
579
 
@@ -599,11 +623,14 @@ New sessions keep changing date, directory listings, workspace instructions and
599
623
 
600
624
  ## `retry`
601
625
 
602
- `retry` customizes the total attempt budget and fixed backoff for selected step errors. By default, a retryable step gets five total attempts, with waits of 2, 4, 8, and 16 seconds plus up to 25% jitter (30–37.5 seconds in total). A provider `Retry-After` value or a matching policy's fixed `backoff` replaces the corresponding default wait. Policies can also target exact model and provider configuration keys, so one provider's temporary failures do not change retry behavior elsewhere. The section and each policy are strict: an unknown field is rejected rather than silently ignored.
626
+ `retry` customizes the total attempt budget and fixed backoff for selected step errors, Output Layer transformations, and session title requests. By default, each retryable operation gets five total attempts, with waits of 2, 4, 8, and 16 seconds plus up to 25% jitter (30–37.5 seconds in total). A provider `Retry-After` value or a matching policy's fixed `backoff` replaces the corresponding default wait. Policies can also target exact model and provider configuration keys, so one provider's temporary failures do not change retry behavior elsewhere. The section and each policy are strict: an unknown field is rejected rather than silently ignored.
627
+
628
+ `retry_partial_responses` defaults to `true`. Set it to `false` to disable only native agent turn retries after partial output; failures before the first token keep the existing bounded retry budget. Eligible connection retries are capped at five total attempts, including the initial request; `max_attempts` or a matching policy can lower that cap. A retry discards partial output, runs tools only after a complete response, and may incur additional charges.
603
629
 
604
630
  | Field | Type | Default | Description |
605
631
  | --- | --- | --- | --- |
606
- | `max_attempts` | `integer` | — | Maximum total attempts for a failing step, including the initial attempt; overrides `loop_control.max_attempts_per_step` |
632
+ | `max_attempts` | `integer` | — | Maximum total attempts, including the initial attempt; for agent steps, overrides `loop_control.max_attempts_per_step` |
633
+ | `retry_partial_responses` | `boolean` | `true` | Whether an eligible native agent turn with partial output may be retried; post-output connection retries are capped at five total attempts including the initial request, and `false` disables only those retries |
607
634
  | `policies` | `array<table>` | — | Ordered per-error policies written as `[[retry.policies]]`; the first matching policy applies |
608
635
 
609
636
  Each `[[retry.policies]]` entry has these fields:
@@ -630,7 +657,25 @@ max_attempts = 20
630
657
  backoff = 15000
631
658
  ```
632
659
 
633
- Replace `gemini-4-argon` and `google-native` with the exact keys used in your `[models]` and `[providers]` tables. The `backoff` applies only when the provider does not send `Retry-After`. The policy does not make HTTP 400, exhausted quota, partial output, or already-executed failures retryable; `retry = true` never overrides Kiki's non-retryable classification.
660
+ Replace `gemini-4-argon` and `google-native` with the exact keys used in your `[models]` and `[providers]` tables. The `backoff` applies only when the provider does not send `Retry-After`. A model stream that ends without its protocol's completion event is a connection failure, not a successful partial answer. With partial output, only an eligible connection interruption can be retried; HTTP 429 or 500–599 failures after output and other provider failures are not made retryable by this setting. Each eligible retry discards the failed attempt's output, and native tools run only after a complete response; the failed generation may incur additional charges. The policy does not make HTTP 400, exhausted quota, or already-executed failures retryable; `retry = true` never overrides Kiki's non-retryable classification.
661
+
662
+ ## `session_residency`
663
+
664
+ Session restoration uses a process-wide queue, shared across workspaces. Empty sessions without an agent or main wire bypass this queue. Idle-session reclamation runs before acquiring a restore slot, so unloading a slow session does not occupy one.
665
+
666
+ | Field | Type | Default | Description |
667
+ | --- | --- | --- | --- |
668
+ | `idle_ttl_ms` | integer, 0–2147483647 | `600000` (10 minutes) | Minimum idle age before the periodic sweep can unload a session when the live-session capacity is not under pressure |
669
+ | `max_live_sessions` | positive integer | `max(16, floor(M / 128))` | Live-session capacity. When the process is at or above this capacity, idle sessions use `min_idle_ms` as the quicker reclamation threshold |
670
+ | `min_idle_ms` | integer, 0–2147483647 | `60000` (1 minute) | Minimum idle age used while live-session capacity or heap pressure requires reclamation |
671
+ | `sweep_interval_ms` | integer, 1000–2147483647 | `30000` (30 seconds) | Periodic eviction check interval |
672
+ | `max_concurrent_restores` | positive integer | `W` | Concurrent cold-session restores. Raising it takes effect without restarting and immediately wakes queued restores. Lowering it leaves current restores running |
673
+ | `max_queued_restores` | non-negative integer | `max(128, 16C)` | Maximum waiting restores; additional requests fail with a queue-full error |
674
+ | `max_resident_heap_bytes` | non-negative integer | `min(max(256, floor(M / 8)) MiB, 60% of the effective V8 heap)` | Heap-pressure threshold for idle-session reclamation. `0` disables this heap trigger, but capacity and idle-time rules still apply |
675
+
676
+ The timer fields use Node's maximum timer delay of `2147483647` milliseconds. Explicit values are not capped at the former `64`-session, `4`-restore, or `64`-queued-restore schema limits.
677
+
678
+ Each restore has a 60-second deadline, including its queue wait. A timed-out restore releases its slot; a saved message remains available for retry or cancellation. See [durable prompt recovery](../server/rest-api.md#prompts) for message state and GUI recovery actions.
634
679
 
635
680
  ## `transcript_memory`
636
681
 
@@ -640,9 +685,9 @@ Replace `gemini-4-argon` and `google-native` with the exact keys used in your `[
640
685
  | --- | --- | --- | --- |
641
686
  | `tail_turns` | positive integer | `20` | How many finished turns stay resident per agent |
642
687
  | `max_agent_bytes` | positive integer | `16777216` (16 MiB) | Per-agent resident byte budget — what stays in memory. Older turns are read from disk on demand |
643
- | `max_detail_cache_bytes` | non-negative safe integer | `268435456` (256 MiB) | Largest single full-detail read cached at once. `0` turns that extra slot off, leaving the content to be read without being held in that cache. A changed value takes effect at the next cache admission or eviction; lowering it evicts what no longer fits, and does not cancel a read already in progress |
688
+ | `max_detail_cache_bytes` | non-negative safe integer | `H` MiB | Largest single full-detail read cached at once. `0` turns that extra slot off, leaving the content to be read without being held in that cache. A changed value takes effect at the next cache admission or eviction; lowering it evicts what no longer fits, and does not cancel a read already in progress |
644
689
 
645
- These are server-side memory budgets, not read limits. Lowering them reduces memory use and may mean reading the same content from disk again.
690
+ `H` is the hardware-derived worker heap from [hardware-scaled resource defaults](#hardware-scaled-resource-defaults). These are server-side memory budgets, not read limits. Lowering them reduces memory use and may mean reading the same content from disk again.
646
691
 
647
692
  ## `token_counting`
648
693
 
@@ -676,7 +721,7 @@ In print mode (`kiki -p "<prompt>"`), Kiki stays alive after the main agent's tu
676
721
 
677
722
  ## `subagent`
678
723
 
679
- `subagent` controls how spawned subagents (`AgentRun`) run. Role selection uses the profile's [`can_spawn_subagents`, `allowed_subagents`, `preferred_subagents`, and `deny_subagents`](../customization/agents-and-subagents.md#agent-file-format); the former host dispatch-policy settings are removed.
724
+ `subagent` controls how spawned subagents (`AgentRun`) run. Role selection uses the profile's [`can_spawn_subagents`, `allowed_subagents`, `preferred_subagents`, and `deny_subagents`](../customization/agents-and-subagents.md#agent-file-format); the former host dispatch-policy settings are removed. Reserved native engine targets such as `engine:claude-acp` are ordinary stable target names for these checks: an explicit `allowed_subagents` list must include the exact `engine:<executor-id>` name to permit that child. Projecting a target from an executor descriptor never widens an existing allowlist.
680
725
 
681
726
  | Field | Type | Default | Description |
682
727
  | --- | --- | --- | --- |
@@ -812,6 +857,29 @@ Like the `tools` / `disallowedTools` fields of an agent file, this section shape
812
857
 
813
858
  Which image formats reach the model depends on the provider the request resolves to. Every provider accepts PNG, JPEG, GIF, and WebP; the Kimi provider additionally accepts BMP, HEIC, and HEIF, so an iPhone photo needs no conversion first. Any other image is replaced by a text notice that names the formats the current provider accepts.
814
859
 
860
+ ## `cpu_workers`
861
+
862
+ `cpu_workers` controls the App-scoped pool for CPU-bound work. Its first landed consumer is the initial image decode used to validate image data; it does not change the image size or format limits in [`image`](#image). The pool creates worker threads lazily on the first request and closes them during App teardown.
863
+
864
+ The values below are an explicit override example, not the defaults:
865
+
866
+ ```toml
867
+ [cpu_workers]
868
+ max_workers = 4
869
+ max_queue = 64
870
+ max_queued_bytes = 67108864
871
+ timeout_ms = 30000
872
+ ```
873
+
874
+ | Field | Type | Default | Environment variable | Description |
875
+ | --- | --- | --- | --- | --- |
876
+ | `max_workers` | positive integer | `W` | `KIKI_CPU_MAX_WORKERS` | The pool size is `max(1, min(os.availableParallelism() - 1, max_workers))`; the schema no longer imposes a `64` upper bound |
877
+ | `max_queue` | positive integer | `max(128, 16W)` | `KIKI_CPU_MAX_QUEUE` | Maximum number of requests waiting for a worker, not counting active requests; the schema no longer imposes a `1024` upper bound |
878
+ | `max_queued_bytes` | positive integer | `max(64, floor(M / 128))` MiB | `KIKI_CPU_MAX_QUEUED_BYTES` | Maximum total bytes declared by queued requests |
879
+ | `timeout_ms` | positive integer, up to `2147483647` | `30000` (30 seconds) | `KIKI_CPU_TIMEOUT_MS` | Request timeout in milliseconds, including time spent waiting in the queue |
880
+
881
+ `C`, `M`, `W`, and `H` are defined in [hardware-scaled resource defaults](#hardware-scaled-resource-defaults). Environment variables take precedence over `config.toml` and are read at startup. The queue is bounded by both `max_queue` and `max_queued_bytes`; when either limit is reached, new requests are rejected with `CPU_QUEUE_FULL` rather than waiting. If an active request is canceled or times out, its worker is terminated and the next request starts on a replacement; the failed work is not replayed.
882
+
815
883
  ## `session_title`
816
884
 
817
885
  `session_title` chooses how AI session titles are written.
@@ -824,7 +892,7 @@ Which image formats reach the model depends on the provider the request resolves
824
892
 
825
893
  The built-in prompt asks for a recognizable title based on the current purpose and concrete subject, keeping useful names and identifiers without claiming unproven success. Changing `prompt` takes effect on the next title request, including in an open session, without restarting. Saving or removing the override does not rename existing sessions or send a title request.
826
894
 
827
- A model you picked is used as-is, under the same excerpt budgets. Automatic titling never overwrites a title you typed yourself, and neither does an ordinary on-demand request. Only a forced request replaces a title you set by hand.
895
+ A model you picked is used as-is, under the same excerpt budgets. Zero-output transient failures follow [`retry`](#retry); a missing model or invalid configuration fails once, and observed model output is never replayed. Automatic titling never overwrites a title you typed yourself, including during retry backoff, and neither does an ordinary on-demand request. Only a forced request replaces a title you set by hand.
828
896
 
829
897
  `GET /api/config` and successful `POST /api/config` responses include `session_title.default_prompt` and `prompt_source` (`default` or `custom`). These are read-only fields; `prompt` is returned only for a nonblank override. Save with `{ "session_title": { "prompt": "Your title instructions" } }`, or remove the override with `{ "session_title": { "prompt": null } }`. Omitted fields stay unchanged, so these patches preserve `model` and `triggers`. Use `model: null` to remove the model without erasing the prompt or selected moments; do not use `replace_domains` for a single-field edit.
830
898
 
@@ -881,6 +949,8 @@ Computer tools from the recognized cua-driver MCP default to the main agent of e
881
949
 
882
950
  The default `WebSearch` lane is `duckduckgo.search`, which searches the general web without registration, credentials or configuration. Its public HTML endpoint may issue a challenge or rate limit; wait before retrying, or explicitly choose another configured source. These failures are errors, not empty results, and never trigger a silent switch to a paid provider. Configured defaults and explicit lane selections take precedence. For repository search or library documentation, choose `github.repositories` or `context7.docs` explicitly; the latter returns typed context and cannot be combined with result lanes. Field names and merge behavior follow the module's canonical configuration contract, shared with the standalone nb-search CLI, so an existing nb-search configuration file applies without translation.
883
951
 
952
+ Search memory and queue defaults follow the same hardware formula: the single query worker uses `H` MiB, keeps 8 active slots, and queues `max(128, 16C)` requests. The indexer child uses `H` MiB, with soft RSS `2H + 256` MiB and hard RSS `3H + 256` MiB. Explicit host options override `KIKI_SEARCH_INDEXER_SOFT_MB` and `KIKI_SEARCH_INDEXER_HARD_MB`, which override these defaults; writer election remains single-writer. These are local resource budgets, not provider rate limits.
953
+
884
954
  | Field | Type | Required | Description |
885
955
  | --- | --- | --- | --- |
886
956
  | `provider_instances` | `table` | No | Named provider instances with `provider_id`, `enabled`, optional `credential_slot_id` / `base_url`, `key_strategy` (`round-robin` or `priority`), `balance_ttl_ms` (60,000–86,400,000), and provider-specific `options` |
@@ -1022,37 +1092,29 @@ dangerous_bash = "default"
1022
1092
 
1023
1093
  `review` ("Approve for me") keeps Auto's routine approvals but sends policy-generated approval requests to a reviewer first. An explicit configured `deny` rule always blocks the call; an exact "approve for session" match is approved before configured `ask` rules and protected-path checks. Otherwise, an explicit configured `ask` rule prompts you. A confident reviewer approval proceeds without a user prompt; a confident denial stops the tool. Uncertain answers, invalid responses, timeouts, missing credentials, and unavailable reviewers ask you instead. After three consecutive reviewer denials in one turn, later requests in that turn go directly to you. Reviewer decisions do not create an "approve for session" rule.
1024
1094
 
1025
- Both reviewer backends receive up to three recent user-origin text messages, the complete Bash command or resolved file paths and operations, the policy name and reason, and the workspace directory. For reviewed `Write` and `Edit` calls, they also receive byte sizes and SHA-256 digests of the submitted content (including both sides of an edit), never file contents or raw diffs. Writes and edits to sensitive files go directly to you because the reviewer cannot verify unseen content. PEM private keys and common API-key formats are redacted from text fields. When the input exceeds its size limit, user-message text is trimmed; the action, policy and directory are never truncated. Assistant messages and tool output are not sent. Commands or target lists beyond their input bounds, fixed action/policy data beyond the size limit, actions without an exact command or resolved file target, and cases where unseen content is needed to judge safety go to user approval instead. Choose a configured model alias for the model backend:
1095
+ Reviewers receive up to three recent user-origin text messages, the complete Bash command or resolved file paths and operations, the policy name and reason, and the workspace directory. For reviewed `Write` and `Edit` calls, they also receive byte sizes and SHA-256 digests of the submitted content (including both sides of an edit), never file contents or raw diffs. Writes and edits to sensitive files go directly to you because the reviewer cannot verify unseen content. PEM private keys and common API-key formats are redacted from text fields. When the input exceeds its size limit, user-message text is trimmed; the action, policy and directory are never truncated. Assistant messages and tool output are not sent. Commands or target lists beyond their input bounds, fixed action/policy data beyond the size limit, actions without an exact command or resolved file target, and cases where unseen content is needed to judge safety go to user approval instead. Choose an existing chat model or [decision connection](./providers.md#decision-connections):
1026
1096
 
1027
1097
  ```toml
1028
1098
  # ~/.kiki/config.toml
1029
1099
  default_permission_mode = "review"
1030
1100
 
1031
1101
  [permission.reviewer]
1032
- backend = "model"
1033
- model = "k3-review"
1102
+ source = { kind = "model", model = "review-model" }
1034
1103
  allow_threshold = 0.9
1035
1104
  deny_threshold = 0.9
1036
1105
  timeout_ms = 8000
1037
1106
  categories = ["policy_compliance", "no_secret_egress", "no_irreversible_damage", "no_outward_effect", "prompt_injection_absent"]
1038
1107
  ```
1039
1108
 
1040
- `backend` accepts `model` or `jev`; the model backend requires `model`. `allow_threshold` and `deny_threshold` each accept 0.5–1; lower confidence asks you. `categories` selects Jev yes/no checks from the five names above. The default timeout is 8 seconds for a model and 4 seconds for Jev (`timeout_ms` overrides either; accepted range 100–30,000). To use TypeSafe Jev, select it as the backend and store the key separately. Choosing `backend = "jev"` is the consent to send this limited reviewer input to TypeSafe; there is no separate consent flag (an old `jev_consent` key is ignored):
1109
+ For a decision service, set `source = { kind = "connection", connection = "judgment" }`. It uses that connection's existing credentials and remote `default_model`; add `model` to the source to override the remote name. Reviewer accepts `system_one`, while `pair_score` is only for memory ranking. Choosing a source permits the limited reviewer input above to be sent to it; Memory Advisor keeps its own source and enable switch. In **Settings → Models & providers → Defaults → Who decides**, select the two sources independently. The permission settings keep the review thresholds and timeout.
1041
1110
 
1042
- ```toml
1043
- # ~/.kiki/config.toml
1044
- [permission.reviewer]
1045
- backend = "jev"
1046
- model = "jev-latest"
1047
- ```
1111
+ `allow_threshold` and `deny_threshold` each accept 0.5–1; lower confidence asks you. `categories` selects the System One yes/no checks from the five names above. `timeout_ms` accepts 100–30,000 milliseconds. Without an override, the existing `backend` setting supplies the timeout default: 8 seconds for `model` (the default), 4 seconds for `jev`.
1048
1112
 
1049
- ```toml
1050
- # ~/.kiki/credentials/credentials.toml
1051
- [permission.reviewer]
1052
- api_key = "YOUR_TYPESAFE_API_KEY"
1053
- ```
1113
+ Memory Advisor has its own `[memory.advisor] first_step_wait_ms` (0–5000 milliseconds). When it is not set, the first step waits up to 3000 ms for a `system_one` or `pair_score` source and 1500 ms for a chat model, following the current source. An explicit value always wins. See [Memory Advisor](../guides/memory.md#memory-advisor).
1114
+
1115
+ Existing configurations without `source` keep using `backend = "model"` with a model alias, or `backend = "jev"` with an optional remote model name (default `jev-latest`). Legacy Jev reads `[permission.reviewer].api_key` from `credentials.toml`, then the server's `TYPESAFE_API_KEY`; without either, approval goes to you. Choosing legacy `backend = "jev"` permits this reviewer input to TypeSafe, and an old `jev_consent` key is ignored. A new `source` takes precedence. API `source: null` clears it and the old model choice and resets `backend` to `model`, leaving the Reviewer unconfigured.
1054
1116
 
1055
- The config writer keeps `api_key` in `credentials.toml` rather than `config.toml`; `TYPESAFE_API_KEY` in the server environment is a fallback when no stored key is present. Without an available key, Jev is not called and approval goes to you. In **Settings → Permissions → Reviewer** a saved key stays masked but is not write-only: you can explicitly reveal, copy, edit, or clear it, and a key taken from the environment shows its source and can be overridden with a value saved in Kiki. Anyone holding the Kiki bearer token can reveal the stored key.
1117
+ If a legacy Reviewer key is saved, **Move to a connection** transfers it on the server; the browser never reads it for this operation. A partial result preserves concurrent changes: refresh and check settings before retrying, and choose a new connection name if the saved connection holds a different key. Afterward, reveal, copy, edit and clear credentials through the existing connection editor. Anyone holding the Kiki bearer token can reveal keys through the authenticated secret API.
1056
1118
 
1057
1119
  ::: tip
1058
1120
  MCP server declarations are configured in `~/.kiki/mcp.json` or the project-local `.kiki/mcp.json`, not in `config.toml`. The legacy `.kimi-code/mcp.json` path is not read. The interactive configuration entry point is the built-in `kiki-ops` skill (Kiki's product-usage and configuration Skill): type `/kiki-ops help me configure MCP`; see [Model Context Protocol](../server/mcp.md).
@@ -1143,13 +1205,13 @@ In the desktop GUI, open **Settings → Agents → Prompt fields** to edit this
1143
1205
 
1144
1206
  ## `[request_governance]`
1145
1207
 
1146
- `request_governance` limits either native model requests (`resource = "model_request"`) or running agents (`resource = "agent_execution"`). No rule means no concurrency cap; existing rules without `resource` remain model-request rules. In the GUI, **Usage → Live** shows running and queued requests and includes **Concurrency limits** to add, edit, pause, or delete rules. **History**, the default tab, shows token usage and estimated cost. See [Usage](../guides/settings.md#usage) for the diagnostic workflow.
1208
+ `request_governance` limits either native model requests (`resource = "model_request"`) or running agents (`resource = "agent_execution"`). No rule means no concurrency cap; existing rules without `resource` remain model-request rules. In the GUI, **Usage → Live** shows running and queued requests and includes **Concurrency limits** to add, edit, pause, or delete rules. **History** shows token usage and estimated cost, and **Live** is the tab that opens by default. See [Usage](../guides/settings.md#usage) for the diagnostic workflow.
1147
1209
 
1148
1210
  A `global` rule shares capacity across sessions in the same Kiki service process. An `each_session` rule gives each session its own bucket. These limits do not span independent Kiki processes, set requests-per-minute, or impose token or spending budgets. For search and fetch calls, use [`nb_search.execution`](#nb-search).
1149
1211
 
1150
1212
  Model-request rules count provider generation attempts, including compaction and OAuth replay. External harness requests are unmanaged, not zero. Agent-execution rules cover both Kiki and external executors launched through Kiki, including main agents, subagents, and externally delegated independent agents. One agent holds one slot throughout its execution, including tool work, approval waits, cancellation cleanup, and finalization. Idle agents, background shell tasks, and child task receipts do not add agent slots. External model identities remain unknown when the harness has not supplied a binding; Kiki never substitutes its native default model.
1151
1213
 
1152
- For example, cap all models using one provider at two simultaneous requests across sessions. Replace `example-provider` with the exact key from `[providers]`:
1214
+ For example, cap all models using one provider at two simultaneous requests across sessions. Replace `example-provider` with the exact key from `[providers]`. The `max_queue_size = 1024` line is an explicit override example; when omitted, the hardware-scaled default is `max(1024, 4 × max(128, 16C))`.
1153
1215
 
1154
1216
  ```toml
1155
1217
  [request_governance]
@@ -1196,7 +1258,7 @@ overflow = "queue"
1196
1258
  | --- | --- | --- | --- |
1197
1259
  | `schema_version` | `integer` | `1` | Configuration version; only `1` is accepted |
1198
1260
  | `max_wait_ms` | `integer` | `300000` | Positive local waiting budget in milliseconds; cumulative across model-request retries, or per agent admission |
1199
- | `max_queue_size` | `integer` | `1024` | Positive maximum number of pending admissions across both resources |
1261
+ | `max_queue_size` | positive integer | `max(1024, 4 × max(128, 16C))` | Positive maximum number of pending admissions across both resources; an explicit value remains an override |
1200
1262
  | `rules` | `array<table>` | `[]` | Concurrency rules, written as `[[request_governance.rules]]` |
1201
1263
  | Rule `id` | `string` | Required | Nonempty, unique rule identifier |
1202
1264
  | Rule `resource` | `string` | `model_request` | `model_request` or `agent_execution`; counts requests or agents, respectively |
@@ -1,11 +1,11 @@
1
1
  # Data locations
2
2
 
3
- Kiki stores its runtime data — the config files, session history, login credentials, and diagnostic logs — under `~/.kiki/` by default. This page helps you understand where each type of data lives, what it is for, and how to clean up or relocate it when needed.
3
+ Kiki stores its runtime data — the config files, session history, login credentials, and diagnostic logs — under `<home>` on the server host. `<home>` means the current Space's resolved Kiki home; `~/.kiki/` is only the default when no supported explicit `--home` or `KIKI_HOME` selects another path. This page helps you understand where each type of data lives, what it is for, and how to clean up or relocate it when needed.
4
4
 
5
5
  ::: warning Desktop OAuth credentials have a separate default
6
- When `KIKI_HOME` is unset, the desktop app keeps its runtime data (config, sessions, `server.token`) in `~/.kiki/`, but its OAuth credentials default to the compatibility home `~/.kimi-code/` (`~/.kimi-code/credentials/`). If you already have a Moonshot `~/.kimi-code/credentials/kimi-code.json`, the desktop app uses that token instead of starting logged out — and deleting `~/.kiki/` does **not** clear it. Running `kiki login` writes the token to `~/.kiki/credentials/`, so a daemon started outside the desktop environment does not see the desktop's credentials.
6
+ When no supported explicit `--home` is selected and `KIKI_HOME` is unset, the desktop app keeps its runtime data (config, sessions, `server.token`) in `~/.kiki/`, but its OAuth credentials default to the compatibility home `~/.kimi-code/` (`~/.kimi-code/credentials/`). If you already have a Moonshot `~/.kimi-code/credentials/kimi-code.json`, the desktop app uses that token instead of starting logged out — and deleting `~/.kiki/` does **not** clear it. Running `kiki login` writes the token to `~/.kiki/credentials/`, so a daemon started outside the desktop environment does not see the desktop's credentials.
7
7
 
8
- Setting `KIKI_HOME` moves both the runtime data and the desktop OAuth credentials to that path. The desktop app also lets you pick the compatibility home in its settings. The kimi-cli-era `~/.kimi` directory is never read and is not imported.
8
+ Setting `KIKI_HOME` moves the runtime data and desktop OAuth credentials selected by that home. The desktop app also lets you pick the compatibility home in its settings. The kimi-cli-era `~/.kimi` directory is never read and is not imported.
9
9
  :::
10
10
 
11
11
  ## Data root directory
@@ -22,11 +22,11 @@ If you need to move the data directory elsewhere (for example, to isolate config
22
22
  export KIKI_HOME="$HOME/.config/kiki"
23
23
  ```
24
24
 
25
- Once set, **all** Kiki data — config, provider credentials, sessions, logs, OAuth credentials, Kiki-specific user Skills, global `AGENTS.md`, and more — lands under the new path. For the full reference on `KIKI_HOME`, see [Environment variables](./env-vars.md).
25
+ Once resolved, current config, sessions, memory, logs, and other runtime data belong under `<home>`. A base home can supply selected inherited resources, and shared credentials may use that base when configured; this does not mean every Kiki file moves to or is shared from the same path. For shell paths, quote the current home as `"$KIKI_HOME/..."` when that environment variable names `<home>`. For the full reference on `KIKI_HOME`, see [Environment variables](./env-vars.md).
26
26
 
27
27
  ::: tip Note
28
28
 
29
- **Generic `.agents` resources** stay under the real OS home so they can be shared across tools. For example, user-level generic Skills remain at `~/.agents/skills/`, while Kiki-specific user Skills move with `KIKI_HOME` as `$KIKI_HOME/skills/`.
29
+ **Generic `.agents` resources** stay under the real OS home so they can be shared across tools. For example, user-level generic Skills remain at `~/.agents/skills/`, while Kiki-specific user Skills move with the current home as `"$KIKI_HOME/skills/"` when `KIKI_HOME` names it.
30
30
  :::
31
31
 
32
32
  ## Directory layout
@@ -78,7 +78,7 @@ Each file under the data root serves a specific purpose; most are managed automa
78
78
  - **`mcp.json`**: user-level MCP server declarations, merged with the project-local `.kiki/mcp.json` on startup. See [MCP](../server/mcp.md).
79
79
  - **`skills/`**: Kiki-specific user-level Skills. This directory moves with `KIKI_HOME`; generic cross-tool Skills can still live under `~/.agents/skills/`. See [Agent Skills](../customization/skills.md).
80
80
  - **`cognition/`**: prompt files referenced by `[models."<alias>".cognition]`; paths are relative to the data root. See [Model cognition](./config-files.md#model-cognition).
81
- - **`hooks/`**: script files referenced by `[[hooks]]` command paths (for example `node ~/.kiki/hooks/check-bash.mjs`). See [Hooks](../customization/hooks.md).
81
+ - **`hooks/`**: script files referenced by `[[hooks]]` command paths (for example `node "$KIKI_HOME/hooks/check-bash.mjs"` for the current home). See [Hooks](../customization/hooks.md).
82
82
  - **`plugins/installed.json`**: records installed plugins, each plugin's enabled state, and MCP server capability state changes made via `/plugins` or `/plugins mcp disable|enable`. Files installed from local paths or zip URLs are copied to `plugins/managed/<id>/`. See [Plugins](../customization/plugins.md).
83
83
  - **`credentials/`**: restricted credential directory, with requested permissions `0o700` (directory) / `0o600` (files). OAuth logins for managed providers are stored as `credentials/<name>.json`; MCP server credentials are stored under `credentials/mcp/`. On Windows, check the file and parent-directory ACLs yourself before relying on the file to stay private.
84
84
  - **`workspaces.json` and `workspaces/`**: the registered workspace catalog and the project directories Kiki creates when a new session has no selected workspace. Each automatically created session receives a distinct directory; these are working files, separate from the session history under `sessions/`.
@@ -110,13 +110,13 @@ This retention does not remove `sessions/`, agent `wire.jsonl` files, or saved m
110
110
 
111
111
  `store/thread-mailbox-sqlite-v1/` contains durable peer messages, delivery state, idempotency receipts, activity cursors, and workspace overrides. Unlike the search and query caches, these records are authoritative and must not be deleted to trigger a rebuild. `authority.json` selects `mailbox-<migrationId>.sqlite`; keep the adjacent `-wal` and `-shm` files while it is open. Use [`kiki storage backup`](../reference/command.md#kiki-storage) for a consistent SQLite copy instead of copying only a live `.sqlite` file.
112
112
 
113
- The 0.5.x upgrade retains its checkpoint in `migration.json`, its source backup under `recovery/<migrationId>/sources/`, and moved originals under `recovery/<migrationId>/originals/`. The former `store/thread-mailbox-v3`, `store/thread-mailbox-v1`, and `store/agent-collaboration-mailbox-v2` directory names become fence files. Keep these files: they stop older versions from reopening those locations as writable mailboxes. Do not point an old binary at the recovery copies. Run `kiki storage status` to inspect recovery state and `kiki storage migrate` to resume; follow the [storage command's rollback rules](../reference/command.md#kiki-storage) rather than moving original directories back by hand.
113
+ The 0.5.x upgrade retains its checkpoint in `migration.json`, frozen source copies under `recovery/<migrationId>/sources/`, and moved originals under `recovery/<migrationId>/originals/`. The former `store/thread-mailbox-v3`, `store/thread-mailbox-v1`, and `store/agent-collaboration-mailbox-v2` directory names become fence files. Keep the originals and fences: older versions must not reopen those locations as writable mailboxes, and the originals also retain older activity records. Do not point an old binary at the recovery copies. Run `kiki storage status` to inspect recovery state and `kiki storage migrate` to resume. After rollback is no longer possible, [`kiki storage cleanup-recovery`](../reference/command.md#kiki-storage) can preview and, with a verified independent SQLite backup and explicit confirmation, remove only `sources/` files that match the originals. Never remove these directories manually; follow the [storage command's rollback rules](../reference/command.md#kiki-storage) rather than moving originals back by hand.
114
114
 
115
115
  ## Session and usage query cache
116
116
 
117
- `cache/query-store-sqlite-v1/index.sqlite` holds the SQLite query cache for session lists, usage facts, and thread-turn lookups. Kiki rebuilds these views from session metadata, usage-fact journals, and conversation history when needed. The database may have adjacent `-wal` and `-shm` files while it is open.
117
+ `cache/query-store-sqlite-v1/index.sqlite` holds the SQLite query cache for session lists and thread-turn lookups. Usage facts and source coverage use a separate database at `cache/usage-read-model-v2/index.sqlite`. Kiki rebuilds these views from session metadata, usage-fact journals, retained accounting ledgers, and conversation history when needed. Each open database may have adjacent `-wal` and `-shm` files.
118
118
 
119
- If this cache is damaged, stop every Kiki process using the data root, back up and remove only `cache/query-store-sqlite-v1/`, then restart. Rebuilding a large history can take several requests; Usage reports incomplete coverage until preparation finishes. Keep `cache/usage-facts-v1/`, `sessions/`, and `store/`: they contain the journals and records needed for recovery. The older `cache/query-store-v*/` directories are separate from the SQLite cache and are not imported by this backend.
119
+ If one cache is damaged, stop every Kiki process using the data root, back up and remove only that cache directory, then restart. Rebuilding a large Usage history can take several requests; committed import progress survives a restart. Keep `cache/usage-facts-v1/`, `sessions/`, and `store/`: they contain the journals and records needed for recovery. Older generic Usage collections and `cache/query-store-v*/` directories are retained for rollback; do not remove the shared query database to reset Usage.
120
120
 
121
121
  ## Content search index
122
122
 
@@ -134,6 +134,11 @@ The first time the `Grep` tool needs ripgrep, the CLI can automatically download
134
134
 
135
135
  - **`logs/kimi-code.log`** (global): records startup, login, export, and other cross-session events.
136
136
  - **`<sessionDir>/logs/kimi-code.log`** (session-level): records diagnostic events within a single session.
137
+ - **`logs/server-runtime.log`**: synchronous daemon startup, shutdown, uncaught-error and exit records, with process ID and memory counters; rotates at 1 MiB with one backup.
138
+ - **`logs/desktop-backend.log`**: desktop backend stderr and the desktop owner's observed exit code or signal, including when the backend cannot write its own final record.
139
+ - **`logs/reports/`**: Node.js reports for fatal errors such as heap exhaustion. Environment variables and network details are excluded; inspect reports before sharing because file paths and error text remain. Reports are retained until you remove them.
140
+
141
+ When investigating a daemon restart, keep `server-runtime.log`, `desktop-backend.log`, their backups and any matching report. A forced process termination can prevent the daemon's final record; the desktop owner's exit record is the next source of evidence.
137
142
 
138
143
  When reporting a bug, prefer exporting the relevant session with `kiki export` (see [kiki command](../reference/command.md)); the session log is included in the export by default. Add `--no-include-global-log` if you do not want to share the global log.
139
144
 
@@ -12,9 +12,17 @@ The separate `KIKI_MODEL_*` family can supply a temporary model and key — see
12
12
 
13
13
  ## Core paths
14
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
+
15
23
  ### `KIKI_HOME`
16
24
 
17
- 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)).
18
26
 
19
27
  ```sh
20
28
  export KIKI_HOME="/path/to/custom/kiki"
@@ -144,7 +152,7 @@ Switches that control the behavior of subsystems such as background tasks, the b
144
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 |
145
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 |
146
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 |
147
- | `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`. Does not override cancellation, local admission denials, observed output or tool execution, `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` |
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` |
148
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 |
149
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 |
150
158
  | `NB_SEARCH_HOME` | Data directory for the built-in search and retrieval module | Directory path |
@@ -164,6 +172,28 @@ Switches that control the behavior of subsystems such as background tasks, the b
164
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 |
165
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 |
166
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
+
167
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.
168
198
 
169
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.
@@ -100,7 +100,7 @@ When a profile binds — a new main session, a new subagent, a model switch, or
100
100
 
101
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.
102
102
 
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 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.
104
104
 
105
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.
106
106
 
@@ -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**: 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. Shell variables are not read automatically. See [Config overrides: provider credentials](./overrides.md#provider-credentials) for the full priority and an environment-variable example.
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
 
@@ -83,11 +113,11 @@ dictionary = true
83
113
 
84
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.
85
115
 
86
- 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. Partial output or observed tool execution prevents resending that generation; completed tool results remain in local history. If a target does not support compression, disable it before starting a new request rather than relying on automatic format probing.
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.
87
117
 
88
118
  ## Incremental Responses over WebSocket
89
119
 
90
- 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 on the next model request. An idle socket closes immediately; a socket serving an in-flight request stays open until that request completes, fails, or is canceled, then the next request uses a new connection.
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.
91
121
 
92
122
  For a gateway that advertises the version 1 `X-Responses-WebSocket-Capabilities` handshake, opt in to connection-local Responses history:
93
123
 
@@ -107,7 +137,11 @@ The target must match the origin and path boundary of the Responses endpoint. A
107
137
 
108
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.
109
139
 
110
- 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. A connection loss or temporary provider failure with no observed output uses the same request retry policy as HTTP; uncertain delivery alone does not block that recovery. This path supports `response.create` generation only; it does not enable background generation, steering, or `generate:false` warmup.
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.
111
145
 
112
146
  ## `/provider` — interactive provider management
113
147
 
@@ -126,17 +160,17 @@ Two paths when adding:
126
160
 
127
161
  ### Fetching model suggestions
128
162
 
129
- 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 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.
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.
130
164
 
131
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.
132
166
 
133
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.
134
168
 
135
- 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**.
136
170
 
137
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.
138
172
 
139
- **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.
140
174
 
141
175
  ::: warning
142
176
  Kimi Code OAuth managed accounts logged in via `/login` do not appear in `/provider`. Use `/login` and `/logout` to manage them.
@@ -367,7 +401,7 @@ GUI **Settings → Models & providers → Identity** is the central page: the le
367
401
  | --- | --- | --- |
368
402
  | Global default | Settings → Models & providers → Identity | `[request_identity]` |
369
403
  | Provider | Settings → Models & providers → provider editor → Request identity | `[providers.<name>.request_identity]` |
370
- | 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]` |
371
405
 
372
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:
373
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