one-code-extension 0.1.4 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +222 -177
  3. package/agents/explore.md +9 -6
  4. package/agents/general-purpose.md +1 -1
  5. package/agents/plan.md +6 -4
  6. package/docs/guide/README.md +52 -0
  7. package/docs/guide/bring-your-claude-code-setup.md +128 -0
  8. package/docs/guide/configuration.md +173 -0
  9. package/docs/guide/differences-from-claude-code.md +152 -0
  10. package/docs/guide/doctor.md +88 -0
  11. package/docs/guide/hooks.md +111 -0
  12. package/docs/guide/installation.md +126 -0
  13. package/docs/guide/permissions-modes-and-auto-mode.md +452 -0
  14. package/docs/guide/providers-and-models.md +196 -0
  15. package/docs/guide/reference.md +226 -0
  16. package/docs/guide/sessions-and-context.md +192 -0
  17. package/docs/guide/skills-plugins-and-mcp.md +178 -0
  18. package/docs/guide/subagents-and-workflows.md +195 -0
  19. package/docs/guide/tasks-and-background-work.md +113 -0
  20. package/docs/guide/terminal-interface.md +157 -0
  21. package/docs/guide/tools.md +177 -0
  22. package/docs/guide/troubleshooting.md +177 -0
  23. package/extensions/ask-user/index.ts +65 -71
  24. package/extensions/ask-user/questions.ts +15 -28
  25. package/extensions/ask-user/widget.ts +533 -0
  26. package/extensions/auto-mode/actions.ts +9 -26
  27. package/extensions/auto-mode/classifier-prompt.ts +127 -0
  28. package/extensions/auto-mode/classifier.ts +305 -227
  29. package/extensions/auto-mode/config.ts +279 -77
  30. package/extensions/auto-mode/defaults.ts +17 -60
  31. package/extensions/auto-mode/instructions.ts +2 -1
  32. package/extensions/auto-mode/model-picker.ts +53 -31
  33. package/extensions/auto-mode/model-select.ts +153 -82
  34. package/extensions/auto-mode/paths.ts +13 -1
  35. package/extensions/auto-mode/pause.ts +8 -0
  36. package/extensions/auto-mode/prompt.ts +205 -238
  37. package/extensions/auto-mode/recoverability.ts +229 -0
  38. package/extensions/auto-mode/rules.ts +92 -75
  39. package/extensions/auto-mode/safety-floor.ts +43 -12
  40. package/extensions/auto-mode/sensitive.ts +11 -0
  41. package/extensions/auto-mode/setup-run.ts +245 -0
  42. package/extensions/auto-mode/setup.ts +235 -0
  43. package/extensions/auto-mode/shell-analysis.ts +332 -26
  44. package/extensions/auto-mode/transcript.ts +102 -0
  45. package/extensions/background/index.ts +256 -43
  46. package/extensions/background/monitor-batch.ts +58 -0
  47. package/extensions/background/registry.ts +9 -0
  48. package/extensions/background/wakeup.ts +45 -0
  49. package/extensions/bash/background.ts +47 -22
  50. package/extensions/bash/guards.ts +229 -0
  51. package/extensions/bash/index.ts +81 -19
  52. package/extensions/branding/index.ts +44 -18
  53. package/extensions/branding/startup.ts +23 -8
  54. package/extensions/claude-compat/index.ts +17 -2
  55. package/extensions/claude-context/index.ts +41 -12
  56. package/extensions/clear/index.ts +27 -0
  57. package/extensions/compaction/fit.ts +121 -0
  58. package/extensions/compaction/index.ts +176 -71
  59. package/extensions/compaction/prompt.ts +21 -1
  60. package/extensions/context-budget/budget.ts +61 -0
  61. package/extensions/context-budget/index.ts +66 -0
  62. package/extensions/context-management/index.ts +40 -16
  63. package/extensions/doctor/build.ts +226 -0
  64. package/extensions/doctor/cli.ts +99 -0
  65. package/extensions/doctor/compat.ts +532 -0
  66. package/extensions/doctor/dependencies.ts +186 -0
  67. package/extensions/doctor/fix-prompt.ts +125 -0
  68. package/extensions/doctor/index.ts +308 -0
  69. package/extensions/doctor/models.ts +231 -0
  70. package/extensions/doctor/presets.ts +208 -0
  71. package/extensions/doctor/report.ts +189 -0
  72. package/extensions/doctor/update-lookup.ts +46 -0
  73. package/extensions/doctor/viewer.ts +124 -0
  74. package/extensions/effort/index.ts +41 -4
  75. package/extensions/effort/slider.ts +33 -2
  76. package/extensions/file-tracker/index.ts +143 -20
  77. package/extensions/file-tracker/replay.ts +46 -0
  78. package/extensions/file-tracker/tracker.ts +51 -4
  79. package/extensions/footer/footer-line.ts +207 -0
  80. package/extensions/footer/index.ts +152 -0
  81. package/extensions/footer/pr.ts +53 -0
  82. package/extensions/hooks/executor.ts +57 -20
  83. package/extensions/hooks/formatter-notice.ts +76 -0
  84. package/extensions/hooks/index.ts +314 -73
  85. package/extensions/hooks/matcher.ts +35 -1
  86. package/extensions/hooks/plugin-hooks.ts +3 -3
  87. package/extensions/hooks/protocol.ts +58 -0
  88. package/extensions/hooks/subagent-bridge.ts +77 -0
  89. package/extensions/hooks/trust.ts +15 -4
  90. package/extensions/init/index.ts +26 -0
  91. package/extensions/init/prompt.ts +40 -0
  92. package/extensions/interrupted/index.ts +35 -0
  93. package/extensions/interrupted/line.ts +9 -0
  94. package/extensions/lib/abort.ts +15 -0
  95. package/extensions/lib/agent-loader.ts +183 -0
  96. package/extensions/lib/anthropic-payload.ts +15 -0
  97. package/extensions/lib/atomic-write.ts +56 -0
  98. package/extensions/lib/bridge-watch.ts +20 -0
  99. package/extensions/lib/cache-retention.ts +60 -0
  100. package/extensions/lib/capability-index.ts +466 -0
  101. package/extensions/lib/claude-context.ts +318 -27
  102. package/extensions/lib/claude-settings.ts +64 -0
  103. package/extensions/lib/consent-preview.ts +30 -0
  104. package/extensions/lib/deferred.ts +144 -13
  105. package/extensions/lib/favorites.ts +43 -0
  106. package/extensions/lib/fetch-timeout.ts +15 -0
  107. package/extensions/lib/frontmatter.ts +31 -0
  108. package/extensions/lib/git.ts +44 -2
  109. package/extensions/lib/hook-gate.ts +90 -0
  110. package/extensions/lib/interrupt.ts +94 -0
  111. package/extensions/lib/mcp-overrides.ts +61 -0
  112. package/extensions/lib/mcp-share.ts +25 -0
  113. package/extensions/lib/mcp-status.ts +34 -0
  114. package/extensions/lib/memory.ts +41 -6
  115. package/extensions/lib/model-facts.generated.json +2480 -0
  116. package/extensions/lib/model-facts.ts +162 -0
  117. package/extensions/lib/model-policy.ts +145 -189
  118. package/extensions/lib/model-tier.ts +480 -64
  119. package/extensions/lib/model-unusable.ts +37 -0
  120. package/extensions/lib/notifications.ts +320 -1
  121. package/extensions/lib/one-code-settings.ts +63 -0
  122. package/extensions/lib/original-command.ts +71 -0
  123. package/extensions/lib/package-version.ts +31 -0
  124. package/extensions/lib/paths.ts +39 -4
  125. package/extensions/lib/permission-gate.ts +192 -0
  126. package/extensions/lib/persisted-output.ts +18 -0
  127. package/extensions/lib/pi-ai-estimate.ts +160 -0
  128. package/extensions/lib/pi-version.ts +1 -1
  129. package/extensions/lib/plan-mode-channels.ts +11 -0
  130. package/extensions/lib/plugin-overrides.ts +24 -0
  131. package/extensions/lib/plugin-root.ts +44 -0
  132. package/extensions/lib/plugins.ts +233 -54
  133. package/extensions/lib/prefix-warm-gate.ts +157 -0
  134. package/extensions/lib/process-tree.ts +56 -0
  135. package/extensions/lib/reminders.ts +321 -68
  136. package/extensions/lib/scratchpad.ts +11 -8
  137. package/extensions/lib/session-lifecycle.ts +28 -0
  138. package/extensions/lib/settings-channels.ts +14 -0
  139. package/extensions/lib/shell-tasks.ts +54 -0
  140. package/extensions/lib/skill-overrides.ts +86 -0
  141. package/extensions/lib/skill-scan.ts +110 -0
  142. package/extensions/lib/text-width.ts +267 -0
  143. package/extensions/lib/tui-render.ts +281 -54
  144. package/extensions/lib/usage-bus.ts +75 -0
  145. package/extensions/lib/usage-tracker.ts +67 -0
  146. package/extensions/lib/worktree-isolation.ts +170 -0
  147. package/extensions/lsp/client.ts +69 -12
  148. package/extensions/lsp/format.ts +12 -2
  149. package/extensions/lsp/index.ts +273 -84
  150. package/extensions/lsp/install-hints.ts +43 -0
  151. package/extensions/lsp/keep-alive.ts +19 -0
  152. package/extensions/lsp/plugin-servers.ts +331 -0
  153. package/extensions/lsp/watcher.ts +157 -0
  154. package/extensions/mcp/announce.ts +99 -0
  155. package/extensions/mcp/client.ts +181 -22
  156. package/extensions/mcp/config.ts +55 -24
  157. package/extensions/mcp/index.ts +586 -86
  158. package/extensions/mcp/oauth/browser.ts +26 -0
  159. package/extensions/mcp/oauth/callback.ts +104 -0
  160. package/extensions/mcp/oauth/flow.ts +68 -0
  161. package/extensions/mcp/oauth/provider.ts +147 -0
  162. package/extensions/mcp/oauth/store.ts +86 -0
  163. package/extensions/mcp/panel/keys.ts +34 -0
  164. package/extensions/mcp/panel/model.ts +62 -0
  165. package/extensions/mcp/panel/render.ts +141 -0
  166. package/extensions/mcp/panel/state.ts +108 -0
  167. package/extensions/mcp/schema.ts +83 -6
  168. package/extensions/mcp/trust.ts +340 -0
  169. package/extensions/memory/entries.ts +163 -0
  170. package/extensions/memory/index.ts +119 -2
  171. package/extensions/memory/open-external.ts +97 -0
  172. package/extensions/memory/panel.ts +124 -0
  173. package/extensions/model-default/index.ts +74 -0
  174. package/extensions/notebook/index.ts +36 -18
  175. package/extensions/notebook/notebook.ts +110 -17
  176. package/extensions/permissions/index.ts +1012 -247
  177. package/extensions/permissions/matcher.ts +488 -57
  178. package/extensions/permissions/modes.ts +55 -7
  179. package/extensions/permissions/project-trust.ts +81 -0
  180. package/extensions/permissions/protected-paths.ts +16 -3
  181. package/extensions/permissions/rule-prose.ts +79 -0
  182. package/extensions/permissions/session-grant.ts +91 -0
  183. package/extensions/permissions/settings.ts +112 -33
  184. package/extensions/permissions/subagent-gate.ts +57 -0
  185. package/extensions/plan-mode/index.ts +143 -33
  186. package/extensions/plan-mode/reminder.ts +16 -19
  187. package/extensions/plan-mode/viewer.ts +40 -31
  188. package/extensions/plugins/counts.ts +68 -0
  189. package/extensions/plugins/index.ts +496 -32
  190. package/extensions/plugins/install/install.ts +167 -0
  191. package/extensions/plugins/install/paths.ts +23 -0
  192. package/extensions/plugins/install/registry.ts +72 -0
  193. package/extensions/plugins/marketplace/git.ts +103 -0
  194. package/extensions/plugins/marketplace/official.ts +36 -0
  195. package/extensions/plugins/marketplace/parse.ts +94 -0
  196. package/extensions/plugins/marketplace/registry.ts +60 -0
  197. package/extensions/plugins/marketplace/sync.ts +146 -0
  198. package/extensions/plugins/marketplace/types.ts +128 -0
  199. package/extensions/plugins/panel/keys.ts +52 -0
  200. package/extensions/plugins/panel/render.ts +315 -0
  201. package/extensions/plugins/panel/rows.ts +230 -0
  202. package/extensions/plugins/panel/state.ts +333 -0
  203. package/extensions/recap/index.ts +215 -0
  204. package/extensions/recap/prompt.ts +44 -0
  205. package/extensions/recap/scheduler.ts +87 -0
  206. package/extensions/search-tools/index.ts +0 -0
  207. package/extensions/search-tools/tools.ts +7 -5
  208. package/extensions/skill/index.ts +360 -34
  209. package/extensions/skill/invoke.ts +185 -0
  210. package/extensions/skill/listing.ts +21 -0
  211. package/extensions/skill/panel/keys.ts +41 -0
  212. package/extensions/skill/panel/render.ts +91 -0
  213. package/extensions/skill/panel/state.ts +115 -0
  214. package/extensions/spinner/index.ts +110 -0
  215. package/extensions/spinner/line.ts +51 -0
  216. package/extensions/spinner/verbs.ts +201 -0
  217. package/extensions/subagents/agents.ts +88 -44
  218. package/extensions/subagents/default-model.ts +62 -32
  219. package/extensions/subagents/delegation-steer.ts +23 -0
  220. package/extensions/subagents/hand-back-review.ts +67 -0
  221. package/extensions/subagents/index.ts +1545 -346
  222. package/extensions/subagents/live-runs.ts +293 -0
  223. package/extensions/subagents/model-select.ts +252 -82
  224. package/extensions/subagents/outcome.ts +90 -0
  225. package/extensions/subagents/panel-keys.ts +41 -0
  226. package/extensions/subagents/panel-render.ts +357 -0
  227. package/extensions/subagents/panel-widget.ts +330 -0
  228. package/extensions/subagents/pending-claim.ts +45 -0
  229. package/extensions/subagents/prose.ts +105 -0
  230. package/extensions/subagents/runner.ts +674 -0
  231. package/extensions/subagents/runs.ts +68 -1
  232. package/extensions/subagents/send-to-main-tool.ts +55 -0
  233. package/extensions/subagents/session-turns.ts +138 -0
  234. package/extensions/subagents/shell-panel.ts +198 -0
  235. package/extensions/subagents/usage.ts +16 -4
  236. package/extensions/subagents/worktree.ts +13 -0
  237. package/extensions/system-prompt/environment.ts +5 -3
  238. package/extensions/system-prompt/git-status.ts +93 -0
  239. package/extensions/system-prompt/index.ts +23 -1
  240. package/extensions/system-prompt/template.ts +34 -4
  241. package/extensions/system-prompt/tiers/common.ts +31 -6
  242. package/extensions/system-prompt/tiers/low.ts +13 -3
  243. package/extensions/system-prompt/tiers/mid.ts +21 -8
  244. package/extensions/system-reminder/index.ts +53 -9
  245. package/extensions/tasks/index.ts +65 -16
  246. package/extensions/tasks/store.ts +76 -3
  247. package/extensions/tool-search/announce.ts +42 -0
  248. package/extensions/tool-search/index.ts +136 -13
  249. package/extensions/turn-duration/index.ts +60 -0
  250. package/extensions/turn-duration/line.ts +22 -0
  251. package/extensions/turn-duration/span.ts +41 -0
  252. package/extensions/turn-duration/verbs.ts +24 -0
  253. package/extensions/web/backends.ts +421 -0
  254. package/extensions/web/index.ts +178 -21
  255. package/extensions/web-fetch/index.ts +74 -18
  256. package/extensions/web-fetch/summarize.ts +1 -1
  257. package/extensions/workflow/agent-session.ts +182 -112
  258. package/extensions/workflow/globals.ts +129 -106
  259. package/extensions/workflow/index.ts +343 -28
  260. package/extensions/workflow/records.ts +118 -0
  261. package/extensions/workflow/run-manager.ts +80 -31
  262. package/extensions/workflow/saved-workflows.ts +2 -1
  263. package/extensions/workflow/script-worker.mjs +110 -0
  264. package/extensions/workflow/types.ts +74 -8
  265. package/extensions/workflow/viewer.ts +562 -0
  266. package/extensions/workflow/vm-runtime.ts +118 -22
  267. package/extensions/workflow/widget.ts +126 -18
  268. package/extensions/worktree/guards.ts +240 -0
  269. package/extensions/worktree/index.ts +30 -5
  270. package/extensions/worktree/rewrite.ts +32 -16
  271. package/package.json +20 -10
  272. package/skills/code-review/SKILL.md +165 -0
  273. package/skills/fewer-permission-prompts/SKILL.md +61 -0
  274. package/skills/security-review/SKILL.md +178 -0
  275. package/skills/simplify/SKILL.md +70 -0
  276. package/themes/{one-code-light.json → onecode-light.json} +6 -1
  277. package/themes/{one-code.json → onecode.json} +6 -1
  278. package/types/app.d.ts +8 -1
  279. package/types/community-packages.d.ts +45 -2
  280. package/docs/decisions/auto-mode.md +0 -526
  281. package/docs/decisions/branding.md +0 -127
  282. package/docs/decisions/code-review-remediation.md +0 -106
  283. package/docs/decisions/compaction.md +0 -140
  284. package/docs/decisions/distribution.md +0 -168
  285. package/docs/decisions/hooks.md +0 -64
  286. package/docs/decisions/lsp.md +0 -58
  287. package/docs/decisions/mcp.md +0 -104
  288. package/docs/decisions/memory-state.md +0 -170
  289. package/docs/decisions/model-policy.md +0 -126
  290. package/docs/decisions/modes.md +0 -178
  291. package/docs/decisions/skills-plugins.md +0 -56
  292. package/docs/decisions/subagents-workflows.md +0 -225
  293. package/docs/decisions/system-prompt.md +0 -98
  294. package/docs/decisions/tools.md +0 -407
  295. package/docs/decisions/tui.md +0 -217
  296. package/docs/decisions.md +0 -148
  297. package/extensions/subagents/child.ts +0 -414
  298. package/extensions/subagents/rpc-turns.ts +0 -123
  299. package/extensions/todo/index.ts +0 -133
  300. package/extensions/workflow/permission-gate.ts +0 -71
