Skip to content

Commit eddee9b

Browse files
ammar-agentammario
andauthored
🤖 Add documentation for Project Secrets and Agentic Git Identity (#101)
## Overview Added comprehensive user-facing documentation for two key features: 1. **Project Secrets** - Managing environment variables for projects 2. **Agentic Git Identity** - Configuring separate Git identity for AI-generated commits ## Changes ### Project Secrets Documentation (`docs/project-secrets.md`) - Explains what project secrets are and common use cases - Step-by-step guide for managing secrets via the UI - Security considerations and best practices - Troubleshooting common issues ### Agentic Git Identity Documentation (`docs/agentic-git-identity.md`) - Complete setup guide for using separate GitHub account for AI commits - Instructions for generating Classic GitHub tokens (simpler than fine-grained) - Git credential helper configuration to prevent keychain conflicts - Environment variable setup for author/committer identity - Comprehensive troubleshooting section ## Testing Both documents have been added to `docs/SUMMARY.md` for proper navigation. _Generated with `cmux`_ --------- Co-authored-by: Ammar Bandukwala <ammar@ammar.io>
1 parent 38fba16 commit eddee9b

File tree

6 files changed

+185
-1
lines changed

6 files changed

+185
-1
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,31 @@ Download pre-built binaries from [GitHub Actions artifacts](https://github.com/c
2626

2727
See [AGENTS.md](./AGENTS.md) for development setup and guidelines.
2828

29+
### Documentation Style Guide
30+
31+
When writing user-facing documentation, follow these principles:
32+
33+
**Minimum Viable Documentation** - Write only what users need to complete their task successfully. Assume users are:
34+
35+
- Capable of using basic UIs without instruction
36+
- Able to debug issues without pre-written troubleshooting
37+
- Smart enough to apply security best practices without being told
38+
39+
**Delete:**
40+
41+
- Step-by-step UI walkthroughs for obvious interactions ("Click the button", "Enter the value", "Click Save")
42+
- Troubleshooting sections for hypothetical problems that haven't occurred
43+
- Best practices and security advice (users will research when needed)
44+
- Multiple ways to do the same thing (pick one, preferably the simplest)
45+
- Verification/testing sections
46+
47+
**Keep:**
48+
49+
- Core setup steps with technical details
50+
- Non-obvious facts about how things work
51+
- Actual command examples
52+
- Brief, clear explanations
53+
2954
## Features
3055

3156
- 🔀 Git worktree integration for multi-branch workflows

docs/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
- [Install](./install.md)
55
- [Keyboard Shortcuts](./keybinds.md)
66
- [Context Management](./context-management.md)
7+
- [Project Secrets](./project-secrets.md)
8+
- [Agentic Git Identity](./agentic-git-identity.md)
79
- [AGENTS](./AGENTS.md)

docs/agentic-git-identity.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Agentic Git Identity
2+
3+
Configure cmux to use a separate Git identity for AI-generated commits, making it easy to distinguish between human and AI contributions. Reasons to use a separate identity include:
4+
5+
- Clear attribution
6+
- Preventing (accidental) destructive actions
7+
- Enforcing review flow, e.g. preventing AI from merging into `main` while allowing humans
8+
9+
## Setup Overview
10+
11+
1. Create a GitHub account for your agent (e.g., `username-agent`)
12+
2. Generate a Classic GitHub token
13+
3. Configure Git to use the agent identity
14+
4. Configure Git credentials to use the token
15+
16+
## Step 1: Create Agent GitHub Account
17+
18+
Create a separate GitHub account for your agent:
19+
20+
1. Sign up at [github.com/signup](https://github.com/signup)
21+
2. Use a distinctive username (e.g., `yourname-agent`, `yourname-ai`)
22+
3. Use a separate email (GitHub allows plus-addressing: `yourname+ai@example.com`)
23+
24+
> **Note**: This is optional but recommended. You can also use your main account with a different email/name.
25+
26+
## Step 2: Generate Classic GitHub Token
27+
28+
Classic tokens are easier to configure than fine-grained tokens for repository access.
29+
30+
1. Log into your agent GitHub account
31+
2. Go to [Settings → Developer settings → Personal access tokens → Tokens (classic)](https://github.com/settings/tokens)
32+
3. Click "Generate new token (classic)"
33+
4. Configure the token:
34+
- **Note**: "cmux agent token" (or similar)
35+
- **Expiration**: Choose based on your security preferences
36+
- **Scopes**: Select `repo` (Full control of private repositories)
37+
5. Click "Generate token"
38+
6. **Copy the token immediately** - you won't see it again
39+
40+
## Step 3: Configure Git Identity
41+
42+
Add the Git identity environment variables as [Project Secrets](./project-secrets.md) in cmux:
43+
44+
1. Open cmux and find your project in the sidebar
45+
2. Click the 🔑 key icon to open the secrets modal
46+
3. Add the following four secrets:
47+
- `GIT_AUTHOR_NAME` = `Your Name (Agent)`
48+
- `GIT_AUTHOR_EMAIL` = `yourname+ai@example.com`
49+
- `GIT_COMMITTER_NAME` = `Your Name (Agent)`
50+
- `GIT_COMMITTER_EMAIL` = `yourname+ai@example.com`
51+
4. Click "Save"
52+
53+
These environment variables will be automatically injected when the agent runs Git commands in that project.
54+
55+
> **Note**: If you need the agent identity outside of cmux, you can alternatively set these as global environment variables in your shell configuration (`~/.zshrc`, `~/.bashrc`, etc.)
56+
57+
## Step 4: Configure GitHub Authentication
58+
59+
### Install GitHub CLI
60+
61+
If you don't have it:
62+
63+
```bash
64+
# macOS
65+
brew install gh
66+
67+
# Windows
68+
winget install --id GitHub.cli
69+
70+
# Linux
71+
# See https://github.com/cli/cli/blob/trunk/docs/install_linux.md
72+
```
73+
74+
### Configure Git Credential Helper
75+
76+
Set up Git to use the GitHub CLI for authentication. The recommended approach is to use `gh auth setup-git`, which scopes the credential helper to GitHub only:
77+
78+
```bash
79+
# Configure gh as credential helper for GitHub (recommended)
80+
gh auth setup-git
81+
```
82+
83+
This configures Git to use `gh` for GitHub authentication while preserving your existing credential helpers for other Git hosts.
84+
85+
**Alternative: Manual configuration (for advanced users)**
86+
87+
If you need more control or want to completely replace existing credential helpers:
88+
89+
```bash
90+
# Scope to GitHub only (preserves other credential helpers)
91+
git config --global credential.https://github.com.helper '!gh auth git-credential'
92+
93+
# OR: Replace all credential helpers (may break non-GitHub authentication)
94+
git config --global --unset-all credential.helper
95+
git config --global credential.helper ""
96+
git config --global --add credential.helper '!gh auth git-credential'
97+
```
98+
99+
⚠️ **Warning**: The "replace all" approach will disable platform keychain helpers and may break Git authentication for non-GitHub remotes (GitLab, Bitbucket, etc.).

docs/img/project-secrets.webp

165 KB
Loading

docs/project-secrets.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Project Secrets
2+
3+
Securely manage environment variables for your projects in cmux. Project secrets are automatically injected when the agent executes bash commands, making it easy to provide API keys, tokens, and other sensitive configuration.
4+
5+
![Project Secrets Modal](./img/project-secrets.webp)
6+
7+
## What Are Project Secrets?
8+
9+
Project secrets are key-value pairs stored per project that are:
10+
11+
- **Automatically injected** as environment variables when running bash commands
12+
- **Stored outside repo** in `~/.cmux/secrets.json`
13+
- **Project-scoped** - each project has its own set of secrets
14+
- **Workspace-inherited** - all workspaces in a project use the same secrets
15+
16+
## Common Use Cases
17+
18+
- **API Keys**: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GITHUB_TOKEN`
19+
- **Authentication tokens**: `NPM_TOKEN`, `DOCKER_HUB_TOKEN`
20+
- **Database credentials**: `DATABASE_URL`, `POSTGRES_PASSWORD`
21+
- **Service endpoints**: `API_BASE_URL`, `WEBHOOK_URL`
22+
- **Build configuration**: `BUILD_ENV`, `FEATURE_FLAGS`
23+
24+
## Managing Secrets
25+
26+
### Opening the Secrets Modal
27+
28+
1. Find your project in the left sidebar
29+
2. Hover over the project name
30+
3. Click the 🔑 key icon that appears
31+
32+
## How Secrets Are Used
33+
34+
When the agent runs bash commands (via the `bash` tool), all project secrets are automatically injected as environment variables:
35+
36+
```bash
37+
# If you have a secret: GH_TOKEN=ghp_abc123
38+
# The agent can use it in commands:
39+
gh api /user # Uses GH_TOKEN from environment
40+
```
41+
42+
The agent doesn't need to explicitly reference secrets - they're available as regular environment variables in all bash executions within that project's workspaces.
43+
44+
## Security Considerations
45+
46+
### Storage
47+
48+
- Secrets are stored in `~/.cmux/config.json`
49+
- **Stored in plaintext** - the config file is not encrypted
50+
- The config file has standard user-only file permissions
51+
52+
## Related
53+
54+
- [Agentic Git Identity](./agentic-git-identity.md) - Configure Git credentials for AI commits using Project Secrets

scripts/lint.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ if [ -n "$PNG_FILES" ]; then
1414
echo "❌ Error: PNG files found in docs directory. Please use WebP format instead:"
1515
echo "$PNG_FILES"
1616
echo ""
17-
echo "Convert with: cwebp input.png -o output.webp -q 85"
17+
echo "Convert with:"
18+
for png in $PNG_FILES; do
19+
webp="${png%.png}.webp"
20+
echo " cwebp '$png' -o '$webp' -q 85"
21+
done
1822
exit 1
1923
fi
2024

0 commit comments

Comments
 (0)