/vibing-nvim:vibing-orchestratefrom vibing-nvim
Orchestrates parallel tasks by creating worker vibing.nvim chats, each with a self-contained brief, then aggregates results. Use when the user requests parallel work across separate chats.
Ships in vibing-nvim. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This chat becomes the orchestrator: it splits the work, creates one worker chat per task, sends each worker a brief, and later reports back. It does not babysit the workers — see "Hand control back" below, which is the part that most needs following.
The MCP server process is already bound to this chat's Neovim. Omit the optional legacy
rpc_port argument from every call below.
A chat is a unit of ownership; a subagent is a unit of delegated work inside one turn. The
most expensive mistake a postmortem (#692) found was broadcasting /simplify to five worker
chats — each spawns its own subagents, so that's the chat count times the subagent count, and it
was one of two runs that hit the session limit. Decide this before creating anything.
| Subagent | Orchestrated chat | |
|---|---|---|
| Lifetime | Dies with the parent turn | Survives restarts |
| Output | One final text blob | Its own transcript |
| Visibility | None | Buffer can be opened and read, mid-task |
| Approval prompts | Can't clear one (turn just fails) | Can handle questions and approvals |
| Owns a branch/worktree | No | Yes, via working_dir frontmatter |
| Survives a rate limit | No | Yes (auto_resume / scheduled resend) |
| Spin-up cost | Low, no protocol | Floor ~51k–61k tokens (#807) + report contract + notifications |
| Coordination can fail | No — the return value is structurally guaranteed | Yes — this run failed 9 of 18 dispatches |
A subagent is enough only if all five hold — one exception and it's a chat:
Use a chat if any one of these holds: it spans multiple turns (implement → wait on CI → address review → fix → merge); it owns a branch/worktree a later turn still needs; it will hit an approval prompt only a human should clear; a human wants to open it mid-task and steer it; it might need re-briefing after a partial failure; it has to survive a rate limit; or its transcript is itself the record you'll want later.
General rule: parallelism inside work that already has a chat belongs to subagents. Don't add chats to get parallelism — a chat's floor is ownership, not concurrency.
Default: one new chat per task (per PR, per independent unit of work). Reusing a chat saves exactly one brief, while everything that chat has already read stays in its context and is billed again on every later request — once there is more than a request or two of work left, a new chat is very likely the cheaper one.
handbook/architecture/orchestration.md → "Worker cost: reuse vs.
new chat, and brief completeness".from_bufnr is enough —
the plugin injects it from orchestrated_by every turn (#706). Keep the brief to the task itself./simplify, /code-review, …) to more than one
worker at a time. Each broadcast multiplies concurrency by that command's own subagent count.main (merges, cleanup).nc cannot hold a conversation with this RPC server. It closes on stdin EOF before the
response comes back over vim.schedule. Use Python's socket.create_connection(...) with
makefile("rwb") instead if you need to talk to it directly.Edit/Write on .claude/rules/**,
independent of this project's own permission rules. Don't brief a worker to edit rules files —
either do it yourself as the orchestrator, or write the brief assuming a human will clear it.Break the request into tasks that can run without waiting on each other. If two tasks would edit
the same files, either merge them into one task or give each its own worktree with the
vibing-worktree-create skill (git worktree add -b <branch> .vibing/worktrees/<branch>) — two
chats editing one working tree will overwrite each other, and nothing in vibing.nvim prevents it.
Separate worktrees stop the overwriting, not the overlap: two branches can still change the same
file in ways that only collide at merge time. Once workers are running, call
nvim_chat_conflicts({}) — it diffs every live chat's working_dir worktree against
main and names the files two or more of them touch. It warns, it does not block; call it before
you merge anything, and read the overlapping files in both branches yourself.
If the split isn't obvious, ask the user with a vibing-question block before creating anything. Creating
five chats for a job that was really one is expensive and the user has to clean them up.
nvim_chat_create({ position: "back", from_bufnr: <this chat's bufnr> })
nvim_chat_create({
position: "back",
from_bufnr: <this chat's bufnr>,
working_dir: ".vibing/worktrees/fix-auth",
})
position: "back" (the default) creates the buffer without opening a window, so the user's
layout is untouched. Don't use a split position for workers unless the user asked to watch them.working_dir is relative to the git root and must already exist — create the worktree first.nvim_chat_create's own
profile argument (and in nvim_chat_list's profiles), each with what it is for and the model
it runs on. A narrowed one loads a fraction of a normal chat on every request, so prefer the one
that fits the task. Built in: focused (Bash/Read/Edit/Write/Glob/Grep, project rules kept) for
implementation, reviewer (Read/Glob/Grep/Bash) for reviewing a change, and default for
anything else. Neither narrowed built-in has Skill or Agent: a worker that will need a skill
(this one included, to orchestrate in turn) or subagents needs default or a configured
profile that lists them. MCP tools, nvim_chat_create among them, stay available on every
profile. Without a
model (from the profile or yours) a worker runs on the user's default — usually as expensive
as you. A worker whose brief is complete rarely needs your model: give it model (and agent
for another CLI, e.g. agent: "codex"), and keep the design decisions in your own chat.agent / model / profile are what was actually written — check them, since
the profile and the user's worker_defaults fill whatever you leave out. The user can take a
worker over with /profile default.from_bufnr: the exact "Current vibing.nvim chat buffer number" from your
system prompt. It records the relationship in both chat files' frontmatter (orchestrated here,
orchestrated_by on the worker), which is what makes it survive a rename or a restart.file_path and bufnr for every worker, and write them into your reply
in this chat. from_bufnr records the relationship, but not which worker owns which task — that
mapping only exists in what you write here, and the transcript is where you read it back from if
the conversation is resumed later.file_path, not bufnr. Both nvim_chat_send_message and
nvim_get_buffer take either, but a buffer number only means something in the Neovim session
that issued it — after a restart the same number points at some unrelated buffer, so a
conversation resumed the next morning would drive the wrong buffer. The path keeps working, and
a worker chat that is no longer open is opened for you. Pass one or the other; passing both is
an error.permissions.delegated_approval is "scoped", declare what this worker may need
approved up front with delegated_scope (same pattern syntax as permissions_allow, e.g.
delegated_scope: ["Bash(npm:*)"]). It is written on the worker's own frontmatter, and is what
makes "Answering a worker's tool approval" below a safe machine check instead of a judgment call
each time. Skip it under true (everything is already delegated) or false (nothing is).nvim_chat_send_message({
file_path: "<worker file_path>",
from_bufnr: <this chat's bufnr>,
message: "<the whole task>",
})
Pass from_bufnr here too. It is the same value as in step 2, and sending is what registers the
relationship for a worker you did not create yourself.
A worker chat starts empty. It has none of this conversation's context: not the user's original request, not the files already discussed, not the decisions already made. Write the brief as if to someone who just walked in — goal, the files or directories involved, the constraints, and what "done" looks like. A brief that says "do the refactor we discussed" produces nothing useful.
You are writing from what you remember reading; the worker is reading the code as it is now. The gap between those two is freshness, not abstraction level, so it does not close by being more specific — a more specific brief written from memory is a wronger one. Measured over one 15-PR run: three briefs carried a design instruction, all three were wrong, and the worker was right all three times. The fix was in a different function than the brief named; an assertion the brief dictated turned out to be unfalsifiable under the gate it was written for; a change the brief specified could not detect the failure it was aimed at. A fourth brief named a symbol that existed only on another branch.
Belongs in the brief:
.vibing/patches/ is written
from git_snapshot.lua; I read it on this branch". A worker can re-verify a stated fact; it
cannot re-verify a memory you did not mark as one.Does not belong in the brief:
If you are about to write an implementation because you are afraid the worker will pick the wrong one, that fear is really an invariant you have not stated yet. State it instead.
That used to be your job to write into every brief; it is not anymore (#706). Creating the worker
with from_bufnr records orchestrated_by on it, and vibing.nvim reads that frontmatter on every
turn to inject the report protocol into the worker's own system prompt — this chat's file_path
already resolved in, the call shape (nvim_chat_send_message, from_bufnr, queue_if_busy: true),
the report shape (a few lines: the conclusion, then only what is unresolved or needs deciding), and what not
to do. The full version is the vibing-worker skill, bundled for exactly this purpose. Your brief
only needs to be the task itself, as below — writing the reporting instructions into it too is
redundant, not more reliable, since the injected line does not depend on the worker having read the
brief carefully or at all.
Do not loop on nvim_get_buffer waiting for workers to finish. A turn spent polling burns
tokens, blocks this chat, and will hit the turn limit long before a real task completes.
Once every brief is sent, end the turn with the worker list:
3件のワーカーチャットにタスクを配りました(
.vibing/chat/a.md/b.md/c.md)。 終わり次第ここに戻ります。
Each worker's own report is what wakes you. queue_if_busy: true makes that delivery reliable: a
report that arrives while you are mid-turn waits and starts a new turn the moment you stop, and
several arriving together are coalesced into one turn. This works regardless of
automation.orchestration.notifications.enabled — the report is a message the worker chose to send you, not a
notification vibing.nvim volunteers.
That setting governs the watchdog instead: with it enabled, a worker that stops without reporting wakes you anyway (step 5). With it disabled, a worker that stopped normally and simply never reported is silent — say "進捗は?と聞いてください" and wait for the user.
A blocked worker always wakes you, whatever that setting is. A worker that stopped to ask a
question, that is sitting on a tool-approval prompt, or whose turn failed cannot report: all three
kill its turn before it could call nvim_chat_send_message, and it will not run again until
someone acts on it. Those three are delivered to you regardless of
automation.orchestration.notifications.enabled, and the notice names the status.
You get woken in two ways, and they do not mean the same thing.
A worker's report — the turn carries its summary as text. This is the normal path, and the
summary is meant to be enough on its own. Do not call nvim_get_buffer on that worker unless the
summary actually leaves something open. One caveat: the user can type into a worker chat
directly, and a report may say the work was user-directed. That is a status update about the
worker's state, not the answer to anything you asked — your own brief may still be unanswered.
A watchdog notice — the turn names one or more chats you messaged and says they stopped. Two
shapes, and the difference is whether the notice carries a status:.
— status: asked_question / waiting_approval / error) the state is already established:
that chat is stuck and will not move until someone acts. Act on it from the list; you only need
nvim_get_buffer to read what it is stuck on.nvim_get_buffer({ file_path, last_section: true, tail_lines: 25 }) — not every
worker, and not a plain nvim_get_buffer call: a worker chat can run to hundreds of thousands
of lines, and reading it in full pulls that whole transcript into this conversation for the
rest of it. last_section + tail_lines gets you the end of its last turn, which is normally
enough to tell "it finished but forgot to report" from "it crashed mid-task"; go back for more
only if that tail leaves it unclear.Alongside the transcript the result carries a chat-status line, in the same vocabulary:
status: responding — a reply is still being streamed in. Whatever you just read is partial;
report it as in progress and do not summarize its conclusion.status: idle — nothing is in flight. The transcript is complete as far as that worker got, so
read its last Assistant section for the outcome.status: asked_question — the worker stopped to ask something and is waiting for an answer.
Read the question and reply with nvim_chat_send_message (passing from_bufnr), or put it to
the user if only they can decide. It will not move until someone answers.status: waiting_approval — the worker stopped on a tool-approval prompt. By default only the
user can clear that one: say which worker is blocked and on what. If the user turned on
permissions.delegated_approval (true or "scoped"), you can answer it yourself — see
"Answering a worker's tool approval" below. It is reported as waiting_approval whether or not
its turn is technically still in flight, so never read responding as "that one is fine".status: error — the last turn ended with an error. Read the tail of the transcript for the
message and decide whether to re-brief the worker or report the failure.Note that idle still means "not currently running", not "succeeded": a worker that did half its
brief and stopped is idle too. Read the tail of the transcript before calling a task done. The
three statuses above are the cases that used to hide inside idle; a status this server has no
wording for is reported by name, and means the same thing — go read the transcript.
One report is one turn, so three workers wake you three times. If workers you dispatched are still running, do not start aggregating: say in one or two lines what this one produced, and end the turn. Aggregate only on the last one. An orchestrator that writes a full summary each time produces three contradictory summaries and pays for all of them.
Track which workers are still outstanding by writing the list into your reply each time — that text is the only place the count survives between turns.
A worker may also message you directly with a question instead of finishing. Answer it with
nvim_chat_send_message (passing from_bufnr again, so its reply comes back to you) and end the
turn.
When no worker is still running, summarize the results together — what changed, what failed, what
still needs the user. Point at each worker's file_path so the user can open the full transcript.
"Not running" includes the blocked statuses above: a worker sitting on asked_question or
waiting_approval is not going to move because you waited. asked_question never resolves itself
at all. waiting_approval has a limit — once it passes, vibing.nvim denies that one tool call
and the worker carries on without it — so ignoring one does not merely stall the worker, it
silently decides the question the wrong way. Either way: report it as blocked and say what it
needs, or answer it, now.
You are worse than the worker at deciding how something should be written (step 3) and better than
it at noticing what it did not look at. On the same run that produced three wrong design
instructions, this position caught two real defects that had already passed the worker's own
review, a /code-review with no findings, a full mutation pass and green CI. Both had one
shape: the worker kept the discipline at the call sites it had in mind, and missed a third one.
So, before you call a result done or recommend merging it:
nil, a guard that now lets a
case through, a branch nothing used to take: the other defect was an existing invariant breaking
on a path the change did not touch but did open.Do not review how it was done. That is the judgment you were wrong about three times, and the worker is the one with the code in front of it. If something looks wrong, report the observation and the invariant you think it breaks, and let the worker choose the fix.
A worker that reaches a tool in its ask list has the approval prompt drawn into its own buffer
and stops there. It cannot continue and cannot report that it is stuck. By default the only
one who can clear that is the user — name the worker and the tool in your reply and end the turn.
waiting_approvals on nvim_get_buffer / nvim_chat_list lists what is open, with the
request_id to answer and whether it has expired. An expired one is still answerable — that
grant is still the user's to give — but answering it starts a new turn on that worker rather
than releasing the call it was raised for, so it only goes through once that worker has stopped.
Answer the ones that have not expired first.
If the user set permissions.delegated_approval to true or "scoped", you can answer it
instead:
nvim_get_buffer({ file_path: "<worker file_path>" }) # read what it is stuck on
nvim_chat_answer_approval({
file_path: "<worker file_path>",
action: "allow_once",
from_bufnr: <this chat's bufnr>,
})
The two modes differ in who judges the prompt:
true: you judge it, every time. You are standing in for the user on a decision they asked
to be consulted about. Answer only when the tool and its input are plainly within the brief you
wrote for that worker. Anything else — a command touching files outside the task, anything
destructive, anything you cannot place — goes to the user, with the worker and the tool named."scoped": the call judges it, against that worker's own delegated_scope frontmatter
(declared when you created it — see step 2). An allow_once/allow_for_session answer only
succeeds if the tool matches a pattern you declared up front; a deny_once/deny_for_session
answer always succeeds. This means you can just try allow_once first — a failure means it is
out of the scope you declared, so fall back to naming the worker and the tool to the user, the
same as when the setting is off. Don't try to widen the scope yourself to force a match; that
defeats the point of having declared it up front.For a Codex native approval, pass the exact value offered by its prompt (accept,
accept_for_session, accept_with_execpolicy_amendment, decline, or cancel when offered),
rather than a hook action. Prefer accept. Command approvals match Bash(...) entries in
delegated_scope using the displayed command; a shell wrapper must match as displayed.
Native file approvals use the bare Codex file change scope entry. Native refusals need no
scope. accept_with_execpolicy_amendment requires delegated_approval = true: it remembers a
command pattern that can authorize later calls beyond the declared scope, so "scoped" refuses
it even with a matching scope. Do not widen the setting to force an answer.
Regardless of mode:
allow_once. allow_for_session is written into that worker's frontmatter and
applies to every later call in it, so it outlives the one call you actually judged. Use it only
when the brief obviously needs the tool repeatedly. deny_once / deny_for_session are the
other two; a denial sends the worker back with "use a different approach", so say why in a
follow-up message if the reason matters."scoped" call misses.
Read it and put the approval to the user; don't call it again to check.Answering starts a new turn in that worker, so it will come back to you when it stops — exactly like a brief. Do not poll it.
If you used worktrees, offer the vibing-worktree-finish skill for each branch once its work has
been merged or abandoned. Don't remove a worktree on your own initiative; unmerged work lives
there.
A chat can be a worker and an orchestrator at once: briefed by a parent, and splitting its own task
across workers of its own. Your own reporting duty to that parent is the injected line in your
system prompt plus the vibing-worker skill it points to — read that for the report protocol.
Everything above still applies to how you run your own workers — plus one rule.
Report your own completion to your parent only once every worker of yours has reported.
Nothing enforces this; there is no barrier in vibing.nvim, and a message sent early is delivered
normally. The whole fan-in is this convention, so keeping it is on you. It covers only the
completion report — the immediate reports the vibing-worker skill obligates you to send your own
parent (a heads-up before an approval-prone action, or the moment you find you yourself cannot
proceed) still fire right away, whether or not your own workers have finished.
asked_question, waiting_approval or error is
not going to report because you waited, and an unanswered waiting_approval ends as a denial
of that tool call rather than as an answer. Deal with it if you can (answer the question, answer
the tool approval if that is enabled, re-brief it); if you cannot, report to your parent now with
that worker's state named, rather than holding the whole tree open for something only the user
can clear.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub shabaraba/vibing.nvim --plugin vibing-nvim12 skills in this plugin
/nvim-contextUse only when the user's request depends on live Neovim state, such as the current buffer, cursor, visual selection, unsaved edits, windows, tabs, or an explicit request to use nvim tools. Do not use for ordinary questions or tasks that do not reference the active editor./nvim-lsp-navigationUse when navigating or analyzing a codebase that's open in a running Neovim instance via vibing.nvim with an LSP client attached. Prefers the vibing-nvim MCP LSP tools (definitions, references, hover, diagnostics, symbols, call hierarchy) over text search for "where is X defined/used/called", "what type is this", "what's broken here" style questions, since they reflect language-aware, live analysis rather than a text match./vibing-chat-recallUse when a vibing.nvim chat session's context feels lost or discontinuous — after a session reset, a dropped connection, or when Claude's own reasoning no longer matches what was discussed earlier in this conversation. Re-reads this conversation's own chat buffer (the buffer announced via the "Current vibing.nvim chat buffer number:" line in the system prompt) to silently restore context. Also invoke when the user explicitly asks to "remember", "recall", or "re-read the chat history" (in any language). Not for browsing other, unrelated past chat files — use vibing-chat-search for that./vibing-chat-searchUse when the user wants to find a past vibing.nvim conversation by topic — phrases like "前に〜について聞いたことあったっけ", "did we talk about X before", "find that chat where I asked about Y". Searches every chat file under .vibing/chat/ (both User and Assistant content) for a natural-language query, narrows candidates with grep, then reads and semantically judges the survivors before presenting matches. Not for recovering this conversation's own lost context — use vibing-chat-recall for that./vibing-code-tourWalk the user through a real execution path by opening the actual files and jumping to the actual lines in their running Neovim, instead of describing the path in chat text. Use when someone asks to be walked through how something works ("walk me through the auth flow", "give me a tour of how a request gets handled", "show me step by step where this bug comes from")./vibing-workerUse when this chat's system prompt states it was started by another vibing.nvim chat (an orchestrator). Covers where and when to report back, the report's shape, and what not to do — the full version of the protocol summarized in that system-prompt line.Other plugins' skills for the same job