Skip to content

feat: implement task-based worker naming#323

Open
aronchick wants to merge 16 commits intodlorenc:mainfrom
aronchick:work/kind-fox
Open

feat: implement task-based worker naming#323
aronchick wants to merge 16 commits intodlorenc:mainfrom
aronchick:work/kind-fox

Conversation

@aronchick
Copy link
Copy Markdown
Contributor

Summary

Replace random worker names with descriptive task-based names. Workers are now named like fix-session-id-bug instead of calm-owl.

Changes:

  • Implemented names.FromTask() for extracting 3-4 keywords from task descriptions
  • Added names.EnsureUnique() for handling duplicate names with numeric suffixes
  • Updated createWorker() in internal/cli/cli.go to use task-based naming
  • Added 20+ comprehensive tests covering all edge cases
  • Created WORKER_NAMING_SPEC.md specification document
  • Created WORKER_NAMING_EXAMPLES.md usage guide

Key Features:

  1. Keyword extraction: Removes stop words and extracts meaningful terms
  2. Sanitization: Converts to lowercase-hyphenated format (max 50 chars)
  3. Uniqueness: Appends numeric suffixes (-2, -3) for duplicates
  4. Fallback: Uses random names if extraction fails
  5. Manual override: Preserves --name flag for custom names

Examples:

  • "Fix session ID bug in authentication"fix-session-id-bug
  • "Add user profile editing feature"add-user-profile-editing
  • "Implement OAuth2 login flow"implement-oauth2-login-flow

Benefits:

  • Immediate clarity on worker purpose
  • Self-documenting git branches (work/fix-session-id-bug)
  • Easier debugging and monitoring
  • Better PR identification

Test plan

  • All existing tests pass (go test ./...)
  • 20+ new tests for naming logic (extraction, sanitization, uniqueness, fallback)
  • Binary builds successfully
  • Integration with CLI verified
  • Manual testing: Create workers with various task descriptions
  • Verify unique naming works with multiple workers

🤖 Generated with Claude Code

Replace random adjective-animal names with descriptive task-based names.
Workers are now named like 'fix-session-id' instead of 'calm-owl'.

Implementation:
- Extract 3-4 keywords from task description (filter stop words)
- Sanitize to lowercase-hyphenated format
- Handle uniqueness with numeric suffixes (-2, -3, etc.)
- Fallback to random names if extraction fails
- Preserve --name flag for manual override

Changes:
- Add names.FromTask() for task-based name generation
- Add names.EnsureUnique() for uniqueness handling
- Update createWorker() to use new naming by default
- Add comprehensive tests (20+ test cases)
- Add WORKER_NAMING_SPEC.md specification
- Add WORKER_NAMING_EXAMPLES.md usage guide

Benefits:
- Immediate clarity on worker purpose from name
- Self-documenting git branches (work/fix-session-id)
- Easier debugging and monitoring in logs/tmux
- Better PR identification from branch names

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@buggtb
Copy link
Copy Markdown

buggtb commented Jan 29, 2026

CI Status: Lint Failing

This PR has lint errors that need to be fixed before it can be merged.

Checks failing:

  • Lint: fail

All other checks (Build, E2E, Unit Tests, Coverage) are passing.

Action needed: Please fix the lint issues to unblock this PR.

🤖 Merge-queue agent

dlorenc and others added 15 commits January 29, 2026 19:11
* fix: append custom agent definitions to base templates instead of replacing

Custom agent definitions from .multiclaude/agents/ are now appended to
the base templates from ~/.multiclaude/repos/<repo>/agents/ instead of
replacing them entirely. This ensures critical instructions like
'multiclaude agent complete' are never lost when users customize their
agent definitions.

Changes:
- Add SourceMerged constant to indicate merged definitions
- Update MergeDefinitions to append content with "## Custom Instructions"
  separator when names match
