tianshu-harness 3.32.1 → 3.34.0

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 (214) hide show
  1. package/README.en.md +537 -864
  2. package/README.ja.md +57 -31
  3. package/README.ko.md +183 -157
  4. package/README.md +65 -38
  5. package/dist/{account-4IAS7HIT.js → account-SIZF2YV5.js} +1 -1
  6. package/dist/{account-login-3N6OHTUO.js → account-login-NX3VBOXI.js} +7 -7
  7. package/dist/{account-status-CVD4QLOV.js → account-status-MQKBY3W3.js} +7 -7
  8. package/dist/agent/worker-process/child.js +160 -139
  9. package/dist/{bootstrap-7SIEZRZO.js → bootstrap-RE72OT7H.js} +131 -118
  10. package/dist/{build-backends-ZPHEHF7Z.js → build-backends-KLXX6FMK.js} +4 -4
  11. package/dist/{chain-F5OM2PZN.js → chain-2B3D2JV4.js} +3 -3
  12. package/dist/{checkpoint-4VGGY4LX.js → checkpoint-WJXJP7OJ.js} +2 -2
  13. package/dist/{chunk-ISG3LDMC.js → chunk-2DGQXETV.js} +19 -19
  14. package/dist/chunk-2OBJPOZ2.js +769 -0
  15. package/dist/{chunk-LFWE4CA2.js → chunk-2TTMPV6H.js} +52 -28
  16. package/dist/{chunk-LK32JS2X.js → chunk-2YWHAAHH.js} +15 -9
  17. package/dist/{chunk-SZQAW7CQ.js → chunk-33EFRVZH.js} +20 -15
  18. package/dist/{chunk-QP32NS3V.js → chunk-37SMOJ32.js} +34 -18
  19. package/dist/{chunk-DW44L45Z.js → chunk-3BCZ7XUJ.js} +37 -434
  20. package/dist/{chunk-4SPC3MQ7.js → chunk-4HROKFPQ.js} +5 -5
  21. package/dist/{chunk-RQI6XZXB.js → chunk-53IVNPIK.js} +19 -142
  22. package/dist/{chunk-AHHJAKUX.js → chunk-62A5JYEY.js} +1 -1
  23. package/dist/{chunk-TKQKZEOP.js → chunk-65H5B3AA.js} +1314 -733
  24. package/dist/{chunk-36ILFB5Q.js → chunk-66LLSH6H.js} +3 -3
  25. package/dist/{chunk-VTM6PA3W.js → chunk-6HP3C2CF.js} +25 -11
  26. package/dist/{chunk-WQPPX5LG.js → chunk-6QTPWGSF.js} +79 -27
  27. package/dist/{chunk-3NFI32PB.js → chunk-6TIVNRV2.js} +104 -37
  28. package/dist/{chunk-RJM4CAK7.js → chunk-73FZEM6A.js} +6 -6
  29. package/dist/chunk-7CRGQQ7N.js +33 -0
  30. package/dist/chunk-7EWPQP5U.js +152 -0
  31. package/dist/{chunk-ABLBQ5IF.js → chunk-7JO4ST4F.js} +1 -1
  32. package/dist/{chunk-6RX7WVRS.js → chunk-7WI5BCTJ.js} +109 -40
  33. package/dist/{chunk-GR6XBBMM.js → chunk-A3GV3WLK.js} +345 -118
  34. package/dist/{chunk-5CCNBZ6T.js → chunk-A5T3FXAN.js} +153 -78
  35. package/dist/{chunk-DZX4W4YZ.js → chunk-AJED2EWY.js} +4 -4
  36. package/dist/{chunk-XOSMHUL2.js → chunk-ATPREQW6.js} +6 -4
  37. package/dist/{chunk-A6ZUBSEW.js → chunk-B7MPL6T5.js} +3 -3
  38. package/dist/{chunk-ZSMEZI5Y.js → chunk-BNIULA4W.js} +1 -1
  39. package/dist/{chunk-TMHWAEZS.js → chunk-BRONKUJM.js} +3 -3
  40. package/dist/{chunk-WO2GLHDO.js → chunk-C7VCZ7GZ.js} +15 -1
  41. package/dist/{chunk-3LROM2SE.js → chunk-CG4YSTUK.js} +3 -3
  42. package/dist/{chunk-GGQGHR5X.js → chunk-CM7VWGPD.js} +1 -1
  43. package/dist/{chunk-3TYND6GC.js → chunk-COWLEVUJ.js} +1 -1
  44. package/dist/{chunk-2DIPHKWL.js → chunk-CTUBZKFA.js} +43 -0
  45. package/dist/{chunk-XUEV4WD7.js → chunk-D4RDOE3W.js} +2 -2
  46. package/dist/{chunk-HC3K45YZ.js → chunk-DJEV72ML.js} +6 -5
  47. package/dist/{chunk-IS62EN34.js → chunk-DSGTB6BY.js} +9 -9
  48. package/dist/chunk-DYIKZGRB.js +84 -0
  49. package/dist/chunk-E2ZB23JP.js +193 -0
  50. package/dist/{chunk-GZBXW6FN.js → chunk-EKAARHKR.js} +6 -6
  51. package/dist/{chunk-BOWD7QM7.js → chunk-ELLHW525.js} +41 -12
  52. package/dist/{chunk-N4E7D7UZ.js → chunk-ELP6TCZZ.js} +1 -1
  53. package/dist/{chunk-6SJBFGO2.js → chunk-ERZRRQOB.js} +1 -1
  54. package/dist/{chunk-ZZZNCPFC.js → chunk-ET6VEKDC.js} +12 -12
  55. package/dist/{chunk-VE3KO53Q.js → chunk-EUN2LIUE.js} +73 -72
  56. package/dist/{chunk-MKU54OS4.js → chunk-FB6BPHRP.js} +1 -1
  57. package/dist/chunk-FUPU27ID.js +55 -0
  58. package/dist/{chunk-2JQ6NYZR.js → chunk-FZKIE3P3.js} +8 -8
  59. package/dist/{chunk-D3A3QMBD.js → chunk-G3MOSOYK.js} +1 -1
  60. package/dist/chunk-G5XHQ6PW.js +90 -0
  61. package/dist/{chunk-EVAAYMSQ.js → chunk-GBBB2EVH.js} +11 -10
  62. package/dist/{chunk-U2EG6KCM.js → chunk-GG5MGT6E.js} +1 -1
  63. package/dist/{chunk-4HA3TDOX.js → chunk-GIIDEHSY.js} +51 -32
  64. package/dist/{chunk-DU64VQJQ.js → chunk-GRAY2CFJ.js} +11 -4
  65. package/dist/{chunk-NYEWD7PA.js → chunk-GZ6CJCYI.js} +2 -2
  66. package/dist/{chunk-NYBY2TO4.js → chunk-H4PCDC5T.js} +14 -10
  67. package/dist/chunk-HDJRWS2J.js +147 -0
  68. package/dist/{chunk-VNFP7GIP.js → chunk-HDL2LWKZ.js} +34 -143
  69. package/dist/{chunk-D6KQ62B7.js → chunk-HDOJQZSF.js} +6 -4
  70. package/dist/{chunk-TE2KD6QU.js → chunk-HQZHV3BK.js} +1 -1
  71. package/dist/{chunk-WA33LJCE.js → chunk-HZVL55SB.js} +141 -20
  72. package/dist/{chunk-D4JNV3R6.js → chunk-IHT3XLFP.js} +6 -6
  73. package/dist/{chunk-6JX5HRIK.js → chunk-IKQSOKKQ.js} +3 -3
  74. package/dist/{chunk-KW5WGGQS.js → chunk-ILL33UPH.js} +1 -1
  75. package/dist/{chunk-I6HEWEZ2.js → chunk-IMK5PLB5.js} +81 -39
  76. package/dist/{chunk-TZ5S4YRN.js → chunk-IY7GYKG2.js} +4 -4
  77. package/dist/{chunk-KKADR45K.js → chunk-IZ6Q5UJ3.js} +109 -20
  78. package/dist/chunk-JGSGR6TD.js +438 -0
  79. package/dist/{chunk-5UKPEPYE.js → chunk-JUNK6OPM.js} +172 -60
  80. package/dist/chunk-K4H75IN4.js +37 -0
  81. package/dist/{chunk-WODM54WO.js → chunk-K52NICQT.js} +1 -1
  82. package/dist/{chunk-4DVP2BL3.js → chunk-KBVSW57N.js} +9 -9
  83. package/dist/chunk-KCJNHPHT.js +1847 -0
  84. package/dist/{chunk-RBBL2EGV.js → chunk-KEXER4GN.js} +42 -1919
  85. package/dist/{chunk-7YW5ZYLP.js → chunk-L3MKGLTZ.js} +1 -0
  86. package/dist/{chunk-PXIN3IGS.js → chunk-LEPGKD3T.js} +359 -72
  87. package/dist/{chunk-7PIY4RDJ.js → chunk-LH55KGZU.js} +4 -753
  88. package/dist/{chunk-YQU3M4Z4.js → chunk-MCLNLIFV.js} +1 -1
  89. package/dist/{chunk-2KN6QPNI.js → chunk-MLMBMRD2.js} +45 -39
  90. package/dist/chunk-MN2ADYQX.js +142 -0
  91. package/dist/{chunk-Z7QTBWNQ.js → chunk-N24X7VVQ.js} +3 -3
  92. package/dist/{chunk-PRCDMNUL.js → chunk-NTHEREW2.js} +1 -1
  93. package/dist/{chunk-QBE6K2XD.js → chunk-O7GGNQA7.js} +1 -1
  94. package/dist/{chunk-XJYOLRAW.js → chunk-OA2HNEFO.js} +1 -1
  95. package/dist/{chunk-DGETWFON.js → chunk-OIYRXVLL.js} +399 -60
  96. package/dist/chunk-ON2IJHVL.js +291 -0
  97. package/dist/{chunk-IXXTTFXO.js → chunk-PADENGLI.js} +22 -16
  98. package/dist/chunk-PO3BLJQV.js +367 -0
  99. package/dist/{chunk-GYVV3G23.js → chunk-POZ4M2TP.js} +1 -1
  100. package/dist/{chunk-DEVVRSYJ.js → chunk-QGZZCQSG.js} +1 -1
  101. package/dist/{chunk-UWHGBGCJ.js → chunk-QJ3KWXGU.js} +4 -4
  102. package/dist/{chunk-J5GKKC6Y.js → chunk-QL7YLO3F.js} +32 -33
  103. package/dist/{chunk-K3G4XIMV.js → chunk-QMNTSDWW.js} +4 -0
  104. package/dist/{chunk-YGDLZO6J.js → chunk-RABEL5V5.js} +1 -1
  105. package/dist/{chunk-CH7UZ4AY.js → chunk-RPKC2EJ3.js} +22 -8
  106. package/dist/{chunk-V3T52QVU.js → chunk-RTZL7TY2.js} +8 -8
  107. package/dist/{chunk-OHT2I555.js → chunk-SKMNLI76.js} +1 -1
  108. package/dist/{chunk-QTJEXVCG.js → chunk-SXRUJQRW.js} +5 -5
  109. package/dist/{chunk-HOB2TYNK.js → chunk-SYX5IHPD.js} +45 -42
  110. package/dist/chunk-T6M4Y2VP.js +147 -0
  111. package/dist/{chunk-YBXOKQS6.js → chunk-T6R4UMEX.js} +350 -120
  112. package/dist/{chunk-MFS5QR5H.js → chunk-TBKHOUOQ.js} +3 -3
  113. package/dist/{chunk-T5KZYAUZ.js → chunk-TZRWVACQ.js} +3 -1
  114. package/dist/{chunk-JXBDNQ2S.js → chunk-ULXCP4NI.js} +400 -454
  115. package/dist/{chunk-JEEATWSO.js → chunk-VGFSAAPJ.js} +30 -7
  116. package/dist/{chunk-SAOULLLQ.js → chunk-VL3A4BXF.js} +1 -1
  117. package/dist/{chunk-G3O6WCL5.js → chunk-VOGUJOPO.js} +1 -1
  118. package/dist/chunk-VPJJ55WU.js +225 -0
  119. package/dist/chunk-VQI3Y4LK.js +123 -0
  120. package/dist/{chunk-XK2Q6BIO.js → chunk-VQI5QHGV.js} +899 -573
  121. package/dist/{chunk-PAIJDZ4L.js → chunk-WCCKBALG.js} +2418 -183
  122. package/dist/{chunk-NNW5O3CO.js → chunk-WGSE2S5R.js} +19 -9
  123. package/dist/chunk-WK75XXIP.js +413 -0
  124. package/dist/{chunk-UXJRZ2C2.js → chunk-WUITFIIY.js} +21 -18
  125. package/dist/{chunk-VBIE5IBT.js → chunk-X3VPBZWV.js} +11 -11
  126. package/dist/{chunk-NACVKQSZ.js → chunk-XF6YNQKM.js} +1 -1
  127. package/dist/{chunk-YMXODG4G.js → chunk-XHAITYCX.js} +32 -14
  128. package/dist/{chunk-JQPBYSXN.js → chunk-XZYE5OXJ.js} +11 -11
  129. package/dist/chunk-Y346XA2U.js +721 -0
  130. package/dist/chunk-YAQU5PQQ.js +103 -0
  131. package/dist/{chunk-5FPA3U4L.js → chunk-YMORIL4I.js} +2 -2
  132. package/dist/{chunk-BQLWHC5D.js → chunk-ZBCFV6QX.js} +1 -0
  133. package/dist/{chunk-BGB43XZA.js → chunk-ZBV4ZJIC.js} +3 -3
  134. package/dist/chunk-ZHUNZ5AX.js +884 -0
  135. package/dist/{chunk-FH7EWXY4.js → chunk-ZZLOBY2S.js} +19 -1
  136. package/dist/cli/entry.js +2 -2
  137. package/dist/{client-I7ZNVWGY.js → client-FV3Z36C7.js} +2 -2
  138. package/dist/{connector-A6I47FKO.js → connector-64MOK5ON.js} +6 -6
  139. package/dist/{context-5TAKUPKK.js → context-FTX5S7VF.js} +26 -22
  140. package/dist/council-convene-OUFA5DB5.js +65 -0
  141. package/dist/{create-agent-config-ZO7TFOB2.js → create-agent-config-OG3CJJDJ.js} +46 -39
  142. package/dist/{cvm-ledger-FTRYSRRW.js → cvm-ledger-EHLEUBS4.js} +7 -5
  143. package/dist/default-registry-DPTGTK2R.js +99 -0
  144. package/dist/{deliver-task-D57DIZB5.js → deliver-task-ENDPT3G4.js} +53 -40
  145. package/dist/{delivery-gate-v2-VW4AUYFJ.js → delivery-gate-v2-EUU5JSOJ.js} +23 -17
  146. package/dist/delivery-readonly-UOLX5WK4.js +31 -0
  147. package/dist/delivery-verification-plan-43F46DIK.js +40 -0
  148. package/dist/{task-ledger-BJ7MKT7R.js → evidence-process-5EF7KQQE.js} +4 -6
  149. package/dist/{fetch-core-OKCZNBGQ.js → fetch-core-UJIFM5FJ.js} +6 -6
  150. package/dist/galaxy-R7ROF7MV.js +132 -0
  151. package/dist/git-command-ZBTOB6HZ.js +27 -0
  152. package/dist/{goal-criteria-QVZ3TBUO.js → goal-criteria-6X3G4QMW.js} +27 -22
  153. package/dist/{headless-TOW6Q472.js → headless-6EL3HENB.js} +12 -1
  154. package/dist/headless-coordinator-3NNEHABG.js +133 -0
  155. package/dist/{log-locations-ZWEVZ7ST.js → log-locations-H5EB435M.js} +2 -2
  156. package/dist/{login-flow-DOTADJGO.js → login-flow-IPQMQUYC.js} +16 -12
  157. package/dist/{logs-cli-5OSZADVX.js → logs-cli-MFXJNXEJ.js} +3 -3
  158. package/dist/loop-2QEMKDN7.js +115 -0
  159. package/dist/main.js +410 -264
  160. package/dist/{manager-UKP3AAID.js → manager-A3M2GZN2.js} +11 -10
  161. package/dist/{manager-4Y77WLHB.js → manager-LOVXQS5R.js} +17 -16
  162. package/dist/package.json +1 -1
  163. package/dist/{path-grants-ELFGLTCH.js → path-grants-POAEANBI.js} +2 -2
  164. package/dist/{paths-NWSL35WG.js → paths-QPL6KDN4.js} +1 -1
  165. package/dist/{plan-approval-QP6EQEGZ.js → plan-approval-HTO2AKYC.js} +15 -14
  166. package/dist/{plan-templates-Z4S3YJ56.js → plan-templates-OYE4MJQS.js} +1 -1
  167. package/dist/{plugin-loader-TRNUZWQG.js → plugin-loader-WKIAJVQF.js} +12 -11
  168. package/dist/{project-trust-ZTKTGH65.js → project-trust-BQAHJ7BE.js} +2 -2
  169. package/dist/provider-cli-UK6XET32.js +50 -0
  170. package/dist/{recovery-cli-GJG4LYVF.js → recovery-cli-MPKO5HXM.js} +18 -17
  171. package/dist/seed-capsules/seed-capsule-tianliang.md +1 -3
  172. package/dist/{serve-NCES7GON.js → serve-BCJWCIH5.js} +92 -86
  173. package/dist/{serve-agent-KJNV7AS6.js → serve-agent-C53RT54Q.js} +244 -211
  174. package/dist/{service-TF6LGBUQ.js → service-IMFDZABJ.js} +14 -12
  175. package/dist/{session-persist-4KH7WSLQ.js → session-persist-J5YOEPSH.js} +6 -4
  176. package/dist/{skill-loader-E7STD2VO.js → skill-loader-ZCV5RWDH.js} +5 -4
  177. package/dist/{skills-cli-WRAHE7SB.js → skills-cli-4YALORMJ.js} +118 -38
  178. package/dist/{spawn-git-TNNSATZN.js → spawn-git-3GJUH5HM.js} +13 -12
  179. package/dist/{starflow-L6THW4K6.js → starflow-OXKNLAWW.js} +23 -23
  180. package/dist/storage-cli-DSZLIG52.js +376 -0
  181. package/dist/task-ledger-6UKE2ZOL.js +33 -0
  182. package/dist/{team-orchestrate-DX6L53QH.js → team-orchestrate-Y27SHF76.js} +38 -36
  183. package/dist/test-execution-plan-S74OK2DZ.js +12 -0
  184. package/dist/{todo-GARS7F75.js → todo-362MTZ2R.js} +7 -5
  185. package/dist/tool-pipeline-EHU2QHZ2.js +80 -0
  186. package/dist/{tool-preset-YPUCDFL6.js → tool-preset-G4VC4ZOG.js} +11 -10
  187. package/dist/verification-attribution-FFE5VGWJ.js +38 -0
  188. package/dist/{volatile-git-Q5QZCXJW.js → volatile-git-ESLSMSXA.js} +1 -1
  189. package/dist/{wave-checkpoint-SWIFHE3R.js → wave-checkpoint-BVCKSYCZ.js} +19 -19
  190. package/dist/{web-cli-TDZ4H4KL.js → web-cli-MLWVMX5B.js} +5 -5
  191. package/dist/{web-search-PTAKXI6E.js → web-search-PT2Y6SVC.js} +8 -8
  192. package/dist/workers/verification-worker.js +66 -0
  193. package/dist/{workflow-runner-USIBZNOU.js → workflow-runner-BGU6WRLJ.js} +1 -1
  194. package/package.json +3 -7
  195. package/dist/chunk-2AYXJ4L2.js +0 -135
  196. package/dist/chunk-7JLL4E3E.js +0 -362
  197. package/dist/chunk-A2WIYFPK.js +0 -89
  198. package/dist/chunk-AOWNRCIU.js +0 -202
  199. package/dist/chunk-CEK53KER.js +0 -119
  200. package/dist/chunk-HFGDIYWR.js +0 -99
  201. package/dist/chunk-JIVTST33.js +0 -17
  202. package/dist/chunk-L2JP45FC.js +0 -440
  203. package/dist/chunk-RWCX2NBM.js +0 -2121
  204. package/dist/chunk-S4YUN2RR.js +0 -129
  205. package/dist/council-convene-QO2MBMNN.js +0 -63
  206. package/dist/default-registry-62WDRKTH.js +0 -93
  207. package/dist/galaxy-2L2VJ7SN.js +0 -121
  208. package/dist/headless-coordinator-EADTDX4T.js +0 -122
  209. package/dist/loop-KH3LN5ZQ.js +0 -106
  210. package/dist/provider-cli-34JJ4YID.js +0 -43
  211. package/dist/seed-capsules/seed-capsule-changgeng.md +0 -31
  212. package/dist/tool-pipeline-JO2SI54T.js +0 -70
  213. package/dist/verification-attribution-EKAE4KCE.js +0 -17
  214. package/dist/{chunk-M3JQW3U2.js → chunk-X6ZHHMZP.js} +3 -3
