Skip to content

feat(agent-lab): open Claude Code tasks via official Android handoff - #396

Merged
trvny merged 3 commits into
mainfrom
feat/claude-code-mobile-handoff
Oct 18, 2026
Merged

trvny merged 3 commits into
mainfrom
feat/claude-code-mobile-handoff

Conversation

@trvny

@trvny trvny commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • Add Agents → Claude Code to existing Studio Tools, with task, optional GitHub repo/branch, Plan/Code mode, and explicit confirmation.
  • Launch official Claude Code Android universal links (app or web), without capturing account credentials, using an API key, a background host or Legiona.
  • Add JVM tests for task URL encoding/validation and keep the existing Tools destination.
  • Document this as an external handoff, not a native Claude Agent SDK/API or subscription broker.

Validation

This is an opt-in convenience, not a prerequisite for Aistee. Actual Claude Code entitlement and usage/extra credits remain controlled by Claude.

@kanarek-companion

kanarek-companion Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

🐤 Kanarek · 🟣 merged

main ✅

Main has acquired another resident. Welcome aboard.

Documentation, App · 7 files

@sourcery-ai

sourcery-ai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This PR adds an opt-in Studio Tools → Agents → Claude Code flow that validates and confirms a user-authored task, then launches an official Claude app/web universal link with optional GitHub context. It preserves Aistee’s existing tools and authentication boundaries, and adds JVM coverage plus documentation clarifying that Claude owns login, usage, entitlement, and billing.

Sequence diagram for the Claude Code external handoff

sequenceDiagram
    actor User
    participant Aistee as Aistee Studio Tools
    participant Claude as Official Claude app or website

    User->>Aistee: Enter task, optional repository/branch, and mode
    Aistee->>Aistee: canOpen(task, repository, branch)
    User->>Aistee: Tap Open in Claude Code
    Aistee->>User: Show confirmation dialog
    User->>Aistee: Confirm Open Claude
    Aistee->>Aistee: newSessionUrl(task, repository, branch, mode)
    Aistee->>Claude: openExternalUri(newSessionUrl)
    Claude->>User: Handle login, entitlement, usage, and billing
Loading

Flow diagram for Claude Code task validation and launch

flowchart TD
    Tools[Studio Tools] --> Agents[Agents]
    Agents --> Panel[Claude Code handoff panel]
    Panel --> Fields[Task plus optional GitHub repository and branch]
    Fields --> Mode[Plan or Code mode]
    Mode --> Valid{canOpen valid?}
    Valid -- No --> Fields
    Valid -- Yes --> Confirm[Explicit confirmation]
    Confirm -- Cancel --> Panel
    Confirm -- Open Claude --> URL[newSessionUrl]
    URL --> External[Official Claude app or website]
Loading

File-Level Changes

Change Details Files
Adds an outbound Claude Code task handoff panel to the existing Studio Tools hub.
  • Introduces an Agents section while preserving existing tool destinations and ordering.
  • Provides task entry, optional GitHub repository and branch, Plan/Code selection, validation, and explicit confirmation.
  • Opens official Claude Code universal links externally without handling credentials, tokens, API keys, files, or chats.
  • Adds a separate link to Claude Code sessions.
app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt
app/src/main/java/ais/tee/ui/screens/StudioToolsHubScreen.kt
Defines and tests URL construction and input validation for the handoff.
  • Encodes task and repository context into the official new-session URL.
  • Validates task length, repository format, branch dependencies, and branch characters.
  • Covers encoded links, modes, credential absence, invalid inputs, and section placement with JVM tests.
app/src/test/java/ais/tee/ui/screens/ClaudeCodeHandoffTest.kt
app/src/test/java/ais/tee/ui/screens/StudioToolsHubScreenTest.kt
Documents Claude Code as an independent external handoff rather than an integrated Claude runtime.
  • Adds the capability and limitations to the provider comparison.
  • Documents official-link behavior, account and entitlement boundaries, and the absence of proxying or credential brokerage.
  • Links to Anthropic’s official mobile-link and legal/compliance guidance.
README.md
docs/provider-runtime.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T23:23:05.626453Z 824da19 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mergify

