Skip to content

BYO Context: auto-detect the coding-agent type and support more BYO agent providers #2090

Description

@liuchao-001

Current behavior

first-tree context enable requires --provider claude-code|codex. Each provider is a native driver under apps/cli/src/core/context-integration/providers/ (Claude Code: user-scope plugin lifecycle; Codex: hooks plus the /hooks trust flow). The BYO setup prompt therefore has to carry two provider-specific commands and ask the agent to pick one.

Goals

  1. Auto-detect the calling coding agent. When the CLI is invoked from inside a coding-agent session, detect the agent type from environment markers (e.g. Claude Code sets CLAUDECODE=1; identify the equivalent for Codex and others) and make --provider an optional override. The setup prompt then collapses to a single enable command.
  2. Support more BYO agent types. Broaden beyond Claude Code and Codex (candidates: OpenCode, Cursor, Gemini CLI, …), auto-adapting the plugin/hook install mechanics per provider via new drivers.
  3. Degraded mode for hook-less agents. Agents without a SessionStart-hook surface cannot get automatic activation; design an explicit manual-activation path for them.

Constraints (from system/context-management/external-byo-context.md)

  • Provider-native consent/trust stays provider-owned (First Tree never grants or bypasses it).
  • The payload integrity contract (release digests) must hold for every provider projection.
  • Provider projections must not grow separate product or authority rules.

Related: #2077 adds an OpenCode runtime provider on the managed side; BYO drivers are a separate surface but may share detection groundwork.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions