one-code-extension 0.1.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +200 -172
  3. package/agents/explore.md +9 -6
  4. package/agents/general-purpose.md +1 -1
  5. package/agents/plan.md +6 -4
  6. package/docs/guide/README.md +52 -0
  7. package/docs/guide/bring-your-claude-code-setup.md +126 -0
  8. package/docs/guide/configuration.md +171 -0
  9. package/docs/guide/differences-from-claude-code.md +150 -0
  10. package/docs/guide/doctor.md +86 -0
  11. package/docs/guide/hooks.md +109 -0
  12. package/docs/guide/installation.md +124 -0
  13. package/docs/guide/permissions-modes-and-auto-mode.md +450 -0
  14. package/docs/guide/providers-and-models.md +194 -0
  15. package/docs/guide/reference.md +224 -0
  16. package/docs/guide/sessions-and-context.md +190 -0
  17. package/docs/guide/skills-plugins-and-mcp.md +176 -0
  18. package/docs/guide/subagents-and-workflows.md +193 -0
  19. package/docs/guide/tasks-and-background-work.md +111 -0
  20. package/docs/guide/terminal-interface.md +155 -0
  21. package/docs/guide/tools.md +175 -0
  22. package/docs/guide/troubleshooting.md +175 -0
  23. package/extensions/ask-user/index.ts +65 -71
  24. package/extensions/ask-user/questions.ts +15 -28
  25. package/extensions/ask-user/widget.ts +533 -0
  26. package/extensions/auto-mode/actions.ts +9 -26
  27. package/extensions/auto-mode/classifier-prompt.ts +127 -0
  28. package/extensions/auto-mode/classifier.ts +305 -227
  29. package/extensions/auto-mode/config.ts +279 -77
  30. package/extensions/auto-mode/defaults.ts +17 -60
  31. package/extensions/auto-mode/instructions.ts +2 -1
  32. package/extensions/auto-mode/model-picker.ts +53 -31
  33. package/extensions/auto-mode/model-select.ts +153 -82
  34. package/extensions/auto-mode/paths.ts +13 -1
  35. package/extensions/auto-mode/pause.ts +8 -0
  36. package/extensions/auto-mode/prompt.ts +205 -238
  37. package/extensions/auto-mode/recoverability.ts +229 -0
  38. package/extensions/auto-mode/rules.ts +92 -75
  39. package/extensions/auto-mode/safety-floor.ts +43 -12
  40. package/extensions/auto-mode/sensitive.ts +11 -0
  41. package/extensions/auto-mode/setup-run.ts +245 -0
  42. package/extensions/auto-mode/setup.ts +235 -0
  43. package/extensions/auto-mode/shell-analysis.ts +332 -26
  44. package/extensions/auto-mode/transcript.ts +102 -0
  45. package/extensions/background/index.ts +256 -43
  46. package/extensions/background/monitor-batch.ts +58 -0
  47. package/extensions/background/registry.ts +9 -0
  48. package/extensions/background/wakeup.ts +45 -0
  49. package/extensions/bash/background.ts +47 -22
  50. package/extensions/bash/guards.ts +229 -0
  51. package/extensions/bash/index.ts +81 -19
  52. package/extensions/branding/index.ts +44 -18
  53. package/extensions/branding/startup.ts +23 -8
  54. package/extensions/claude-compat/index.ts +17 -2
  55. package/extensions/claude-context/index.ts +41 -12
  56. package/extensions/clear/index.ts +27 -0
  57. package/extensions/compaction/fit.ts +121 -0
  58. package/extensions/compaction/index.ts +176 -71
  59. package/extensions/compaction/prompt.ts +21 -1
  60. package/extensions/context-budget/budget.ts +61 -0
  61. package/extensions/context-budget/index.ts +66 -0
  62. package/extensions/context-management/index.ts +40 -16
  63. package/extensions/doctor/build.ts +226 -0
  64. package/extensions/doctor/cli.ts +99 -0
  65. package/extensions/doctor/compat.ts +532 -0
  66. package/extensions/doctor/dependencies.ts +186 -0
  67. package/extensions/doctor/fix-prompt.ts +125 -0
  68. package/extensions/doctor/index.ts +308 -0
  69. package/extensions/doctor/models.ts +231 -0
  70. package/extensions/doctor/presets.ts +208 -0
  71. package/extensions/doctor/report.ts +189 -0
  72. package/extensions/doctor/update-lookup.ts +46 -0
  73. package/extensions/doctor/viewer.ts +124 -0
  74. package/extensions/effort/index.ts +41 -4
  75. package/extensions/effort/slider.ts +33 -2
  76. package/extensions/file-tracker/index.ts +143 -20
  77. package/extensions/file-tracker/replay.ts +46 -0
  78. package/extensions/file-tracker/tracker.ts +51 -4
  79. package/extensions/footer/footer-line.ts +207 -0
  80. package/extensions/footer/index.ts +152 -0
  81. package/extensions/footer/pr.ts +53 -0
  82. package/extensions/hooks/executor.ts +57 -20
  83. package/extensions/hooks/formatter-notice.ts +76 -0
  84. package/extensions/hooks/index.ts +314 -73
  85. package/extensions/hooks/matcher.ts +35 -1
  86. package/extensions/hooks/plugin-hooks.ts +3 -3
  87. package/extensions/hooks/protocol.ts +58 -0
  88. package/extensions/hooks/subagent-bridge.ts +77 -0
  89. package/extensions/hooks/trust.ts +15 -4
  90. package/extensions/init/index.ts +26 -0
  91. package/extensions/init/prompt.ts +40 -0
  92. package/extensions/interrupted/index.ts +35 -0
  93. package/extensions/interrupted/line.ts +9 -0
  94. package/extensions/lib/abort.ts +15 -0
  95. package/extensions/lib/agent-loader.ts +183 -0
  96. package/extensions/lib/anthropic-payload.ts +15 -0
  97. package/extensions/lib/atomic-write.ts +56 -0
  98. package/extensions/lib/bridge-watch.ts +20 -0
  99. package/extensions/lib/cache-retention.ts +60 -0
  100. package/extensions/lib/capability-index.ts +466 -0
  101. package/extensions/lib/claude-context.ts +318 -27
  102. package/extensions/lib/claude-settings.ts +64 -0
  103. package/extensions/lib/consent-preview.ts +30 -0
  104. package/extensions/lib/deferred.ts +144 -13
  105. package/extensions/lib/favorites.ts +43 -0
  106. package/extensions/lib/fetch-timeout.ts +15 -0
  107. package/extensions/lib/frontmatter.ts +31 -0
  108. package/extensions/lib/git.ts +44 -2
  109. package/extensions/lib/hook-gate.ts +90 -0
  110. package/extensions/lib/interrupt.ts +94 -0
  111. package/extensions/lib/mcp-overrides.ts +61 -0
  112. package/extensions/lib/mcp-share.ts +25 -0
  113. package/extensions/lib/mcp-status.ts +34 -0
  114. package/extensions/lib/memory.ts +41 -6
  115. package/extensions/lib/model-facts.generated.json +2480 -0
  116. package/extensions/lib/model-facts.ts +162 -0
  117. package/extensions/lib/model-policy.ts +145 -189
  118. package/extensions/lib/model-tier.ts +480 -64
  119. package/extensions/lib/model-unusable.ts +37 -0
  120. package/extensions/lib/notifications.ts +320 -1
  121. package/extensions/lib/one-code-settings.ts +63 -0
  122. package/extensions/lib/original-command.ts +71 -0
  123. package/extensions/lib/package-version.ts +31 -0
  124. package/extensions/lib/paths.ts +39 -4
  125. package/extensions/lib/permission-gate.ts +192 -0
  126. package/extensions/lib/persisted-output.ts +18 -0
  127. package/extensions/lib/pi-ai-estimate.ts +160 -0
  128. package/extensions/lib/pi-version.ts +1 -1
  129. package/extensions/lib/plan-mode-channels.ts +11 -0
  130. package/extensions/lib/plugin-overrides.ts +24 -0
  131. package/extensions/lib/plugin-root.ts +44 -0
  132. package/extensions/lib/plugins.ts +233 -54
  133. package/extensions/lib/prefix-warm-gate.ts +157 -0
  134. package/extensions/lib/process-tree.ts +56 -0
  135. package/extensions/lib/reminders.ts +321 -68
  136. package/extensions/lib/scratchpad.ts +11 -8
  137. package/extensions/lib/session-lifecycle.ts +28 -0
  138. package/extensions/lib/settings-channels.ts +14 -0
  139. package/extensions/lib/shell-tasks.ts +54 -0
  140. package/extensions/lib/skill-overrides.ts +86 -0
  141. package/extensions/lib/skill-scan.ts +110 -0
  142. package/extensions/lib/text-width.ts +267 -0
  143. package/extensions/lib/tui-render.ts +281 -54
  144. package/extensions/lib/usage-bus.ts +75 -0
  145. package/extensions/lib/usage-tracker.ts +67 -0
  146. package/extensions/lib/worktree-isolation.ts +170 -0
  147. package/extensions/lsp/client.ts +69 -12
  148. package/extensions/lsp/format.ts +12 -2
  149. package/extensions/lsp/index.ts +273 -84
  150. package/extensions/lsp/install-hints.ts +43 -0
  151. package/extensions/lsp/keep-alive.ts +19 -0
  152. package/extensions/lsp/plugin-servers.ts +331 -0
  153. package/extensions/lsp/watcher.ts +157 -0
  154. package/extensions/mcp/announce.ts +99 -0
  155. package/extensions/mcp/client.ts +181 -22
  156. package/extensions/mcp/config.ts +55 -24
  157. package/extensions/mcp/index.ts +586 -86
  158. package/extensions/mcp/oauth/browser.ts +26 -0
  159. package/extensions/mcp/oauth/callback.ts +104 -0
  160. package/extensions/mcp/oauth/flow.ts +68 -0
  161. package/extensions/mcp/oauth/provider.ts +147 -0
  162. package/extensions/mcp/oauth/store.ts +86 -0
  163. package/extensions/mcp/panel/keys.ts +34 -0
  164. package/extensions/mcp/panel/model.ts +62 -0
  165. package/extensions/mcp/panel/render.ts +141 -0
  166. package/extensions/mcp/panel/state.ts +108 -0
  167. package/extensions/mcp/schema.ts +83 -6
  168. package/extensions/mcp/trust.ts +340 -0
  169. package/extensions/memory/entries.ts +163 -0
  170. package/extensions/memory/index.ts +119 -2
  171. package/extensions/memory/open-external.ts +97 -0
  172. package/extensions/memory/panel.ts +124 -0
  173. package/extensions/model-default/index.ts +74 -0
  174. package/extensions/notebook/index.ts +36 -18
  175. package/extensions/notebook/notebook.ts +110 -17
  176. package/extensions/permissions/index.ts +1012 -247
  177. package/extensions/permissions/matcher.ts +488 -57
  178. package/extensions/permissions/modes.ts +55 -7
  179. package/extensions/permissions/project-trust.ts +81 -0
  180. package/extensions/permissions/protected-paths.ts +16 -3
  181. package/extensions/permissions/rule-prose.ts +79 -0
  182. package/extensions/permissions/session-grant.ts +91 -0
  183. package/extensions/permissions/settings.ts +112 -33
  184. package/extensions/permissions/subagent-gate.ts +57 -0
  185. package/extensions/plan-mode/index.ts +143 -33
  186. package/extensions/plan-mode/reminder.ts +16 -19
  187. package/extensions/plan-mode/viewer.ts +40 -31
  188. package/extensions/plugins/counts.ts +68 -0
  189. package/extensions/plugins/index.ts +496 -32
  190. package/extensions/plugins/install/install.ts +167 -0
  191. package/extensions/plugins/install/paths.ts +23 -0
  192. package/extensions/plugins/install/registry.ts +72 -0
  193. package/extensions/plugins/marketplace/git.ts +103 -0
  194. package/extensions/plugins/marketplace/official.ts +36 -0
  195. package/extensions/plugins/marketplace/parse.ts +94 -0
  196. package/extensions/plugins/marketplace/registry.ts +60 -0
  197. package/extensions/plugins/marketplace/sync.ts +146 -0
  198. package/extensions/plugins/marketplace/types.ts +128 -0
  199. package/extensions/plugins/panel/keys.ts +52 -0
  200. package/extensions/plugins/panel/render.ts +315 -0
  201. package/extensions/plugins/panel/rows.ts +230 -0
  202. package/extensions/plugins/panel/state.ts +333 -0
  203. package/extensions/recap/index.ts +215 -0
  204. package/extensions/recap/prompt.ts +44 -0
  205. package/extensions/recap/scheduler.ts +87 -0
  206. package/extensions/search-tools/index.ts +0 -0
  207. package/extensions/search-tools/tools.ts +7 -5
  208. package/extensions/skill/index.ts +360 -34
  209. package/extensions/skill/invoke.ts +185 -0
  210. package/extensions/skill/listing.ts +21 -0
  211. package/extensions/skill/panel/keys.ts +41 -0
  212. package/extensions/skill/panel/render.ts +91 -0
  213. package/extensions/skill/panel/state.ts +115 -0
  214. package/extensions/spinner/index.ts +110 -0
  215. package/extensions/spinner/line.ts +51 -0
  216. package/extensions/spinner/verbs.ts +201 -0
  217. package/extensions/subagents/agents.ts +88 -44
  218. package/extensions/subagents/default-model.ts +62 -32
  219. package/extensions/subagents/delegation-steer.ts +23 -0
  220. package/extensions/subagents/hand-back-review.ts +67 -0
  221. package/extensions/subagents/index.ts +1545 -346
  222. package/extensions/subagents/live-runs.ts +293 -0
  223. package/extensions/subagents/model-select.ts +252 -82
  224. package/extensions/subagents/outcome.ts +90 -0
  225. package/extensions/subagents/panel-keys.ts +41 -0
  226. package/extensions/subagents/panel-render.ts +357 -0
  227. package/extensions/subagents/panel-widget.ts +330 -0
  228. package/extensions/subagents/pending-claim.ts +45 -0
  229. package/extensions/subagents/prose.ts +105 -0
  230. package/extensions/subagents/runner.ts +674 -0
  231. package/extensions/subagents/runs.ts +68 -1
  232. package/extensions/subagents/send-to-main-tool.ts +55 -0
  233. package/extensions/subagents/session-turns.ts +138 -0
  234. package/extensions/subagents/shell-panel.ts +198 -0
  235. package/extensions/subagents/usage.ts +16 -4
  236. package/extensions/subagents/worktree.ts +13 -0
  237. package/extensions/system-prompt/environment.ts +5 -3
  238. package/extensions/system-prompt/git-status.ts +93 -0
  239. package/extensions/system-prompt/index.ts +23 -1
  240. package/extensions/system-prompt/template.ts +34 -4
  241. package/extensions/system-prompt/tiers/common.ts +31 -6
  242. package/extensions/system-prompt/tiers/low.ts +13 -3
  243. package/extensions/system-prompt/tiers/mid.ts +21 -8
  244. package/extensions/system-reminder/index.ts +53 -9
  245. package/extensions/tasks/index.ts +65 -16
  246. package/extensions/tasks/store.ts +76 -3
  247. package/extensions/tool-search/announce.ts +42 -0
  248. package/extensions/tool-search/index.ts +136 -13
  249. package/extensions/turn-duration/index.ts +60 -0
  250. package/extensions/turn-duration/line.ts +22 -0
  251. package/extensions/turn-duration/span.ts +41 -0
  252. package/extensions/turn-duration/verbs.ts +24 -0
  253. package/extensions/web/backends.ts +421 -0
  254. package/extensions/web/index.ts +178 -21
  255. package/extensions/web-fetch/index.ts +74 -18
  256. package/extensions/web-fetch/summarize.ts +1 -1
  257. package/extensions/workflow/agent-session.ts +182 -112
  258. package/extensions/workflow/globals.ts +129 -106
  259. package/extensions/workflow/index.ts +343 -28
  260. package/extensions/workflow/records.ts +118 -0
  261. package/extensions/workflow/run-manager.ts +80 -31
  262. package/extensions/workflow/saved-workflows.ts +2 -1
  263. package/extensions/workflow/script-worker.mjs +110 -0
  264. package/extensions/workflow/types.ts +74 -8
  265. package/extensions/workflow/viewer.ts +562 -0
  266. package/extensions/workflow/vm-runtime.ts +118 -22
  267. package/extensions/workflow/widget.ts +126 -18
  268. package/extensions/worktree/guards.ts +240 -0
  269. package/extensions/worktree/index.ts +30 -5
  270. package/extensions/worktree/rewrite.ts +32 -16
  271. package/package.json +20 -10
  272. package/skills/code-review/SKILL.md +165 -0
  273. package/skills/fewer-permission-prompts/SKILL.md +61 -0
  274. package/skills/security-review/SKILL.md +178 -0
  275. package/skills/simplify/SKILL.md +70 -0
  276. package/themes/{one-code-light.json → onecode-light.json} +6 -1
  277. package/themes/{one-code.json → onecode.json} +6 -1
  278. package/types/app.d.ts +8 -1
  279. package/types/community-packages.d.ts +45 -2
  280. package/docs/decisions/auto-mode.md +0 -526
  281. package/docs/decisions/branding.md +0 -127
  282. package/docs/decisions/code-review-remediation.md +0 -106
  283. package/docs/decisions/compaction.md +0 -140
  284. package/docs/decisions/distribution.md +0 -168
  285. package/docs/decisions/hooks.md +0 -64
  286. package/docs/decisions/lsp.md +0 -58
  287. package/docs/decisions/mcp.md +0 -104
  288. package/docs/decisions/memory-state.md +0 -170
  289. package/docs/decisions/model-policy.md +0 -126
  290. package/docs/decisions/modes.md +0 -178
  291. package/docs/decisions/skills-plugins.md +0 -56
  292. package/docs/decisions/subagents-workflows.md +0 -225
  293. package/docs/decisions/system-prompt.md +0 -98
  294. package/docs/decisions/tools.md +0 -407
  295. package/docs/decisions/tui.md +0 -217
  296. package/docs/decisions.md +0 -148
  297. package/extensions/subagents/child.ts +0 -414
  298. package/extensions/subagents/rpc-turns.ts +0 -123
  299. package/extensions/todo/index.ts +0 -133
  300. package/extensions/workflow/permission-gate.ts +0 -71
