workflow-ledger 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +18 -0
- package/.claude-plugin/plugin.json +18 -0
- package/LICENSE +21 -0
- package/README.md +226 -0
- package/README.zh-CN.md +224 -0
- package/bin/workflow-ledger +417 -0
- package/bin/workflow-ledger.js +239 -0
- package/docs/cli.md +94 -0
- package/docs/design.md +43 -0
- package/docs/design.zh-CN.md +47 -0
- package/docs/usage.md +119 -0
- package/docs/usage.zh-CN.md +117 -0
- package/examples/claude-project/CLAUDE.md.snippet +18 -0
- package/examples/claude-project/WORKFLOW.md +36 -0
- package/examples/codex-project/AGENTS.md.snippet +11 -0
- package/hooks/hooks.json +10 -0
- package/hooks/session-start +28 -0
- package/install.sh +75 -0
- package/package.json +43 -0
- package/skills/workflow-ledger/SKILL.md +168 -0
- package/skills/workflow-ledger/templates/WORKFLOW.md +50 -0
- package/templates/WORKFLOW.md +50 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workflow-ledger-dev",
|
|
3
|
+
"description": "Development marketplace for workflow-ledger",
|
|
4
|
+
"owner": {
|
|
5
|
+
"name": "MorseWayne"
|
|
6
|
+
},
|
|
7
|
+
"plugins": [
|
|
8
|
+
{
|
|
9
|
+
"name": "workflow-ledger",
|
|
10
|
+
"description": "Lightweight, recoverable workflow ledger for Claude Code projects",
|
|
11
|
+
"version": "0.3.5",
|
|
12
|
+
"source": "./",
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "MorseWayne"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workflow-ledger",
|
|
3
|
+
"description": "Lightweight, recoverable workflow ledger for Claude Code projects",
|
|
4
|
+
"version": "0.3.5",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "MorseWayne"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/MorseWayne/workflow-ledger",
|
|
9
|
+
"repository": "https://github.com/MorseWayne/workflow-ledger",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"claude-code",
|
|
13
|
+
"skills",
|
|
14
|
+
"workflow",
|
|
15
|
+
"ledger",
|
|
16
|
+
"recoverability"
|
|
17
|
+
]
|
|
18
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# workflow-ledger
|
|
2
|
+
|
|
3
|
+
A lightweight OpenSpec-style change ledger for Claude Code.
|
|
4
|
+
|
|
5
|
+
`workflow-ledger` helps Claude Code projects stay **traceable, resumable, and adaptable** without forcing every change through proposal/design/task/spec files.
|
|
6
|
+
|
|
7
|
+
It is designed for one common failure mode of AI-assisted development:
|
|
8
|
+
|
|
9
|
+
> The conversation is interrupted, context is compacted, or a new session starts — and nobody can immediately tell what was done, what was accepted, what is blocked, and what should happen next.
|
|
10
|
+
|
|
11
|
+
`workflow-ledger` solves this with a single project overview file: `.claude/WORKFLOW.md`.
|
|
12
|
+
|
|
13
|
+
[中文文档](README.zh-CN.md)
|
|
14
|
+
|
|
15
|
+
## Why this workflow exists
|
|
16
|
+
|
|
17
|
+
Many workflow systems solve recoverability by creating a lot of structure:
|
|
18
|
+
|
|
19
|
+
- proposal files
|
|
20
|
+
- design files
|
|
21
|
+
- task files
|
|
22
|
+
- per-feature folders
|
|
23
|
+
- phase-specific artifacts
|
|
24
|
+
- command-specific state
|
|
25
|
+
|
|
26
|
+
That is valuable for large feature work, but too heavy for everyday Claude Code development. Most tasks need something smaller:
|
|
27
|
+
|
|
28
|
+
- one place to see the active change intent
|
|
29
|
+
- a mutable current todo instead of a frozen plan
|
|
30
|
+
- visible prerequisites, blockers, and deferred work
|
|
31
|
+
- a resume point for the next session
|
|
32
|
+
- a short close summary when work finishes
|
|
33
|
+
|
|
34
|
+
`workflow-ledger` keeps the parts that matter and removes the parts that slow small tasks down.
|
|
35
|
+
|
|
36
|
+
## What it gives you
|
|
37
|
+
|
|
38
|
+
- **One change ledger**: `.claude/WORKFLOW.md` is the source of truth.
|
|
39
|
+
- **Task levels**: Level 0-3 classification keeps simple work light and complex work safer.
|
|
40
|
+
- **Intent-first entries**: each active task records one small user-visible intent.
|
|
41
|
+
- **Mutable todo**: `Current todo` can change as requirements, prerequisites, or blockers appear.
|
|
42
|
+
- **Recoverability**: every active task has `Current phase` as current focus and `Resume next`.
|
|
43
|
+
- **Dependency discipline**: blocking prerequisites stay in the active entry; non-blocking discoveries go to Backlog/Future.
|
|
44
|
+
- **Low file count**: no per-task files by default.
|
|
45
|
+
- **Claude Code native**: shipped as a reusable skill, no runtime dependency required.
|
|
46
|
+
|
|
47
|
+
## How it compares
|
|
48
|
+
|
|
49
|
+
| Approach | Strength | Tradeoff | workflow-ledger stance |
|
|
50
|
+
|---|---|---|---|
|
|
51
|
+
| Chat history only | Zero setup | Hard to recover after interruption or compaction | Not enough for multi-step work |
|
|
52
|
+
| Todo list only | Great for current session | Not durable across sessions | Use TodoWrite for in-session execution only |
|
|
53
|
+
| Heavy spec workflows | Strong governance and traceability | Many files and stage overhead | Use only when Level 3 work truly needs it |
|
|
54
|
+
| Hooks-first automation | Deterministic enforcement | Can become noisy and rigid | Use hooks as optional guardrails, not the workflow engine |
|
|
55
|
+
| `workflow-ledger` | Durable, lightweight, reviewable | Requires updating one ledger file at milestones | Default for recoverable Claude Code work |
|
|
56
|
+
|
|
57
|
+
## Compared with specific tools
|
|
58
|
+
|
|
59
|
+
| Tool / workflow | Best at | Typical shape | Where `workflow-ledger` differs |
|
|
60
|
+
|---|---|---|---|
|
|
61
|
+
| Superpowers-style skills | Teaching Claude repeatable behaviors through reusable skills and checklists | Skill packs with detailed procedures, design/planning loops, and explicit human approval gates | Uses the same skill-native delivery model, but narrows the scope to task memory: one ledger, change intent, mutable todo, prerequisites, and resume points |
|
|
62
|
+
| GSD-style planning workflows | Breaking large work into researched phases with verification, security, UI, or evaluation reviews | Multi-agent planning and execution, phase documents, review reports, and stronger process gates | Keeps the recoverability pattern but removes most ceremony for day-to-day work; heavyweight review artifacts stay outside the default ledger |
|
|
63
|
+
| OpenSpec-style spec workflows | Governing product or API changes with proposals, specs, tasks, and archival history | Formal proposal/design/task files with a spec lifecycle | Borrows intent/change discipline, but avoids making every change start with proposal/design/tasks/spec files |
|
|
64
|
+
| Claude Code hooks | Deterministically enforcing a rule at tool or lifecycle boundaries | Event handlers for commands such as pre-tool, post-tool, stop, or compact | Treats hooks as optional guardrails; the workflow state remains human-readable in `.claude/WORKFLOW.md` |
|
|
65
|
+
| TodoWrite / session todos | Managing what Claude is doing right now | In-session checklist that is easy to update frequently | Uses TodoWrite for live execution only; the ledger stores durable milestones and handoff context |
|
|
66
|
+
|
|
67
|
+
In short: Superpowers teaches behaviors, GSD coordinates heavier execution, OpenSpec governs formal changes, hooks enforce events, and TodoWrite tracks the current session. `workflow-ledger` is the smaller missing layer between them: a single-file, OpenSpec-lite memory for everyday Claude Code development.
|
|
68
|
+
|
|
69
|
+
## Inspired by existing workflows
|
|
70
|
+
|
|
71
|
+
`workflow-ledger` borrows ideas from spec-driven and skill-driven workflows, but intentionally stays smaller.
|
|
72
|
+
|
|
73
|
+
- From spec-driven systems such as OpenSpec: explicit change intent, dependency awareness, and archive-style close summaries.
|
|
74
|
+
- From Claude Code skills and Superpowers-style workflows: reusable procedural guidance that loads when needed.
|
|
75
|
+
- From hooks: the idea that some actions may need hard guardrails, while keeping those guardrails optional.
|
|
76
|
+
|
|
77
|
+
The key design decision is simple:
|
|
78
|
+
|
|
79
|
+
> Mandatory project rules stay short. Detailed workflow guidance lives in a skill. Durable change state lives in one ledger file.
|
|
80
|
+
|
|
81
|
+
## Install
|
|
82
|
+
|
|
83
|
+
Recommended global tool setup:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx workflow-ledger setup
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Configure specific AI coding tools:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx workflow-ledger setup --tool claude-code
|
|
93
|
+
npx workflow-ledger setup --tool codex
|
|
94
|
+
npx workflow-ledger setup --tool all
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Then initialize a project ledger from the target project root:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npx workflow-ledger init
|
|
101
|
+
npx workflow-ledger init --tool claude-code
|
|
102
|
+
npx workflow-ledger init --tool codex
|
|
103
|
+
npx workflow-ledger init --tool all
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`setup` installs global tool integrations. `init` creates project-local ledger files and short instruction snippets. `claude-code` uses `.claude/WORKFLOW.md`; `codex` uses `.workflow-ledger/WORKFLOW.md` plus `AGENTS.md`.
|
|
107
|
+
|
|
108
|
+
The Bash installer remains available for Claude Code project initialization:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
curl -fsSL https://raw.githubusercontent.com/MorseWayne/workflow-ledger/main/install.sh | bash
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If you already have a local checkout of `workflow-ledger`, you can run the installer directly:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
/path/to/workflow-ledger/install.sh /path/to/your/project
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Manual project-local install for Claude Code:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
mkdir -p .claude/skills
|
|
124
|
+
cp -R skills/workflow-ledger .claude/skills/workflow-ledger
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Personal install only installs the skill; project setup still needs the `CLAUDE.md` snippet and `.claude/WORKFLOW.md`:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
mkdir -p ~/.claude/skills
|
|
131
|
+
cp -R skills/workflow-ledger ~/.claude/skills/workflow-ledger
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The installer also copies a project-local CLI to `.claude/bin/workflow-ledger`:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
.claude/bin/workflow-ledger doctor
|
|
138
|
+
.claude/bin/workflow-ledger list
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
See [docs/cli.md](docs/cli.md) for command details. The CLI is an optional guardrail; it does not replace the skill workflow.
|
|
142
|
+
|
|
143
|
+
Then invoke it in Claude Code:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
/workflow-ledger start "implement auth flow"
|
|
147
|
+
/workflow-ledger resume
|
|
148
|
+
/workflow-ledger close
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Project setup
|
|
152
|
+
|
|
153
|
+
A project needs two layers:
|
|
154
|
+
|
|
155
|
+
1. Global tool setup with `workflow-ledger setup` so supported agents can find the workflow instructions.
|
|
156
|
+
2. Project initialization with `workflow-ledger init` so the repository has a ledger file and a short tool-specific reminder.
|
|
157
|
+
|
|
158
|
+
For Claude Code, `init` adds the snippet from [examples/claude-project/CLAUDE.md.snippet](examples/claude-project/CLAUDE.md.snippet) to your project's `CLAUDE.md` and creates [skills/workflow-ledger/templates/WORKFLOW.md](skills/workflow-ledger/templates/WORKFLOW.md) at `.claude/WORKFLOW.md`.
|
|
159
|
+
|
|
160
|
+
For Codex, `init --tool codex` adds [examples/codex-project/AGENTS.md.snippet](examples/codex-project/AGENTS.md.snippet) to `AGENTS.md` and creates [templates/WORKFLOW.md](templates/WORKFLOW.md) at `.workflow-ledger/WORKFLOW.md`.
|
|
161
|
+
|
|
162
|
+
## The ledger shape
|
|
163
|
+
|
|
164
|
+
A tracked task is organized like this:
|
|
165
|
+
|
|
166
|
+
```markdown
|
|
167
|
+
### WF-2026-05-16-001 — Add streaming usage accounting
|
|
168
|
+
Status: In Progress
|
|
169
|
+
Level: 2
|
|
170
|
+
Current phase: Implement conversion fix
|
|
171
|
+
|
|
172
|
+
Intent:
|
|
173
|
+
- Stabilize streaming usage accounting without expanding the ledger into a transcript.
|
|
174
|
+
|
|
175
|
+
Current todo:
|
|
176
|
+
- [ ] Update converter.
|
|
177
|
+
- [ ] Add regression test.
|
|
178
|
+
|
|
179
|
+
Changes:
|
|
180
|
+
- 2026-05-16 — Current implementation path narrowed to the provider conversion code.
|
|
181
|
+
|
|
182
|
+
Prerequisites:
|
|
183
|
+
- Existing streaming usage tests must be checked before editing.
|
|
184
|
+
|
|
185
|
+
Resume next:
|
|
186
|
+
- Update the converter and add the smallest regression test.
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Workflow levels
|
|
190
|
+
|
|
191
|
+
| Level | Use for | Ledger? |
|
|
192
|
+
|---|---|---|
|
|
193
|
+
| Level 0 | Q&A, read-only explanation | No |
|
|
194
|
+
| Level 1 | typo, docs tweak, tiny config, no behavior change | Optional |
|
|
195
|
+
| Level 2 | standard code work, tests, single-module behavior changes | Yes |
|
|
196
|
+
| Level 3 | new features, cross-module work, public APIs, unclear or high-risk changes | Yes, attachments optional |
|
|
197
|
+
|
|
198
|
+
## Design principles
|
|
199
|
+
|
|
200
|
+
- Keep the overview file useful at a glance.
|
|
201
|
+
- Keep the active intent small and current.
|
|
202
|
+
- Treat `Current todo` as mutable when implementation reveals new work.
|
|
203
|
+
- Record why prerequisites or future tasks were added.
|
|
204
|
+
- Avoid process for process's sake.
|
|
205
|
+
- Prefer one durable ledger over many scattered notes.
|
|
206
|
+
|
|
207
|
+
## When to use
|
|
208
|
+
|
|
209
|
+
Use `workflow-ledger` for:
|
|
210
|
+
|
|
211
|
+
- multi-step implementation work
|
|
212
|
+
- tasks likely to span sessions
|
|
213
|
+
- work where review history matters
|
|
214
|
+
- debugging or refactoring with dependencies
|
|
215
|
+
- any task where you need to know what is done and what is left
|
|
216
|
+
|
|
217
|
+
Skip it for:
|
|
218
|
+
|
|
219
|
+
- pure Q&A
|
|
220
|
+
- trivial one-step changes
|
|
221
|
+
- throwaway exploration
|
|
222
|
+
- tasks where the user explicitly says not to track
|
|
223
|
+
|
|
224
|
+
## Repository status
|
|
225
|
+
|
|
226
|
+
This version supports both npm setup and the legacy Bash installer. The CLI can install Workflow Ledger for Claude Code, Codex, or both, while keeping the ledger format lightweight and tool-readable.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# workflow-ledger
|
|
2
|
+
|
|
3
|
+
面向 Claude Code 的轻量级 OpenSpec-style change ledger。
|
|
4
|
+
|
|
5
|
+
`workflow-ledger` 让 Claude Code 项目在开发过程中保持**可跟踪、可恢复、可调整**,但不强迫每个任务都进入 proposal/design/tasks/spec 文件流程。
|
|
6
|
+
|
|
7
|
+
它要解决的是 AI 辅助开发里非常常见的问题:
|
|
8
|
+
|
|
9
|
+
> 会话中断、上下文压缩、换新会话继续时,没人能一眼看清已经做了什么、验收了什么、阻塞在哪里、下一步该干什么。
|
|
10
|
+
|
|
11
|
+
`workflow-ledger` 用一个项目总览文件解决这个问题:`.claude/WORKFLOW.md`。
|
|
12
|
+
|
|
13
|
+
## 为什么设计这个工作流
|
|
14
|
+
|
|
15
|
+
很多工作流系统为了可恢复性,会引入很多结构:
|
|
16
|
+
|
|
17
|
+
- proposal 文件
|
|
18
|
+
- design 文件
|
|
19
|
+
- task 文件
|
|
20
|
+
- 每个功能一个目录
|
|
21
|
+
- 阶段产物
|
|
22
|
+
- 命令状态机
|
|
23
|
+
|
|
24
|
+
这些对大型功能很有价值,但对日常 Claude Code 开发太重了。大多数任务真正需要的是:
|
|
25
|
+
|
|
26
|
+
- 一个地方看当前 change intent
|
|
27
|
+
- 可变的 `Current todo`,而不是冻结计划
|
|
28
|
+
- 能看到前置依赖、阻塞和延期任务
|
|
29
|
+
- 中断后能恢复
|
|
30
|
+
- 完成时只写短 `Close summary`
|
|
31
|
+
|
|
32
|
+
`workflow-ledger` 保留这些关键能力,同时避免制造大量文件。
|
|
33
|
+
|
|
34
|
+
## 它提供什么
|
|
35
|
+
|
|
36
|
+
- **单文件 change ledger**:`.claude/WORKFLOW.md` 是任务状态源。
|
|
37
|
+
- **任务分级**:Level 0-3,让简单任务保持轻量,复杂任务更安全。
|
|
38
|
+
- **Intent-first 条目**:每个 Active 任务只记录一个小的用户可见目标。
|
|
39
|
+
- **可变 todo**:`Current todo` 可以随新增需求、前置依赖或阻塞调整。
|
|
40
|
+
- **可恢复点**:每个活跃任务都有表示当前焦点的 `Current phase` 和 `Resume next`。
|
|
41
|
+
- **依赖管理**:阻塞当前目标的前置依赖留在 Active;非阻塞发现进入 Backlog/Future。
|
|
42
|
+
- **低文件数量**:默认不为每个任务创建独立文件。
|
|
43
|
+
- **Claude Code 原生**:以 skill 形式交付,不需要运行时依赖。
|
|
44
|
+
|
|
45
|
+
## 和其他方式的区别
|
|
46
|
+
|
|
47
|
+
| 方式 | 优点 | 代价 | workflow-ledger 的选择 |
|
|
48
|
+
|---|---|---|---|
|
|
49
|
+
| 只靠聊天历史 | 零配置 | 中断或压缩后难恢复 | 多步任务不够用 |
|
|
50
|
+
| 只靠 TodoWrite | 当前会话很好用 | 不能跨会话持久恢复 | 用于当前会话执行,不承担历史记录 |
|
|
51
|
+
| 重型 spec 工作流 | 治理强、可追踪 | 文件多、阶段重 | 只在 Level 3 真需要时使用 |
|
|
52
|
+
| hook 自动化 | 确定性强 | 容易变吵、变硬 | 作为可选保险丝,不作为主流程 |
|
|
53
|
+
| `workflow-ledger` | 轻量、可恢复、可验收 | 需要在里程碑节点更新一个文件 | 默认用于需要恢复的 Claude Code 开发任务 |
|
|
54
|
+
|
|
55
|
+
## 和具体工具的横向对比
|
|
56
|
+
|
|
57
|
+
| 工具 / 工作流 | 最擅长 | 常见形态 | `workflow-ledger` 的区别 |
|
|
58
|
+
|---|---|---|---|
|
|
59
|
+
| Superpowers 风格 skills | 用可复用 skill 和 checklist 教 Claude 按固定方式工作 | skill 包、详细流程、设计/计划循环、明确的人类批准门 | 采用同样的 skill-native 交付方式,但范围更窄:只解决任务记忆、change intent、可变 todo、前置依赖和恢复点 |
|
|
60
|
+
| GSD 风格规划工作流 | 把大型工作拆成调研、计划、执行、验证、安全/UI/eval review 等阶段 | 多 agent 规划与执行、阶段文档、review 报告、更强流程门禁 | 借鉴可恢复思路,但把日常任务的仪式感降到最低;重型 review 产物不进入默认 ledger |
|
|
61
|
+
| OpenSpec 风格 spec 工作流 | 用 proposal、spec、tasks 和归档历史治理产品/API 变化 | 正式 proposal/design/task 文件和 spec 生命周期 | 借鉴 intent/change 管理意识,但不要求每个改动都从 proposal/design/tasks/spec 文件开始 |
|
|
62
|
+
| Claude Code hooks | 在工具调用或生命周期边界确定性执行规则 | PreToolUse、PostToolUse、Stop、Compact 等事件处理器 | 把 hooks 视为可选保险丝;工作流状态仍放在可读的 `.claude/WORKFLOW.md` 中 |
|
|
63
|
+
| TodoWrite / 会话 todo | 管理 Claude 当前会话正在做什么 | 当前会话内频繁更新的 checklist | TodoWrite 只负责现场执行;ledger 负责持久里程碑和交接上下文 |
|
|
64
|
+
|
|
65
|
+
一句话概括:Superpowers 教行为,GSD 编排重型执行,OpenSpec 治理正式变更,hooks 强制事件规则,TodoWrite 跟踪当前会话。`workflow-ledger` 补的是中间那一层:日常 Claude Code 开发里的单文件 OpenSpec-lite 任务记忆。
|
|
66
|
+
|
|
67
|
+
## 借鉴了哪些思路
|
|
68
|
+
|
|
69
|
+
`workflow-ledger` 借鉴了 spec-driven 和 skill-driven 工作流,但刻意保持更小:
|
|
70
|
+
|
|
71
|
+
- 借鉴 OpenSpec 这类 spec-driven 系统:明确 intent、依赖意识和归档式关闭摘要。
|
|
72
|
+
- 借鉴 Claude Code skills / Superpowers 风格:把可复用流程写成 skill,按需加载。
|
|
73
|
+
- 借鉴 hooks:关键动作可以有硬性保护,但不默认把 hook 变成工作流引擎。
|
|
74
|
+
|
|
75
|
+
核心设计原则是:
|
|
76
|
+
|
|
77
|
+
> 强制规则保持短;详细流程放 skill;长期 change state 放一个 ledger 文件。
|
|
78
|
+
|
|
79
|
+
## 安装
|
|
80
|
+
|
|
81
|
+
推荐先做全局工具接入:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx workflow-ledger setup
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
也可以只配置特定 AI coding 工具:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx workflow-ledger setup --tool claude-code
|
|
91
|
+
npx workflow-ledger setup --tool codex
|
|
92
|
+
npx workflow-ledger setup --tool all
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
然后在目标项目根目录初始化 ledger:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx workflow-ledger init
|
|
99
|
+
npx workflow-ledger init --tool claude-code
|
|
100
|
+
npx workflow-ledger init --tool codex
|
|
101
|
+
npx workflow-ledger init --tool all
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
`setup` 安装全局工具接入;`init` 创建项目本地 ledger 和短指令片段。`claude-code` 使用 `.claude/WORKFLOW.md`;`codex` 使用 `.workflow-ledger/WORKFLOW.md` 和 `AGENTS.md`。
|
|
105
|
+
|
|
106
|
+
Bash 安装器仍可用于 Claude Code 项目初始化:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
curl -fsSL https://raw.githubusercontent.com/MorseWayne/workflow-ledger/main/install.sh | bash
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
如果你已经有本地 `workflow-ledger` checkout,也可以直接运行安装脚本:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
/path/to/workflow-ledger/install.sh /path/to/your/project
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
手动项目级安装 Claude Code:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
mkdir -p .claude/skills
|
|
122
|
+
cp -R skills/workflow-ledger .claude/skills/workflow-ledger
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
个人全局安装只安装 skill;项目仍然需要 `CLAUDE.md` 片段和 `.claude/WORKFLOW.md`:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
mkdir -p ~/.claude/skills
|
|
129
|
+
cp -R skills/workflow-ledger ~/.claude/skills/workflow-ledger
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
安装器也会把项目本地 CLI 复制到 `.claude/bin/workflow-ledger`:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
.claude/bin/workflow-ledger doctor
|
|
136
|
+
.claude/bin/workflow-ledger list
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
详见 [docs/cli.md](docs/cli.md)。CLI 是可选保护栏,不替代 skill 工作流。
|
|
140
|
+
|
|
141
|
+
然后在 Claude Code 中调用:
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
/workflow-ledger start "implement auth flow"
|
|
145
|
+
/workflow-ledger resume
|
|
146
|
+
/workflow-ledger close
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 项目接入
|
|
150
|
+
|
|
151
|
+
项目接入分两层:
|
|
152
|
+
|
|
153
|
+
1. 先用 `workflow-ledger setup` 做全局工具接入,让支持的 agent 能找到工作流指令。
|
|
154
|
+
2. 再用 `workflow-ledger init` 初始化项目,让仓库里有 ledger 文件和短工具提醒。
|
|
155
|
+
|
|
156
|
+
对 Claude Code,`init` 会把 [examples/claude-project/CLAUDE.md.snippet](examples/claude-project/CLAUDE.md.snippet) 加入项目 `CLAUDE.md`,并把 [skills/workflow-ledger/templates/WORKFLOW.md](skills/workflow-ledger/templates/WORKFLOW.md) 创建到 `.claude/WORKFLOW.md`。
|
|
157
|
+
|
|
158
|
+
对 Codex,`init --tool codex` 会把 [examples/codex-project/AGENTS.md.snippet](examples/codex-project/AGENTS.md.snippet) 加入 `AGENTS.md`,并把 [templates/WORKFLOW.md](templates/WORKFLOW.md) 创建到 `.workflow-ledger/WORKFLOW.md`。
|
|
159
|
+
|
|
160
|
+
## 台账结构示例
|
|
161
|
+
|
|
162
|
+
一个被跟踪的任务大致长这样:
|
|
163
|
+
|
|
164
|
+
```markdown
|
|
165
|
+
### WF-2026-05-16-001 — Add streaming usage accounting
|
|
166
|
+
Status: In Progress
|
|
167
|
+
Level: 2
|
|
168
|
+
Current phase: Implement conversion fix
|
|
169
|
+
|
|
170
|
+
Intent:
|
|
171
|
+
- Stabilize streaming usage accounting without expanding the ledger into a transcript.
|
|
172
|
+
|
|
173
|
+
Current todo:
|
|
174
|
+
- [ ] Update converter.
|
|
175
|
+
- [ ] Add regression test.
|
|
176
|
+
|
|
177
|
+
Changes:
|
|
178
|
+
- 2026-05-16 — Current implementation path narrowed to the provider conversion code.
|
|
179
|
+
|
|
180
|
+
Prerequisites:
|
|
181
|
+
- Existing streaming usage tests must be checked before editing.
|
|
182
|
+
|
|
183
|
+
Resume next:
|
|
184
|
+
- Update the converter and add the smallest regression test.
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## 任务分级
|
|
188
|
+
|
|
189
|
+
| Level | 适用场景 | 是否写 ledger |
|
|
190
|
+
|---|---|---|
|
|
191
|
+
| Level 0 | 问答、只读解释 | 不需要 |
|
|
192
|
+
| Level 1 | typo、文档小改、小配置、无行为变化 | 可选 |
|
|
193
|
+
| Level 2 | 标准代码修改、测试、单模块行为变更 | 需要 |
|
|
194
|
+
| Level 3 | 新功能、跨模块、公共 API、不明确或高风险变更 | 需要,可选附件 |
|
|
195
|
+
|
|
196
|
+
## 设计原则
|
|
197
|
+
|
|
198
|
+
- 总览文件必须一眼有用。
|
|
199
|
+
- 保持 Active intent 小而明确。
|
|
200
|
+
- 执行中发现新情况时允许调整 `Current todo`。
|
|
201
|
+
- 新增前置依赖或未来任务时记录原因。
|
|
202
|
+
- 不为了流程而流程。
|
|
203
|
+
- 优先一个持久 ledger,而不是散落的过程文件。
|
|
204
|
+
|
|
205
|
+
## 什么时候使用
|
|
206
|
+
|
|
207
|
+
适合:
|
|
208
|
+
|
|
209
|
+
- 多步骤实现
|
|
210
|
+
- 可能跨会话的任务
|
|
211
|
+
- 需要保留 review 历史的任务
|
|
212
|
+
- 有依赖的 debug / refactor
|
|
213
|
+
- 任何需要知道“已完成什么、还剩什么”的任务
|
|
214
|
+
|
|
215
|
+
不适合:
|
|
216
|
+
|
|
217
|
+
- 纯问答
|
|
218
|
+
- 一步完成的小修改
|
|
219
|
+
- 临时探索
|
|
220
|
+
- 用户明确说不用跟踪的任务
|
|
221
|
+
|
|
222
|
+
## 当前状态
|
|
223
|
+
|
|
224
|
+
当前版本同时支持 npm setup 和旧的 Bash installer。CLI 可以为 Claude Code、Codex 或两者安装 Workflow Ledger,同时保持 ledger 格式轻量、可被多个工具读取。
|