one-code-extension 0.1.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +200 -172
- package/agents/explore.md +9 -6
- package/agents/general-purpose.md +1 -1
- package/agents/plan.md +6 -4
- package/docs/guide/README.md +52 -0
- package/docs/guide/bring-your-claude-code-setup.md +126 -0
- package/docs/guide/configuration.md +171 -0
- package/docs/guide/differences-from-claude-code.md +150 -0
- package/docs/guide/doctor.md +86 -0
- package/docs/guide/hooks.md +109 -0
- package/docs/guide/installation.md +124 -0
- package/docs/guide/permissions-modes-and-auto-mode.md +450 -0
- package/docs/guide/providers-and-models.md +194 -0
- package/docs/guide/reference.md +224 -0
- package/docs/guide/sessions-and-context.md +190 -0
- package/docs/guide/skills-plugins-and-mcp.md +176 -0
- package/docs/guide/subagents-and-workflows.md +193 -0
- package/docs/guide/tasks-and-background-work.md +111 -0
- package/docs/guide/terminal-interface.md +155 -0
- package/docs/guide/tools.md +175 -0
- package/docs/guide/troubleshooting.md +175 -0
- package/extensions/ask-user/index.ts +65 -71
- package/extensions/ask-user/questions.ts +15 -28
- package/extensions/ask-user/widget.ts +533 -0
- package/extensions/auto-mode/actions.ts +9 -26
- package/extensions/auto-mode/classifier-prompt.ts +127 -0
- package/extensions/auto-mode/classifier.ts +305 -227
- package/extensions/auto-mode/config.ts +279 -77
- package/extensions/auto-mode/defaults.ts +17 -60
- package/extensions/auto-mode/instructions.ts +2 -1
- package/extensions/auto-mode/model-picker.ts +53 -31
- package/extensions/auto-mode/model-select.ts +153 -82
- package/extensions/auto-mode/paths.ts +13 -1
- package/extensions/auto-mode/pause.ts +8 -0
- package/extensions/auto-mode/prompt.ts +205 -238
- package/extensions/auto-mode/recoverability.ts +229 -0
- package/extensions/auto-mode/rules.ts +92 -75
- package/extensions/auto-mode/safety-floor.ts +43 -12
- package/extensions/auto-mode/sensitive.ts +11 -0
- package/extensions/auto-mode/setup-run.ts +245 -0
- package/extensions/auto-mode/setup.ts +235 -0
- package/extensions/auto-mode/shell-analysis.ts +332 -26
- package/extensions/auto-mode/transcript.ts +102 -0
- package/extensions/background/index.ts +256 -43
- package/extensions/background/monitor-batch.ts +58 -0
- package/extensions/background/registry.ts +9 -0
- package/extensions/background/wakeup.ts +45 -0
- package/extensions/bash/background.ts +47 -22
- package/extensions/bash/guards.ts +229 -0
- package/extensions/bash/index.ts +81 -19
- package/extensions/branding/index.ts +44 -18
- package/extensions/branding/startup.ts +23 -8
- package/extensions/claude-compat/index.ts +17 -2
- package/extensions/claude-context/index.ts +41 -12
- package/extensions/clear/index.ts +27 -0
- package/extensions/compaction/fit.ts +121 -0
- package/extensions/compaction/index.ts +176 -71
- package/extensions/compaction/prompt.ts +21 -1
- package/extensions/context-budget/budget.ts +61 -0
- package/extensions/context-budget/index.ts +66 -0
- package/extensions/context-management/index.ts +40 -16
- package/extensions/doctor/build.ts +226 -0
- package/extensions/doctor/cli.ts +99 -0
- package/extensions/doctor/compat.ts +532 -0
- package/extensions/doctor/dependencies.ts +186 -0
- package/extensions/doctor/fix-prompt.ts +125 -0
- package/extensions/doctor/index.ts +308 -0
- package/extensions/doctor/models.ts +231 -0
- package/extensions/doctor/presets.ts +208 -0
- package/extensions/doctor/report.ts +189 -0
- package/extensions/doctor/update-lookup.ts +46 -0
- package/extensions/doctor/viewer.ts +124 -0
- package/extensions/effort/index.ts +41 -4
- package/extensions/effort/slider.ts +33 -2
- package/extensions/file-tracker/index.ts +143 -20
- package/extensions/file-tracker/replay.ts +46 -0
- package/extensions/file-tracker/tracker.ts +51 -4
- package/extensions/footer/footer-line.ts +207 -0
- package/extensions/footer/index.ts +152 -0
- package/extensions/footer/pr.ts +53 -0
- package/extensions/hooks/executor.ts +57 -20
- package/extensions/hooks/formatter-notice.ts +76 -0
- package/extensions/hooks/index.ts +314 -73
- package/extensions/hooks/matcher.ts +35 -1
- package/extensions/hooks/plugin-hooks.ts +3 -3
- package/extensions/hooks/protocol.ts +58 -0
- package/extensions/hooks/subagent-bridge.ts +77 -0
- package/extensions/hooks/trust.ts +15 -4
- package/extensions/init/index.ts +26 -0
- package/extensions/init/prompt.ts +40 -0
- package/extensions/interrupted/index.ts +35 -0
- package/extensions/interrupted/line.ts +9 -0
- package/extensions/lib/abort.ts +15 -0
- package/extensions/lib/agent-loader.ts +183 -0
- package/extensions/lib/anthropic-payload.ts +15 -0
- package/extensions/lib/atomic-write.ts +56 -0
- package/extensions/lib/bridge-watch.ts +20 -0
- package/extensions/lib/cache-retention.ts +60 -0
- package/extensions/lib/capability-index.ts +466 -0
- package/extensions/lib/claude-context.ts +318 -27
- package/extensions/lib/claude-settings.ts +64 -0
- package/extensions/lib/consent-preview.ts +30 -0
- package/extensions/lib/deferred.ts +144 -13
- package/extensions/lib/favorites.ts +43 -0
- package/extensions/lib/fetch-timeout.ts +15 -0
- package/extensions/lib/frontmatter.ts +31 -0
- package/extensions/lib/git.ts +44 -2
- package/extensions/lib/hook-gate.ts +90 -0
- package/extensions/lib/interrupt.ts +94 -0
- package/extensions/lib/mcp-overrides.ts +61 -0
- package/extensions/lib/mcp-share.ts +25 -0
- package/extensions/lib/mcp-status.ts +34 -0
- package/extensions/lib/memory.ts +41 -6
- package/extensions/lib/model-facts.generated.json +2480 -0
- package/extensions/lib/model-facts.ts +162 -0
- package/extensions/lib/model-policy.ts +145 -189
- package/extensions/lib/model-tier.ts +480 -64
- package/extensions/lib/model-unusable.ts +37 -0
- package/extensions/lib/notifications.ts +320 -1
- package/extensions/lib/one-code-settings.ts +63 -0
- package/extensions/lib/original-command.ts +71 -0
- package/extensions/lib/package-version.ts +31 -0
- package/extensions/lib/paths.ts +39 -4
- package/extensions/lib/permission-gate.ts +192 -0
- package/extensions/lib/persisted-output.ts +18 -0
- package/extensions/lib/pi-ai-estimate.ts +160 -0
- package/extensions/lib/pi-version.ts +1 -1
- package/extensions/lib/plan-mode-channels.ts +11 -0
- package/extensions/lib/plugin-overrides.ts +24 -0
- package/extensions/lib/plugin-root.ts +44 -0
- package/extensions/lib/plugins.ts +233 -54
- package/extensions/lib/prefix-warm-gate.ts +157 -0
- package/extensions/lib/process-tree.ts +56 -0
- package/extensions/lib/reminders.ts +321 -68
- package/extensions/lib/scratchpad.ts +11 -8
- package/extensions/lib/session-lifecycle.ts +28 -0
- package/extensions/lib/settings-channels.ts +14 -0
- package/extensions/lib/shell-tasks.ts +54 -0
- package/extensions/lib/skill-overrides.ts +86 -0
- package/extensions/lib/skill-scan.ts +110 -0
- package/extensions/lib/text-width.ts +267 -0
- package/extensions/lib/tui-render.ts +281 -54
- package/extensions/lib/usage-bus.ts +75 -0
- package/extensions/lib/usage-tracker.ts +67 -0
- package/extensions/lib/worktree-isolation.ts +170 -0
- package/extensions/lsp/client.ts +69 -12
- package/extensions/lsp/format.ts +12 -2
- package/extensions/lsp/index.ts +273 -84
- package/extensions/lsp/install-hints.ts +43 -0
- package/extensions/lsp/keep-alive.ts +19 -0
- package/extensions/lsp/plugin-servers.ts +331 -0
- package/extensions/lsp/watcher.ts +157 -0
- package/extensions/mcp/announce.ts +99 -0
- package/extensions/mcp/client.ts +181 -22
- package/extensions/mcp/config.ts +55 -24
- package/extensions/mcp/index.ts +586 -86
- package/extensions/mcp/oauth/browser.ts +26 -0
- package/extensions/mcp/oauth/callback.ts +104 -0
- package/extensions/mcp/oauth/flow.ts +68 -0
- package/extensions/mcp/oauth/provider.ts +147 -0
- package/extensions/mcp/oauth/store.ts +86 -0
- package/extensions/mcp/panel/keys.ts +34 -0
- package/extensions/mcp/panel/model.ts +62 -0
- package/extensions/mcp/panel/render.ts +141 -0
- package/extensions/mcp/panel/state.ts +108 -0
- package/extensions/mcp/schema.ts +83 -6
- package/extensions/mcp/trust.ts +340 -0
- package/extensions/memory/entries.ts +163 -0
- package/extensions/memory/index.ts +119 -2
- package/extensions/memory/open-external.ts +97 -0
- package/extensions/memory/panel.ts +124 -0
- package/extensions/model-default/index.ts +74 -0
- package/extensions/notebook/index.ts +36 -18
- package/extensions/notebook/notebook.ts +110 -17
- package/extensions/permissions/index.ts +1012 -247
- package/extensions/permissions/matcher.ts +488 -57
- package/extensions/permissions/modes.ts +55 -7
- package/extensions/permissions/project-trust.ts +81 -0
- package/extensions/permissions/protected-paths.ts +16 -3
- package/extensions/permissions/rule-prose.ts +79 -0
- package/extensions/permissions/session-grant.ts +91 -0
- package/extensions/permissions/settings.ts +112 -33
- package/extensions/permissions/subagent-gate.ts +57 -0
- package/extensions/plan-mode/index.ts +143 -33
- package/extensions/plan-mode/reminder.ts +16 -19
- package/extensions/plan-mode/viewer.ts +40 -31
- package/extensions/plugins/counts.ts +68 -0
- package/extensions/plugins/index.ts +496 -32
- package/extensions/plugins/install/install.ts +167 -0
- package/extensions/plugins/install/paths.ts +23 -0
- package/extensions/plugins/install/registry.ts +72 -0
- package/extensions/plugins/marketplace/git.ts +103 -0
- package/extensions/plugins/marketplace/official.ts +36 -0
- package/extensions/plugins/marketplace/parse.ts +94 -0
- package/extensions/plugins/marketplace/registry.ts +60 -0
- package/extensions/plugins/marketplace/sync.ts +146 -0
- package/extensions/plugins/marketplace/types.ts +128 -0
- package/extensions/plugins/panel/keys.ts +52 -0
- package/extensions/plugins/panel/render.ts +315 -0
- package/extensions/plugins/panel/rows.ts +230 -0
- package/extensions/plugins/panel/state.ts +333 -0
- package/extensions/recap/index.ts +215 -0
- package/extensions/recap/prompt.ts +44 -0
- package/extensions/recap/scheduler.ts +87 -0
- package/extensions/search-tools/index.ts +0 -0
- package/extensions/search-tools/tools.ts +7 -5
- package/extensions/skill/index.ts +360 -34
- package/extensions/skill/invoke.ts +185 -0
- package/extensions/skill/listing.ts +21 -0
- package/extensions/skill/panel/keys.ts +41 -0
- package/extensions/skill/panel/render.ts +91 -0
- package/extensions/skill/panel/state.ts +115 -0
- package/extensions/spinner/index.ts +110 -0
- package/extensions/spinner/line.ts +51 -0
- package/extensions/spinner/verbs.ts +201 -0
- package/extensions/subagents/agents.ts +88 -44
- package/extensions/subagents/default-model.ts +62 -32
- package/extensions/subagents/delegation-steer.ts +23 -0
- package/extensions/subagents/hand-back-review.ts +67 -0
- package/extensions/subagents/index.ts +1545 -346
- package/extensions/subagents/live-runs.ts +293 -0
- package/extensions/subagents/model-select.ts +252 -82
- package/extensions/subagents/outcome.ts +90 -0
- package/extensions/subagents/panel-keys.ts +41 -0
- package/extensions/subagents/panel-render.ts +357 -0
- package/extensions/subagents/panel-widget.ts +330 -0
- package/extensions/subagents/pending-claim.ts +45 -0
- package/extensions/subagents/prose.ts +105 -0
- package/extensions/subagents/runner.ts +674 -0
- package/extensions/subagents/runs.ts +68 -1
- package/extensions/subagents/send-to-main-tool.ts +55 -0
- package/extensions/subagents/session-turns.ts +138 -0
- package/extensions/subagents/shell-panel.ts +198 -0
- package/extensions/subagents/usage.ts +16 -4
- package/extensions/subagents/worktree.ts +13 -0
- package/extensions/system-prompt/environment.ts +5 -3
- package/extensions/system-prompt/git-status.ts +93 -0
- package/extensions/system-prompt/index.ts +23 -1
- package/extensions/system-prompt/template.ts +34 -4
- package/extensions/system-prompt/tiers/common.ts +31 -6
- package/extensions/system-prompt/tiers/low.ts +13 -3
- package/extensions/system-prompt/tiers/mid.ts +21 -8
- package/extensions/system-reminder/index.ts +53 -9
- package/extensions/tasks/index.ts +65 -16
- package/extensions/tasks/store.ts +76 -3
- package/extensions/tool-search/announce.ts +42 -0
- package/extensions/tool-search/index.ts +136 -13
- package/extensions/turn-duration/index.ts +60 -0
- package/extensions/turn-duration/line.ts +22 -0
- package/extensions/turn-duration/span.ts +41 -0
- package/extensions/turn-duration/verbs.ts +24 -0
- package/extensions/web/backends.ts +421 -0
- package/extensions/web/index.ts +178 -21
- package/extensions/web-fetch/index.ts +74 -18
- package/extensions/web-fetch/summarize.ts +1 -1
- package/extensions/workflow/agent-session.ts +182 -112
- package/extensions/workflow/globals.ts +129 -106
- package/extensions/workflow/index.ts +343 -28
- package/extensions/workflow/records.ts +118 -0
- package/extensions/workflow/run-manager.ts +80 -31
- package/extensions/workflow/saved-workflows.ts +2 -1
- package/extensions/workflow/script-worker.mjs +110 -0
- package/extensions/workflow/types.ts +74 -8
- package/extensions/workflow/viewer.ts +562 -0
- package/extensions/workflow/vm-runtime.ts +118 -22
- package/extensions/workflow/widget.ts +126 -18
- package/extensions/worktree/guards.ts +240 -0
- package/extensions/worktree/index.ts +30 -5
- package/extensions/worktree/rewrite.ts +32 -16
- package/package.json +20 -10
- package/skills/code-review/SKILL.md +165 -0
- package/skills/fewer-permission-prompts/SKILL.md +61 -0
- package/skills/security-review/SKILL.md +178 -0
- package/skills/simplify/SKILL.md +70 -0
- package/themes/{one-code-light.json → onecode-light.json} +6 -1
- package/themes/{one-code.json → onecode.json} +6 -1
- package/types/app.d.ts +8 -1
- package/types/community-packages.d.ts +45 -2
- package/docs/decisions/auto-mode.md +0 -526
- package/docs/decisions/branding.md +0 -127
- package/docs/decisions/code-review-remediation.md +0 -106
- package/docs/decisions/compaction.md +0 -140
- package/docs/decisions/distribution.md +0 -168
- package/docs/decisions/hooks.md +0 -64
- package/docs/decisions/lsp.md +0 -58
- package/docs/decisions/mcp.md +0 -104
- package/docs/decisions/memory-state.md +0 -170
- package/docs/decisions/model-policy.md +0 -126
- package/docs/decisions/modes.md +0 -178
- package/docs/decisions/skills-plugins.md +0 -56
- package/docs/decisions/subagents-workflows.md +0 -225
- package/docs/decisions/system-prompt.md +0 -98
- package/docs/decisions/tools.md +0 -407
- package/docs/decisions/tui.md +0 -202
- package/docs/decisions.md +0 -148
- package/extensions/subagents/child.ts +0 -414
- package/extensions/subagents/rpc-turns.ts +0 -123
- package/extensions/todo/index.ts +0 -133
- package/extensions/workflow/permission-gate.ts +0 -71
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Bring your Claude Code setup
|
|
2
|
+
|
|
3
|
+
One Code reads the same configuration files as Claude Code, so your
|
|
4
|
+
existing setup works without changes. There is no import step and nothing
|
|
5
|
+
to convert. Open a project that already has a `.claude/` directory, and One
|
|
6
|
+
Code picks up each of the following as it is.
|
|
7
|
+
|
|
8
|
+
## Project instructions: CLAUDE.md
|
|
9
|
+
|
|
10
|
+
One Code loads `CLAUDE.md` files and includes them in the model's context
|
|
11
|
+
exactly as Claude Code does: your global `~/.claude/CLAUDE.md`, then the
|
|
12
|
+
`CLAUDE.md` in every directory from the filesystem root down to the working
|
|
13
|
+
directory, plus any `CLAUDE.local.md` beside them for private instructions.
|
|
14
|
+
`@path` imports are expanded in place.
|
|
15
|
+
|
|
16
|
+
If a directory has no `CLAUDE.md`, One Code uses its `AGENTS.md` instead, so
|
|
17
|
+
a repository that standardized on `AGENTS.md` works too. A `CLAUDE.md` takes
|
|
18
|
+
precedence over an `AGENTS.md` in the same directory.
|
|
19
|
+
|
|
20
|
+
To give One Code instructions that Claude Code should not read, add an
|
|
21
|
+
`ONECODE.md`. See [ONECODE.md](sessions-and-context.md#onecodemd).
|
|
22
|
+
|
|
23
|
+
To generate a `CLAUDE.md` for a project that lacks one, run `/init`. It has
|
|
24
|
+
the model survey the project (build, test, and lint commands, layout,
|
|
25
|
+
existing AI-tool configuration), ask you about what the code cannot answer,
|
|
26
|
+
and write the file. It never overwrites an existing `CLAUDE.md` silently.
|
|
27
|
+
|
|
28
|
+
## Skills, commands, and agents
|
|
29
|
+
|
|
30
|
+
| Directory | Becomes |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `.claude/skills/`, `~/.claude/skills/`, `~/.agents/skills/` | Skills the model can call and you can run as `/<name>`. `/skills` manages them. |
|
|
33
|
+
| `.claude/commands/`, `~/.claude/commands/` | Slash commands with the same names, with `$ARGUMENTS` substitution. |
|
|
34
|
+
| `.claude/agents/`, `~/.claude/agents/` | Subagent definitions with their model, tools, and instructions. `/agents` lists them. |
|
|
35
|
+
| `.claude/workflows/`, `~/.claude/workflows/` | Saved `ultracode` workflow scripts. |
|
|
36
|
+
|
|
37
|
+
See [Skills, plugins, and MCP](skills-plugins-and-mcp.md) and
|
|
38
|
+
[Subagents and workflows](subagents-and-workflows.md).
|
|
39
|
+
|
|
40
|
+
## Plugins
|
|
41
|
+
|
|
42
|
+
Plugins installed under `~/.claude/plugins` are picked up, with their
|
|
43
|
+
agents, skills, commands, hooks, MCP servers, and language-server
|
|
44
|
+
configuration, each namespaced by plugin. The `enabledPlugins` key in your
|
|
45
|
+
settings files is honored. `/plugins` browses and installs more; anything
|
|
46
|
+
One Code installs goes to its own plugin directory. See
|
|
47
|
+
[Plugins](skills-plugins-and-mcp.md#plugins).
|
|
48
|
+
|
|
49
|
+
## MCP servers
|
|
50
|
+
|
|
51
|
+
Servers in `.mcp.json`, in `~/.claude.json`, and in
|
|
52
|
+
`.claude/settings.local.json` are connected at startup, after a one-time
|
|
53
|
+
approval for project servers. Only the `mcpServers` key of `~/.claude.json`
|
|
54
|
+
is read; the rest of that file is left alone. See
|
|
55
|
+
[MCP servers](skills-plugins-and-mcp.md#mcp-servers).
|
|
56
|
+
|
|
57
|
+
## Settings files
|
|
58
|
+
|
|
59
|
+
One Code reads these Claude Code files and never writes them:
|
|
60
|
+
|
|
61
|
+
| File | Scope |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `~/.claude/settings.json` | User |
|
|
64
|
+
| `.claude/settings.json` | Project |
|
|
65
|
+
| `.claude/settings.local.json` | Project, local |
|
|
66
|
+
| Managed settings (`/Library/Application Support/ClaudeCode/managed-settings.json` on macOS, the Linux equivalent elsewhere) | Organization |
|
|
67
|
+
| `~/.claude.json` | User, `mcpServers` only |
|
|
68
|
+
|
|
69
|
+
`CLAUDE_CONFIG_DIR` relocates the user-scope files, as it does in Claude
|
|
70
|
+
Code.
|
|
71
|
+
|
|
72
|
+
The keys One Code honors:
|
|
73
|
+
|
|
74
|
+
| Key | Scopes | Notes |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `permissions.allow`, `permissions.deny`, `permissions.ask` | All | Project allow rules need one-time approval. See [Permissions](permissions-modes-and-auto-mode.md#permission-rules). |
|
|
77
|
+
| `permissions.defaultMode` | All | A project file cannot select `auto` or `bypassPermissions`. |
|
|
78
|
+
| `permissions.disableBypassPermissionsMode` | All | `"disable"` refuses bypass mode from any source. |
|
|
79
|
+
| `autoMode.*` | User, managed | Never read from project files. See [Configure auto mode](permissions-modes-and-auto-mode.md#configure-auto-mode). |
|
|
80
|
+
| `hooks` | All | Project hooks need one-time approval. See [Hooks](hooks.md). |
|
|
81
|
+
| `env.CLAUDE_CODE_SUBAGENT_MODEL` | User, managed | The only `env` key read. |
|
|
82
|
+
| `enabledPlugins` | All | Later scope wins per plugin. |
|
|
83
|
+
| `enabledMcpjsonServers`, `disabledMcpjsonServers`, `enableAllProjectMcpServers` | User, untracked local | Never from a checked-in project file. |
|
|
84
|
+
| `mcpServers` | `~/.claude.json`, `.claude/settings.local.json` | |
|
|
85
|
+
|
|
86
|
+
Not honored: `permissions.additionalDirectories`, other `env` keys,
|
|
87
|
+
`includeCoAuthoredBy`, `apiKeyHelper`, `forceLoginMethod`,
|
|
88
|
+
`cleanupPeriodDays`, and `spinnerTipsEnabled`. Run `/doctor report` to see,
|
|
89
|
+
for every file found, which keys were used, ignored, or refused.
|
|
90
|
+
|
|
91
|
+
## Permission rules
|
|
92
|
+
|
|
93
|
+
The `allow`, `deny`, and `ask` rules in your settings drive the permission
|
|
94
|
+
gate, with `deny` always winning. Claude Code's PascalCase tool names
|
|
95
|
+
(`Read`, `Bash`, `Edit`, `Task`, `WebFetch`, and the rest) are accepted
|
|
96
|
+
verbatim and mapped to the matching tool. See
|
|
97
|
+
[Permissions, modes, and auto mode](permissions-modes-and-auto-mode.md).
|
|
98
|
+
|
|
99
|
+
## Hooks
|
|
100
|
+
|
|
101
|
+
Claude Code command hooks run unchanged, with the same standard-input JSON,
|
|
102
|
+
exit-code meaning, and output format. Eight events are supported. A
|
|
103
|
+
project's hooks run only after you approve them once. See [Hooks](hooks.md).
|
|
104
|
+
|
|
105
|
+
## Memory
|
|
106
|
+
|
|
107
|
+
One Code keeps per-repository memory in Claude Code's own folder,
|
|
108
|
+
`~/.claude/projects/<slug>/memory/`, so both tools read and write the same
|
|
109
|
+
memories. This is the one place One Code writes under `~/.claude`. Run
|
|
110
|
+
`/memory` to open memory and instruction files. See
|
|
111
|
+
[Memory](sessions-and-context.md#memory).
|
|
112
|
+
|
|
113
|
+
## What stays separate
|
|
114
|
+
|
|
115
|
+
One Code's own state lives in `~/.onecode`. Everything it saves (a chosen
|
|
116
|
+
subagent model, auto-mode options, rules added with `/allow`, disabled MCP
|
|
117
|
+
servers, project approvals, plan files, OAuth tokens) goes there or to a
|
|
118
|
+
per-repository file under it, never into your Claude Code configuration.
|
|
119
|
+
See [Where settings live](configuration.md#where-settings-live).
|
|
120
|
+
|
|
121
|
+
## What does not carry over
|
|
122
|
+
|
|
123
|
+
Features that need Claude Code's own hosted or desktop services are not
|
|
124
|
+
available. For the full list of tools, commands, and skills that are
|
|
125
|
+
missing or different, see
|
|
126
|
+
[Differences from Claude Code](differences-from-claude-code.md).
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Configure One Code
|
|
2
|
+
|
|
3
|
+
Use this page to find the right settings file, learn what One Code stores
|
|
4
|
+
and where, change the terminal appearance, and set up language-server
|
|
5
|
+
diagnostics. Provider keys are covered in
|
|
6
|
+
[Providers and models](providers-and-models.md); permission rules in
|
|
7
|
+
[Permissions, modes, and auto mode](permissions-modes-and-auto-mode.md).
|
|
8
|
+
|
|
9
|
+
## Where settings live
|
|
10
|
+
|
|
11
|
+
Three kinds of files are involved: pi's own settings (terminal, theme,
|
|
12
|
+
default model), One Code's settings, and Claude Code's settings, which One
|
|
13
|
+
Code reads but never writes.
|
|
14
|
+
|
|
15
|
+
| What you want to change | File |
|
|
16
|
+
|---|---|
|
|
17
|
+
| Theme, full-screen mode, and other pi settings, in the `onecode` app | `~/.onecode/agent/settings.json` |
|
|
18
|
+
| The same, on your own pi installation | `~/.pi/agent/settings.json` |
|
|
19
|
+
| One Code's user-wide settings: subagent model, auto-mode configuration, global allow rules, web-search keys, disabled MCP servers | `~/.onecode/settings.json` |
|
|
20
|
+
| One Code's per-repository settings: allow rules and disabled MCP servers for one repository | `~/.onecode/projects/<slug>/settings.json` |
|
|
21
|
+
| Claude Code user configuration that One Code reads | `~/.claude/settings.json` |
|
|
22
|
+
| Claude Code project configuration that One Code reads | `.claude/settings.json`, `.claude/settings.local.json` |
|
|
23
|
+
|
|
24
|
+
The per-repository slug is derived from the repository root, so worktrees
|
|
25
|
+
and subdirectories of one repository share one file.
|
|
26
|
+
|
|
27
|
+
Commands such as `/allow`, `/subagent`, `/auto-mode model`, and the
|
|
28
|
+
`/mcp` panel write to One Code's files. Both One Code files are written
|
|
29
|
+
atomically; a malformed file is reported rather than overwritten.
|
|
30
|
+
|
|
31
|
+
### Relocating directories
|
|
32
|
+
|
|
33
|
+
| Variable | Moves |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `ONECODE_STATE_DIR` | One Code's state (default `~/.onecode`). |
|
|
36
|
+
| `PI_CODING_AGENT_DIR` | pi's agent directory. The bundled app sets it to `~/.onecode/agent`. |
|
|
37
|
+
| `CLAUDE_CONFIG_DIR` | Where Claude Code's user configuration is read from (default `~/.claude`). |
|
|
38
|
+
|
|
39
|
+
Setting one does not move the others.
|
|
40
|
+
|
|
41
|
+
## What is stored under ~/.onecode
|
|
42
|
+
|
|
43
|
+
| Path | Contents |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `settings.json` | User-wide One Code settings. |
|
|
46
|
+
| `projects/<slug>/settings.json` | Per-repository settings. |
|
|
47
|
+
| `agent/` | pi's own state under the bundled app: credentials, model catalog, sessions, pi's settings, and One Code's plugin directory (`agent/plugins/`). |
|
|
48
|
+
| `plans/<name>.md` | Plan files from plan mode. |
|
|
49
|
+
| `hooks/project-approvals.json` | Which projects' hooks you approved. |
|
|
50
|
+
| `mcp/project-approvals.json` | Which projects' MCP servers you approved. |
|
|
51
|
+
| `permissions/project-allow-approvals.json` | Which projects' allow rules you trusted. |
|
|
52
|
+
| `mcp-auth/<server>.json` | OAuth tokens for MCP servers, owner-readable only. |
|
|
53
|
+
| `cache/artificial-analysis.json` | The cached model-capability snapshot, when a key is set. |
|
|
54
|
+
| `hooks/hooks-decisions.jsonl` | A hook decision log, written only while `CC_HOOKS_DEBUG` is set. |
|
|
55
|
+
|
|
56
|
+
The bundled app also keeps a timestamp of its last update check at
|
|
57
|
+
`agent/last-update-check`.
|
|
58
|
+
|
|
59
|
+
## Settings reference
|
|
60
|
+
|
|
61
|
+
Keys in `~/.onecode/settings.json`. Keys marked "per repository" may also
|
|
62
|
+
appear in `projects/<slug>/settings.json`.
|
|
63
|
+
|
|
64
|
+
| Key | Type | Set by | Effect |
|
|
65
|
+
|---|---|---|---|
|
|
66
|
+
| `subagentModel` | string | `/subagent` | Default model for subagents and workflow agents: `provider/model-id`, a short alias, or `inherit`. |
|
|
67
|
+
| `permissions.allow` | string array | `/allow` (per repository) or `/allow … global` | Allow rules in Claude Code's format. |
|
|
68
|
+
| `autoMode.environment` | string array | `/auto-mode setup` | Describes your environment to the classifier. |
|
|
69
|
+
| `autoMode.hard_deny`, `autoMode.soft_deny`, `autoMode.allow` | string array | `/auto-mode setup` | Extra classifier rules, appended to the built-ins. |
|
|
70
|
+
| `autoMode.classifierModel` | string | `/auto-mode model` | The classifier model. |
|
|
71
|
+
| `autoMode.classifyAllShell` | boolean | By hand | Send every shell command to the classifier. |
|
|
72
|
+
| `autoMode.logDecisions` | boolean | By hand | Log every gate decision next to the session files. |
|
|
73
|
+
| `webSearch.apiKeys.brave`, `webSearch.apiKeys.tavily` | string | By hand | Search keys when the environment variables are not set. |
|
|
74
|
+
| `webSearch.order` | string array | By hand | Order of the fallback search backends: `brave`, `tavily`, `exa-free`. |
|
|
75
|
+
| `capabilityIndex.artificialAnalysisApiKey` | string | By hand | Artificial Analysis key for measured model selection. |
|
|
76
|
+
| `disabledMcpServers` | string array | `/mcp` (user or per repository) | MCP servers kept disabled. |
|
|
77
|
+
|
|
78
|
+
Two keys are stamped alongside model choices (`subagentModelSetFor`,
|
|
79
|
+
`autoMode.classifierModelSetFor`) to record the provider a choice was made
|
|
80
|
+
on; leave them alone.
|
|
81
|
+
|
|
82
|
+
The main model chosen with `/model` is saved in pi's own settings file as
|
|
83
|
+
`defaultProvider` and `defaultModel`, not in One Code's.
|
|
84
|
+
|
|
85
|
+
## Full-screen mode and themes
|
|
86
|
+
|
|
87
|
+
The bundled app starts in full-screen mode with the `onecode` theme and
|
|
88
|
+
quiet startup. It sets these on first run in pi's settings and never
|
|
89
|
+
overrides a value you change later.
|
|
90
|
+
|
|
91
|
+
On your own pi, to use full-screen mode for one session:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pi --tui-mode fullscreen
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
For a persistent setting, merge these keys into pi's settings file (the
|
|
98
|
+
first two rows of the table under [Where settings live](#where-settings-live)),
|
|
99
|
+
preserving its other keys such as `packages`:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"tuiMode": "fullscreen",
|
|
104
|
+
"theme": "onecode",
|
|
105
|
+
"quietStartup": true
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Use `"theme": "onecode-light"` for the light theme. Full-screen mode uses
|
|
110
|
+
the terminal's alternate screen and restores your terminal on exit.
|
|
111
|
+
|
|
112
|
+
One Code also works with other pi extensions, themes, and settings; see pi's
|
|
113
|
+
own documentation for those.
|
|
114
|
+
|
|
115
|
+
## Main and subagent models
|
|
116
|
+
|
|
117
|
+
Connect providers with `/login` and choose the main model with `/model`.
|
|
118
|
+
Set the subagent default with `/subagent`, or apply a preset with
|
|
119
|
+
`/doctor preset <economical|balanced|quality>`. See
|
|
120
|
+
[Providers and models](providers-and-models.md) and
|
|
121
|
+
[Choose the subagent model](subagents-and-workflows.md#choose-the-subagent-model).
|
|
122
|
+
|
|
123
|
+
## Permission settings
|
|
124
|
+
|
|
125
|
+
`/permissions` shows the mode and rules, `/allow` adds a rule, and
|
|
126
|
+
`/auto-mode setup` configures the classifier. **ctrl+q** cycles modes. To
|
|
127
|
+
start a session in a given mode:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
onecode --permission-mode plan
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
A persistent default goes in a Claude Code settings file, not in
|
|
134
|
+
`~/.onecode/settings.json`. See
|
|
135
|
+
[Choose the starting mode](permissions-modes-and-auto-mode.md#choose-the-starting-mode).
|
|
136
|
+
|
|
137
|
+
## Language-server diagnostics
|
|
138
|
+
|
|
139
|
+
One Code runs a language server for each language it detects in the
|
|
140
|
+
project and reports diagnostics to the model after edits. The server must
|
|
141
|
+
be installed and on the `PATH` used to launch One Code.
|
|
142
|
+
|
|
143
|
+
| Language | Server | Install |
|
|
144
|
+
|---|---|---|
|
|
145
|
+
| TypeScript, JavaScript | `typescript-language-server` | `npm install -g typescript-language-server typescript` |
|
|
146
|
+
| Python | `pyright-langserver` | `npm install -g pyright` |
|
|
147
|
+
| Go | `gopls` | `go install golang.org/x/tools/gopls@latest` |
|
|
148
|
+
| Rust | `rust-analyzer` | `rustup component add rust-analyzer` |
|
|
149
|
+
| Java | `jdtls` | `brew install jdtls` |
|
|
150
|
+
|
|
151
|
+
A server is started for a language the first time the model touches one of
|
|
152
|
+
its files, from the nearest directory that has a project marker such as
|
|
153
|
+
`package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, or `pom.xml`. A
|
|
154
|
+
server that crashes is restarted twice, then disabled for the session.
|
|
155
|
+
|
|
156
|
+
If the project's TypeScript installation lacks `lib/tsserver.js`
|
|
157
|
+
(TypeScript 7's native compiler), the server cannot start; One Code
|
|
158
|
+
reports this. Install a TypeScript 5.x development dependency in that
|
|
159
|
+
project.
|
|
160
|
+
|
|
161
|
+
Plugins can add servers through a `.lsp.json` file. A plugin's server takes
|
|
162
|
+
precedence over the built-in table for the file extensions it claims.
|
|
163
|
+
|
|
164
|
+
Run `/lsp` to see each server's status and diagnostic count, start
|
|
165
|
+
failures, and plugin configuration problems. `/doctor report` lists the
|
|
166
|
+
servers your project needs and whether they are installed.
|
|
167
|
+
|
|
168
|
+
## Environment variables
|
|
169
|
+
|
|
170
|
+
Every toggle is listed in the
|
|
171
|
+
[environment-variable reference](reference.md#environment-variables).
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Differences from Claude Code
|
|
2
|
+
|
|
3
|
+
One Code recreates Claude Code's workflow on the pi agent harness with your
|
|
4
|
+
choice of model. Most of what you know carries over. This page lists what
|
|
5
|
+
is deliberately different, what is not provided, and the known limitations,
|
|
6
|
+
so nothing surprises you.
|
|
7
|
+
|
|
8
|
+
## What is the same
|
|
9
|
+
|
|
10
|
+
- Your `CLAUDE.md`, skills, commands, agents, plugins, hooks, permission
|
|
11
|
+
rules, and MCP configuration are read from the same files, in the same
|
|
12
|
+
formats. See [Bring your Claude Code setup](bring-your-claude-code-setup.md).
|
|
13
|
+
- The system prompt, the context block, the compaction instruction, the
|
|
14
|
+
auto-mode classifier ruleset, and the recap prompt are Claude Code's own,
|
|
15
|
+
adapted where a provider requires it.
|
|
16
|
+
- Memory lives in Claude Code's own folder, so both tools share it.
|
|
17
|
+
- Auto mode is the default permission mode, with Claude Code's two-stage
|
|
18
|
+
classifier.
|
|
19
|
+
- Subagents, forks, worktree isolation, plan mode, structured tasks,
|
|
20
|
+
background shells, and `ultracode` workflows behave as they do in Claude
|
|
21
|
+
Code.
|
|
22
|
+
|
|
23
|
+
## What is different by design
|
|
24
|
+
|
|
25
|
+
| Area | Claude Code | One Code |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| Models | Anthropic models. | Any provider pi supports, switchable mid-session, with a different model per role. |
|
|
28
|
+
| 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. |
|
|
29
|
+
| Permission-mode key | shift+tab. | ctrl+q. pi reserves shift+tab for the reasoning-effort dial. |
|
|
30
|
+
| Task-list key | ctrl+t. | `/tasks show` and `/tasks hide`. pi reserves ctrl+t for thinking blocks. |
|
|
31
|
+
| 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. |
|
|
32
|
+
| Bypass mode | Protected paths stay protected. | Bypass mode bypasses everything, including protected paths. |
|
|
33
|
+
| First-run consent for auto mode | Asked once. | Not asked. Auto mode is on from the first session. |
|
|
34
|
+
| OS sandbox | Paired with auto mode. | None. Run One Code in a container for OS-level isolation. |
|
|
35
|
+
| Cost display | Main conversation. | All-in: subagents, classifier, reader, and recap calls included. |
|
|
36
|
+
| Web search | Anthropic's search. | The provider's own search when it has one, else Brave, Tavily, or a keyless fallback. |
|
|
37
|
+
| Reasoning effort | Fixed per model. | A slider from `off` to `max`, plus `ultracode`. |
|
|
38
|
+
| Session storage | `~/.claude`. | `~/.onecode` for One Code's state and the bundled app's pi state. `~/.claude` is read-only except for memory. |
|
|
39
|
+
| Update command | `/upgrade`. | A daily check that shows an install-aware upgrade hint. |
|
|
40
|
+
| Config editing | `/config`, `/hooks`, `/statusline`. | Settings files, plus `/doctor` to see what is in effect. |
|
|
41
|
+
|
|
42
|
+
## Tools that are not provided
|
|
43
|
+
|
|
44
|
+
These Claude Code tools depend on Anthropic-hosted or desktop services and
|
|
45
|
+
have no equivalent here: `Artifact`, `ReportFindings`,
|
|
46
|
+
`ShareOnboardingGuide`, `PushNotification`, `RemoteTrigger`, `DesignSync`,
|
|
47
|
+
`CronCreate`, `CronList`, `CronDelete`, `EndConversation`, and
|
|
48
|
+
`SendFeedback`. Scheduling within a session is available through `/loop`
|
|
49
|
+
and `schedule_wakeup`; scheduled cloud sessions are not.
|
|
50
|
+
|
|
51
|
+
The `Agent` tool's remote isolation option is not implemented.
|
|
52
|
+
|
|
53
|
+
## Commands that are not provided
|
|
54
|
+
|
|
55
|
+
Claude Code commands with no One Code or pi counterpart: `/cost` (the
|
|
56
|
+
footer shows cost instead), `/status`, `/vim`, `/terminal-setup`, `/bug`,
|
|
57
|
+
`/help`, `/rewind`, `/add-dir`, `/hooks`, `/ide`, `/install-github-app`,
|
|
58
|
+
`/statusline`, `/privacy-settings`, and `/upgrade`. pi's `/changelog` and
|
|
59
|
+
`/settings` cover part of `/release-notes` and `/config`. `/review` is
|
|
60
|
+
available through the `commit-commands` plugin when installed.
|
|
61
|
+
|
|
62
|
+
## Skills that are not bundled
|
|
63
|
+
|
|
64
|
+
One Code bundles four of Claude Code's built-in skills: `simplify`,
|
|
65
|
+
`code-review`, `security-review`, and `fewer-permission-prompts`. It does
|
|
66
|
+
not bundle the skills that need Claude Code's hosted or desktop surfaces
|
|
67
|
+
(`design`, `dataviz`, the `artifact-*` guides, and the publishers), the
|
|
68
|
+
account and desktop skills (`update-config`, `keybindings-help`,
|
|
69
|
+
`claude-in-chrome`, `debug`, `usage`, `schedule`, `batch`,
|
|
70
|
+
`claude-code-guide`), the run-skill generators, or the `claude-api`
|
|
71
|
+
reference. See
|
|
72
|
+
[Skills not bundled](skills-plugins-and-mcp.md#skills-not-bundled).
|
|
73
|
+
|
|
74
|
+
## Hooks
|
|
75
|
+
|
|
76
|
+
Eight events are supported: `PreToolUse`, `PostToolUse`,
|
|
77
|
+
`UserPromptSubmit`, `Stop`, `SessionStart`, `SessionEnd`, `PreCompact`, and
|
|
78
|
+
`PostCompact`. `Notification`, `SubagentStop`, and `PermissionRequest` are
|
|
79
|
+
not. Hook types other than `command` are skipped. A hook can block an
|
|
80
|
+
action but never pre-approve one. See [Hooks](hooks.md).
|
|
81
|
+
|
|
82
|
+
## Settings keys that are ignored
|
|
83
|
+
|
|
84
|
+
`permissions.additionalDirectories` is not honored. The `env` block is read
|
|
85
|
+
only for `CLAUDE_CODE_SUBAGENT_MODEL`, and only from user and managed
|
|
86
|
+
scope. `includeCoAuthoredBy`, `apiKeyHelper`, `forceLoginMethod`,
|
|
87
|
+
`cleanupPeriodDays`, and `spinnerTipsEnabled` are not read. Run
|
|
88
|
+
`/doctor report` to see, per file, which keys were used, ignored, or
|
|
89
|
+
refused.
|
|
90
|
+
|
|
91
|
+
## Prompt layout on Anthropic models
|
|
92
|
+
|
|
93
|
+
Claude Code delivers part of its reminder stack to Opus and Sonnet as a
|
|
94
|
+
system-role message after the first user message. pi's message model cannot
|
|
95
|
+
express that, so One Code uses the layout Claude Code uses for Haiku on
|
|
96
|
+
every model. The content is the same; only the placement differs.
|
|
97
|
+
|
|
98
|
+
## Platform support
|
|
99
|
+
|
|
100
|
+
- **macOS and Linux** are developed and verified. **WSL** works the same
|
|
101
|
+
way.
|
|
102
|
+
- **Native Windows** is untested and unsupported. Hooks run through
|
|
103
|
+
`/bin/sh`, background shells fall back to it when `SHELL` is unset, and
|
|
104
|
+
no PowerShell tool exists. Use WSL.
|
|
105
|
+
|
|
106
|
+
## Provider notes
|
|
107
|
+
|
|
108
|
+
- End-to-end verification has focused on Anthropic, OpenAI, and OpenRouter.
|
|
109
|
+
Other providers are less exercised.
|
|
110
|
+
- Some models reject options that others accept. One Code sends minimal
|
|
111
|
+
options to its side calls (classifier, recap, reader) for this reason. A
|
|
112
|
+
provider incompatibility in a side call fails closed: a classifier that
|
|
113
|
+
cannot answer blocks the action.
|
|
114
|
+
- Prompt-cache lifetime and pricing are the provider's. The extended
|
|
115
|
+
one-hour cache applies to Anthropic; other providers use their own
|
|
116
|
+
values.
|
|
117
|
+
|
|
118
|
+
## Known issues
|
|
119
|
+
|
|
120
|
+
- A write or edit tool can reach a file that only a `Bash` deny rule
|
|
121
|
+
protects, because in-project writes take the deterministic fast path in
|
|
122
|
+
auto mode and are not classified. Write `deny` rules for the write tools
|
|
123
|
+
as well. This is documented and accepted rather than fixed.
|
|
124
|
+
- GLM-5.3 and GLM-5.3 Flash, used as the classifier, approve a request to
|
|
125
|
+
back up the project to an unnamed outside location that the ruleset says
|
|
126
|
+
to block.
|
|
127
|
+
- Running a skill in a one-shot run (`-p '/simplify'`) delivers the skill
|
|
128
|
+
but starts no model turn, so the process exits without doing anything.
|
|
129
|
+
Interactive sessions are unaffected.
|
|
130
|
+
- The reasoning effort set with `/effort` does not persist across
|
|
131
|
+
restarts; the model chosen with `/model` does. To save a level, open
|
|
132
|
+
pi's `/thinking` picker and press **ctrl+s**, or pass `--thinking`.
|
|
133
|
+
- A subagent spawn that is blocked before it starts can leave its requested
|
|
134
|
+
run name reserved; a retry with the same name is renamed automatically.
|
|
135
|
+
- Under pi's RPC transport, `SessionStart` hooks fire twice per `/clear`.
|
|
136
|
+
- A background subagent started before `/clear` can report its cost into
|
|
137
|
+
the new session's footer total.
|
|
138
|
+
- `/lsp` diagnostics from a subagent's edits surface in the parent's
|
|
139
|
+
context, not the subagent's. This matches Claude Code.
|
|
140
|
+
- Subagents run in-process. A subagent that stops responding is stopped
|
|
141
|
+
after 30 minutes, and an out-of-memory condition affects the whole
|
|
142
|
+
process.
|
|
143
|
+
- MCP servers that use server-sent events (`type: "sse"`) are untested.
|
|
144
|
+
Stdio and HTTP transports are verified. The OAuth flow is implemented but
|
|
145
|
+
has had limited live testing.
|
|
146
|
+
- Plugin marketplaces support git and local sources only; npm and pip
|
|
147
|
+
sources, version pinning, dependency resolution, and enterprise
|
|
148
|
+
blocklists are not implemented.
|
|
149
|
+
|
|
150
|
+
Open work is tracked in the project's issue tracker on GitHub.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Check your setup with doctor
|
|
2
|
+
|
|
3
|
+
`/doctor` is One Code's health check, modelled on Claude Code's. It measures
|
|
4
|
+
your setup, reports what a session will use, and can have the model repair
|
|
5
|
+
the findings.
|
|
6
|
+
|
|
7
|
+
## The three forms
|
|
8
|
+
|
|
9
|
+
| Command | What it does |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `/doctor` | The checkup. One Code builds the report and hands it to the model, which reviews the findings and proposes or applies fixes. With no model available, it falls back to showing the report. |
|
|
12
|
+
| `/doctor report` | The report alone, in a scrollable panel, with no model call. Includes a network check for a newer version. |
|
|
13
|
+
| `onecode doctor` | The report from the shell, without starting a session. Bundled app only. |
|
|
14
|
+
|
|
15
|
+
`/doctor presets` and `/doctor preset <name>` are described in
|
|
16
|
+
[Model presets](#model-presets).
|
|
17
|
+
|
|
18
|
+
## What the report contains
|
|
19
|
+
|
|
20
|
+
1. **Installation.** Whether you run the bundled app or the extension on
|
|
21
|
+
your own pi, the pi version and whether it is in the tested range, the
|
|
22
|
+
Node version and platform, pi's agent directory, One Code's state
|
|
23
|
+
directory, where Claude Code configuration is read from, and whether a
|
|
24
|
+
newer One Code is available.
|
|
25
|
+
2. **Providers.** Each provider with credentials, how many models it
|
|
26
|
+
offers, and where the credential came from. An error when none is
|
|
27
|
+
ready, with the free options named.
|
|
28
|
+
3. **Models.** The main model with its price and context window, the
|
|
29
|
+
prompt tier it gets, the reasoning effort, the subagent model and how it
|
|
30
|
+
was chosen, the auto-mode classifier model, the reader model used by
|
|
31
|
+
web fetch and recaps, capability verdicts for each role when an
|
|
32
|
+
Artificial Analysis key is set, and the permission mode.
|
|
33
|
+
4. **Presets.** The three model presets for your provider and the model
|
|
34
|
+
each role would get under each.
|
|
35
|
+
5. **Imported configuration.** Every settings file found, with the keys One
|
|
36
|
+
Code uses, ignores, and refuses; the instruction files in context with
|
|
37
|
+
their sizes; the memory folder; agents, skills, and commands by origin;
|
|
38
|
+
plugins; and hooks.
|
|
39
|
+
6. **MCP servers.** Each configured server, its source, and its connection
|
|
40
|
+
status.
|
|
41
|
+
7. **Dependencies.** `git` (required), `rg` (optional), the language
|
|
42
|
+
servers for the languages detected in the project, the commands MCP
|
|
43
|
+
servers need, and the route web search would take. Missing programs
|
|
44
|
+
come with install hints.
|
|
45
|
+
|
|
46
|
+
Findings are listed first, errors before warnings, each with a suggested
|
|
47
|
+
fix. The report is "ready" when at least one provider works, a model is
|
|
48
|
+
selected, and there are no errors.
|
|
49
|
+
|
|
50
|
+
In the panel, press **f** to run the checkup on the report you are reading.
|
|
51
|
+
|
|
52
|
+
## Model presets
|
|
53
|
+
|
|
54
|
+
A preset sets the main model, the subagent model, and the classifier model
|
|
55
|
+
together, from the provider you are connected to. Only current-generation,
|
|
56
|
+
priced models that support tool calls are considered.
|
|
57
|
+
|
|
58
|
+
| Preset | Main model | Subagents | Classifier |
|
|
59
|
+
|---|---|---|---|
|
|
60
|
+
| `economical` | The cheapest small model. | Inherit the main model. | Automatic. |
|
|
61
|
+
| `balanced` | The cheapest Sonnet-class model. | Chosen automatically (a cheaper Sonnet-class model when one exists, else the main model). | Automatic. |
|
|
62
|
+
| `quality` | The most capable model available. | Inherit the main model. | Automatic. |
|
|
63
|
+
|
|
64
|
+
`/doctor presets` shows what each preset would pick. `/doctor preset balanced`
|
|
65
|
+
applies one; the aliases `economy`, `cheap`, `balance`, `max`, `maximum`,
|
|
66
|
+
and `best` also work. Applying a preset writes the subagent and classifier
|
|
67
|
+
choices to `~/.onecode/settings.json` and remembers the main model as pi's
|
|
68
|
+
default. Undo any part with `/model`, `/subagent clear`, or
|
|
69
|
+
`/auto-mode model clear`.
|
|
70
|
+
|
|
71
|
+
## The command-line form
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
onecode doctor
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This prints the same report as text. It exits with:
|
|
78
|
+
|
|
79
|
+
| Code | Meaning |
|
|
80
|
+
|---|---|
|
|
81
|
+
| 0 | No errors. |
|
|
82
|
+
| 1 | At least one error-level finding, such as no provider ready. |
|
|
83
|
+
| 2 | The doctor itself failed to run. |
|
|
84
|
+
|
|
85
|
+
Because it registers the extension package in the isolated agent directory
|
|
86
|
+
before reporting, the result matches what a real session would see.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Hooks
|
|
2
|
+
|
|
3
|
+
Hooks are shell commands that run at fixed points in a session. One Code
|
|
4
|
+
runs Claude Code's command hooks from your existing settings files, with
|
|
5
|
+
the same input, output, and exit-code contract, so hooks you wrote for
|
|
6
|
+
Claude Code work unchanged.
|
|
7
|
+
|
|
8
|
+
## Where hooks come from
|
|
9
|
+
|
|
10
|
+
Hooks are read from the `hooks` block of these files:
|
|
11
|
+
|
|
12
|
+
- `~/.claude/settings.json` (user scope)
|
|
13
|
+
- Managed settings
|
|
14
|
+
- `.claude/settings.json` (project scope)
|
|
15
|
+
- `.claude/settings.local.json` (project scope)
|
|
16
|
+
- Installed plugins
|
|
17
|
+
|
|
18
|
+
A project's hooks can run arbitrary code, so they run only after you
|
|
19
|
+
approve them once. At startup One Code lists each command from the
|
|
20
|
+
project's files and asks "Run this project's hooks?". The approval is
|
|
21
|
+
stored in `~/.onecode/hooks/project-approvals.json` with a hash of the hook
|
|
22
|
+
configuration, so any change asks again. Declining is remembered for the
|
|
23
|
+
session only. User, managed, and plugin hooks never prompt.
|
|
24
|
+
|
|
25
|
+
Only command hooks are supported. Hook entries of type `http`, `prompt`, or
|
|
26
|
+
`agent` are skipped with a diagnostic.
|
|
27
|
+
|
|
28
|
+
## Supported events
|
|
29
|
+
|
|
30
|
+
| Event | When it runs |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `PreToolUse` | Before a tool runs. Can block the call or rewrite its input. |
|
|
33
|
+
| `PostToolUse` | After a tool returns. Can replace the result or add context. |
|
|
34
|
+
| `UserPromptSubmit` | When you submit a prompt. Can block it or add context. |
|
|
35
|
+
| `Stop` | When the model finishes a turn. |
|
|
36
|
+
| `SessionStart` | When a session starts, resumes, clears, or compacts. |
|
|
37
|
+
| `SessionEnd` | When a session ends. |
|
|
38
|
+
| `PreCompact` | Before context compaction. |
|
|
39
|
+
| `PostCompact` | After context compaction, with the summary. |
|
|
40
|
+
|
|
41
|
+
Claude Code's `Notification`, `SubagentStop`, and `PermissionRequest`
|
|
42
|
+
events are not supported. pi has no event that carries the notification
|
|
43
|
+
concept, and the other two are not implemented.
|
|
44
|
+
|
|
45
|
+
Hooks also run inside subagents: a `PreToolUse` hook that blocks a command
|
|
46
|
+
blocks it in a subagent too.
|
|
47
|
+
|
|
48
|
+
Under pi's RPC transport, `SessionStart` fires twice per `/clear`. This is
|
|
49
|
+
a pi behavior.
|
|
50
|
+
|
|
51
|
+
## What a hook receives
|
|
52
|
+
|
|
53
|
+
The hook's standard input is a JSON object with these fields:
|
|
54
|
+
|
|
55
|
+
| Field | Present | Meaning |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `session_id` | Always | The session id. |
|
|
58
|
+
| `transcript_path` | Always | The session file, or an empty string when there is none. |
|
|
59
|
+
| `cwd` | Always | The working directory. |
|
|
60
|
+
| `hook_event_name` | Always | The event name from the table. |
|
|
61
|
+
| `tool_name`, `tool_input` | Tool events | The tool and its arguments. Tool names are One Code's names; see [Claude Code tool names](tools.md#claude-code-tool-names). |
|
|
62
|
+
| `tool_response` | `PostToolUse` | `{ content, is_error }`. |
|
|
63
|
+
| `prompt` | `UserPromptSubmit` | The submitted text. |
|
|
64
|
+
| `stop_hook_active` | `Stop` | Whether a Stop hook is already running. |
|
|
65
|
+
| `trigger` | Compaction events | `manual` or `auto`. |
|
|
66
|
+
| `custom_instructions` | `PreCompact` | Instructions passed to `/compact`. |
|
|
67
|
+
| `compact_summary` | `PostCompact` | The summary that replaced the context. |
|
|
68
|
+
| `source` | `SessionStart` | `startup`, `resume`, `clear`, or `compact`. |
|
|
69
|
+
| `reason` | `SessionEnd` | `clear`, `logout`, `prompt_input_exit`, or `other`. |
|
|
70
|
+
| `agent_id`, `agent_type` | Inside a subagent | Identify the subagent making the call. |
|
|
71
|
+
|
|
72
|
+
The hook's environment also carries `CLAUDE_PROJECT_DIR`.
|
|
73
|
+
|
|
74
|
+
Hook matchers match on the tool name. Claude Code's PascalCase names work.
|
|
75
|
+
|
|
76
|
+
## How a hook's result is read
|
|
77
|
+
|
|
78
|
+
| Outcome | Effect |
|
|
79
|
+
|---|---|
|
|
80
|
+
| Exit code 0 with JSON on stdout | The JSON is read as an envelope; see the following table. |
|
|
81
|
+
| Exit code 0 with other output | The hook passes. For `UserPromptSubmit` and `SessionStart`, the output is added to the model's context. |
|
|
82
|
+
| Exit code 2 | The action is blocked. Standard error is the reason. |
|
|
83
|
+
| Any other exit code | The hook passes and its output is ignored. |
|
|
84
|
+
| Timeout | `PreToolUse` and `UserPromptSubmit` block (fail closed). Other events pass. |
|
|
85
|
+
| The command could not be started | The hook passes; this is an environment problem, not a verdict. |
|
|
86
|
+
|
|
87
|
+
Envelope fields honored in a JSON result:
|
|
88
|
+
|
|
89
|
+
| Field | Effect |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `continue: false` | Blocks, with `stopReason` as the reason. |
|
|
92
|
+
| `decision: "block"` | Blocks, with `reason` as the reason. |
|
|
93
|
+
| `hookSpecificOutput.permissionDecision` | `"deny"` and `"ask"` both block, with `permissionDecisionReason`. `"allow"` is read but never honored; a hook cannot pre-approve an action, and the permission gate still runs. |
|
|
94
|
+
| `hookSpecificOutput.updatedInput` | Replaces the tool's input (`PreToolUse`). |
|
|
95
|
+
| `hookSpecificOutput.updatedToolResult` | Replaces the tool's result (`PostToolUse`). |
|
|
96
|
+
| `hookSpecificOutput.additionalContext` | Adds text to the model's context. |
|
|
97
|
+
| `systemMessage` | Shown to you. |
|
|
98
|
+
|
|
99
|
+
A `PreToolUse` block stops the call before the permission gate runs, so no
|
|
100
|
+
approval prompt appears for a hook-blocked call.
|
|
101
|
+
|
|
102
|
+
## Debugging hooks
|
|
103
|
+
|
|
104
|
+
Set `CC_HOOKS_DEBUG=1` before launching to print each hook dispatch and its
|
|
105
|
+
outcome to stderr. Decisions are also appended to
|
|
106
|
+
`~/.onecode/hooks/hooks-decisions.jsonl` while the variable is set.
|
|
107
|
+
|
|
108
|
+
Hooks run through `/bin/sh`. On native Windows this path does not exist,
|
|
109
|
+
which is one reason native Windows is unsupported; use WSL.
|