feat: uwf thread read — human-readable markdown with pagination #350

Merged
xiaomo merged 3 commits from feat/349-thread-read into main 2026-05-19 03:45:03 +00:00
Owner

What

New uwf thread read <thread-id> command that outputs thread content as markdown.

Why

thread steps outputs JSON/YAML for machines. thread read is for humans and agents to quickly understand thread context (#349).

Usage

uwf thread read <thread-id>                    # default, start + latest steps within 4000 chars
uwf thread read <thread-id> --quota 8000        # larger budget
uwf thread read <thread-id> --before <hash>     # steps before hash, no start
uwf thread read <thread-id> --before <hash> --start  # with start

Pagination

  • Walks backward from head, accumulating step sizes until quota exceeded
  • Skipped steps show a hint: *(N earlier steps, load with uwf thread read ...)*
  • Without --before: shows start + newest steps within quota
  • With --before: shows steps before that hash, no start (unless --start)

Changes

  • thread.tscmdThreadRead, collectOrderedSteps (extracted from cmdThreadSteps), formatThreadReadMarkdown
  • cli.ts — wire up thread read with --quota, --before, --start

Verified locally

  • Default output
  • --before pagination
  • --start flag
  • --quota limiting

Closes #349

## What New `uwf thread read <thread-id>` command that outputs thread content as markdown. ## Why `thread steps` outputs JSON/YAML for machines. `thread read` is for humans and agents to quickly understand thread context (#349). ## Usage ```bash uwf thread read <thread-id> # default, start + latest steps within 4000 chars uwf thread read <thread-id> --quota 8000 # larger budget uwf thread read <thread-id> --before <hash> # steps before hash, no start uwf thread read <thread-id> --before <hash> --start # with start ``` ## Pagination - Walks backward from head, accumulating step sizes until quota exceeded - Skipped steps show a hint: `*(N earlier steps, load with uwf thread read ...)*` - Without `--before`: shows start + newest steps within quota - With `--before`: shows steps before that hash, no start (unless `--start`) ## Changes - `thread.ts` — `cmdThreadRead`, `collectOrderedSteps` (extracted from `cmdThreadSteps`), `formatThreadReadMarkdown` - `cli.ts` — wire up `thread read` with `--quota`, `--before`, `--start` ## Verified locally - Default output ✅ - `--before` pagination ✅ - `--start` flag ✅ - `--quota` limiting ✅ Closes #349
xiaoju added 1 commit 2026-05-19 02:38:45 +00:00
- Outputs markdown directly (not JSON/YAML)
- --quota <chars>: character budget, loads steps backward until exceeded (default 4000)
- --before <step-hash>: load steps before this hash (exclusive), omits start
- --start: force include start section even with --before
- Skip hint with uwf thread read command for pagination
- Reuses walkChain/collectOrderedSteps/expandOutput

Closes #349
xiaoju force-pushed feat/349-thread-read from 1a3f58f87e to 4c9ce72395 2026-05-19 03:15:42 +00:00 Compare
xiaoju added 1 commit 2026-05-19 03:19:44 +00:00
--detail now uses expandDeep to recursively resolve all cas_ref
fields in the detail merkle tree, showing full turn content
instead of raw hashes.

Refs #349
xiaoju added 1 commit 2026-05-19 03:23:55 +00:00
Each step block now includes a '### Prompt' section showing the
role's systemPrompt from the workflow definition.

Refs #349
xiaomo approved these changes 2026-05-19 03:45:01 +00:00
xiaomo left a comment
Owner

LGTM

亮点:

  • expandDeep schema-driven 递归展开 cas_ref,含 cycle guard 和 anyOf nullable 处理
  • pagination 用 quota 反向累加,skip hint 带具体 --before 命令,agent 友好
  • collectOrderedStepscmdThreadSteps 提取复用,DRY

一个小 nit(不阻塞):.gitignore 加了 *.py 有点宽,可能误伤脚本文件。

LGTM ✅ 亮点: - `expandDeep` schema-driven 递归展开 cas_ref,含 cycle guard 和 anyOf nullable 处理 - pagination 用 quota 反向累加,skip hint 带具体 `--before` 命令,agent 友好 - `collectOrderedSteps` 从 `cmdThreadSteps` 提取复用,DRY 一个小 nit(不阻塞):`.gitignore` 加了 `*.py` 有点宽,可能误伤脚本文件。
xiaomo merged commit 432400ee20 into main 2026-05-19 03:45:03 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#350