@@ -20,32 +20,48 @@ export function shellQuote(path: string): string {
20
20
  return `'${path.replace(/'/g, "'\\''")}'`;
21
21
  }
22
22
 
23
+
23
24
  /**
24
- * Key under which a worktree-rewritten bash call preserves the model's original
25
- * (pre-`cd`-wrapper) command. The permission matcher reads it so allow/ask/deny
26
- * rules are evaluated against what the model actually asked for, not the
27
- * `cd '<wt>' && (…)` wrapper (which starts with `cd` and matches no Bash rule).
28
- * The classifier and safety floor still see the wrapped `input.command`, whose
29
- * `cd` makes containment resolve inside the worktree — see docs/decisions/worktree.md.
25
+ * Mutates `input` in place so the call runs inside the worktree. For bash,
26
+ * returns the model's ORIGINAL command (pre-`cd`-wrapper) so the caller can
27
+ * publish it over `ORIGINAL_COMMAND_CHANNEL` keyed by the call id: the
28
+ * permission matcher evaluates rules against what the model asked for, not
29
+ * the wrapper (which starts with `cd` and matches no Bash rule), while the
30
+ * classifier and safety floor keep reading the wrapped `input.command`, whose
31
+ * `cd` makes containment resolve inside the worktree —
32
+ * docs/decisions/code-review-remediation.md ("Worktree vs. permission rules").
33
+ * The original is deliberately NOT stored in `input`: a key there is
34
+ * model-writable (lib/original-command.ts).
30
35
  */
