From 76f9ac7b8790cee99360001f1f37d90710edd702 Mon Sep 17 00:00:00 2001 From: Benjamin Borbe Date: Thu, 2 Jul 2026 19:07:46 +0200 Subject: [PATCH 1/2] work-on-task: add --non-interactive mode (skip Phase 4 asks + Phase 5 chain) --- CHANGELOG.md | 4 ++++ commands/work-on-task.md | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5718f30..b9a05a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Please choose versions by [Semantic Versioning](http://semver.org/). * MINOR version when you add functionality in a backwards-compatible manner, and * PATCH version when you make backwards-compatible bug fixes. +## Unreleased + +- feat(plugin): `/vault-cli:work-on-task` accepts `--non-interactive` (deprecated alias `--tool`) — skips the create-task prompt (Phase 4) and the plan-task/execute-task sharpening chain (Phase 5) so headless callers (e.g. `vault-cli work-on`'s `claude --print` bootstrap) orient and stop instead of hanging on `AskUserQuestion` + ## v0.96.0 - feat: Config loading follows XDG Base Directory spec — new FindConfigDir prefers ~/.config/vault-cli/ over legacy ~/.vault-cli/ with no forced migration diff --git a/commands/work-on-task.md b/commands/work-on-task.md index a0a2a87..8e7c31b 100644 --- a/commands/work-on-task.md +++ b/commands/work-on-task.md @@ -1,6 +1,6 @@ --- description: Find task details, transition Jira, set status, track on daily note, discover guides, then auto-sharpen and gate the planning → execution transition -argument-hint: "" +argument-hint: " [--non-interactive]" allowed-tools: [Task, AskUserQuestion, Skill, Bash(vault-cli *)] --- @@ -16,14 +16,17 @@ Find task details and relevant operational guides before starting work. Delegate ## Process -1. **Validate input** - - If no argument: `❌ Pass a task identifier or description.` and STOP +1. **Parse input** + - Parse `$ARGUMENTS`: if it contains `--non-interactive` (or deprecated `--tool`) → set `MODE=non_interactive` and strip that flag token from the arguments; otherwise `MODE=interactive`. Use the stripped arguments as the task identifier everywhere below — NEVER pass the flag token into the assistant prompt or task search. + - If no argument remains after stripping: `❌ Pass a task identifier or description.` and STOP + + **`MODE=non_interactive`** exists for headless callers — e.g. `vault-cli work-on`'s Claude bootstrap runs `claude --print`, which cannot answer `AskUserQuestion`, so an interactive gate would block until the session-start timeout. In this mode the command NEVER calls `AskUserQuestion` and NEVER runs the interactive sharpening chain (Phase 5): it orients (via the assistant) and stops. Interactive sharpening resumes later when the session is opened in a real terminal. 2. **Invoke work-on-task-assistant** ``` Task tool with: subagent_type: 'vault-cli:work-on-task-assistant' - prompt: 'Find details and guides for: {arguments}' + prompt: 'Find details and guides for: {stripped arguments}' ``` 3. **Auto-sharpen + auto-gate (Phase 5).** If the assistant's report ends with `Ready to work on this task.` (the `found` case), continue to Phase 5 below. If the report contains the `not_found:` marker, skip Phase 5 and run Phase 4 (Handle not_found) instead. @@ -45,6 +48,8 @@ Output ends with `Ready to work on this task.` The agent (dispatched in `## Process` step 2) emits a structured `not_found` verdict from its own Phase 1 (`Find task`) when the requested task cannot be found in any source. This phase parses that verdict and asks the user before any file is created. +**Non-interactive gate (checked first):** If `MODE=non_interactive`, do NOT call `AskUserQuestion` and do NOT create anything. Print the `not_found:` report — the `Searched:` block from the verdict, then `❌ Task not found: ""` — followed by `ℹ️ Non-interactive mode: no task created. Re-run in a terminal to create one.` and STOP. Skip steps 1–7 below (they are the interactive create-gate). + 1. **Parse the agent's report** for the `not_found:` marker AND capture the verdict body into variables. The agent's `` defines two separate fenced markdown blocks — one for the `found` case (ends with `Ready to work on this task.`) and one for the `not_found:` case (literal `not_found:` header on its own line). Look for the `not_found:` block specifically; if the report ends with `Ready to work on this task.` and contains no `not_found:` block, Phase 4 is a no-op and you are done. When the `not_found:` block IS present, match on the `not_found:` token, then extract: - `SEARCHED_BLOCK` — the bullet list under the `Searched:` line (verbatim, line-by-line, until the next blank line or `Suggested task name:` line) - `SUGGESTED_NAME` — the value after `Suggested task name:` (verbatim, trimmed) @@ -78,6 +83,8 @@ Goal: by the time work-on-task returns, the resolved task is in `phase: planning Runs only after Phase 2 returned a `found` task — never on `not_found` (Phase 4 handles that branch). +**Non-interactive gate (checked first):** If `MODE=non_interactive`, SKIP Phase 5 entirely — do NOT invoke `plan-task` or `execute-task`. Both own `AskUserQuestion` flows and would hang a headless caller. The assistant's orient (status, daily note, guides) already ran in `## Process` step 2 and IS the complete non-interactive result. Print `✅ Oriented (non-interactive). Run /vault-cli:plan-task in a terminal to sharpen and gate execution.` and STOP. + 1. **Resolve the task name from the assistant's report.** The assistant prints `📋 Task: ` near the top of its `found` block; that line is the canonical identifier. Capture it verbatim. 2. **Invoke `Skill: vault-cli:plan-task` with the captured name as a quoted argument.** plan-task owns its own entry contract, gate logic, and `AskUserQuestion` flow — do not intercept. Wait for it to return. From 7c1d19ad7f2c884c64777d1d7dd9ca11999fc1f2 Mon Sep 17 00:00:00 2001 From: Benjamin Borbe Date: Thu, 2 Jul 2026 19:15:21 +0200 Subject: [PATCH 2/2] work-on-task: drop unused --tool alias, clarify self-contained parsing + changelog --- CHANGELOG.md | 2 +- commands/work-on-task.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9a05a6..09bcfcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ Please choose versions by [Semantic Versioning](http://semver.org/). ## Unreleased -- feat(plugin): `/vault-cli:work-on-task` accepts `--non-interactive` (deprecated alias `--tool`) — skips the create-task prompt (Phase 4) and the plan-task/execute-task sharpening chain (Phase 5) so headless callers (e.g. `vault-cli work-on`'s `claude --print` bootstrap) orient and stop instead of hanging on `AskUserQuestion` +- feat(plugin): `/vault-cli:work-on-task` accepts `--non-interactive` — still orients the task (assistant sets status, tracks the daily note, discovers guides) but skips the create-task prompt (Phase 4) and the plan-task/execute-task sharpening chain (Phase 5), so headless callers (e.g. `vault-cli work-on`'s `claude --print` bootstrap) orient and stop instead of hanging on `AskUserQuestion` ## v0.96.0 diff --git a/commands/work-on-task.md b/commands/work-on-task.md index 8e7c31b..2855282 100644 --- a/commands/work-on-task.md +++ b/commands/work-on-task.md @@ -17,7 +17,7 @@ Find task details and relevant operational guides before starting work. Delegate ## Process 1. **Parse input** - - Parse `$ARGUMENTS`: if it contains `--non-interactive` (or deprecated `--tool`) → set `MODE=non_interactive` and strip that flag token from the arguments; otherwise `MODE=interactive`. Use the stripped arguments as the task identifier everywhere below — NEVER pass the flag token into the assistant prompt or task search. + - Parse `$ARGUMENTS`: if it contains `--non-interactive` → set `MODE=non_interactive` and strip that flag token from the arguments; otherwise `MODE=interactive`. Parsing is self-contained here — it does not depend on any other command. Use the stripped arguments as the task identifier everywhere below — NEVER pass the flag token into the assistant prompt or task search. - If no argument remains after stripping: `❌ Pass a task identifier or description.` and STOP **`MODE=non_interactive`** exists for headless callers — e.g. `vault-cli work-on`'s Claude bootstrap runs `claude --print`, which cannot answer `AskUserQuestion`, so an interactive gate would block until the session-start timeout. In this mode the command NEVER calls `AskUserQuestion` and NEVER runs the interactive sharpening chain (Phase 5): it orients (via the assistant) and stops. Interactive sharpening resumes later when the session is opened in a real terminal.