actas 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,692 @@
1
+ Metadata-Version: 2.5
2
+ Name: actas
3
+ Version: 2.0.0
4
+ Summary: Act as the right identity (LLM provider, cloud accounts, GitHub, git, secrets) for every project, in every terminal and agent.
5
+ Project-URL: Homepage, https://github.com/TsenkoTsenkov/actas
6
+ Project-URL: Documentation, https://github.com/TsenkoTsenkov/actas#readme
7
+ Project-URL: Changelog, https://github.com/TsenkoTsenkov/actas/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/TsenkoTsenkov/actas/issues
9
+ Project-URL: Funding, https://buymeacoffee.com/tsenkotsenkov
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai-agents,aws,azure,claude,codex,credentials,direnv,gcp,gemini,github,sops
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Topic :: Security
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.9
25
+ Requires-Dist: pyyaml>=6
26
+ Description-Content-Type: text/markdown
27
+
28
+ # actas
29
+
30
+ [![test](https://github.com/TsenkoTsenkov/actas/actions/workflows/test.yml/badge.svg)](https://github.com/TsenkoTsenkov/actas/actions/workflows/test.yml)
31
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
32
+ ![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)
33
+ [![Buy Me a Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-support-FFDD00?logo=buymeacoffee&logoColor=black)](https://buymeacoffee.com/tsenkotsenkov)
34
+
35
+ **Give every project its own LLM provider, cloud accounts, GitHub account, git
36
+ identity and secrets, in every terminal and every AI agent, without letting
37
+ the agent promote itself to your admin account.**
38
+
39
+ ```console
40
+ $ actas exec client-a -- terraform apply # act as client-a for one command
41
+ ```
42
+
43
+ **Who it is for:** you run Claude Code, Codex or Gemini CLI across several
44
+ clients, employers or personal accounts, and you are tired of `gh auth switch`,
45
+ of `AWS_PROFILE` leaking between terminals, and of an agent pushing with the
46
+ wrong GitHub account or running against the wrong AWS account.
47
+
48
+ actas keeps every context in one manifest. It picks the profile from the
49
+ directory you are in and applies it to **one process**: Claude Code, Codex,
50
+ Gemini CLI, `terraform`, `aws`, or any other command. Secrets stay references
51
+ (`keychain:`, `sops:`, `op://`) until the moment they are needed.
52
+
53
+ **What no account switcher does:** an agent may act as another profile only if
54
+ you allowed it, never at a higher privilege level, and never for a profile
55
+ marked `confirm`. For those it stops and hands you the exact command to run
56
+ yourself in your own terminal.
57
+
58
+ [![actas demo: one manifest of profiles and roles; two terminals side by side as different accounts; an agent acting as another allowed profile and refused a more powerful one; the human approving it in their own terminal](docs/demo/actas-demo.gif)](docs/demo/actas-demo.mp4)
59
+
60
+ One manifest, two terminals running as two different accounts at once, any
61
+ agent or CLI, `status --why`, and an agent that pushes as another profile you
62
+ allowed but is refused a more powerful one until you approve it in your own
63
+ terminal.
64
+
65
+ ```console
66
+ $ cd ~/code/client-a/api
67
+ $ actas run
68
+ actas: cleared from your shell: ANTHROPIC_API_KEY, AWS_ACCESS_KEY_ID
69
+ actas: client-a · standard · gateway · aws:client-a-dev · gh:ada-client-a
70
+
71
+ $ actas exec -- aws sts get-caller-identity # any command, same identity
72
+ $ actas run -t codex # another agent, same identity
73
+ ```
74
+
75
+ - **Works with any CLI or agent.** Claude Code is first-class: providers,
76
+ settings, permission rules, and Desktop and IDE support. Codex and Gemini
77
+ CLI get their own login home per account. Everything else runs through
78
+ `actas exec`.
79
+ - **Nothing global changes when you run a profile.** No `gh auth switch`, no
80
+ edits to `~/.gitconfig` or `~/.aws/config`. Two terminals can be two different people in two
81
+ different accounts at the same time.
82
+ - **No secrets in the clear.** The manifest holds references such as
83
+ `keychain:actas/client-a` or `sops:client-a/token`. They are resolved at
84
+ launch or when used, and never written to a file in clear text.
85
+ - **Agent-aware.** Agents get rules tied to the profile's privilege level, and
86
+ actas refuses to let an agent switch itself to a more powerful profile.
87
+ - **One file, standard library only.** A single Python 3.9+ script. Runs on
88
+ macOS and Linux, and on Windows through WSL.
89
+
90
+ > [!NOTE]
91
+ > Coming from v1? Your manifest keeps working; see
92
+ > [Upgrading from v1](#upgrading-from-v1).
93
+
94
+ [Install](#install) · [Quick start](#quick-start) · [Common setups](#common-setups) · [Roles and levels](#roles-levels-and-permission-sets) · [AI agents](#ai-agents) · [Where it works](#where-it-works) · [How it compares](#how-it-compares) · [Docs](#documentation) · [Upgrading from v1](#upgrading-from-v1)
95
+
96
+ ## Install
97
+
98
+ One line per platform. Each puts `actas` on your PATH; then run
99
+ `actas init && actas doctor` (see [Quick start](#quick-start)).
100
+
101
+ | Platform | Command |
102
+ |---|---|
103
+ | macOS, Linux: **uv** (recommended) | `uv tool install actas` |
104
+ | macOS, Linux: pipx | `pipx install actas` |
105
+ | macOS, Linux: Homebrew | `brew tap tsenkotsenkov/actas https://github.com/TsenkoTsenkov/actas && brew install actas` |
106
+ | macOS, Linux: no Python tooling | `curl -fsSL https://github.com/TsenkoTsenkov/actas/releases/latest/download/install.sh \| sh` |
107
+ | Windows | Install [WSL](https://learn.microsoft.com/windows/wsl/install) (`wsl --install` in PowerShell), then use a Linux line inside it |
108
+ | Try it without installing | `uvx actas --help` |
109
+
110
+ To run the latest `main` instead of a release:
111
+
112
+ ```bash
113
+ uv tool install git+https://github.com/TsenkoTsenkov/actas
114
+ ```
115
+
116
+ (or `pipx install git+…`, or `brew install --HEAD actas` after the tap).
117
+
118
+ You need Python 3.9 or later: macOS has it with the Xcode Command Line
119
+ Tools, Linux distributions ship it, and uv fetches one itself. The uv, pipx
120
+ and Homebrew installs include a YAML parser (PyYAML, or `yq` for Homebrew).
121
+ Native Windows is not supported: actas uses POSIX process and file APIs, so it
122
+ runs under WSL.
123
+
124
+ **Updating.** `uv tool upgrade actas`, `pipx upgrade actas`,
125
+ `brew upgrade actas`, or re-run the install.sh line. To remove it, see
126
+ [Uninstall](#uninstall).
127
+
128
+ The install carries the Claude Code skill and the direnv function, so you need
129
+ no checkout for them: `actas setup skill` writes
130
+ `~/.claude/skills/actas/SKILL.md`, and `actas setup direnv` writes
131
+ `~/.config/direnv/lib/actas.sh`. Run them again after an upgrade.
132
+ `actas --version` names the install: `actas 2.0.0 (package)` for uv or pipx
133
+ (plus the git commit when it recorded one), `(git <commit>)` for a checkout.
134
+
135
+ **Tab completion** for commands, options and profile names:
136
+ `eval "$(actas completion bash)"` in `~/.bashrc`, `eval "$(actas completion zsh)"`
137
+ in `~/.zshrc` (after `compinit`), or
138
+ `actas completion fish > ~/.config/fish/completions/actas.fish`.
139
+
140
+ <details>
141
+ <summary>install.sh details</summary>
142
+
143
+ It downloads the single-file release asset, checks its SHA-256 against the
144
+ release's `SHA256SUMS` and installs it as `~/.local/bin/actas` (`--dir` to
145
+ change). It never uses sudo, and it refuses to write through a symlink. uv
146
+ and pipx also link into `~/.local/bin`: install.sh does not replace their
147
+ `actas`, so switching from one of them means `uv tool uninstall actas` (or
148
+ `pipx uninstall actas`) first. Options: `--version TAG`, `--dir DIR`,
149
+ `--force`; pass them after `sh -s --`. To read the script before running it:
150
+
151
+ ```bash
152
+ curl -fsSLO https://github.com/TsenkoTsenkov/actas/releases/latest/download/install.sh
153
+ sh install.sh --help
154
+ ```
155
+
156
+ Without `--version` it installs the latest stable release. Run the
157
+ `gh attestation verify` command it prints to check that the file was built by
158
+ this repository's release workflow.
159
+
160
+ </details>
161
+
162
+ <details>
163
+ <summary>A git checkout with a symlink (for contributors)</summary>
164
+
165
+ Update with `git pull`.
166
+
167
+ ```bash
168
+ git clone https://github.com/TsenkoTsenkov/actas ~/.local/share/actas
169
+ mkdir -p ~/.local/bin
170
+ ln -s ~/.local/share/actas/bin/actas ~/.local/bin/actas # any directory on your PATH
171
+ ```
172
+
173
+ </details>
174
+
175
+ <details>
176
+ <summary>Optional tools</summary>
177
+
178
+ Everything except Python 3.9+ is optional:
179
+
180
+ | Tool | Needed for |
181
+ |---|---|
182
+ | PyYAML or `yq` (mikefarah/yq, or Debian/Ubuntu's `yq` package) | a YAML manifest. The uv/pipx install includes PyYAML. Otherwise use `brew install yq` (macOS), `sudo apt install python3-yaml` or `yq` (Debian/Ubuntu), or `python3 -m pip install --user pyyaml` where pip allows it. Without a parser, write the manifest as JSON; `actas doctor` says which parser is missing. |
183
+ | [Claude Code](https://code.claude.com), `codex`, `gemini` | `actas run` with that tool |
184
+ | `aws`, `gcloud`, `az`, `gh` | that module's logins and probes |
185
+ | `sops` + `age` | `sops:` secrets |
186
+ | `op` | `op://` secrets |
187
+
188
+ </details>
189
+
190
+ <details>
191
+ <summary>Setting up sops + age</summary>
192
+
193
+ For `sops:` secrets (optional; `keychain:`, `op://` and `gh:` refs do not
194
+ need it):
195
+
196
+ ```bash
197
+ brew install sops age # or your package manager
198
+ mkdir -p ~/.config/sops/age
199
+ age-keygen -o ~/.config/sops/age/keys.txt && chmod 600 ~/.config/sops/age/keys.txt
200
+ actas init # writes ~/.config/actas/.sops.yaml for that key
201
+ actas secret set sops:client-a/token # prompted
202
+ ```
203
+
204
+ </details>
205
+
206
+ Your configuration lives in `~/.config/actas` (`ACTAS_ROOT`), separate from
207
+ this repository. Keep it private.
208
+
209
+ ### Uninstall
210
+
211
+ 1. Undo `actas sync` first. Synced repos call the actas binary from
212
+ `.claude/settings.local.json` (a SessionStart hook, and `apiKeyHelper` for
213
+ gateway and API-key profiles), so they break once it is gone:
214
+
215
+ ```bash
216
+ actas sync --clean --all --dry-run # list what would be removed
217
+ actas sync --clean --all # add --force for files it keeps (it says why)
218
+ ```
219
+
220
+ It removes only what actas wrote (your own keys stay) and works without a
221
+ manifest.
222
+ 2. Remove the program: `uv tool uninstall actas`, `pipx uninstall actas` or
223
+ `brew uninstall actas` (then `brew untap tsenkotsenkov/actas`);
224
+ `rm ~/.local/bin/actas` for install.sh; for a checkout,
225
+ `rm ~/.local/bin/actas && rm -rf ~/.local/share/actas`.
226
+ 3. Optionally remove what actas kept: `~/.claude/skills/actas` and
227
+ `~/.config/direnv/lib/actas.sh` (from `actas setup`), `~/.cache/actas`,
228
+ `~/.local/state/actas` (managed homes, the sync ledger, the audit log) and
229
+ `~/.config/actas` (your manifest, and `secrets.enc.yaml`: keep a copy if
230
+ you may want the secrets). Keychain, 1Password and `gh` entries are left
231
+ where they are.
232
+
233
+ ## Quick start
234
+
235
+ This takes about a minute.
236
+
237
+ **1. Create the config directory.** `actas init` writes a short, commented
238
+ version 2 starter to `~/.config/actas/environments.yaml`. Its git identity
239
+ comes from your global git config; without one, the `git:` line stays
240
+ commented out. It never overwrites an existing file, and it works without sops. It writes YAML when PyYAML or
241
+ `yq` is available (the uv/pipx install includes PyYAML) and JSON otherwise.
242
+
243
+ ```bash
244
+ actas init
245
+ ```
246
+
247
+ **2. Describe your contexts.** Replace the starter with something like this
248
+ (if `init` wrote JSON, install a YAML parser first, see [Install](#install),
249
+ or write the same structure as JSON):
250
+
251
+ ```yaml
252
+ version: 2
253
+ profiles:
254
+ personal:
255
+ match: ~/code/personal
256
+ git: { name: Ada Example, email: ada@example.com }
257
+ github: { auth: "gh:ada-personal" }
258
+ aws: { profile: personal, region: eu-west-1 }
259
+ client-a:
260
+ match: ~/code/client-a
261
+ git: { name: Ada Example, email: ada@client-a.example }
262
+ github: { auth: "gh:ada-client-a" }
263
+ aws: { profile: client-a-dev, region: eu-west-1 }
264
+ claude: { provider: gateway, base_url: "https://llm.client-a.example", token: "keychain:actas/client-a" }
265
+ ```
266
+
267
+ - `match`: the directories this profile applies to, including subdirectories. Globs work, and the longest match wins.
268
+ - `github.auth: "gh:<login>"`: an account you already signed in to with `gh auth login`. actas reads its token without switching gh's active account.
269
+ - `aws.profile`: a profile from `~/.aws/config`.
270
+ - `claude`: the default is your claude.ai subscription. Here `client-a` uses the client's LLM gateway, with the token in the macOS Keychain.
271
+
272
+ **3. Store the token.** You are prompted for it, so it never lands in shell
273
+ history or in `ps`.
274
+
275
+ ```bash
276
+ actas secret set keychain:actas/client-a
277
+ ```
278
+
279
+ On Linux, use a `sops:`, `op://` or `cmd:` ref instead (see
280
+ [secret schemes](#secret-schemes)).
281
+
282
+ **4. Check, then launch.**
283
+
284
+ ```bash
285
+ actas status --cwd ~/code/client-a # which profile applies there, and what it sets
286
+ actas doctor # tools, manifest problems, missing logins, leaking shell exports
287
+ cd ~/code/client-a && actas run # Claude Code as client-a
288
+ ```
289
+
290
+ `actas status --why` shows where each value comes from. `actas list` shows
291
+ every profile.
292
+
293
+ ## Common setups
294
+
295
+ **Two claude.ai subscriptions.** `claude.home` gives a profile its own Claude
296
+ Code login, settings and history (through `CLAUDE_CONFIG_DIR`). Run `/login`
297
+ once inside its first session. This works wherever actas sets the environment:
298
+ `actas run`, `actas exec`, or a shell after `eval "$(actas shell work)"`.
299
+ Claude Desktop, the IDE extensions and a bare `claude` started without actas's
300
+ environment keep the app's single login (one claude.ai account per app; see
301
+ [docs/desktop.md](docs/desktop.md)).
302
+
303
+ ```yaml
304
+ work:
305
+ match: ~/code/oss-work
306
+ claude: { home: work } # ~/.local/state/actas/homes/claude/work
307
+ ```
308
+
309
+ A new home starts empty: it has none of your main home's user settings,
310
+ plugins, MCP servers or `CLAUDE.md`.
311
+
312
+ **A client with its own gateway, AWS and GitHub.** This is `client-a` in the
313
+ quick start. Inside `~/code/client-a`, Claude talks to the gateway, `aws` uses
314
+ `client-a-dev`, `gh` and HTTPS `git push` use `ada-client-a`, and commits carry
315
+ the client email. A repo cloned over SSH (`git@github.com:…`) pushes with
316
+ whatever key `ssh` picks, usually your personal one: add
317
+ `git: { ssh_key: ~/.ssh/id_ed25519_client_a }` to the profile, which makes git
318
+ use only that key. A stray `AWS_ACCESS_KEY_ID`, `ANTHROPIC_API_KEY` or another
319
+ client's `GIT_AUTHOR_EMAIL` in your shell cannot leak in: actas clears the variables of every module your
320
+ manifest uses, unless the profile sets them.
321
+
322
+ **No cloud account at all.** `aws: null` in a profile makes the AWS CLI see an
323
+ empty config.
324
+
325
+ **Agents that work across all your accounts.** By default an agent stays in
326
+ the profile its session started with: from a `personal` session it cannot
327
+ push as your work GitHub account, and it hands you the command to run
328
+ instead. To let agents use any of your everyday profiles, allow them all:
329
+
330
+ ```yaml
331
+ defaults:
332
+ agents_may_use: ["*"] # any profile at the same or a lower level
333
+ ```
334
+
335
+ The agent then runs `actas exec work -- git push` itself. Profiles with
336
+ `confirm: true` or a higher level still need you, and a profile can opt out
337
+ with `agents_may_use: []`. This also works in a v1 manifest.
338
+
339
+ **Read-only by default, power on demand.** See the next section.
340
+
341
+ More setups (GitLab, Bitbucket, npm, uv/pip, cargo, Docker, Kubernetes,
342
+ Terraform Cloud, Vault, other agents, direnv) are written as roles in
343
+ [docs/recipes.md](docs/recipes.md).
344
+
345
+ ## Roles, levels and permission sets
346
+
347
+ When one client needs more than one identity, split the pieces into **roles**
348
+ and combine them with `use:`. A role is a profile fragment that never runs on
349
+ its own. A **permission set** is just a role that carries agent rules.
350
+
351
+ Each profile has a **level**: `readonly`, `standard` (the default) or `power`.
352
+ The level says how much the credentials can do. It picks the built-in agent
353
+ rules (below) and limits which profiles an agent may switch to.
354
+ `confirm: true` makes a human type the profile name before it runs. Agents can
355
+ never run a `confirm` profile.
356
+
357
+ ```yaml
358
+ version: 2
359
+ defaults:
360
+ git: { name: Ada Example, email: ada@example.com }
361
+
362
+ roles:
363
+ gh-personal-ro: # fine-grained, read-only PAT
364
+ level: readonly
365
+ github: { auth: "sops:personal/gh_ro_pat" }
366
+ aws-personal-ro:
367
+ level: readonly
368
+ aws: { profile: personal-readonly, region: eu-west-1 }
369
+ aws-personal-power:
370
+ level: power
371
+ aws: { profile: personal-poweruser } # region still comes from aws-personal-ro
372
+ no-pulumi: # a permission set
373
+ permissions: { deny: ["Bash(pulumi up *)", "Bash(pulumi destroy *)"] }
374
+
375
+ profiles:
376
+ personal:
377
+ match: [~/code/personal, ~/code/sandbox-*]
378
+ use: [gh-personal-ro, aws-personal-ro, no-pulumi] # level: readonly
379
+ personal-power: # personal, plus AWS PowerUser
380
+ use: [personal, aws-personal-power] # level: power
381
+ confirm: true # a human types "personal-power"
382
+ ```
383
+
384
+ `personal-power` keeps everything from `personal`: the read-only PAT, the
385
+ region, the git identity and the `no-pulumi` rules. Only the AWS profile
386
+ becomes PowerUser. It has no `match`, so it never applies by directory. You
387
+ use it by name, one command at a time:
388
+
389
+ ```console
390
+ $ actas exec personal-power -- terraform apply
391
+ Elevate this shell -> personal-power (power) to run: terraform apply.
392
+ Type the profile name to continue:
393
+ ```
394
+
395
+ `actas status personal-power --why` shows where each value comes from:
396
+
397
+ ```text
398
+ chain defaults -> gh-personal-ro -> aws-personal-ro -> no-pulumi -> personal -> aws-personal-power -> personal-power
399
+ aws.profile = personal-poweruser (from aws-personal-power, was personal-readonly from aws-personal-ro)
400
+ aws.region = eu-west-1 (from aws-personal-ro)
401
+ ```
402
+
403
+ **Built-in agent rules per level.** actas renders these as Claude Code
404
+ permission rules. "allow" means no rule is added; actas never adds allow
405
+ rules.
406
+
407
+ | | readonly | standard | power |
408
+ |---|---|---|---|
409
+ | edit local files | allow | allow | allow |
410
+ | `git push`, `gh pr merge`, `gh release` | deny | ask | allow |
411
+ | `terraform apply`, `kubectl apply`, `cdk deploy`, `aws * delete-*`, … | deny | ask | ask |
412
+ | read secrets (`actas secret`, `sops`, `gh auth token`, credential files) | deny | deny | deny |
413
+ | `actas exec`, `run`, `login`, `sync` | ask | ask | ask |
414
+
415
+ "Readonly" means read-only toward remote systems and credentials. It is not
416
+ plan mode: local edits are allowed. `permissions.builtin: false` turns the
417
+ built-in rules off for a profile; your own `deny`/`ask` lists still apply.
418
+
419
+ **The four rules.** Everything in the manifest follows them:
420
+
421
+ 1. **Later layers win, maps merge.** A profile's own keys override what it
422
+ `use:`s, key by key (a layer is `defaults`, a role you `use:`, or the
423
+ profile itself). Restriction lists such as `permissions.deny` and `unset`
424
+ are combined, never dropped.
425
+ 2. **`null` means off: the tool sees no account.** `aws: null` points the AWS
426
+ CLI at an empty config, so it cannot fall back to your `[default]` profile.
427
+ `"inherit"` passes your shell's values through instead.
428
+ 3. **Compose upward.** A profile is at least as privileged as anything it
429
+ uses. A profile that declares `level: readonly` but uses a `power` role is
430
+ an error.
431
+ 4. **A secret is always `scheme:path`.** For example `sops:client-a/token`,
432
+ `keychain:actas/gw`, `op://vault/item/field`, `gh:ada-personal` or
433
+ `cmd:["pass", "show", "x"]`. A bare value where a secret is expected is an
434
+ error.
435
+
436
+ A manifest has five top-level keys: `version: 2`, `profiles`, `roles`,
437
+ `defaults` and `fallback`; unknown keys get a "did you mean" warning. Full
438
+ schema, merge rules and every key: [docs/manifest.md](docs/manifest.md).
439
+ Complete examples: [examples/environments.yaml](examples/environments.yaml)
440
+ and [examples/minimal.yaml](examples/minimal.yaml) (the quick-start manifest).
441
+
442
+ ## What actas supports
443
+
444
+ ### Modules
445
+
446
+ | Key | What it sets | Notes |
447
+ |---|---|---|
448
+ | `aws` | `AWS_PROFILE`, `AWS_REGION`, `AWS_DEFAULT_REGION`, optional `AWS_CONFIG_FILE` | `actas login` runs `aws sso login`; Claude Code gets `awsAuthRefresh` |
449
+ | `gcp` | `CLOUDSDK_*` project, region, configuration and impersonation; `home:` gives an isolated gcloud config | `actas login --module gcp [--adc]` |
450
+ | `azure` | `ARM_SUBSCRIPTION_ID`, `ARM_TENANT_ID`; `home:` gives an isolated `AZURE_CONFIG_DIR` | Without `home`, `az` keeps using `~/.azure`'s current subscription; only Terraform is pinned |
451
+ | `github` | `GH_TOKEN`/`GITHUB_TOKEN` (or the Enterprise variables) and a git credential helper for HTTPS | `auth: "gh:<login>[@host]"` or any secret ref; `home:` gives an isolated `gh` login |
452
+ | `git` | name, email, SSH key, signing, per-URL credentials, raw config | Set per process through `GIT_CONFIG_*`; `~/.gitconfig` is never touched |
453
+ | `env` | plain variables | Not secret: `sync` may write them to settings files |
454
+ | `secret_env` | `VAR: <ref>` | Resolved at launch, into the process environment only |
455
+
456
+ Everything else (GitLab, Bitbucket, Azure DevOps, npm, uv/pip, cargo, Docker,
457
+ kube, Terraform Cloud, Vault, …) is a role built from `env`, `secret_env` and
458
+ `git.credentials`: see [docs/recipes.md](docs/recipes.md).
459
+
460
+ ### Tools
461
+
462
+ | `tool:` | Support |
463
+ |---|---|
464
+ | `claude` (default) | Providers `subscription`, `gateway`, `api-key`, `bedrock` and `vertex`. A separate login per `claude.home`. Generated settings with permission rules, and a SessionStart note that tells Claude which profile it is in. The gateway token reaches Claude through `apiKeyHelper` and is not exported. |
465
+ | `codex` | `codex.home` gives each account its own `CODEX_HOME`. `actas login` signs in with ChatGPT, or pipes an API key on stdin. Nothing secret is exported. Permission rules are not rendered for Codex yet. |
466
+ | `gemini` | `gemini.home`, an API key or Vertex. `--approval-mode` follows the level: `auto_edit` for power, `default` otherwise. |
467
+ | anything else | `actas exec <profile> -- <command>`: Cursor, Copilot CLI, Aider, opencode, Goose, or any CLI. |
468
+
469
+ Codex and Gemini are supported at the environment level in 2.0. Some details
470
+ (Codex's environment filter and API-key login, Gemini's Vertex variable) are
471
+ not yet verified against the real tools.
472
+
473
+ ### Secret schemes
474
+
475
+ | Ref | Backend | `actas secret set` |
476
+ |---|---|---|
477
+ | `sops:<group>/<key>` | `~/.config/actas/secrets.enc.yaml`, encrypted with [sops](https://github.com/getsops/sops) + [age](https://github.com/FiloSottile/age), decrypted once per launch | yes (prompted or piped; passed to sops on stdin when it supports `--value-stdin`, see [secret references](docs/manifest.md#secret-references)) |
478
+ | `keychain:<service>/<account>` | the macOS Keychain | yes (`security` prompts for the value) |
479
+ | `op://vault/item/field` | the 1Password CLI (`op read`) | no, use `op` |
480
+ | `gh:<login>[@host]` | the token `gh` stores for that account | no, use `gh auth login` |
481
+ | `cmd:["prog", "arg", …]` | any program's stdout, run without a shell (`secret-tool`, `pass`, `bw`, `vault`, `doppler`, …) | no |
482
+
483
+ Exactly one trailing newline is stripped. A missing secret is a warning: the
484
+ variable stays unset and the launch goes ahead.
485
+
486
+ ## Where it works
487
+
488
+ Claude Code can start in several ways, and they do not all read the same
489
+ configuration. The full matrix is in
490
+ [docs/desktop.md](docs/desktop.md#at-a-glance).
491
+
492
+ | Surface | How | What it does not get |
493
+ |---|---|---|
494
+ | Terminal | `actas run` (Claude, Codex, Gemini) or `actas exec` (anything) | Nothing: everything applies. |
495
+ | Bare `claude`, IDE extensions, Claude Desktop (local sessions) | `actas sync` writes `.claude/settings.local.json` in each matching repo; `actas desktop <p> --print-3p` / `--vscode` print the app-wide gateway and VS Code blocks | `secret_env` values; with `github.auth`, a GitHub token (`gh` is logged out there; HTTPS `git push` still works through the helper); `claude.home`; `confirm` profiles unless `--include-confirm`. Desktop has one claude.ai account and one provider for the whole app. |
496
+ | Remote Control | as the local session it drives (`actas run` or `sync`) | Gateway, API-key, Bedrock and Vertex profiles (`actas list` shows `remote=`). |
497
+ | Cloud sessions (claude.ai/code) | Subscription only. For AWS, run `actas aws-handoff` in your terminal and paste the short-lived credentials | Local files, gateways, API keys, Bedrock/Vertex. |
498
+ | Other GUI apps, shells, direnv | `actas exec <p> -- <app binary>`, `eval "$(actas shell)"`, or `use actas` after `actas setup direnv` ([contrib/direnvrc](contrib/direnvrc)) | `--format env` and direnv get non-secret values only. Under direnv, git over HTTPS uses the profile's account, but `gh` acts as whichever account is active in gh's keyring; use `actas exec` or `github.home` for a per-profile `gh`. |
499
+
500
+ ## AI agents
501
+
502
+ Credentials follow the **session**, not the directory. An agent started by
503
+ `actas run` stays anchored to that profile, even if it `cd`s elsewhere.
504
+
505
+ - An agent checks its identity with `actas status --json`. `"mismatch": true`
506
+ means the current directory is matched to another profile (a directory
507
+ only the `fallback:` covers is no mismatch).
508
+ - An agent can use another profile only through
509
+ `actas exec <profile> --reason "…" -- <cmd>`, and only if the session's
510
+ profile lists it in `agents_may_use` (`["*"]` for any) at the same or a lower level. `confirm`
511
+ profiles always need a human.
512
+ - Every refusal starts with an `actas-stop:` line and includes a ready-to-run
513
+ command. You run it yourself in a separate terminal. A `not_allowed`
514
+ refusal also says which `agents_may_use` list to add the profile to, if you
515
+ want agents to do it themselves next time. There is no in-session
516
+ approval and no bypass variable.
517
+ - Logins, `sync`, `init`, `aws-handoff`, `migrate --write`, writing secrets
518
+ and `shell` with secrets are human-only. Runs, execs, logins and refusals
519
+ are logged to `~/.local/state/actas/audit.jsonl` (names, never values).
520
+
521
+ ```text
522
+ actas-stop: code=needs_user reason=confirm profile=personal-power
523
+ actas: refused: personal-power requires a typed confirmation, which only a human in a terminal can give
524
+ actas: show the user this ask_user text exactly, then stop:
525
+ The agent wants to run `terraform apply` as actas profile personal-power (power; aws:personal-poweruser, gh:pat).
526
+ Agent's reason: "apply the reviewed plan"
527
+ If you agree, run it yourself in a separate terminal (not inside the agent session):
528
+ actas exec personal-power -- terraform apply
529
+ ```
530
+
531
+ To teach an agent the rules, run `actas instructions` and add the output to
532
+ your project's `AGENTS.md` (for Claude Code, also add `@AGENTS.md` to
533
+ `CLAUDE.md`).
534
+
535
+ **Agent skills.** [skills/actas](skills/actas/SKILL.md) teaches Claude Code to
536
+ check its identity before cloud or GitHub commands: `actas setup skill`
537
+ installs it as `~/.claude/skills/actas` (or link the checkout's directory there).
538
+ [skills/aws-handoff](skills/aws-handoff/SKILL.md) is a `/aws-handoff` command
539
+ for cloud sessions: `actas setup skill aws-handoff` writes it into the
540
+ current repository's `.claude/skills`, to commit.
541
+
542
+ **These guardrails are a seatbelt, not a boundary.** They stop a confused or
543
+ prompt-injected agent that follows its instructions. They do not stop code
544
+ running as your user that sets out to get around them. The real boundary is
545
+ the credentials themselves: the server enforces a read-only PAT or a
546
+ ReadOnlyAccess role. [docs/agents.md](docs/agents.md) covers the threat model,
547
+ the full gate rules and stronger options. If you are an agent working on this
548
+ repository, read [AGENTS.md](AGENTS.md).
549
+
550
+ If you point actas at another config with `ACTAS_ROOT` or `ACTAS_STATE`, set
551
+ them per command rather than exporting them: exported to a non-default place,
552
+ they make agents without an `actas run` session refuse every `actas exec` with
553
+ `reason=override` ([details](docs/agents.md#the-gate)).
554
+
555
+ ## How it compares
556
+
557
+ | You may already use | What it does | What actas adds |
558
+ |---|---|---|
559
+ | direnv, mise `[env]` | per-directory variables in your interactive shell | one identity per process (two terminals, two accounts), secret refs resolved at launch, agent rules. They combine: `use actas` in `.envrc` |
560
+ | cc-switch, claude-switch and other Claude account switchers | switch which provider or account Claude Code (and often Codex or Gemini CLI) uses | the same switch for the cloud accounts, GitHub, git identity and secrets of that context, per process, with rules that stop an agent from switching itself up |
561
+ | aws-vault, granted | AWS credentials | the same idea for the LLM provider, GitHub, git, GCP and Azure. Set `aws.profile` to an AWS profile whose `credential_process` uses them |
562
+ | `gh auth switch`, `gcloud config set`, `az account set` | switch the account for every terminal at once | per-process accounts; nothing global changes |
563
+ | 1Password shell plugins, fnox, sops | supply secrets | which secrets belong to which context; actas reads them through `op://`, `cmd:` and `sops:` refs |
564
+
565
+ **When actas is not the right tool:** you need an enforced sandbox around an
566
+ untrusted agent (the agent rules are a seatbelt; use a
567
+ [devcontainer or VM](docs/recipes.md#stronger-isolation-devcontainer-or-vm),
568
+ with actas inside if you like), you use one account everywhere, or you are on
569
+ native Windows (WSL only). Using them together:
570
+ [docs/recipes.md](docs/recipes.md#direnv-mise-and-aws-credential-tools).
571
+
572
+ ## Commands
573
+
574
+ `actas help` shows the everyday commands; `actas help <command>` lists a
575
+ command's flags, `actas help manifest` and `actas help agents` give short
576
+ primers, and `actas --help` lists everything. `--cwd DIR` works with any command
577
+ and resolves the profile as if you were in `DIR`; it wins over the session's
578
+ profile in `status`, `exec` and `run`. Arguments after `--` go to
579
+ the launched tool: `actas run client-a -- --resume`. In your own terminal,
580
+ `actas client-a -- terraform plan` is short for
581
+ `actas exec client-a -- terraform plan` (command names win over profile
582
+ names; agent sessions spell out `exec`). A mistyped option prints that
583
+ command's usage line and a hint; `--no-color` works before or after the
584
+ command.
585
+
586
+ **Everyday**
587
+
588
+ | Command | What it does |
589
+ |---|---|
590
+ | `actas init` | Create `~/.config/actas` with a starter manifest (git identity from your global git config, if set) and a `.sops.yaml` when an age key exists. Never overwrites. |
591
+ | `actas run [profile] [-t claude\|codex\|gemini] [--login] [-- args]` | Launch the profile's tool with its identity. Warns about expired AWS credentials; logs in only with `--login`. |
592
+ | `actas exec [profile] [--reason TEXT] -- cmd …` | Run any command with a profile's identity. Returns the command's own exit code. Short form: `actas <profile> -- cmd …`. |
593
+ | `actas status [profile] [--why] [--probe] [--json]` | Which profile applies and what it sets. `--why`: the `use:` chain and where each value comes from. `--probe`: check each login (the checks run in parallel). Outside every `match` (no session, no `fallback`) it reports no profile and a `match` to add. Alias: `whoami`. |
594
+ | `actas list [--check] [--json] [--names]` | All profiles and roles; `*` marks the profile matching this directory, `+` this session's. `--check` also probes AWS and gateway secrets. `--names`: one profile name per line. |
595
+ | `actas login [profile] [--module M] [--all]` | Log in: AWS SSO by default (plus Codex for Codex profiles). `--module gcp\|azure\|github\|codex` (for a `gh:` account, gh's previously active account is switched back afterwards). `--all`: one AWS login per SSO session or portal; exits 1 and names the portals whose login failed. |
596
+ | `actas sync [profile] [--dry-run] [--clean [--all] [--force]] [--include-confirm]` | Write non-secret settings into each matching repo's `.claude/settings.local.json`, for bare `claude`, IDEs and Desktop. `--clean` also removes what actas wrote in files no profile syncs any more (`--force` for files that hide `~/.claude/settings.json`'s provider routing); `--clean --all` removes it from every synced file and writes nothing (before [uninstalling](#uninstall)). `--include-confirm` also writes `confirm` profiles. |
597
+ | `actas doctor [--strict] [--json] [--fix]` | Check tools, the manifest, file modes, and the shell exports `run` would clear. Warns when a `gh:` account the manifest names is not logged in, an `aws.profile` is not in `~/.aws/config` or `~/.aws/credentials`, a tool a ref or `tool:` needs (sops, age key, op, codex, ...) is missing, or a git identity is a placeholder (`you@example.com`). It never reads a secret. `--fix` only tightens actas's own directories to 0700. |
598
+
599
+ **Advanced**
600
+
601
+ | Command | What it does |
602
+ |---|---|
603
+ | `actas shell [profile] [--format sh\|fish\|direnv\|json\|env] [--no-secrets]` | Print the environment, for `eval "$(actas shell)"`, direnv or a GUI app. |
604
+ | `actas secret set REF` / `actas secret --ref REF` | Store a secret (prompted, or from stdin), or print one (helpers use this). |
605
+ | `actas desktop [profile] [--print-3p] [--vscode]` | What reaches Claude Desktop and IDEs, plus blocks to paste there. |
606
+ | `actas instructions [--agent claude\|codex\|gemini\|generic] [--direnv] [--skill [NAME]]` | Print the agent rules, the direnv function, or a Claude Code skill's `SKILL.md`. |
607
+ | `actas setup skill [NAME] [--dir DIR]` / `actas setup direnv [--file FILE]` | Install the Claude Code skill (`actas` into `~/.claude/skills`, `aws-handoff` into `./.claude/skills`) or the direnv function (`~/.config/direnv/lib/actas.sh`). `--dry-run`; `--force` replaces a file actas did not write. |
608
+ | `actas migrate [--write]` | Print a v1 manifest as version 2. `--write` replaces it and keeps the old file. |
609
+ | `actas aws-handoff [profile] [--stdout] [--login]` | Copy short-lived AWS credentials for a cloud session. |
610
+ | `actas completion bash\|zsh\|fish` | Print a tab-completion script (commands, options, profile names). |
611
+
612
+ Exit codes: `0` ok, `1` error, `2` usage, `3` needs the user (an `actas-stop:`
613
+ refusal), `4` credentials expired. Apart from these, `exec` and `run` return
614
+ the tool's own exit code. A file actas cannot read or write (a read-only repo,
615
+ an unwritable cache) ends in one `actas:` line naming it, with exit `1`;
616
+ `ACTAS_DEBUG=1` shows the Python traceback instead.
617
+
618
+ ## Documentation
619
+
620
+ - [docs/manifest.md](docs/manifest.md): every key, merge rules, modules, secret references, validation, and the files actas uses
621
+ - [docs/recipes.md](docs/recipes.md): GitLab, npm, Docker, Kubernetes, Terraform Cloud, Vault, other agents, direnv and mise, written as roles
622
+ - [docs/agents.md](docs/agents.md): levels and rules, the gate, refusals, the audit log, the threat model
623
+ - [docs/desktop.md](docs/desktop.md): bare `claude`, IDE extensions, Claude Desktop, cloud sessions, Cursor and other GUI apps
624
+ - [docs/migration.md](docs/migration.md): moving a v1 manifest to version 2, with rollback
625
+ - [examples/](examples/): complete manifests; [skills/](skills/): Claude Code skills
626
+ - [SECURITY.md](SECURITY.md), [CHANGELOG.md](CHANGELOG.md), and [AGENTS.md](AGENTS.md) for agents working on this repository
627
+
628
+ ## Security
629
+
630
+ - **Credentials are the boundary** (see [AI agents](#ai-agents)). Give each
631
+ profile the narrowest credentials that work, such as a fine-grained
632
+ read-only PAT or a ReadOnlyAccess role. A separate SSO start URL or MFA for
633
+ power roles makes the split real.
634
+ - **No secret is written to disk in clear text.** The manifest holds refs.
635
+ Generated and synced settings hold no secret values. Helpers fetch gateway
636
+ tokens and git credentials when they are used.
637
+ - **Secrets in the process environment are visible inside the session.**
638
+ `secret_env`, `GH_TOKEN` and similar values sit in the process environment,
639
+ so the agent and its subprocesses can read them. Use narrow tokens, and for
640
+ Claude Code consider `env: { CLAUDE_CODE_SUBPROCESS_ENV_SCRUB: "1" }`.
641
+
642
+ Details and how to report a problem: [SECURITY.md](SECURITY.md).
643
+
644
+ ## Upgrading from v1
645
+
646
+ v1 manifests (no `version`, or `version: 1`) keep working unchanged. A
647
+ translator maps them onto the v2 engine and keeps v1 behaviour where it
648
+ matters: no built-in agent rules, the gateway token is still exported, and
649
+ only the variables v1 already managed are cleared (AWS ones only where the
650
+ environment has an `aws:` block, so elsewhere your shell's `AWS_PROFILE`
651
+ stays, as in v1; `GIT_AUTHOR_*`/`GIT_COMMITTER_*` only for the git name and
652
+ email the environment sets).
653
+
654
+ ```bash
655
+ actas migrate # print the v2 version and list what would change
656
+ actas migrate --write # switch; the old file is kept as environments.v1.yaml
657
+ ```
658
+
659
+ `migrate` keeps your existing sops paths (`sops:<env>/<key>`) and never reads
660
+ or changes `secrets.enc.yaml`. The step-by-step guide, with rollback, is
661
+ [docs/migration.md](docs/migration.md). [CHANGELOG.md](CHANGELOG.md) lists
662
+ every behaviour change.
663
+
664
+ ## Contributing
665
+
666
+ Issues and pull requests are welcome. The tests use only the standard library
667
+ and never touch a real login:
668
+
669
+ ```bash
670
+ python3 -m unittest discover -s tests -v
671
+ uv run --no-project --python 3.9 python -m unittest discover -s tests # oldest supported Python
672
+ ```
673
+
674
+ Each test gets its own temporary `HOME`, `ACTAS_ROOT`, `ACTAS_STATE` and XDG
675
+ directories, and `PATH` points at fake `gh`, `aws`, `sops`, `security`, `op`,
676
+ `gcloud`, `az`, `claude`, `codex` and `gemini` binaries. CI runs on Ubuntu and
677
+ macOS with Python 3.10 and 3.13, plus Python 3.9 through uv, and builds the
678
+ package. Conventions (tables-first design, placeholder names only, Python 3.9
679
+ compatibility, one source for the agent rules) are in [AGENTS.md](AGENTS.md),
680
+ written for coding agents but meant for every contributor.
681
+
682
+ ## Support
683
+
684
+ actas is free and MIT-licensed. If it saves you time, you can
685
+ [buy me a coffee](https://buymeacoffee.com/tsenkotsenkov). Bug reports and
686
+ pull requests help just as much.
687
+
688
+ [![Buy Me a Coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-tsenkotsenkov-FFDD00?logo=buymeacoffee&logoColor=black&style=for-the-badge)](https://buymeacoffee.com/tsenkotsenkov)
689
+
690
+ ## License
691
+
692
+ [MIT](LICENSE)