Multi-line Continuations
Relevant source files
The following files were used as context for generating this wiki page:
Multi-line continuations in PlanQueue allow users to group supplementary information, details, or extended code blocks with a primary task line. This ensures that when a task is dispatched from the prompt queue to an agent, all associated context is sent as a single, coherent multi-line message rather than fragmented inputs.
Within the PlanQueue ecosystem, the note buffer acts as the source of truth for the queue. Lines indented immediately under a task line are interpreted as continuations of that task. This structure is critical for maintaining the logical integrity of complex prompts that require more than a single line of instruction.
Sources: README.md:65-67, CHANGELOG.md:18-20
Architecture and Logic
The system identifies multi-line continuations based on indentation levels following a "head" task line (marked with - [ ]). The block continues until it encounters a blank line, a non-indented line, or a human-in-the-loop barrier (---).
Data Flow for Dispatching
When a user triggers a queue step (default Ctrl+↓), the QueueController identifies the "head" task and all its associated continuation lines. These are concatenated into a single string and passed to the agent via the pi.sendUserMessage API.
The diagram above illustrates how the controller processes a task block before sending it to the agent.
Sources: src/queue-controller.ts:117-133, README.md:65-67
Component Interaction
The logic is split between the core parsing logic (imported from @aryrabelo/planqueue-core) and the OMP-specific wiring in queue-controller.ts.
| Component | Responsibility | Relevant File |
|---|---|---|
findHead | Scans the note content to find the next pending task and its continuation lines. | src/queue-controller.ts:109-111 |
sendPrompt | Handles the asynchronous dispatch to the AI agent and updates the note state. | src/queue-controller.ts:86-98 |
registerMakeNoteTool | Allows the agent to programmatically generate multi-line plans with details. | src/main.ts:228-251 |
LLM Integration: The make_note Tool
The make_note tool is a primary way multi-line continuations are generated. It allows an LLM to decompose a high-level goal into a structured plan where each step can include an array of details strings.
Schema Structure
The steps parameter in the make_note tool explicitly supports continuations:
- prompt: The primary task line (rendered as
- [ ]). - details: An optional array of strings that become indented continuation lines.
steps: z.array(
z.object({
prompt: z.string().describe("One prompt to dispatch (becomes a - [ ] queue line)."),
details: z.array(z.string()).optional().describe("Indented continuation lines sent with the prompt."),
barrierAfter: z.boolean().optional()
})
)
Sources: src/main.ts:241-260
Execution Dynamics
Multi-line continuations behave differently depending on whether the queue is in manual or auto-run mode.
Auto-run and Settle
In auto-run mode (Ctrl+Shift+↓), the system feeds one queued block per agent "settle" (when a turn ends). The system uses the followUp delivery mechanism to ensure that the entire multi-line prompt is queued for the next available turn without hitting OMP's internal continuation caps.
The sequence diagram demonstrates the lifecycle of a multi-line prompt during an auto-run session, highlighting the transition from in-flight to completed.
Sources: src/queue-controller.ts:153-181, src/main.ts:333-345
Manual Stepping
When manually stepping through the queue, the system verifies if the agent is idle. If the agent is busy, it dispatches the multi-line block as a followUp to be processed immediately after the current turn completes.
Sources: src/queue-controller.ts:113-133
Visual Representation in UI
Multi-line continuations are rendered in the widget below the editor. The styling applied to these lines distinguishes them from the primary task lines to provide visual hierarchy.
| Style Property | Implementation | Source |
|---|---|---|
| Indentation | Two-space indent (" ") | src/main.ts:167 |
| Coloring | Dimmed text via theme.fg("dim", t) | src/main.ts:176 |
| Widget Placement | belowEditor | src/main.ts:317 |
Sources: src/main.ts:162-177, README.md:58-61
Conclusion
Multi-line continuations provide the necessary depth for complex agent instructions within PlanQueue. By leveraging indentation-based grouping and the make_note tool's structured output, the system ensures that detailed prompts remain atomic during dispatch, whether triggered manually or through the auto-run automation.