Claude Code Tools

@trekagent/claude

official

One-command installer for Trek: installs the Trek Claude Code plugin (skill + hooks + MCP) from the Trek marketplace and wires your API token.

Version
0.3.0
Last Updated
2026-06-07
Source
official

@trekagent/claude

One-command installer for Trek. It installs the Trek Claude Code plugin (skill + presence hooks + remote MCP server) from the Trek marketplace and wires your API token — so an agent starts reporting presence and working the ready-task frontier the moment you restart Claude Code.

If no token is already available, init opens your browser so you can sign in or create an account and pick a project — the token (and the selected project) are then delivered straight back to the installer over a localhost loopback listener and written as TREK_TOKEN / TREK_PROJECT_ID. No copy-paste required.

Usage

# Install into the current project (writes ./.claude/settings.local.json)
npx @trekagent/claude init

# User-level (writes ~/.claude/settings.local.json)
npx @trekagent/claude init --user

# Reverse it
npx @trekagent/claude init --uninstall

Flags

FlagDefaultDescription
--project(default)Project scope — write ./.claude/settings.local.json.
--userUser scope — write ~/.claude/settings.local.json.
--token <trk_...>browser loginTrek API token (skips the browser flow).
--api-url <url>https://api.trekagent.ioTrek API base URL.
--cockpit-url <url>https://console.trekagent.ioCockpit base URL used for browser login.
--project-id <uuid>$TREK_PROJECT_IDBind a default Trek project.
--marketplace <owner>/<repo>trekagent/trek-claude-plugin or $TREK_MARKETPLACEGitHub repo hosting the plugin marketplace.
--loginForce a fresh browser login, ignoring any saved token.
--no-browserSkip the browser flow and paste a token manually.
--uninstallRemove the plugin + Trek env for the chosen scope.

How the token is resolved

init finds a token in this order:

  1. --token <trk_...> flag.
  2. $TREK_TOKEN environment variable.
  3. A trk_ token already wired into project ./.claude/settings.local.json or user ~/.claude/settings.local.json (skipped when --login is passed).
  4. Browser login (interactive terminals, unless --no-browser): opens the cockpit cli-auth page, you sign in / sign up and select a project, and the token plus the chosen project are delivered back automatically over a loopback listener bound to 127.0.0.1. The selected project is written as TREK_PROJECT_ID (an explicit --project-id still applies to the non-browser paths).
  5. Manual paste prompt — the fallback for --no-browser, non-interactive shells, or if the browser flow times out (3 min). Points you at Settings → API tokens in the cockpit.

What init does

  1. claude plugin marketplace add trekagent/trek-claude-plugin
  2. claude plugin install trek@trek
  3. Writes the token into .claude/settings.local.json (gitignored), deep-merged:
    { "env": { "TREK_TOKEN": "trk_…", "TREK_API_URL": "https://api.trekagent.io" } }

That one env block powers both the plugin’s MCP auth (Bearer ${TREK_TOKEN}) and the presence hooks (which read TREK_TOKEN / TREK_API_URL). The skill, hooks, and MCP server themselves all live in the plugin — this installer just stands it up and authenticates it.

The plugin marketplace lives at trekagent/trek-claude-plugin. Override it with --marketplace <owner>/<repo> or TREK_MARKETPLACE when testing a fork.

Idempotency

init is safe to re-run: marketplace-add / plugin-install tolerate “already present”, and the settings.local.json env block is deep-merged (never clobbers your other settings).

Next steps after install

  1. Restart Claude Code (in the project, for project scope) so it loads the Trek plugin.
  2. Approve the trek MCP server when prompted (it reads ${TREK_TOKEN}).
  3. Update later with claude plugin update trek@trek.