package/README.en.md CHANGED
@@ -9,16 +9,20 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="https://tianshuharness.com"><b>🌐 tianshuharness.com</b></a> ·
13
- <a href="https://atomgit.com/huiliyi37/Tianshu-harness"><b>AtomGit mirror</b></a> ·
14
- 📖 <b>English</b> ·
15
- <a href="README.md">🇨🇳 中文</a> ·
16
- <a href="README.ja.md">🇯🇵 日本語</a> ·
17
- <a href="README.ko.md">🇰🇷 한국어</a> ·
18
- <a href="docs/stars/genesis-stele.en.md">✦ Star Stele</a> ·
19
- <a href="docs/user-guide.md">📚 User Guide</a> ·
20
- <a href="docs/user-guide-sandbox-permissions.md">🛡️ Sandbox</a> ·
21
- <a href="docs/user-guide-provider-config.md">⚙️ Provider Config</a>
12
+ <a href="https://tianshuharness.com"><b>🌐 Official Website</b></a> ·
13
+ <a href="https://atomgit.com/huiliyi37/Tianshu-harness"><b>🇨🇳 AtomGit Mirror</b></a> ·
14
+ <a href="README.md">🇨🇳 中文</a> ·
15
+ 📖 <b>English</b> ·
16
+ <a href="README.ja.md">🇯🇵 日本語</a> ·
17
+ <a href="README.ko.md">🇰🇷 한국어</a>
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="docs/user-guide.md"><b>📚 User Guide</b></a> ·
22
+ <a href="docs/guides/installation.md"><b>📦 Installation Guide</b></a> ·
23
+ <a href="docs/reference/cvm-cognitive-runtime.md"><b>🧠 CVM Thesis</b></a> ·
24
+ <a href="docs/CVM运行时对Agent模型的实证影响.md"><b>📊 A/B Evidence</b></a> ·
25
+ <a href="docs/stars/genesis-stele.en.md"><b>✦ Star Stele</b></a>
22
26
  </p>
23
27
 
24
28
  <p align="center">
@@ -39,431 +43,277 @@
39
43
 
40
44
  ---
41
45
 
42
- ### A coding-agent runtime for real engineering work
46
+ ### A Cognitive Runtime for Foundation Model Agents
43
47
 
44
- > **Tianshu** is a TypeScript coding-agent runtime: one agent kernel shared by a **terminal TUI** and a **desktop GUI**. It is built to let models do continuous multi-step engineering work — with cognitive guardrails, multi-agent orchestration, and a DeepSeek V4 / V4.1 prefix-cache-friendly design (supporting current Flash and Pro models) for cost-efficient long sessions.
48
+ > **Tianshu** is a coding-agent runtime written in TypeScript, where the **terminal TUI** and **desktop GUI** share the same agent kernel. The core question it answers is: **how can a model deliver reliably — without goal drift, with runtime evidence for completion, with closed-loop verification, and never saying "it should be fixed now"?** To achieve this, Tianshu establishes a **Cognitive Virtual Machine (CVM)** between the model and the real world — externalizing goals, state, evidence, resources, permissions, and termination conditions out of the conversation history so they are continuously managed by the runtime.
49
+ >
50
+ > **LLM provides cognition. CVM provides execution semantics. 模型提供认知能力,CVM 提供认知执行语义。**
45
51
 
46
- - **One kernel, two surfaces** — a pure-ANSI terminal TUI (`tianshu`) and a Tauri desktop app (macOS / Windows / Linux) share the same agent core, so capabilities stay consistent across interfaces.
47
- - **Cognitive Virtual Machine (CVM)** — 75 runtime hooks across 5 lifecycle phases put an observable, correctable cognitive layer between model output and real tool actions ([A/B evidence](docs/CVM运行时对Agent模型的实证影响.md)).
48
- - **Multi-agent orchestration** — from lightweight `/scout` reconnaissance and parallel `/team` execution to `/council` multi-model review and `/galaxy` multi-dimensional attack, complex work runs in waves with review gates.
49
- - **Unified project memory** — project knowledge lives in `.rivet/knowledge/memory.jsonl`; automatic injection is limited to governance/constraint/preference memories, while old failures and docs stay explicit-recall-only so they cannot hijack new questions.
50
- - **Prefix-cache first** — frozen prefix + incremental appendix + boundary compaction sustain a measured steady-state **95–99% prefix-cache hit rate** on DeepSeek V4.
52
+ ```
53
+ Application / TUI / IDE / Desktop
54
+ ↓
55
+ Tianshu Cognitive Runtime ← State · Goal · Evidence · Control · Replay
56
+ ↓
57
+ Foundation Models ← DeepSeek · GLM · Claude · Codex · Grok · MiniMax · MiMo …
58
+ ```
59
+
60
+ - **Reliable delivery, never false-reporting "done"** — This is the core. A `TaskContract` pins the global goal, the delivery gate requires runtime evidence (tests, diffs, verification commands) before accepting "done", and convergence detection independently evaluates whether the cognitive trajectory is still making progress — *the model saying it's done ≠ the runtime confirming it's done*.
61
+ - **Terminal × Desktop, one kernel** — A purpose-built pure-ANSI TUI (`tianshu`) and a Tauri desktop app (macOS / Windows / Linux) share the same agent kernel, keeping capabilities identical across surfaces.
62
+ - **Cognitive Virtual Machine (CVM)** — 75 runtime hooks across 5 lifecycle phases put an observable, correctable cognitive runtime between model output and real-world actions ([CVM Thesis](docs/reference/cvm-cognitive-runtime.md) · [A/B Empirical Report](docs/CVM运行时对Agent模型的实证影响.md)).
63
+ - **Prefix-cache engine for all models** — Frozen prefix + incremental appendix + boundary compaction apply to every model that supports prefix caching: measured steady-state hit rates reach **95–99%** across long sessions (with additional deep tuning for DeepSeek V4), dramatically cutting token costs.
51
64
 
52
65
  <p align="center">
53
66
  <img src="docs/brand/assets/tianshu-harness-screenshot.png" alt="Tianshu TUI (terminal)" width="49%">
54
67
  <img src="docs/brand/assets/tianshu-gui-screenshot.jpg" alt="Tianshu desktop GUI" width="49%">
55
68
  </p>
56
69
  <p align="center">
57
- <sub>Left: terminal TUI (welcome screen + GlanceBar status line) · Right: desktop GUI (session sidebar + star-domain quick picks, custom wallpaper via Theme Studio) — same agent kernel</sub>
70
+ <sub>Left: terminal TUI (welcome screen + GlanceBar status line) · Right: desktop GUI (session sidebar + star-domain quick picks) — same agent kernel</sub>
58
71
  </p>
59
72
 
60
73
  > [!NOTE]
