Skip to content

Repository files navigation

aenv

CInpmlicense

The fast, project-local environment manager for Claude Code and Codex.

aenv initializes, audits, compares, captures, and protects AI coding environments without touching global Claude Code or Codex configuration. It is a local-first, CLI-first tool: no account, API key, daemon, cloud service, or LLM is required.

English · 简体中文

npm install -g @tinylion1024/aenv
mkdir my-agent-project &&cd my-agent-project
aenv init --provider codex --yes
aenv doctor
aenv diff

That creates a small agent-env.json manifest and a repository-level AGENTS.md. Use --provider claude-code to create the corresponding Claude Code environment.

Why use aenv?

Claude Code and Codex project instructions, MCP declarations, local settings, and credentials can drift between repositories or leak into invisible global state. aenv keeps the supported project environment explicit and reviewable.

Needaenv action
Start a Claude Code or Codex project consistentlyaenv init
Find invalid config, inline secrets, or unsafe Git stateaenv doctor
See drift from the selected recipe without changing filesaenv diff
Reuse a proven, redacted project environmentaenv capture then aenv init
Keep local agent state out of commitsautomatic local Git guard

Commands

CommandWritesResult
aenv initProject files; local .git metadata in Git repositoriesCreates only missing files from a recipe
aenv doctorNothingAudits the selected provider, configuration, secrets, context size, and Git state
aenv diffNothingReports missing, unchanged, modified, and unmanaged files
aenv capture <name>Local or explicitly selected recipe directoryCreates a provider-specific, redacted private recipe

Common automation forms:

aenv init --provider claude-code --recipe web --dry-run --cwd /path/to/project
aenv doctor --json --cwd /path/to/project
aenv diff --json --cwd /path/to/project
aenv capture team-base --cwd /path/to/project

doctor exits with 1 when a failing finding exists. diff exits with 1 when drift exists. Their JSON output is a single document suitable for CI; normal human output remains the default.

Supported environments

ProviderBaseline project filesGlobal locations never touched
Claude CodeCLAUDE.md, .claude/settings.json, optional captured .mcp.json~/.claude
Codexrepository-root AGENTS.md$CODEX_HOME, default ~/.codex

Codex project .codex/config.toml, project skills, and MCP configuration are outside aenv's managed baseline. The default Git guard treats .codex/ as protected local state; teams that intentionally version Codex project configuration must manage that policy explicitly outside aenv.

Existing files are never overwritten. agent-env.json records the selected provider and recipe so doctor, diff, and capture use an explicit environment rather than guessing.

Recipes and reuse

Built-in recipes establish concise policy, not a hidden tool bundle:

  • lean — minimal guidance; no plugins or MCP servers enabled.
  • web — web-project guidance; integrations remain opt-in.
  • research — research-project guidance; external access remains opt-in.

Capture a working environment and reuse it offline:

# Run inside a project already initialized by aenv.
aenv capture team-base
mkdir ../next-project
aenv init --provider codex --recipe team-base --yes --cwd ../next-project

Captured recipes default to ~/.agent-env/recipes/ for backward compatibility. Use --recipes-dir to select a private team directory. Capture accepts only provider-owned project files, replaces likely secrets with ${ENV_VAR}, replaces machine-specific home paths with ${LOCAL_PATH}, and writes an AUDIT.md review checklist.

Safety guarantees

  • Core commands are deterministic and require no network access.
  • aenv never reads or writes Claude Code or Codex account, credential, cache, session, or global configuration files.
  • Writes stay inside the target project, aenv's local recipe store, or an explicit recipe directory.
  • Existing project and recipe files are preserved.
  • Recipe paths are provider-scoped and reject absolute paths, traversal, duplicates, and symlinks at the root, directory, or file level.
  • Capture and audit refuse symlinked project roots, manifests, and provider-owned source files.
  • doctor and diff are always read-only and never print differing file contents.
  • In Git repositories, aenv installs local protection in the default hooks directory or a project-local core.hooksPath. It blocks local agent state and probable inline credentials while leaving CLAUDE.md and AGENTS.md versionable. An external core.hooksPath is never modified and produces a warning.

Is aenv an AI agent framework?

No. aenv does not run agents, route models, manage accounts, store credentials, or support arbitrary providers. Its scope is deliberately limited to project environment management for Claude Code and Codex.

Documentation

The primary command is aenv. The former agent-env command remains as a compatibility alias, and the existing agent-env.json / ~/.agent-env/recipes/ names remain stable for existing users.

License

MIT

About

No description, website, or topics provided.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages