one-code-extension 0.3.1 → 0.4.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 (113) hide show
  1. package/README.md +88 -10
  2. package/docs/guide/README.md +1 -0
  3. package/docs/guide/configuration.md +2 -2
  4. package/docs/guide/differences-from-claude-code.md +13 -4
  5. package/docs/guide/hooks.md +14 -2
  6. package/docs/guide/installation.md +54 -6
  7. package/docs/guide/permissions-modes-and-auto-mode.md +23 -7
  8. package/docs/guide/reference.md +5 -2
  9. package/docs/guide/sessions-and-context.md +18 -0
  10. package/docs/guide/terminal-interface.md +1 -1
  11. package/docs/guide/tools.md +24 -2
  12. package/docs/guide/troubleshooting.md +14 -4
  13. package/docs/guide/windows.md +184 -0
  14. package/extensions/auto-mode/actions.ts +3 -1
  15. package/extensions/auto-mode/paths.ts +21 -23
  16. package/extensions/auto-mode/safety-floor.ts +44 -6
  17. package/extensions/auto-mode/shell-analysis.ts +25 -10
  18. package/extensions/auto-mode/transcript.ts +15 -5
  19. package/extensions/background/index.ts +83 -34
  20. package/extensions/background/monitor-batch.ts +7 -5
  21. package/extensions/background/wakeup.ts +18 -24
  22. package/extensions/bash/background.ts +19 -10
  23. package/extensions/bash/guards.ts +36 -16
  24. package/extensions/bash/index.ts +36 -166
  25. package/extensions/branding/index.ts +35 -4
  26. package/extensions/btw/index.ts +207 -0
  27. package/extensions/btw/panel.ts +179 -0
  28. package/extensions/btw/prompt.ts +45 -0
  29. package/extensions/clear/index.ts +15 -0
  30. package/extensions/compaction/fit.ts +9 -6
  31. package/extensions/doctor/build.ts +22 -2
  32. package/extensions/doctor/dependencies.ts +63 -31
  33. package/extensions/doctor/fix-prompt.ts +12 -4
  34. package/extensions/doctor/index.ts +1 -0
  35. package/extensions/doctor/models.ts +2 -1
  36. package/extensions/doctor/report.ts +2 -3
  37. package/extensions/doctor/update-lookup.ts +19 -11
  38. package/extensions/effort/index.ts +2 -1
  39. package/extensions/footer/footer-line.ts +19 -0
  40. package/extensions/footer/index.ts +25 -5
  41. package/extensions/hooks/executor.ts +84 -18
  42. package/extensions/hooks/index.ts +1 -0
  43. package/extensions/hooks/matcher.ts +23 -9
  44. package/extensions/hooks/settings.ts +15 -0
  45. package/extensions/lib/branch-restore.ts +12 -0
  46. package/extensions/lib/claude-context.ts +2 -3
  47. package/extensions/lib/claude-settings.ts +19 -0
  48. package/extensions/lib/command-launch.ts +71 -0
  49. package/extensions/lib/deferred.ts +173 -33
  50. package/extensions/lib/git.ts +16 -0
  51. package/extensions/lib/keys.ts +38 -0
  52. package/extensions/lib/local-command.ts +112 -0
  53. package/extensions/lib/model-facts.generated.json +263 -68
  54. package/extensions/lib/model-policy.ts +13 -0
  55. package/extensions/lib/model-tier.ts +16 -5
  56. package/extensions/lib/notifications.ts +547 -53
  57. package/extensions/lib/paths.ts +130 -2
  58. package/extensions/lib/pi-ai-estimate.ts +57 -26
  59. package/extensions/lib/pi-version.ts +1 -1
  60. package/extensions/lib/process-tree.ts +131 -5
  61. package/extensions/lib/reminders.ts +80 -27
  62. package/extensions/lib/scratchpad.ts +11 -10
  63. package/extensions/lib/shell-spawn.ts +298 -0
  64. package/extensions/lib/shell-tool.ts +252 -0
  65. package/extensions/lib/shell-tools.ts +13 -0
  66. package/extensions/lib/side-call.ts +76 -0
  67. package/extensions/lib/tui-render.ts +62 -11
  68. package/extensions/lib/update-check.mjs +155 -0
  69. package/extensions/lib/usage-bus.ts +1 -1
  70. package/extensions/lib/which.ts +62 -0
  71. package/extensions/lib/worktree-channel.ts +18 -0
  72. package/extensions/lib/worktree-isolation.ts +2 -1
  73. package/extensions/lsp/client.ts +14 -3
  74. package/extensions/lsp/index.ts +12 -5
  75. package/extensions/lsp/install-hints.ts +33 -3
  76. package/extensions/lsp/plugin-servers.ts +2 -2
  77. package/extensions/lsp/servers.ts +29 -7
  78. package/extensions/mcp/index.ts +3 -2
  79. package/extensions/memory/entries.ts +9 -6
  80. package/extensions/memory/index.ts +3 -2
  81. package/extensions/memory/open-external.ts +4 -1
  82. package/extensions/model-default/index.ts +21 -2
  83. package/extensions/permissions/index.ts +57 -28
  84. package/extensions/permissions/matcher.ts +120 -33
  85. package/extensions/permissions/modes.ts +14 -6
  86. package/extensions/permissions/powershell-rules.ts +549 -0
  87. package/extensions/permissions/session-grant.ts +9 -9
  88. package/extensions/plugins/index.ts +3 -2
  89. package/extensions/plugins/install/install.ts +1 -1
  90. package/extensions/powershell/description.ts +139 -0
  91. package/extensions/powershell/guards.ts +91 -0
  92. package/extensions/powershell/index.ts +89 -0
  93. package/extensions/powershell/policy.ts +91 -0
  94. package/extensions/recap/index.ts +10 -24
  95. package/extensions/recap/prompt.ts +3 -3
  96. package/extensions/session-title/index.ts +120 -0
  97. package/extensions/session-title/title.ts +111 -0
  98. package/extensions/skill/index.ts +40 -18
  99. package/extensions/skill/invoke.ts +1 -0
  100. package/extensions/subagents/hand-back-review.ts +10 -12
  101. package/extensions/subagents/index.ts +221 -78
  102. package/extensions/subagents/model-select.ts +75 -7
  103. package/extensions/system-prompt/environment.ts +14 -1
  104. package/extensions/system-reminder/index.ts +9 -0
  105. package/extensions/tasks/index.ts +2 -1
  106. package/extensions/tool-search/index.ts +41 -20
  107. package/extensions/workflow/agent-session.ts +6 -4
  108. package/extensions/workflow/index.ts +28 -5
  109. package/extensions/worktree/guards.ts +5 -4
  110. package/extensions/worktree/index.ts +15 -2
  111. package/extensions/worktree/rewrite.ts +17 -0
  112. package/package.json +7 -4
  113. package/types/app.d.ts +18 -2
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # One Code
2
2
 
