Skip to content

Home Information - Your home, your data, organized.

Python

Update documentation: AI agent workflow improvements and setup clarifications

Tony Cassandra645f5180192b
diff --git a/docs/CLAUDE.md b/docs/CLAUDE.md
index e7e54224..e38b1aa7 100644
--- a/docs/CLAUDE.md
+++ b/docs/CLAUDE.md
@@ -32,9 +32,7 @@ When working on GitHub issues, follow this development workflow:
- The proposed changes have significant architectural implications
- Otherwise, proceed directly to implementation
-4. **Initialize development environment** - MANDATORY before any development work:
- - Run environment setup: `. ./init-env-dev.sh`
- - This sets up the virtual environment and all necessary environment variables
+4. **Development environment check** - The virtual environment and necessary environment variables should be set before starting claude. If there is no virtual environment, this is an indication that the environment has not been properly set up. That means the unit test cannot run and code changes cannot be validated. We shoudl stop the process and fix it. There is no need to check ever time since this shoudl be rare, but if running tests is failing, that is a good thing to look for.
5. **Create a dev branch off the staging branch** - Use proper naming convention:
- **Bug fixes**: `bugfix/##-description` (e.g., `bugfix/31-controller-modal-fix`)
@@ -56,9 +54,6 @@ When working on GitHub issues, follow this development workflow:
**NOTE**: All commands run from PROJECT ROOT directory for consistency.
```bash
-# First ensure environment is initialized (if not already done in step 4)
-. ./init-env-dev.sh
-
# 1. Run full unit test suite
src/manage.py test
# Must show: "OK" with all tests passing
@@ -155,9 +150,6 @@ This documentation helps maintain continuity across work sessions and provides v
For detailed setup and daily commands, see [Development Setup](dev/Setup.md).
```bash
-# Daily development setup
-. ./init-env-dev.sh
-
# Common commands (all run from PROJECT ROOT)
src/manage.py test
flake8 --config=src/.flake8-ci src/hi/
diff --git a/docs/dev/AiAgentSetup.md b/docs/dev/AiAgentSetup.md
index 1c991e42..80d7b802 100644
--- a/docs/dev/AiAgentSetup.md
+++ b/docs/dev/AiAgentSetup.md
@@ -161,8 +161,73 @@ git config --global user.name "AI Agent"
git config --global user.email "[email protected]"
```
+## App Development Setup
-### Install Claude Code
+### Environment Variables
+
+**Note**: This is mostly duplicative to [Setup.md](Setup.md) though slightly customized for the AI agent setup. Check there if you run into issues in case this file gets outdated.
+
+Create environment variables for secrets (never commit these!)
+```
+# Copy your development.sh file
+
+cd ~/proj/hi
+mkdir -p .private/env
+cat > .private/env/development.sh << 'EOF'
+[[paste your development.sh contents here]]
+EOF
+```
+
+### Redis Tweaks
+
+If you also are presonally also doing development on the same machine, then you should be running Redis and that can also be used by the agent with no extra Redis server needed, but with an environment variable tweak needed (see below).
+
+If Redis is not running on the machine, you'll need to install and/or start redis as shown in [Dependencies.md](Dependencies.md).
+
+When sharing the same Redis server, we will need to avoid collisions on the key space between development environments. There is a Redis key prefix environment variable that can be used to do that. For the ai-agent user, chnage this:
+
+export HI_REDIS_KEY_PREFIX="dev-ai"
+```
+grep -q "HI_REDIS_KEY_PREFIX" .private/env/development.sh && sed -i '' '/HI_REDIS_KEY_PREFIX/c\
+export HI_REDIS_KEY_PREFIX="dev-ai"
+' .private/env/development.sh
+
+# Then verify value change
+grep HI_REDIS_KEY_PREFIX .private/env/development.sh
+```
+
+### Virtual Environment
+
+Create and initialize virtual environment
+```
+python3.11 -m venv venv
+
+# Activate and source
+. ./init-env-dev.sh
+```
+
+Install python dependencies
+```
+pip install -r src/hi/requirements/development.txt
+```
+
+### App and Database Initializations
+```
+cd ~/proj/hi
+mkdir -p data/database
+./src/manage.py check
+./src/manage.py migrate
+./src/manage.py hi_createsuperuser
+./src/manage.py hi_creategroups
+```
+
+Verify app code
+```
+cd ~/proj/hi
+make check
+```
+
+## Claude Code
Install Claude Code using the official installer
```
@@ -182,7 +247,7 @@ claude-code --version
```
-## MacOS-only Create Keychain for Claude OAuth token
+### MacOS-only Create Keychain for Claude OAuth token
**Critical**: Terminal-created users don't have a login keychain, which Claude needs.
@@ -225,7 +290,7 @@ chmod +x ~/start-claude.sh
~/start-claude.sh
```
-## Run OAuth flow to Autheticate to Anthropic
+### Run OAuth flow to Autheticate to Anthropic
- Start up with `claude`.
- Select the color scheme when prompted
@@ -314,9 +379,9 @@ gh auth login
4. Paste token from 1Password
-### Option 2: GitHub App Setup (Aborted)
+## Option to Avoid: GitHub App Setup (Aborted)
-* THIS DID NOT WORK. LIKELY BUG IN CLAUDE CODE *
+* THIS DID NOT WORK. LIKELY BUG IN CLAUDE CODE. SAVING STEPS FOR REFERFENCE ONLY. *
#### Create GitHub App
@@ -432,7 +497,7 @@ which npm
### Verify Authentication to GitHub
- est GitHub App authentication by starting Claude and asking it to list issues
+Test GitHub App authentication by starting Claude and asking it to list issues
```
claude
```
diff --git a/docs/dev/Setup.md b/docs/dev/Setup.md
index 33b8429c..bd346175 100644
--- a/docs/dev/Setup.md
+++ b/docs/dev/Setup.md
@@ -1,6 +1,6 @@
<img src="../../src/hi/static/img/hi-logo-w-tagline-197x96.png" alt="Home Information Logo" width="128">
-# Development Setup (one-time setup)
+# Development Setup (one-time setup, external dev)
## Fork the Repository
@@ -48,7 +48,6 @@ upstream https://github.com/cassandra/home-information.git (fetch)
upstream https://github.com/cassandra/home-information.git (push)
```
-
If your origin is not set properly, re-verify after setting with:
``` shell
git remote add origin [email protected]:${YOURUSERNAME}/home-information.git