Stamp CLAUDE_CODE_ENTRYPOINT so phone-started sessions appear in the resume pickers - #108
Open
jankarres wants to merge 1 commit into
Open
Stamp CLAUDE_CODE_ENTRYPOINT so phone-started sessions appear in the resume pickers#108jankarres wants to merge 1 commit into
jankarres wants to merge 1 commit into
Conversation
Claude Code records an entrypoint on every transcript record, and both of its resume pickers drop the ones that look machine-driven: /resume in the CLI and the session list in the VS Code extension each filter sdk-cli, sdk-ts and sdk-py. The Agent SDK that the ACP adapter runs on stamps sdk-ts unless the variable is already set, so a session started from the phone is written to ~/.claude/projects like any other and is then invisible at the desk, which is where you would want to pick it up. Set CLAUDE_CODE_ENTRYPOINT=shellular at spawn time, and only when the operator has not set one, the way the SDK itself does it. Baking it into the descriptor would win over an inherited value, since spawnAgentProcess merges the descriptor env over process.env. The value matters: cli is rewritten to sdk-cli when Claude Code runs under the SDK and is filtered again. Anything outside that set works, and shellular also labels the transcript by where it came from.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sessions started from the app are written to
~/.claude/projectslike any other, and then neither/resumenor the VS Code session list will show them, because the Agent SDK stamps themsdk-tsand both pickers filter that out. This setsCLAUDE_CODE_ENTRYPOINT=shellularwhen the host spawns the Claude Code adapter, which is all it takes. Closes #107.ClaudeCodeoverridesspawnEnvOverride(), the hookACPalready provides for exactly this, and returns the value only when the operator has not exported one of their own. That is deliberate rather than lazy:spawnAgentProcessmerges the descriptor env overprocess.env, so putting it inBUILTIN_AGENT_DESCRIPTORSwould silently beat anyone who sets it themselves. The SDK defaults its own value the same way.The value is not arbitrary.
cliis rewritten tosdk-cliunder the SDK and lands back on the filter list; anything else outsidesdk-cli,sdk-tsandsdk-pyworks, andshellularalso labels the transcript with where the session came from.How I checked it
Built the CLI, pointed it at a local central and relay, paired the app and opened the agent's session list, since that is what makes the host spawn the adapter in the first place. Then read the environment out of
/procrather than trusting the code.With nothing exported, the host process has no
CLAUDE_CODE_ENTRYPOINTand the adapter underneath it comes up withshellular. Restart the same host withCLAUDE_CODE_ENTRYPOINT=operator-choiceand the adapter comes up withoperator-choice, so exporting your own still wins.tsc --noEmitandbiome checkare clean, and there are no tests in the package to add to. CI here only checks thatcli/schema.sqlis in sync; nothing in this change touches a migration, and regenerating it leaves the file untouched.Before you merge
shellularas the value is the part I would expect an opinion on, since it is what ends up in every transcript record. Any string outside the three filtered ones does the job.If anything here should be different, tell me and I will take care of it.