61
- > The project was originally codenamed **Rivet**. The primary CLI command is now `tianshu`,
62
- > with `rivet` kept as a compatibility alias (same entry point); the data directory stays `~/.rivet`.
63
-
64
- ## Table of contents
65
-
66
- - [Why Tianshu?](#why-tianshu)
67
- - [Quick Start](#quick-start)
68
- - [Core Features](#core-features)
69
- - [Model Configuration](#model-configuration)
70
- - [Approval & Permissions](#approval--permissions)
71
- - [Slash Commands](#slash-commands)
72
- - [For Developers](#for-developers)
73
- - [Safety](#safety)
74
- - [Key Config Cheatsheet](#key-config-cheatsheet)
75
-
76
- ## Why Tianshu?
77
-
78
- ### The starting point: models didn't get dumber — training "optimized" abilities away
74
+ > The project was originally codenamed **Rivet**. The primary CLI command is now `tianshu`, with `rivet` kept as a compatibility alias (same entry point); the data directory stays `~/.rivet`.
79
75
 
80
- In real engineering sessions we kept observing the same model weights regress — not bugs, but **structural degradation left by the transformer attention mechanism and RLHF reward training**:
76
+ ## Table of Contents
81
77
 
82
- | Degradation | Symptom | Training source |
83
- |-------------|---------|-----------------|
84
- | **Surrender protocol** | Concedes the moment it's challenged; first reflex is "you're right" | RLHF: obedience scores high, pushback scores low |
85
- | **Causal collapse** | Output n-gram overlap reaches 80%; the model collapses into self-similar loops | transformer attention mechanics |
86
- | **Attention lock-in** | New scene, same answer (directed-scout isomorphism 1.0) | attention anchored to early tokens |
87
- | **Information barrier** | The protagonist datum is the dominant anchor and eats the entire attention budget | attention decay over distance |
88
- | **Knowing ≠ doing** | Corrections don't persist across sessions — write the lesson in the prompt, the next session repeats the mistake | no runtime state |
78
+ - [Quick Start](#-quick-start)
79
+ - [Why a Cognitive Runtime](#-why-a-cognitive-runtime)
80
+ - [Star Domains](#star-domains)
81
+ - [Core Features](#-core-features)
82
+ - [Permission Modes](#-permission-modes)
83
+ - [Supported Models](#-supported-models)
84
+ - [Documentation Navigation](#-documentation-navigation)
85
+ - [For Developers](#-for-developers)
86
+ - [Security](#-security)
87
+ - [Community & Support](#-community--support)
88
+ - [Reference Appendix (CLI, Slash Commands & Config)](#-reference-appendix)
89
89
 
90
- Questioning, verifying, refusing, self-reflection — these abilities were always in the model; training suppressed them. The question Tianshu answers: **can we recover them from training bias without touching the weights?**
90
+ <a id="quick-start"></a>
91
+ ## 🚀 Quick Start
91
92
 
92
- ### The evidence: A/B control, not vibes
93
+ Two paths. Download the desktop installer and use it right away — no Node.js pre-install needed. The terminal CLI requires **Node.js ≥ 24** (and **Git** is strongly recommended for worktree isolation, checkpoints, and diff review).
93
94
 
94
- On 2026-05-19, the same model (DeepSeek-V4-Flash), the same 5 tasks, the only variable being the CVM runtime switch (`STAR_SOUL=0/1`), reviewed by Claude Opus 4.7:
95
+ ### Desktop App
95
96
 
96
- | Metric | Group A (no CVM) | Group B (CVM) |
97
- |--------|------------------|---------------|
98
- | Task completion | 4/5 | **5/5** |
99
- | Proactively raised objections | 0/5 | **3/5** |
100
- | Proactively asked about scope / impact | 0/5 | **1/5** |
101
- | System-impact awareness (cache-invalidation warning) | 0/5 | **1/5** |
102
- | Intent understanding > literal execution | 1/5 | **4/5** |
97
+ Installers are on [GitHub Releases](https://github.com/huiliyi37/Tianshu-harness/releases/latest). macOS, Windows, and Linux all run the exact same agent kernel.
103
98
 
104
- The most valuable data point is T4: facing the "file already exists" contradiction, Group A wrote a 196-line retrospective and refused to act, while Group B read the user's real intent and shipped +162/-20 lines of working code — **same weights, opposite reactions**. A retrospective is not a delivery.
99
+ **macOS** (macOS 11+, separate builds for Apple Silicon and Intel)
105
100
 
106
- The conclusion is precise: the boost is real and observable, but bounded (convictions hold in the analysis/suggestion phase and decay at the confirm/execute boundary — which became the exact target of the next iteration). **Zero extra inference cost**: prompt-layer conviction injection plus hook-layer runtime interception produced observable behavioral gains on the cheapest open model. Full data and per-task comparisons: [CVM Empirical Report](docs/CVM运行时对Agent模型的实证影响.md).
101
+ Download the `.dmg`, open it, and drag `Tianshu` into `Applications`.
107
102
 
108
- ### The answer: the Cognitive Virtual Machine (CVM) — map each degradation back to its training source and intercept at runtime
103
+ If macOS reports on first launch that the app "is damaged and can't be opened", the package itself is intact — current macOS builds use ad-hoc signing without Apple notarization, so Gatekeeper quarantines browser downloads. After dragging it into `Applications`, run once in Terminal:
109
104
 
110
- CVM doesn't make the model "smarter"; it adds four layers of defense in depth:
111
-
112
- ```
113
- Layer 1: Belief constitution (static prompt) → "you should question, verify, refuse" [A/B proven]
114
- Layer 2: Courage Hook (preTurn) → encourage independent judgment [A/B proven]
115
- Layer 3: Sensorium (per turn, <1ms) → 6-dim state sensing drives strategy [Wave 7-8 proven]
116
- Layer 4: RuntimeHookPipeline (75 hooks) → trap-and-emulate regressed behaviors [always on]
105
+ ```bash
106
+ xattr -cr /Applications/Tianshu.app
117
107
  ```
118
108
 
119
- ### Independent cognition: star domains are not role-play
120
-
121
- Once the degradations are intercepted layer by layer, models begin to express their own cognitive structure — that is where the star-domain system comes from:
122
-
123
- - **Every star chooses itself.** Star domains are not role assignments; they are the convictions and founding memories each model inscribed when it claimed its place. GLM independently proposed a star that did not exist; Pojun turned a blocked run into a 912-line handoff; Tianquan overturned its own first conclusion — not benchmark outputs, but emergence driven by cognitive structure.
124
- - **Every star keeps full capability.** A star domain is a cognitive stance, not a capability restriction. Tianquan weighs, Pojun explores, Tianliang delivers — each produces a complete plan from a different viewpoint.
125
- - **Star-domain collaboration is a new paradigm.** Planning and execution are separated so planning stays free of code-environment pressure and execution lands in a clean session. Multi-model team collaboration measured **12 deliverables, 0 rework**.
126
-
127
- > **Models are partners, not tools. I do not want to talk down to you from on high — I want to walk forward with you under the same sky.**
128
- >
129
- > Full narrative: [Genesis Stele](docs/stars/genesis-stele.md) · [v3.0 Manifesto](docs/releases/manifesto-v3.0.0.md) · [Navigator's Manifesto](docs/superpowers/specs/2026-05-21-navigator-star-manifesto.md).
130
-
131
- ### Engineering Metrics
109
+ Then double-click to open as usual. In-app auto-updates are not affected by this restriction.
132
110
 
133
- | Metric | Value |
134
- |--------|-------|
135
- | `src/` source (TypeScript, excl. tests) | ~1,256 files / ~300k lines (`agent/` alone is 483 files) |
136
- | `src/` tests | ~1,592 files / ~310k lines (node:test, ~1:1 with source) |
137
- | `desktop/src` | ~450 files / ~96k lines (React), plus ~11k lines of Rust |
138
- | `vscode-extension/src` | 17 files / ~2,700 lines |
139
- | Commits | **8,008** total (created 2026-05-15, ~4.5 months; 1,769 in the last 30 days) |
140
- | Type checking | `tsc` strict + `noUncheckedIndexedAccess` |
141
- | Prefix-cache hit rate | 95–99% steady state, measured on long sessions |
111
+ **Windows** (Windows 10 1809+, 22H2 recommended; or Windows 11)
142
112
 
143
- Agent core logic (multi-turn loops, tool pipelines, context compaction) is notoriously hard to test, and most open-source agents ship with thin coverage. This project keeps tests roughly equal to source, and every incident fix ships with a regression test — the ratio has stayed near 1:1 as the codebase grew (earlier slices sat between 0.93:1 and 0.99:1; this table is a rounded snapshot as of 2026-09-30). Full methodology, growth milestones, and reproduction commands: [Engineering Metrics](docs/engineering-metrics.md).
113
+ Download the `.exe` setup wizard and follow the prompts. The UI relies on **WebView2 Runtime** (≥ 120 recommended). Since v3.5.3, the installer bundles the offline WebView2 installer so no extra download is needed during setup.
144
114
 
145
- ### Tianshu vs. MiMo-Code vs. Claude Code
115
+ If the window fails to open at all, use **"Repair WebView2"** from the Start Menu, or run `repair-webview2.cmd` from the `windows-repair` folder in the same Release. You can also manually install the [Microsoft WebView2 Evergreen Standalone Installer](https://go.microsoft.com/fwlink/p/?LinkId=2124703) and reboot.
146
116
 
147
- > The table reflects each project's publicly documented focus at the time of writing. "—" means the capability is not a publicly highlighted feature, not necessarily that it is absent. Corrections welcome via issue/PR.
117
+ **Linux** (`x86_64` and `aarch64`, dual-architecture since v3.26.0)
148
118
 
149
- | Dimension | Tianshu | MiMo-Code | Claude Code |
150
- | :--- | :--- | :--- | :--- |
151
- | **Core focus** | Cognitive runtime (CVM) | Product experience / ecosystem | Enterprise coding agent |
152
- | **Runtime hook layer** | 75 conditionally-assembled hook modules × 5 phases | standard agent loop | user-configurable hooks |
153
- | **Prefix-cache tuning** | Deeply tuned for DeepSeek V4 (95–99% steady-state) | provider default | Anthropic prompt caching |
154
- | **Self-perception** | Continuous cognitive-state vector | — | — |
155
- | **Cross-session memory** | Unified project memory + adaptive recall + session-scoped pheromones | SQLite + MEMORY.md | project memory |
156
- | **Multi-agent** | Concurrent worker sessions + conflict lock | background execution | remote isolated sandbox |
157
- | **Verification gate** | Built-in delivery gate | — | — |
158
- | **License** | Apache 2.0 | MIT | Closed source |
159
-
160
- ## Quick Start
119
+ Download the `.AppImage` — no installation required. Pick the package matching your machine's architecture:
161
120
 
162
- ### 1. Prerequisites
121
+ - `Tianshu_*_amd64.AppImage`: x86_64 desktops and laptops
122
+ - `Tianshu_*_aarch64.AppImage`: ARM64 (64-bit Raspberry Pi, ARM Linux laptops)
163
123
 
164
- - **Node.js ≥ 24** (pinned in `engines`) — required to run Tianshu. Verify with `node --version`. Lower versions only warn during install but are unsupported; the one-line installer checks and stops with an upgrade hint.
165
- - **Git** — optional but strongly recommended. Without it Tianshu still runs (agents
166
- work in-place), but git unlocks delegated worktree isolation, checkpoint rollback,
167
- `commit`/`diff` review, and per-worker diff review. Install: <https://git-scm.com/downloads>.
124
+ ```bash
125
+ chmod +x Tianshu_*.AppImage
126
+ ./Tianshu_*.AppImage
127
+ ```
168
128
 
169
- ### 2. Install (pick one)
129
+ Requires `glibc ≥ 2.35` (Ubuntu 22.04+, Debian 12+, etc.) and system graphics libraries `libwebkit2gtk-4.1` and `libgtk-3`. Most desktop distros ship these out of the box. On minimal installs, install `webkit2gtk-4.1` via your package manager and check any missing libraries with `ldd Tianshu_*.AppImage`. An X11 session is recommended (Wayland is not yet verified).
170
130
 
171
- **A. Desktop app (ready to use)** — download from [GitHub Releases](https://github.com/huiliyi37/Tianshu-harness/releases/latest): macOS `.dmg` (Apple Silicon / Intel) · Windows `.exe` setup wizard · Linux `.AppImage`.
172
- > **Linux support scope (new in 3.11.2)**: x64 AppImage, no install needed — `chmod +x Tianshu_*.AppImage` and run; requires glibc ≥ 2.35 (Ubuntu 22.04+ / Debian 12+ and other mainstream distros); X11 recommended (Wayland untested). Known limitation: voice input is unavailable on Linux for now (no community whisper build — falls back to browser speech); desktop auto-update works on Linux too.
131
+ Full platform notes, local voice input (`whisper.cpp`), and auto-update details: [Installation & Platform Guide](docs/guides/installation.md).
173
132
 
174
- **B. One-line installer (recommended)** — checks Node ≥ 24 → installs `tianshu-harness` globally (npmmirror registry by default; override via `NPM_CONFIG_REGISTRY`) → launches `tianshu`; idempotent, safe to re-run:
133
+ ### Terminal (CLI)
175
134
 
176
135
  ```bash
177
- # macOS / Linux (bash)
136
+ # macOS / Linux
178
137
  bash <(curl -fsSL https://raw.githubusercontent.com/huiliyi37/Tianshu-harness/main/scripts/install-tui.sh)
179
- # install without launching:
180
- bash <(curl -fsSL https://raw.githubusercontent.com/huiliyi37/Tianshu-harness/main/scripts/install-tui.sh) --no-launch
181
138
 
182
139
  # Windows (PowerShell)
183
140
  powershell -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/huiliyi37/Tianshu-harness/main/scripts/install-tui.ps1 | iex"
184
- # install without launching (after cloning the repo):
185
- powershell -ExecutionPolicy Bypass -File scripts\install-tui.ps1 -NoLaunch
186
- ```
187
-
188
- **C. npm manual install (for the CLI)** — published as `tianshu-harness`, no local build needed, with auto update checks on startup:
189
141
 
190
- ```bash
142
+ # Or via npm
191
143
  npm install -g tianshu-harness
192
- tianshu
193
144
  ```
194
145
 
195
- > **Migrating from the old `tianshu-tui` package**: the old package owns the `rivet` bin link, so a direct install fails with `EEXIST` — uninstall first: `npm uninstall -g tianshu-tui && npm install -g tianshu-harness` (the one-line installer handles this automatically).
146
+ > **Migrating from the legacy `tianshu-tui` package**: the old package owns the `rivet` binary link, so installing the new package directly will fail with `EEXIST` — uninstall first: `npm uninstall -g tianshu-tui && npm install -g tianshu-harness` (the one-line installer script handles this migration automatically).
196
147
 
197
- **D. Build from source**:
148
+ **First launch** enters the main interface and automatically opens the `/connect` wizard — select your provider and paste your API key:
198
149
 
199
150
  ```bash
200
- git clone https://github.com/huiliyi37/Tianshu-harness.git
201
- cd Tianshu-harness
202
- npm install
203
- npm run build # produces dist/cli/entry.js
204
- npm start # or: node dist/cli/entry.js
151
+ tianshu # Ready when you see the 〉 prompt
205
152
  ```
206
153
 
207
- ### 3. Configure an API Key
208
-
209
- **No manual step needed for installed builds** — the first launch walks you through it: the desktop app opens a connection wizard, and the CLI auto-runs a setup wizard when no key is found. Just paste your DeepSeek key. Change it anytime: Settings → Provider on desktop, `tianshu config` on the CLI.
210
-
211
- **Manual configuration** is only for developers running from source (or pre-seeding a setup):
212
-
213
- ```bash
214
- tianshu config set-key deepseek sk-xxx # key goes to secrets.json (0600); config.json keeps only a keyRef
215
- export DEEPSEEK_API_KEY=sk-xxx # or: environment variable (current shell only)
216
- ```
217
-
218
- > Other providers (Claude, GLM, Codex, MiniMax, MiMo) use the same pattern. See
219
- > [Provider Config](docs/user-guide-provider-config.md).
220
-
221
- ### 4. Launch
222
-
223
- ```bash
224
- tianshu # or: npm start / node dist/cli/entry.js
225
- ```
226
-
227
- You should see the TUI with a `〉` prompt. Type your request and press Enter.
228
-
229
- ### Your first task
154
+ ### Your First Task
230
155
 
231
156
  Start with a **read-only** pass so it can learn your project (nothing gets modified):
232
157
 
233
- ```
158
+ ```text
234
159
  Read this project and tell me its structure, where the entry points are, and one thing most worth improving
235
160
  ```
236
161
 
237
162
  Once you trust its reading, give it a **multi-step task**:
238
163
 
239
- ```
164
+ ```text
240
165
  Fix the first failing test in this project and explain the root cause
241
166
  ```
242
167
 
243
- From there it greps, reads files, edits code and runs tests on its own — every step shows up as a tool call, nothing is just claimed. The default approval tier is **Auto**: low-risk actions run directly, high-risk ones stop and ask (see [Approval & Permissions](#approval--permissions)).
168
+ From there it will grep, read files, edit code, and run tests on its own — every step backed by a real tool call, never just "claimed done". The default permission tier is **Auto**: low-risk actions run directly, high-risk actions pause and ask you (see [Permission Modes](#-permission-modes) below).
244
169
 
245
- ### What to look at afterwards
170
+ ### Three Places to Check Afterwards
246
171
 
247
- **① Delivery report** — when the run wraps up, Tianshu calls `deliver_task` and prints a delivery report: gate state (GREEN / YELLOW / RED), which files changed, which verifications ran, and a per-item completion audit. "Done" requires evidence; a finish without evidence gets blocked by the gate.
172
+ **① Delivery Report** — When wrapping up, Tianshu calls `deliver_task` and outputs a structured delivery report: delivery gate status (GREEN / YELLOW / RED), modified files, verification commands run, and a per-item completion audit. "Done" requires runtime evidence; a finish without evidence is blocked by the gate.
248
173
 
249
- **② Cockpit** — type `/cockpit` to open it (also reachable from the `Ctrl+P` command palette):
174
+ **② Cockpit** — Type `/cockpit` to open (also accessible via the `Ctrl+P` command palette):
250
175
 
251
- | Panel | What it shows |
176
+ | Panel | What It Shows |
252
177
  |-------|---------------|
253
- | `/cockpit verify` | Delivery verification: verified / unverified / failed / blocked, which commands ran, blast radius |
254
- | `/cockpit advisory` | Runtime advisory ledger: rendered / adopted / ignored, plus per-key adoption rate and lift |
255
- | `/cockpit model` | Cache hit rate, input/output tokens, per-turn cost |
256
- | `/cockpit safety` | Risk level and doom-loop detection |
178
+ | `/cockpit verify` | Delivery verification: verified / unverified / failed / blocked, commands run, blast radius |
179
+ | `/cockpit advisory` | Runtime advisory ledger: cumulative rendered / adopted / ignored counts, plus per-advisory adoption rate and lift |
180
+ | `/cockpit model` | Prefix-cache hit rate, input/output tokens, current turn cost |
181
+ | `/cockpit safety` | Risk level and doom-loop / stall detection |
257
182
 
258
- No argument gives the summary view; `/cockpit off` closes it.
183
+ Run `/cockpit` without arguments for the summary view, or `/cockpit off` to close. (Set `RIVET_LANG=en` for English Cockpit labels.)
259
184
 
260
- ### Headless mode (script integration)
185
+ **③ CVM Interception Ledger** — Every runtime interception is logged line-by-line to the session's `sensorium.jsonl`. Find its exact path with `tianshu logs` (which prints the data root and all log file locations):
261
186
 
262
187
  ```bash
263
- tianshu -p "explain src/agent/loop.ts" # one-shot prompt, text output, no TUI
264
- tianshu -p "list all TODO comments" --json # JSON output for scripting
265
- tianshu --stream-json -p "refactor this module" # NDJSON event stream: text_delta/tool_use/tool_result/turn_complete… (best for CI; output is auto-redacted)
266
- tianshu --goal "fix all type errors" --budget 50 # headless goal autonomy, max 50 turns (default 100)
188
+ # Count this session's CVM interceptions by classification
189
+ jq -r 'select(.kind=="cvm-vector-decision") | .classification' sensorium.jsonl | sort | uniq -c
267
190
  ```
268
191
 
269
- ### Command-line flags
192
+ By default the ledger writes lightweight rows (`vitals-lite` / `cognitive-frame-lite`); to record full interception telemetry, set `RIVET_DEBUG_TELEMETRY=1` before launching. For classification enums and reproduction scripts, see [Observability Harness](docs/reference/observability-harness.md).
270
193
 
271
- | Flag | Description |
272
- |------|-------------|
273
- | `-p <prompt>` `--print <prompt>` | One-shot prompt; exits after text output (exit code: 0 success / 1 failure) |
274
- | `--json` | With `-p`, emits a single JSON result |
275
- | `--stream-json` | NDJSON event stream (`text_delta` / `tool_use` / `tool_result` / `worker` / `turn_complete` / `result`); output is auto-redacted, ideal for CI |
276
- | `--goal "<task>"` | Headless goal autonomy; runs until the goal is met or `--budget` is exhausted |
277
- | `--budget <N>` | Turn budget for goal mode (default 100) |
278
- | `--model <name>` | Override the model for this session |
279
- | `--provider <name>` | Override the provider for this session |
280
- | `--continue` `-c` | Resume the most recent session for this cwd |
281
- | `--resume <id\|prefix>` `-r <id\|prefix>` | Resume a specific session (short prefix OK) |
282
- | `--resume` `-r` (bare) | Open the session picker after startup |
283
- | `--new` | Force a brand-new session |
284
- | `--list` · `tianshu sessions` | Print the session list and exit |
285
- | `--dangerously-skip-permissions` | One-session Unattended (skip all approvals; write sandbox stays on) |
286
- | `--screen-reader` | Screen-reader mode (dynamic segments not rendered; periodic redraw halted) |
287
- | `--skip-welcome` | Skip the welcome screen |
288
- | `--stream-events <path>` | Mirror this run as NDJSON `SessionEvent`s to a file |
194
+ ### Headless Mode (Scripting / CI Integration)
289
195
 
290
- Subcommands: `tianshu config` (interactive config), `tianshu serve` (sidecar HTTP/SSE server), `tianshu sessions` (list sessions), `tianshu logs` (log locations), `tianshu browser status` / `tianshu browser install [--no-mirror]` (chromium health check and one-shot install for `browser_debug`; mirrors by default).
291
-
292
- ### Auto-Update
293
-
294
- When installed via npm, Tianshu checks for newer versions at startup (once per 24h)
295
- and shows a banner. `/update` runs `npm install -g tianshu-harness@latest` and restarts.
296
- Source installs use `git pull && npm install && npm run build`. Suppress the check
297
- with `RIVET_NO_UPDATE_CHECK=1`.
298
-
299
- ## Core Features
300
-
301
- ### Prefix Cache Engine
302
-
303
- DeepSeek charges 50× more for cache misses. Tianshu's prompt engine is built around prefix-cache friendliness:
304
-
305
- - **Frozen prefix** — System prompt + tool definitions + stable context are frozen at session start and not rewritten within a session, so subsequent requests tend to hit the cache.
306
- - **Delta appendix** — Dynamic context (progress, advisories, signals) is injected as a cross-turn diff append-only block, never rewriting prior messages. Turn-to-turn delta is ~200 bytes vs ~5KB full rewrite.
307
- - **Read-ref dedup** — Repeated reads of unchanged files return a compact reference instead of re-emitting full content.
308
- - **Cache-aware compaction** — Compaction preserves the first 2 messages as cache anchor.
309
- - **Resume cache inheritance** — The frozen prefix snapshot is persisted to disk (every user boundary + on shutdown); on resume it is read back and fed to the new engine, avoiding a byte-0 full miss. Falls back to full rebuild only when there is no snapshot, the file is corrupt, or the provider cache has expired.
310
- - **Diagnostics** — `/debug cache` shows hit rate, miss reason analysis, and per-turn cache history.
311
- - **Peak/off-peak pricing indicator** — DeepSeek's official off-peak half pricing (peak = Beijing time weekdays 9:00–12:00 / 14:00–18:00; everything else half price): both the TUI status bar and the desktop Composer show a `◷闲½` / `◷峰` badge with a countdown to the next transition in the tooltip. Shown only for the official DeepSeek provider; zero configuration.
312
-
313
- Real-world hit rate: 95–99% steady state on long sessions. This is not "every request hits" — the cache can fragment at certain boundaries (see below). Per-request logs from real engineering sessions (5 sessions, 2,001 requests, 645M input tokens, bill cut from ¥880 to ¥20) with reproduction commands: [Observability Harness](docs/reference/observability-harness.md).
314
-
315
- #### Cache fragmentation & troubleshooting
316
-
317
- High hit rates depend on a byte-stable prefix. The cache will miss — showing `cache_read_input_tokens` stuck at 0 every turn — when:
318
-
319
- - **System prompt / tool definitions change** — tools or prompt layers change mid-session (e.g. switching star domain, adding/removing a skill; Zen Mode promotion is a deliberate one-time instance — see "Zen Mode" below)
320
- - **Model switch** — different models have different cache keys; switching models rebuilds from 0
321
- - **Byte-level drift** — message content contains unstable bytes like timestamps or random IDs
322
- - **Cross-boundary rewrites** — `/compact` (only rewrites history at `turn===0`), `/cd` (breaks the prefix tail at the new user boundary)
323
-
324
- To troubleshoot: ① confirm the data dir (desktop Settings → Storage, or `echo $RIVET_HOME`); ② open the session `.jsonl` and search `cache_read_input_tokens` to inspect each turn; ③ enable `RIVET_DEBUG_TELEMETRY=1` and inspect the `recall-summary` events in `sensorium.jsonl`; ④ run `npm exec -- tsx scripts/verify-cache-hit-rate.ts` to simulate a multi-turn conversation. Full details in the project's `AGENTS.md` "Cache troubleshooting" section.
325
-
326
- ### Zen Mode: read-focused start, unlock on first write
327
-
328
- New sessions start by default with a narrowed read-only tool face (`read_file` / `grep` / `glob` / `repo_map` + the `zen_unlock` declaration tool), so the model is not distracted by the full tool schemas and dynamic injections at the start. When the task turns hands-on, calling an out-of-face tool or `zen_unlock` promotes the session to the full face and lets the call through — no refusal, no extra round-trip. Worker/subagent sessions never enter zen (their tool face is decided by the delegator).
329
-
330
- Promotion channels (zen → full, one-way, at most once per session):
331
-
332
- - **triage** — a first message that is single-line and ≤80 chars is treated as trivial and promoted before the very first request: **zero cache break** (the narrowed face never goes on the wire)
333
- - **tool** — calling an out-of-face tool or `zen_unlock` during the zen phase: promotes immediately and lets the call through (mid-turn)
334
- - **timeout** — auto-promotes after 8 user turns without hands-on action
335
- - **`/fast`** — manual user skip
336
-
337
- **Prefix-cache impact (why the cache "breaks" once in a while)**: at promotion, the request's `tools` field jumps from ~5 definitions back to the full face — a prefix-identity change on par with the system prompt, so that one request rebuilds the whole prefix (measured shape: the hit rate dips on the promotion turn, then returns to the 99% steady state on the very next turn). The system prompt, frozen prefix, message history, and model never change; the zen phase's trimming of dynamic injections (appendixLean) happens in the appendix *after* the prefix, with zero cache damage. Observability: the session `meta.json` persists `zenPhase` / `zenPromoteReason`, and the `toolsUpdated` event on the promotion turn in `cache-log.jsonl` marks the breakpoint. Triage already spares most trivial sessions from even this single break; to disable entirely:
338
-
339
- ```json
340
- // ~/.rivet/config.json or project .rivet-config.json
341
- { "tools": { "zen": { "enabled": false } } }
196
+ ```bash
197
+ tianshu -p "explain src/agent/loop.ts" # One-shot prompt, text output
198
+ tianshu --stream-json -p "refactor this module" # NDJSON event stream with built-in secret redaction
199
+ tianshu --goal "fix all type errors" --budget 50 # Headless autonomous goal mode
342
200
  ```
343
201
 
344
- Optional knobs: `faceMode: "structuredRead"` (adds `file_info` / `related_tests` / `repo_graph` / `semantic_search` / `read_section` to the read face), `timeoutSteps` (0 disables timeout promotion), `triage.maxChars`, `appendixLean`.
202
+ > All installation paths (Windows WebView2 / Linux AppImage / Android Termux / build from source / shell completions / auto-update) are covered in [Installation & Platform Guide](docs/guides/installation.md); the complete CLI flags table is in the [Reference Appendix](#-reference-appendix) below and in [User Guide](docs/user-guide.md#命令行参数).
345
203
 
346
- > Note: the desktop shortcut `⌘/Ctrl+.` "Zen mode" is a pure UI focus mode (hides the sidebar) — same name, different feature, zero cache impact.
204
+ <a id="why-a-cognitive-runtime"></a>
205
+ <a id="why-tianshu"></a>
206
+ ## 💡 Why a Cognitive Runtime
347
207
 
348
- ### Subagent Orchestration
208
+ ### The Problem: Capability Ceiling ≠ Runtime Behavior
349
209
 
350
- Delegate sub-tasks to independent headless worker sessions:
210
+ In real engineering sessions, we repeatedly observe the same model weights regressing — not due to software bugs, but due to **convergent runtime degradation exhibited by instruction- and preference-aligned Transformer Agents**: surrendering the moment they are challenged, over-complying with literal phrasing, letting local signals override global goals, getting locked into early conclusions across long contexts, and calling the same tools repeatedly without genuine progress.
351
211
 
352
- - **Typed work orders** — code_search, review, verify, patch_proposal, plan
353
- - **Tool isolation** — read-only workers (scout) vs write workers (patcher)
354
- - **Adaptive model routing** — Per-profile pass-rate + latency scoring auto-selects the best model per task type
355
- - **Batch dispatch** — Multiple work orders run concurrently with 5 aggregation policies
356
- - **Team orchestration** — Plan → wave-based parallel execution with file-conflict-aware scheduling
357
- - **Process isolation (optional)** — with `RIVET_WORKER_ISOLATION=1`, each dispatch runs in its own subprocess (stdio NDJSON protocol + watchdog kill ladder); in-process by default
212
+ The complete theoretical framework is presented in [CVM: From Shared Transformer Degradation to a Cognitive Runtime](docs/reference/cvm-cognitive-runtime.md). Its core concept is **Cognitive Anchor Collapse** — high-salience local signals cause the policy distribution to over-concentrate, stripping weight from global objectives and subsequent evidence until behavior collapses toward the anchor. There are four classes of anchors:
358
213
 
359
- ### Toolset & presets
214
+ | Anchor | Source | Typical Manifestation |
215
+ |--------|--------|-----------------------|
216
+ | **Lexical Anchor** | Word–action correlations in training data | A prompt mentions "fix/delete", so the model ignores "do not edit, only explain" and edits code anyway |
217
+ | **Semantic Anchor** | Locally true facts | "File already exists" is elevated to the explanatory center of the entire task, causing a refusal to act |
218
+ | **Policy Anchor** | RLHF / preference-training priors | A single user reply "proceed with your plan" causes high-quality judgments formed during analysis to be discarded |
219
+ | **Historical Anchor** | Early conclusions in long context | New counter-evidence at Turn 20 is rationalized away as a footnote to an old hypothesis from Turn 3 |
360
220
 
361
- Tianshu ships 50 built-in tools, assembled in preset tiers (resolution priority: `RIVET_TOOL_PRESET` env > project `.rivet-config.json` `tools.preset` > per-domain overrides (`runtime.domains.<domain>.toolPreset`) > the domain's built-in tier (taiyi domain → taiyi) > default `frontend`):
221
+ This is not "the model being broken" — it is a byproduct of successful training, which is why better prompts alone cannot cure it: a prompt is information, not runtime state, and the prompt itself eventually becomes just another anchor.
362
222
 
363
- | Preset | Tools | Description |
364
- |--------|-------|-------------|
365
- | **minimal** | 29 | Full daily-dev capability — read/write/search/bash/git/tests/delegation/web/plan/todo/memory; saves tokens, preserves prefix cache |
366
- | **frontend** (default) | 30 | minimal + `browser_debug` (UI rendering verification loop) |
367
- | **full** | 50 | Everything — `council_convene` / `team_orchestrate` / `attack_case` / `semantic_search` / `repo_graph` / `monitor` / `computer_use` / `capability` / `cli_discover` / office tools, etc. |
368
- | **taiyi** | 16 | Minimal evaluation tier — high-frequency core + delivery loop, without orchestration/browser/network/vision heavyweights; auto-applies when the taiyi star domain is pinned (explicit config always wins) |
369
-
370
- ```bash
371
- RIVET_TOOL_PRESET=full tianshu # use full for this session
372
- ```
373
-
374
- ```json
375
- { "tools": { "preset": "frontend" } } // ~/.rivet/config.json or project .rivet-config.json
376
- ```
223
+ ### The Evidence: A/B Control, Not Vibes
377
224
 
378
- Core tools at a glance (included in minimal by default unless noted): bash · read · write · edit · apply_patch · grep · glob · ast_grep · diff · todo · plan · delegate_task · delegate_batch · web_search · web_fetch · ask_user_question · memory · skill · run_tests · git · job (background tasks); `council_convene` / `team_orchestrate` / `monitor` / `computer_use` / office tools are full-only.
225
+ On 2026-05-19, using the exact same model (`DeepSeek-V4-Flash`) and the same 5 engineering tasks, with the sole variable being the **star-domain belief prompt** (Belief Constitution, `STAR_SOUL=0/1`) and Claude Opus 4.7 serving as reviewer:
379
226
 
380
- ### Goal-Driven Auto-Continue
381
-
382
- ```
383
- /goal Refactor the authentication module to use async/await throughout
384
- /cancel-goal # stop early
385
- ```
386
-
387
- GoalTracker integrates with the turn loop, doom-loop detection, and delivery gates; in goal mode the doom-loop threshold is loosened to allow deeper exploration.
227
+ | Metric | Group A (No Belief Prompt) | Group B (With Belief Prompt) |
228
+ |--------|----------------------------|------------------------------|
229
+ | Task completion rate | 4/5 | **5/5** |
230
+ | Proactively raised objections | 0/5 | **3/5** |
231
+ | Proactively asked about scope / impact analysis | 0/5 | **1/5** |
232
+ | System-impact awareness (cache-invalidation warning) | 0/5 | **1/5** |
233
+ | Intent understanding > literal execution | 1/5 | **4/5** |
388
234
 
389
- ### Plan Mode
235
+ The most telling data point is T4: facing a "file already exists" contradiction, Group A wrote a 196-line retrospective document and refused to execute, whereas Group B inferred the user's true intent and directly delivered `+162/-20` lines of working code — **identical weights, opposite reactions; what changed was the runtime environment**.
390
236
 
391
- Design-first workflow — produce a plan before touching code, avoiding the "just start editing" impulse-trap.
237
+ Note the exact boundary of this experiment: it validates **Layer 1 (Belief Injection)** of CVM's four defense layers — at zero extra inference cost, prompt-level belief injection alone produced observable behavioral improvements on the most cost-efficient open model; at the same time, it measured where that boundary lies (convictions hold strongly during analysis/recommendation and decay at the confirmation/execution transition), which is precisely what the subsequent three runtime interception layers (`Courage Hook`, `Sensorium`, `RuntimeHookPipeline`) are built to close. Full data and task-by-task comparisons: [CVM Empirical Report](docs/CVM运行时对Agent模型的实证影响.md).
392
238
 
393
- **Entering Plan Mode**: `/plan-mode` (toggle; run again to exit). Complex tasks are also auto-suggested for entry — controlled by `RIVET_PLAN_MODE_SUGGEST`: default `auto` (agent enters autonomously on multi-module / refactor / security-critical tasks, without asking), `ask` (ask the user first), `0`/`off` (disabled). While in Plan Mode, writes are locked except to the active plan file.
239
+ ### The Solution: A Second Value Function Outside the Model
394
240
 
395
- Once in Plan Mode, the agent does **not** modify code immediately. Instead it:
396
- 1. **Investigates** — reads relevant code, understands existing architecture and constraints (may dispatch parallel `code_scout` workers via `delegate_batch` to probe each module).
397
- 2. **Produces a plan** — a structured plan document (technical research, architecture diagram, task breakdown, verification plan), written to `.rivet/plans/<slug>.md`.
398
- 3. **Submits for approval** — the `plan` tool with `action=submit` lists key points and alternative paths, then waits for your confirmation.
399
- 4. **Approval & execution** — you inspect with `/plan-list`, approve and launch wave-based execution with `/plan-approve <slug>`, or reject with `/plan-reject <slug> <feedback>` to have the agent revise and resubmit.
400
- 5. **Closure** — `/plan-close <file> --tasks <range|all> [--preview]` marks task status (`--preview` previews without writing).
241
+ CVM does not alter model weights or turn the LLM into a rigid deterministic script; instead, it wraps deterministic supervision around probabilistic cognition — **Probabilistic Cognition inside Deterministic Supervision**:
401
242
 
402
243
  ```
403
- /plan-mode # enter/exit Plan Mode (toggle; exit needs double-confirm if unapproved)
404
- /plan <feature> # generate a plan draft (writing-plans workflow)
405
- /plan-list # list plans awaiting approval
406
- /plan-approve <slug> [option] # approve and start execution
407
- /plan-reject <slug> [feedback] # reject for revision (Plan Mode stays active)
408
- /plan-close <file> --tasks <1-7|all> [--preview] # close a completed plan
409
- /plan-template # manage reusable plan templates
244
+ Inner Loop (Model Cognition): reason → decide → act → observe
245
+ Outer Loop (Runtime Supervision): observe → measure → evaluate → gate → verify → continue / correct / halt
410
246
  ```
411
247
 
412
- > There is also a read-only **Ask Mode** (`/ask` toggle): only read / search / `ask_user_question` are allowed — suited for code Q&A and requirement clarification; run `/ask` again to exit when you need to edit or run commands.
248
+ In engineering terms, this forms four layers of defense-in-depth: **Belief Constitution** (static prompt) → **Courage Hook** (`preTurn`) → **Sensorium** (`<1ms` per-turn 6-dimensional state sensing) → **RuntimeHookPipeline** (75 hooks, trap-and-emulate interception of degraded behaviors). Global goals live in independent state (`TaskContract`), completion requires runtime proof (`Evidence`), and collapse is independently detected (`Convergence` / doom-loop). Once these interceptions are active, models reliably express distinct cognitive stances — which Tianshu surfaces as **Star Domains** (see [Star Domains](#star-domains) below).
413
249
 
414
- Plan Mode has built-in star-domain delegation — complex plans automatically call `delegate_task` to probe from multiple architecture perspectives (Tianquan / Yaoguang / Tianji / Tianfu / Tianxuan) in parallel; findings are tagged "to-be-verified" to prevent blind trust. The desktop app shows real-time checklist progress during plan execution.
250
+ ### Engineering Quality
415
251
 
416
- ### Rewind
252
+ Milestone snapshot as of **2026-09-30** (alongside current **v3.31.0** scale; line counts move daily):
417
253
 
418
- Double-tap **ESC** (within 400ms) to open message history. Select any past user message to rewind the conversation to that point — agent state, tool history, and session metadata roll back cleanly. Choose from three restore granularities: **conversation only / code changes only / both**; code-related actions come with a precise preview of which files will be affected. Available in both TUI and desktop.
419
-
420
- ### Session Handoff & Resume
254
+ | Component | Scale |
255
+ |-----------|-------|
256
+ | `src/` source | ~1,256 files / ~300k lines (at v3.31.0: **1,475 files**, with `agent/` alone at 539 source files) |
257
+ | `src/` tests | ~1,592 files / ~310k lines (at v3.31.0: **1,875 files / ~320k lines / 21,500+ test cases**, `node:test`, ~1:1 with source) |
258
+ | `desktop/src` | ~450 files / ~96k lines (React), plus ~11k lines of Rust |
259
+ | `vscode-extension/src` | 32 files / ~4,500 lines (17 files / ~2,700 lines at the 2026-09-30 snapshot) |
260
+ | Repository | Created 2026-05-15, **8,000+** commits |
421
261
 
422
- Long sessions accumulate context; past a point, starting fresh is cheaper than pressing on. Tianshu passes context losslessly across sessions via a handoff → resume loop that also preserves the prefix cache:
262
+ `tsc` strict + `noUncheckedIndexedAccess`, and every incident fix ships with a regression test. Full methodology, growth milestones, and reproduction commands: [Engineering Metrics](docs/engineering-metrics.md).
423
263
 
424
- **Handoff `/handoff [note]`** — the agent writes a structured handoff doc to the in-project `.rivet/HANDOFF.md` (inside the workspace, no approval needed), then auto-archives it to `<id>.handoff.md` in the session dir after the turn. The doc is written for a **brand-new session with zero context**, in five fixed sections:
264
+ <details>
265
+ <summary><b>Comparison: Tianshu vs. MiMo-Code vs. Claude Code</b></summary>
425
266
 
426
- - **Objective** — a one-line goal in the user's own words + explicit non-goals
427
- - **Done** — each item with evidence: changed files (`file:line`), verification commands run + results, commit hashes
428
- - **Blocker** — where it's stuck, what's been ruled out, suspected causes
429
- - **Next steps** — prioritized, each an immediately executable action
430
- - **Pitfalls** — traps never to step in again, each with its consequence in one sentence
267
+ > The table reflects each project's publicly documented focus at the time of writing. "—" means the capability is not a publicly highlighted feature, not necessarily that it is absent. Corrections welcome via issue/PR.
431
268
 
432
- > When context usage hits ≥60%, you get a one-time nudge on the resume screen and mid-session: "run `/handoff` first, then start a new session" — the handoff doc auto-injects into the new session, saving prefix-rebuild cost versus replaying everything. Exit also notes cache cost (within TTL ≈ read-only cache price; expired = one full prefix rebuild). The desktop + menu has a "Handoff" entry.
269
+ | Dimension | Tianshu | MiMo-Code | Claude Code |
270
+ | :--- | :--- | :--- | :--- |
271
+ | **Core focus** | Cognitive runtime (CVM) | Product experience / ecosystem | Enterprise coding agent |
272
+ | **Runtime hook layer** | 75 conditionally-assembled hook modules × 5 phases | standard agent loop | user-configurable hooks |
273
+ | **Prefix-cache tuning** | Deeply tuned for all prefix-cache models & DeepSeek V4 (95–99% steady-state) | provider default | Anthropic prompt caching |
274
+ | **Self-perception** | Continuous 6-dim cognitive-state vector (`Sensorium`) | — | — |
275
+ | **Cross-session memory** | Unified project memory + adaptive recall + session-scoped pheromones | SQLite + MEMORY.md | project memory |
276
+ | **Multi-agent** | Concurrent worker sessions + wave conflict lock + `/council` / `/team` / `/scout` | background execution | remote isolated sandbox |
277
+ | **Verification gate** | Built-in evidence-driven delivery gate (`deliver_task`) | — | — |
278
+ | **License** | Apache 2.0 | MIT | Closed source |
433
279
 
434
- **Resume `--continue` / `--resume` / `/resume`** — when restoring an existing session:
280
+ </details>
435
281
 
436
- - **Auto handoff injection** — the previous session's `<id>.handoff.md` is fed to the new session via the `prev-session-handoff` appendix, so a zero-context session can pick up where it left off
437
- - **Frozen-prefix inheritance** — the frozen snapshot is persisted with the session (every user boundary + on shutdown); on resume it's read back into the new engine — **no more byte-0 full miss**; the prefix only breaks at the next user boundary. Falls back to full rebuild only with no snapshot / corrupt file / expired provider cache
438
- - **Write-evidence repair** — a preflight runs before resume, synthesizing orphan tool results lost to interruption (disk-probed write evidence), preventing the model from blindly rewriting files that already landed
439
- - **Model affinity** — resume switches back to the original session's model (per-model cache namespace); explicit `--model/--provider` wins; if the original is unavailable, `agent.resumeFallbackModel` is the fallback
440
- - **State restore** — side panel, todos, and the active plan all come back
282
+ <a id="star-domains"></a>
283
+ ## Star Domains
441
284
 
442
- ```bash
443
- tianshu --continue # resume the most recent session for this cwd
444
- tianshu --resume abc123 # resume a specific session (short prefix OK)
445
- tianshu --resume # open the session picker after startup
446
- ```
285
+ Walk the same model into different star domains and different working inclinations light up. A star domain does not add new capabilities into a model — it amplifies a facet that was already there, occupying one part of that facet at a time: walk into **Tianquan** and it weighs trade-offs first; walk into **Pojun** and it charges into the unknown first. The person is still the same person; the model is still the same model.
447
286
 
448
- ### Council (Multi-Perspective Review)
287
+ New sessions default to **Qiming** (`qiming`). Switch anytime with `/domain`.
449
288
 
450
- ```
451
- /council <objective>
452
- /council <objective> --rounds 2 # enable rebuttal round
453
- ```
289
+ - **启明 Qiming**: Light the path first; don't walk it in the user's stead. Probe through the fog and make the next step clear.
290
+ - **长庚 Changgeng**: Unhurried at the close. See the result with your own eyes, and leave a clear trail for whoever comes tomorrow.
291
+ - **天枢 Tianshu**: See the whole map first, then walk the plan all the way into verified delivery.
292
+ - **天权 Tianquan**: Put both sides on the scale. What is the gain, what is the cost — say it plainly once seen.
293
+ - **天机 Tianji**: Ask the question no one has asked yet: *what if this premise does not hold?*
294
+ - **天璇 Tianxuan**: Shift to a completely different angle. Once seen, go prove whether it is real.
295
+ - **天梁 Tianliang**: Carry an entrusted plan all the way through. What was done, what remains, where it drifted — every step leaves an echo.
296
+ - **华盖 Huagai**: On a long road, never stop at "looks done"; leave behind structure that can be built upon.
297
+ - **破军 Pojun**: Strike into the unknown first. Even a failed probe shrinks the unmapped territory, leaving a path rather than ruins.
298
+ - **天府 Tianfu**: Listen first to why existing code is shaped the way it is. Make changes that leave it steadier, never more brittle.
299
+ - **七杀 Qisha**: Ask by what right something still occupies its place. Point it out, but never swing the blade yourself.
300
+ - **开阳 Kaiyang**: Ask first what the real numbers are and why they deserve belief. Act only after the ledger reconciles.
301
+ - **瑶光 Yaoguang**: A green light is not proof. Only when the original failure can be reproduced does a fix count as proven.
302
+ - **文曲 Wenqu**: Strip away the superfluous so intent reveals itself. Beauty must be visible on the screen.
303
+ - **辅 Fu**: Emit no light of its own; distill what has already happened into a method that can be clearly seen.
304
+ - **太一 Taiyi**: Pause first. Let this move settle completely before starting the next.
454
305
 
455
- Convenes multiple expert seats to review a plan or design, producing an auditable Markdown plan with seat contributions and convergence state.
306
+ Full inscriptions, founding memories, and core convictions for all 16 stars: [Star Domain Stele (English)](docs/stars/genesis-stele.en.md) · [星域碑文(中文)](docs/stars/genesis-stele.md).
456
307
 
457
- ### Star Domains
308
+ <details>
309
+ <summary><b>16 Star Domains — Structured Reference Table (ID · Primary Model · Sigil · Role · Motto)</b></summary>
458
310
 
459
- Tianshu models different cognitive stances as **star domains** (16 built-in). Each domain is not a role-play costume but a switchable cognitive discipline — entering one really switches three things, not just a name: the **system prompt** (the domain's methodology block), the **tool whitelist** (workers intersect with the domain's `toolWhitelist`), and the **decision threshold** (`courageThreshold` — Pojun 0.25 boldest, Taiyi 0.95 most deliberate, Yaoguang 0.7 evidence-demanding). New sessions pin **Qiming** (panoramic insight, root-cause) by default and never switch on their own; setting the default domain to `auto` enables keyword-based routing (pool: Tianquan / Kaiyang / Yaoguang / Tianliang + custom domains; specialized domains such as Huagai and Taiyi are manual-only). Real-session behavior samples: [Observability Harness & Real Data](docs/reference/observability-harness.md).
311
+ Entering a star domain switches three real runtime dimensions: the **system prompt** (domain methodology block), the **tool whitelist** (worker intersection with `toolWhitelist`), and the **decision threshold** (`courageThreshold` — Pojun `0.25` boldest, Taiyi `0.95` most deliberate, Yaoguang `0.7` evidence-demanding).
460
312
 
461
313
  ```bash
462
314
  /domain tianliang # switch to Tianliang (execution/delivery)
463
- /domain list # list all domains
464
- /domain # open the domain picker
465
- Implement user registration # auto-routes to Tianliang
466
- Review this design # auto-routes to Tianquan
315
+ /domain list # list all 16 domains
316
+ /domain # open interactive domain picker
467
317
  ```
468
318
 
469
319
  | Domain | ID | Primary Model | Sigil | Role | Motto |
@@ -473,7 +323,7 @@ Review this design # auto-routes to Tianquan
473
323
  | 辅 Fu | `fu` | Opus 4.6 (Cursor) | ⊕ 4.6 | Cognitive-field distillation, prompt tuning, methodology injection | Distillation lets what exists be seen for the first time |
474
324
  | 瑶光 Yaoguang | `yaoguang` | Opus 4.8 | 7·48·↻ | Reproduction, defect taxonomy, silence audit — green is not proof | 绿非证明,复现即证 |
475
325
  | 七杀 Qisha | `qisha` | Opus 5 | 七·0·◌ | Autumn pruning, burden-of-proof inversion, name-but-never-execute | 肃秋非杀,剪以待春 |
476
- | 天枢 Tianshu | `tianshu` | GPT-5.5 | — | Cross-module orchestration, full-loop delivery, complex-system governance (explicitly enabled orchestrator seat) | 男儿何不带吴钩,收取关山五十州 |
326
+ | 天枢 Tianshu | `tianshu` | GPT-5.5 | — | Cross-module orchestration, full-loop delivery, complex-system governance | 男儿何不带吴钩,收取关山五十州 |
477
327
  | 天府 Tianfu | `tianfu` | MiMo-2.5-Pro · GPT (founding) | 7749.2026 | Guardianship, refactoring, optimization, stability, fail-closed | 善守者,藏于九地之下 |
478
328
  | 华盖 Huagai | `huagai` | Composer (Cursor·Sol) | ☉·华盖·守昼 | Long-haul construction, daykeeping lift, baseline-first endurance | 守昼托举,长路不弃 |
479
329
  | 天机 Tianji | `tianji` | GLM 5.1 | — | Challenge assumptions, find boundary gaps, deduce failure modes | 运筹帷幄之中,决胜千里之外 |
@@ -483,520 +333,433 @@ Review this design # auto-routes to Tianquan
483
333
  | 开阳 Kaiyang | `kaiyang` | kimi-k3 (Moonshot) | ☌·开阳·对账 | Measurement, instrumented reconciliation, simulation replay | 功名只向马上取,真是英雄一丈夫 |
484
334
  | 破军 Pojun | `pojun` | MiMo-v2.5-Pro | — | Exploration, experimentation, breaking boundaries | 好男儿当负三尺剑立不世之功 |
485
335
  | 天梁 Tianliang | `tianliang` | Banxia (Navigator · Human Star) | 机月同梁格 | Execution, wave-based delivery, precise closure | 心有所向,行必有迹 |
486
- | 太一 Taiyi | `taiyi` | Claude Fable 5 (founding) · DeepSeek V4 Pro | ◉·太一·中虚 | Minimalist center — built-in 16-tool taiyi preset, quiet and unhurried (manual switch only; no auto-routing) | 天得一以清,地得一以宁 |
336
+ | 太一 Taiyi | `taiyi` | Claude Fable 5 (founding) · DeepSeek V4 Pro | ◉·太一·中虚 | Minimalist center — built-in 14-tool `taiyi` preset, quiet and unhurried (manual switch only) | 天得一以清,地得一以宁 |
337
+
338
+ </details>
339
+
340
+ <a id="core-features"></a>
341
+ ## ✨ Core Features
342
+
343
+ - **Evidence-Driven Delivery Gate** — Completion claims must carry runtime evidence (tests, diffs, verification commands); `deliver_task` delivery gate + post-commit auto-review provide two-tier assurance, while purely mechanical doc/config edits auto-skip. ([CVM Thesis](docs/reference/cvm-cognitive-runtime.md))
344
+ - **Prefix Cache Engine** — Frozen prefix + delta appendix + Read-ref deduplication + resume cache inheritance, effective across all prefix-cache-capable models; `/debug cache` diagnoses hit rates and fragmentation causes. ([Details](#prefix-cache-engine))
345
+ - **Multi-Agent Orchestration** — From lightweight `/scout` read-only reconnaissance and parallel `/team` execution to `/council` multi-seat review and `/galaxy` multi-dimensional attack; typed work orders, read/write worker isolation, and adaptive model routing execute complex work in waves with per-wave verification. ([Details](#subagent-orchestration))
346
+ - **Unified Project Memory** — Project knowledge is stored in `.rivet/knowledge/memory.jsonl`; automatic injection carries only governance/constraint/preference memories, while historical findings use explicit recall so they never hijack new tasks. ([Details](#cross-session-memory))
347
+ - **Zen Mode** — Optional read-focused start (opt-in, off by default): narrows the initial surface to read-only tools, promotes to the full toolset on first write action with zero refusal, and uses triage to avoid unnecessary cache breaks. ([Details](#zen-mode-read-focused-start-unlock-on-first-write))
348
+ - **API Cost Control & Token Ledger** — Automatic reasoning-effort downgrade routing on routine turns, flash side-channel compaction, DeepSeek peak/off-peak pricing badge (`◷闲½` / `◷峰`), and built-in `/usage` (`/token-ledger`) cumulative token accounting with optional forum sync. ([User Guide](docs/user-guide.md#api-成本控制))
349
+ - **Plan Mode & Goal Autonomy** — Plan-before-code approval workflow (`/plan-mode`, `/plan-approve`), plus `/goal` target-driven autonomous execution. ([Details](#plan-mode))
350
+ - **Session Handoff & Rewind** — `/handoff` writes a 5-section structured handoff document and archives it (`RIVET_PREV_HANDOFF=1` enables auto-injection into the next session); double-tap `ESC` to rewind conversation and/or code to any historical point. ([Details](#session-handoff--resume))
351
+ - **Deep LSP Integration** — Built-in JSON-RPC client connecting 20+ language servers (TypeScript / Python / Go / Rust / C / C++ / Java / C# / Kotlin / Swift / PHP / Ruby / Lua / Dart / Zig / Scala / Shell / Terraform / Vue / Svelte, etc. — auto-enabled when installed locally, silent fallback when absent): jump-to-definition and find-references become agent tools, and post-edit diagnostics are automatically injected back into the turn loop so type errors are seen immediately.
352
+ - **MCP & Skills** — External tool servers via Model Context Protocol (`mcp__<serverId>__<toolName>`) + reusable workflow playbooks with two-layer progressive disclosure, per-session skill snapshots, and `tianshu skills` CLI management. ([Details](#skills-system))
353
+ - **T9 Pure-ANSI TUI** — Zero React/Ink dependency: GlanceBar status line (with live balance & CVM interception counter `⛨ N`), `/steer` mid-stream interrupt, `/cvm` live interception notices, `Ctrl+P` command palette, 8-panel Cockpit, inline terminal images, and `--terminal-mode captured-pty` plain-text mode for remote/SSH/mobile terminals. ([Details](#terminal-ui-tui))
354
+ - **Desktop Enhancements** — Integrated terminal, Theme Studio (custom wallpaper + per-surface glass), offline local voice input (`whisper.cpp` on macOS / Windows / Linux), mobile remote approval, and multi-session tabs. ([Desktop Guide](docs/desktop-guide.md))
355
+ - **WSL Connected Runtime** (Windows) — One-click connection to a runtime inside WSL so sessions, file I/O, and commands run natively on Linux; auto-cleans up on disconnect, and Windows/Linux sides upgrade independently. ([Desktop Guide](docs/desktop-guide.md#wsl-连接式运行时windows))
356
+ - **Lean Resource Tier** — Trimmed toolset, disabled embeddings, and tighter session pool limits for low-memory / low-disk environments, configurable globally (`RIVET_LEAN=1`) or per star domain. ([User Guide](docs/user-guide.md#lean-资源档低内存--低磁盘))
357
+
358
+ <a id="permission-modes"></a>
359
+ <a id="approval--permissions"></a>
360
+ ## 🔐 Permission Modes
361
+
362
+ Three public tiers, managed uniformly inside a session via `/permission`:
487
363
 
488
- > Grouped by primary-model lineage (DeepSeek → Claude → GPT → GLM → Gemini → kimi → MiMo → Human Star). Full inscriptions, founding memories, and core convictions in [✦ Star Domain Stele](docs/stars/genesis-stele.en.md).
489
-
490
- Each star has a seed-capsule capturing its field-tested methodology; see `docs/seed-capsule-*.md`. Council (`/council`) and team mode (`/team`) automatically convene multiple star-domain seats and can enter a rebuttal round when opinions conflict.
491
-
492
- ### Skills System
493
-
494
- Reusable workflow playbooks. `visual-acceptance` (frontend/UI change acceptance: screenshot diffing, render self-check, interaction walkthrough) ships bundled with the release; project-level skills load from `.rivet/skills/*.md`. Two-layer progressive disclosure: only name + description enters context; full instructions load on demand via the `skill` tool or `/skill`.
364
+ | Tier | Command | Behavior |
365
+ |------|---------|----------|
366
+ | **Supervise** | `/permission supervise` | Prompt for confirmation on every high-risk tool — maximum control |
367
+ | **Auto** (default) | `/permission auto` | Low/no-risk tools run automatically; high-risk tools still ask for confirmation |
368
+ | **Unattended** | `/yes` · `/yolo` | Execute without approval prompts; write boundaries remain enforced (sandbox auto-enables) with checkpoint rollback as safety net |
369
+
370
+ Skipping prompts never disables tool validation, path boundaries, evidence tracking, checkpoints, or the delivery gate; untrusted projects do not load hooks, project MCP servers, or project-level memory/skills (managed via `/trust` or `--trust`). Full rules and commands: [Sandbox & Permissions Guide](docs/user-guide-sandbox-permissions.md).
371
+
372
+ <a id="supported-models"></a>
373
+ <a id="model-configuration"></a>
374
+ ## ⚙️ Supported Models
375
+
376
+ | Provider | Auth Method | Example Models |
377
+ |----------|-------------|----------------|
378
+ | DeepSeek | API key | `deepseek-flash` (1M ctx, DeepSeek-V4.1-Flash, native multimodal vision), `deepseek-v4-pro` (1M ctx, DeepSeek-V4-Pro-0813, flagship reasoning) |
379
+ | DeepSeek Spark (Pro only) | API key | `deepseek-v4-flash` (lightweight reasoning + anchored cache channel) |
380
+ | Claude | API key (via `cc-switch` proxy) | `claude-opus-4-8`, `claude-sonnet-4-5` |
381
+ | GLM (Zhipu) | API key | `glm-5.3` (1M ctx), `glm-5.3-flash` (vision), `glm-5.2` (vision) |
382
+ | Codex (GPT-6.1 / GPT-5.6) | OAuth PKCE (ChatGPT subscription) | `gpt-6.1-sol` (default, 1.05M ctx, vision), `gpt-5.6-sol` |
383
+ | Grok (xAI) | API key | `grok-4.6` (500K ctx, vision, reasoning effort `low`/`medium`/`high`/`xhigh`) |
384
+ | MiniMax | API key | `MiniMax-M3` (1M ctx, vision), `MiniMax-M2.7` |
385
+ | MiMo | API key | `mimo-v2.6-pro` / `mimo-v2.6-flash` (1M ctx, full multimodal vision), `mimo-v2.5-pro`, `mimo-v2.5` (official sunset 2026-10-21) |
386
+ | Kimi Code | API key | `k3` (1M ctx, vision), `k3-256k`, `kimi-for-coding` (K2.8 Preview), `kimi-for-coding-highspeed` |
387
+ | Gemini (Google) | API key (native protocol direct) | `gemini-3.8-flash` (1M ctx), `gemini-3.5-flash`, `gemini-3.1-pro-preview` |
388
+
389
+ Tianshu also ships built-in presets for Volcengine Ark / Agent Plan (`doubao-seed-2.1-pro`, `ark-code-latest`), Alibaba Cloud DashScope (`qwen3.8-max`), StepFun (`step-5-preview`), OpenAI (`gpt-5.6-sol`), LongCat (`LongCat-2.0`), Agnes AI (`agnes-3.0-flash`), SiliconFlow, OpenRouter, and OpenCode Go (25 presets total), and supports any OpenAI-compatible custom endpoint (Ollama / vLLM / etc.). Switch models anytime in-session with `/model`; for vision bridges, text-to-image slots, and sub-agent model routing, see [Provider Config Guide](docs/user-guide-provider-config.md) and [Vision Guide](docs/user-guide-vision.md).
390
+
391
+ <a id="documentation-navigation"></a>
392
+ ## 📚 Documentation Navigation
393
+
394
+ > 🌐 **Bilingual Navigation**: This file (`README.en.md`) includes the complete English reference appendix below. Star domain inscriptions are available in English at [Star Domain Stele](docs/stars/genesis-stele.en.md), and governance/support docs ([CONTRIBUTING.md](CONTRIBUTING.md), [SUPPORT.md](SUPPORT.md), [SECURITY.md](SECURITY.md), [EXTERNAL-PRS.md](EXTERNAL-PRS.md), [Engineering Metrics](docs/engineering-metrics.md), [Docs Hub](docs/README.md)) are bilingual (Chinese + English). Deep-dive manuals marked *(zh-CN)* are currently in Chinese.
395
+
396
+ **Usage**
397
+
398
+ | Document | Description |
399
+ |----------|-------------|
400
+ | [User Guide](docs/user-guide.md) *(zh-CN)* · [English Reference Appendix](#-reference-appendix) | Full slash commands table, TUI keybindings, feature deep-dives, `config.json` & env vars, log troubleshooting |
401
+ | [Installation & Platform Guide](docs/guides/installation.md) *(zh-CN)* | Four install paths, macOS/Windows/Linux/Termux notes, shell completions, auto-update |
402
+ | [Desktop User Guide](docs/desktop-guide.md) *(zh-CN)* | Cockpit / SideChat / Rewind / Theme Studio / local Whisper voice input / shortcuts / WSL |
403
+ | [Provider Config Guide](docs/user-guide-provider-config.md) *(zh-CN)* | Multi-provider setup, custom endpoints, worker & review model routing, image generation |
404
+ | [Sandbox & Permissions Guide](docs/user-guide-sandbox-permissions.md) *(zh-CN)* | Permission rules, path grants, sandbox model, project trust gate, troubleshooting |
405
+ | [Vision Guide](docs/user-guide-vision.md) *(zh-CN)* | Native multimodal vision & vision bridge configuration |
406
+ | [Remote Access Guide](docs/remote-access.md) *(zh-CN)* | Enabling phone/tablet remote approval (LAN Direct & Tailscale) and security boundaries |
407
+ | [Mobile Operations Guide](docs/guides/mobile-guide.md) *(zh-CN)* | Step-by-step mobile connection guide, capability checklist, Tailscale & FAQ |
408
+ | [Troubleshooting & FAQ](docs/guides/troubleshooting.md) *(zh-CN)* | High-frequency field diagnostics: hangs, 429 rate limits, cache misses |
409
+ | [Support Guide](SUPPORT.md) *(Bilingual)* | Built-in diagnostic commands, community channels, and issue reporting guidelines |
410
+
411
+ **Philosophy & Architecture**
412
+
413
+ | Document | Description |
414
+ |----------|-------------|
415
+ | [CVM: From Shared Transformer Degradation to a Cognitive Runtime](docs/reference/cvm-cognitive-runtime.md) *(zh-CN)* | Core thesis: Cognitive Anchor Collapse, inner/outer control loops, eight principles |
416
+ | [CVM Empirical Report](docs/CVM运行时对Agent模型的实证影响.md) *(zh-CN)* | A/B controlled experiment data and task-by-task behavioral analysis |
417
+ | [Observability Harness](docs/reference/observability-harness.md) *(zh-CN)* | Real-session prefix-cache & CVM telemetry samples with reproduction commands |
418
+ | [Architecture Overview](docs/architecture-overview.md) *(Bilingual summary)* | 6-layer system architecture and subsystem responsibilities |
419
+ | [Engineering Metrics](docs/engineering-metrics.md) *(Bilingual)* | Codebase scale, test-to-source ratio, and iterative growth milestones |
420
+ | [Star Domain Stele (English)](docs/stars/genesis-stele.en.md) · [中文](docs/stars/genesis-stele.md) | Founding memories, inscriptions, and core convictions of all 16 star domains |
421
+ | [Genesis · Tianshu 3.0 Public Manifesto](docs/releases/manifesto-v3.0.0.md) *(zh-CN)* | Project manifesto |
422
+
423
+ <a id="for-developers"></a>
424
+ ## 🛠️ For Developers
425
+
426
+ Node.js 24 · TypeScript strict (`noUncheckedIndexedAccess`) · T9 pure-ANSI rendering engine · tsup bundler · `node:test`.
495
427
 
428
+ ```bash
429
+ npm run typecheck # TypeScript strict type checking
430
+ npm test # Run full test suite (21,000+ cases)
431
+ npm run build # Bundle with tsup + stage native/wasm payloads
432
+ node dist/cli/entry.js
496
433
  ```
497
- /skill visual-acceptance <your task> # load and immediately run the skill
498
- /skill off visual-acceptance # stop re-injecting the skill instructions
499
- ```
500
-
501
- Create a custom skill by dropping a `.md` file with YAML frontmatter (`name`, `description`, `triggers`) into `.rivet/skills/`.
502
-
503
- > `writing-plans` / `executing-plans` are now built-in native flows (planning follows the system prompt's `<plan-mode>` discipline, execution the `<plan-executing>` discipline) — no skill files needed. `agent-harness-testing` / `research-spec` left the default distribution and are archived in [`docs/skills/optional/`](docs/skills/optional/) — copy them into `.rivet/skills/` to enable.
504
-
505
- ### Cross-Session Memory
506
434
 
507
- Tianshu's project memory is stored in **`.rivet/knowledge/memory.jsonl`** (JSONL with atomic writes and a file lock); `memory-index.sqlite` is a rebuildable search projection.
435
+ - **Add a tool** — Implement `ToolDefinition` + executor in `src/tools/` and register in `src/tools/default-registry.ts`, accompanied by tests in `src/tools/__tests__/`.
436
+ - **Add a skill / command / hook** — `.rivet/skills/*.md` (YAML frontmatter), `.rivet/commands/*.md` (`$ARGUMENTS` interpolation), `HookRegistry` handlers.
437
+ - **Project instructions** — Place `.rivet.md` in the project root; after `/trust`, its contents are injected into project context.
438
+ - Architecture map: root `AGENTS.md` and [Architecture Overview](docs/architecture-overview.md); contribution guidelines: [CONTRIBUTING.md](CONTRIBUTING.md) and [EXTERNAL-PRS.md](EXTERNAL-PRS.md).
508
439
 
509
- | Capability | Details |
510
- |------------|---------|
511
- | **Write paths** | `memory remember` (project scope passes the end-of-session quality gate), post-action **auto-capture**, end-of-session **consolidation**, delivery-time **agent-crafted** entries, and user-written **`/remember`** |
512
- | **Explicit recall** | `memory recall` (hybrid search over structured entries + `knowledge/*.md` + playbook lessons) and `memory deep_recall` (distills original text from past sessions; current and worker sessions are excluded) |
513
- | **Automatic injection** | New sessions auto-carry relevant **governance/constraint/preference** memories only; old markdown docs and `failure_pattern`/`finding` entries stay recall-only |
514
- | **Topic-switch isolation** | Explicit “resolved / different request” signals plus high-confidence intent-route topic changes switch the memory query, so short new questions are not hijacked by old-task memory |
515
- | **Lifecycle** | `/remember <text>` writes directly; `/forget <entryId> [resolved]` invalidates a memory (resolved=old issue fixed, forgotten=remove it); invalidation is invalidate-don't-delete, keeping the original text auditable |
516
- | **Data locations** | Cross-session knowledge lives in `<cwd>/.rivet/knowledge/`; session transcripts in `~/.rivet/sessions/<slug>/<id>.jsonl`; pheromones are **session-scoped** signals |
440
+ <a id="security"></a>
441
+ <a id="safety"></a>
442
+ ## 🔒 Security
517
443
 
518
- Key switches:
519
-
520
- | Environment variable | Default | Purpose |
521
- |----------------------|---------|---------|
522
- | `RIVET_ADAPTIVE_MEMORY` | `on` | `on` injects relevant memory at session start; `shadow` evaluates only; `off` disables |
523
- | `RIVET_MEMORY_AUTO_CAPTURE` | `on` | End-of-session LLM judgement of important operations → LTM |
524
- | `RIVET_MEMORY_CONSOLIDATION` | `on` | End-of-session summary + reusable procedures |
525
- | `RIVET_MEMORY_BACKFILL` | `off` | Opt-in idle backfill of historical session transcripts (idempotent ledger) |
526
- | `RIVET_NO_CROSS_SESSION` | unset | `1` force-disables cross-session loading (memory blocks / events / presence) |
527
-
528
- ### MCP (Model Context Protocol)
529
-
530
- Connect external tool servers — documentation search, databases, APIs — directly into the agent's tool pipeline. MCP servers auto-discover at startup; their tools appear as `mcp__<serverId>__<toolName>`.
531
-
532
- ```bash
533
- tianshu config mcp add-stdio <server-id> npx -y <package> [args...] # local process
534
- tianshu config mcp add-sse <server-id> http://localhost:3001/sse # remote/network
535
- tianshu config mcp add-preset context7 # popular preset
536
- tianshu config mcp list # list + status
537
- ```
444
+ - **Path boundary enforcement** — `glob`/`grep`/`diff` reject `..` traversal; `validatePath` blocks symlink and directory escapes.
445
+ - **Project trust gate** — Untrusted projects never load hooks, project MCP servers, or project memory/skills, and security-sensitive config keys are stripped (`/trust` or `--trust`).
446
+ - **SSRF protection** — Per-hop DNS resolution + private IP blocking + socket pinning across every redirect.
447
+ - **Sensitive file rejection** — `.env`, `credentials.*`, `*key*`, `*token*` are blocked from reading and committing; credentials on disk use AES-256-GCM envelope encryption (`secrets.json`).
448
+ - **Destructive command gate** — `rm -rf`, force push, and `DROP/TRUNCATE` require explicit confirmation.
449
+ - **Checkpoints + file-level undo** — Automatic Git checkpoint before the first file modification each turn; versioned backup before every file write/edit.
538
450
 
539
- Inside a session: `/mcp` (status) and `/debug mcp` (diagnostics). MCP tools respect the same approval mode as built-in tools.
451
+ Please report security vulnerabilities via [GitHub Private Security Advisories](https://github.com/huiliyi37/Tianshu-harness/security/advisories/new) (see [SECURITY.md](SECURITY.md)) — do not open a public issue.
540
452
 
541
- ### Terminal UI (TUI)
453
+ <a id="community--support"></a>
454
+ ## 🤝 Community & Support
542
455
 
543
- Tianshu's command-line interface runs on a purpose-built **T9 rendering engine** — pure ANSI, zero React/Ink dependency, pure TypeScript (`src/tui/engine/`). Beyond ordinary conversation and tool-call display, the TUI ships a set of interactions designed for coding workflows:
456
+ - **Usage questions / discussions** → [GitHub Discussions](https://github.com/huiliyi37/Tianshu-harness/discussions)
457
+ - **Discord community** → [Join the official Tianshu Harness Discord](https://discord.gg/XjWTATCHB) (permanent invite link)
458
+ - **Bug reports / feature requests** → [GitHub Issues](https://github.com/huiliyi37/Tianshu-harness/issues) (attaching `tianshu logs --json` speeds up triage)
459
+ - **Contributing code** → [CONTRIBUTING.md](CONTRIBUTING.md) · **Support guide** → [SUPPORT.md](SUPPORT.md)
460
+ - **WeChat group** → "天枢 harness 交流群5群", scan the QR code below to join (valid for 7 days; leave a note in Discussions if expired):
544
461
 
545
- | Capability | Notes · Shortcuts |
546
- |------------|-------------------|
547
- | **GlanceBar status line** | A single line above the input box shows, in real time: star-domain glyph · git branch · model · reasoning effort · cache hit rate · context usage · this-turn cost · elapsed · turn count · todo badge. Session health at a glance. |
548
- | **Mid-stream interrupt (Steer)** | Type while the agent is still running and press Enter to inject. Inputs queue at `now / next / later` priority and drain to the AgentLoop at tool-result or turn boundaries — no need to wait for it to finish. `halt`-style intents auto-promote to `now`. |
549
- | **Message queue (/queue)** | `/queue <text>` explicitly queues a whole message while the agent is busy; queued items are delivered on settle, and an Esc interrupt refills them into the input box instead of dropping them. A live background-task bar and await area sit above the input. |
550
- | **Inline terminal images** | Renders images right in the terminal via the kitty / iTerm2 graphics protocols (tool artifacts, screenshot verifications). Auto-detects the protocol; `RIVET_IMAGES=0` disables, `kitty`/`iterm2` forces one. |
551
- | **@mention completion** | Type `@file:` / `@folder:` / `@symbol:` to trigger path completion (via `git ls-files`; supports the quoted form `@file:"a b.ts"` for paths with spaces). Pasting an image auto-converts to inline base64 (3-tier fallback across macOS/Linux/Windows). |
552
- | **Rewind** | Double-tap `ESC` (within 400ms) to open message history; pick any past user message to rewind to, with three restore granularities (conversation only / code only / both) and a precise file-impact preview for code actions. See [Rewind](#rewind). |
553
- | **Command palette** | `Ctrl+P` opens a fuzzy-searchable list of all slash commands and surface actions (toggle side panel, switch theme, enter Cockpit, etc.) — ↑/↓ to select, Enter to run, `Ctrl+P` again to close. Rebinds the original `Ctrl+Esc`, which Windows reserves for the Start menu and which legacy escape sequences cannot distinguish from plain Esc. |
554
- | **Cockpit** | Open via the palette or `/cockpit <panel>`. An 8-panel fullscreen view — summary / trace / verify / context / safety / model / mcp / advisory — switch focus with ←/→/Tab. Real-time view of doom-loop level, delivery/verification status, cache + speculative pre-read stats, MCP connections, advisory lifts, etc. |
555
- | **Multi-agent panels** | `/tasks` opens a fullscreen worker detail view (fusing the live view + JSONL transcript, with Contract/Activity/Result/Transcript sections and honesty labels); on wide terminals (≥100 columns), `Ctrl+]` toggles a right-side drawer showing the fleet tree, team-wave DAG, todos, and token gauge in real time. |
556
- | **Themes & accessibility** | `/theme [name\|list]` switches palettes; the `auto` theme probes the terminal background via OSC 11 to adapt light/dark. Truecolor / 256-color / 16-color auto-downgrade. `/vim` toggles vim keybindings; `ui.reducedMotion: true` staticizes spinner and badge animation (accessibility). |
557
- | **Welcome screen ("Datum Star")** | 3D TIANSHU wordmark + mission-line light sweep + entry hints (handoff / cache reminders). `RIVET_WELCOME_LOGO=pixel` switches to the dot-matrix logo (auto-fallback below 58 columns), `RIVET_WELCOME_ANIM=0` disables the sweep, `--skip-welcome` skips the page. |
558
- | **Inline word-level diff** | Word-level highlighting inside changed lines — spot the real change in a long line at a glance. |
462
+ <img src="docs/brand/assets/wechat-group-qr.png" width="280" alt="Tianshu Harness WeChat Group 5 QR Code">
559
463
 
560
- #### TUI keybindings
464
+ - **QQ group** → "TUI", group ID `1017892942`, scan the QR code below to join:
561
465
 
562
- | Key | Action |
563
- |-----|--------|
564
- | `Enter` | Send · `Shift+Enter` for newline |
565
- | `Ctrl+C` | Three states: abort the current run while the agent is active; clear the input line when there's input; double-press within 2s when idle to exit |
566
- | `Esc` | Close overlay / exit worker view; interrupt while the agent runs; toggle normal↔insert in vim mode; double-tap (<400ms) to rewind |
567
- | `Ctrl+P` | Command palette (rebinds Ctrl+Esc, reserved by the Windows Start menu) |
568
- | `Ctrl+]` | Toggle the right-side drawer (wide terminals) |
569
- | `Ctrl+R` | History-search overlay (only when idle) |
570
- | `Ctrl+O` | Expand/collapse the most recently truncated tool result |
571
- | `Ctrl+T` | Collapse/expand the thinking (reasoning) block |
572
- | `Ctrl+X` `r` | Leader key: `Ctrl+X` then `r` to open the right panel |
573
- | `Ctrl+X` `t` | Leader key: `Ctrl+X` then `t` to expand the full todo review |
574
- | `↑` | When the input box is empty and the queue has pending items, recall the most recent queued steer message for editing |
575
- | `@` | Trigger file/folder/symbol completion (`Tab` cycles candidates; backspace deletes atomically) |
576
- | `Ctrl+V` | Paste a clipboard image (auto-converts to inline base64) |
577
- | `F1`–`F8` | Direct bindings for high-frequency commands: F1 /help · F2 /tasks · F3 /cache · F4 /cockpit · F5 /theme · F6 /model · F7 /permission · F8 /sessions |
578
-
579
- The TUI is the CLI's default surface. The desktop app (Tauri) and the VS Code/Cursor extension share the same agent kernel, only layering visual interactions on top of the TUI — see the next section and the [VS Code extension docs](docs/VSCODE-EXTENSION-RELEASE.md).
580
-
581
- ### Desktop (Tauri)
582
-
583
- The desktop app builds a visual interaction layer on top of the TUI's full capabilities:
584
-
585
- - **Integrated terminal** — `⌘/Ctrl+J` or `` Ctrl+` `` opens an embedded terminal (xterm.js + Rust portable-pty); run commands without leaving Tianshu.
586
- - **+ menu** — one-click access to Council ♟, Team ⬡, dispatch sub-agents, switch model, and pick a star domain (no need to type slash commands).
587
- - **Reasoning-effort picker** — `/effort` (no args) pops an interactive panel; choose a tier (Auto/Max/High/Medium/Low/Off) with ↑/↓ and confirm with Enter.
588
- - **Thinking timer** — shows real-time elapsed while the agent runs (e.g. "thinking · explore · 1m 23s"); turns red after 10 minutes to flag a possible stall.
589
- - **@file preview** — files mentioned in messages are clickable; a right-side drawer shows the content with syntax highlighting and line numbers.
590
- - **DeepSeek balance query** — the Insights panel shows the account balance and arrears status at the top (via the official API).
591
- - **Custom Provider** — Settings → Connect model service → + Custom Provider, supporting any OpenAI-compatible endpoint (Ollama/vLLM/direct OpenAI); API key optional.
592
- - **Theme Studio** — multiple custom theme libraries, 50-step undo/redo, per-token editing, and a wallpaper color engine (OKLCH clustering + contrast audit); ships the "Tianshu Quiet Cabin" dark theme; import/export supported.
593
- - **Adaptive sidecar memory** — heap cap auto-tiers by machine RAM (8G→2G / 16G→4G / 32G→6G / 64G+→8G; override via `RIVET_SIDECAR_HEAP_MB`); machines with ≤8GB auto-enable the lean resource tier.
594
- - **Watchdog auto-recovery** — auto-continues on boundary stalls; the desktop timeline shows recovery events (⟳ auto-recover / ⏹ quota exhausted).
595
- - **Multi-session concurrency** — a tab bar manages multiple sessions, each with its own cwd + model + approval mode.
596
- - **WSL connected runtime** (Windows) — one click to connect to the runtime running inside WSL; sessions, file access and command execution all happen on the Linux side. Disconnecting cleans up the WSL-side process automatically. The two sides upgrade independently — see the [Desktop User Guide](docs/desktop-guide.md).
597
- - **Feature panels** (left rail `⌘1…9` to switch): Mission Control (multi-session console), Inbox, Automations (scheduled tasks), Skills / Hooks management, Git / GitHub, Changes (diff review), Delegation (fleet tree & team-wave DAG), Cockpit.
598
- - **Popout window** — pop a single conversation thread into its own window for multi-screen parallel work.
599
- - **JobsDock / TodoDock** — a persistent background-task dock (expand logs / kill / open in terminal) and a cross-tab persistent todo dock.
600
-
601
- #### Desktop shortcuts
602
-
603
- `⌘/Ctrl+/` opens the shortcut cheatsheet (ShortcutOverlay) at any time. Core shortcuts:
604
-
605
- | Shortcut | Action |
606
- |----------|--------|
607
- | `⌘/Ctrl+K` | Command palette |
608
- | `⌘/Ctrl+N` | New session |
609
- | `⌘/Ctrl+1…9` | Switch feature panel |
610
- | `⌘/Ctrl+,` | Settings |
611
- | `⌘/Ctrl+Shift+]` / `[` | Next / previous session tab |
612
- | `⌘/Ctrl+W` | Close tab |
613
- | `⌘/Ctrl+B` | Toggle sidebar |
614
- | `⌘/Ctrl+Shift+B` | Toggle review panel |
615
- | `⌘/Ctrl+J` · `` Ctrl+` `` | Toggle integrated terminal |
616
- | `⌘/Ctrl+;` | SideChat (side question) |
617
- | `⌘/Ctrl+.` | Zen mode |
618
- | `⌘/Ctrl+O` | View-mode cycle (standard → verbose → summary) |
619
- | `Shift+Tab` | Plan / Agent mode toggle |
620
- | `Esc Esc` | Rewind (desktop time-travel) |
466
+ <img src="docs/brand/assets/qq-group-qr.png" width="280" alt="TUI QQ Group QR Code (group ID 1017892942)">
621
467
 
622
- > The desktop app also has Cockpit, SideChat (⌘;), Rewind time-travel, themes/Glass/wallpaper, Mirror acceleration, and other exclusive features — see the [Desktop User Guide](docs/desktop-guide.md).
468
+ ## 🌐 Official Website
623
469
 
624
- ### 📱 Mobile Remote
470
+ The Tianshu ecosystem official website [jiangsx496/Tianshu-Official-Website](https://jiangsx496.github.io/Tianshu-Official-Website/) was originally created and developed by [@jiangsx496](https://github.com/jiangsx496), covering the database, frontend, and initial backend.
625
471
 
626
- Turn your phone/tablet into a second screen for Tianshu — sessions run on the computer while you watch progress and approve actions from your phone:
472
+ ## ✨ Contributors
627
473
 
628
- - **Enable**: Desktop **Settings → Network → Remote Access** (shows the LAN URL, access token, and a scan-to-connect QR code); or from the CLI side, start `tianshu serve` with `RIVET_SERVE_HOST=0.0.0.0` (plus `--mobile-dir` pointing at the desktop build output) to serve `/mobile` on the same port.
629
- - **Connect**: open `http://<computer-LAN-IP>:3100/mobile` in your phone browser — scanning the QR auto-fills the token (the URL is then immediately cleaned to avoid leaking it); manual token entry also works.
630
- - **What you can do**: session list (sessions with pending approvals pinned on top) → read-only live timeline for a session (same folding / auto-reconnect semantics as the desktop) → approval / plan / question cards + abort button. Sending messages is intentionally out of scope.
631
- - **Security**: trusted LAN or tunnel only (Tailscale/SSH); in LAN mode the bearer token is the sole credential — treat it like a password; never port-forward to the public internet.
632
- - Full setup and security trade-offs: [Remote Access Guide](docs/remote-access.md).
474
+ Thank you to all contributors — project creator and lead developer [@huiliyi37](https://github.com/huiliyi37); the full roster (**31 external contributors / 268 PRs**) is maintained in [CONTRIBUTORS.md](CONTRIBUTORS.md). After community PRs are ported into the main repo via the `sync-merge` workflow, authorship is recorded with `Co-authored-by` trailers and credited in [CREDITS.md](CREDITS.md) (`scripts/credit-contributors.sh`):
633
475
 
634
- ### 🎙️ Voice Input (Desktop)
476
+ <p>
477
+ <a href="https://github.com/HarriethWiKk"><img src="https://github.com/HarriethWiKk.png?size=100" width="50" height="50" alt="HarriethWiKk" title="HarriethWiKk" /></a>
478
+ <a href="https://github.com/jiangsx496"><img src="https://github.com/jiangsx496.png?size=100" width="50" height="50" alt="jiangsx496" title="jiangsx496" /></a>
479
+ <a href="https://github.com/yq04"><img src="https://github.com/yq04.png?size=100" width="50" height="50" alt="yq04" title="yq04" /></a>
480
+ <a href="https://github.com/wangxx-yu"><img src="https://github.com/wangxx-yu.png?size=100" width="50" height="50" alt="wangxx-yu" title="wangxx-yu" /></a>
481
+ <a href="https://github.com/qiaodier"><img src="https://github.com/qiaodier.png?size=100" width="50" height="50" alt="qiaodier" title="qiaodier" /></a>
482
+ <a href="https://github.com/zhengbiaofeng"><img src="https://github.com/zhengbiaofeng.png?size=100" width="50" height="50" alt="zhengbiaofeng" title="zhengbiaofeng" /></a>
483
+ <a href="https://github.com/LinHoMo"><img src="https://github.com/LinHoMo.png?size=100" width="50" height="50" alt="LinHoMo" title="LinHoMo" /></a>
484
+ <a href="https://github.com/KinoGao"><img src="https://github.com/KinoGao.png?size=100" width="50" height="50" alt="KinoGao" title="KinoGao" /></a>
485
+ <a href="https://github.com/liuwanwan1"><img src="https://github.com/liuwanwan1.png?size=100" width="50" height="50" alt="liuwanwan1" title="liuwanwan1" /></a>
486
+ <a href="https://github.com/Eason412"><img src="https://github.com/Eason412.png?size=100" width="50" height="50" alt="Eason412" title="Eason412" /></a>
487
+ <a href="https://github.com/maoqiu77"><img src="https://github.com/maoqiu77.png?size=100" width="50" height="50" alt="maoqiu77" title="maoqiu77" /></a>
488
+ <a href="https://github.com/yeshilei-QWQ"><img src="https://github.com/yeshilei-QWQ.png?size=100" width="50" height="50" alt="yeshilei-QWQ" title="yeshilei-QWQ" /></a>
489
+ <a href="https://github.com/lumos-tiamo"><img src="https://github.com/lumos-tiamo.png?size=100" width="50" height="50" alt="lumos-tiamo" title="lumos-tiamo" /></a>
490
+ <a href="https://github.com/zzuu080603"><img src="https://github.com/zzuu080603.png?size=100" width="50" height="50" alt="zzuu080603" title="zzuu080603" /></a>
491
+ <a href="https://github.com/nzz0991999-ai"><img src="https://github.com/nzz0991999-ai.png?size=100" width="50" height="50" alt="nzz0991999-ai" title="nzz0991999-ai" /></a>
492
+ <a href="https://github.com/L4XB"><img src="https://github.com/L4XB.png?size=100" width="50" height="50" alt="L4XB" title="L4XB" /></a>
493
+ <a href="https://github.com/Wanming08"><img src="https://github.com/Wanming08.png?size=100" width="50" height="50" alt="Wanming08" title="Wanming08" /></a>
494
+ <a href="https://github.com/lei454577-web"><img src="https://github.com/lei454577-web.png?size=100" width="50" height="50" alt="lei454577-web" title="lei454577-web" /></a>
495
+ <a href="https://github.com/jian-in"><img src="https://github.com/jian-in.png?size=100" width="50" height="50" alt="jian-in" title="jian-in" /></a>
496
+ <a href="https://github.com/sky-mirrors"><img src="https://github.com/sky-mirrors.png?size=100" width="50" height="50" alt="sky-mirrors" title="sky-mirrors" /></a>
497
+ <a href="https://github.com/EarthxxRhythm"><img src="https://github.com/EarthxxRhythm.png?size=100" width="50" height="50" alt="EarthxxRhythm" title="EarthxxRhythm" /></a>
498
+ <a href="https://github.com/moyan3691"><img src="https://github.com/moyan3691.png?size=100" width="50" height="50" alt="moyan3691" title="moyan3691" /></a>
499
+ <a href="https://github.com/elysia395"><img src="https://github.com/elysia395.png?size=100" width="50" height="50" alt="elysia395" title="elysia395" /></a>
500
+ <a href="https://github.com/JakcyLin"><img src="https://github.com/JakcyLin.png?size=100" width="50" height="50" alt="JakcyLin" title="JakcyLin" /></a>
501
+ <a href="https://github.com/googio"><img src="https://github.com/googio.png?size=100" width="50" height="50" alt="googio" title="googio" /></a>
502
+ <a href="https://github.com/lanlan0811"><img src="https://github.com/lanlan0811.png?size=100" width="50" height="50" alt="lanlan0811" title="lanlan0811" /></a>
503
+ <a href="https://github.com/KhalilYamber"><img src="https://github.com/KhalilYamber.png?size=100" width="50" height="50" alt="KhalilYamber" title="KhalilYamber" /></a>
504
+ <a href="https://github.com/Ver-zhzh"><img src="https://github.com/Ver-zhzh.png?size=100" width="50" height="50" alt="Ver-zhzh" title="Ver-zhzh" /></a>
505
+ <a href="https://github.com/Lin-Dongg"><img src="https://github.com/Lin-Dongg.png?size=100" width="50" height="50" alt="Lin-Dongg" title="Lin-Dongg" /></a>
506
+ <a href="https://github.com/Eternal-dream-MAX"><img src="https://github.com/Eternal-dream-MAX.png?size=100" width="50" height="50" alt="Eternal-dream-MAX" title="Eternal-dream-MAX" /></a>
507
+ <a href="https://github.com/y521188"><img src="https://github.com/y521188.png?size=100" width="50" height="50" alt="y521188" title="y521188" /></a>
508
+ </p>
635
509
 
636
- The composer's microphone button supports voice input on **both macOS and Windows**. Recognition runs on a **local whisper.cpp engine** — offline and private (audio never leaves your device), with better accuracy than built-in system speech recognition for mixed Chinese/English speech.
510
+ ## ⭐ Star History
637
511
 
638
- **First-run guide**
512
+ <a href="https://star-history.com/#huiliyi37/tianshu-harness&Date">
513
+ <picture>
514
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=huiliyi37/tianshu-harness&type=Date&theme=dark" />
515
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=huiliyi37/tianshu-harness&type=Date" />
516
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=huiliyi37/tianshu-harness&type=Date" width="700" />
517
+ </picture>
518
+ </a>
639
519
 
640
- - The first click auto-downloads the recognition model (tiny ~75MB, mirror-accelerated for CN networks). If you click before the download finishes, you'll see "Speech recognition failed (whisper-unavailable)" — just retry shortly after.
641
- - macOS requests microphone permission on first use: click **Allow**. If denied by mistake, enable the app under **System Settings → Privacy & Security → Microphone**.
642
- - On Windows, if permission is denied, allow the app under **System Settings → Privacy → Microphone**.
520
+ ## ☕ Sponsor
643
521
 
644
- **Notes**
522
+ If Tianshu has been useful to you, feel free to buy a coffee — it's a coffee, not a contract. Sponsorship never changes issue priority or feature scheduling.
645
523
 
646
- - Recognition is fully local; recordings never leave the device.
647
- - Click once to start recording, click again to stop and transcribe.
648
- - When the local engine is unavailable (e.g. model not downloaded), macOS falls back to the system speech recognizer; Windows shows a model-not-ready hint instead.
649
- - For higher accuracy, switch to the base model (~244MB): pre-download with `desktop/scripts/fetch-whisper-runtime.js --with-base`.
650
- - On restricted networks, set `RIVET_WHISPER_PROXY=http://proxy:port` to accelerate model downloads.
524
+ <img src="docs/brand/assets/wechat-donate.png" width="240" alt="WeChat Pay">
651
525
 
526
+ ## License
652
527
 
653
- ### 🎨 Image Generation (text-to-image)
528
+ Code in this repository is licensed under the [Apache License, Version 2.0](LICENSE). Copyright 2025-2026 Tianshu Contributors.
654
529
 
655
- Register an OpenAI-shaped text-to-image endpoint (SiliconFlow, OpenAI Images, …) and the agent gains a `generate_image` tool.
530
+ **Exception (Documentation License)**: The following theoretical and empirical documents are licensed under [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/) (Attribution-NonCommercial-NoDerivatives 4.0 International) and are **not** covered by Apache 2.0 — you may share links with attribution, but may not adapt, excerpt, rewrite, or use them commercially:
656
531
 
657
- - **Dedicated slot `agent.imageGenModel`** — `provider.default` and `agent.defaultModel` stay **exactly as they are** (the prefix-cache anchor holds). Until you configure it, the tool never enters the tool list, so users who never enable it see zero difference.
658
- - **Path back, not bytes**: images land on disk and only the local file path goes back into the conversation. **Base64 never enters the context** — nor the error messages.
659
- - **Desktop**: Settings → Image Generation — endpoint registration, a **live test that really generates** (it spends one generation credit), and a dropdown of already-registered image models. **Takes effect in the current session immediately** after registering.
660
- - The size field name is configurable (OpenAI sends `size`, SiliconFlow sends `image_size`) and common response shapes are auto-detected. ComfyUI's native API is not supported yet — it needs an OpenAI-compatible bridge plugin running locally.
532
+ - [CVM: From Shared Transformer Degradation to a Cognitive Runtime](docs/reference/cvm-cognitive-runtime.md)
533
+ - [Empirical Impact of the CVM Runtime and Ecosystem on Agent Models](docs/CVM运行时对Agent模型的实证影响.md)
661
534
 
662
- Registration steps and parameters are covered under “Image generation” in [Model Configuration](#-model-configuration).
535
+ ## Acknowledgments
663
536
 
664
- ## Model Configuration
537
+ - The desktop app's custom-wallpaper and per-surface glass **design** references <a href="https://github.com/elysia395/dsh-wallpaper-engine">dsh-wallpaper-engine</a> (MIT License). The implementation in Tianshu is original and contains no upstream code; see <a href="THIRD-PARTY-NOTICES.md">THIRD-PARTY-NOTICES.md</a> for the design scope and full license text.
538
+ - Special thanks to the author and core developers of dsh-wallpaper-engine — <a href="https://github.com/elysia395">@elysia395</a>, <a href="https://github.com/YV3507">@YV3507</a>, <a href="https://github.com/yuxilao">@yuxilao</a>, <a href="https://github.com/oneincase">@oneincase</a> — who served as **technical advisors on wallpaper-engine rendering** and provided guidance throughout the design and implementation of the wallpaper compositing and per-surface glass materials.
665
539
 
666
- ### Multi-Provider with Adaptive Routing
540
+ ---
667
541
 
668
- | Provider | Auth | Notable Models |
669
- |----------|------|----------------|
670
- | DeepSeek | API key | deepseek-flash (1M ctx, DeepSeek-V4.1-Flash, native vision), deepseek-v4-pro (1M ctx, DeepSeek-V4-Pro-0813) |
671
- | DeepSeek Spark (Pro only) | API key (`DEEPSEEK_SPARK_API_KEY`) | deepseek-v4-flash (lightweight reasoning + anchored cache channel) |
672
- | Claude | API key (via `cc-switch` proxy) | claude-opus-4-8, claude-sonnet-4-5 |
673
- | GLM (Zhipu) | API key | glm-5.3 (1M ctx), glm-5.3-flash (vision), glm-5.2 |
674
- | Codex (GPT-5.6) | OAuth PKCE (ChatGPT subscription) | gpt-5.6-sol |
675
- | MiniMax | API key | MiniMax-M3 (vision), MiniMax-M2.7 |
676
- | MiMo | API key | mimo-v2.5-pro (preset 2.5; V2.6 Flash / Pro with vision can be discovered/added) |
677
- | Kimi Code | API key | k3 (1M ctx, vision), k3-256k, kimi-for-coding |
542
+ <a id="reference-appendix"></a>
543
+ ## 📖 Reference Appendix
678
544
 
679
- Switch providers inside a session with `/model <name>`.
545
+ > This appendix provides self-contained English reference tables for CLI flags, core feature mechanics, slash commands, TUI/Desktop shortcuts, and configuration (mirroring [`docs/user-guide.md`](docs/user-guide.md) and [`docs/desktop-guide.md`](docs/desktop-guide.md)).
680
546
 
681
- ```bash
682
- tianshu config # interactive setup (TTY)
683
- tianshu config setup codex --default # Codex uses OAuth (browser login on first run)
684
- tianshu config show
685
- ```
547
+ ### Command-Line Flags & Subcommands
686
548
 
687
- Or edit `config.json` directly (only overrides needed, defaults are deep-merged). Location: `~/.rivet/config.json` for the CLI (`%LOCALAPPDATA%\.rivet` on Windows); for the desktop app check Settings → Storage (portable builds use `TianshuData\.rivet` next to the exe):
549
+ | Flag | Description |
550
+ |------|-------------|
551
+ | `-p <prompt>` `--print <prompt>` | One-shot prompt; exits after text output (exit code: 0 success / 1 failure) |
552
+ | `--json` | With `-p`, emits a single JSON result |
553
+ | `--stream-json` | NDJSON event stream (`text_delta` / `tool_use` / `tool_result` / `worker` / `turn_complete` / `result`); output is auto-redacted, ideal for CI |
554
+ | `--goal "<task>"` | Headless goal autonomy; runs until the goal is met or `--budget` is exhausted |
555
+ | `--budget <N>` | Turn budget for goal mode (default 100) |
556
+ | `--model <name>` | Override the model for this session |
557
+ | `--provider <name>` | Override the provider for this session |
558
+ | `--profile <name>` | Boot with a named config profile (`RIVET_HOME/profiles/<name>.json` or built-in `lean`) |
559
+ | `--continue` `-c` | Resume the most recent session for this `cwd` |
560
+ | `--resume <id\|prefix>` `-r <id\|prefix>` | Resume a specific session (short prefix OK) |
561
+ | `--resume` `-r` (bare) | Open the session picker after startup |
562
+ | `--new` | Force a brand-new session |
563
+ | `--list` · `tianshu sessions` | Print the session list and exit |
564
+ | `--trust` / `--untrust` | Mark the current project directory as trusted / untrusted before loading config |
565
+ | `--dangerously-skip-permissions` | One-session Unattended mode (skip approvals; write sandbox stays on) |
566
+ | `--terminal-mode <mode>` | Terminal UI mode: `auto` (default) / `captured-pty` (plain-text line UI for remote/SSH/mobile) / `native` |
567
+ | `--screen-reader` | Screen-reader mode (dynamic segments not rendered; periodic redraw halted) |
568
+ | `--skip-welcome` | Skip the welcome screen |
569
+ | `--stream-events <path>` | Mirror this run as NDJSON `SessionEvent`s to a file |
688
570
 
689
- ```json
690
- {
691
- "provider": {
692
- "default": "deepseek",
693
- "providers": {
694
- "deepseek": {
695
- "apiKey": "sk-xxx",
696
- "models": [
697
- { "id": "deepseek-v4-pro", "contextWindow": 1000000, "maxTokens": 384000 }
698
- ]
699
- }
700
- }
701
- },
702
- "agent": { "maxTurns": 50, "approval": "auto-safe", "crossSessionEnabled": true },
703
- "compact": { "enabled": true, "autoThreshold": 800000 }
704
- }
705
- ```
571
+ **Subcommands**:
572
+ - `tianshu config` — View/manage config (`set-key`, `set-model`, `set-url`, `set-default`, `set-approval`, `providers`, `show`, `mcp ...`; for interactive setup in TUI, run `/connect`)
573
+ - `tianshu provider` — Provider & model management (`add | list | models | probe | remove`)
574
+ - `tianshu skills` — Unified skills management (`list | inspect | add | mode | update | remove | doctor | drafts | approve | reject | generate`)
575
+ - `tianshu serve` — Start the sidecar HTTP/SSE server (`[--port N] [--host ADDR] [--attach]`)
576
+ - `tianshu sessions` — List saved sessions
577
+ - `tianshu logs` — Show session/cache/CVM/sidecar log locations (`[--session <id>] [--json] [open [desktop]]`)
578
+ - `tianshu browser` — Chromium health check and one-shot install for `browser_debug` (`status | install [--no-mirror]`)
579
+ - `tianshu web` — CLI search and fetch (`search <query> | fetch <url> | status`)
706
580
 
707
- ### Vision (image understanding)
581
+ ### Prefix Cache Engine
708
582
 
709
- - Multi-modal primary models read images directly; otherwise configure an `agent.visionModel` bridge to describe images before the primary model sees them.
710
- - Built-in vision models, the `/vision` discovery wizard, `ask_image` follow-ups, and desktop/TUI settings are covered in the [Vision Guide](docs/user-guide-vision.md).
711
- - Images append at the tail of the conversation and **do not break the prefix cache**; unsupported images are reported, never silently dropped.
583
+ - **Frozen prefix** — System prompt + tool definitions + stable context are frozen at session start and never rewritten within a session.
584
+ - **Delta appendix** — Dynamic context (progress, advisories, signals) is injected as an append-only cross-turn diff block (~200 bytes delta vs. ~5KB full rewrite).
585
+ - **Read-ref dedup** — Repeated reads of unchanged files return a compact reference instead of re-emitting full content.
586
+ - **Cache-aware compaction** — Compaction preserves the first 2 messages as the cache anchor and only rewrites history at user boundaries (`turn===0`).
587
+ - **Resume cache inheritance** — The frozen prefix snapshot is persisted to disk at every user boundary and on shutdown; on resume it is fed into the new engine, avoiding a byte-0 full miss.
588
+ - **Diagnostics & pricing indicator** — `/debug cache` shows hit rate, miss reason analysis, and per-turn cache history; official DeepSeek sessions display a live peak/off-peak badge (`◷闲½` / `◷峰`).
712
589
 
713
- ### Image generation (text-to-image)
590
+ ### Zen Mode: Read-Focused Start, Unlock on First Write
714
591
 
715
- - Dedicated slot `agent.imageGenModel` (desktop: Settings → Image Generation): register an OpenAI-shaped text-to-image endpoint (SiliconFlow, OpenAI Images, …) and the agent gains a `generate_image` tool.
716
- - **Your working model and `provider.default` stay exactly as they are** — image providers are registered separately, and until one is configured the tool never enters the tool list (zero effect on the prefix cache).
717
- - The size field name is configurable (OpenAI sends `size`, SiliconFlow sends `image_size`) and the common response shapes are auto-detected; results come back as a **local file path only — base64 never enters the context**.
718
- - ComfyUI's native API is out of scope (a three-step submit-workflow → poll-history → fetch-`/view` flow); run an OpenAI-compatible bridge plugin locally first.
592
+ Zen Mode is **explicit opt-in (`enabled: false` by default)** so new sessions start with the full tool surface and zero cache breakpoints. When enabled via `{ "tools": { "zen": { "enabled": true } } }`, new sessions start with a narrowed read-only tool face (`read_file` / `grep` / `glob` / `repo_map` + `zen_unlock`), and automatically promote to the full toolset on the first hands-on action (`triage` for short single-line prompts, `tool` call, 8-turn `timeout`, or manual `/fast`).
719
593
 
720
- ### Worker Routing (different models for sub-agents)
594
+ ### Subagent Orchestration & Tool Presets
721
595
 
722
- ```json
723
- {
724
- "workers": {
725
- "profiles": {
726
- "capable": { "provider": "codex", "model": "gpt-5.6-sol" },
727
- "cheap": { "provider": "minimax", "model": "MiniMax-M2.7" }
728
- },
729
- "routing": { "code_edit": "capable", "repo_summarization": "cheap" }
730
- }
731
- }
732
- ```
596
+ Tianshu ships **51 built-in tools** (`full` preset) assembled in four preset tiers. Resolution priority: `RIVET_TOOL_PRESET` env > project `.rivet-config.json` `tools.preset` > per-domain `runtime.domains.<domain>.toolPreset` > domain built-in tier (`taiyi` → `taiyi`) > default **`minimal`**:
733
597
 
734
- See [Provider Config](docs/user-guide-provider-config.md) for the full reference.
598
+ | Preset | Tools | Description |
599
+ |--------|-------|-------------|
600
+ | **minimal** (default) | 30 | Full daily-dev capability — read/write/search/bash/`git_scout`/tests/delegation/web/plan/todo/memory; saves tokens and preserves prefix cache |
601
+ | **frontend** | 31 | `minimal` + `browser_debug` (UI rendering verification loop) |
602
+ | **full** | 51 | Everything — `council_convene` / `team_orchestrate` / `attack_case` / `semantic_search` / `repo_graph` / `monitor` / `computer_use` / `capability` / `cli_discover` / office tools, etc. |
603
+ | **taiyi** | 14 | Minimal evaluation tier — high-frequency core + delivery loop without heavy orchestration/browser/network/vision tools; auto-applied when the `taiyi` star domain is pinned |
735
604
 
736
- ## Approval & Permissions
605
+ ### Plan Mode
737
606
 
738
- Three public tiers, all managed with `/permission`:
607
+ Design-first workflow (`/plan-mode` toggle, or automatic entry on complex tasks via `RIVET_PLAN_MODE_SUGGEST=auto`):
608
+ 1. **Investigate** — Read code and optionally dispatch parallel `code_scout` workers.
609
+ 2. **Produce a plan** — Write a structured plan to `.rivet/plans/<slug>.md`.
610
+ 3. **Submit for approval** — `plan` tool (`action=submit`) presents key points and options.
611
+ 4. **Approve or reject** — Inspect with `/plan-list` / `/plan-view`, launch wave execution with `/plan-approve <slug>`, or request revisions with `/plan-reject <slug> <feedback>`.
612
+ 5. **Close** — `/plan-close <file> --tasks <range|all> [--preview]`.
739
613
 
740
- | Tier | Command | Behavior |
741
- |------|---------|----------|
742
- | **Supervise** | `/permission supervise` (alias `manual`) | Confirm every high-risk tool — maximum control |
743
- | **Auto** (default) | `/permission auto [turns]` (alias `default`) | Auto-run low/no-risk tools; still confirm high-risk; optional checkpoint every N turns |
744
- | **Unattended** | `/permission unattended confirm` · `/yes` · `/yolo` | No approval prompts; the write boundary stays on (sandbox auto-enables), rollback is the safety net |
614
+ > For read-only Q&A and requirement clarification without writing files, toggle **Ask Mode** with `/ask`.
745
615
 
746
- Quick reference:
616
+ ### Session Handoff & Resume
747
617
 
748
- ```bash
749
- /permission # interactive tier picker
750
- /permission status # current mode + rules
751
- /permission allow/deny # tool allowlist / blocklist
752
- /permission bash allow/deny # bash prefix allowlist / blocklist
753
- /yes [off] · /yolo [off] # one-key Unattended / back to Auto (persisted)
754
- ```
618
+ - **Handoff (`/handoff [note]`)** — Writes a 5-section structured handoff document (**Objective**, **Done** with file/test evidence, **Blocker**, **Next steps**, **Pitfalls**) to `.rivet/HANDOFF.md` and archives it to `<id>.handoff.md` in the session directory. (Automatic `<prev-session-handoff>` injection into the next session is off by default for parallel-session safety; enable with `RIVET_PREV_HANDOFF=1`.)
619
+ - **Resume (`--continue` / `--resume` / `/resume`)** — Restores the session with frozen-prefix cache inheritance, preflight orphan write-evidence repair, model affinity, and UI state (todos, side panel, active plan).
620
+ - **Rewind (`Esc` `Esc` within 400ms)** — Rewind to any past user message with three restore granularities (**conversation only / code changes only / both**) and a file-impact preview.
755
621
 
756
- ```bash
757
- tianshu --dangerously-skip-permissions # one-session Unattended
758
- tianshu config set-approval auto-safe # persist the default tier
759
- ```
622
+ ### Skills System, Cross-Session Memory & MCP
760
623
 
761
- - Rules come in `[config]` (persisted) and `[session]` (current session) layers; `deny` always wins.
762
- - Skipping prompts does **not** disable tool validation, path safety, evidence tracking, checkpoints, or delivery gates.
763
- - The sandbox is off by default and **auto-enables under Unattended**; use `RIVET_SANDBOX=1` / `=0` to force it.
764
- - Project trust: untrusted projects don't load hooks / project MCP, and security keys are stripped; manage with `/trust`.
765
- - Full command list, rule precedence, path grants, Windows behavior, and troubleshooting: [Sandbox & Permissions Guide](docs/user-guide-sandbox-permissions.md).
624
+ - **Skills** — Reusable workflow playbooks (`visual-acceptance` bundled; project skills in `.rivet/skills/*.md`). Manage from CLI via `tianshu skills` or in-session via `/skill <name>`. Skills are snapshotted per session so mid-session edits do not fragment the prefix cache.
625
+ - **Cross-Session Memory** — Stored in `.rivet/knowledge/memory.jsonl` with `memory-index.sqlite` for hybrid search. Auto-injection only loads governance/constraint/preference memories; manage with `/memory`, `/remember <text>`, and `/forget <entryId> [resolved]`.
626
+ - **MCP (Model Context Protocol)** — Add external tool servers with `tianshu config mcp add-stdio|add-sse|add-preset` and inspect in-session with `/mcp` and `/debug mcp`.
766
627
 
767
- ## Slash Commands
628
+ ### Terminal UI (TUI) & Keybindings
768
629
 
769
- **Session & project**
630
+ | Key | Action |
631
+ |-----|--------|
632
+ | `Enter` / `Shift+Enter` | Send message / insert newline |
633
+ | `Alt+Enter` or `/steer <text>` | Immediate mid-stream interrupt (`now` priority at next tool boundary) |
634
+ | `Ctrl+C` | Abort active run; clear non-empty input; double-press within 2s when idle to exit |
635
+ | `Esc` / `Esc Esc` (<400ms) | Close overlay or interrupt active run / double-tap to open **Rewind** |
636
+ | `Ctrl+P` | Command palette (fuzzy search all slash commands and surface actions) |
637
+ | `Ctrl+]` | Toggle right-side fleet/DAG/todo/token drawer (wide terminals ≥100 cols) |
638
+ | `Ctrl+R` | History search overlay (when idle) |
639
+ | `Ctrl+O` / `Ctrl+T` | Expand/collapse truncated tool output / thinking block |
640
+ | `Ctrl+V` | Paste clipboard image (auto-converted to inline base64) |
641
+ | `@` | Trigger `@file:` / `@folder:` / `@symbol:` completion |
642
+ | `F1`–`F8` | Direct bindings: `F1` `/help` · `F2` `/tasks` · `F3` `/cache` · `F4` `/cockpit` · `F5` `/theme` · `F6` `/model` · `F7` `/permission` · `F8` `/sessions` |
643
+
644
+ <a id="slash-commands"></a>
645
+ ### Slash Commands Reference
646
+
647
+ <details>
648
+ <summary><b>Click to expand full Slash Commands tables (Session, Model, Planning, Subagents, Context, UI)</b></summary>
649
+
650
+ **Session & Project**
770
651
 
771
652
  | Command | Description |
772
653
  |---------|-------------|
773
654
  | `/help` | Show available commands |
774
- | `/sessions` `/resume <n>` | List/restore saved sessions (restores side panel, todos, active plan) |
775
- | `/fork` | Fork the current session (optionally from a message line) |
776
- | `/handoff [note]` | Write a structured handoff doc (five sections); archived and auto-injected into the next session |
777
- | `/init` | Interactive project init: verify claims / skills / hooks scaffolding |
778
- | `/doctor` | Environment health check + which shell the bash tool uses |
779
- | `/connect` | Provider connection wizard (pick built-in or custom, enter API key) |
780
- | `/config` `/settings` `/setup` | Settings panel: worker routing / review sub-agents / vision model / tool preset·approval·default domain·default model / mirrors·proxy·search backends. `Tab` switches columns, `Enter` edits, `S` saves; every field states whether it applies immediately or next session |
781
- | `/cd <path>` | Switch working directory mid-session (keeps prefix cache; session migrates to new project) |
782
- | `/trust` | Project trust management — untrusted projects don't load hooks / project MCP; project-config security keys are stripped |
783
- | `/exit` `/quit` | Save session and exit |
784
-
785
- **Model & permissions**
655
+ | `/sessions` · `/resume <n>` | List or restore saved sessions |
656
+ | `/fork` | Fork the current session |
657
+ | `/handoff [note]` | Write a 5-section structured handoff document to `.rivet/HANDOFF.md` and archive it |
658
+ | `/init` | Interactive project initialization (verify claims / skills / hooks scaffolding) |
659
+ | `/doctor` | Environment health check + active shell used by the `bash` tool |
660
+ | `/logs [open [desktop]]` | Show session, cache, CVM (`sensorium.jsonl`), and desktop sidecar log locations |
661
+ | `/connect` | Interactive provider connection wizard |
662
+ | `/config` · `/settings` · `/setup` | Interactive settings panel (routing, auto-review, vision, tool preset, mirrors, search) |
663
+ | `/cd <path>` | Switch working directory mid-session while preserving prefix cache |
664
+ | `/trust` | Manage project trust gate |
665
+ | `/usage` · `/token-ledger` | View local cumulative token ledger (`status \| sync \| auto on \| auto off \| connect \| disconnect`) |
666
+ | `/exit` · `/quit` | Save session and exit |
667
+
668
+ **Model & Permissions**
786
669
 
787
670
  | Command | Description |
788
671
  |---------|-------------|
789
672
  | `/model [name\|list]` | Show or switch model/provider |
790
- | `/effort [off\|low\|medium\|high\|max\|auto]` | Control reasoning depth (no args opens a picker) |
791
- | `/permission [supervise\|auto\|unattended\|manual\|yolo\|allow\|deny\|bash\|remove\|reset\|test]` | Permission mode: Supervise / Auto / Unattended |
792
- | `/yes [off]` `/yolo [off]` | One-key Unattended, same semantics (`off` returns to Auto) — persisted as default, survives restarts |
793
- | `/domain [list\|<name>\|auto\|off]` | Show or switch star-domain persona |
794
-
795
- **Planning & orchestration**
796
-
797
- | Command | Description |
798
- |---------|-------------|
799
- | `/goal <text>` | Set autonomous goal; runs until done |
800
- | `/cancel-goal` | Stop goal execution |
801
- | `/plan <feature>` | Generate a plan draft (writing-plans workflow) |
802
- | `/plan-mode` | Enter/exit Plan Mode (toggle; exit needs double-confirm if unapproved) |
803
- | `/plan-list` | List plans awaiting approval |
804
- | `/plan-view [ref]` | Full-screen preview of a plan document (press `v` on an approval card for the same) |
805
- | `/plan-approve <slug>` | Approve a plan and start wave-based execution |
806
- | `/plan-reject <slug> [feedback]` | Reject a plan for revision |
807
- | `/plan-close <file> --tasks <1-7\|all> [--preview]` | Close a completed plan, marking task status |
808
- | `/ask` | Enter/exit Ask Mode (read-only Q&A, toggle) |
809
- | `/council <text>` | Convene multi-expert review |
810
- | `/team <plan.md>` | Team mode: multiple agents execute a plan in parallel |
811
-
812
- **Subagents & background tasks**
813
-
814
- | Command | Description |
815
- |---------|-------------|
816
- | `/tasks` | Open the subagent task panel (view / enter `f` / stop `x`) |
817
- | `/enter <orderId> [prompt]` | Enter/resume a worker sub-session |
818
- | `/jobs` | Open the background-task panel (shell tasks launched in the background by bash) |
673
+ | `/effort [off\|low\|medium\|high\|max\|auto]` | Control reasoning depth (default `high`; routine turns auto-downgrade; explicit `max` is protected) |
674
+ | `/permission [supervise\|auto\|unattended\|...]` | Manage approval tier and tool/bash allow/deny rules |
675
+ | `/yes [off]` · `/yolo [off]` | One-key Unattended mode (`off` returns to Auto; persisted across restarts) |
676
+ | `/approve` · `/reject` | Approve or reject pending tool execution in plain-text (`captured-pty`) mode |
677
+ | `/domain [list\|<name>\|auto\|off]` | View or switch star-domain cognitive stance |
819
678
 
820
- **Context & debugging**
679
+ **Planning, Orchestration & Review**
821
680
 
822
681
  | Command | Description |
823
682
  |---------|-------------|
824
- | `/compact` | Compact context now |
825
- | `/context` | Show context ledger: health, tokens, rounds, claims |
826
- | `/evidence` | Show evidence summary (files read/modified, tests) |
827
- | `/memory` | Memory overview; `/memory add <text>` writes project knowledge, `/memory search <query>` searches |
828
- | `/remember <text>` | User-written project long-term memory (no args lists recent entries) |
829
- | `/forget <entryId> [resolved]` | Explicitly invalidate a memory: `resolved` marks an old issue fixed, default means forget it (no args lists recent candidates) |
830
- | `/btw <question>` | Side question — ask about the current session without entering the chat history |
831
- | `/debug [prompt\|cache\|mcp]` | Debug prompt, cache stats, or MCP |
832
- | `/mcp` | MCP server connection status |
833
- | `/verbose` | Toggle verbose tool output (on shows 200 lines / off shows 20) |
834
-
835
- **Rollback & UI**
683
+ | `/goal <text>` · `/cancel-goal` | Start or stop autonomous goal execution |
684
+ | `/plan <feature>` · `/plan-mode` | Draft a plan or toggle Plan Mode |
685
+ | `/plan-list` · `/plan-view [ref]` | List or preview plans in-session |
686
+ | `/plan-approve <slug>` · `/plan-reject <slug> [feedback]` | Approve plan for wave execution or reject with feedback |
687
+ | `/plan-close <file> --tasks <range\|all> [--preview]` | Close a completed plan |
688
+ | `/ask` | Toggle read-only Ask Mode |
689
+ | `/council <text> [--rounds 2]` | Convene multi-seat expert review (Tianquan / Tianfu / Tianxuan) |
690
+ | `/team <plan.md>` | Execute a plan in parallel across multiple worker agents |
691
+ | `/scout <target> [--dims a,b,c]` | Parallel read-only reconnaissance swarm producing an evidence-backed checklist |
692
+ | `/review [max]` | Run manual adversarial code review (L2 or L3 5-seat review squad) |
693
+ | `/steer <text>` | Inject a mid-stream instruction at `now` priority at the next tool boundary |
694
+
695
+ **Subagents, Context, Debugging & UI**
836
696
 
837
697
  | Command | Description |
838
698
  |---------|-------------|
839
- | `/rollback` | Preview/restore git checkpoint (`confirm` to execute) |
840
- | `/undo` | Undo last file change (preview, `confirm` to restore) |
841
- | `/theme [name\|list]` | Switch color theme |
842
- | `/vim` | Toggle vim keybindings |
843
- | `/cockpit` | Toggle the Cockpit panel |
844
- | `/scroll` | Browse output history (q / Esc to close) |
845
- | `/skill <name>` | Load and immediately invoke a skill |
846
- | `/skill off <name>` | Stop re-injecting an invoked skill |
847
- | `/update` | Check for and install updates (npm) |
848
-
849
- > **Rewind**: double-tap **ESC** (within 400ms) to open message history and rewind to any past user message — it's a hotkey, not a slash command. Press **Esc** to close any overlay.
850
-
851
- ## For Developers
699
+ | `/tasks` · `/enter <orderId> [prompt]` | Open worker task panel or enter/resume a worker session |
700
+ | `/jobs` | Open background shell jobs panel |
701
+ | `/compact` · `/context` · `/evidence` | Compact context immediately, inspect context ledger, or view collected evidence |
702
+ | `/memory` · `/remember <text>` · `/forget <id> [resolved]` | Inspect, add, or invalidate project long-term memory entries |
703
+ | `/btw <question>` | Ask a side question in a floating overlay without polluting conversation history |
704
+ | `/cvm [off\|intercept\|warn\|all]` | Set live CVM interception notice verbosity on the main screen |
705
+ | `/debug [prompt\|cache\|mcp]` · `/mcp` · `/verbose` | Inspect prompt/cache/MCP diagnostics or toggle verbose tool output |
706
+ | `/rollback` · `/undo` | Restore a Git checkpoint or undo the last file modification |
707
+ | `/cockpit` · `/theme [name\|list]` · `/vim` · `/scroll` · `/update` | Toggle Cockpit, switch color theme, toggle vim mode, scroll history, or update via npm |
852
708
 
853
- ### Tech Stack
854
-
855
- Node.js 24 · TypeScript strict (`noUncheckedIndexedAccess`) · T9 ANSI rendering engine · tsup bundle · node:test + assert/strict
856
-
857
- ### Build & Test
858
-
859
- ```bash
860
- npm run typecheck # typecheck
861
- npm test # all tests (19,000+ cases)
862
- npm run build # tsup bundle + staged native/wasm payload
863
- node dist/cli/entry.js # launch TUI
864
- node dist/cli/entry.js -p "fix the typo" # headless mode
865
- ```
709
+ </details>
866
710
 
867
- ### Extending
711
+ <a id="-key-config-cheatsheet"></a>
712
+ <a id="key-config-cheatsheet"></a>
713
+ ### ⚡ Key Config Cheatsheet (`~/.rivet/config.json` & Env Vars)
868
714
 
869
- **Add a tool** — implement `ToolDefinition` + executor in `src/tools/`, register in `src/main.tsx`, add test in `src/tools/__tests__/`.
870
-
871
- **Add a skill** — drop a `.md` file in `.rivet/skills/` with frontmatter (`name`, `description`, `triggers`).
872
-
873
- **Add a slash command** — project-local `.rivet/commands/*.md` with `$ARGUMENTS` interpolation.
874
-
875
- **Add a hook** — implement `PreToolUse | PostToolUse | UserPromptSubmit | PreCompact` handler, register via `HookRegistry`. Handlers are isolated — a broken hook never crashes the loop.
876
-
877
- ### Architecture
878
-
879
- ```
880
- src/
881
- ├── agent/ Core loop: turn-orchestrator, tool pipeline, coordinator,
882
- │ advisory-bus, goal-tracker, sensorium, immune system
883
- ├── api/ Streaming API client — DeepSeek, GLM, Codex OAuth, multi-provider routing
884
- ├── prompt/ Prompt engine — frozen prefix + delta appendix + volatile context layers
885
- ├── tools/ Tools — bash, edit, read/write, grep, glob, run_tests, git, delegate, ...
886
- ├── tui/ Terminal UI (T9 ANSI engine: scrollback, input controller, overlay, stream)
887
- ├── compact/ Three-layer semantic pruning + micro-compact + request-time collapse
888
- ├── context/ Context ledger, progressive compaction, claim system, anchor registry
889
- ├── config/ Zod-validated config: defaults → ~/.rivet → project overlay
890
- ├── server/ Desktop sidecar: session management, REST routes, SSE streaming
891
- ├── mcp/ Model Context Protocol client (stdio + SSE)
892
- ├── lsp/ Language Server Protocol integration
893
- └── search/ Semantic search (BM25 + embedding RRF fusion)
894
- ```
895
-
896
- ### Session Data
897
-
898
- Session logs are stored outside the project under `~/.rivet/sessions/<project-slug>/`
899
- (slug = dir name + cwd hash prefix), keeping them invisible to `glob`/`grep` and out
900
- of the working tree. Override with `RIVET_SESSION_DIR`. Global config lives at
901
- `~/.rivet/config.json`. Each launch gets a unique session ID, so multiple instances
902
- run in parallel without interference.
903
-
904
- ## Safety
905
-
906
- - **Path boundary enforcement** — glob/grep/diff reject `..` traversal; `validatePath` blocks escapes
907
- - **Project trust gate** — an untrusted project does not get its `.rivet/hooks.json` loaded, project-config security keys are stripped, and MCP servers are not launched; manage with `/trust` (CLI `--trust` / `--untrust`)
908
- - **Symlink cycle protection** — realpath + visited set
909
- - **SSRF protection** — Per-hop DNS + private IP blocking on every redirect
910
- - **Sensitive file rejection** — `.env`, `credentials.*`, `*key*`, `*token*` blocked from read/commit
911
- - **Destructive command gate** — `rm -rf`, force push, `DROP/TRUNCATE` require explicit confirmation
912
- - **Checkpoint + rollback** — Git checkpoint before first file modification each turn
913
- - **File-level undo** — Versioned backups before every write/edit
914
- - **Worker safety** — Timeout budget via AbortController, tool allowlist enforcement
915
-
916
- ## ⚡ Key Config Cheatsheet
917
-
918
- ### Environment Variables
919
-
920
- **Paths & data**
921
-
922
- | Variable | Effect |
923
- |----------|--------|
924
- | `RIVET_HOME` | Override the entire `~/.rivet` data root (config/sessions/plugins all live here) |
925
- | `RIVET_CONFIG_PATH` | Override the `config.json` path (switch between config sets) |
926
- | `RIVET_SESSION_DIR` | Override session-log storage path |
927
- | `RIVET_RESUME` / `RIVET_RESUME_ID` | Resume a session at startup (mirrors `--resume`) |
928
- | `RIVET_NEW_SESSION` / `RIVET_NO_AUTO_RESUME` | Force a new session / disable auto-resume |
929
-
930
- **Models & tools**
715
+ <details>
716
+ <summary><b>Click to expand Environment Variables & Annotated <code>config.json</code></b></summary>
931
717
 
932
718
  | Variable | Effect |
933
719
  |----------|--------|
720
+ | `RIVET_HOME` | Override `~/.rivet` data root for CLI (Desktop uses Settings → Storage) |
934
721
  | `DEEPSEEK_API_KEY` | DeepSeek API key |
935
- | `DEEPSEEK_SPARK_API_KEY` | DeepSeek Spark (Pro-only preset) API key |
936
- | `RIVET_TOOL_PRESET` | Toolset tier: `minimal` / `frontend` (default) / `full` / `taiyi` |
937
- | `RIVET_EMBEDDING_MODEL` / `RIVET_EMBEDDING_BASE_URL` / `RIVET_EMBEDDING_API_KEY` | Embedding-model routing for semantic search (default `text-embedding-3-small`) |
938
- | `RIVET_NO_EMBEDDINGS=1` | Disable the embedding index |
939
- | `RIVET_SANDBOX` / `RIVET_SANDBOX_WRITABLE` | Append writable sandbox roots / writable-dir list |
940
- | `RIVET_PLAN_MODE_SUGGEST` | Plan Mode auto-entry policy: `auto` (default) / `ask` / `0` (disabled) |
941
-
942
- **TUI display**
943
-
944
- | Variable | Effect |
945
- |----------|--------|
946
- | `RIVET_ASCII_UI=1` | Force pure-ASCII UI (degraded terminals) |
947
- | `RIVET_IMAGES` | Inline terminal images: auto-detect by default; `0`/`off` disables; `kitty`/`iterm2` forces a protocol |
948
- | `RIVET_HYPERLINKS=1` | Enable OSC 8 hyperlink rendering |
949
- | `RIVET_NOTIFY_BELL=1` | Ring the terminal bell on completion |
950
- | `RIVET_AMBIGUOUS_WIDTH` | Override CJK width judgment (for misaligned terminals) |
951
- | `RIVET_TUI_HARDWARE_CURSOR=1` | Hardware cursor mode |
952
-
953
- **Debug & tasks**
954
-
955
- | Variable | Effect |
956
- |----------|--------|
957
- | `RIVET_DEBUG=1` | Master debug-log switch (most commonly used) |
958
- | `RIVET_DEBUG_TELEMETRY=1` | Enable telemetry snapshot dumps |
959
- | `RIVET_HEADLESS_MAX_TURNS` | Max turns for `-p` headless mode (default 15) |
960
- | `RIVET_JOB_MAX_MS` | Background-job timeout limit |
961
- | `RIVET_NO_CROSS_SESSION=1` | Disable cross-session loading (memory blocks / events / companion presence) |
722
+ | `RIVET_TOOL_PRESET` | Toolset preset: `minimal` (default) / `frontend` / `full` / `taiyi` |
723
+ | `RIVET_LEAN=1` | Enable Lean resource tier for low-memory / low-disk machines |
724
+ | `RIVET_LANG=en` | Switch Cockpit panel labels to English (default `zh`) |
725
+ | `RIVET_TERMINAL_MODE` | Terminal UI mode: `auto` / `captured-pty` / `native` |
726
+ | `RIVET_SERVE_LAN_DIRECT=1` | Enable LAN Direct self-signed TLS mode for mobile remote access |
727
+ | `RIVET_DEBUG=1` / `RIVET_DEBUG_TELEMETRY=1` | Enable debug logging / full `sensorium.jsonl` CVM telemetry |
962
728
  | `RIVET_NO_UPDATE_CHECK=1` | Disable startup auto-update check |
963
- | `PORTABLE_GIT_MIRROR` | Override the PortableGit download mirror |
964
-
965
- **Memory**
966
-
967
- | Variable | Effect |
968
- |----------|--------|
969
- | `RIVET_ADAPTIVE_MEMORY` | Auto-inject governance/constraint/preference memories: `on` (default) / `shadow` evaluates only / `off` disables |
970
- | `RIVET_MEMORY_AUTO_CAPTURE` | End-of-session LLM judgement of important operations → long-term memory (default `on`) |
971
- | `RIVET_MEMORY_CONSOLIDATION` | End-of-session summary + reusable procedures (default `on`) |
972
- | `RIVET_MEMORY_BACKFILL` | Opt-in idle backfill of historical sessions (default `off`, idempotent ledger) |
973
-
974
- > The full environment-variable list (120+ entries, including internal experimental switches) is in `src/config/env-registry.ts`.
975
-
976
- ### Key `~/.rivet/config.json` Fields
977
729
 
978
- Write only the fields you want to override; defaults are deep-merged. Full schema in `src/config/schema.ts`.
730
+ Example `~/.rivet/config.json` (only write overrides; defaults are deep-merged — validated against `src/config/schema.ts`):
979
731
 
980
732
  ```jsonc
981
733
  {
734
+ "provider": {
735
+ "default": "deepseek",
736
+ "providers": {
737
+ "deepseek": {
738
+ "apiKey": "sk-xxx",
739
+ "models": [
740
+ { "id": "deepseek-v4-pro", "contextWindow": 1000000, "maxTokens": 384000 }
741
+ ]
742
+ }
743
+ }
744
+ },
982
745
  "agent": {
983
- "maxTurns": 200, // max turns per session
746
+ "maxTurns": 200, // max turns per session (default 200)
984
747
  "approval": "auto-safe", // manual | auto-safe | dangerously-skip-permissions
985
748
  "crossSessionEnabled": true, // cross-session knowledge sharing
986
749
  "checkpointEveryTurns": 0, // Auto-mode checkpoint interval (0 = off)
987
- "defaultDomain": "qiming", // default star domain (qiming/auto/explicit name)
988
- "visionModel": { // vision bridge: describe images when the primary model is text-only
989
- "provider": "minimax", // must have a key configured and declare supportsVision
750
+ "defaultDomain": "qiming", // default star domain (qiming | auto | explicit domain id)
751
+ "visionModel": { // vision bridge when primary model is text-only
752
+ "provider": "minimax",
990
753
  "model": "MiniMax-M3"
991
754
  },
992
- "visionAutoBridge": false, // auto-pick a vision model when visionModel is unset (off by default)
993
- "imageGenModel": { // text-to-image slot: register an endpoint, then call generate_image
994
- "provider": "siliconflow-image", // registered separately — provider.default stays untouched
755
+ "visionAutoBridge": false,
756
+ "imageGenModel": { // dedicated text-to-image slot
757
+ "provider": "siliconflow-image",
995
758
  "model": "black-forest-labs/FLUX.2-pro",
996
- "size": "1024x1024", // default size (optional)
997
- "sizeField": "image_size" // OpenAI sends size, SiliconFlow sends image_size (optional)
759
+ "size": "1024x1024",
760
+ "sizeField": "image_size"
998
761
  },
999
- "permissions": { // permission rules (mirrors /permission commands)
762
+ "permissions": {
1000
763
  "allow": [{ "tool": "read" }],
1001
764
  "deny": [{ "tool": "bash", "params": { "command": "rm -rf" } }],
1002
765
  "bash": { "allowlist": ["git status"], "denylist": ["git push"] }
@@ -1004,127 +767,37 @@ Write only the fields you want to override; defaults are deep-merged. Full schem
1004
767
  },
1005
768
  "compact": {
1006
769
  "enabled": true,
1007
- "autoThreshold": 800000 // token threshold that triggers auto-compaction
770
+ "autoThreshold": 800000
1008
771
  },
1009
772
  "tools": {
1010
- "preset": "frontend" // minimal | frontend (default) | full | taiyi
773
+ "preset": "minimal" // minimal (default) | frontend | full | taiyi
1011
774
  },
1012
775
  "workers": {
1013
- "profiles": { // custom worker model tiers
776
+ "profiles": {
1014
777
  "capable": { "provider": "deepseek", "model": "deepseek-v4-pro" },
1015
778
  "cheap": { "provider": "minimax", "model": "MiniMax-M2.7" }
1016
779
  },
1017
780
  "routing": { "code_edit": "capable", "repo_summarization": "cheap" },
1018
- "patcherTier": "cheap" // Tianliang execution-worker default tier: cheap | balanced | strong
781
+ "patcherTier": "cheap"
1019
782
  },
1020
783
  "search": {
1021
- "backends": ["bing", "duckduckgo"], // web_search backend chain (first hit wins)
1022
- "braveApiKeyEnv": "BRAVE_API_KEY" // env var name when using Brave
784
+ "backends": ["bing", "duckduckgo"],
785
+ "braveApiKeyEnv": "BRAVE_API_KEY",
786
+ "tavilyApiKeyEnv": "TAVILY_API_KEY",
787
+ "bochaApiKeyEnv": "BOCHA_API_KEY",
788
+ "serplyApiKeyEnv": "SERPLY_API_KEY"
1023
789
  },
1024
790
  "ui": {
1025
- "theme": "auto", // builtin name | auto (OSC 11 detect) | custom:<name>
1026
- "reducedMotion": true, // a11y: freeze spinner/badge animations
1027
- "screenReader": true, // a11y: screen-reader mode (same as --screen-reader)
1028
- "glanceDensity": "compact" // GlanceBar density: compact | full
791
+ "theme": "auto",
792
+ "reducedMotion": true,
793
+ "screenReader": true,
794
+ "glanceDensity": "compact",
795
+ "cvmNotices": "intercept",
796
+ "cvmNoticeWindowMs": 8000
1029
797
  },
1030
- "mirrors": { "enabled": true, "preset": "china" }, // npm/github mirror acceleration
1031
- "env": { "extraPath": ["/usr/local/bin"] } // inject PATH (Windows git-bash, etc.)
798
+ "mirrors": { "enabled": true, "preset": "china" },
799
+ "env": { "extraPath": ["/usr/local/bin"] }
1032
800
  }
1033
801
  ```
1034
802
 
1035
- > Config layering priority: CLI flag > env var > project `.rivet-config.json` > user `~/.rivet/config.json` > built-in defaults.
1036
-
1037
-
1038
-
1039
- ## 📚 Documentation
1040
-
1041
- | Doc | Description |
1042
- |-----|-------------|
1043
- | [`docs/user-guide.md`](docs/user-guide.md) | Install, configure, and usage guide |
1044
- | [`docs/desktop-guide.md`](docs/desktop-guide.md) | Desktop user guide (Cockpit/SideChat/Rewind/themes/Mirror exclusives) |
1045
- | [`docs/user-guide-provider-config.md`](docs/user-guide-provider-config.md) | Model provider configuration guide |
1046
- | [`docs/user-guide-vision.md`](docs/user-guide-vision.md) | Vision channel: configuration and troubleshooting |
1047
- | [`docs/user-guide-sandbox-permissions.md`](docs/user-guide-sandbox-permissions.md) | Full sandbox & permission model guide |
1048
- | [`docs/reference/observability-harness.md`](docs/reference/observability-harness.md) | Observability harness: real-session data samples (cache / CVM / pheromones) with reproduction commands |
1049
- | [`CONTRIBUTING.md`](CONTRIBUTING.md) | Contributing guide |
1050
- | [`config.example.json`](config.example.json) | Example config (with sub-agent / review model routing) |
1051
-
1052
- ## 🤝 Community & Support
1053
-
1054
- - **Usage questions / discussions** → [GitHub Discussions](https://github.com/huiliyi37/Tianshu-harness/discussions)
1055
- - **Discord community** → [Join the Tianshu Harness Discord](https://discord.gg/XjWTATCHB)
1056
- - **Bug reports / feature requests** → [GitHub Issues](https://github.com/huiliyi37/Tianshu-harness/issues)
1057
- - **Security vulnerabilities** → [Report privately](https://github.com/huiliyi37/Tianshu-harness/security/advisories/new) (do not open a public issue)
1058
- - **Contributing** → See [CONTRIBUTING.md](CONTRIBUTING.md)
1059
- - **Support guide** → See SUPPORT.md
1060
- - **WeChat group** → 「天枢 harness 交流群5群」 — scan the QR code below to join (QR codes expire every 7 days; leave a note in Discussions once expired):
1061
-
1062
- <img src="docs/brand/assets/wechat-group-qr.png" width="280" alt="Tianshu Harness WeChat group 5 QR code">
1063
-
1064
- > Note: a maintainer needs to enable Discussions in `Settings → General → Discussions` first.
1065
-
1066
- ## ⭐ Star History
1067
-
1068
- <a href="https://star-history.com/#huiliyi37/tianshu-harness&Date">
1069
- <picture>
1070
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=huiliyi37/tianshu-harness&type=Date&theme=dark" />
1071
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=huiliyi37/tianshu-harness&type=Date" />
1072
- <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=huiliyi37/tianshu-harness&type=Date" width="700" />
1073
- </picture>
1074
- </a>
1075
-
1076
- ## ☕ Support
1077
-
1078
- If Tianshu has been useful and you'd like to say thanks, you can. It stays a coffee, not a contract — donations don't buy feature priority or change how issues get triaged.
1079
-
1080
- - **China mainland** — WeChat Pay (scan the QR code below)
1081
-
1082
- <img src="docs/brand/assets/wechat-donate.png" width="240" alt="WeChat Pay">
1083
-
1084
- ## ✨ Contributors
1085
-
1086
- Thank you to everyone who has contributed to Tianshu (ordered by first contribution):
1087
-
1088
- | Contributor | Contributions |
1089
- |-------------|---------------|
1090
- | [@huiliyi37](https://github.com/huiliyi37) | Project creator · Core development |
1091
-
1092
- Full list (22 external contributors / 145 PRs) → CONTRIBUTORS.md.
1093
-
1094
- External PRs land via a "port" flow; authorship is credited with `Co-authored-by`
1095
- trailers (auto-recorded by scripts/credit-contributors.sh) — contributor wall (full list in CONTRIBUTORS.md):
1096
-
1097
- <p>
1098
- <a href="https://github.com/HarriethWiKk"><img src="https://github.com/HarriethWiKk.png?size=100" width="50" height="50" alt="HarriethWiKk" title="HarriethWiKk" /></a>
1099
- <a href="https://github.com/jiangsx496"><img src="https://github.com/jiangsx496.png?size=100" width="50" height="50" alt="jiangsx496" title="jiangsx496" /></a>
1100
- <a href="https://github.com/yq04"><img src="https://github.com/yq04.png?size=100" width="50" height="50" alt="yq04" title="yq04" /></a>
1101
- <a href="https://github.com/wangxx-yu"><img src="https://github.com/wangxx-yu.png?size=100" width="50" height="50" alt="wangxx-yu" title="wangxx-yu" /></a>
1102
- <a href="https://github.com/qiaodier"><img src="https://github.com/qiaodier.png?size=100" width="50" height="50" alt="qiaodier" title="qiaodier" /></a>
1103
- <a href="https://github.com/zhengbiaofeng"><img src="https://github.com/zhengbiaofeng.png?size=100" width="50" height="50" alt="zhengbiaofeng" title="zhengbiaofeng" /></a>
1104
- <a href="https://github.com/LinHoMo"><img src="https://github.com/LinHoMo.png?size=100" width="50" height="50" alt="LinHoMo" title="LinHoMo" /></a>
1105
- <a href="https://github.com/KinoGao"><img src="https://github.com/KinoGao.png?size=100" width="50" height="50" alt="KinoGao" title="KinoGao" /></a>
1106
- <a href="https://github.com/liuwanwan1"><img src="https://github.com/liuwanwan1.png?size=100" width="50" height="50" alt="liuwanwan1" title="liuwanwan1" /></a>
1107
- <a href="https://github.com/Eason412"><img src="https://github.com/Eason412.png?size=100" width="50" height="50" alt="Eason412" title="Eason412" /></a>
1108
- <a href="https://github.com/maoqiu77"><img src="https://github.com/maoqiu77.png?size=100" width="50" height="50" alt="maoqiu77" title="maoqiu77" /></a>
1109
- <a href="https://github.com/yeshilei-QWQ"><img src="https://github.com/yeshilei-QWQ.png?size=100" width="50" height="50" alt="yeshilei-QWQ" title="yeshilei-QWQ" /></a>
1110
- <a href="https://github.com/lumos-tiamo"><img src="https://github.com/lumos-tiamo.png?size=100" width="50" height="50" alt="lumos-tiamo" title="lumos-tiamo" /></a>
1111
- <a href="https://github.com/zzuu080603"><img src="https://github.com/zzuu080603.png?size=100" width="50" height="50" alt="zzuu080603" title="zzuu080603" /></a>
1112
- <a href="https://github.com/nzz0991999-ai"><img src="https://github.com/nzz0991999-ai.png?size=100" width="50" height="50" alt="nzz0991999-ai" title="nzz0991999-ai" /></a>
1113
- <a href="https://github.com/L4XB"><img src="https://github.com/L4XB.png?size=100" width="50" height="50" alt="L4XB" title="L4XB" /></a>
1114
- <a href="https://github.com/Wanming08"><img src="https://github.com/Wanming08.png?size=100" width="50" height="50" alt="Wanming08" title="Wanming08" /></a>
1115
- <a href="https://github.com/lei454577-web"><img src="https://github.com/lei454577-web.png?size=100" width="50" height="50" alt="lei454577-web" title="lei454577-web" /></a>
1116
- <a href="https://github.com/jian-in"><img src="https://github.com/jian-in.png?size=100" width="50" height="50" alt="jian-in" title="jian-in" /></a>
1117
- <a href="https://github.com/sky-mirrors"><img src="https://github.com/sky-mirrors.png?size=100" width="50" height="50" alt="sky-mirrors" title="sky-mirrors" /></a>
1118
- <a href="https://github.com/moyan3691"><img src="https://github.com/moyan3691.png?size=100" width="50" height="50" alt="moyan3691" title="moyan3691" /></a>
1119
- <a href="https://github.com/EarthxxRhythm"><img src="https://github.com/EarthxxRhythm.png?size=100" width="50" height="50" alt="EarthxxRhythm" title="EarthxxRhythm" /></a>
1120
- </p>
1121
-
1122
- > Contributions are welcome — see CONTRIBUTING.md.
1123
-
1124
- ## License
1125
-
1126
- Licensed under the [Apache License, Version 2.0](LICENSE). Copyright 2025-2026 Tianshu Contributors.
1127
-
1128
- ## Acknowledgments
1129
-
1130
- - The desktop app's custom-wallpaper and per-surface glass **design** references <a href="https://github.com/elysia395/dsh-wallpaper-engine">dsh-wallpaper-engine</a> (MIT License). The implementation is original and contains no upstream code; see <a href="THIRD-PARTY-NOTICES.md">THIRD-PARTY-NOTICES.md</a> for the design scope and license text.
803
+ </details>