feat(cli): step ask — read-only query to historical step sessions
CI / check (pull_request) Successful in 2m46s

Adds `uwf step ask <step-hash> -p <prompt>` for asking follow-up
questions to a completed step's agent without mutating thread state.

- Fork-by-default: creates and caches a fork session per step (cache
  key `<stepHash>:ask`); subsequent asks reuse it.
- `--no-fork` fallback: spawns a fresh session with the step's detail
  ref injected as context.
- `--agent` overrides the recorded agent; otherwise resolves from the
  step's agent field via config alias.
- Updates `packages/cli/README.md` and `packages/util/src/usage-reference.ts`
  so the new subcommand is discoverable via README and `uwf prompt usage`.

Fixes #146
This commit is contained in:
2026-06-07 10:33:41 +00:00
parent e9e896146e
commit b5e094ab4d
6 changed files with 951 additions and 2 deletions
+5
View File
@@ -94,10 +94,15 @@ start → exec (repeat) → thread reaches $END → auto-completed
uwf step list <thread-id> # list all steps
uwf step show <step-hash> # show step details
uwf step fork <step-hash> # fork thread from a step (branch)
uwf step ask <step-hash> -p <prompt> [--agent <cmd>] [--no-fork]
# ask a follow-up question to the step's agent
# (read-only; no new step, no thread mutation)
\`\`\`
Forking creates a new thread that shares history up to the fork point — useful for retrying from a known-good state.
\`step ask\` re-opens the agent session that produced \`<step-hash>\` and returns its answer on stdout. Subsequent asks reuse the same forked session via the per-agent ask-cache; \`--no-fork\` runs the agent fresh with the step's detail ref injected for context.
## CAS Commands
Use the \`ocas\` CLI for direct CAS operations (\`~/.ocas/\` store, shared with \`uwf\`):