mergify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 865f164e8b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt Outdated
Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt Outdated

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt" line_range="151" />
<code_context>
+                TextButton(onClick = {
+                    confirmation = false
+                    val url = ClaudeCodeHandoff.newSessionUrl(task, repository, branch, mode)
+                    notice = if (openExternalUri(context, Uri.parse(url))) null
+                        else "No app or browser could open Claude Code."
+                }) { Text("Open Claude") }
</code_context>
<issue_to_address>
**Task text leaks to logs**

When opening the handoff fails because Android has no URL handler or rejects the launch, `openExternalUri` logs the caught launch exception, whose message includes the intent URI and its task text. The composed task is exposed in logcat without the user being told.

Avoid logging the exception or intent URI, or redact the task text before logging.
</issue_to_address>

### Comment 2
<location path="app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt" line_range="68" />
<code_context>
+@Composable
+internal fun ClaudeCodeHandoffPanel(modifier: Modifier = Modifier) {
+    val context = LocalContext.current
+    var task by remember { mutableStateOf("") }
+    var repository by remember { mutableStateOf("") }
+    var branch by remember { mutableStateOf("") }
</code_context>
<issue_to_address>
**Handoff drafts disappear**

When the user switches away from Agents or Android recreates the activity while composing a handoff, `ClaudeCodeHandoffPanel` stores the draft in `remember` state, which is discarded when the panel leaves composition and is not restored after activity recreation. Returning to Agents shows an empty form and loses the task and its options.

Store the draft in state that survives both panel disposal and activity recreation, such as state hoisted to a saveable owner.

Also at `app/src/main/java/ais/tee/ui/screens/StudioToolsHubScreen.kt:65-67`.
</issue_to_address>

### Comment 3
<location path="app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt" line_range="105" />
<code_context>
+            value = branch,
+            onValueChange = { branch = it },
+            label = { Text("Branch (optional)") },
+            enabled = repository.isNotBlank(),
+            singleLine = true,
+            modifier = Modifier.fillMaxWidth().testTag("claude_code_branch"),
</code_context>
<issue_to_address>
**Branch cannot be cleared**

When the user enters a branch and then clears the repository, `branch` remains populated while the field is disabled, and `canOpen` rejects a branch without a repository. The user cannot clear the stale branch, so the Open button stays disabled.

Keep the branch field editable or clear the branch when the repository is emptied.

Also at `app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt:47`.
</issue_to_address>

### Comment 4
<location path="app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt" line_range="36-37" />
<code_context>
+    const val SESSIONS_URL = "https://claude.ai/code"
+    private const val NEW_SESSION_URL = "https://claude.ai/code/new"
+    const val MAX_TASK_CHARS = 2_000
+    private val repoPattern = Regex("^[A-Za-z0-9][A-Za-z0-9-]{0,38}/[A-Za-z0-9._-]{1,100}$")
+    private val branchPattern = Regex("^[A-Za-z0-9._/-]{1,150}$")
+
+    enum class Mode(val value: String) { PLAN("plan"), CODE("code") }
</code_context>
<issue_to_address>
**Invalid GitHub references pass**

When the user enters a repository or branch that the regex accepts but GitHub or Git rejects, or a valid branch containing `+`, `repoPattern` and `branchPattern` accept invalid names and reject some valid branch names, so `canOpen` enables unusable references or blocks valid ones; `newSessionUrl` then sends the accepted reference to Claude Code. The requested repository or branch cannot be used.

Validate repository names against GitHub naming rules and branches against Git ref rules.
</issue_to_address>

### Comment 5
<location path="app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt" line_range="144" />
<code_context>
+                Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
+                    Text("Only this task, mode and optional GitHub reference will be passed to " +
+                        "the official Claude Code composer. Aistee does not authenticate to Claude.")
+                    Text(task, maxLines = 5, style = MaterialTheme.typography.bodySmall)
+                }
+            },
</code_context>
<issue_to_address>
**Handoff payload cannot be verified**

When the task exceeds five rendered lines or the user has entered GitHub context or selected Code mode, the confirmation dialog limits the displayed task to five lines and omits the selected mode and repository and branch values, while `newSessionUrl` submits the full payload. The user cannot review what will be sent to Claude.