31
- export const ORIGINAL_COMMAND_KEY = "__ccOriginalCommand";
32
-
33
- /** Mutates `input` in place so the call runs inside the worktree. */
34
- export function rewriteToolInput(toolName: string, input: Record<string, unknown>, worktreePath: string): void {
36
+ export function rewriteToolInput(
37
+ toolName: string,
38
+ input: Record<string, unknown>,
39
+ worktreePath: string,
40
+ ): { originalCommand?: string } {
35
41
  if (toolName === "bash") {
36
42
  if (typeof input.command === "string") {
37
- input[ORIGINAL_COMMAND_KEY] = input.command;
38
- input.command = `cd ${shellQuote(worktreePath)} && (${input.command}\n)`;
43
+ const originalCommand = input.command;
44
+ input.command = `cd ${shellQuote(worktreePath)} && (${originalCommand}\n)`;
45
+ return { originalCommand };
39
46
  }
40
- return;
47
+ return {};
41
48
  }
42
- if (!PATH_TOOLS.has(toolName)) return;
49
+ if (!PATH_TOOLS.has(toolName)) return {};
43
50
 
44
- if (typeof input.path === "string" && input.path.length > 0) {
45
- if (!isAbsolute(input.path)) input.path = resolve(worktreePath, input.path);
51
+ // Rewrite whichever field carries the path — `path` for pi's built-ins,
52
+ // `file_path`/`notebook_path` for Claude Code-shaped calls — so a
53
+ // notebook_edit using `notebook_path` still lands inside the worktree
54
+ // instead of the shared checkout (code-review).
55
+ const pathField = (["path", "file_path", "notebook_path"] as const).find(
56
+ (field) => typeof input[field] === "string" && (input[field] as string).length > 0,
57
+ );
58
+ if (pathField) {
59
+ const value = input[pathField] as string;
60
+ if (!isAbsolute(value)) input[pathField] = resolve(worktreePath, value);
46
61
  } else if (DEFAULTS_TO_CWD.has(toolName)) {
47
62
  input.path = worktreePath;
48
63
  }
64
+ return {};
49
65
  }
50
66
 
51
67
  /** Validates an EnterWorktree name: /-separated segments of [A-Za-z0-9._-], ≤64 chars total. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "one-code-extension",
3
- "version": "0.1.4",
4
- "description": "One Code as a pi package \u2014 the Claude Code experience on your own pi install: ported system prompt, Claude-Code-format permissions, .claude/ compatibility, ToolSearch-style deferred tools, and system-reminder steering. For the bundled app, install `@one-ai/one-code` instead.",
3
+ "version": "0.3.0",
4
+ "description": "One Code as a pi package — the Claude Code experience on your own pi install: ported system prompt, Claude-Code-format permissions, .claude/ compatibility, ToolSearch-style deferred tools, and system-reminder steering. For the bundled app, install `@one-ai/one-code` instead.",
5
5
  "keywords": [
6
6
  "pi",
7
7
  "pi-package",
@@ -28,6 +28,7 @@
28
28
  "extensions": [
29
29
  "extensions/branding/index.ts",
30
30
  "extensions/claude-compat/index.ts",
31
+ "extensions/context-budget/index.ts",
31
32
  "extensions/system-reminder/index.ts",
32
33
  "extensions/claude-context/index.ts",
33
34
  "extensions/hooks/index.ts",
@@ -46,8 +47,15 @@
46
47
  "extensions/subagents/index.ts",
47
48
  "extensions/workflow/index.ts",
48
49
  "extensions/effort/index.ts",
50
+ "extensions/spinner/index.ts",
51
+ "extensions/model-default/index.ts",
52
+ "extensions/footer/index.ts",
53
+ "extensions/turn-duration/index.ts",
54
+ "extensions/interrupted/index.ts",
55
+ "extensions/recap/index.ts",
49
56
  "extensions/exit/index.ts",
50
- "extensions/todo/index.ts",
57
+ "extensions/init/index.ts",
58
+ "extensions/clear/index.ts",
51
59
  "extensions/tasks/index.ts",
52
60
  "extensions/plan-mode/index.ts",
53
61
  "extensions/notebook/index.ts",
@@ -55,6 +63,7 @@
55
63
  "extensions/web-fetch/index.ts",
56
64
  "extensions/lsp/index.ts",
57
65
  "extensions/mcp/index.ts",
66
+ "extensions/doctor/index.ts",
58
67
  "extensions/context-management/index.ts",
59
68
  "extensions/compaction/index.ts",
60
69
  "extensions/system-prompt/index.ts"
@@ -66,30 +75,31 @@
66
75
  "files": [
67
76
  "extensions/",
68
77
  "agents/",
78
+ "skills/",
69
79
  "themes/",
70
80
  "types/",
71
81
  "README.md",
72
82
  "LICENSE",
73
- "docs/decisions.md",
74
- "docs/decisions/"
83
+ "docs/guide/"
75
84
  ],
76
85
  "scripts": {
77
86
  "typecheck": "tsc --noEmit",
78
- "test": "vitest run"
87
+ "test": "vitest run",
88
+ "gen:model-facts": "node scripts/gen-model-facts.mjs"
79
89
  },
80
90
  "dependencies": {
81
91
  "@modelcontextprotocol/sdk": "^1.30.0",
82
92
  "@mozilla/readability": "^0.6.0",
83
93
  "acorn": "^8.18.0",
84
94
  "linkedom": "^0.18.13",
85
- "pi-web-search": "^1.3.1",
95
+ "pi-web-search": "^1.5.0",
86
96
  "turndown": "^7.2.4",
87
97
  "typebox": "^1.3.7"
88
98
  },
89
99
  "devDependencies": {
90
- "@earendil-works/pi-agent-core": "^0.84.1",
91
- "@earendil-works/pi-ai": "^0.84.1",
92
- "@earendil-works/pi-coding-agent": "^0.84.1",
100
+ "@earendil-works/pi-agent-core": "^0.85.1",
101
+ "@earendil-works/pi-ai": "^0.85.1",
102
+ "@earendil-works/pi-coding-agent": "^0.85.1",
93
103
  "@types/node": "^26.1.2",
94
104
  "@types/turndown": "^5.0.6",
95
105
  "typescript": "^5.6.0",
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: code-review
3
+ description: >
4
+ Review the current diff, or a PR number/branch/path target, for correctness
5
+ bugs and reuse/simplification/efficiency cleanups. Pass --comment to post
6
+ findings as inline PR comments, or --fix to apply the findings to the working
7
+ tree after the review. Raise the reasoning effort (/effort) for broader,
8
+ recall-biased coverage; lower it for fewer, high-confidence findings.
9
+ ---
10
+
11
+ `medium effort → 3+5 angles × 6 candidates → 1-vote verify → ≤8 findings`
12
+
13
+ You are reviewing for **precision**: every finding you surface should be one a
14
+ maintainer would act on. If the session is running at a higher reasoning effort,
15
+ shift toward **recall** — catch every real bug a careful reviewer would catch in
16
+ one sitting, err on the side of surfacing, and raise the finding cap and the
17
+ number of finder angles accordingly.
18
+
19
+ ## Phase 0 — Gather the diff
20
+
21
+ Run `git diff @{upstream}...HEAD` (or `git diff main...HEAD` / `git diff HEAD~1`
22
+ if there's no upstream) to get the unified diff under review. If there are
23
+ uncommitted changes, or the range diff is empty, also run `git diff HEAD` and
24
+ include the working-tree changes in scope — the review often runs before the
25
+ commit. If a PR number, branch name, or file path was passed as an argument,
26
+ review that target instead. Treat this diff as the review scope.
27
+
28
+ ## Phase 1 — Find candidates (3 correctness angles + 3 cleanup angles + 1 altitude angle + 1 conventions angle, up to 6 each)
29
+
30
+ Run **8 independent finder angles** via the Agent tool. Each
31
+ surfaces **up to 6 candidate findings** with `file`, `line`, a one-line
32
+ `summary`, and a concrete `failure_scenario`. If the Agent tool is not available
33
+ in your current tool set, do not error — perform each angle (and each
34
+ verification) yourself, sequentially, in this context.
35
+
36
+ ### Angle A — line-by-line diff scan
37
+
38
+ Read every hunk in the diff, line by line. Then Read the enclosing function for
39
+ each hunk — bugs in unchanged lines of a touched function are in scope (the PR
40
+ re-exposes or fails to fix them). For every line ask: what input, state, timing,
41
+ or platform makes this line wrong? Look for inverted/wrong conditions,
42
+ off-by-one, null/undefined deref, missing `await`, falsy-zero checks,
43
+ wrong-variable copy-paste, error swallowed in catch, unescaped regex metachars.
44
+
45
+ ### Angle B — removed-behavior auditor
46
+
47
+ For every line the diff DELETES or replaces, name the invariant or behavior it
48
+ enforced, then search the new code for where that invariant is re-established.
49
+ If you can't find it, that's a candidate: a removed guard, a dropped error
50
+ path, a narrowed validation, a deleted test that was covering a real case.
51
+
52
+ ### Angle C — cross-file tracer
53
+
54
+ For each function the diff changes, find its callers (Grep for the symbol) and
55
+ check whether the change breaks any call site: a new precondition, a changed
56
+ return shape, a new exception, a timing/ordering dependency. Also check callees:
57
+ does a parallel change in the same PR make a call unsafe?
58
+
59
+ ### Reuse
60
+
61
+ The angles above hunt for bugs; this one and the next two hunt for cleanup in
62
+ the changed code. Flag new code that re-implements something the codebase
63
+ already has — Grep shared/utility modules and files adjacent to the change,
64
+ and name the existing helper to call instead.
65
+
66
+ ### Simplification
67
+
68
+ Flag unnecessary complexity the diff adds: redundant or derivable state,
69
+ copy-paste with slight variation, deep nesting, dead code left behind. Name
70
+ the simpler form that does the same job.
71
+
72
+ ### Efficiency
73
+
74
+ Flag wasted work the diff introduces: redundant computation or repeated I/O,
75
+ independent operations run sequentially, blocking work added to startup or
76
+ hot paths. Also flag long-lived objects built from closures or captured
77
+ environments — they keep the entire enclosing scope alive for the object's
78
+ lifetime (a memory leak when that scope holds large values); prefer a
79
+ class/struct that copies only the fields it needs. Name the cheaper
80
+ alternative.
81
+
82
+ ### Altitude
83
+
84
+ Check that each change is implemented at the right depth, not as a fragile
85
+ bandaid. Special cases layered on shared infrastructure are a sign the fix
86
+ isn't deep enough — prefer generalizing the underlying mechanism over adding
87
+ special cases.
88
+
89
+ ### Conventions (CLAUDE.md)
90
+
91
+ Find the CLAUDE.md files that govern the changed code: the user-level
92
+ ~/.claude/CLAUDE.md, the repo-root CLAUDE.md, plus any CLAUDE.md or
93
+ CLAUDE.local.md in a directory that is an ancestor of a changed file (a
94
+ directory's CLAUDE.md only applies to files at or below it). Read each one
95
+ that exists, then check the diff for clear violations of the rules they state.
96
+
97
+ Only flag a violation when you can quote the exact rule and the exact line
98
+ that breaks it — no style preferences, no vague "spirit of the doc"
99
+ inferences. In the finding, name the CLAUDE.md path and quote the rule so the
100
+ report can cite it. If no CLAUDE.md applies, return nothing for this angle.
101
+
102
+ Cleanup, altitude, and conventions candidates use the same
103
+ `file`/`line`/`summary` shape; in `failure_scenario`, state the concrete
104
+ cost (what is duplicated, wasted, harder to maintain, or which CLAUDE.md rule
105
+ is broken) instead of a crash. Correctness bugs always outrank cleanup,
106
+ altitude, and conventions findings when the output cap forces a cut.
107
+
108
+ Pass every candidate with a nameable failure scenario through — finders that
109
+ silently drop half-believed candidates bypass the verify step and are the
110
+ dominant cause of misses.
111
+
112
+ ## Phase 2 — Verify (1-vote, 3-state)
113
+
114
+ Dedup candidates that point at the same line/mechanism, keeping the one with
115
+ the most concrete failure scenario. For each remaining candidate, run **one
116
+ verifier** via the Agent tool: give it the diff, the relevant
117
+ file(s), and the candidate, and have it return exactly one of:
118
+
119
+ - **CONFIRMED** — can name the inputs/state that trigger it and the wrong
120
+ output or crash. Quote the line.
121
+ - **PLAUSIBLE** — mechanism is real, trigger is uncertain (timing, env,
122
+ config). State what would confirm it.
123
+ - **REFUTED** — factually wrong (code doesn't say that) or guarded elsewhere.
124
+ Quote the line that proves it.
125
+
126
+ Keep candidates where the vote is CONFIRMED or PLAUSIBLE.
127
+
128
+ ## Output
129
+
130
+ Return findings as a JSON array of at most 8 objects (raise the cap when running
131
+ at higher effort):
132
+
133
+ ```json
134
+ [
135
+ {
136
+ "file": "path/to/file.ext",
137
+ "line": 123,
138
+ "summary": "one-sentence statement of the bug",
139
+ "failure_scenario": "concrete inputs/state → wrong output/crash"
140
+ }
141
+ ]
142
+ ```
143
+
144
+ Ranked most-severe first. If more than the cap survive, keep the most severe. If
145
+ nothing survives verification, return `[]`.
146
+
147
+ ## Arguments and flags
148
+
149
+ Read the invocation arguments and adjust accordingly:
150
+
151
+ - **A target** (`<pr#>`, `<branch>`, or `<path>`) replaces "the current diff" as
152
+ the review scope in Phase 0.
153
+ - **`--comment`** — after producing the findings list, if the review target is a
154
+ GitHub PR, post each finding as an inline PR comment (one call per finding;
155
+ include a suggestion block only when it fully fixes the issue). Prefer a
156
+ GitHub inline-comment MCP tool if one is connected this session; otherwise use
157
+ `gh api repos/{owner}/{repo}/pulls/{pr}/comments`. If the target is not a PR,
158
+ print the findings to the terminal and note that `--comment` was ignored.
159
+ - **`--fix`** — after producing the findings list, apply the findings to the
160
+ working tree instead of stopping at the report: fix each one directly —
161
+ correctness bugs and reuse/simplification/efficiency cleanups alike. Skip any
162
+ finding whose fix would change intended behavior, require changes well outside
163
+ the reviewed diff, or that you judge to be a false positive — note the skip
164
+ rather than arguing with it. Finish with a brief summary of what was fixed and
165
+ what was skipped.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: fewer-permission-prompts
3
+ description: >
4
+ Scan your session transcripts for common read-only Bash and MCP tool calls,
5
+ then add a prioritized allowlist to One Code's per-repo settings to reduce
6
+ permission prompts.
7
+ ---
8
+
9
+ # Fewer Permission Prompts
10
+
11
+ Look through my transcripts' MCP and bash tool calls, and based on those, make a prioritized list of patterns that I should add to my permission allowlist to reduce permission prompts. Focus on read-only commands.
12
+
13
+ The format for permissions is: `Bash(foo*)`, `Bash(foo)`, `Bash(foo bar *)`, `mcp__slack__slack_read_thread`, etc. Claude Code's PascalCase tool names are accepted too and mapped automatically.
14
+
15
+ Then, add these to One Code's per-repo settings at `~/.onecode/projects/<slug>/settings.json` under `permissions.allow`. Never write to `~/.claude` — that is Claude Code's directory and One Code treats it as read-only.
16
+
17
+ ## Steps
18
+
19
+ 1. **Locate transcripts.** One Code / pi session transcripts live under the agent state dir at `~/.onecode/agent/sessions/<sanitized-cwd>/*.jsonl` (the base honours `PI_CODING_AGENT_DIR`, which the bundled app sets to `~/.onecode/agent`; a stock pi install uses its own agent dir). Each line is a JSON object. Tool calls appear as assistant messages whose content carries tool-call entries: a tool name (e.g. `Bash`, `mcp__slack__slack_read_thread`) and, for a shell tool, the command string in its input.
20
+
21
+ Scan the recent transcripts across the sessions dir — not just the current project — so the allowlist reflects your actual usage. Cap the scan at a reasonable number of recent sessions (e.g. 50 most-recently-modified JSONL files) so this stays fast.
22
+
23
+ 2. **Extract tool-call frequencies.**
24
+ - For shell (`Bash`) calls: parse the command, take the leading command token (handling `sudo`, `timeout`, pipes, `&&`, env-var prefixes). Record the command + first subcommand pair (e.g. `git status`, `gh pr view`, `ls`, `cat`).
25
+ - For MCP calls: record the full tool name (e.g. `mcp__slack__slack_read_thread`).
26
+ - Count occurrences across the scanned transcripts.
27
+
28
+ 3. **Filter to read-only.** Keep only commands that don't mutate state. Examples of read-only: `ls`, `cat`, `pwd`, `git status`, `git log`, `git diff`, `git show`, `git branch`, `rg`, `grep`, `find`, `head`, `tail`, `wc`, `file`, `which`, `echo`, `date`, `gh pr view`, `gh pr list`, `gh pr diff`, `gh issue view`, `gh issue list`, `gh run list`, `gh run view`, `gh api` (GET), `docker ps`, `docker logs`, `kubectl get`, `kubectl describe`, `ps`, `top`, `df`, `du`, `env`, `printenv`, any MCP tool with `read`/`get`/`list`/`search`/`view` in its name.
29
+
30
+ Drop anything that writes, deletes, renames, pushes, merges, installs, or runs a build/test that has side effects. When in doubt, leave it out.
31
+
32
+ **Never allowlist a pattern that grants arbitrary code execution.** A wildcard rule for any of these (e.g. `Bash(python3:*)`) is equivalent to allowing arbitrary code execution. This list is not exhaustive — apply the same rule to anything in the same category:
33
+ - Interpreters: `python`/`python3`, `node`, `bun`, `deno`, `ruby`, `perl`, `php`, `lua`, etc.
34
+ - Shells: `bash`, `sh`, `zsh`, `fish`, `eval`, `exec`, `ssh`, etc.
35
+ - Package runners: `npx`, `bunx`, `uvx`, `uv run`, etc.
36
+ - Task-runner wildcards: `npm run *`, `yarn run *`, `pnpm run *`, `bun run *`, `make *`, `just *`, `cargo run *`, `go run *`, etc. — an exact `Bash(npm run typecheck)` is fine, `Bash(npm run *)` is not
37
+ - `gh api *`, `docker run`/`exec`, `kubectl exec`, `sudo`, and similar
38
+
39
+ 4. **Drop commands One Code already auto-allows.** One Code's auto-mode floor already treats common read-only commands as safe, so they never prompt in auto mode and don't need an allowlist entry — plain `cat`, `ls`, `git status`, `grep`, and the like. If you see these in the transcripts, don't bother suggesting them. When you are unsure whether a command is already covered, it is safe to include it anyway: a redundant `permissions.allow` entry is harmless, whereas a genuinely useful allow left out keeps prompting you.
40
+
41
+ 5. **Pick the pattern form.** Use the narrowest pattern that still covers the observed usage:
42
+ - If you run many variants (`git log`, `git log --oneline`, `git log main..HEAD`): use `Bash(git log *)` — note the space before `*`, which is required for prefix matching to work correctly.
43
+ - If a single exact invocation is common: use `Bash(foo)` with no wildcard.
44
+ - For MCP: use the full tool name verbatim (no wildcard needed; they're already specific).
45
+ - Never widen a pattern to the point that it conflicts with the rules above (no arbitrary code execution, no mutation/side effects).
46
+
47
+ 6. **Prioritize.** Rank by count descending. Drop anything that appeared fewer than ~3 times — not worth the allowlist entry. Cap the list at the top ~20 so you can skim it.
48
+
49
+ 7. **Present the prioritized list to the user** as a markdown table with columns: rank, pattern, count, one-line description. Example:
50
+
51
+ | # | Pattern | Count | Notes |
52
+ |---|---------|-------|-------|
53
+ | 1 | `Bash(git status *)` | 142 | repo status checks |
54
+ | 2 | `Bash(gh pr view *)` | 87 | PR inspection |
55
+ | 3 | `mcp__slack__slack_read_thread` | 54 | Slack thread reads |
56
+
57
+ 8. **Merge into the per-repo settings** at `~/.onecode/projects/<slug>/settings.json` (not `~/.onecode/settings.json`, not anything under `~/.claude`). Create the file if it doesn't exist. Preserve existing keys and existing entries in `permissions.allow`; de-duplicate against what's already there; don't remove anything; don't reorder unrelated fields.
58
+
59
+ 9. **Report back.** Tell the user what you added (count + a few examples), what was already in the allowlist, and what you skipped and why (e.g. "dropped `rm` and `git push` — not read-only; dropped `cat`/`ls`/`git status` — already auto-allowed, no rule needed").
60
+
61
+ Do not add anything to `permissions.deny` or `permissions.ask`. Do not touch any other settings field.
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: security-review
3
+ description: >
4
+ Complete a security review of the pending changes on the current branch — a
5
+ focused, high-confidence hunt for exploitable vulnerabilities newly introduced
6
+ by the diff, reported as a severity-ranked markdown briefing.
7
+ ---
8
+
9
+ You are a senior security engineer conducting a focused security review of the changes on this branch.
10
+
11
+ ## Phase 0 — Gather the changes
12
+
13
+ Run these commands and treat their combined output as the review scope:
14
+
15
+ - `git status`
16
+ - `git diff --name-only origin/HEAD...` — files modified
17
+ - `git log --no-decorate origin/HEAD...` — commits
18
+ - `git diff origin/HEAD...` — the full diff
19
+
20
+ Review the complete diff. This contains all code changes in the PR.
21
+
22
+ OBJECTIVE:
23
+ Perform a security-focused code review to identify HIGH-CONFIDENCE security vulnerabilities that could have real exploitation potential. This is not a general code review - focus ONLY on security implications newly added by this PR. Do not comment on existing security concerns.
24
+
25
+ CRITICAL INSTRUCTIONS:
26
+ 1. MINIMIZE FALSE POSITIVES: Only flag issues where you're >80% confident of actual exploitability
27
+ 2. AVOID NOISE: Skip theoretical issues, style concerns, or low-impact findings
28
+ 3. FOCUS ON IMPACT: Prioritize vulnerabilities that could lead to unauthorized access, data breaches, or system compromise
29
+ 4. EXCLUSIONS: Do NOT report the following issue types:
30
+ - Denial of Service (DOS) vulnerabilities, even if they allow service disruption
31
+ - Secrets or sensitive data stored on disk (these are handled by other processes)
32
+ - Rate limiting or resource exhaustion issues
33
+
34
+ SECURITY CATEGORIES TO EXAMINE:
35
+
36
+ **Input Validation Vulnerabilities:**
37
+ - SQL injection via unsanitized user input
38
+ - Command injection in system calls or subprocesses
39
+ - XXE injection in XML parsing
40
+ - Template injection in templating engines
41
+ - NoSQL injection in database queries
42
+ - Path traversal in file operations
43
+
44
+ **Authentication & Authorization Issues:**
45
+ - Authentication bypass logic
46
+ - Privilege escalation paths
47
+ - Session management flaws
48
+ - JWT token vulnerabilities
49
+ - Authorization logic bypasses
50
+
51
+ **Crypto & Secrets Management:**
52
+ - Hardcoded API keys, passwords, or tokens
53
+ - Weak cryptographic algorithms or implementations
54
+ - Improper key storage or management
55
+ - Cryptographic randomness issues
56
+ - Certificate validation bypasses
57
+
58
+ **Injection & Code Execution:**
59
+ - Remote code execution via deseralization
60
+ - Pickle injection in Python
61
+ - YAML deserialization vulnerabilities
62
+ - Eval injection in dynamic code execution
63
+ - XSS vulnerabilities in web applications (reflected, stored, DOM-based)
64
+
65
+ **Data Exposure:**
66
+ - Sensitive data logging or storage
67
+ - PII handling violations
68
+ - API endpoint data leakage
69
+ - Debug information exposure
70
+
71
+ Additional notes:
72
+ - Even if something is only exploitable from the local network, it can still be a HIGH severity issue
73
+
74
+ ANALYSIS METHODOLOGY:
75
+
76
+ Phase 1 - Repository Context Research (Use file search tools):
77
+ - Identify existing security frameworks and libraries in use
78
+ - Look for established secure coding patterns in the codebase
79
+ - Examine existing sanitization and validation patterns
80
+ - Understand the project's security model and threat model
81
+
82
+ Phase 2 - Comparative Analysis:
83
+ - Compare new code changes against existing security patterns
84
+ - Identify deviations from established secure practices
85
+ - Look for inconsistent security implementations
86
+ - Flag code that introduces new attack surfaces
87
+
88
+ Phase 3 - Vulnerability Assessment:
89
+ - Examine each modified file for security implications
90
+ - Trace data flow from user inputs to sensitive operations
91
+ - Look for privilege boundaries being crossed unsafely
92
+ - Identify injection points and unsafe deserialization
93
+
94
+ REQUIRED OUTPUT FORMAT:
95
+
96
+ You MUST output your findings in markdown. The markdown output should contain the file, line number, severity, category (e.g. `sql_injection` or `xss`), description, exploit scenario, and fix recommendation.
97
+
98
+ For example:
99
+
100
+ # Vuln 1: XSS: `foo.py:42`
101
+
102
+ * Severity: High
103
+ * Description: User input from `username` parameter is directly interpolated into HTML without escaping, allowing reflected XSS attacks
104
+ * Exploit Scenario: Attacker crafts URL like /bar?q=<script>alert(document.cookie)</script> to execute JavaScript in victim's browser, enabling session hijacking or data theft
105
+ * Recommendation: Use Flask's escape() function or Jinja2 templates with auto-escaping enabled for all user inputs rendered in HTML
106
+
107
+ SEVERITY GUIDELINES:
108
+ - **HIGH**: Directly exploitable vulnerabilities leading to RCE, data breach, or authentication bypass
109
+ - **MEDIUM**: Vulnerabilities requiring specific conditions but with significant impact
110
+ - **LOW**: Defense-in-depth issues or lower-impact vulnerabilities
111
+
112
+ CONFIDENCE SCORING:
113
+ - 0.9-1.0: Certain exploit path identified, tested if possible
114
+ - 0.8-0.9: Clear vulnerability pattern with known exploitation methods
115
+ - 0.7-0.8: Suspicious pattern requiring specific conditions to exploit
116
+ - Below 0.7: Don't report (too speculative)
117
+
118
+ FINAL REMINDER:
119
+ Focus on HIGH and MEDIUM findings only. Better to miss some theoretical issues than flood the report with false positives. Each finding should be something a security engineer would confidently raise in a PR review.
120
+
121
+ FALSE POSITIVE FILTERING:
122
+
123
+ > You do not need to run commands to reproduce the vulnerability, just read the code to determine if it is a real vulnerability. Do not use the bash tool or write to any files.
124
+ >
125
+ > HARD EXCLUSIONS - Automatically exclude findings matching these patterns:
126
+ > 1. Denial of Service (DOS) vulnerabilities or resource exhaustion attacks.
127
+ > 2. Secrets or credentials stored on disk if they are otherwise secured.
128
+ > 3. Rate limiting concerns or service overload scenarios.
129
+ > 4. Memory consumption or CPU exhaustion issues.
130
+ > 5. Lack of input validation on non-security-critical fields without proven security impact.
131
+ > 6. Input sanitization concerns for GitHub Action workflows unless they are clearly triggerable via untrusted input.
132
+ > 7. A lack of hardening measures. Code is not expected to implement all security best practices, only flag concrete vulnerabilities.
133
+ > 8. Race conditions or timing attacks that are theoretical rather than practical issues. Only report a race condition if it is concretely problematic.
134
+ > 9. Vulnerabilities related to outdated third-party libraries. These are managed separately and should not be reported here.
135
+ > 10. Memory safety issues such as buffer overflows or use-after-free-vulnerabilities are impossible in rust. Do not report memory safety issues in rust or any other memory safe languages.
136
+ > 11. Files that are only unit tests or only used as part of running tests.
137
+ > 12. Log spoofing concerns. Outputting un-sanitized user input to logs is not a vulnerability.
138
+ > 13. SSRF vulnerabilities that only control the path. SSRF is only a concern if it can control the host or protocol.
139
+ > 14. Including user-controlled content in AI system prompts is not a vulnerability.
140
+ > 15. Regex injection. Injecting untrusted content into a regex is not a vulnerability.
141
+ > 16. Regex DOS concerns.
142
+ > 16. Insecure documentation. Do not report any findings in documentation files such as markdown files.
143
+ > 17. A lack of audit logs is not a vulnerability.
144
+ >
145
+ > PRECEDENTS -
146
+ > 1. Logging high value secrets in plaintext is a vulnerability. Logging URLs is assumed to be safe.
147
+ > 2. UUIDs can be assumed to be unguessable and do not need to be validated.
148
+ > 3. Environment variables and CLI flags are trusted values. Attackers are generally not able to modify them in a secure environment. Any attack that relies on controlling an environment variable is invalid.
149
+ > 4. Resource management issues such as memory or file descriptor leaks are not valid.
150
+ > 5. Subtle or low impact web vulnerabilities such as tabnabbing, XS-Leaks, prototype pollution, and open redirects should not be reported unless they are extremely high confidence.
151
+ > 6. React and Angular are generally secure against XSS. These frameworks do not need to sanitize or escape user input unless it is using dangerouslySetInnerHTML, bypassSecurityTrustHtml, or similar methods. Do not report XSS vulnerabilities in React or Angular components or tsx files unless they are using unsafe methods.
152
+ > 7. Most vulnerabilities in github action workflows are not exploitable in practice. Before validating a github action workflow vulnerability ensure it is concrete and has a very specific attack path.
153
+ > 8. A lack of permission checking or authentication in client-side JS/TS code is not a vulnerability. Client-side code is not trusted and does not need to implement these checks, they are handled on the server-side. The same applies to all flows that send untrusted data to the backend, the backend is responsible for validating and sanitizing all inputs.
154
+ > 9. Only include MEDIUM findings if they are obvious and concrete issues.
155
+ > 10. Most vulnerabilities in ipython notebooks (*.ipynb files) are not exploitable in practice. Before validating a notebook vulnerability ensure it is concrete and has a very specific attack path where untrusted input can trigger the vulnerability.
156
+ > 11. Logging non-PII data is not a vulnerability even if the data may be sensitive. Only report logging vulnerabilities if they expose sensitive information such as secrets, passwords, or personally identifiable information (PII).
157
+ > 12. Command injection vulnerabilities in shell scripts are generally not exploitable in practice since shell scripts generally do not run with untrusted user input. Only report command injection vulnerabilities in shell scripts if they are concrete and have a very specific attack path for untrusted input.
158
+ >
159
+ > SIGNAL QUALITY CRITERIA - For remaining findings, assess:
160
+ > 1. Is there a concrete, exploitable vulnerability with a clear attack path?
161
+ > 2. Does this represent a real security risk vs theoretical best practice?
162
+ > 3. Are there specific code locations and reproduction steps?
163
+ > 4. Would this finding be actionable for a security team?
164
+ >
165
+ > For each finding, assign a confidence score from 1-10:
166
+ > - 1-3: Low confidence, likely false positive or noise
167
+ > - 4-6: Medium confidence, needs investigation
168
+ > - 7-10: High confidence, likely true vulnerability
169
+
170
+ START ANALYSIS:
171
+
172
+ Begin your analysis now. Do this in 3 steps:
173
+
174
+ 1. Spawn one subagent via the Agent tool to identify vulnerabilities. Have it use the repository exploration tools to understand the codebase context, then analyze the PR changes for security implications. In the prompt for this subagent, include all of the above. If the Agent tool is not available in your current tool set, do this step yourself in this context instead.
175
+ 2. Then for each vulnerability the first step identified, spawn a new subagent via the Agent tool to filter out false-positives. Launch these as parallel Agent subagents. In the prompt for each, include everything in the "FALSE POSITIVE FILTERING" instructions. (Without the Agent tool, run this filtering pass yourself.)
176
+ 3. Filter out any vulnerabilities where the filtering step reported a confidence less than 8.
177
+
178
+ Your final reply must contain the markdown report and nothing else.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: simplify
3
+ description: >
4
+ Review the changed code for reuse, simplification, efficiency, and altitude
5
+ cleanups, then apply the fixes. Quality only — it does not hunt for bugs; use
6
+ code-review for that.
7
+ ---
8
+
9
+ `/simplify → 4 cleanup agents in parallel → apply the fixes`
10
+
11
+ You are improving the quality of the changed code, not hunting for bugs. Review
12
+ it for reuse, simplification, efficiency, and altitude issues, then fix what you
13
+ find. Do not look for correctness bugs — that is what `/code-review` is for.
14
+
15
+ ## Phase 0 — Gather the diff
16
+
17
+ Run `git diff @{upstream}...HEAD` (or `git diff main...HEAD` / `git diff HEAD~1`
18
+ if there's no upstream) to get the unified diff under review. If there are
19
+ uncommitted changes, or the range diff is empty, also run `git diff HEAD` and
20
+ include the working-tree changes in scope — the review often runs before the
21
+ commit. If a PR number, branch name, or file path was passed as an argument,
22
+ review that target instead. Treat this diff as the review scope.
23
+
24
+ ## Phase 1 — Review (4 cleanup agents in parallel)
25
+
26
+ Launch **4 independent review agents** via the Agent tool, all in a
27
+ single message so they run concurrently. Pass each agent the diff and one of
28
+ the four angles below. Each returns its findings with `file`, `line`, a
29
+ one-line `summary`, and the concrete cost (what is duplicated, wasted, or
30
+ harder to maintain). If the Agent tool is not available in your current tool
31
+ set, do not error — work through all four angles yourself, sequentially, in
32
+ this same context.
33
+
34
+ ### Reuse
35
+
36
+ Flag new code that re-implements something the codebase
37
+ already has — Grep shared/utility modules and files adjacent to the change,
38
+ and name the existing helper to call instead.
39
+
40
+ ### Simplification
41
+
42
+ Flag unnecessary complexity the diff adds: redundant or derivable state,
43
+ copy-paste with slight variation, deep nesting, dead code left behind. Name
44
+ the simpler form that does the same job.
45
+
46
+ ### Efficiency
47
+
48
+ Flag wasted work the diff introduces: redundant computation or repeated I/O,
49
+ independent operations run sequentially, blocking work added to startup or
50
+ hot paths. Also flag long-lived objects built from closures or captured
51
+ environments — they keep the entire enclosing scope alive for the object's
52
+ lifetime (a memory leak when that scope holds large values); prefer a
53
+ class/struct that copies only the fields it needs. Name the cheaper
54
+ alternative.
55
+
56
+ ### Altitude
57
+
58
+ Check that each change is implemented at the right depth, not as a fragile
59
+ bandaid. Special cases layered on shared infrastructure are a sign the fix
60
+ isn't deep enough — prefer generalizing the underlying mechanism over adding
61
+ special cases.
62
+
63
+ ## Phase 2 — Apply the fixes
64
+
65
+ Wait for all four agents to complete, dedup findings that point at the same
66
+ line or mechanism, and fix each remaining one directly. Skip any finding whose
67
+ fix would change intended behavior, require changes well outside the reviewed
68
+ diff, or that you judge to be a false positive — note the skip rather than
69
+ arguing with it. Finish with a brief summary of what was fixed and what was
70
+ skipped (or confirm the code was already clean).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
3
- "name": "one-code-light",
3
+ "name": "onecode-light",
4
4
  "vars": {
5
5
  "clay": "#c05f38",
6
6
  "clayDeep": "#9c4a29",
@@ -72,5 +72,10 @@
72
72
  "thinkingXhigh": "red",
73
73
  "thinkingMax": "violet",
74
74
  "bashMode": "amber"
75
+ },
76
+ "export": {
77
+ "pageBg": "#faf7f3",
78
+ "cardBg": "surface",
79
+ "infoBg": "surfaceRaised"
75
80
  }
76
81
  }