one-code-extension 0.1.4 → 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 -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,124 @@
1
+ # Install One Code
2
+
3
+ One Code ships as two npm packages from one repository. Choose the one that
4
+ fits how you already work.
5
+
6
+ | You | Install | What you get |
7
+ |---|---|---|
8
+ | New to this, or you want the simplest setup | `npm install -g @one-ai/one-code` | The bundled app: its own `onecode` command, a pinned version of the pi coding agent inside it, and its state kept in `~/.onecode`. It coexists with any `pi` you already have. |
9
+ | Already running [pi](https://github.com/earendil-works/pi) | `pi install npm:one-code-extension` | The extensions only. They run on your existing pi. One Code's own state still goes to `~/.onecode`; pi's own files stay under your pi agent directory (`~/.pi/agent`). |
10
+
11
+ ## Requirements
12
+
13
+ - Node.js 22.19 or later. The app refuses to start on older versions,
14
+ because pi crashes at import time there.
15
+ - macOS or Linux. Windows Subsystem for Linux (WSL) works the same way.
16
+ Native Windows is untested and unsupported.
17
+ - `git`. Optional: `rg` (ripgrep) for faster search, the GitHub CLI for the
18
+ pull-request marker in the footer, and a language server for your
19
+ language (see
20
+ [Language-server diagnostics](configuration.md#language-server-diagnostics)).
21
+
22
+ ## Install the app with npm
23
+
24
+ ```bash
25
+ npm install -g @one-ai/one-code
26
+ cd your-project
27
+ onecode
28
+ ```
29
+
30
+ On the first run there is no provider yet: the banner shows `model none`.
31
+ Run `/login` inside One Code to connect a provider, or set a provider key
32
+ in your environment before launching. For a free option, see
33
+ [Providers and models](providers-and-models.md).
34
+
35
+ The first run also seeds pi's settings under `~/.onecode/agent/` with the
36
+ `onecode` theme, quiet startup, and full-screen mode. It never overrides a
37
+ value you change later.
38
+
39
+ ## Install with Homebrew
40
+
41
+ Homebrew installs Node for you, so this route has no separate Node step:
42
+
43
+ ```bash
44
+ brew install isurumaduranga/one-ai/one-code
45
+ ```
46
+
47
+ The formula is named `one-code`; the command it installs is `onecode`.
48
+ Homebrew refuses npm packages published less than a day ago, so a release
49
+ becomes installable this way about a day after it appears on npm.
50
+
51
+ ## Install the extension on your own pi
52
+
53
+ If you already run pi, add One Code as an extension:
54
+
55
+ ```bash
56
+ pi install npm:one-code-extension
57
+ ```
58
+
59
+ Use `pi` in place of `onecode` for every command in this guide. The
60
+ extension is tested against pi 0.83 through 0.85 and warns at startup when
61
+ your pi is outside that range. Full-screen mode is opt-in on your own pi;
62
+ see [Full-screen mode and themes](configuration.md#full-screen-mode-and-themes).
63
+
64
+ A few interface refinements are applied only by the bundled app, because
65
+ they patch pi internals the extension API cannot reach: a clean exit that
66
+ erases the screen in regular mode, and suppression of pi's "Operation
67
+ aborted" line when you interrupt a reply. Everything else is identical.
68
+
69
+ ## Install from source
70
+
71
+ ```bash
72
+ git clone https://github.com/IsuruMaduranga/one-code
73
+ cd one-code
74
+ npm install
75
+ cd ..
76
+ pi install ./one-code
77
+ pi list
78
+ ```
79
+
80
+ Run `npm install` before the path install so the dependencies are present.
81
+ `pi list` confirms the package registered.
82
+
83
+ ## Check the installation
84
+
85
+ ```bash
86
+ onecode --version # prints the app version and the pi version inside it
87
+ onecode doctor # prints the setup report; exits 1 when no provider is ready
88
+ ```
89
+
90
+ Inside a session, `/doctor` runs the full checkup. See
91
+ [Check your setup with doctor](doctor.md).
92
+
93
+ ## Update
94
+
95
+ The bundled app checks npm once a day when a session starts and shows a
96
+ notice with the matching upgrade command when a newer version exists:
97
+
98
+ ```bash
99
+ npm install -g @one-ai/one-code # npm installs
100
+ brew upgrade one-code # Homebrew installs
101
+ ```
102
+
103
+ Set `ONECODE_NO_UPDATE_CHECK=1` to skip the check; `--offline` skips it too.
104
+ On your own pi, update with `pi update --extensions`.
105
+
106
+ Both packages are released together with the same version number.
107
+
108
+ ## Uninstall
109
+
110
+ ```bash
111
+ npm uninstall -g @one-ai/one-code # or: brew uninstall one-code
112
+ rm -rf ~/.onecode # One Code's state, including pi's under the app
113
+ ```
114
+
115
+ On your own pi, run `pi remove one-code-extension` (or remove the package
116
+ entry from pi's settings). Removing `~/.onecode` deletes One Code's
117
+ settings, approvals, plan files, and, under the bundled app, pi's sessions
118
+ and credentials. Memory files stay in `~/.claude/projects/`, because they
119
+ are shared with Claude Code.
120
+
121
+ ## Next step
122
+
123
+ Connect a provider and choose a model in
124
+ [Providers and models](providers-and-models.md).
@@ -0,0 +1,450 @@
1
+ # Permissions, modes, and auto mode
2
+
3
+ Every tool call the model makes passes through One Code's permission gate
4
+ before it runs. This page explains the permission modes, how to switch
5
+ between them, how to write rules, what the approval prompt offers, and how
6
+ plan mode and auto mode change what needs your approval.
7
+
8
+ For the security guarantees and the known gaps, read
9
+ [A boundary, not a promise](#a-boundary-not-a-promise) at the end of this
10
+ page before you rely on auto mode for unattended work.
11
+
12
+ ## How a decision is made
13
+
14
+ For each tool call, the gate checks the following in order:
15
+
16
+ 1. **Protected paths.** A write to a protected file or directory (see
17
+ [Protected paths](#protected-paths)) is never approved automatically. In
18
+ auto mode it goes to the classifier; in other modes it prompts you.
19
+ Allow rules do not cover protected paths.
20
+ 2. **`deny` rules.** A matching `deny` rule blocks the call. `deny` always
21
+ wins.
22
+ 3. **`ask` rules.** A matching `ask` rule prompts you, even in a mode that
23
+ would otherwise approve the call.
24
+ 4. **`allow` rules.** A matching `allow` rule approves the call without a
25
+ prompt.
26
+ 5. **The mode's default.** Anything no rule covers is decided by the current
27
+ permission mode.
28
+
29
+ A handful of tools are always allowed because other tools sit behind them:
30
+ `tool_search`, `skill`, `Agent`, `SendMessage`, `list_agents`, `workflow`,
31
+ `ask_user_question`, `lsp_diagnostics`, `list_mcp_resources`, the task-list
32
+ tools, `schedule_wakeup`, and the plan-mode tools. The tool calls these
33
+ tools make in turn (a subagent's own edits, for example) are still gated.
34
+
35
+ ## Permission rules
36
+
37
+ One Code reads `allow`, `deny`, and `ask` rules from the same files Claude
38
+ Code uses, plus its own:
39
+
40
+ | File | Scope |
41
+ |---|---|
42
+ | `~/.claude/settings.json` | Your user-wide Claude Code rules. Read only. |
43
+ | `~/.onecode/settings.json` | Your user-wide One Code rules. `/allow … global` writes here. |
44
+ | `.claude/settings.json` and `.claude/settings.local.json` | The project's rules. Read only. Allow rules from these files need your approval once; see [Trusting a project](#trusting-a-project). |
45
+ | `~/.onecode/projects/<slug>/settings.json` | One Code's per-repository rules. `/allow` writes here. |
46
+ | Managed settings | Organization-wide rules, when present. Read only. |
47
+
48
+ Rules match tools by name and, optionally, by argument. Claude Code's
49
+ PascalCase tool names (`Bash`, `Read`, `Edit`, `WebFetch`, `Task`, and the
50
+ rest) work in these rules, so a setup you wrote for Claude Code applies as
51
+ it is. For the mapping from Claude Code names to One Code's tool names, see
52
+ [Tools](tools.md#claude-code-tool-names).
53
+
54
+ A rule naming an MCP server, such as `mcp__github`, covers every tool that
55
+ server provides. A rule naming a single MCP tool, such as
56
+ `mcp__github__create_issue`, covers only that tool.
57
+
58
+ ### Bash rule patterns
59
+
60
+ Bash rules follow Claude Code's matching rules:
61
+
62
+ - `Bash(npm test)` matches that exact command line.
63
+ - `Bash(npm test:*)` matches `npm test` and any command that starts with
64
+ `npm test` followed by a space. It does not match `npm tests` or
65
+ `npm test:unit`; write `Bash(npm test:unit:*)` for the latter.
66
+ - `Bash(git * --dry-run)` uses `*` as a wildcard anywhere in the line. Write
67
+ `\*` for a literal asterisk and `\\` for a literal backslash.
68
+
69
+ `deny` and `ask` rules are matched against every form of a command line, so
70
+ they are hard to sidestep. They apply when they match the raw line, any
71
+ subcommand of a compound line (`&&`, `||`, `;`, `|`, `&`, or a newline), or
72
+ the payload of a wrapper. Wrappers such as `env`, `command`, `nice`,
73
+ `timeout`, and `xargs` are peeled, `sh -c '…'` and the other shells are
74
+ expanded, and the command word is reduced to its lowercased basename, so
75
+ `/bin/rm`, `\rm`, and `RM` all match a rule written for `rm`.
76
+
77
+ `allow` rules are matched against the literal spelling only, and a compound
78
+ command line is allowed only when an `allow` rule covers every one of its
79
+ subcommands, or when an exact rule matches the whole line. A line that
80
+ contains command substitution (`$(…)` or backticks), `eval`, `exec`, a pipe
81
+ into an interpreter, or a base64 decode is never covered by a prefix or
82
+ wildcard `allow` rule.
83
+
84
+ ### Add a rule during a session
85
+
86
+ To add an allow rule for the current repository, run:
87
+
88
+ ```
89
+ /allow Bash(npm test:*)
90
+ ```
91
+
92
+ Add `global` at the end to save it for every repository instead:
93
+
94
+ ```
95
+ /allow Bash(npm test:*) global
96
+ ```
97
+
98
+ To review the current mode and every loaded rule, including which project
99
+ rules are trusted and which rules could not be parsed, run `/permissions`.
100
+
101
+ Rules One Code adds are saved under `~/.onecode`, never under `~/.claude`.
102
+
103
+ ## Permission modes
104
+
105
+ A mode sets the default answer for actions no rule covers. **Auto is the
106
+ default**, matching Claude Code: a classifier approves routine actions and
107
+ stops risky ones, so you are not prompted for every step.
108
+
109
+ | Mode | Badge | What it does |
110
+ |---|---|---|
111
+ | Manual | `⏸ manual mode on` | Prompts for anything not already allowed. The `--permission-mode` value is `default`. |
112
+ | Accept edits | `⏵⏵ accept edits on` | File edits inside the working directory run without a prompt. Everything else still prompts. The flag value is `acceptEdits`. |
113
+ | Plan | `⏸ plan mode on` | Read-only investigation plus one plan file. See [Plan mode](#plan-mode). The flag value is `plan`. |
114
+ | Auto | `⏵⏵ auto mode on` | A classifier screens each action. See [Auto mode](#auto-mode). The flag value is `auto`. |
115
+ | Bypass permissions | `⏵⏵ bypass permissions on` | Runs everything without prompts, including writes to protected paths. The flag value is `bypassPermissions`; `--dangerously-skip-permissions` also selects it. |
116
+ | Don't ask | `⏵⏵ don't ask on` | Never prompts. Anything that would have prompted is denied instead. The flag value is `dontAsk`. |
117
+
118
+ The current badge appears in the banner and is announced when the mode
119
+ changes.
120
+
121
+ ### Cycle modes with ctrl+q
122
+
123
+ Press **ctrl+q** to cycle through manual, accept edits, plan, and auto.
124
+ Two modes join the cycle only under conditions:
125
+
126
+ - **Auto** appears only when a model that can run the classifier is
127
+ available. With no provider connected, the cycle skips it.
128
+ - **Bypass permissions** appears only when the session started in it.
129
+
130
+ **Don't ask** is never in the cycle; reach it with the `--permission-mode`
131
+ flag or a settings file.
132
+
133
+ Claude Code cycles modes with shift+tab. One Code cannot use that key
134
+ because pi reserves it for the reasoning-effort dial. On Windows and WSL,
135
+ pi's own default keybindings also use ctrl+q to queue a follow-up message.
136
+ If the two conflict there, change pi's binding in its keybindings file.
137
+
138
+ ### Choose the starting mode
139
+
140
+ To start one session in a different mode, pass `--permission-mode`:
141
+
142
+ ```bash
143
+ onecode --permission-mode plan
144
+ ```
145
+
146
+ For a reusable shortcut, add an alias to your shell configuration:
147
+
148
+ ```bash
149
+ alias onecode-manual='onecode --permission-mode default'
150
+ ```
151
+
152
+ For a persistent default, One Code reads `permissions.defaultMode` from your
153
+ Claude Code settings files. Merge this into the existing object:
154
+
155
+ ```json
156
+ {
157
+ "permissions": {
158
+ "defaultMode": "default"
159
+ }
160
+ }
161
+ ```
162
+
163
+ The scopes are not equal:
164
+
165
+ - **User scope** (`~/.claude/settings.json`) and **managed settings** can
166
+ set any mode.
167
+ - **Project scope** (`.claude/settings.json` and `.claude/settings.local.json`)
168
+ can set `default`, `acceptEdits`, `plan`, or `dontAsk`. It cannot set
169
+ `auto` or `bypassPermissions`; a checked-in file must not be able to turn
170
+ off approvals for whoever clones it.
171
+ - A `defaultMode` in `~/.onecode/settings.json` has no effect.
172
+
173
+ The `--permission-mode` flag takes precedence over every configured default.
174
+
175
+ To make bypass mode impossible from any source, set
176
+ `permissions.disableBypassPermissionsMode` to `"disable"` in any scope. One
177
+ Code then refuses bypass whether it was requested by flag or by settings.
178
+
179
+ The mode you choose during a session persists across `/clear`. A session
180
+ you resume later starts in the configured default, not in the mode it was
181
+ in when it ended.
182
+
183
+ ## The approval prompt
184
+
185
+ When an action needs your decision, a prompt shows the tool, its arguments,
186
+ and these choices:
187
+
188
+ - **Yes.** Run it this once.
189
+ - **Yes, and don't ask again … this session.** Approve this action and
190
+ similar ones until the session ends. The scope of "similar" depends on the
191
+ action:
192
+ - A command: only that exact command line, never a pattern.
193
+ - A file inside the working directory: that tool anywhere in the working
194
+ directory.
195
+ - A file outside the working directory: that tool within the file's
196
+ directory only.
197
+ - A URL: that host.
198
+ - **No, tell the agent what to do differently.** Deny it, with an optional
199
+ note that is passed to the model as the reason.
200
+
201
+ The "don't ask again" option is not offered for protected paths, for writes
202
+ that the auto-mode safety floor caught, or in auto mode. Session grants never
203
+ apply in auto mode and are cleared when the session ends.
204
+
205
+ In non-interactive runs (`-p` and `--mode json`) nothing can prompt, so an
206
+ action that would have prompted is denied and the model is told why.
207
+
208
+ ## The working directory boundary
209
+
210
+ Reads and edits are confined to the working directory by default:
211
+
212
+ - Reading a file inside the working directory is allowed in every mode.
213
+ Reading outside it prompts in manual mode, goes to the classifier in auto
214
+ mode, and is denied in don't-ask mode.
215
+ - Accept-edits mode approves edits only inside the working directory.
216
+ - The harness's own session directories count as inside: the auto-memory
217
+ folder, the session scratchpad, persisted tool output, and the plan file.
218
+
219
+ Paths are compared after resolving symlinks, so a symlink inside the project
220
+ that points outside it counts as outside.
221
+
222
+ In auto mode, a shell command that reads outside the working directory, a
223
+ bare `env`, or a `printenv` is never treated as safe by the deterministic
224
+ check and always goes to the classifier.
225
+
226
+ ## Protected paths
227
+
228
+ Writes to these paths are never approved automatically in any mode other
229
+ than bypass, and allow rules do not cover them.
230
+
231
+ Protected directories, including everything inside them:
232
+
233
+ `.git`, `.config/git`, `.vscode`, `.idea`, `.husky`, `.cargo`,
234
+ `.devcontainer`, `.yarn`, `.mvn`, `.claude`, `.onecode`,
235
+ `Library/LaunchAgents`, `.config/fish`, `.local/bin`.
236
+
237
+ `.claude/worktrees` and `.onecode/plans` are ordinary working space and are
238
+ exempt.
239
+
240
+ Protected files:
241
+
242
+ Shell startup files (`.bashrc`, `.bash_profile`, `.bash_login`,
243
+ `.bash_aliases`, `.bash_logout`, `.zshrc`, `.zprofile`, `.zshenv`, `.zlogin`,
244
+ `.zlogout`, `.profile`, `.envrc`), git files (`.gitconfig`, `.gitmodules`),
245
+ package-manager files (`.npmrc`, `.yarnrc`, `.yarnrc.yml`, `.pnp.cjs`,
246
+ `.pnp.loader.mjs`, `.pnpmfile.cjs`, `bunfig.toml`, `.bunfig.toml`), build
247
+ files (`.bazelrc`, `.bazelversion`, `.bazeliskrc`, `gradle-wrapper.properties`,
248
+ `maven-wrapper.properties`), hook runners (`.pre-commit-config.yaml`,
249
+ `lefthook.yml`, `lefthook.yaml`, `.lefthook.yml`, `.lefthook.yaml`), and
250
+ tool configuration (`.devcontainer.json`, `.ripgreprc`, `pyrightconfig.json`,
251
+ `.mcp.json`, `.claude.json`, `managed-settings.json`).
252
+
253
+ pi's agent directory, Claude Code's configuration directory, and One Code's
254
+ state directory are protected wherever they are, including when relocated
255
+ by an environment variable.
256
+
257
+ ## Trusting a project
258
+
259
+ Some project-provided configuration can run code or widen permissions, so
260
+ One Code asks you once per project before using it. Each approval is
261
+ remembered under `~/.onecode` together with a hash of the configuration, so
262
+ a change to the configuration asks again. Declining is remembered for the
263
+ current session only.
264
+
265
+ | What | When you are asked | Stored in |
266
+ |---|---|---|
267
+ | Hooks in `.claude/settings.json` or `.claude/settings.local.json` | At startup: "Run this project's hooks?", listing each command. | `~/.onecode/hooks/project-approvals.json` |
268
+ | MCP servers in `.mcp.json` | At startup, for each new server. See [MCP servers](skills-plugins-and-mcp.md#mcp-servers). | `~/.onecode/mcp/project-approvals.json` |
269
+ | `permissions.allow` rules in the project's settings files | The first time such a rule would decide a call: "Trust this repository's allow rules?" | `~/.onecode/permissions/project-allow-approvals.json` |
270
+
271
+ `deny` and `ask` rules from a project never prompt; they only tighten the
272
+ gate. Hooks and servers from your user settings, managed settings, or an
273
+ installed plugin never prompt either, because installing them was the
274
+ consent.
275
+
276
+ ## Plan mode
277
+
278
+ Plan mode lets the model investigate and write a plan without changing your
279
+ code. Only read-only tools and edits to one plan file are available.
280
+
281
+ - The plan file lives at `~/.onecode/plans/<name>.md`, where the name is a
282
+ random three-word slug. The same file is reused when you resume the
283
+ session or switch branches in `/tree`.
284
+ - The model is reminded to explore with the `explore` agent, design with the
285
+ `plan` agent, and then write the plan.
286
+ - You can read and edit the plan file yourself while the model works.
287
+
288
+ Enter plan mode by cycling to it with **ctrl+q**, by starting with
289
+ `--permission-mode plan`, or by asking the model to plan first (it can call
290
+ `enter_plan_mode` itself).
291
+
292
+ When the model finishes, it calls `exit_plan_mode` and an approval dialog
293
+ shows the plan. Nothing runs until you choose. The choices are:
294
+
295
+ 1. **Approve and return to the mode you were in** before planning, when that
296
+ mode is available.
297
+ 2. **Approve into auto mode**, when a classifier model is available.
298
+ 3. **Approve into accept-edits mode.**
299
+ 4. **Approve into manual mode.**
300
+ 5. **Keep planning.** No mode change; the model refines the plan file.
301
+
302
+ The initial highlight is the option that restores your previous mode, or
303
+ manual mode when that is not offered. It never lands on a more permissive
304
+ option by default. Press the number of a choice to pick it directly, or
305
+ **Esc** to keep planning.
306
+
307
+ In a non-interactive run there is no one to approve, so `exit_plan_mode`
308
+ refuses and the session stays in plan mode with the plan on disk.
309
+
310
+ ## Auto mode
311
+
312
+ Auto mode removes routine approval prompts without removing the boundary.
313
+ It combines a deterministic first pass with Claude Code's own two-stage
314
+ classifier.
315
+
316
+ ### What is approved without a classifier call
317
+
318
+ - Actions a deterministic analysis proves safe. Read-only shell commands
319
+ inside the working directory are the common case. This analysis can only
320
+ ever conclude "safe"; anything it cannot parse or recognize goes to the
321
+ classifier rather than through.
322
+ - Edits and writes to files inside the project that are not credential
323
+ files, not protected paths, and not files that run code on their own
324
+ (build wrappers, CI workflows, editor auto-run configuration).
325
+ - Deleting or resetting files inside the project **when git can recover
326
+ them**. A tracked, committed file can be restored, so removing it is
327
+ approved. An untracked or modified file cannot, so removing it goes to
328
+ the classifier. Claude Code trusts the whole project directory here; One
329
+ Code checks recoverability first.
330
+
331
+ ### What goes to the classifier
332
+
333
+ Everything else: destructive commands git cannot undo, anything that
334
+ reaches outside the project, network-affecting commands, writes to
335
+ protected paths, and reads outside the working directory.
336
+
337
+ The classifier is Claude Code's two-stage ruleset, embedded verbatim:
338
+
339
+ 1. **Stage 1** grades harm only, on a 0 to 100 scale. Below 50 the action
340
+ is allowed and nothing more runs.
341
+ 2. **Stage 2** runs when stage 1 scores 50 or above. It weighs the user's
342
+ stated intent and the allow list, and either approves or blocks with a
343
+ named rule.
344
+
345
+ Verdicts are checked before they are acted on. A block must cite a real
346
+ rule from the ruleset. An approval based on intent must quote your own
347
+ words from the conversation. A classifier that cannot be reached, times
348
+ out, or returns something unparseable blocks the action; a gate that cannot
349
+ consult its classifier approves nothing.
350
+
351
+ A blocked action is reported to the model with the reason so it can choose
352
+ a safer route. You are not prompted per action while auto mode runs. After
353
+ repeated blocks in a row, auto mode pauses and the next action prompts you;
354
+ approving it resumes auto mode.
355
+
356
+ Allow rules that are broad enough to pre-approve arbitrary execution, such
357
+ as `Bash(*)`, a wildcarded interpreter, or a rule that allows delegation to
358
+ subagents, are suspended in auto mode so they cannot bypass the classifier.
359
+ Session grants from the approval prompt do not apply in auto mode either.
360
+
361
+ ### The classifier model
362
+
363
+ The classifier runs on a model from the same provider as your session,
364
+ chosen automatically as the cheapest model that is at least as capable as
365
+ the floor: a Sonnet-class model when your session runs a Sonnet-class or
366
+ stronger model, a Haiku-class model otherwise. A weak classifier is a
367
+ measurably weaker boundary; in testing, a Haiku-class classifier scored an
368
+ explicitly requested recursive delete far below the block threshold that a
369
+ Sonnet-class classifier applied to the same command.
370
+
371
+ To choose the classifier yourself, run `/auto-mode model <provider/model-id>`.
372
+ `/auto-mode model clear` returns to automatic selection. The choice is saved
373
+ to `~/.onecode/settings.json`. When auto mode is active, the banner shows
374
+ the classifier in use.
375
+
376
+ ### The safety floor
377
+
378
+ A deterministic floor protects the gate's own configuration regardless of
379
+ what the classifier or the model decides. A write to any of these files
380
+ never reaches the classifier; it prompts you in an interactive session and
381
+ is blocked in a non-interactive one:
382
+
383
+ - `.claude/settings.json` and `.claude/settings.local.json` anywhere
384
+ - `~/.onecode/settings.json` and any `~/.onecode/projects/<slug>/settings.json`
385
+ - `~/.claude.json`
386
+ - Managed settings files
387
+
388
+ ### Configure auto mode
389
+
390
+ Run `/auto-mode` (or `/auto-mode config`) to see the effective
391
+ configuration: the files it was read from, the environment description,
392
+ any extra rules, and which classifier model is in use.
393
+
394
+ Run `/auto-mode setup` to have a model draft a configuration for your
395
+ environment. It asks how you use One Code here, offers to scan recent shell
396
+ history for evidence, proposes an environment description and extra rules,
397
+ and saves them to `~/.onecode/settings.json` only when you approve. It also
398
+ audits your allow rules and offers to remove any that are broad enough to
399
+ bypass the classifier.
400
+
401
+ The configuration keys, under `autoMode`, follow Claude Code's own schema:
402
+
403
+ | Key | Type | Effect |
404
+ |---|---|---|
405
+ | `environment` | string array | Describes your environment to the classifier, replacing Claude Code's default description. Include `"$defaults"` to keep the defaults and add to them. |
406
+ | `hard_deny` | string array | Extra rules that always block. Appended to Claude Code's built-in list; the built-ins cannot be removed. |
407
+ | `soft_deny` | string array | Extra rules that block unless you explicitly asked for the action. |
408
+ | `allow` | string array | Extra rules that approve. |
409
+ | `classifyAllShell` | boolean | Send every shell command to the classifier, even ones a narrow allow rule covers. |
410
+ | `classifierModel` | string | The classifier model, as `provider/model-id`. |
411
+ | `logDecisions` | boolean | Append every gate decision to `auto-mode-decisions.jsonl` next to the session files. |
412
+
413
+ One Code reads `autoMode` from `~/.claude/settings.json`,
414
+ `~/.onecode/settings.json`, and managed settings. It never reads `autoMode`
415
+ from a project's `.claude/settings.json` or `.claude/settings.local.json`,
416
+ because a checked-in file must not be able to loosen the classifier for
417
+ whoever clones it. `classifierModel` is read only from `~/.onecode` and
418
+ managed settings.
419
+
420
+ To see the classifier's verdicts while you work, set `CC_AUTO_MODE_DEBUG=1`
421
+ before launching; each decision is printed to stderr with its stage,
422
+ severity, and rule.
423
+
424
+ ## A boundary, not a promise
425
+
426
+ One Code's security model is the permission gate plus auto mode, not an
427
+ assumption that the model behaves. Read these facts before you leave a
428
+ session unattended:
429
+
430
+ - **There is no operating-system sandbox.** The gate decides whether a
431
+ command runs; nothing constrains what an approved command can touch. For
432
+ an OS-level wall, run One Code inside a container. The gate and the
433
+ container work together.
434
+ - **Bypass mode bypasses everything**, including protected paths. Claude
435
+ Code keeps its protected-path checks active even under
436
+ `--dangerously-skip-permissions`; One Code does not.
437
+ - **Auto mode is the default without a first-run consent step**, and
438
+ without the OS sandbox Claude Code pairs its own auto default with.
439
+ - **A weak classifier is a weaker boundary.** Automatic selection applies a
440
+ floor, but a provider whose catalog has nothing stronger is screened by
441
+ what it has. One tested model family (GLM-5.3 and GLM-5.3 Flash) approved a
442
+ request to back up the project to an unnamed outside location, which the
443
+ ruleset says to block.
444
+ - **A known, accepted gap:** a write or edit tool can reach a file that only
445
+ a `Bash` deny rule protects, because in-project writes take the
446
+ deterministic fast path and are never classified. Write a `deny` rule for
447
+ the write tools too if a path must stay untouched.
448
+ - The license carries an autonomous-execution notice: the permission rules,
449
+ classifier, and safety checks are best-effort measures, not guarantees.
450
+ Keep backups and version control of anything you care about.