claude_profile
Claude Code account credential management.
Files
| File | Responsibility |
|---|---|
Cargo.toml |
Crate manifest: dependencies, features, metadata |
src/ |
Library modules and CLI binary (account, token, paths, adapter, commands) |
tests/ |
Test suite for credential management |
docs/ |
Behavioral requirements: features (FR-6–FR-20), invariants, CLI reference |
unilang.commands.yaml |
YAML command metadata for 16 profile commands |
verb/ |
Shell scripts for each do protocol verb (build, test, clean, run, lint). |
vision.md |
Crate vision, design decisions, and open problems |
changelog.md |
Notable changes by version |
Responsibility Table
| Entity | Responsibility | Input→Output | Scope | Out of Scope |
|---|---|---|---|---|
account |
Named credential storage and rotation | name → active credentials | Save, list, switch, delete accounts | ❌ OAuth HTTP refresh → network dep❌ Browser launch → caller |
token |
Active OAuth token expiry status | credentials file → TokenStatus |
Read expiresAt, classify Valid/ExpiringSoon/Expired |
❌ Token refresh → HTTP❌ Server-side window → unobservable |
paths |
~/.claude/ file topology |
HOME → canonical PathBufs |
All ~/.claude/ path constants |
❌ Process execution |
persist |
Persistent user storage path resolution | $PRO/$HOME → PathBuf |
Resolve $PRO/persistent/claude_profile/ with $HOME fallback (FR-15) |
❌ Writing data → caller |
Scope
In Scope:
- Account credential snapshots in
$PRO/.persistent/claude/credential/(or$HOME/.persistent/...) - Token expiry detection from
~/.claude/.credentials.json - All canonical
~/.claude/paths viaClaudePaths - Persistent user storage path resolution via
PersistPaths($PRO/$HOME)
Out of Scope:
- ❌ Claude Code process execution →
claude_runner_core - ❌ Continuation detection (session file existence) →
claude_storage_core - ❌ Session directory management →
claude_runner_core::SessionManager - ❌ Pulse keeping (periodic
claudeinvocation) → caller +claude_runner - ❌ Browser launch /
xdg-open→ caller - ❌ OAuth HTTP token refresh → network dependency not allowed
- ❌ Server-side 5-hour subscription window → not locally observable
Account Management
use ;
// Where are the files?
let claude = new.expect;
let persist = new.expect;
let credential_store = persist.credential_store;
println!;
println!;
println!;
// Check active token status
match status.expect
// List all stored accounts
for acct in list.expect
// Save current credentials as "work@acme.com"
save.expect;
// Switch to "personal@home.com"
switch_account.expect;
// Delete an old account
delete.expect;
File Paths
use ;
let p = new.expect;
let persist = new.expect;
println!;
println!;
println!;
println!;
println!;
println!;
println!;
Binary
Two names, same binary — both claude_profile and clp are installed:
Testing
Container (all tests — credentials required):
Container (offline — no credentials needed):
Container (interactive shell):
Local (Docker-orchestrated):