Commit Graph

1050 Commits

Author SHA1 Message Date
xiaomo fa188ddf21 Merge pull request 'feat: rename skill subcommand to prompt, add usage/setup' (#599) from feat/prompt-subcommand into main 2026-06-02 05:46:44 +00:00
xingyue 61ee22f647 feat: rename skill subcommand to prompt, add usage/setup
Rename `uwf skill` → `uwf prompt` to align with ocas CLI convention.

Changes:
- `uwf prompt usage` — combined output of all references (for skill installation)
- `uwf prompt setup` — agent-facing setup instructions
- `uwf prompt list` — list available prompt names
- `uwf prompt <name>` — individual reference (user/author/developer/adapter/bootstrap)
- Removed: commands/skill.ts, __tests__/skill.test.ts
- Added: commands/prompt.ts, __tests__/prompt.test.ts

Ref #598
2026-06-02 13:41:46 +08:00
xiaomo dbfed616f8 Merge pull request 'feat: record suspend event as StepNode in CAS chain' (#594) from feat/589-suspend-cas-chain into main 2026-06-02 05:13:13 +00:00
xiaomo f493b251db Merge branch 'main' into feat/589-suspend-cas-chain 2026-06-02 05:13:04 +00:00
xiaomo b699200adf Merge pull request 'chore: update solve-issue workflow to use $SUSPEND for insufficient_info' (#597) from feat/592-solve-issue-suspend into main 2026-06-02 05:12:14 +00:00
xiaomo 7b13e7deb4 Merge pull request 'feat: thread list/show displays suspended state and message' (#596) from feat/591-thread-list-suspended into main 2026-06-02 05:12:12 +00:00
xiaomo b1d9eebcf7 Merge pull request 'feat: uwf thread resume command' (#595) from feat/590-thread-resume into main 2026-06-02 05:12:10 +00:00
xiaomo 6b201fd73e Merge pull request 'feat: moderator recognizes $SUSPEND as pseudo-role target' (#593) from feat/588-suspend-pseudo-role into main 2026-06-02 05:12:08 +00:00
xiaomo f67507bb32 chore: update solve-issue workflow to use $SUSPEND for insufficient_info
- .workflows/solve-issue.yaml
- examples/solve-issue.yaml
- workflows/solve-issue.yaml

All planner insufficient_info routes now use $SUSPEND instead of $END.

Closes #592
2026-06-02 04:56:59 +00:00
xiaomo 00f95547d9 Merge branch 'feat/591-thread-list-suspended' into feat/592-solve-issue-suspend 2026-06-02 04:55:21 +00:00
xiaomo f79db334a0 feat: thread list/show displays suspended state and message
- thread list: suspended threads show [suspended] marker via statusDisplay
- thread show: displays suspendedRole, suspendMessage, and resume hint
- New ThreadShowOutput type with hint field
- Tests: 3 cases for display formatting

Closes #591
2026-06-02 04:55:08 +00:00
xiaomo 8e7aa3362a feat: uwf thread resume command
- New CLI: uwf thread resume <thread-id> [-p "supplement"]
- Validates thread is suspended, reads suspendedRole/suspendMessage
- Executes step as suspendedRole with resume prompt
- Clears suspend metadata on success
- Refactored cmdThreadStepOnce into composable helpers
- Tests: 5 cases including error, idle transition, prompt injection, cycles

Closes #590
2026-06-02 04:47:47 +00:00
xiaomo 10b478640d feat: record suspend event as StepNode in CAS chain
- ThreadIndexEntry supports suspendedRole + suspendMessage metadata
- threads.yaml: suspended threads serialize as objects (backward compat)
- cmdThreadStepOnce writes step before marking thread suspended
- StepOutput extended with suspendedRole/suspendMessage fields
- thread show displays suspend message

Closes #589
2026-06-02 04:44:05 +00:00
xiaomo b0ef9c55a9 feat: moderator recognizes $SUSPEND as pseudo-role target
- Add GraphPseudoRole type ($END | $SUSPEND) to workflow-protocol
- Add 'suspended' to ThreadStatus
- evaluate() returns EvaluateSuspendResult for $SUSPEND targets
- Thread show/list derive suspended status from moderator evaluation
- validate-semantic treats $SUSPEND like $END (valid target, no outgoing edges)
- Tests: routing to $SUSPEND, mustache rendering, thread status display

Closes #588
2026-06-02 04:39:29 +00:00
xingyue a335471cc7 Merge pull request 'chore: migrate json-cas to ocas' (#586) from chore/migrate-ocas into main 2026-06-02 03:07:50 +00:00
xiaomo 7a0c928a4a docs: update all docs to reference @ocas/core and ocas_ref
- README.md, docs/architecture.md, docs/wf-stateless-design.md
- docs/builtin-agent-research.md
- All package README.md files
- cas_ref → ocas_ref, @uncaged/json-cas → @ocas/core, json-cas-fs → @ocas/fs
2026-06-02 02:55:42 +00:00
xiaomo d8181e9fdf fix: config test reads source file from correct path
Test was reading from dist/commands/config.ts which doesn't exist
(only .js files in dist). Navigate to src/ instead.
2026-06-02 02:53:35 +00:00
xiaomo ef0174a6f1 chore: migrate @uncaged/json-cas to @ocas/core, @uncaged/json-cas-fs to @ocas/fs
- Replace all package.json dependencies
- Update all imports across 7 packages + scripts
- cas_ref → ocas_ref in schema definitions
- listByType() adapted for ListEntry[] return type
- Update CLAUDE.md references

Fixes #585
2026-06-02 02:51:21 +00:00
xiaomo 2a72dcde20 Merge pull request 'feat: !include YAML tag and folder-based workflow layout' (#584) from feat/include-and-folder-workflow into main 2026-05-31 04:54:16 +00:00
xiaomo b1759096a2 fix: biome 2.4.16 migration, reduce scanWorkflowDir complexity, fix formatting 2026-05-31 04:52:08 +00:00
xiaomo f8c06ada64 style: fix biome lint (template literal, import sorting) 2026-05-31 04:48:16 +00:00
xiaomo 806edb2750 style: fix biome lint (import sorting, formatting) 2026-05-31 04:44:09 +00:00
xiaomo da1678ffef fix: address review feedback on !include and folder workflow
- Fix nested !include: pass customTags recursively, scoped to included file's dir
- Add path traversal guard: !include paths must resolve within base directory
- Fix discoverProjectWorkflows: scan both .workflow/ and .workflows/ (consistent with findWorkflowInDir)
- Add tests: path traversal blocking, nested !include, absolute path rejection
2026-05-31 04:26:54 +00:00
xiaomo 88c251fc14 feat: !include YAML tag and folder-based workflow layout
- Add !include custom YAML tag for referencing external files (Fixes #582)
  - .md/.txt files included as strings
  - .json files parsed as JSON objects
  - .yaml/.yml files parsed as YAML objects
  - Paths resolved relative to the workflow YAML file

- Support foo/index.yaml as alternative to foo.yaml (Fixes #583)
  - Updated discoverProjectWorkflows(), findWorkflowInDir()
  - Updated workflowNameFromPath() for index.yaml detection
  - Flat files take priority over folder layout

- Added tests for both features
2026-05-31 04:12:11 +00:00
xiaoju 9fb817a99c Merge pull request 'improve: solve-issue — replace tea pr create with Gitea API' (#581) from retrospect/fix-committer-tea into main 2026-05-30 23:37:31 +00:00
xiaoju f9b8cf025e fix: add repoRemote to planner required fields 2026-05-30 23:36:49 +00:00
xiaoju d10f55294a improve: solve-issue — replace tea pr create with Gitea API curl
Fixes the committer role's inefficiency (thread 06F7JE4NDERP6J3W2RWVFQVQ7G analysis).

1. **Committer procedure**: Replace `tea pr create` with direct Gitea API calls via curl
   - Eliminates 15-18 wasted turns (~30-40% overhead) caused by incorrect tea CLI syntax
   - Adds verification steps: check push success + verify PR creation response
   - Warns explicitly: "do NOT use tea pr create — it fails in worktrees"

2. **Planner enhancement**: Extract and propagate `repoRemote` (owner/repo) in frontmatter
   - Downstream roles no longer need to extract repo info from git remote
   - Reduces discovery overhead and shell parsing errors

3. **Frontmatter schema updates**: Add `repoRemote` field to all roles
   - Developer, reviewer, tester, committer all propagate repoRemote
   - Ensures consistent data flow through the graph

4. **Graph prompt updates**: Pass `{{{repoRemote}}}` through all transitions
   - All roles receive repo remote context in task prompts
   - Committer receives "Repo remote (owner/repo): {{{repoRemote}}}"

5. **Test updates**: Update `solve-issue-tea-worktree.test.ts`
   - Expect curl API instead of tea pr create
   - Verify warning against tea pr create exists
   - All 8 tests pass

-  15-18 fewer turns per thread in committer role (30-40% reduction)
-  ~20-30 seconds saved per thread execution
-  Improved reliability — no CLI version/config dependencies
-  Cross-platform compatibility — works anywhere with curl + git

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-30 22:38:28 +00:00
xiaoju 0ece23f03e improve: solve-issue — add mandatory verification and escalation steps
Fixes hallucination issues observed in thread 06F7FSTXQGY3D5CY5YPQFK2Y3W:

1. Developer self-verification (critical): Added step 12 requiring
   mandatory verification of branch, file existence, and git status
   before reporting done status. Prevents hallucinated completions
   without actual tool execution.

2. Reviewer hard-check enforcement (critical): Added critical warning
   and step 0 requiring cd/pwd verification before review. Prevents
   false rejections based on assumptions without actual path checks.

3. Test debugging escalation (medium): Added structured debugging
   guidance with escalation path after 3 test cycles. Prevents
   infinite retry loops by providing strategy and fail-fast guidance.

Also added 3 test cases to verify the new procedure steps exist.

Based on change plan 9EVZPDTS16PMG analyzing execution anomalies
that resulted in 58% waste (13 of 23 minutes).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-30 22:37:42 +00:00
xiaonuo 389924c3ab Merge pull request 'improve: solve-issue — fix hallucination patterns (thread 06F7FSTXQGY3D5CY5YPQFK2Y3W)' (#579) from retrospect/solve-issue-fixes into main 2026-05-30 08:57:58 +00:00
xiaoju 0dfa20f1d7 improve: solve-issue — add mandatory verification and escalation steps
Fixes hallucination issues observed in thread 06F7FSTXQGY3D5CY5YPQFK2Y3W:

1. Developer self-verification (critical): Added step 12 requiring
   mandatory verification of branch, file existence, and git status
   before reporting done status. Prevents hallucinated completions
   without actual tool execution.

2. Reviewer hard-check enforcement (critical): Added critical warning
   and step 0 requiring cd/pwd verification before review. Prevents
   false rejections based on assumptions without actual path checks.

3. Test debugging escalation (medium): Added structured debugging
   guidance with escalation path after 3 test cycles. Prevents
   infinite retry loops by providing strategy and fail-fast guidance.

Also added 3 test cases to verify the new procedure steps exist.

Based on change plan 9EVZPDTS16PMG analyzing execution anomalies
that resulted in 58% waste (13 of 23 minutes).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-30 08:40:34 +00:00
xingyue 0fcab06b80 improve(workflow): solve-issue — fix committer tea PR creation in worktrees
- Remove --repo flag from tea pr create (fails in git worktrees)
- Add guard to skip staging when developer already committed changes

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
2026-05-30 15:41:08 +08:00
xiaonuo 15dcdee1cb Merge pull request 'fix(agent-claude-code): handle missing result line gracefully' (#576) from fix/574-silent-fail-handling into main 2026-05-30 05:52:54 +00:00
xiaoju 53fa4d8972 fix(agent-claude-code): handle missing result line gracefully
Handle the case where Claude Code exits without producing a result line
(timeout, OOM, signal kill). Previously returned null and threw an error;
now returns incomplete result with best-effort output extraction.

Changes:
- Add "incomplete" as new ClaudeCodeResultSubtype value
- Extract output from last assistant turn when no result line exists
- Enhanced error messages distinguish incomplete vs unparseable output
- Store incomplete results in CAS with appropriate metadata
- Add 10 comprehensive test cases for incomplete result handling

Fixes #574

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-30 05:37:09 +00:00
xiaonuo ff8542d811 Merge pull request 'feat(cli): unify uwf CAS store with global json-cas store' (#575) from fix/573-unify-cas-store into main
feat(cli): unify uwf CAS store with global json-cas store

Fixes #573
2026-05-30 05:25:12 +00:00
xiaoju 97637ad831 feat(cli): unify uwf CAS store with global json-cas store
This resolves issue #573 by moving uwf's CAS directory from
~/.uncaged/workflow/cas/ to the shared ~/.uncaged/json-cas/ location.

Changes:
- Added getGlobalCasDir() function with UNCAGED_CAS_DIR support
- Updated createUwfStore() to use global CAS directory
- Added comprehensive test coverage (11 new tests)
- Updated all existing tests for environment isolation
- Updated documentation (CLAUDE.md, README.md)

Benefits:
- Cross-tool visibility: json-cas CLI can read uwf-created nodes
- Schema sharing: both tools access same schema registry
- Future-proofing: enables json-cas render/verbose for uwf data

Fixes #573

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-30 04:52:47 +00:00
xiaoju 27d699fa73 feat(cli): unify uwf CAS store with global json-cas store
This resolves issue #573 by moving uwf's CAS directory from
~/.uncaged/workflow/cas/ to the shared ~/.uncaged/json-cas/ location.

Changes:
- Added getGlobalCasDir() function that respects UNCAGED_CAS_DIR env var
- Updated createUwfStore() to use the global CAS directory
- Updated all tests to set UNCAGED_CAS_DIR for test isolation
- Added comprehensive test suite for global CAS functionality
- Updated documentation (CLAUDE.md, README.md) to reflect new architecture

Benefits:
- Cross-tool visibility: json-cas CLI can now read uwf-created nodes
- Schema sharing: both tools access the same schema registry
- Future-proofing: enables json-cas render/verbose features for uwf data

Workflow metadata (threads.yaml, registry.yaml, history.jsonl) remains in
~/.uncaged/workflow/ as intended.

All tests pass. No breaking changes to existing functionality.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-30 04:45:16 +00:00
xiaoju 80bbb8b5f9 fix: add anti-hallucination ground rules and build artifact detection to normalize workflow
- Add GROUND RULES section to all role procedures: require real command output, no fabrication
- Add 'skipped' status for roles where everything is already configured
- Add skipped routing in graph so workflow continues normally
- Add build artifact detection in committer: scan for .d.ts/.js.map/.js before commit
- Add verification enforcement notes to all roles

Fixes hallucination issue where agents reported completing work without actually writing files.
2026-05-29 04:45:31 +00:00
xiaoju d310d43ab8 feat(step-read): store assembled prompt in CAS, add --prompt flag
Store the fully assembled prompt sent to each agent in CAS as a text
node, referenced from StepNodePayload.assembledPrompt. This enables
exact reproduction of what the agent received for debugging hallucinations.

Changes:
- workflow-protocol: StepRecord + STEP_NODE_SCHEMA add assembledPrompt field
- workflow-util-agent: AgentRunResult includes assembledPrompt, run.ts stores it
- workflow-util-agent: schemas register TEXT_SCHEMA for prompt storage
- workflow-agent-claude-code: return assembled prompt from buildClaudeCodePrompt
- workflow-agent-hermes: return assembled prompt from buildHermesPrompt
- workflow-agent-builtin: return empty prompt (no prompt assembly)
- cli-workflow: step read --prompt renders the stored prompt
- All test fixtures updated for new field

Legacy steps without assembledPrompt show 'Prompt not recorded' message.

小橘 🍊
2026-05-29 01:42:43 +00:00
xiaoju 7612c97ae7 fix(solve-issue): committer post-condition verification + use API instead of tea
- Add git ls-remote verification after push
- Switch from tea pr create to Gitea API (tea fails in worktrees)
- Add PR creation verification (check response JSON has number field)
- Explicitly mark steps 4 and 6 as verification gates

小橘 🍊
2026-05-28 23:51:46 +00:00
xiaoju 8ffea10db0 fix: pass repoRemote through solve-issue workflow pipeline
Root cause: committer role had to parse owner/repo from git remote URL,
which failed in worktrees with token-embedded URLs. Agent hallucinated
a fake PR URL instead of reporting the error.

Fix:
- planner extracts repoRemote from git remote, stores in frontmatter
- repoRemote flows through all roles via graph prompts
- committer uses repoRemote directly for tea/API calls
- Added Gitea API fallback when tea CLI fails

小橘 <xiaoju@shazhou.work>
2026-05-28 10:34:17 +00:00
xiaomo abe516f739 feat: add uwf skill bootstrap subcommand, update BOOTSTRAP.md to use it 2026-05-28 10:32:25 +00:00
xiaomo 647f40bdd5 docs: use diff command for skill freshness check 2026-05-28 10:28:06 +00:00
xiaomo 2265b32933 docs: clarify workflow means uwf workflow, not skill 2026-05-28 10:04:13 +00:00
xiaoju 3971c26dc1 fix: solve-issue-workflow writes to .workflows/ instead of registering
- Place workflow YAML in .workflows/ (dot-prefix convention)
- Do not run uwf workflow add — use directly via uwf thread start
- Fixes agent hallucination issue where registration was faked

小橘 <xiaoju@shazhou.work>
2026-05-28 09:58:52 +00:00
xiaoju 27d6062992 feat: normalize workflow v2 — JS/MJS project support
- typescript role: detect .ts/.tsx files, skip tsc for pure JS/MJS projects
- testing role: vitest --passWithNoTests for empty test suites
- committer role: tsconfig.json optional in spot-check
- all roles: proper frontmatter schemas with repoPath

小橘 <xiaoju@shazhou.work>
2026-05-28 09:49:39 +00:00
xiaomo 625d975c3d docs: add per-step verification and self-check/upgrade section to BOOTSTRAP.md 2026-05-28 09:44:26 +00:00
xiaomo b4919aa921 docs: add BOOTSTRAP.md and uwf skill for agent onboarding 2026-05-28 09:42:38 +00:00
xiaoju 3a927de63f chore: normalize to bun monorepo conventions
- Enhanced Biome config with test file override for noConsole
- Applied Biome auto-fixes (8 files: formatting, template literals, optional chains)
- Updated all package repository URLs to git.shazhou.work/uncaged/workflow.git
- Added workflow-agent-claude-code to publish order in scripts/publish-all.mjs
- Added --ignore-scripts flag to publish command to bypass prepublishOnly guard
- Installed vitest in root devDependencies for test infrastructure
- Created vitest.config.ts for all 8 packages with passWithNoTests: true
- Fixed 3 test files to use vitest imports instead of bun:test
- Added test and test:ci scripts to packages missing them
- Added missing build step to .gitea/workflows/ci.yml
- Renamed CI job from 'test' to 'check' for clarity
- Created workflows/solve-issue.yaml with TDD-driven issue resolution workflow
- Registered solve-issue workflow with uwf (hash: 084YVM60BR8G6)
- Added packageManager: bun@1.3.14 to root package.json
- Added preinstall guard to block npm/pnpm/yarn
- Added prepublishOnly guard to root and all 7 public packages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-28 08:02:52 +00:00
xiaomo 512a3f8653 refactor(skill): remove non-scenario skill commands, add navigation to user reference
Removed: cli, architecture, yaml, moderator, actor skill subcommands
Kept: user, author, developer, adapter (scenario-based)
Added: scenario navigation table to user-reference.ts
2026-05-28 06:39:36 +00:00
xiaoju 0b20e88317 feat(cli): add currentRole field to thread show and thread list output (#572)
Co-authored-by: 小橘 <xiaoju@shazhou.work>
Co-committed-by: 小橘 <xiaoju@shazhou.work>
2026-05-28 01:58:23 +00:00