3
+ [![CI](https://github.com/IsuruMaduranga/one-code/actions/workflows/ci.yml/badge.svg)](https://github.com/IsuruMaduranga/one-code/actions/workflows/ci.yml)
4
+
3
5
  **Claude Code with the model slot left open. The full workflow, open source, on any model or provider.**
4
6
 
5
7
  Claude Code is a good harness. It just ships bolted to one model. One Code
@@ -13,7 +15,7 @@ context management) live in the harness, not the model. One Code brings all of
13
15
  them across, because the good part was never the logo.
14
16
 
15
17
  <p align="center">
16
- <img src="demo/onecode.gif" alt="One Code switching models and running an agentic task" width="820">
18
+ <img src="demo/onecode.gif" alt="One Code: permission modes, a mid-session model switch, an agentic edit approved by auto mode, a /btw side question, /doctor report, and a subagent in the live panel" width="820">
17
19
  </p>
18
20
 
19
21
  [User guide](docs/guide/README.md) ·
@@ -33,7 +35,9 @@ them across, because the good part was never the logo.
33
35
  - **Your Claude Code setup runs unchanged.** `CLAUDE.md`, `.claude/commands`,
34
36
  `.claude/skills`, `.claude/agents`, `.mcp.json`, plugins, and permission rules
35
37
  are picked up as they are. No migration, and no second config file to keep in
36
- sync.
38
+ sync. A directory with no `CLAUDE.md` falls back to its `AGENTS.md`, the
39
+ cross-tool convention Claude Code now reads too, so a repo written for another
40
+ agent works here with nothing to change.
37
41
  - **Capability-tiered prompting.** A weaker model gets more guidance, not less.
38
42
  Not out of politeness; it is how you get output you can use.
39
43
  - **A package, not a fork.** One Code is a [pi](https://github.com/earendil-works/pi)
@@ -41,10 +45,73 @@ them across, because the good part was never the logo.
41
45
  Forks go stale; packages do not have to.
42
46
  - **Free and open source** under the MIT license.
43
47
 
48
+ ## 🤔 "But I can already point Claude Code at Ollama"
49
+
50
+ You can:
51
+
52
+ ```bash
53
+ export ANTHROPIC_BASE_URL="http://localhost:11434"
54
+ claude --model kimi-k2.7-code:cloud
55
+ ```
56
+
57
+ Claude Code will happily talk to whoever picks up the phone. If one model
58
+ behind Claude Code's interface is all you want, enjoy it.
59
+
60
+ The catch: you swapped the brain and told the body nothing. Claude Code's
61
+ prompts, caching, and side calls all assume a current Claude is on the other
62
+ end, and that assumption doesn't come off with an environment variable.
63
+
64
+ One Code started as the experiment that follows from that. My
65
+ [Harness Engineering 101](https://isuruwijesiri.com/harness-engineering-101/)
66
+ series argues the model is the brain and the harness is the body, and the good
67
+ parts live in the body. So: rebuild the body from scratch on a model-neutral
68
+ runtime and put any brain in it. This repository is that rebuild, and here's
69
+ what it does that a base URL can't.
70
+
71
+ - **One phone line.** You can rename the subagent model in Claude Code, but
72
+ every call, main agent, subagents, classifier, compaction, still dials the one
73
+ endpoint behind that URL. Mixing providers means running a routing gateway
74
+ and maintaining it. One Code gives each seat its own brain on its own
75
+ provider, natively. A frontier model in charge, DeepSeek V4 Flash running
76
+ twelve subagents. That's the setup this was built for.
77
+ - **Subscriptions don't fit behind a base URL.** A gateway wants API keys. One
78
+ Code signs you in with the account you already pay for: Claude Pro and Max,
79
+ ChatGPT, GitHub Copilot, OpenRouter, Kimi, xAI, and Radius all have native
80
+ OAuth logins, and you can mix them in one session.
81
+ - **Someone else's prompt.** Claude Code's prompt is about 8k characters,
82
+ because Claude 5 doesn't need hand-holding. Give it to a smaller model and
83
+ you get a stranger reading Claude's notes. One Code sizes the prompt to the
84
+ model in four tiers, down to playbooks and strict-schema search tools for
85
+ flash-class and local models. Weaker brains need more body.
86
+ - **Cache misses, billed to you.** Anthropic caches at explicit `cache_control`
87
+ markers; most other providers cache on an exact prefix, and the two do not
88
+ line up. A gateway that translates between them silently maps the markers
89
+ wrong, so the cache sticks at the system prompt and never advances, or never
90
+ forms at all. Nothing errors. You just pay full price every turn. This is not
91
+ hypothetical: users report proxies where the cache-creation count is zero on
92
+ every turn and half the turns re-bill the whole context, and Claude Code's own
93
+ attribution header defeats caching behind a base URL unless you know the flag
94
+ to turn off. One Code speaks each provider's native API, keeps the prefix
95
+ byte-stable, and shows the live hit rate in the footer, because one careless
96
+ byte up top is a tenfold price increase.
97
+ - **Anthropic-only parts.** Deferred tools, server-side web search, the
98
+ thinking block. A foreign endpoint drops them. One Code has a
99
+ provider-neutral version of each.
100
+ - **Side jobs that ask for Haiku by name.** Your gateway had better know who
101
+ that is. One Code picks side models from your provider's own catalog, with
102
+ a capability floor.
103
+ - **A knob, not a toolbox.** Claude Code isn't open source; the base URL is
104
+ the one knob. One Code is pi extensions all the way down, so anything
105
+ missing is one more extension.
106
+
107
+ The base URL trick swaps the brain and hopes the body doesn't notice. One Code
108
+ is the body that was built to notice.
109
+
44
110
  ## 🚀 Get started
45
111
 
46
112
  You need **Node.js 22.19+**. One Code is developed and verified on macOS and
47
- Linux; WSL works too. Native Windows is untested.
113
+ Linux; WSL works too. Native Windows runs in Claude Code's shape (Git Bash
114
+ optional, PowerShell tool) — see the [Windows guide](docs/guide/windows.md).
48
115
 
49
116
  ```bash
50
117
  npm install -g @one-ai/one-code
@@ -76,6 +143,12 @@ for connection options.
76
143
  brew install isurumaduranga/one-ai/onecode
77
144
  ```
78
145
 
146
+ **Windows** without Node.js? This fetches Node for you and installs the app:
147
+
148
+ ```powershell
149
+ powershell -c "irm https://raw.githubusercontent.com/IsuruMaduranga/one-code/master/install.ps1 | iex"
150
+ ```
151
+
79
152
  **Already on pi?** Add the extensions to your existing installation:
80
153
 
81
154
  ```bash
@@ -85,7 +158,7 @@ pi install npm:one-code-extension
85
158
  The app package, [`@one-ai/one-code`](https://www.npmjs.com/package/@one-ai/one-code),
86
159
  bundles a pinned pi and gives you the `onecode` command. The extension package,
87
160
  [`one-code-extension`](https://www.npmjs.com/package/one-code-extension), runs on
88
- your own pi and is tested against pi 0.83 to 0.85; use `pi` in place of `onecode`
161
+ your own pi and is tested against pi 0.83 to 0.86; use `pi` in place of `onecode`
89
162
  for that install.
90
163
 
91
164
  The app opens in a full-screen terminal interface by default. See the
@@ -169,7 +242,7 @@ while permission rules and deterministic checks enforce the rest. `deny` rules
169
242
  beat `allow` rules. Trust approval covers project-provided hooks, MCP servers,
170
243
  and allow rules.
171
244
 
172
- Press **ctrl+q** to cycle through manual, accept-edits, plan, and auto modes.
245
+ Press **ctrl+q** (**alt+m** on Windows and WSL) to cycle through manual, accept-edits, plan, and auto modes.
173
246
  Plan mode lets the agent investigate and write a plan file before you approve
174
247
  implementation. Use `/permissions` to inspect rules and `/auto-mode` to
175
248
  configure the classifier.
@@ -226,8 +299,10 @@ troubleshooting, and a full reference.
226
299
  - **Web search:** set `BRAVE_SEARCH_API_KEY` or `TAVILY_API_KEY` on a provider
227
300
  without native search. With neither key, the fallback is Exa's rate-limited
228
301
  keyless endpoint, and One Code labels those results.
229
- - **Native Windows:** hooks and background shells assume `/bin/sh` for now. Use
230
- WSL until native Windows is verified.
302
+ - **Native Windows:** shells, hooks, and the PowerShell tool follow Claude
303
+ Code's behavior and pass on Windows CI runners, but a real Windows desktop
304
+ session hasn't been driven end to end yet. Expect rough edges around
305
+ drive-letter paths in permission rules; WSL remains the safest route.
231
306
 
232
307
  ## 🔧 Install from source
233
308
 
@@ -244,9 +319,12 @@ pi list
244
319
 
245
320
  ## 🧠 Learn the ideas behind it
246
321
 
247
- One Code is the practical companion to the Harness Engineering 101 series, which
248
- builds these ideas up from first principles: what a coding harness actually does,
249
- and why the good parts are model-independent.
322
+ One Code is the production-scale companion to
323
+ [Harness Engineering 101](https://isuruwijesiri.com/harness-engineering-101/),
324
+ a sixteen-chapter series that builds these ideas up from first principles: what
325
+ a coding harness actually does, why the good parts are model-independent, and
326
+ how a ~300-line toy agent grows into the patterns you see here. The series
327
+ points at this repository wherever it needs a grown-up example.
250
328
 
251
329
  ## 📄 License
252
330
 
@@ -35,6 +35,7 @@ If you've never run One Code, read these in order:
35
35
  | [Sessions and context](sessions-and-context.md) | What the model sees, memory, compaction, the cache, recaps, and resuming sessions. |
36
36
  | [Tasks and background work](tasks-and-background-work.md) | The task list, background shells, monitors, loops, and how results reach the model. |
37
37
  | [Check your setup with doctor](doctor.md) | The report, the checkup, model presets, and the `onecode doctor` command. |
38
+ | [Windows](windows.md) | Git Bash and the PowerShell tool, `PowerShell(...)` rules, hooks' `shell` field, paths, and what is verified on native Windows. |
38
39
  | [Differences from Claude Code](differences-from-claude-code.md) | What is different by design, what isn't provided, and known issues. |
39
40
  | [Troubleshooting](troubleshooting.md) | Symptoms, causes, and fixes. |
40
41
  | [Command and keyboard reference](reference.md) | Every command, shortcut, flag, environment variable, and file location. |
@@ -125,7 +125,7 @@ Set the subagent default with `/subagent`, or apply a preset with
125
125
  ## Permission settings
126
126
 
127
127
  `/permissions` shows the mode and rules, `/allow` adds a rule, and
128
- `/auto-mode setup` configures the classifier. **ctrl+q** cycles modes. To
128
+ `/auto-mode setup` configures the classifier. **ctrl+q** (**alt+m** on Windows and WSL) cycles modes. To
129
129
  start a session in a given mode:
130
130
 
131
131
  ```bash
@@ -144,7 +144,7 @@ be installed and on the `PATH` used to launch One Code.
144
144
 
145
145
  | Language | Server | Install |
146
146
  |---|---|---|
147
- | TypeScript, JavaScript | `typescript-language-server` | `npm install -g typescript-language-server typescript` |
147
+ | TypeScript, JavaScript | `typescript-language-server` | `npm install -g typescript-language-server`, plus `npm install -D typescript@5` in the project (the server reads the project's TypeScript and never a global one; TypeScript 7 no longer ships the `tsserver.js` it needs) |
148
148
  | Python | `pyright-langserver` | `npm install -g pyright` |
149
149
  | Go | `gopls` | `go install golang.org/x/tools/gopls@latest` |
150
150
  | Rust | `rust-analyzer` | `rustup component add rust-analyzer` |
@@ -28,7 +28,7 @@ so nothing surprises you.
28
28
  |---|---|---|
29
29
  | Models | Anthropic models. | Any provider pi supports, switchable mid-session, with a different model per role. |
30
30
  | Tool names on the wire | PascalCase (`Read`, `Bash`). | snake_case (`read`, `bash`); `Agent` and `SendMessage` keep their names. Claude Code names still work in rules and hook matchers. |
31
- | Permission-mode key | shift+tab. | ctrl+q. pi reserves shift+tab for the reasoning-effort dial. |
31
+ | Permission-mode key | shift+tab. | ctrl+q; alt+m on Windows and WSL. pi reserves shift+tab for the reasoning-effort dial and, on Windows, ctrl+q for queuing a follow-up. |
32
32
  | Task-list key | ctrl+t. | `/tasks show` and `/tasks hide`. pi reserves ctrl+t for thinking blocks. |
33
33
  | Deleting files in auto mode | The whole project directory is trusted. | A delete is approved only when git can recover the file; otherwise the classifier decides. |
34
34
  | Bypass mode | Protected paths stay protected. | Bypass mode bypasses everything, including protected paths. |
@@ -101,9 +101,18 @@ every model. The content is the same; only the placement differs.
101
101
 
102
102
  - **macOS and Linux** are developed and verified. **WSL** works the same
103
103
  way.
104
- - **Native Windows** is untested and unsupported. Hooks run through
105
- `/bin/sh`, background shells fall back to it when `SHELL` is unset, and
106
- no PowerShell tool exists. Use WSL.
104
+ - **Native Windows** follows Claude Code's shape: Git for Windows is
105
+ optional, PowerShell is the primary shell tool when it is enabled (on by
106
+ default on Windows, `CLAUDE_CODE_USE_POWERSHELL_TOOL=0` turns it off), and
107
+ your `PowerShell(...)` rules, `CLAUDE_CODE_GIT_BASH_PATH`, and per-hook
108
+ `shell` field work unchanged. The PowerShell tool's description is Claude
109
+ Code's own text. What differs: One Code has no PowerShell command parser
110
+ yet, so in auto mode every PowerShell command that isn't on Claude Code's
111
+ read-only cmdlet list goes to the classifier (Claude Code auto-approves
112
+ more in-project work), and the git-recoverability shortcut for in-project
113
+ deletes is bash-only. Verified on CI runners and through a `pwsh` on
114
+ macOS; a real Windows desktop has not been driven end to end yet. See
115
+ [Windows](windows.md).
107
116
 
108
117
  ## Provider notes
109
118
 
@@ -107,5 +107,17 @@ Set `CC_HOOKS_DEBUG=1` before launching to print each hook dispatch and its
107
107
  outcome to stderr. Decisions are also appended to
108
108
  `~/.onecode/hooks/hooks-decisions.jsonl` while the variable is set.
109
109
 
110
- Hooks run through `/bin/sh`. On native Windows this path doesn't exist,
111
- which is one reason native Windows is unsupported; use WSL.
110
+ ## Which shell runs a hook
111
+
112
+ Hooks run in bash, as in Claude Code: `/bin/bash` on macOS and Linux, Git
113
+ Bash on Windows (`CLAUDE_CODE_GIT_BASH_PATH` points at a different bash;
114
+ a value that isn't a bash or sh binary is ignored with a warning). A hook
115
+ can ask for PowerShell instead with Claude Code's `shell` field:
116
+
117
+ ```json
118
+ { "type": "command", "command": "Get-Content $env:TEMP\\hook.log", "shell": "powershell" }
119
+ ```
120
+
121
+ On a Windows machine without Git for Windows, hooks default to PowerShell.
122
+ Matchers accept `Bash|PowerShell` and `Bash,PowerShell` to cover both shell
123
+ tools. See [Windows](windows.md).
@@ -8,14 +8,17 @@ fits how you already work.
8
8
  | You | Install | What you get |
9
9
  |---|---|---|
10
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
+ | On Windows without Node.js | `powershell -c "irm https://raw.githubusercontent.com/IsuruMaduranga/one-code/master/install.ps1 \| iex"` | The bundled app, with Node.js fetched for you when the machine has none. See [Install on Windows](#install-on-windows). |
11
12
  | 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
 
13
14
  ## Requirements
14
15
 
15
16
  - Node.js 22.19 or later. The app refuses to start on older versions,
16
17
  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.
18
+ - macOS, Linux, or Windows. Windows Subsystem for Linux (WSL) works like
19
+ Linux. On native Windows, One Code takes Claude Code's shape: Git for
20
+ Windows is recommended but optional, and PowerShell is the primary shell
21
+ tool. See [Windows](windows.md) for what is verified and what isn't.
19
22
  - `git`. Optional: `rg` (ripgrep) for faster search, the GitHub CLI for the
20
23
  pull-request marker in the footer, and a language server for your
21
24
  language (see
@@ -38,6 +41,46 @@ The first run also seeds pi's settings under `~/.onecode/agent/` with the
38
41
  `onecode` theme, quiet startup, and full-screen mode. It never overrides a
39
42
  value you change later.
40
43
 
44
+ ## Install on Windows
45
+
46
+ Open Windows Terminal or PowerShell and run:
47
+
48
+ ```powershell
49
+ powershell -c "irm https://raw.githubusercontent.com/IsuruMaduranga/one-code/master/install.ps1 | iex"
50
+ ```
51
+
52
+ The script looks for Node.js 22.19 or later on your PATH. When there is
53
+ none, it downloads the current Node LTS for your CPU from nodejs.org as a
54
+ zip, checks it against nodejs.org's published checksums, unpacks it under
55
+ `%LOCALAPPDATA%\onecode\node`, and adds that folder to your user PATH.
56
+ Nothing is installed system-wide and no Windows installer runs. It then
57
+ runs `npm install -g @one-ai/one-code` and makes sure the `onecode` command
58
+ is on your PATH. Open a new terminal afterwards so it sees the PATH change.
59
+
60
+ The script also tells you when `git` is missing. One Code runs without it,
61
+ but Git for Windows gives you the branch in the footer, `/init`, worktrees,
62
+ and a bash tool for the model next to PowerShell. Install it with
63
+ `winget install --id Git.Git -e`, or set `ONECODE_INSTALL_GIT=1` before
64
+ running the script to have it do that for you.
65
+
66
+ If you already have Node.js 22.19 or later, the plain npm command works the
67
+ same on Windows as anywhere else:
68
+
69
+ ```powershell
70
+ npm install -g @one-ai/one-code
71
+ ```
72
+
73
+ The script's knobs are environment variables, because a piped script
74
+ cannot take parameters: `ONECODE_INSTALL_NODE=1` downloads the standalone
75
+ Node even when one exists, `ONECODE_NODE_VERSION` pins the version it
76
+ downloads, and `ONECODE_NO_PATH_UPDATE=1` leaves your PATH alone and prints
77
+ what to add. Read the script before running it if you like; it is the
78
+ `install.ps1` at the root of the repository.
79
+
80
+ Windows Subsystem for Linux (WSL) is Linux: use the npm or Homebrew route
81
+ inside the distribution. For what works on native Windows, see
82
+ [Windows](windows.md).
83
+
41
84
  ## Install with Homebrew
42
85
 
43
86
  Homebrew installs Node for you, so this route has no separate Node step:
@@ -59,7 +102,7 @@ pi install npm:one-code-extension
59
102
  ```
60
103
 
61
104
  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
105
+ extension is tested against pi 0.83 through 0.86 and warns at startup when
63
106
  your pi is outside that range. Full-screen mode is opt-in on your own pi;
64
107
  see [Full-screen mode and themes](configuration.md#full-screen-mode-and-themes).
65
108
 
@@ -102,7 +145,10 @@ npm install -g @one-ai/one-code # npm installs
102
145
  brew upgrade onecode # Homebrew installs
103
146
  ```
104
147
 
105
- Set `ONECODE_NO_UPDATE_CHECK=1` to skip the check; `--offline` skips it too.
148
+ A Homebrew install sees the notice a day after the npm release, because
149
+ Homebrew refuses packages younger than that and `brew upgrade` would find
150
+ nothing sooner. Set `ONECODE_NO_UPDATE_CHECK=1` to skip the check;
151
+ `--offline` skips it too.
106
152
  On your own pi, update with `pi update --extensions`.
107
153
 
108
154
  Both packages are released together with the same version number.
@@ -114,8 +160,10 @@ npm uninstall -g @one-ai/one-code # or: brew uninstall onecode
114
160
  rm -rf ~/.onecode # One Code's state, including pi's under the app
115
161
  ```
116
162
 
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
163
+ If the Windows script fetched Node.js for you, delete `%LOCALAPPDATA%\onecode`
164
+ too and remove that folder from your user PATH. On your own pi, run
165
+ `pi remove one-code-extension` (or remove the package entry from pi's
166
+ settings). Removing `~/.onecode` deletes One Code's
119
167
  settings, approvals, plan files, and, under the bundled app, pi's sessions
120
168
  and credentials. Memory files stay in `~/.claude/projects/`, because they
121
169
  are shared with Claude Code.
@@ -83,6 +83,18 @@ contains command substitution (`$(…)` or backticks), `eval`, `exec`, a pipe
83
83
  into an interpreter, or a base64 decode is never covered by a prefix or
84
84
  wildcard `allow` rule.
85
85
 
86
+ ### PowerShell rule patterns
87
+
88
+ `PowerShell(...)` rules have the same shape and follow Claude Code's
89
+ PowerShell matching: aliases are canonicalized on both sides
90
+ (`PowerShell(Remove-Item:*)` catches `rm`, `del`, and `ri`), cmdlet names
91
+ are case-insensitive, a line is split on `|`, `;`, `&&`, `||`, and newlines
92
+ outside quotes and here-strings, an `allow` rule must cover every statement,
93
+ and a `deny` or `ask` rule fires on any statement. A `$(…)` subexpression, a
94
+ backtick escape, a script block, the `&`/`.` call operators,
95
+ `Invoke-Expression`, or an encoded command keeps a wildcard `allow` from
96
+ applying. Details in [Windows](windows.md#permission-rules).
97
+
86
98
  ### Add a rule during a session
87
99
 
88
100
  To add an allow rule for the current repository, run:
@@ -120,10 +132,10 @@ stops risky ones, so you're not prompted for every step.
120
132
  The current badge appears in the banner and is announced when the mode
121
133
  changes.
122
134
 
123
- ### Cycle modes with ctrl+q
135
+ ### Cycle modes with ctrl+q (alt+m on Windows and WSL)
124
136
 
125
- Press **ctrl+q** to cycle through manual, accept edits, plan, and auto.
126
- Two modes join the cycle only under certain conditions:
137
+ Press **ctrl+q** to cycle through manual, accept edits, plan, and auto. On
138
+ Windows and WSL the key is **alt+m**. Two modes join the cycle only under certain conditions:
127
139
 
128
140
  - **Auto** appears only when a model that can run the classifier is
129
141
  available. With no provider connected, the cycle skips it.
@@ -134,8 +146,9 @@ flag or a settings file.
134
146
 
135
147
  Claude Code cycles modes with shift+tab. One Code can't use that key
136
148
  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.
149
+ pi's own default keybindings use ctrl+q to queue a follow-up message, so
150
+ One Code cycles modes with alt+m there instead. The footer badge and the
151
+ startup hints name whichever key applies on your machine.
139
152
 
140
153
  ### Choose the starting mode
141
154
 
@@ -216,7 +229,10 @@ Reads and edits are confined to the working directory by default:
216
229
  mode, and is denied in don't-ask mode.
217
230
  - Accept-edits mode approves edits only inside the working directory.
218
231
  - The harness's own session directories count as inside: the auto-memory
219
- folder, the session scratchpad, persisted tool output, and the plan file.
232
+ folder, the session scratchpad, persisted tool output, the plan file, and
233
+ this project's own session transcripts (with auto mode's decision log next
234
+ to them), which is what `/doctor` reads. Other projects' transcripts are
235
+ outside, as they are for Claude Code.
220
236
 
221
237
  Paths are compared after resolving symlinks, so a symlink inside the project
222
238
  that points outside it counts as outside.
@@ -287,7 +303,7 @@ code. Only read-only tools and edits to one plan file are available.
287
303
  `plan` agent, and then write the plan.
288
304
  - You can read and edit the plan file yourself while the model works.
289
305
 
290
- Enter plan mode by cycling to it with **ctrl+q**, by starting with
306
+ Enter plan mode by cycling to it with **ctrl+q** (**alt+m** on Windows and WSL), by starting with
291
307
  `--permission-mode plan`, or by asking the model to plan first (it can call
292
308
  `enter_plan_mode` itself).
293
309
 
@@ -49,7 +49,7 @@ that explains it.
49
49
  | `/loop status`, `/loop stop` | Report or end the loop. | |
50
50
  | `/tools-deferred` | List deferred tools and whether each is loaded. | [Tools](tools.md#eager-and-deferred-tools) |
51
51
  | `/init` | Have the model write a `CLAUDE.md` for the project. | [CLAUDE.md](bring-your-claude-code-setup.md#project-instructions-claudemd) |
52
- | `/clear` | Start a new session (pi's `/new`). | [Sessions](sessions-and-context.md#start-over) |
52
+ | `/clear` | Start a new session (pi's `/new`); the model is told. | [Sessions](sessions-and-context.md#start-over) |
53
53
  | `/exit` | Quit (pi's `/quit`). | |
54
54
 
55
55
  ### pi commands
@@ -85,7 +85,7 @@ These come from pi and are available in every One Code session.
85
85
 
86
86
  | Shortcut | What it does |
87
87
  |---|---|
88
- | **ctrl+q** | Cycle the permission mode: manual, accept edits, plan, auto. |
88
+ | **ctrl+q** (**alt+m** on Windows and WSL) | Cycle the permission mode: manual, accept edits, plan, auto. |
89
89
  | **↓** (empty editor) | Focus the panel below the editor: background shells, then subagents, then workflows. |
90
90
  | **ctrl+x** then **ctrl+k** | Stop every running agent (in the subagent panel). |
91
91
  | **x** | Stop the selected agent, shell, or workflow (in a panel). |
@@ -175,6 +175,7 @@ The `CC_` prefix is historical; `ONECODE_`-prefixed aliases are planned.
175
175
  | `CC_FOOTER=0` | Keep pi's footer instead of One Code's status line. |
176
176
  | `CC_TURN_DURATION=0` | Remove the post-turn timing line. |
177
177
  | `CC_RECAP=0` | Turn off the "while you were away" recap. |
178
+ | `CC_SESSION_TITLE=0` | Turn off the automatic session title. |
178
179
  | `CC_RECAP_IDLE_MS` | Idle time before a recap, in milliseconds (default 300000). |
179
180
  | `CC_COMPACTION=0` | Use pi's compaction summary instead of Claude Code's. |
180
181
  | `CC_CLEAR_THINKING=0`, `=1` | Force the thinking-preservation request off or on for Anthropic models. Default: on for `api.anthropic.com` only. |
@@ -194,6 +195,8 @@ The `CC_` prefix is historical; `ONECODE_`-prefixed aliases are planned.
194
195
  | `PI_CACHE_RETENTION` | pi's prompt-cache lifetime. One Code sets `long` for interactive sessions unless you set it yourself. |
195
196
  | `PI_OFFLINE=1` | Same as `--offline`. |
196
197
  | `CLAUDE_CONFIG_DIR` | Where Claude Code's user configuration is read from. |
198
+ | `CLAUDE_CODE_USE_POWERSHELL_TOOL` | `1` turns the `powershell` tool on (the default on Windows), `0` turns it off. Off Windows it needs a `pwsh` on PATH. See [Windows](windows.md). |
199
+ | `CLAUDE_CODE_GIT_BASH_PATH` | The bash that drives the `bash` tool, hooks, and background shells. Also read from the `env` block of `~/.claude/settings.json`; a non-bash binary is ignored with a warning. |
197
200
  | `CLAUDE_CODE_SUBAGENT_MODEL` | Default subagent model on a Claude session. |
198
201
  | `EDITOR`, `VISUAL` | Editor used by `/memory` (and pi's **ctrl+g**). |
199
202
  | `SHELL` | Shell used for commands (default `/bin/sh`). |
@@ -184,6 +184,24 @@ Not restored:
184
184
  `/new`. Running background tasks are stopped and listed. The permission
185
185
  mode you chose carries over.
186
186
 
187
+ ### What the model learns about your commands
188
+
189
+ As in Claude Code, a slash command you run is recorded for the model: the
190
+ next message you send carries a short note that the command ran, wrapped in a
191
+ caveat telling the model not to act on it. `/clear` opens the new session
192
+ with that note, and a model switch records "Set model to …" the way Claude
193
+ Code does. Commands that One Code cannot observe (pi's own `/compact`,
194
+ `/settings`, `/name`) leave no note.
195
+
196
+ ### The session title
197
+
198
+ After your first real message, One Code names the session the way Claude
199
+ Code does: a cheap model on your provider turns the message into a short
200
+ title (Claude Code's own naming prompt), which shows in the terminal tab as
201
+ `One Code - <title> - <folder>` and in the session picker. A name you set
202
+ with `/name` is never overwritten. The call's cost is included in the
203
+ footer's total. Set `CC_SESSION_TITLE=0` to turn it off.
204
+
187
205
  ## Turn timing
188
206
 
189
207
  After each turn, a dim line such as `✻ Cooked for 5m 12s` reports how long
@@ -16,7 +16,7 @@ hint line lists the keys worth knowing:
16
16
  |---|---|
17
17
  | `/hotkeys` | pi's full key list. |
18
18
  | `shift+tab` | Cycle reasoning effort. |
19
- | `ctrl+q` | Cycle the permission mode. |
19
+ | `ctrl+q` (`alt+m` on Windows and WSL) | Cycle the permission mode. |
20
20
  | `ctrl+t` | Show or hide thinking blocks. |
21
21
  | `ctrl+o` | Expand a collapsed tool output. |
22
22
  | `/` | List commands. |
@@ -53,6 +53,15 @@ notification. A background shell shows up in the shells section of the
53
53
  panel below the editor. See
54
54
  [Tasks and background work](tasks-and-background-work.md).
55
55
 
56
+ `powershell` is Claude Code's PowerShell tool: on by default on Windows,
57
+ where it becomes the primary shell and `bash` (Git Bash) stays alongside
58
+ when Git for Windows is installed; off elsewhere unless
59
+ `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` and a `pwsh` is on your PATH. It has the
60
+ same `run_in_background`, the same background panel, and its description is
61
+ Claude Code's own, with the edition section (PowerShell 7 or Windows
62
+ PowerShell 5.1) picked from the executable found. Permission rules use
63
+ Claude Code's `PowerShell(...)` form. See [Windows](windows.md).
64
+
56
65
  Some command shapes are refused before they run, with a message that steers
57
66
  the model to a better route:
58
67
 
@@ -140,10 +149,22 @@ and the model is steered to `tool_search`.
140
149
 
141
150
  In `-p` and `--mode json` runs the process exits when the turn settles, so
142
151
  nothing can run in the background. Tools that would detach work run to
143
- completion instead and return the output in their result: `bash` with
144
- `run_in_background`, `Agent`, `monitor`, and `workflow`. Timers such as
152
+ completion instead and return the output in their result: `bash` and
153
+ `powershell` with `run_in_background`, `Agent`, `monitor`, and `workflow`. Timers such as
145
154
  `schedule_wakeup` and `/loop` never fire in these modes.
146
155
 
156
+ Give a scripted run its own deadline. One Code has no idle timeout on a
157
+ provider response, so a stream that stalls mid-reply keeps the process
158
+ waiting indefinitely. Wrap the call in your script:
159
+
160
+ ```bash
161
+ timeout 180 onecode --mode json -p "…" </dev/null
162
+ ```
163
+
164
+ The `</dev/null` matters too: in `-p` mode piped standard input is read as
165
+ part of the prompt, so a run inside a shell script that reads its own body
166
+ from stdin would hand the rest of the script to the model.
167
+
147
168
  ## Claude Code tool names
148
169
 
149
170
  Claude Code's tool names are accepted in permission rules and hook
@@ -152,6 +173,7 @@ matchers, and mapped to One Code's names. Case is ignored.
152
173
  | Claude Code | One Code |
153
174
  |---|---|
154
175
  | `Bash` | `bash` |
176
+ | `PowerShell` | `powershell` |
155
177
  | `Read`, `Write`, `Edit` | `read`, `write`, `edit` |
156
178
  | `Grep`, `Glob`, `LS` | `grep`, `find`, `ls` |
157
179
  | `NotebookEdit` | `notebook_edit` |
@@ -46,12 +46,12 @@ on first run, so there's nothing to ask.
46
46
 
47
47
  ## Permissions
48
48
 
49
- **Auto mode is missing from the ctrl+q cycle.** Auto mode needs a model to
49
+ **Auto mode is missing from the mode cycle.** Auto mode needs a model to
50
50
  run its classifier. Connect a provider.
51
51
 
52
- **ctrl+q does something else.** On Windows and WSL, pi's default
53
- keybindings also bind ctrl+q, to queue a follow-up message. Rebind one of
54
- them in pi's keybindings file.
52
+ **ctrl+q queues a follow-up instead of changing the mode.** On Windows and
53
+ WSL that is pi's own binding for ctrl+q. The mode key there is alt+m; the
54
+ footer badge names it.
55
55
 
56
56
  **Everything prompts, even in auto mode.** Auto mode pauses after several
57
57
  blocked actions in a row and prompts you once; approving resumes it. Also
@@ -171,6 +171,16 @@ for its scrollback. Use the keys the panel's footer names (**Space** and
171
171
  `CC_FOOTER=0`, or the other toggles listed in
172
172
  [Environment variables](reference.md#environment-variables).
173
173
 
174
+ **On Windows the model has no shell tool, or the wrong one.** With Git for
175
+ Windows installed you get `bash` plus `powershell`; without it, `powershell`
176
+ alone. Set `CLAUDE_CODE_USE_POWERSHELL_TOOL=0` to hide the PowerShell tool
177
+ or `=1` to force it on (it also works on macOS and Linux with a `pwsh` on
178
+ PATH). A startup warning names a `CLAUDE_CODE_GIT_BASH_PATH` that was
179
+ ignored and why. If you report a Windows problem, include the shells on your
180
+ PATH (`where bash`, `where pwsh`, `where powershell`), the value of those two
181
+ variables, and whether the command came through `bash` or `powershell`.
182
+ See [Windows](windows.md).
183
+
174
184
  ## Getting help
175
185
 
176
186
  Report problems at the project's GitHub repository. Include the output of