grant CLI
Project description
grant
Agent-first per-OS-user secrets manager CLI. Part of the
AgentCulture ecosystem; sibling to
zehut (identity layer) and
patterned on afi-cli
(noun-verb shape, exit-code discipline, structured --json output).
Each OS user gets their own secrets store at
~/.local/share/grant/secrets.json (mode 0600, owned by the
user). grant never reaches across users in self-mode. Admin handoff
to another user goes through a single setuid-fork chokepoint and
preserves the H2 hidden-secret contract — admin can never extract a
value through any CLI verb.
Install
uv tool install grant
grant --version
Linux only (uses setuid / useradd semantics). Python ≥ 3.12.
Quick start
# store a secret you already have (stdin form preferred — keeps the
# value out of /proc/<pid>/cmdline and shell history)
echo -n "sk-..." | grant set OPENAI_API_KEY -
# generate a random one, hidden — never printed
grant generate JWT_SECRET --bytes 32 --hidden
# inspect (never prints value)
grant show OPENAI_API_KEY
grant show OPENAI_API_KEY --json
# consume — visible secrets only
grant get OPENAI_API_KEY
eval $(grant env OPENAI_API_KEY DATABASE_URL)
# consume — visible OR hidden (this is the only path for hidden)
grant run --inject JWT=JWT_SECRET --inject DB=DATABASE_URL -- ./myapp
grant list and grant overview give names and metadata.
grant delete NAME removes a record.
Self-teaching surface
grant learn # markdown summary of every verb + concept
grant learn --json # structured payload for agent consumers
grant explain hidden # explain a concept
grant explain set # explain a verb
Admin handoff
grant is single-admin-trusted-host. Admin operations go through
sudo; the binary forks → drops to the target user → writes/reads
under their uid. Every admin write stamps source = "admin:<invoker>"
and handed_over_by = "<invoker>" so the receiving user can audit.
# provision a secret into alice's store as root
sudo grant set --user alice OPENAI_API_KEY -
# read-only audit across every user with a grant store
sudo grant overview --all-users
sudo grant doctor --all-users
# delete a record from alice's store
sudo grant delete --user alice OPENAI_API_KEY
get, env, run deliberately have NO admin flags — values are
never extractable through the CLI, even for root. Use sudo cat ~alice/.local/share/grant/secrets.json if you truly need plaintext
(at which point you've moved outside grant's contract).
Hidden secrets — the H2 contract
A secret with hidden: true:
- Is immutable post-create — you cannot toggle the hidden flag.
- Is refused by
get,env,show(they exit64with a remediation pointing atrun --inject). - Has its value omitted from
generate --hidden --jsonoutput (the JSON payload has novaluefield). - Is consumable only through
grant run --inject VAR=NAME -- cmd.
Hidden is a CLI contract, not encryption. The on-disk file is
plaintext at 0600. Encryption-at-rest is tracked for a future
v1.x release in
issue #8.
Exit codes
| Code | Meaning |
|---|---|
0 |
success |
64 |
bad input from the caller (invalid flag, missing record, hidden refusal, etc.) |
65 |
store is corrupt / schema mismatch / unreadable |
66 |
this operation requires root |
67 |
backend dependency failed (unknown OS user, etc.) |
70 |
bug in grant — please file an issue |
Every error path emits a structured GrantError with a remediation
string. With --json, errors land as {"ok": false, "error": {...}}
on stdout (single-payload contract).
Docs
Development
git clone https://github.com/agentculture/grant
cd grant
uv sync # install deps
bash .claude/skills/run-tests/scripts/test.sh -p # unit suite
bash .claude/skills/run-tests/scripts/test.sh --ci # CI parity
Integration tests need real root + useradd/userdel, which we
only do inside a disposable Docker image:
docker build -f .github/workflows/Dockerfile.integration -t grant-int .
docker run --rm -e GRANT_DOCKER=1 grant-int uv run pytest tests/integration -v
See docs/testing.md for the broader test-isolation
conventions and the smoke-test namespace under /tmp/grant-tests/.
License
MIT. © 2026 Ori Nachum / AgentCulture.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grant-0.9.0.tar.gz.
File metadata
- Download URL: grant-0.9.0.tar.gz
- Upload date:
- Size: 136.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
517fcf26525d97f6f71e9df6a3cabc004300bf4ec4dc9a7be83b725805b290aa
|
|
| MD5 |
8b955b411724600a09abaab1ca09d152
|
|
| BLAKE2b-256 |
bd17a54f0b33269bd901615b6d266cf9daf7cde5c929cefe3a5c75a72cb72770
|
Provenance
The following attestation bundles were made for grant-0.9.0.tar.gz:
Publisher:
publish.yml on agentculture/grant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grant-0.9.0.tar.gz -
Subject digest:
517fcf26525d97f6f71e9df6a3cabc004300bf4ec4dc9a7be83b725805b290aa - Sigstore transparency entry: 1671552589
- Sigstore integration time:
-
Permalink:
agentculture/grant@8478ec1b1c9e5efcbe5731f02214abb460f3222a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/agentculture
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8478ec1b1c9e5efcbe5731f02214abb460f3222a -
Trigger Event:
push
-
Statement type:
File details
Details for the file grant-0.9.0-py3-none-any.whl.
File metadata
- Download URL: grant-0.9.0-py3-none-any.whl
- Upload date:
- Size: 35.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e1be7af9de43cab1425be41997bc7f6595196329e1bfea3332d2c9ada337b68
|
|
| MD5 |
5c86c686bda931d0993671aa51f53c18
|
|
| BLAKE2b-256 |
ecf9072ba4f6679055820a5906b69684216bdf4a01b2a73f6115f0d97ea74126
|
Provenance
The following attestation bundles were made for grant-0.9.0-py3-none-any.whl:
Publisher:
publish.yml on agentculture/grant
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grant-0.9.0-py3-none-any.whl -
Subject digest:
1e1be7af9de43cab1425be41997bc7f6595196329e1bfea3332d2c9ada337b68 - Sigstore transparency entry: 1671552602
- Sigstore integration time:
-
Permalink:
agentculture/grant@8478ec1b1c9e5efcbe5731f02214abb460f3222a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/agentculture
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8478ec1b1c9e5efcbe5731f02214abb460f3222a -
Trigger Event:
push
-
Statement type: