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