Problem Statement
Setting up a sandbox for realistic developer/agent pairing currently has too much credential plumbing before the useful workflow begins.
The agent-driven policy demo shows the desired loop well, but the setup path has to manually discover and inject credentials for tools like GitHub, Codex, and Claude. In practice, this makes demos and dev workflows spend a lot of time on auth setup instead of the actual OpenShell value proposition: scoped sandbox access, policy denies, agent proposals, human approval, and hot reload.
This is especially noticeable for manual policy workflow demos. A developer may already be signed in locally with gh auth login, codex login, or Claude tooling, but openshell sandbox create --auto-providers does not currently turn that local state into a ready-to-use sandbox environment.
Proposed Design
Make local developer credential discovery and sandbox projection first-class provider behavior.
The product flow should be explicit and reviewable, not silent magic. For example:
Found local credentials:
github: gh auth token
codex: ~/.codex/auth.json
claude: ANTHROPIC_API_KEY or local Claude auth
Attach these to sandbox policy-demo-123? [Y/n]
Suggested behavior:
-
Provider plugins discover local credentials from common sources:
- GitHub:
GITHUB_TOKEN, GH_TOKEN, or gh auth token
- Codex:
OPENAI_API_KEY and/or ~/.codex/auth.json
- Claude:
ANTHROPIC_API_KEY, CLAUDE_API_KEY, and possibly Claude local auth if stable and safe
-
The CLI presents discovered credentials before importing or attaching them.
-
Provider plugins know how to project credentials into the sandbox in the form the target tool expects:
- GitHub token as
GITHUB_TOKEN
- Codex login state as a usable
~/.codex/auth.json or equivalent runtime projection
- Claude credentials in the expected env/file form
-
--auto-providers should either:
- grow into this behavior, with clear consent prompts when interactive, or
- remain narrow but be paired with a more explicit dev workflow flag, such as
--dev-access github,codex,claude.
The key UX principle: OpenShell should make the credential bridge visible and intentional, but developers should not have to hand-copy local auth state into provider records or sandbox bootstrap scripts.
Claude support should be part of the initial scope, not a follow-up. Manual pairing needs to work naturally for both Codex and Claude-style agent sessions.
Alternatives Considered
Keep credential setup in demos/scripts.
This works for the current automated policy demo, but it makes each demo reimplement provider discovery and projection logic. It also hides a real product gap: users expect local tool auth to be reusable when creating a developer sandbox.
Require users to create providers manually.
This is explicit, but too much friction for common dev pairing workflows. It also makes --auto-providers feel surprising because it does not currently discover local tool auth unless specific environment variables are already exported.
Silently import all local credentials.
This would be smoother but too opaque. The better UX is explicit discovery with a short review/confirmation step.
Implementation Pointers
The current agent-driven policy demo already prototypes the missing behavior:
examples/agent-driven-policy-management/demo.sh resolves GitHub owner and token from gh/env:
resolve_github_owner
resolve_github_token
examples/agent-driven-policy-management/demo.sh resolves Codex auth from ~/.codex/auth.json:
examples/agent-driven-policy-management/demo.sh creates generic providers from the discovered values:
examples/agent-driven-policy-management/sandbox-agent.sh projects those env vars back into the runtime shape Codex expects:
- exports
GITHUB_TOKEN
- materializes
~/.codex/auth.json
This demo behavior is a useful spike, but the durable implementation should move into provider discovery/projection rather than staying as example-specific shell glue.
Current code behavior observed during investigation:
- Provider auto-creation is driven by explicit
--provider values or command inference.
- Provider discovery currently reads known environment variables.
- GitHub provider discovery checks
GITHUB_TOKEN / GH_TOKEN, but not gh auth token.
- Codex provider discovery checks
OPENAI_API_KEY, but not ~/.codex/auth.json.
- Claude provider discovery checks
ANTHROPIC_API_KEY / CLAUDE_API_KEY; local Claude auth discovery/projection should be evaluated as part of this issue.
Relevant files:
crates/openshell-cli/src/run.rs
crates/openshell-providers/src/discovery.rs
crates/openshell-providers/src/providers/github.rs
crates/openshell-providers/src/providers/codex.rs
crates/openshell-providers/src/providers/claude.rs
examples/agent-driven-policy-management/demo.sh
examples/agent-driven-policy-management/sandbox-agent.sh
Definition of Done
Problem Statement
Setting up a sandbox for realistic developer/agent pairing currently has too much credential plumbing before the useful workflow begins.
The agent-driven policy demo shows the desired loop well, but the setup path has to manually discover and inject credentials for tools like GitHub, Codex, and Claude. In practice, this makes demos and dev workflows spend a lot of time on auth setup instead of the actual OpenShell value proposition: scoped sandbox access, policy denies, agent proposals, human approval, and hot reload.
This is especially noticeable for manual policy workflow demos. A developer may already be signed in locally with
gh auth login,codex login, or Claude tooling, butopenshell sandbox create --auto-providersdoes not currently turn that local state into a ready-to-use sandbox environment.Proposed Design
Make local developer credential discovery and sandbox projection first-class provider behavior.
The product flow should be explicit and reviewable, not silent magic. For example:
Suggested behavior:
Provider plugins discover local credentials from common sources:
GITHUB_TOKEN,GH_TOKEN, orgh auth tokenOPENAI_API_KEYand/or~/.codex/auth.jsonANTHROPIC_API_KEY,CLAUDE_API_KEY, and possibly Claude local auth if stable and safeThe CLI presents discovered credentials before importing or attaching them.
Provider plugins know how to project credentials into the sandbox in the form the target tool expects:
GITHUB_TOKEN~/.codex/auth.jsonor equivalent runtime projection--auto-providersshould either:--dev-access github,codex,claude.The key UX principle: OpenShell should make the credential bridge visible and intentional, but developers should not have to hand-copy local auth state into provider records or sandbox bootstrap scripts.
Claude support should be part of the initial scope, not a follow-up. Manual pairing needs to work naturally for both Codex and Claude-style agent sessions.
Alternatives Considered
Keep credential setup in demos/scripts.
This works for the current automated policy demo, but it makes each demo reimplement provider discovery and projection logic. It also hides a real product gap: users expect local tool auth to be reusable when creating a developer sandbox.
Require users to create providers manually.
This is explicit, but too much friction for common dev pairing workflows. It also makes
--auto-providersfeel surprising because it does not currently discover local tool auth unless specific environment variables are already exported.Silently import all local credentials.
This would be smoother but too opaque. The better UX is explicit discovery with a short review/confirmation step.
Implementation Pointers
The current agent-driven policy demo already prototypes the missing behavior:
examples/agent-driven-policy-management/demo.shresolves GitHub owner and token fromgh/env:resolve_github_ownerresolve_github_tokenexamples/agent-driven-policy-management/demo.shresolves Codex auth from~/.codex/auth.json:resolve_codex_authexamples/agent-driven-policy-management/demo.shcreates generic providers from the discovered values:create_providersexamples/agent-driven-policy-management/sandbox-agent.shprojects those env vars back into the runtime shape Codex expects:GITHUB_TOKEN~/.codex/auth.jsonThis demo behavior is a useful spike, but the durable implementation should move into provider discovery/projection rather than staying as example-specific shell glue.
Current code behavior observed during investigation:
--providervalues or command inference.GITHUB_TOKEN/GH_TOKEN, but notgh auth token.OPENAI_API_KEY, but not~/.codex/auth.json.ANTHROPIC_API_KEY/CLAUDE_API_KEY; local Claude auth discovery/projection should be evaluated as part of this issue.Relevant files:
crates/openshell-cli/src/run.rscrates/openshell-providers/src/discovery.rscrates/openshell-providers/src/providers/github.rscrates/openshell-providers/src/providers/codex.rscrates/openshell-providers/src/providers/claude.rsexamples/agent-driven-policy-management/demo.shexamples/agent-driven-policy-management/sandbox-agent.shDefinition of Done
gh auth tokenwhen env vars are absent.codex loginstate or clearly document why it cannot.