Skip to content

Home Information - Your home, your data, organized.

Python

Added notes around setting up an AI Agent for poroject work.

Tony Cassandra79713dbab21d
diff --git a/docs/CLAUDE.md b/docs/CLAUDE.md
index c2240193..5c2d30b9 100644
--- a/docs/CLAUDE.md
+++ b/docs/CLAUDE.md
@@ -40,8 +40,7 @@ This documentation helps maintain continuity across work sessions and provides v
## Environment-Specific Configuration
### Git Remote Configuration
-- The remote repository name is `github` (not `origin`)
-- Use `git push github` or `git push -u github branch-name` for pushing branches
+- Use `git push origin` or `git push -u origin branch-name` for pushing branches
### Development Commands Quick Reference
For detailed setup and daily commands, see [Development Setup](dev/Setup.md).
@@ -66,6 +65,35 @@ For comprehensive project information, see:
- **Setup**: [dev/Setup.md](dev/Setup.md) - Environment setup and daily development commands
- **Workflow**: [dev/Workflow.md](dev/Workflow.md) - Branching, commits, and pull request process
+## Release Process (Claude-Specific)
+
+When executing the release process documented in `docs/dev/ReleaseProcesses.md`, use these AI-specific commands and considerations:
+
+### Release Execution Commands
+```bash
+# Pre-release verification (combine all checks)
+git status && make check
+
+# Version bump and commit
+git add HI_VERSION && git commit -m "Bump version number to vX.X.X"
+git push origin staging
+
+# Merge to master
+git checkout master && git pull origin master
+git merge staging && git push origin master
+
+# Create release (CLI method - preferred for automation)
+gh release create vX.X.X --title "vX.X.X" --generate-notes --latest
+```
+
+### Release Process Considerations
+- **Working Directory**: Always verify clean working directory before starting
+- **Dependency Vulnerabilities**: GitHub may warn about dependencies during push - note but don't block release
+- **Documentation Changes**: Commit any documentation updates to staging before switching branches
+- **GitHub CLI**: Prefer `gh` command for release creation over manual UI steps
+
+See `docs/dev/ReleaseProcesses.md` for the complete process documentation.
+
## Generated Code Standards (Claude-Specific)
All generated code must comply with the `.flake8-ci` configuration rules. Common issues to avoid:
diff --git a/docs/dev/AiAgentSetup.md b/docs/dev/AiAgentSetup.md
new file mode 100644
index 00000000..aab8fd56
--- /dev/null
+++ b/docs/dev/AiAgentSetup.md
@@ -0,0 +1,466 @@
+
+
+
+
+Reconcile "orgin v. github remote name !!!!!!!
+ 1. Git Remote Naming: Your CLAUDE.md expects remote named github, but you have origin
+Change to origin (there's a rename command and needs doc updates)
+
+
+
+
+
+# Setup for AI Agent Assistant
+
+**Goal**: Create a dedicated local user account and GitHub account for Claude Code operations, ensuring clear attribution and separation from personal development work.
+
+**Key Components**:
+- Dedicated local user account (`ai-agent`) on both macOS and Ubuntu
+- Separate GitHub user account for AI operations
+- Claude Code authentication on both platforms
+- GitHub CLI (`gh`) for GitHub operations
+
+## Create Dedicated User Accounts
+
+### MacOS
+
+Create dev-shared group
+```
+sudo dseditgroup -o create -n . dev-shared
+```
+
+Find which user ids exists on system and choose a non-existent one
+```
+dscl . -list /Users UniqueID | sort -k2 -n
+```
+
+Create ai-agent user
+```
+sudo dscl . -create /Users/ai-agent
+sudo dscl . -create /Users/ai-agent UserShell /bin/bash
+sudo dscl . -create /Users/ai-agent RealName "AI Agent for Claude Code"
+sudo dscl . -create /Users/ai-agent UniqueID 505
+sudo dscl . -create /Users/ai-agent PrimaryGroupID 20
+sudo dscl . -create /Users/ai-agent NFSHomeDirectory /Users/ai-agent
+```
+
+Add users to dev-shared group
+```
+sudo dseditgroup -o edit -a arc -t user dev-shared
+sudo dseditgroup -o edit -a ai-agent -t user dev-shared
+```
+
+Create home directory with proper permissions
+```
+sudo createhomedir -c -u ai-agent
+sudo chown ai-agent:dev-shared /Users/ai-agent
+sudo chmod 770 /Users/ai-agent # ai-agent: rwx, dev-shared: r-x, others: none
+```
+
+Ensure unified environment on login
+```
+cat >> ~/.bash_profile << 'EOF'
+if [ -r ~/.bashrc ] ; then
+ . ~/.bashrc
+fi
+EOF
+```
+
+Set password for ai-agent
+```
+sudo passwd ai-agent
+```
+
+Verify setup
+```
+su - ai-agent
+whoami # Should show: ai-agent
+pwd # Should show: /Users/ai-agent (macOS) or /home/ai-agent (Linux)
+groups # Should show: dev-shared (and other groups)
+ls -la # Check home directory permissions
+```
+
+**Gotcha**: The keychain password warning for macOS can be ignored - it's only relevant for GUI logins.
+
+### Ubuntu (GNU/Linux)
+
+Create dev-shared group
+```
+sudo groupadd dev-shared
+```
+
+Create ai-agent user
+```
+sudo useradd -m -s /bin/bash -c "AI Agent" ai-agent
+```
+
+Add users to dev-shared group
+```
+sudo usermod -a -G dev-shared $(whoami)
+sudo usermod -a -G dev-shared ai-agent
+```
+
+Set proper home directory permissions
+```
+sudo chown ai-agent:dev-shared /home/ai-agent
+sudo chmod 770 /home/ai-agent
+```
+
+Set password for ai-agent
+```
+sudo passwd ai-agent
+```
+
+Verify setup
+```
+su - ai-agent
+whoami # Should show: ai-agent
+pwd # Should show: /Users/ai-agent (macOS) or /home/ai-agent (Linux)
+groups # Should show: dev-shared (and other groups)
+ls -la # Check home directory permissions
+```
+
+## Setup SSH Keys
+
+ Generate SSH key pair (use same email on both machines for consistency)
+```
+# MacOS
+ssh-keygen -t ed25519 -C "ai-agent@strudel" -f ~/.ssh/id_ed25519
+
+# Ubuntu
+ssh-keygen -t ed25519 -C "ai-agent@groovy" -f ~/.ssh/id_ed25519
+```
+
+Set proper permissions
+```
+chmod 700 ~/.ssh
+chmod 600 ~/.ssh/id_ed25519
+chmod 644 ~/.ssh/id_ed25519.pub
+```
+
+## Workspace Setup
+
+Create workspace structure
+```
+mkdir -p ~/proj
+cd ~/proj
+```
+
+Clone the repository
+```
+git clone [email protected]:cassandra/home-information.git
+mv home-information hi
+ln -s hi home-information
+cd hi
+```
+
+Configure git identity for ai-agent
+```
+git config user.name "AI Agent"
+git config user.email "[email protected]"
+```
+
+Verify the setup
+```
+git remote -v
+git status
+pwd
+```
+
+Also set global git config for consistency:
+```
+git config --global user.name "AI Agent"
+git config --global user.email "[email protected]"
+```
+
+
+### Install Claude Code
+
+Install Claude Code using the official installer
+```
+curl -fsSL https://claude.ai/install.sh | bash
+```
+
+Add to PATH env (now and future)
+```
+export PATH="~/.local/bin:$PATH"
+echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
+```
+
+
+After installation, verify:
+```
+claude-code --version
+```
+
+
+## MacOS-only Create Keychain for Claude OAuth token
+
+**Critical**: Terminal-created users don't have a login keychain, which Claude needs.
+
+Create a keychain for ai-agent:
+```
+security create-keychain -p "b92ZnuzkXfAYcAth7gXk" ~/Library/Keychains/login.keychain-db
+```
+
+Set it as the default keychain
+```
+security default-keychain -s ~/Library/Keychains/login.keychain-db
+```
+
+Verify it exists
+```
+security list-keychains
+security default-keychain
+```
+
+Unlock it for use and keep it unlocked for session
+```
+security unlock-keychain ~/Library/Keychains/login.keychain-db
+security set-keychain-settings -t 3600 ~/Library/Keychains/login.keychain-db
+```
+
+Create convenience script
+
+```
+cat > ~/start-claude.sh << 'EOF'
+#!/bin/bash
+cd ~/workspace/repos/home-information
+security unlock-keychain ~/Library/Keychains/login.keychain-db
+security set-keychain-settings -t 3600 ~/Library/Keychains/login.keychain-db
+claude
+EOF
+
+chmod +x ~/start-claude.sh
+
+# Then just run:
+~/start-claude.sh
+```
+
+## Run OAuth flow to Autheticate to Anthropic
+
+- Start up with `claude`.
+- Select the color scheme when prompted
+- On authetication screen, choose subsciption login
+- This gives a browser URL (or visits url if browser access available)
+- Visit URL, login into Anthropic account (if needed)
+- Click button to authorize
+- Copy and paste resulting token from browser into terninal.
+
+**Gotcha**: After OAuth completes, you may have to exit and restart Claude for the authentication to take effect.
+
+## GitHub Setup
+
+### Option 1: Separate GitHub User
+
+#### Create new GitHub account:
+
+- Go to github.com in incognito/private browser
+- Sign up with a new email ([email protected])
+- Username suggestion: cassandra-ai-agent
+
+#### Add SSH keys to New Account
+
+Display the public key to add to GitHub
+```
+cat ~/.ssh/id_ed25519.pub
+```
+
+For GitHub setup:
+
+1. Copy the public key output from both machines
+2. Go to GitHub → User Icon → Settings → SSH and GPG keys → New SSH key
+3. Add both public keys with descriptive titles:
+ - "ai-agent@strudel (MacOS laptop)"
+ - "ai-agent@groovy (Ubuntu Desktop)"
+
+Test SSH connection (run on both machines as ai-agent):
+```
+```
+
+#### Add as collaborator:
+
+- In your main account, go to repository Settings
+- Collaborators → Add people
+- Invite the new account with "Write" access
+
+#### Install gh CLI
+
+Install from main account (system-wide install)
+```
+# MacOS
+brew install gh
+
+# Ubuntu
+sudo apt install gh
+
+# Verify installation (as ai-agent on both):
+gh --version
+```
+
+#### Configure gh CLI:
+
+Generate a Personal Acess Toke (PAT in GitHub Console
+1. Login to the new GitHub account (in any browser)
+2. Go to Settings → Developer settings → Personal access tokens → Tokens (classic)
+3. Click Generate new token → Generate new token (classic)
+4. Set name
+5. Set expiry (Custom -> One year)
+6. Set permission scopes
+ - repo (all)
+ - workflow
+ - admin.org -> read.org
+ - write:discussion
+ - project (all)
+7. Generate and save in 1Password
+
+Autheticate CLI with token
+```
+gh auth login
+```
+
+1. Choose: GitHub.com
+2. HTTPS
+3. Auth w/GitHub Credentials
+4. Paste token from 1Password
+
+
+### Option 2: GitHub App Setup (Aborted)
+
+* THIS DID NOT WORK. LIKELY BUG IN CLAUDE CODE *
+
+#### Create GitHub App
+
+In GitHub console:
+
+- Creat GitHub app in GitHub profile
+ - Read and write access to actions, checks, code, commit statuses, discussions, issues, and pull requests
+- Generate and downloaded private key
+- Connect GitHub app to home-information repo.
+
+#### App Details
+
+- cassandra-ai-agent
+- App ID: 1798555
+- Client ID: Iv23lik8L3LA5QzJVd9K
+- Installation Id for home-information repo: 81448612
+- Private key: ~/.ssh//cassandra-ai-agent.2025-08-17.private-key.pem
+
+### Setting GitHub App Credentials
+
+Create Claude Code configuration directory
+```
+mkdir -p ~/.claude-code
+```
+
+Create project-specific Claude settings
+```
+cd ~/proj/hi
+mkdir -p .claude
+```
+
+Copy the GitHub app private key to both ai-agent accounts:
+```
+# As 'arc' user:
+scp ~/.ssh/cassandra-ai-agent.2025-08-17.private-key.pem strudel:/tmp
+scp ~/.ssh/cassandra-ai-agent.2025-08-17.private-key.pem groovy:/tmp
+```
+
+As ai-agent, create secure directory for GitHub App credentials
+```
+mkdir -p ~/.config/github-app
+chmod 700 ~/.config/github-app
+```
+
+Copy your .pem file to this location (you'll need to do this manually).
+```
+cp /tmp/cassandra-ai-agent.2025-08-17.private-key.pem ~/.config/github-app/github-app-private-key.pem
+```
+
+Then set proper permissions:
+```
+chmod 600 ~/.config/github-app/github-app-private-key.pem
+```
+
+Create Claude settings to use GitHub App instead of PAT
+```
+cd ~/proj/hi
+
+cat > .claude/settings.local.json << 'EOF'
+{
+ "mcp": {
+ "servers": {
+ "github": {
+ "command": "npx",
+ "args": ["-y", "@modelcontextprotocol/server-github"],
+ "env": {
+ "GITHUB_APP_ID": "1798555",
+ "GITHUB_APP_INSTALLATION_ID": "81448612",
+ "GITHUB_APP_PRIVATE_KEY_PATH": "~/.config/github-app/github-app-private-key.pem"
+ }
+ }
+ }
+ },
+ "permissions": {
+ "allow": [
+ "mcp__github__*",
+ "Bash(python manage.py:*)",
+ "Bash(./manage.py test:*)",
+ "Bash(flake8:*)",
+ "Bash(gh issue:*)",
+ "Bash(python -m pytest:*)",
+ "Bash(find:*)",
+ "Bash(grep:*)",
+ "Bash(python -m flake8:*)",
+ "Bash(python:*)",
+ "Bash(git:*)"
+ ],
+ "deny": []
+ }
+}
+EOF
+```
+
+### Node Install
+
+Also install Node.js if not available (needed for GitHub MCP server)
+```
+# On macOS (as 'arc' user who has Homebrew access available):
+brew install node
+
+# On Ubuntu (as 'arc' user who has apt access available):
+sudo apt update && sudo apt install nodejs npm
+
+```
+
+Verify ai-agent user can access required executables:
+```
+which claude
+which node
+which npm
+```
+
+### Verify Authentication to GitHub
+
+
+ est GitHub App authentication by starting Claude and asking it to list issues
+```
+claude
+```
+
+In Claude, test these commands:
+1. List the open issues in this repository
+2. Show me the recent commits
+3. What files are in the src directory?
+
+Expected results:
+- Claude Code starts without errors
+- MCP GitHub server connects successfully
+- You can see repository issues
+- GitHub App authentication works
+
+If you get errors:
+- Check file paths in settings.local.json
+- Verify .pem file permissions (should be 600)
+- Ensure the repository directory contains .claude/settings.local.json