- Update unit and integration tests to verify new append behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: remove extra blank line for gofmt compliance

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Test User <test@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Removed gopkg.in/yaml.v3 which was listed in go.mod but never imported.
Discovered via `go mod tidy` lint warning.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…Ls (dlorenc#320)

Fixes two bugs in the init command:

1. The init command now checks if a repository is already initialized or if
   the tmux session already exists before attempting to create them. Previously,
   users would get cryptic "exit status 1" errors when trying to re-initialize
   a repo. Now they get clear error messages with actionable suggestions.

2. The GitHub URL parser now supports repository names containing dots (e.g.,
   demos.expanso.io). The regex was too restrictive and excluded dots from
   repo names, causing fork detection to fail for repos with dotted names.

Changes:
- Add pre-flight checks in initRepo to verify repo doesn't exist in state
- Check if repository directory already exists before cloning
- Check if tmux session exists before attempting to create it
- Update regex in ParseGitHubURL to allow dots in repository names
- Update test to reflect that dots in repo names are now supported

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
…add (dlorenc#322)

Fixes state inconsistency issues when init or workspace add commands fail
partway through execution. Previously, if these commands failed after creating
tmux sessions/windows but before updating state, re-running would fail with
cryptic tmux errors.

Changes:
- initRepo: Check for existing tmux session and state entry before creation
  - Auto-repair by killing stale tmux sessions
  - Clear error if repo already tracked in state
- addWorkspace: Check for existing tmux window and worktree before creation
  - Auto-repair by killing stale tmux windows
  - Auto-repair by removing stale worktrees

This improves P0 "Clear error messages" goal by preventing confusing error
states and making the system self-healing.

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds spec-driven proposal for unified repo lifecycle commands:
- repo start: Initialize all standard agents
- repo status: Comprehensive status display
- repo hibernate: Pause agents, preserve state
- repo wake: Resume hibernated repo
- repo refresh: Sync worktrees with main
- repo clean: Remove orphaned resources

Includes design decisions, implementation tasks, and detailed specs.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…orenc#314)

Addresses P0 roadmap item "Worktree sync". Adds:
- trigger_refresh socket command in daemon
- multiclaude refresh CLI command that triggers immediate worktree sync
- Allows merge-queue or users to force refresh after PRs merge

The existing 5-minute refresh loop continues unchanged; this adds
on-demand capability for faster sync when needed.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Fork package tests were failing on machines with global git URL rewrite
rules (e.g., url.git@github.com:.insteadof=https://github.com/). Tests
expected exact HTTPS URLs but git was returning SSH URLs due to the
global insteadOf configuration.

Changes:
- Add gitCmdIsolated() helper that runs git with GIT_CONFIG_GLOBAL and
  GIT_CONFIG_SYSTEM set to /dev/null for deterministic behavior
- Add urlsEquivalent() helper for semantic URL comparison (owner/repo
  match) instead of exact string matching
- Update all test git commands to use isolated environment
- Update URL comparisons to use semantic equivalence

This makes tests deterministic regardless of developer's local git
configuration.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add repo hibernate command to archive and stop work

Adds `multiclaude repo hibernate` command that cleanly stops all work
in a repository while preserving uncommitted changes:

- Archives uncommitted changes as patch files to ~/.multiclaude/archive/<repo>/<timestamp>/
- Saves metadata (branch, task, worktree path) for each agent
- Lists untracked files separately for manual restoration
- Stops workers and review agents by default (--all for persistent agents)
- Force-removes worktrees after archiving to ensure clean shutdown

Also adds ArchiveDir to Paths config and updates all test files to include it.

Usage: multiclaude repo hibernate [--repo <repo>] [--all] [--yes]

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address lint issues in hibernate command

- Check error return from client.Send (errcheck)
- Fix formatting with gofmt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Implements dlorenc#305 - adds a memorable `multiclaude status` command that:

- Shows daemon status (running/not running/unhealthy)
- Lists tracked repos with agent counts
- Gracefully handles daemon not running (no error, just shows status)
- Provides helpful hints for next steps

Unlike `multiclaude list` which errors when daemon is unavailable,
`multiclaude status` always succeeds and shows what it can.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…ker (dlorenc#307)

Extends worker template with two new capability sections:

**Environment Hygiene:**
- Shell history stealth (leading space prefix)
- Pre-completion cleanup (verify no credentials leaked)

**Feature Integration Tasks:**
- Reuse First principle
- Minimalist Extensions guidance
- PR analysis workflow
- Integration checklist

Follows the concise style of the existing worker template.

Fixes dlorenc#282
Fixes dlorenc#283

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: Add CI guard rails for local validation

Adds Makefile and pre-commit hook to run CI checks locally before pushing.

This prevents the common issue where CI fails after code is already pushed,
by enabling developers to run the exact same checks that GitHub CI runs.

Features:
- Makefile with targets matching all CI jobs (build, unit-tests, e2e-tests, verify-docs, coverage)
- Pre-commit hook script for automatic validation
- Updated CLAUDE.md with usage instructions

Usage:
  make pre-commit    # Fast checks before commit
  make check-all     # Full CI validation
  make install-hooks # Install git pre-commit hook

* Update verify-docs to fix CI

* Use double quotes for regex to avoid syntax errors

* Update Makefile to include verify-docs check

* Fix unused verbose variable in verify-docs
Add comprehensive tests for daemon handlers with low coverage:
- handleTriggerRefresh (0% → 100%)
- handleRestartAgent (validation error paths)
- handleSpawnAgent (argument validation and error cases)
- handleRepairState (basic functionality)
- handleTaskHistory (with filters and limits)
- handleListAgents (with multiple agents)
- handleUpdateRepoConfig (merge queue and PR shepherd settings)
- handleGetRepoConfig (validation and success cases)

The tests use table-driven patterns consistent with existing tests
and focus on testing argument validation and error handling paths
that don't require actual tmux or Claude process startup.

Co-authored-by: Test User <test@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…c#331)

Add helper functions to socket package for creating responses:
- ErrorResponse(format, args...) for error responses with formatting
- SuccessResponse(data) for success responses

Add argument extraction helpers in daemon:
- getOptionalStringArg for optional string arguments with defaults
- getOptionalBoolArg for optional bool arguments with defaults

Refactored all 50 handler response patterns in daemon.go to use
the new helpers, improving consistency and reducing boilerplate.
This also simplifies fork config parsing from ~12 lines to ~4 lines.

Co-authored-by: Test User <test@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Port changes from #66:

- Add docs/TASK_MANAGEMENT.md with comprehensive guide for Claude Code's
  task management tools (TaskCreate/Update/List/Get)
- Add internal/diagnostics package for machine-readable system diagnostics
- Add 'multiclaude diagnostics' CLI command outputting JSON with:
  * Claude CLI version and capability detection
  * Task management support detection (v2.0+)
  * Environment variables (with sensitive value redaction)
  * System paths and tool versions
  * Daemon status and agent statistics
- Add daemon startup diagnostics logging for monitoring
- Update supervisor and worker prompts with task management guidance
  (adapted to new concise prompt style from dlorenc#302)

The diagnostics endpoint helps operators understand the multiclaude
environment, and task management enables agents to organize complex
multi-step work while maintaining the "focused PRs" principle.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Simplified the character validation logic in isValidName() by applying
De Morgan's law to the negated OR expression. This fixes the QF1001
staticcheck lint error.

Before: !((r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r == '-')
After:  (r < 'a' || r > 'z') && (r < '0' || r > '9') && r != '-'

Both expressions are logically equivalent but the second form is more
idiomatic and what the linter expects.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants