aesop / auth
CLAUDE.md2 starsChanged 31 days agoMITView on GitHub
Purpose: a zero-dependency, Claude Code style credential and model-selection surface for aesop. Reached through bin/cli.js verbs auth and model, and through control messages on stdin. Files - providers.mjs — registry PROVIDERS ({name, envVar, defaultModel, models}); seeds anthropic and local; parseSelector. - store.mjs — the one JSON store: readStore, writeStore (temp file + rename, mode 0600 off win32), resolveCredential (env beats store). - cli.mjs — verb dispatch, control op registry (runControlOp), exit codes. Runnable directly: node auth/cli.mjs <argv>. Verbs - auth…
- Reads credentials
In this repository21 other files it gives its agents.
- bin/CLAUDE.mdCLAUDE.md
- chat/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- daemons/CLAUDE.mdCLAUDE.md
- dash/CLAUDE.mdCLAUDE.md
- driver/CLAUDE.mdCLAUDE.md
- hooks/CLAUDE.mdCLAUDE.md
- mcp/CLAUDE.mdCLAUDE.md
- monitor/CLAUDE.mdCLAUDE.md
- scan/CLAUDE.mdCLAUDE.md
- skills/CLAUDE.mdCLAUDE.md
- state_store/CLAUDE.mdCLAUDE.md
- stdio/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- tools/CLAUDE.mdCLAUDE.md
- ui/CLAUDE.mdCLAUDE.md
- buildsystemSkill
- dashboardSkill
- fleetSkill
- healthcheckSkill
- powerSkill
The file
Files
auth/ — generic auth and model selection
Purpose: a zero-dependency, Claude Code style credential and model-selection surface for aesop. Reached through bin/cli.js verbs auth and model, and through control messages on stdin.
Files
providers.mjs— registryPROVIDERS({name, envVar, defaultModel, models}); seedsanthropicandlocal;parseSelector.store.mjs— the one JSON store:readStore,writeStore(temp file + rename, mode 0600 off win32),resolveCredential(env beats store).cli.mjs— verb dispatch, control op registry (runControlOp), exit codes. Runnable directly:node auth/cli.mjs <argv>.
Verbs
auth login --provider <name> --api-key-stdin— key read from stdin only, never an argument.auth status [--provider <name>]—<provider>: source=<env|store|none> model=<m> credential=<set|none>;keyTailis always null (a fixed slot kept for the strict-equal contract, no part of a key is shown).auth logout [--provider <name>]— drops the stored entry; no flag clears all providers. A selection (store.current) naming a provider that was logged out is cleared too, whether its credential came from the store or the environment (the env var itself is never touched). If a provider's credential still resolves from its env var after logout, stdout gets one extra line per such provider after thelogged out:line:still set: <provider> source=env (...), naming the provider only, never the value (R5).model list— providers, default models, credential requirement.model use <provider>/<model>— records the selection; needs a credential when the provider has an env var.model current— prints<provider>/<model>.- Machine output: when stdout is not a TTY,
auth status,model listandmodel currentprint exactly one JSON line (opsauth.status,model.list,model.current). Bareaesopnever reads stdin for these. - Control ops: the only control channel is
aesop pipe --input-format stream-json --output-format stream-json. Each control record{"type":"control","op":...,"id"?,...}is answered byrunControlOpin cli.mjs, the only op registry (CONTROL_OPS), and wrapped by stdio/pipe.mjs in its reply envelope. Ops:auth.status(optionalprovider),auth.login(api_key, optionalprovider, default anthropic),auth.logout(optionalprovider),model.list,model.use(modelas<provider>/<model>),model.current. Registered by importing this module (bin/cli.js preloads it).- Result shapes: each op's
resultis the same object its verb reports after the op.auth.loginandauth.logoutreturn theauth.statusshape ({ok, op:'auth.status', providers}), not a shape of their own. - Refusals: a refused op answers an ok:false envelope and the pipe keeps running (exit 0). Known-op refusals keep
op. Every envelope carries a machine-readablecode(R-CONTROL-1); everyControlOpErroris constructed with one ofCONTROL_ERROR_CODES. - Codes:
unknown_op(noopfield, errorunknown op);unknown_provider;unknown_model_selector(malformed, unregistered or unlisted selector; never echoed);invalid_argument(wrong argument shape, e.g. a badapi_key, or a provider that needs no credential);no_credential(model.usewith no credential behind the model; keepsopwith its credential message);store_error(unreadable or corrupt store);op_failed(any other refusal of a known op).
- Result shapes: each op's
Exit codes: 0 ok (including every op refused with an ok:false envelope); 2 bad usage, --control on any path, malformed control framing, or corrupt store; 3 model use for a provider that needs a credential and has none.
Store: $AESOP_CONFIG_DIR/auth.json (default <home>/.aesop/auth.json). Entries {credential, model, addedAt} keyed by provider, plus top-level current. Env secrets are never persisted. A corrupt file exits 2 and is left untouched.
Secrets: never printed, in full or in part. No fragment of a key (not even its last four characters) appears in the login echo, auth status (human or JSON), or any control reply; they show the source and the fixed word set or none. Error messages name the expected shape (provider list, <provider>/<model>, flag name, verb list) and never echo an argv value. Precedence: AESOP_API_KEY, then the provider env var, then the store.
Platform gap: the store file is mode 0600 on POSIX; on win32 writeStore runs icacls /inheritance:r /grant:r <user>:F on the temp file (and (OI)(CI)F on the directory), so only the current user is granted (row f-dc34e7d6).
Invariants: imports are node: builtins and relative files only (tests/auth-zero-dependency.test.mjs). Auth verbs never scaffold into cwd. Tests: tests/auth-cli.test.mjs, tests/auth-store.test.mjs.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