@@ -0,0 +1,196 @@
1
+ # Providers and models
2
+
3
+ [← One Code user guide](README.md)
4
+
5
+ One Code talks to each model provider natively, so you choose the provider
6
+ and the model, and you can change either one during a session. This page
7
+ covers connecting a provider, storing a key, switching models, how One Code
8
+ picks models for its side roles, and web search on providers without a
9
+ search API.
10
+
11
+ ## Connect your first provider
12
+
13
+ You need one provider API key to start. On the first run there is no
14
+ provider yet, so the banner shows `model none` and points you at `/login`.
15
+ Start One Code and run `/login` to pick a provider and paste a key, or sign
16
+ in through the browser where the provider supports it:
17
+
18
+ ```bash
19
+ cd your-project
20
+ onecode
21
+ # then, inside One Code:
22
+ /login
23
+ ```
24
+
25
+ Alternatively, set the provider's key as an environment variable before
26
+ launching. One Code picks it up and no `/login` is needed.
27
+
28
+ Two providers hand out free models you can try at no cost:
29
+
30
+ - **OpenCode Zen** ([opencode.ai/zen](https://opencode.ai/zen)): sign up and
31
+ copy your API key. A free model is `deepseek-v4-flash-free`.
32
+ - **OpenRouter** ([openrouter.ai](https://openrouter.ai)): sign up and create
33
+ a key, or sign in from inside One Code with no key copying. Free models
34
+ carry a `:free` suffix, such as `nvidia/nemotron-3-ultra-550b-a55b:free`.
35
+
36
+ pi stores credentials in its agent directory (`~/.onecode/agent/` under
37
+ the bundled app). `/logout` removes them.
38
+
39
+ ## Store keys as environment variables
40
+
41
+ pi reads provider keys from the environment, so you can set them once:
42
+
43
+ | Provider | Environment variable |
44
+ |---|---|
45
+ | Anthropic | `ANTHROPIC_API_KEY` |
46
+ | OpenAI | `OPENAI_API_KEY` |
47
+ | Google | `GEMINI_API_KEY` |
48
+ | OpenCode Zen | `OPENCODE_API_KEY` |
49
+ | OpenRouter | `OPENROUTER_API_KEY` |
50
+
51
+ Other providers pi supports follow the same pattern; see pi's provider
52
+ documentation for the full list.
53
+
54
+ ## Switch models
55
+
56
+ Run `/model` to see the models available from your connected providers and
57
+ pick one, or pass `--model provider/model-id` at launch. **ctrl+p** cycles
58
+ through models. The switch takes effect on your next message, so you can
59
+ start a task on one model and finish it on another.
60
+
61
+ Every interactive `/model` choice is saved as pi's default, so the next
62
+ session starts on the same model. A `--model` flag wins for that session
63
+ without changing the saved default.
64
+
65
+ Changing the model re-caches the conversation, so the next request costs
66
+ more than usual.
67
+
68
+ ## Run a cheap model with a frontier model
69
+
70
+ Because each provider is native, different parts of the same session can
71
+ run on different models:
72
+
73
+ - **Switch as the task changes.** Use `/model` to move between a cheap model
74
+ for routine work and a stronger one for the hard parts.
75
+ - **A cheaper subagent tier.** Subagents, workflow agents, the auto-mode
76
+ classifier, and the reader model behind web fetch and recaps all run on
77
+ their own model. By default One Code picks these for you; see the next
78
+ section. `/subagent` and `/auto-mode model` set them by hand.
79
+
80
+ This matters most for `ultracode` workflows, which fan work out across many
81
+ agents at once. Running those agents on a cheap tier keeps a large fan-out
82
+ affordable while the parent session stays on a frontier model.
83
+
84
+ ## Automatic model selection
85
+
86
+ For its side roles, One Code chooses a model from the **same provider** as
87
+ your session; automatic picks never send your data to another provider. The
88
+ choice is the cheapest model that clears a capability floor:
89
+
90
+ - **Subagents and the classifier** share one rule: a Sonnet-class model when
91
+ your session runs a Sonnet-class or stronger model, and a Haiku-class model
92
+ otherwise. This is Claude Code's classifier rule, applied to delegated work
93
+ too, so on most providers both roles land on the same model. A subagent is
94
+ never dearer than your main model; if nothing cheaper qualifies, it runs on
95
+ the main model.
96
+ - **The reader** (web fetch answers, recaps) uses the cheapest capable
97
+ model.
98
+
99
+ Claude Code's model aliases work everywhere: `sonnet`, `haiku`, `opus` and
100
+ `fable` resolve to a model of that name when your provider has one, and
101
+ otherwise to the matching class within your provider (`haiku` the cheapest
102
+ capable model, `sonnet` the cheapest Sonnet-class model, `opus` and `fable`
103
+ your main model). They never switch providers.
104
+
105
+ Capability is judged by tier (see the next section). One Code excludes
106
+ models that can't call tools, have no price, or are a generation behind: a
107
+ model released more than a year after its vendor's newest drops one tier,
108
+ and one more than two years behind never gets picked automatically.
109
+ Provider aliases such as `:free` or `:online` variants are skipped.
110
+
111
+ ### Measured selection with Artificial Analysis
112
+
113
+ If you have an [Artificial Analysis](https://artificialanalysis.ai) API key,
114
+ One Code uses measured coding ability instead of name-based tiers for these
115
+ picks: a candidate must score at least the lower of your session model's
116
+ coding index and a Sonnet 5 reference (the reader gets 10 percent
117
+ tolerance; subagents and the classifier get none). The score can also move
118
+ a model to a more scaffolded prompt: a model whose coding index is below 85
119
+ percent of the Sonnet 5 reference gets at most the cheap register, and one
120
+ below 60 percent at most the tiny register. A score never moves a model to
121
+ a leaner register than its name class allows. Models sold under several
122
+ providers share one release date for this purpose, so a Codex or Azure
123
+ listing is scored like its OpenAI twin. Set `AA_API_KEY`, or add the key to `~/.onecode/settings.json`:
124
+
125
+ ```json
126
+ {
127
+ "capabilityIndex": {
128
+ "artificialAnalysisApiKey": "…"
129
+ }
130
+ }
131
+ ```
132
+
133
+ The snapshot is cached under `~/.onecode/cache/` and refreshed at most once
134
+ a day. Without a key, selection uses tiers alone. The measured index never
135
+ changes the prompt tier itself.
136
+
137
+ `/doctor report` shows the model each role gets and why, and `/doctor
138
+ presets` offers three coordinated presets; see
139
+ [Model presets](doctor.md#model-presets).
140
+
141
+ ## Prompting adapts to the model
142
+
143
+ One Code classifies every model into one of four prompt tiers and adjusts
144
+ the system prompt to match:
145
+
146
+ | Tier | Models | Prompt |
147
+ |---|---|---|
148
+ | Frontier | Opus and Fable, current generation. | Claude Code's terse prompt. |
149
+ | Workhorse | Sonnet-class models and comparable third-party models. | Claude Code's full prompt. |
150
+ | Cheap | Haiku-class models and comparable "flash", "mini", or "small" models. | The verbose prompt Claude Code gives Haiku. |
151
+ | Tiny | Sub-Haiku models. | The verbose prompt plus extra scaffolding and the `grep`, `find`, and `ls` tools. |
152
+
153
+ The tier is derived from the model's name, release date, and price. You
154
+ don't configure it; set `CC_PROMPT_TIER` to force one when you want to
155
+ experiment. `/doctor report` shows the tier in use.
156
+
157
+ ## Web search on providers without a search API
158
+
159
+ Web search uses your provider's own search when it has one (Anthropic,
160
+ OpenAI, Gemini, xAI). On any other provider (OpenRouter, Z.ai, Ollama,
161
+ DeepSeek direct, and the rest) One Code falls back to a third-party search
162
+ API, in this order:
163
+
164
+ 1. **Brave Search**, when `BRAVE_SEARCH_API_KEY` is set.
165
+ 2. **Tavily**, when `TAVILY_API_KEY` is set.
166
+ 3. **Exa's free keyless endpoint**, when neither key is set. It's
167
+ rate-limited and best-effort, so One Code warns you the first time a
168
+ session uses it and labels every result that came from it.
169
+
170
+ Both Brave and Tavily have free tiers. If you would rather not use
171
+ environment variables, put the keys in `~/.onecode/settings.json`:
172
+
173
+ ```json
174
+ {
175
+ "webSearch": {
176
+ "apiKeys": { "brave": "…", "tavily": "…" },
177
+ "order": ["tavily", "brave", "exa-free"]
178
+ }
179
+ }
180
+ ```
181
+
182
+ `order` is optional. A backend that fails is skipped and the result says
183
+ so. Web fetch works on every provider; it never depends on a search API.
184
+
185
+ ## Provider notes
186
+
187
+ - Verification has focused on Anthropic, OpenAI, and OpenRouter. Other
188
+ providers are less exercised.
189
+ - Some models reject request options others accept (a temperature, a
190
+ reasoning setting). One Code sends minimal options to its side calls for
191
+ this reason, and a side call that still fails does so loudly: a
192
+ classifier that can't answer blocks the action; a reader that fails
193
+ returns the raw page.
194
+ - Interactive sessions request the provider's extended prompt cache (one
195
+ hour on Anthropic). Subagents and one-shot runs use the short default.
196
+ See [The prompt cache](sessions-and-context.md#the-prompt-cache).
@@ -0,0 +1,226 @@
1
+ # Command and keyboard reference
2
+
3
+ [← One Code user guide](README.md)
4
+
5
+ A lookup for every slash command, keyboard shortcut, command-line flag,
6
+ environment variable, and file location. Each entry points to the page
7
+ that explains it.
8
+
9
+ ## Slash commands
10
+
11
+ ### One Code commands
12
+
13
+ | Command | What it does | Page |
14
+ |---|---|---|
15
+ | `/doctor` | Run the checkup: the model reviews the measured setup report and proposes repairs. | [Doctor](doctor.md) |
16
+ | `/doctor report` | Show the report alone in a scrollable panel. | [Doctor](doctor.md) |
17
+ | `/doctor presets` | Show the three model presets and what each would pick. | [Doctor](doctor.md#model-presets) |
18
+ | `/doctor preset <economical\|balanced\|quality>` | Apply a preset. | [Doctor](doctor.md#model-presets) |
19
+ | `/agents` | Open the live subagent panel, or list the available agents. | [Subagents](subagents-and-workflows.md) |
20
+ | `/subagent <provider/model-id>` | Save the default model for subagents and workflow agents. | [Subagents](subagents-and-workflows.md#choose-the-subagent-model) |
21
+ | `/subagent inherit` | Use the main model for subagents. | |
22
+ | `/subagent status` | Show the configured default and what it resolves to. | |
23
+ | `/subagent clear` | Return to automatic selection. | |
24
+ | `/subagent` | Open a model picker. | |
25
+ | `/workflows` | Open the workflow run viewer. | [Workflows](subagents-and-workflows.md#the-run-viewer) |
26
+ | `/workflows stop <runId>` | Stop a running workflow. | |
27
+ | `/workflows log <runId>` | Print a run's recent events. | |
28
+ | `/workflows list` | List this session's runs and the saved workflows. | |
29
+ | `/effort [level]` | Set the reasoning effort (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, `ultracode`), or open the slider. | [Reasoning effort](subagents-and-workflows.md#reasoning-effort) |
30
+ | `/skills` | Manage which skills the model sees. | [Skills](skills-plugins-and-mcp.md#manage-skills) |
31
+ | `/<skill-name> [args]` | Run a skill. | [Skills](skills-plugins-and-mcp.md#skills) |
32
+ | `/skill:<name>`, `/skill:<plugin>:<name>` | Run a skill by its full name. | |
33
+ | `/<command-name> [args]` | Run a custom command from `.claude/commands/`. | [Custom commands](skills-plugins-and-mcp.md#custom-commands) |
34
+ | `/<plugin>:<command>` | Run a plugin command. | |
35
+ | `/plugins` | Browse, install, and toggle plugins and marketplaces. | [Plugins](skills-plugins-and-mcp.md#plugins) |
36
+ | `/mcp` | Manage MCP servers: status, reconnect, authenticate, enable, disable. | [MCP servers](skills-plugins-and-mcp.md#manage-servers) |
37
+ | `/lsp` | Show language-server status. | [Language servers](configuration.md#language-server-diagnostics) |
38
+ | `/permissions` | Show the permission mode and every loaded rule. | [Permissions](permissions-modes-and-auto-mode.md) |
39
+ | `/allow <rule> [global]` | Save an allow rule for this repository, or for every repository with `global`. | [Add a rule](permissions-modes-and-auto-mode.md#add-a-rule-during-a-session) |
40
+ | `/auto-mode`, `/auto-mode config` | Show the effective auto-mode configuration. | [Auto mode](permissions-modes-and-auto-mode.md#configure-auto-mode) |
41
+ | `/auto-mode setup` | Draft and save an auto-mode configuration for this environment. | |
42
+ | `/auto-mode defaults` | Show the built-in environment description. | |
43
+ | `/auto-mode model [provider/model-id\|clear]` | Choose or clear the classifier model. | |
44
+ | `/memory` | Open an instruction file or the memory folder. | [Memory](sessions-and-context.md#memory) |
45
+ | `/tasks`, `/tasks hide`, `/tasks show` | Print the task list, or hide and show its widget. | [Tasks](tasks-and-background-work.md#the-task-list) |
46
+ | `/background` | List background tasks. | [Background](tasks-and-background-work.md#the-background-list) |
47
+ | `/loop <interval> <task>` | Repeat a task at a fixed interval (`30s`, `5m`, `1h`). | [Loops](tasks-and-background-work.md#scheduled-wake-ups-and-loops) |
48
+ | `/loop <task>` | Repeat a task, letting the model choose the pace. | |
49
+ | `/loop status`, `/loop stop` | Report or end the loop. | |
50
+ | `/tools-deferred` | List deferred tools and whether each is loaded. | [Tools](tools.md#eager-and-deferred-tools) |
51
+ | `/init` | Have the model write a `CLAUDE.md` for the project. | [CLAUDE.md](bring-your-claude-code-setup.md#project-instructions-claudemd) |
52
+ | `/clear` | Start a new session (pi's `/new`). | [Sessions](sessions-and-context.md#start-over) |
53
+ | `/exit` | Quit (pi's `/quit`). | |
54
+
55
+ ### pi commands
56
+
57
+ These come from pi and are available in every One Code session.
58
+
59
+ | Command | What it does |
60
+ |---|---|
61
+ | `/login`, `/logout` | Add or remove provider credentials. |
62
+ | `/model` | Switch the model. **ctrl+s** in the picker saves it as the startup default. |
63
+ | `/thinking` | Switch the thinking level. **ctrl+s** in the picker saves it as the startup default. Covers the same dial as `/effort`. |
64
+ | `/scoped-models` | Choose which models **ctrl+p** cycles through. |
65
+ | `/settings` | pi's preferences: theme, message delivery, and more. |
66
+ | `/compact [instructions]` | Compact the context now. |
67
+ | `/resume` | Pick a previous session. |
68
+ | `/new` | Start a new session. |
69
+ | `/name <name>` | Name the session. |
70
+ | `/session` | Show the session file, id, message count, tokens, and cost. |
71
+ | `/tree` | Jump to any point in the session and continue from there. |
72
+ | `/fork`, `/clone` | Copy the session from a message, or duplicate the current branch. |
73
+ | `/trust` | Save the project trust decision for pi's own project resources. |
74
+ | `/copy` | Copy the last reply to the clipboard. |
75
+ | `/export [file]`, `/import <file>` | Export the session to HTML or JSONL; import a JSONL session. |
76
+ | `/share` | Upload the session as a private GitHub gist. |
77
+ | `/reload` | Reload extensions, skills, prompts, themes, and context files. |
78
+ | `/hotkeys` | Show every keyboard shortcut. |
79
+ | `/changelog` | Show pi's version history. |
80
+ | `/quit` | Quit. |
81
+
82
+ ## Keyboard shortcuts
83
+
84
+ ### One Code
85
+
86
+ | Shortcut | What it does |
87
+ |---|---|
88
+ | **ctrl+q** | Cycle the permission mode: manual, accept edits, plan, auto. |
89
+ | **↓** (empty editor) | Focus the panel below the editor: background shells, then subagents, then workflows. |
90
+ | **ctrl+x** then **ctrl+k** | Stop every running agent (in the subagent panel). |
91
+ | **x** | Stop the selected agent, shell, or workflow (in a panel). |
92
+ | **Esc** | Leave a panel, or cancel a dialog. |
93
+ | **ctrl+c** | Close any panel. |
94
+
95
+ Panel-specific keys are listed in
96
+ [The terminal interface](terminal-interface.md#panels-opened-by-commands).
97
+
98
+ ### pi
99
+
100
+ The ones you will use most; `/hotkeys` shows all of them.
101
+
102
+ | Shortcut | What it does |
103
+ |---|---|
104
+ | **shift+tab** | Cycle the thinking level. |
105
+ | **ctrl+t** | Show or hide thinking blocks. |
106
+ | **ctrl+o** | Expand or collapse a tool's output. |
107
+ | **ctrl+p**, **shift+ctrl+p** | Cycle models forward or backward. |
108
+ | **ctrl+l** | Open the model picker. |
109
+ | **Esc** | Interrupt the model. |
110
+ | **ctrl+c** | Clear the editor; press twice to exit. |
111
+ | **ctrl+d** | Exit when the editor is empty. |
112
+ | **alt+enter** (**ctrl+q** on Windows and WSL) | Queue a follow-up message while the model works. |
113
+ | **alt+↑** | Restore queued messages to the editor. |
114
+ | **ctrl+g** | Edit the prompt in your external editor. |
115
+ | **ctrl+v** | Paste an image or text. |
116
+ | **shift+enter**, **ctrl+j** | Insert a newline. |
117
+ | **ctrl+x** | Copy the last reply. |
118
+ | **PgUp**, **PgDn**, **Home**, **End** | Scroll the transcript in full-screen mode. |
119
+ | **ctrl+shift+f** | Search the transcript in full-screen mode. |
120
+ | **!** at the start of a line | Run a shell command yourself. |
121
+
122
+ Rebind keys in pi's keybindings file; see pi's documentation.
123
+
124
+ ## Command-line flags
125
+
126
+ `onecode` forwards every flag to pi except `--version` and `doctor`. On the
127
+ extension install, use `pi` in place of `onecode`.
128
+
129
+ | Flag | What it does |
130
+ |---|---|
131
+ | `onecode --version`, `-v` | Print the app version and the pi version inside it. |
132
+ | `onecode doctor` | Print the setup report without starting a session. Exit 1 when no provider is ready. |
133
+ | `-p "…"`, `--print` | Run one prompt and exit. |
134
+ | `--mode json` | Emit JSON events for scripting. |
135
+ | `--mode rpc` | Speak pi's RPC protocol over stdin and stdout. |
136
+ | `-c`, `--continue` | Continue the most recent session. |
137
+ | `-r`, `--resume` | Browse and pick a session. |
138
+ | `--session <id>`, `--fork <id>` | Open or fork a specific session. |
139
+ | `--no-session` | Do not save this session. |
140
+ | `--permission-mode <mode>` | Start in `default`, `acceptEdits`, `plan`, `auto`, `bypassPermissions`, or `dontAsk`. |
141
+ | `--dangerously-skip-permissions` | Start in bypass mode. |
142
+ | `--model <provider/id>` | Start on a model. Add `:<level>` to set thinking. |
143
+ | `--thinking <level>` | Start at a thinking level. |
144
+ | `--provider <name>`, `--api-key <key>` | Choose a provider and supply a key for this run. |
145
+ | `--tui-mode fullscreen` | Full-screen interface (the default under the app). |
146
+ | `--tools <list>` | Restrict the tools available. |
147
+ | `-e <source>` | Load an extra extension. |
148
+ | `--offline` | Skip network checks, including the update check. |
149
+ | `--append-system-prompt <text>` | Append to the system prompt. |
150
+ | `--verbose` | Show the full startup listing. |
151
+
152
+ ## Environment variables
153
+
154
+ Set these before launching.
155
+
156
+ ### One Code
157
+
158
+ | Variable | Effect |
159
+ |---|---|
160
+ | `ONECODE_STATE_DIR` | Where One Code keeps its state (default `~/.onecode`). Independent of pi's agent directory. |
161
+ | `ONECODE_NO_UPDATE_CHECK=1` | Skip the daily update check. |
162
+ | `ONECODE_DEBUG=1` | Report when a pi-internal patch in the bundled app didn't apply. |
163
+ | `AA_API_KEY` | Artificial Analysis key for measured model selection. |
164
+ | `BRAVE_SEARCH_API_KEY`, `TAVILY_API_KEY` | Web-search fallback keys. |
165
+
166
+ ### Claude Code compatibility toggles
167
+
168
+ The `CC_` prefix is historical; `ONECODE_`-prefixed aliases are planned.
169
+
170
+ | Variable | Effect |
171
+ |---|---|
172
+ | `CC_NO_BANNER=1` | Keep pi's header instead of the One Code banner. |
173
+ | `CC_NO_INPUT_MARKER=1` | Remove the `❯` prompt marker. |
174
+ | `CC_NO_ASSISTANT_MARKER=1` | Remove the `●` reply marker. |
175
+ | `CC_FOOTER=0` | Keep pi's footer instead of One Code's status line. |
176
+ | `CC_TURN_DURATION=0` | Remove the post-turn timing line. |
177
+ | `CC_RECAP=0` | Turn off the "while you were away" recap. |
178
+ | `CC_RECAP_IDLE_MS` | Idle time before a recap, in milliseconds (default 300000). |
179
+ | `CC_COMPACTION=0` | Use pi's compaction summary instead of Claude Code's. |
180
+ | `CC_CLEAR_THINKING=0`, `=1` | Force the thinking-preservation request off or on for Anthropic models. Default: on for `api.anthropic.com` only. |
181
+ | `CC_TOTAL_TOKENS=0` | Remove the `<total_tokens>` budget line. |
182
+ | `CC_TOTAL_TOKENS_BUDGET` | The per-turn budget the line counts down from (default 15000000). |
183
+ | `CC_PROMPT_TIER=frontier\|workhorse\|cheap\|tiny` | Force a system-prompt tier. |
184
+ | `CC_HOOKS_DEBUG=1` | Print hook dispatches to stderr and log decisions. |
185
+ | `CC_AUTO_MODE_DEBUG=1` | Print classifier verdicts to stderr. `2` is more verbose. |
186
+ | `CC_VERSION` | The version shown in the banner (set by the app). |
187
+ | `CC_PERMISSION_MODE` | Set by One Code to the live mode for child processes. Not an input; use `--permission-mode`. |
188
+
189
+ ### pi and Claude Code variables honored
190
+
191
+ | Variable | Effect |
192
+ |---|---|
193
+ | `PI_CODING_AGENT_DIR` | pi's agent directory. The app sets `~/.onecode/agent`. |
194
+ | `PI_CACHE_RETENTION` | pi's prompt-cache lifetime. One Code sets `long` for interactive sessions unless you set it yourself. |
195
+ | `PI_OFFLINE=1` | Same as `--offline`. |
196
+ | `CLAUDE_CONFIG_DIR` | Where Claude Code's user configuration is read from. |
197
+ | `CLAUDE_CODE_SUBAGENT_MODEL` | Default subagent model on a Claude session. |
198
+ | `EDITOR`, `VISUAL` | Editor used by `/memory` (and pi's **ctrl+g**). |
199
+ | `SHELL` | Shell used for commands (default `/bin/sh`). |
200
+ | Provider keys | `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `OPENROUTER_API_KEY`, `OPENCODE_API_KEY`, and the rest pi supports. |
201
+
202
+ Variables One Code sets for hooks and children: `CLAUDE_PROJECT_DIR` in a
203
+ hook's environment, `CC_PERMISSION_MODE` for child tool gates.
204
+
205
+ ## Files and directories
206
+
207
+ | Path | Contents |
208
+ |---|---|
209
+ | `~/.onecode/` | One Code's state. See [What is stored under ~/.onecode](configuration.md#what-is-stored-under-onecode). |
210
+ | `~/.onecode/agent/` | pi's state under the bundled app: credentials, sessions, pi's settings, plugins. |
211
+ | `~/.claude/` | Claude Code's configuration, read only, except `projects/<slug>/memory/`. |
212
+ | `~/.claude/projects/<slug>/memory/` | Per-repository memory, shared with Claude Code. |
213
+ | `.claude/` | Project configuration: `settings.json`, `settings.local.json`, `skills/`, `commands/`, `agents/`, `workflows/`, `worktrees/`. |
214
+ | `.mcp.json` | Project MCP servers. |
215
+ | `CLAUDE.md`, `CLAUDE.local.md`, `AGENTS.md`, `ONECODE.md` | Instruction files. |
216
+ | System temp directory | Session scratchpads. |
217
+
218
+ ## Tools
219
+
220
+ The tools available to the model are listed in [Tools](tools.md), with the
221
+ mapping from Claude Code's names.
222
+
223
+ ## Themes
224
+
225
+ `onecode` (dark) and `onecode-light`. See
226
+ [Full-screen mode and themes](configuration.md#full-screen-mode-and-themes).
@@ -0,0 +1,192 @@
1
+ # Sessions and context
2
+
3
+ [← One Code user guide](README.md)
4
+
5
+ This page covers what One Code puts into the model's context, how it keeps
6
+ long sessions within the context window, what it remembers between
7
+ sessions, and how to continue or branch a session.
8
+
9
+ ## What the model sees at the start
10
+
11
+ The first message of every session carries a context block built the same
12
+ way Claude Code builds it, so the model reads your instructions exactly as
13
+ it would there. The block contains, in order:
14
+
15
+ 1. **Project instructions.** Every `CLAUDE.md` from your home directory's
16
+ `~/.claude/CLAUDE.md` down through each ancestor directory to the
17
+ working directory. In a directory that has no `CLAUDE.md`, an
18
+ `AGENTS.md` is used instead. A `CLAUDE.local.md` next to either is
19
+ included as your private, uncommitted instructions.
20
+ 2. **The auto-memory index.** The first 200 lines or 25 KB of `MEMORY.md`
21
+ from the repository's memory folder. See [Memory](#memory).
22
+ 3. **Your email**, from `git config user.email` (or `GIT_AUTHOR_EMAIL` or
23
+ `EMAIL`), for attribution.
24
+ 4. **Today's date.**
25
+
26
+ `@path` references inside a `CLAUDE.md` are expanded in place, up to five
27
+ levels deep, so a file that imports shared instructions keeps working.
28
+ Paths resolve relative to the importing file; `~/` resolves to your home
29
+ directory. References inside code spans and fenced blocks are left alone.
30
+
31
+ A `CLAUDE.md` larger than 40,000 characters, or a set of instruction files
32
+ whose total exceeds that, triggers a warning at startup so you can trim it.
33
+ Run `/memory` to open any of these files.
34
+
35
+ ### ONECODE.md
36
+
37
+ Instructions that only One Code should read go in `ONECODE.md`
38
+ (`onecode.md` and `One Code.md` also work). Claude Code never reads this
39
+ file. One Code adds it as a separate block after the Claude Code context,
40
+ marked as taking precedence, so the order is ONECODE.md, then CLAUDE.md,
41
+ then AGENTS.md. A global `~/.onecode/ONECODE.md` is read too.
42
+
43
+ Use it for instructions that mention One Code features, such as the
44
+ `ultracode` keyword or a subagent model preference, without confusing a
45
+ real Claude Code session on the same repository.
46
+
47
+ ### The system prompt
48
+
49
+ The system prompt is an adaptation of Claude Code's, chosen by the
50
+ capability of the model in use. Stronger models receive a terse prompt;
51
+ smaller models receive more guidance and, on the smallest tier, extra
52
+ search tools. It ends with a git status snapshot (branch, main branch, user,
53
+ working-tree status, recent commits) taken once per session. See
54
+ [Prompting adapts to the model](providers-and-models.md#prompting-adapts-to-the-model).
55
+
56
+ ## Memory
57
+
58
+ One Code keeps per-repository memory in the same place Claude Code does:
59
+ `~/.claude/projects/<slug>/memory/`, where the slug is derived from the
60
+ repository root (or the working directory outside a repository). Worktrees
61
+ and subdirectories of one repository share one memory folder. This is the
62
+ one place One Code writes under `~/.claude`, so a real Claude Code session
63
+ on the same repository reads the same memories.
64
+
65
+ The model writes one file per memory and keeps an index in `MEMORY.md`.
66
+ When the index grows near its limit (200 lines or 25 KB), the model is
67
+ warned; past the limit, a write to it still succeeds but returns an error
68
+ so the model trims the index.
69
+
70
+ Run `/memory` to open the memory folder or any instruction file. Files open
71
+ in `$VISUAL` or `$EDITOR`; folders open in your file manager.
72
+
73
+ ## The context window
74
+
75
+ ### Compaction
76
+
77
+ When the conversation approaches the context limit, One Code replaces the
78
+ older part with a summary, using Claude Code's compaction instruction: the
79
+ summary keeps the request and intent, key concepts, the files touched,
80
+ errors and fixes, every user message, pending tasks, and the current work.
81
+ The summary also points the model at the session file so it can search the
82
+ full transcript if it needs a detail.
83
+
84
+ Run `/compact` to compact at any time; you can pass instructions about what
85
+ the summary should focus on. Compaction that happens because the context is
86
+ full is more expensive than a manual or threshold compaction, because it
87
+ can't reuse the cached prefix of the conversation.
88
+
89
+ Set `CC_COMPACTION=0` to use pi's own summary instead.
90
+
91
+ ### The token budget line
92
+
93
+ Like Claude Code, One Code tells the model how many tokens it has left in
94
+ the current turn: a `<total_tokens>` line appears in the system prompt, at
95
+ the end of every user message, and after every tool result. The budget is
96
+ 15,000,000 tokens per turn, Claude Code's own figure. Set
97
+ `CC_TOTAL_TOKENS_BUDGET` to change it or `CC_TOTAL_TOKENS=0` to remove it.
98
+
99
+ ### Thinking blocks and the cache
100
+
101
+ On Anthropic's own API, One Code asks the provider to keep earlier thinking
102
+ blocks in place rather than strip them, because stripping them invalidates
103
+ the prompt cache on older models. This is on by default for
104
+ `api.anthropic.com` and off for Bedrock, Vertex, and proxies. Set
105
+ `CC_CLEAR_THINKING=1` to force it on elsewhere or `CC_CLEAR_THINKING=0` to
106
+ turn it off.
107
+
108
+ ### The prompt cache
109
+
110
+ Interactive sessions ask the provider for an extended cache lifetime (one
111
+ hour on Anthropic; provider-dependent elsewhere), so a pause between turns
112
+ doesn't re-send the whole conversation. Subagents, workflow agents, and
113
+ `-p` or `--mode json` runs use the provider's short default. Set
114
+ `PI_CACHE_RETENTION` yourself to take over the choice. The footer shows the
115
+ cache-hit rate of the latest turn.
116
+
117
+ Changing the reasoning effort or the model re-caches the conversation, so
118
+ one request after such a change costs more than usual.
119
+
120
+ ## Scratch space and large output
121
+
122
+ Each session gets a scratchpad directory under the system temp directory,
123
+ named by project and session. The model is told to use it for temporary
124
+ files instead of `/tmp`; writes there need no approval.
125
+
126
+ Tool output larger than 50 KB isn't truncated. It's written to a file
127
+ under the session directory, and the model receives the path, the size,
128
+ and a 2 KB preview in a `<persisted-output>` block, so it can read the part
129
+ it needs.
130
+
131
+ ## While you are away
132
+
133
+ After five minutes without a keystroke following a turn, One Code shows a
134
+ short recap of what the model was doing and what comes next, prefixed with
135
+ `※ recap:`. The recap is produced by a cheap model on your provider using
136
+ Claude Code's own recap prompt, is display-only, and is never sent back to
137
+ the model. Its cost is included in the footer's total.
138
+
139
+ Set `CC_RECAP_IDLE_MS` to change the delay (in milliseconds) or `CC_RECAP=0`
140
+ to turn recaps off.
141
+
142
+ ## Continue, resume, and branch
143
+
144
+ Session management is pi's own. The commands work the same under `onecode`:
145
+
146
+ ```bash
147
+ onecode -c # continue the most recent session
148
+ onecode -r # browse and pick a session to resume
149
+ onecode --session <id> # open a specific session
150
+ onecode --fork <id> # fork a session into a new file
151
+ onecode --no-session # do not save this session
152
+ ```
153
+
154
+ Inside a session, `/resume` browses sessions, `/tree` shows the session's
155
+ branches and lets you switch between them, `/fork` and `/clone` copy the
156
+ session, `/name` names it, and `/export` writes it to HTML.
157
+
158
+ The resume hint printed when a session ends reads `onecode --session …`
159
+ under the bundled app.
160
+
161
+ ### What comes back after a resume or branch switch
162
+
163
+ Restored from the session file:
164
+
165
+ - The file-tracker's record of which files the model has read, checked
166
+ against the current contents on disk.
167
+ - The structured task list.
168
+ - The plan file, when the session was in plan mode.
169
+ - The history of subagent runs, so a finished subagent can still be
170
+ messaged.
171
+
172
+ Not restored:
173
+
174
+ - The permission mode. A resumed session starts in the configured default.
175
+ - Background shells, monitors, running subagents, and background workflow
176
+ runs. They stop when a session ends; the next session is told what was
177
+ stopped. A workflow can be resumed from its journal.
178
+ - Session-only approvals from the permission prompt.
179
+ - The reasoning effort level.
180
+
181
+ ### Start over
182
+
183
+ `/clear` starts a new session in the same directory, the same as pi's
184
+ `/new`. Running background tasks are stopped and listed. The permission
185
+ mode you chose carries over.
186
+
187
+ ## Turn timing
188
+
189
+ After each turn, a dim line such as `✻ Cooked for 5m 12s` reports how long
190
+ it took, with a random verb, as in Claude Code. When background shells are
191
+ still running, the line adds a count. Set `CC_TURN_DURATION=0` to turn it
192
+ off.