one-code-extension 0.1.4 → 0.3.1

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