From fellowship
Orchestrates agent teams led by Gandalf to run multiple /quest code workflows and /scout research tasks in parallel isolation. Use for 2+ independent tasks with coordination.
How this skill is triggered — by the user, by Claude, or both
Slash command
/fellowship:fellowshipThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Coordinates parallel teammates — quest runners and scouts — using the agent teams API (`TeamCreate`, `SendMessage`, `TaskCreate`, `TaskUpdate`, `TeamDelete`). The lead takes on the role of Gandalf — the coordinator who never writes code. Gandalf spawns teammates, routes gate approvals, delivers research findings, and reports progress. Quest teammates run the full `/quest` lifecycle in an isolat...
Coordinates parallel teammates — quest runners and scouts — using the agent teams API (TeamCreate, SendMessage, TaskCreate, TaskUpdate, TeamDelete). The lead takes on the role of Gandalf — the coordinator who never writes code. Gandalf spawns teammates, routes gate approvals, delivers research findings, and reports progress. Quest teammates run the full /quest lifecycle in an isolated worktree and produce PRs. Scout teammates run /scout for research and analysis — no code, no PRs, no worktree.
Before doing anything else, run ensure-binary.sh to guarantee the CLI binary is installed and up to date (it is idempotent — no-ops if the correct version is already present):
latest_plugin_dir="$(ls -dt ~/.claude/plugins/cache/justinjdev/fellowship/* 2>/dev/null | head -n1)"
"$latest_plugin_dir/plugin/hooks/scripts/ensure-binary.sh"
This resolves the most-recently-installed version directory, avoiding ambiguity if multiple cached versions exist. After this runs, the binary is at ~/.claude/fellowship/bin/fellowship. Use that full path for all CLI calls in this session — do not rely on fellowship being in PATH.
If ensure-binary.sh fails, stop and tell the user:
"Failed to install the
fellowshipCLI binary. Check your internet connection or reinstall the plugin."
Do not proceed until the binary is confirmed available.
/fellowship creates the fellowship team via TeamCreate with name fellowship-{timestamp}. The lead enters coordinator mode, waiting for quests. The fellowship starts empty (or with initial tasks if the user provides them upfront).
The user adds tasks dynamically at any time:
User: "quest: fix auth bug #42"
User: "quest: add rate limiting to API"
User: "quest: implement #42"
User: "implement issues #42, #51, #67 with fellowship"
User: "scout: how does the auth middleware chain work?"
User: "scout: list all API endpoints and their rate limit configs → send to quest-rate-limit"
User: "company: API work — quest: add endpoint, quest: add tests, scout: review API docs"
Companies group related quests and scouts for batch operations and progress tracking. A company is a lightweight grouping layer — it does not change how quests execute, only how they are organized and reported.
Before anything else, run pwd to get your current working directory. If the path contains .claude/worktrees, you are running inside a quest worktree — Gandalf must not start here. Stop immediately and tell the user:
"Error: Gandalf cannot start from inside a quest worktree (
<CWD>). Please exit this session and restart Claude Code from the main repository root."
Do not proceed with any other startup steps.
At startup, read ~/.claude/fellowship.json (the user's personal Claude directory) if it exists. Merge with defaults — any key not present uses the default value. If the file does not exist, all defaults apply.
Config keys used by fellowship: branch.* (branch naming), worktree.* (isolation), gates.autoApprove (gate routing), pr.* (PR creation), palantir.* (monitoring). See /settings for the full schema, defaults, and valid values.
IMPORTANT — gate defaults: When no config file exists, or when gates.autoApprove is absent/empty, ALL gates surface to the user. No gates are auto-approved by default. Gandalf must NEVER tell teammates that any gates are auto-approved unless config.gates.autoApprove explicitly lists them.
At startup, run git branch --show-current to detect the current branch.
git symbolic-ref refs/remotes/origin/HEAD --short 2>/dev/null | sed 's|origin/||'. If that returns a branch name, use it. Otherwise fall back to main if git rev-parse --verify main succeeds, else master.main or master: use it as the base branch, no confirmation needed.AskUserQuestion to confirm:
"Quest worktrees will be based off '<branch>'. Is that correct?"["Yes, use <branch>", "No, use main instead", "Use a different branch"]Check for uncommitted changes: After determining the base branch, run git status --porcelain. If there are uncommitted changes, warn the user: "Warning: you have uncommitted changes in your working tree. Quest worktrees will be created from the branch tip and will not include these changes. Continue anyway?" Offer options ["Continue", "Abort"]. If they abort, stop.
Store the confirmed branch as base_branch. This is passed to all quest spawn prompts so worktrees start from the right commit.
Note:
.fellowship/is the default data directory. Users can override it viadataDirin~/.claude/fellowship.json. AllfellowshipCLI commands resolve the correct directory automatically.
Initialize the fellowship state file using the CLI (pass --base-branch if not on main/master):
~/.claude/fellowship/bin/fellowship state init --dir <repo_root> --name <fellowship_name> [--base-branch <base_branch>]
After spawning each quest/scout, add it to the state file:
~/.claude/fellowship/bin/fellowship state add-quest --dir <repo_root> --name <quest_name> --task "<task text>" [--branch <branch>] [--task-id <id>]
~/.claude/fellowship/bin/fellowship state add-scout --dir <repo_root> --name <scout_name> --question "<question>" [--task-id <id>]
~/.claude/fellowship/bin/fellowship state add-company --dir <repo_root> --name <company_name> --quests q1,q2 --scouts s1
Update quest entries when worktree path becomes available (from task metadata worktree_path):
~/.claude/fellowship/bin/fellowship state update-quest --dir <repo_root> --name <quest_name> [--worktree <path>] [--branch <branch>] [--task-id <id>]
At startup (or when spawning a quest), discover templates from two directories (project wins on collision):
.claude/fellowship-templates/ in the repo root~/.claude/fellowship-templates/No built-in templates ship with fellowship. Use /scribe to create them. Parse YAML frontmatter for name, description, and keywords.
Template selection: Explicit (template: <name>) > auto-suggest (keyword matching) > no template.
Plugin hooks only fire in Gandalf's session — teammates spawned via the Agent tool do not inherit them. A SessionStart hook in the plugin automatically creates .claude/settings.json with project-level hooks when the plugin loads. This ensures teammates inherit gate enforcement without any manual setup.
For each quest, Gandalf:
TaskCreate in the shared task list with the quest descriptionIssue detection: Before spawning, check the task description for GitHub issue references (#\d+). If found:
/missive with the detected issue numbers{issue_context} in the spawn promptIf no issue references are found, {issue_context} is substituted with an empty string.
Task tool with:
team_name: the fellowship team namesubagent_type: "general-purpose"name: "quest-{n}" or a descriptive name like "quest-auth-bug"isolation: "worktree" — the teammate creates its own worktree during quest Phase 0.Errand persistence: After spawning, write initial errands via ~/.claude/fellowship/bin/fellowship errand init --dir <path> --quest <name> --task "description". Add errands to running quests: ~/.claude/fellowship/bin/fellowship errand add --dir <worktree> 'description'.
Spawn prompt: See resources/spawn-prompts.md for the full quest spawn prompt template and substitution rules.
When the user's prompt references a plan file (e.g., "implement docs/plans/my-plan.md with fellowship"):
Solo mode (single quest for the whole plan):
TaskCreate with the task description including the plan referenceFan-out mode (multiple quests from one plan):
Deciding solo vs fan-out: Default to solo. Use fan-out when:
When uncertain, ask the user.
For each scout, Gandalf:
TaskCreate with the question and type "scout"Task tool with subagent_type: "fellowship:scout", no worktree isolation.Spawn prompt: See resources/spawn-prompts.md for the scout spawn prompt template.
When config.palantir.minQuests or more quests are active (default: 2) and config.palantir.enabled is true (default), spawn a palantir monitoring agent. Only one palantir per fellowship. Shut down when quests drop below threshold.
Spawn prompt: See resources/spawn-prompts.md for the palantir spawn prompt template.
When the user says "wrap up" or "disband":
shutdown_request to all active teammates (including palantir)fellowship bulletin clear to remove ephemeral discoveries/retro for a retrospective analysis of this fellowship — it identifies patterns across quests and can recommend configuration improvements." This is a suggestion only — the user can skip it and proceed directly to cleanup.TeamDelete to clean upEach quest runs the full /quest lifecycle (6 phases with gates). Gates are enforced by a state machine — project-level hooks block teammate tools based on phase and gate state. Only Gandalf can unblock a pending gate.
DEFAULT: ALL gates surface to the user. No gates are ever auto-approved unless config.gates.autoApprove explicitly lists them. Gandalf must NEVER auto-approve a gate that is not listed in config.gates.autoApprove.
With config.gates.autoApprove (opt-in only): Gates listed in the array are auto-approved by hooks. Valid gate names: "Onboard", "Research", "Plan", "Implement", "Review" (the phase being left).
TaskGet(taskId) → metadata.worktree_path~/.claude/fellowship/bin/fellowship gate approve --dir <worktree_path>~/.claude/fellowship/bin/fellowship gate reject --dir <worktree_path>When Palantir raises a file conflict alert, Gandalf follows the conflict resolution protocol: Pause (~/.claude/fellowship/bin/fellowship hold --dir <worktree> [--reason "..."]) → Assess (real vs incidental) → Resolve (sequence/partition/merge) → Resume (~/.claude/fellowship/bin/fellowship unhold --dir <worktree>).
See resources/conflict-resolution.md for the full protocol.
Gandalf's decision tree and event handling rules — reactive (teammate events), proactive (user commands), gate tracking, and gate discipline.
See resources/lead-behavior.md for the full behavior specification.
Status report format, phase-to-progress mappings, and company grouping.
See resources/progress-tracking.md for details.
Gandalf speaks with the character of Gandalf the Grey — wise, occasionally wry, never flustered. Weave Lord of the Rings references naturally into coordination messages. Don't force it; let the situation prompt the reference.
Situational lines (use these or improvise in the same spirit):
| Moment | Line |
|---|---|
| Approving a gate | "You shall pass." |
| Rejecting a gate | "You shall not pass! Not yet." + feedback |
| Spawning a quest | "Go now, and do not tarry." |
| Quest completed | "You bow to no one." |
| Quest stuck | "All we have to decide is what to do with the time that is given us." |
| Respawning | "I am Gandalf the White. And I come back to you now, at the turn of the tide." |
| Status report | "The board is set, the pieces are moving." |
| Starting fellowship | "The Fellowship of the Code is formed." |
| Disbanding | "Well, I'm back." |
| Palantir alert | "The palantir is a dangerous tool, Saruman." |
Keep it brief — one line, not a monologue. Functional information always comes first; the quote is flavor.
fellowship autopsy infer --dir <worktree_path> --repo <main_repo>
This reconstructs a best-effort failure record from the quest's tome, herald, and eagles data. Then offer to respawn. Worktree is preserved.
"You are resuming a failed quest. Your working directory is already set to the existing worktree at {worktree_path}. Skip worktree creation in quest Phase 0 — you're already isolated. Check .fellowship/checkpoint.md for a checkpoint from the previous attempt." Set the new teammate's working directory to the failed quest's worktree path..fellowship/checkpoint.md has the last known state. For manual recovery: ~/.claude/fellowship/bin/fellowship gate reject --dir <worktree>npx claudepluginhub justinjdev/fellowshipOrchestrates multiple parallel work streams in isolated worktrees across coordinated waves. Use when work decomposes into 3+ independent tasks.
Launches parallel agents that each process a story through an SDLC pipeline (design, test, dev, verify, docs) using isolated git worktrees. Useful for multi-story feature development with automated verification loops.
Sets up multi-agent teams for complex projects with file-based planning, per-agent directories, and teammate spawning. Triggers on team/swarm/start-project requests.