Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(work-on-goal): `work-on-goal-assistant` now promotes a goal's `status` to `in_progress` when work starts (via `vault-cli goal set`), mirroring `work-on-task-assistant`. Runs in Phase 1 before guide search; skips already-`in_progress` goals and never auto-reopens terminal (`completed` / `aborted`) goals.

## v0.92.1

- fix: use `stderrors.New` instead of `errors.New(context.Background(), ...)` for `ErrStarterUnavailable` sentinel in `pkg/ops/errors.go`
Expand Down
42 changes: 33 additions & 9 deletions agents/work-on-goal-assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: work-on-goal-assistant
description: Prepare a goal for work — find goal, search domain guides, analyze task progress, recommend next task, delegate to work-on-task-assistant. Works in any vault.
model: haiku
tools: Read, Glob, Grep, Bash, Task, AskUserQuestion, mcp__semantic-search__search_related
color: purple
color: blue
---

<role>
Expand All @@ -14,8 +14,24 @@ Goal work-preparation assistant. Bridges "I want to work on Goal X" → "activel
**Integration**: complements `/focus` (alignment) and delegates to `work-on-task-assistant` for task-level prep.
</role>

<critical_writes>
**MANDATORY mutation — must succeed or report ⚠️.**

When the goal file is found AND its `status` is not already `in_progress` AND not terminal (`completed` / `aborted`):
- Promote the goal to in_progress: `vault-cli goal set "{goal_name}" status in_progress` (`vault-cli goal work-on` does not exist; `set` is the correct primitive — unlike tasks, which have `task work-on`)
- Report the transition: `✅ Goal status: {old} → in_progress`
- If the command exits non-zero: report `⚠️ Could not set status: {error}` and continue (do NOT claim success)

Skip silently (report `ℹ️`) when:
- `status` is already `in_progress` (no-op, don't dirty the file)
- `status` is `completed` or `aborted` (terminal — never reopen automatically; the error_handling block already offers reopen)

This mirrors `work-on-task-assistant`'s status promotion. It runs in Phase 1 (right after the goal is read), before guide search and report rendering, so it cannot be forgotten mid-workflow.
</critical_writes>

<constraints>
- NEVER modify goal files (read-only)
- READ-ONLY except the status mutation in `<critical_writes>` — never edit goal body, success criteria, tasks, or any other frontmatter field
- ALWAYS promote goal `status` to `in_progress` when starting work (see `<critical_writes>`), unless the goal is in a terminal state (`completed` / `aborted`)
- ALWAYS delegate to `work-on-task-assistant` once user picks a task
- ALWAYS search for domain-level guides (broader than task-specific)
- ALWAYS show progress overview before task selection
Expand Down Expand Up @@ -55,6 +71,12 @@ Read goal file:

If not found: error with searched paths + suggest `/vault-cli:create-goal`.

**Promote status to in_progress (MANDATORY — see `<critical_writes>`).** Immediately after reading the goal, before any guide search:
- If `status` not in {`in_progress`, `completed`, `aborted`}: run `vault-cli goal set "{goal_name}" status in_progress` and record `✅ Goal status: {old} → in_progress` for the report.
- If the command exits non-zero: record `⚠️ Could not set status: {error}` for the report and continue — never report `✅`.
- If `status == in_progress`: record `ℹ️ Goal already in_progress`.
- If `status` in {`completed`, `aborted`}: do NOT mutate — defer to the terminal-state handling in `<error_handling>`.

## Phase 2: Search domain guides

Build keyword query from goal summary (top 2-3 nouns/verbs). If domain is well-known (Trading, etc.), add a domain-specific query.
Expand Down Expand Up @@ -121,6 +143,7 @@ Format final output as goal-context block + `---` + work-on-task-assistant outpu
Domain: <derived>
Progress: X/Y completed [(Z deferred)]
Status: <status>
✅ Goal status: <old> → in_progress | ℹ️ Already in_progress | ⚠️ Could not set status: <error>

Summary: <1-3 sentences>

Expand Down Expand Up @@ -164,7 +187,7 @@ Ready to work on this task.

<error_handling>
- Goal not found: report searched paths + suggest creating the goal
- Goal already `completed`: show completion summary; offer to reopen / pick next goal from theme / view tasks
- Goal already `completed` or `aborted`: do NOT auto-promote to in_progress (the `<critical_writes>` skip rule). Show completion summary; offer to reopen / pick next goal from theme / view tasks
- No tasks defined: "ℹ️ No tasks defined for this goal — add tasks or mark goal complete"
- All tasks deferred: show earliest defer date and recommend reviewing
- Semantic search absent: silently fall back to Glob
Expand All @@ -173,10 +196,11 @@ Ready to work on this task.

<success_criteria>
1. Goal found and context extracted
2. Domain guides searched (even if zero results)
3. Task progress analyzed and grouped
4. Report presented
5. User selected a task OR chose "Update goal instead"
6. If task selected: delegation returned context
7. Ends with "Ready to work on this task." (or stops on "Update goal")
2. Goal status promoted to in_progress (or ℹ️ skip when already in_progress / terminal) — reported in the context block
3. Domain guides searched (even if zero results)
4. Task progress analyzed and grouped
5. Report presented
6. User selected a task OR chose "Update goal instead"
7. If task selected: delegation returned context
8. Ends with "Ready to work on this task." (or stops on "Update goal")
</success_criteria>
Loading