From fellowship
Orchestrates Research-Plan-Implement cycle for non-trivial tasks with phase gates, lembas compaction, and integration of council, gather-lore, warden skills.
How this skill is triggered — by the user, by Claude, or both
Slash command
/fellowship:questThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Orchestrates the full Research → Plan → Implement cycle with intentional compaction between phases. This is the hub skill that enforces context engineering discipline by invoking satellite skills at the right moments and maintaining hard gates between phases.
Orchestrates the full Research → Plan → Implement cycle with intentional compaction between phases. This is the hub skill that enforces context engineering discipline by invoking satellite skills at the right moments and maintaining hard gates between phases.
Phase 0: Onboard ──→ EnterWorktree → /council
│
▼
Phase 1: Research ──→ Explore agents / /gather-lore
│ Goal: understand the system, identify files
▼
/lembas
│
▼
Phase 2: Plan ──────→ Plan mode / writing-plans
│ Goal: explicit steps with file:line refs
▼
/lembas
│
▼
Phase 3: Implement ──→ TDD (test-driven-development) + execute plan
│ Goal: small verifiable changes via red-green-refactor
▼
/lembas
│
▼
Phase 3.5: Adversarial → balrog agent (edge cases, error paths, adversarial inputs)
│ Goal: find failure modes before review
▼
/lembas
│
▼
Phase 4: Review ─────→ /warden → /pr-review-toolkit:review-pr
│ → verification-before-completion
│ Goal: conventions + code quality + verified passing
▼
/lembas
│
▼
Phase 5: Complete ───→ finishing-a-development-branch
Goal: squash/merge, PR creation, cleanup
When running as a fellowship teammate (indicated by the spawn prompt), the gate prerequisite order at the end of each phase is:
/lembas to compress context (hooks verify this)TaskUpdate(taskId: "<your_task_id>", metadata: {"phase": "<current_phase>"}) (hooks verify this)[GATE] message to the lead via SendMessage using this template:[GATE] <phase> complete
## Summary
<2-3 sentences: what was done this phase, key decisions made>
## Artifacts
- <file:lines> — <what/why>
## Risks
<any concerns for the next phase, or "None">
## Next Phase Needs
<what the next phase should focus on>
Both steps 1 and 2 must complete before step 3 — the hooks will block gate submission otherwise. Valid phase names: Onboard, Research, Plan, Implement, Adversarial, Review, Complete.
Note:
.fellowship/is the default data directory. Users can override it viadataDirin~/.claude/fellowship.json. AllfellowshipCLI commands resolve the correct directory automatically. When this document references.fellowship/, it means the configured data directory.
When running as a fellowship teammate, a state file at .fellowship/quest-state.json enforces gate discipline via plugin hooks. The hooks structurally prevent you from working after submitting a gate, skipping lembas, or skipping metadata updates. You do not need to manage this file — the hooks handle it automatically.
What the hooks enforce:
.fellowship/ are blocked. You cannot modify production code until you reach the Implement phase by submitting gates. Bash, Agent, Skill, and reads are allowed in all phases.[GATE] to be detected (e.g., [GATE] Research complete\n- [x] ...)/lembas and updated task metadata with your current phaseCompleteState file initialization happens at Phase 0 (see below). If you are resuming a failed quest and .fellowship/quest-state.json already exists, the file is preserved with gate_pending reset to false.
If the spawn prompt contains a RESUME CONTEXT: block, this is a recovered quest:
fellowship init --dir $(pwd) (you're already in the worktree) to clear gate_pending while preserving the current phaseTaskUpdate(taskId: "<task_id>", metadata: {"worktree_path": "<cwd>"}) with the new task ID from the recovery spawn.fellowship/checkpoint.md exists, read it as your initial context — this replaces /council orientation/council — the checkpoint provides equivalent context from the previous sessionOn respawn, your tome at .fellowship/quest-tome.json contains your full history — phases completed, gates passed/rejected, files touched. Use this to orient faster than the checkpoint alone.
If no checkpoint exists (stale classification), restart the current phase from scratch — run /council for orientation, then begin the phase normally.
After resume setup, proceed to the gate for Phase 0 as normal (run /lembas, update metadata, send [GATE] message).
~/.claude/fellowship.json (the user's personal Claude directory) if it exists. Merge with defaults (see fellowship skill for the full schema). If the file does not exist, all defaults apply.worktree_path (via TaskGet) and the path exists on disk. If so, you're already isolated — skip worktree creation. Otherwise, if config.worktree.enabled is true (default), create an isolated worktree:
/missive with a suggested branch name, use that name directly (it already incorporates the issue number and title). Otherwise, determine the branch name using config:
branch.pattern is set: substitute {slug}, {ticket}, {author} placeholders (see below).fellowship/{slug}.{slug}: slugify the task description (lowercase, hyphens for spaces, strip non-alphanumeric). If a ticket was extracted, derive slug from the remaining text after extraction.{ticket}: match branch.ticketPattern (default: [A-Z]+-\d+) against the task description. If matched, use the match. If not matched and the pattern contains {ticket}, ask the user to provide a ticket ID.{author}: use branch.author from config. If not set and the pattern contains {author}, ask the user to provide their name.Base branch: in the CONTEXT section, use git rev-parse <base_branch> to get the SHA; otherwise run git rev-parse HEAD. Save the full SHA in your response text (not a shell variable — shell state does not persist between tool calls).EnterWorktree with the resolved branch name. If config.worktree.directory is set, create the worktree there instead of the default location.git reset --hard <sha> using the exact SHA from step 1. EnterWorktree bases off the default branch, not the current branch. This reset is what makes the worktree start from the correct point. Skip this and the worktree will be wrong.pwd and confirm the output contains your branch name or expected worktree path. When multiple quests spawn in parallel, a race condition can place your CWD in another quest's worktree. If pwd shows a different quest's worktree, run cd <expected_worktree_path> to correct it before proceeding. The expected path is the one printed by EnterWorktree (typically .claude/worktrees/<branch_name>/).fellowship init --dir <worktree_path> (using the path from EnterWorktree in step 2.2, verified correct in step 2.4) to ensure the state file is created in the correct worktree, regardless of CWD. If running as a fellowship teammate:
.fellowship/quest-state.json already exists (respawn), reset gate_pending to false and preserve the existing phase..fellowship/quest-state.json:
{
"version": 1,
"quest_name": "<quest_name>",
"task_id": "<task_id>",
"team_name": "<team_name>",
"phase": "Onboard",
"gate_pending": false,
"gate_id": null,
"lembas_completed": false,
"metadata_updated": false,
"auto_approve_gates": [],
"held": false,
"held_reason": null
}
Populate auto_approve_gates from config.gates.autoApprove if set.TaskUpdate(taskId: "<task_id>", metadata: {"worktree_path": "<cwd>"}).fellowship/quest-tome.json is automatically maintained by hooks — it records phases completed, gate events, and files touched. You do not need to manage it manually./council to load task-relevant context.If the user has already described their task, pass the description directly. Otherwise, council will ask.
Gate: Isolation set up (worktree created or skipped per config) AND Session Context block must exist before proceeding.
If the spawn prompt contains PRE-EXISTING PLAN: with a plan file path:
git reset --hard <sha> and CWD verification after EnterWorktree).fellowship/plan.md in the worktreefellowship init --dir <worktree_path> --phase Implement --plan-skip --quest <quest_name> — this creates the state file starting at Implement and records Onboard/Research/Plan as skipped in the tomefellowship errand init to create the errand file, then add one errand per plan task with fellowship errand addThe plan file at .fellowship/plan.md is your implementation blueprint for Phase 3. Use it exactly as you would use a plan created during Phase 2.
Goal: Understand the system well enough to plan changes. Stay objective — gather information, don't propose solutions yet.
If the spawn prompt contains a PROMOTED FROM: block, this is a promoted quest with pre-existing scout findings:
SCOUT FINDINGS CONTENT: with the full scout findings. Write this content to .fellowship/scout-findings-{scout_name}.md in your worktree so it survives context compression.The same hard gate requirements apply — validation mode doesn't lower the bar, it changes the starting point.
Actions:
fellowship autopsy scan --dir <main_repo> --files "<target_files>" --modules "<target_modules>"
If matches are found, incorporate their warnings into your research findings — these are hard-won lessons from previous quests that failed in the same area.fellowship bulletin scan with whatever filters you already know:
--topics "<relevant_topics>" if you know the domain/problem area--files "<target_files>" once likely files are known/gather-lore to extract conventions from reference filesHard gate — Research must produce:
If these aren't met, continue researching. Don't proceed to planning with incomplete understanding.
Transition: Invoke /lembas with phase "Research" before moving to Plan.
Goal: Outline explicit steps with file:line references and a test strategy.
Actions:
Hard gate — Plan must include:
Transition: Invoke /lembas with phase "Plan" before moving to Implement.
Goal: Execute the plan with small, verifiable changes and tight feedback loops. Default to TDD.
Errand tracking: If .fellowship/quest-errands.json exists, use it as your errand checklist. The errand file is the source of truth for remaining work, not just the original prompt. Update errand status as you complete each one: fellowship errand update --dir . <id> done. Mark errands as active when you start them and done when finished. Check fellowship errand list --dir . to see what remains.
Execution mode — choose based on plan structure:
Single-stream (default): Tasks are sequential or tightly coupled.
superpowers:test-driven-development — red-green-refactor for each unit of workParallel subagents: Plan has 3+ independent tasks touching different files.
Guidelines:
feat:, fix:, docs:, refactor:).fellowship bulletin post --quest "<quest_name>" --topic "<topic>" --files "<affected_files>" --discovery "<description>". Post refactors, API changes, infrastructure shifts, gotchas, deprecations, and research findings about shared code. Do NOT post phase progress, gate submissions, or file edit intentions.Recovery — when implementation hits a wall:
Trigger recovery when any of these occur:
Recovery procedure:
echo '{"quest":"<quest_name>","task":"<task>","phase":"Implement","trigger":"recovery","files":["<affected_files>"],"modules":["<affected_modules>"],"what_failed":"<specific description>","resolution":"<what you learned or changed>","tags":["<relevant_tags>"]}' | fellowship autopsy create --dir <main_repo>
/lembas with phase "Implement (partial)" to compact, then re-enter plan mode with the new information. Revise only the affected steps — don't replan from scratch.Transition: Invoke /lembas with phase "Implement" before moving to Adversarial Review.
Goal: Find failure modes before conventions and code quality review. Spawn balrog to attack the implementation.
Actions:
Hard gate — Adversarial Review must produce:
Transition: Invoke /lembas with phase "Adversarial" before moving to Review.
Goal: Convention compliance, code quality, and verified passing state before completion.
Actions — three sequential steps:
Step 1: Convention review
/warden to compare changes against reference files and conventionsStep 2: Code quality review
/pr-review-toolkit:review-pr for comprehensive code quality analysis (silent failure hunting, type design, test coverage)Step 3: Verification gate
superpowers:verification-before-completion — run tests for affected package(s) only, confirm build passes, verify output matches expectationsOutput: Summary of what was built, what was reviewed, verification results, and readiness for completion.
Transition: Invoke /lembas with phase "Review" before moving to Complete.
Goal: Integrate the work — squash/merge, PR creation, worktree cleanup. The quest tome is automatically marked "completed" by hooks when the task completes.
Actions:
superpowers:finishing-a-development-branch to present integration optionsconfig.pr.draft is true, create the PR as a draft. If config.pr.template is set (a string), use it as the PR body template — the template can contain {task}, {summary}, and {changes} placeholders that get filled in with the actual values./missive with PR keywords (e.g., Closes #42), include these in the PR body so the issue is automatically closed on merge.Gate: Phase 4 verification must have passed. Do not complete without a green verification step.
Use the shortened cycle when ALL of these are true:
If any condition is uncertain, run the full cycle.
Shortened cycle:
/wardennpx claudepluginhub justinjdev/fellowshipAuto-loop execution workflow with quality gates. Use when starting any non-trivial implementation task. Provides automatic task decomposition, code implementation, testing (L1-L4), and iterative quality gates until completion. Invoke with /autoworker.