Show the complete task and all selected handoff options in the confirmation dialog.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 5 findings to address first, and opening the handoff URL sends the task text and optional repository details to Claude in the URL; once transmitted, reverting the feature cannot retract that disclosure. The confirmation gate limits this to an explicit user action, but a mistaken or unintended handoff could still expose information externally.

Blocking findings: app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt:151, app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt:68, app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt:105, app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt:37, app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt:144


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt
Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt Outdated
Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt
Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt Outdated
Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt Outdated
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 511ecf79-021f-4ecf-816b-c8d95896d883

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

新增 Claude Code 外部交接功能。用户可输入任务、可选 GitHub 仓库和分支,并选择 Plan 或 Code 模式。用户确认后,Aistee 尝试打开 Claude Code 应用或网站。新增 Studio Tools → Agents 入口,并补充说明和测试。

诗

石头敲出任务字
仓库分支排成行
Plan 与 Code 任君选
点头之后链接飞
Agents 小门已开启

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 824da

The new Claude Code handoff builds links that do not follow the official link format. After confirming, users may land in Claude Code without their task filled in, and without their chosen repository, branch or Plan/Code mode selected. The fixes are small URL changes, but the core feature should work before merging.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed 标题准确概括了通过官方 Android 交接打开 Claude Code 任务的主要变更。
Description check Passed 描述与变更相关。它说明了 Agents 入口、任务参数、官方链接、测试和外部交接边界。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

石头写下任务字
仓库分支排成行
Plan 和 Code 任君选
点头后链接飞
Agents 小门开启

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments: 2
app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt: 2

130-132: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

让“打开会话”入口与实际目标一致。

官方文档将 https://claude.ai/code 标为新会话编辑器,不是会话列表。用户点击“Open Claude Code sessions”时,当前代码仍打开该地址。若要打开已安装应用的会话列表,请使用文档中的 claude://code,并为浏览器回退提供准确的按钮文案;同时更新文档中的入口说明。(support.claude.com)


37-37: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

修正 Git 分支名校验。

石头人看:branchPattern 接受 main/、foo//bar 和 topic..next,但 Git 不允许这些分支名。用户可以确认交接,却无法让 Claude 预选所填分支。请按 Git refname 规则校验各个路径段,并补上这些输入的测试。(git-scm.com)


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: 880ee0d0-4f65-4db6-8908-7fb3acd7d6a2
📥 Commits

Reviewing files that changed from the base of the PR and between 39630af and 865f164.

📒 Files selected for processing: 6
  • README.md
  • app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt
  • app/src/main/java/ais/tee/ui/screens/StudioToolsHubScreen.kt
  • app/src/test/java/ais/tee/ui/screens/ClaudeCodeHandoffTest.kt
  • app/src/test/java/ais/tee/ui/screens/StudioToolsHubScreenTest.kt
  • docs/provider-runtime.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@gptomek
gptomek Bot force-pushed the feat/claude-code-mobile-handoff branch from 9558c7e to 5a4386e Compare October 17, 2026 20:58
Comment thread app/src/main/java/ais/tee/ui/screens/WebChatScreen.kt Fixed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 824da195c0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: af251d36-8b9a-4624-9e99-8c7592455535
📥 Commits

Reviewing files that changed from the base of the PR and between 865f164 and 824da19.

📒 Files selected for processing: 5
  • app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt
  • app/src/main/java/ais/tee/ui/screens/StudioToolsHubScreen.kt
  • app/src/main/java/ais/tee/ui/screens/WebNavigationSafety.kt
  • app/src/test/java/ais/tee/ui/screens/ClaudeCodeHandoffTest.kt
  • docs/provider-runtime.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt Outdated
Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt Outdated
Comment thread app/src/main/java/ais/tee/ui/screens/ClaudeCodeHandoffPanel.kt Outdated
@trvny
trvny merged commit a272996 into main Oct 18, 2026
10 checks passed
@trvny
trvny deleted the feat/claude-code-mobile-handoff branch October 18, 2026 08:53
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