Skip to main content

kubectx-like CLI for switching Codex auth profiles

Project description

agentctx

agentctx is a kubectx-like CLI for saving and switching local Codex auth profiles.

It manages copies of ~/.codex/auth.json under ~/.agentctx and atomically swaps the active auth file when you switch profiles. When saving the current auth via =., the profile name is derived from the user's email claim in the JWT. Token contents are never printed.

Install

pipx install agentctx

For local development:

poetry install
poetry run agentctx --help

Usage

agentctx                 # list profiles or open fzf selector when interactive
agentctx work            # switch to profile
agentctx login           # run Codex browser login and save auth as JWT email profile
agentctx -               # switch to previous profile
agentctx -c              # show current profile
agentctx =.              # save/rename current Codex auth as JWT email profile
agentctx user@example.com=. # same, but validate name matches JWT email
agentctx prod=work       # rename profile
agentctx -d old-profile  # delete profile
agentctx -u              # unset current marker
agentctx -V              # show version

Long aliases:

agentctx --current
agentctx --unset
agentctx --version

CRUD-style subcommands are intentionally not part of the public CLI.

Storage

~/.agentctx/
  profiles/
    <email-or-name>/
      auth.json
      metadata.json
  backups/
    auth-<timestamp>.json
  current
  previous
  lock

Active Codex auth remains:

~/.codex/auth.json

Security behavior

  • validates JSON before saving or switching;
  • rejects symlinks and non-regular auth files;
  • writes auth files atomically with temporary files in the target directory;
  • uses 0600 permissions for active, profile, and backup auth files where supported;
  • creates backups before switching profiles;
  • never prints token contents.

Development

poetry check
poetry run pytest
poetry build

Publish

make publish

make publish bumps the minor version, syncs agentctx.__version__, runs checks/tests, builds a clean dist/, and publishes with poetry publish.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentctx-0.5.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentctx-0.5.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file agentctx-0.5.0.tar.gz.

File metadata

  • Download URL: agentctx-0.5.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.6 Darwin/24.1.0

File hashes

Hashes for agentctx-0.5.0.tar.gz
Algorithm Hash digest
SHA256 cf8b2d5aa7a970e303bc02f8d6a905080ec888e87e1bf014e710bc16b2c5bc7f
MD5 2151463e682bda9f7ffae5cebbd2bdd3
BLAKE2b-256 ca671401d606142bc085ce4ab208211e67852a251403ef5095f36f09ff878630

See more details on using hashes here.

File details

Details for the file agentctx-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: agentctx-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.6 Darwin/24.1.0

File hashes

Hashes for agentctx-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 890c68f5ee1918b5eee9b71d7f3f8c1b6ea723a35b472f8184b935e06e6c0f0a
MD5 837d5711b2d2ae038165d5e9438a18f1
BLAKE2b-256 38d2f19ec6aad4e7392561252f7c06f6679e145f94f28199d0b54980b8226029

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page