Configure Rails for Conductor Parallel Agents
Scaffolds a Rails project for Conductor's parallel coding-agent workspaces with isolated ports and Redis DBs.
Why it matters
Set up your Rails project to run seamlessly within Conductor workspaces, enabling parallel coding agents with isolated ports, Redis configurations, and shared secrets.
Outcomes
What it gets done
Create and configure `conductor.json` for script execution.
Implement `bin/conductor-setup` for managing environment variables and dependencies.
Develop `script/server` for port isolation and Redis URL configuration.
Update Rails configuration files for proper Redis integration.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-conductor-setup | bash Overview
What to Create
Rails project scaffolding skill for Conductor's parallel coding-agent workspaces, generating conductor.json, an executable setup script that symlinks secrets, and a server script that isolates ports and Redis per workspace via a hashed workspace name. Use when configuring a Rails project to run inside Conductor workspaces needing isolated ports and Redis settings for parallel coding agents.
What it does
This skill sets up a Rails project to run correctly inside Conductor, the Mac app for parallel coding agents, so multiple agent workspaces get isolated ports, isolated Redis databases, and shared secrets without conflicting with each other. It creates conductor.json in the project root (if not already present) declaring a setup script (bin/conductor-setup) and a run script (script/server). It creates the executable bin/conductor-setup, which symlinks .env and the Rails config/master.key from the repo root - where secrets live, outside the per-workspace worktrees - and then runs bundle install and npm install. It creates the executable script/server, which sets PORT from $CONDUCTOR_PORT (defaulting to 3000), derives a separate Vite port by adding 1000, and, when $CONDUCTOR_WORKSPACE_NAME is set, hashes that workspace name with cksum to pick one of 16 isolated Redis database numbers exported as REDIS_URL, before executing bin/dev. For any of four existing Rails config files that already configure Redis - config/initializers/sidekiq.rb, config/cable.yml, config/environments/development.rb, and config/initializers/rack_attack.rb - it updates them to read ENV.fetch('REDIS_URL', ...) (or ENV['REDIS_URL']) with a sensible localhost fallback, so each workspace's isolated Redis DB is actually used. Implementation notes: it never overwrites conductor.json, bin/conductor-setup, or script/server if they already exist (it skips creation and informs the user instead), it only touches Redis-related configuration and skips files that don't exist or don't use Redis, and it creates the script/ directory if needed. Verification confirms all Conductor files exist and are executable, runs script/server to check it starts without errors, and checks that Rails configs properly reference ENV['REDIS_URL'] or the ENV.fetch fallback form.
When to use - and when NOT to
Use this skill when configuring a Rails project to run correctly inside Conductor workspaces, needing isolated ports and Redis settings for parallel coding agents, or wanting the standard conductor.json/bin/conductor-setup/script/server scaffolding for a Rails repo. It is specific to Rails projects and Conductor's workspace model, not a general-purpose project scaffolding tool. Of the four Redis-configuring files it updates, config/cable.yml falls back to database 1 while the other three default to database 0.
Inputs and outputs
Input is a Rails project that needs to run inside Conductor's parallel-workspace model. Output is a conductor.json manifest, an executable bin/conductor-setup that symlinks secrets and installs dependencies, an executable script/server that isolates ports and Redis per workspace, and updated Rails config files reading REDIS_URL from the environment with a fallback, skipped gracefully for any of the four config files that don't exist or don't use Redis, with the target Redis database chosen via the literal formula $((HASH % 16)).
Integrations
Built for Conductor (the Mac app for parallel coding agents), targeting Rails projects using Bundler, npm, Sidekiq, Action Cable, Rails caching, and Rack::Attack, all reading Redis connection details from $REDIS_URL.
#!/bin/bash
set -e
### Symlink .env from repo root (where secrets live, outside worktrees)
[ -f "$CONDUCTOR_ROOT_PATH/.env" ] && ln -sf "$CONDUCTOR_ROOT_PATH/.env" .env
### Symlink Rails master key
[ -f "$CONDUCTOR_ROOT_PATH/config/master.key" ] && ln -sf "$CONDUCTOR_ROOT_PATH/config/master.key" config/master.key
### Install dependencies
bundle install
npm install
Who it's for
Rails developers using Conductor who need isolated ports, isolated Redis databases, and shared secrets scaffolded consistently across parallel agent workspaces.
Source README
Set up this Rails project for Conductor, the Mac app for parallel coding agents.
When to Use
- You need to configure a Rails project so it runs correctly inside Conductor workspaces.
- The project should support parallel coding agents with isolated ports, Redis settings, and shared secrets.
- You want the standard
conductor.json,bin/conductor-setup, andscript/serverscaffolding for a Rails repo.
What to Create
1. conductor.json (project root)
Create conductor.json in the project root if it doesn't already exist:
{
"scripts": {
"setup": "bin/conductor-setup",
"run": "script/server"
}
}
2. bin/conductor-setup (executable)
Create bin/conductor-setup if it doesn't already exist:
#!/bin/bash
set -e
### Symlink .env from repo root (where secrets live, outside worktrees)
[ -f "$CONDUCTOR_ROOT_PATH/.env" ] && ln -sf "$CONDUCTOR_ROOT_PATH/.env" .env
### Symlink Rails master key
[ -f "$CONDUCTOR_ROOT_PATH/config/master.key" ] && ln -sf "$CONDUCTOR_ROOT_PATH/config/master.key" config/master.key
### Install dependencies
bundle install
npm install
Make it executable with chmod +x bin/conductor-setup.
3. script/server (executable)
Create the script directory if needed, then create script/server if it doesn't already exist:
#!/bin/bash
### === Port Configuration ===
export PORT=${CONDUCTOR_PORT:-3000}
export VITE_RUBY_PORT=$((PORT + 1000))
### === Redis Isolation ===
if [ -n "$CONDUCTOR_WORKSPACE_NAME" ]; then
HASH=$(printf '%s' "$CONDUCTOR_WORKSPACE_NAME" | cksum | cut -d' ' -f1)
REDIS_DB=$((HASH % 16))
export REDIS_URL="redis://localhost:6379/${REDIS_DB}"
fi
exec bin/dev
Make it executable with chmod +x script/server.
4. Update Rails Config Files
For each of the following files, if they exist and contain Redis configuration, update them to use ENV.fetch('REDIS_URL', ...) or ENV['REDIS_URL'] with a fallback:
config/initializers/sidekiq.rb
If this file exists and configures Redis, update it to use:
redis_url = ENV.fetch('REDIS_URL', 'redis://localhost:6379/0')
config/cable.yml
If this file exists, update the development adapter to use:
development:
adapter: redis
url: <%= ENV.fetch('REDIS_URL', 'redis://localhost:6379/1') %>
config/environments/development.rb
If this file configures Redis for caching, update to use:
config.cache_store = :redis_cache_store, { url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0') }
config/initializers/rack_attack.rb
If this file exists and configures a Redis cache store, update to use:
Rack::Attack.cache.store = ActiveSupport::Cache::RedisCacheStore.new(url: ENV.fetch('REDIS_URL', 'redis://localhost:6379/0'))
Implementation Notes
- Don't overwrite existing files: Check if conductor.json, bin/conductor-setup, and script/server exist before creating them. If they exist, skip creation and inform the user.
- Rails config updates: Only modify Redis-related configuration. If a file doesn't exist or doesn't use Redis, skip it gracefully.
- Create directories as needed: Create
script/directory if it doesn't exist.
Verification
After creating the files:
- Confirm all Conductor files exist and scripts are executable
- Run
script/serverto verify it starts without errors - Check that Rails configs properly reference
ENV['REDIS_URL']orENV.fetch('REDIS_URL', ...)
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.