Skip to content

Add claude yolo mode#86

Open
Swolebrain wants to merge 1 commit into
gi11es:masterfrom
Swolebrain:master
Open

Add claude yolo mode#86
Swolebrain wants to merge 1 commit into
gi11es:masterfrom
Swolebrain:master

Conversation

@Swolebrain

Copy link
Copy Markdown

I don't have your xcode key files so i can't build and test it but this feature seems simple enough to test

Comment on lines +718 to +723
let maxNum = project.tabs
.compactMap { tab -> Int? in
guard tab.name.hasPrefix(prefix) else { return nil }
return Int(tab.name.dropFirst(prefix.count))
}
.max() ?? 0

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit: the equivalent counter in createTabInProject (around line 641) does .filter { $0.isClaude == isClaude } before extracting numbers. This one doesn't, so if a user ever renamed a terminal tab to Yolo #3 the counter would skew. Not exploitable in practice — just worth matching the existing convention.

.max() ?? 0
let tabName = "\(prefix)\(maxNum + 1)"

let baseArgs = project.defaultArgs ?? UserDefaults.standard.string(forKey: "claudeExtraArgs") ?? ""

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fallback already exists inside createTabInProject at line 664 (extraArgs ?? project.defaultArgs ?? UserDefaults.standard.string(forKey: "claudeExtraArgs") ?? ""). It works today because you pass a non-nil extraArgs: and the ?? chain short-circuits, but the two copies can drift. Consider adding something like a yolo: Bool = false parameter to createTabInProject (or passing just the extra flag to splice in) so args resolution stays in one place.

let yoloFlag = "--dangerously-skip-permissions"
let yoloArgs = baseArgs.contains(yoloFlag) ? baseArgs : (baseArgs.isEmpty ? yoloFlag : "\(baseArgs) \(yoloFlag)")

createTabInProject(project, isClaude: true, name: tabName, extraArgs: yoloArgs)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads-up: yolo state won't survive an app restart. ProjectTabState (in Sources/Session/SessionState.swift) doesn't persist extraArgs, and the restore paths at DeckardWindowController.swift:473 and :1301 call createTabInProject without passing extraArgs:. So a Yolo #1 tab reappears by name on relaunch but without --dangerously-skip-permissions — the name suggests yolo mode, but it's a normal permission-prompting session. Fix would be adding an isYolo: Bool (or extraArgs: String?) field to ProjectTabState and threading it through the restore sites.

@gi11es gi11es left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the idea — a one-keystroke "yolo" tab is a reasonable feature request, but the PR as it stands can't land:

Blocking

  1. Doesn't compile against current master. The branch predates #91 (bd3ca6e), which renamed the folder/project terminology to workspace/group. addYoloTabToCurrentProject uses projects, selectedProjectIndex, project.defaultArgs, createTabInProject(...) and finalizeTabCreation(in: project) — none of these symbols exist anymore (workspaces, selectedWorkspaceIndex, createTabInWorkspace(_:kind:name:...extraArgs:) are the current API). The hunk contexts in AppDelegate.swift are also stale (they show addTabToCurrentProject(isClaude:) and omit the Codex menu item), so the diff won't apply cleanly either. The green CI run on this PR is from January, against the tree it was written for.

  2. The yolo flag is lost on restore. --dangerously-skip-permissions is passed as transient extraArgs only; nothing is persisted on the tab. After an app restart, a "Yolo #N" tab is recreated as a normal claude tab without the flag — the mode silently disappears while the tab name still claims otherwise.

  3. Flag conflicts aren't handled. The dedup only checks for the literal --dangerously-skip-permissions substring. If workspace.defaultArgs or the global claudeExtraArgs contain --permission-mode …, the composed command mixes mutually exclusive permission flags and the tab errors out at launch.

Worth addressing too

  1. Duplication: the method re-implements both the defaultArgs → claudeExtraArgs fallback and the "#N" tab-numbering loop that createTabInWorkspace already does. After rebasing, this can shrink to: resolve the base args, append the flag, call createTabInWorkspace(workspace, kind: .claude, name: …, extraArgs: yoloArgs).

  2. Dangerous default needs friction/labeling: a default ⌘Y binding one key away from ⌘T silently launches an agent with all permission prompts disabled. Suggest no default shortcut (leave it configurable), and/or a first-use confirmation, and a clearer name like "New Claude Tab (skip permissions)".

Happy to re-review after a rebase onto current master addressing 1–3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants