From 4a925b98af31269c0ed9adc8e3232bb62d29068d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A9=98?= Date: Thu, 7 May 2026 16:10:37 +0000 Subject: [PATCH] docs: create README.md, update architecture.md for current structure - Create root README.md with project intro, concepts, packages, quickstart - Remove workflow-role-* references from docs/architecture.md - Roles now live inside template packages (src/roles/) - Clean up untracked dist/packages/workflow-role-* remnants Fixes #88 --- README.md | 71 ++++++++++++++++++++++++++++++++++++++++++++ docs/architecture.md | 7 ++--- 2 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b6f59b7 --- /dev/null +++ b/README.md @@ -0,0 +1,71 @@ +# @uncaged/workflow + +A workflow engine that executes single-file ESM bundles. Each workflow is a self-contained `.esm.js` file identified by its XXH64 hash (Crockford Base32). + +## Core Concepts + +| Concept | Description | +|---------|-------------| +| **Workflow** | A single-file ESM module exporting `run` (workflow function) and `descriptor` (metadata). Identified by its XXH64 hash. | +| **Bundle** | The physical `.esm.js` file stored in `~/.uncaged/workflow/bundles/`. | +| **Thread** | A single execution of a workflow, identified by a ULID. Persisted as `.data.jsonl` + `.info.jsonl`. | +| **Role** | A named actor within a workflow. Each role produces output with typed `meta`. Roles live inside template packages (`src/roles/`). | +| **Registry** | `workflow.yaml` — maps workflow names to current/historical bundle hashes. | +| **CAS** | Content-Addressed Storage — bundles are immutable and addressed by hash. | + +## Monorepo Packages + +``` +packages/ + workflow/ # @uncaged/workflow — core lib (types, engine, hash, ULID, registry) + cli-workflow/ # @uncaged/cli-workflow — CLI (`uncaged-workflow` command) + workflow-template-develop/ # @uncaged/workflow-template-develop — develop workflow template (includes roles) + workflow-template-solve-issue/ # @uncaged/workflow-template-solve-issue — solve-issue workflow template (includes roles) + workflow-agent-hermes/ # @uncaged/workflow-agent-hermes — Hermes agent adapter + workflow-agent-cursor/ # @uncaged/workflow-agent-cursor — Cursor agent adapter + workflow-agent-llm/ # @uncaged/workflow-agent-llm — LLM agent adapter + workflow-util-agent/ # @uncaged/workflow-util-agent — agent utilities (buildAgentPrompt, spawnCli) +``` + +Managed with **bun workspace** using the `workspace:*` protocol. + +## Quick Start + +```bash +# Install dependencies +bun install + +# Build all packages +bun run build + +# Register a workflow bundle +uncaged-workflow add solve-issue dist/packages/workflow-template-solve-issue/solve-issue.esm.js + +# Run a workflow +uncaged-workflow run solve-issue --prompt "Fix bug #42" +``` + +## CLI Usage + +```bash +uncaged-workflow help # Show all commands +uncaged-workflow list # List registered workflows +uncaged-workflow run # Start a workflow thread +uncaged-workflow threads # List all threads +uncaged-workflow thread # Inspect a thread +uncaged-workflow skill # Show workflow skill info +``` + +See `uncaged-workflow --help` for the full command reference. + +## Development + +```bash +bun run check # Biome lint + format check +bun run format # Auto-format with Biome +bun test # Run tests +``` + +## Architecture + +See [docs/architecture.md](docs/architecture.md) for the full design — three-phase engine loop, bundle contract, storage layout, and design decisions. diff --git a/docs/architecture.md b/docs/architecture.md index c869753..1a3ac48 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -17,11 +17,8 @@ A workflow engine that executes single-file ESM bundles. Each workflow is a self | `workflow-agent-cursor` | `@uncaged/workflow-agent-cursor` | Cursor CLI agent (extracts workspace from ctx) | | `workflow-agent-hermes` | `@uncaged/workflow-agent-hermes` | Hermes CLI agent | | `workflow-agent-llm` | `@uncaged/workflow-agent-llm` | OpenAI-compatible LLM agent | -| `workflow-role-planner` | `@uncaged/workflow-role-planner` | Pure data: phased planning prompt + schema | -| `workflow-role-coder` | `@uncaged/workflow-role-coder` | Pure data: coding prompt + schema | -| `workflow-role-reviewer` | `@uncaged/workflow-role-reviewer` | Pure data: code review prompt + schema | -| `workflow-role-committer` | `@uncaged/workflow-role-committer` | Pure data: git commit prompt + schema | -| `workflow-template-solve-issue` | `@uncaged/workflow-template-solve-issue` | Composes roles + moderator into a complete workflow | +| `workflow-template-develop` | `@uncaged/workflow-template-develop` | Develop workflow template (roles in `src/roles/`) | +| `workflow-template-solve-issue` | `@uncaged/workflow-template-solve-issue` | Solve-issue workflow template (roles in `src/roles/`) | | `workflow-util-agent` | `@uncaged/workflow-util-agent` | `buildAgentPrompt` + `spawnCli` utilities | Monorepo with **bun workspace**, `workspace:*` protocol.