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
package/docs/cli.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# CLI
|
|
2
|
+
|
|
3
|
+
`workflow-ledger` includes a small zero-dependency Bash CLI for project-local guardrails.
|
|
4
|
+
|
|
5
|
+
The installer copies it to:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
.claude/bin/workflow-ledger
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
It does not modify your shell `PATH`.
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
workflow-ledger setup --tool claude-code
|
|
17
|
+
workflow-ledger setup --tool codex
|
|
18
|
+
workflow-ledger setup --tool all
|
|
19
|
+
workflow-ledger init --tool claude-code
|
|
20
|
+
workflow-ledger init --tool codex
|
|
21
|
+
workflow-ledger init --tool all
|
|
22
|
+
workflow-ledger doctor
|
|
23
|
+
workflow-ledger list
|
|
24
|
+
workflow-ledger hooks status
|
|
25
|
+
workflow-ledger hooks install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## `setup`
|
|
29
|
+
|
|
30
|
+
Installs global Workflow Ledger integrations for supported AI coding tools.
|
|
31
|
+
|
|
32
|
+
- `--tool claude-code` installs the global Claude Code skill to `~/.claude/skills/workflow-ledger` and copies the local CLI to `~/.claude/bin/workflow-ledger`.
|
|
33
|
+
- `--tool codex` installs the Codex skill to `~/.agents/skills/workflow-ledger` when `~/.codex` exists.
|
|
34
|
+
- `--tool all` configures all detected adapters.
|
|
35
|
+
|
|
36
|
+
`setup` is environment-level and may skip tools that are not installed.
|
|
37
|
+
|
|
38
|
+
## `init`
|
|
39
|
+
|
|
40
|
+
Creates project-local Workflow Ledger files for selected tools.
|
|
41
|
+
|
|
42
|
+
- `--tool claude-code` creates `.claude/WORKFLOW.md` and updates `CLAUDE.md`.
|
|
43
|
+
- `--tool codex` creates `.workflow-ledger/WORKFLOW.md` and updates `AGENTS.md`.
|
|
44
|
+
- `--tool all` initializes both project adapters.
|
|
45
|
+
- `--root PATH` targets a project root other than the current directory.
|
|
46
|
+
|
|
47
|
+
`init` preserves existing ledger files and instruction sections.
|
|
48
|
+
|
|
49
|
+
## `doctor`
|
|
50
|
+
|
|
51
|
+
Runs read-only health checks against `.claude/WORKFLOW.md`.
|
|
52
|
+
|
|
53
|
+
Errors return exit code `1`:
|
|
54
|
+
|
|
55
|
+
- Missing `.claude/WORKFLOW.md`.
|
|
56
|
+
- Missing core sections: `Active`, `Backlog / Future`, or `Completed`.
|
|
57
|
+
- In Progress task without `Current phase`.
|
|
58
|
+
- In Progress task without `Intent`.
|
|
59
|
+
- In Progress task without `Current todo`.
|
|
60
|
+
- In Progress task without `Resume next`.
|
|
61
|
+
- Blocked task without `Blocked by` or `Resume next`.
|
|
62
|
+
|
|
63
|
+
Warnings do not fail the command:
|
|
64
|
+
|
|
65
|
+
- More than one Active task.
|
|
66
|
+
- Level 2/3 task without `Changes` or `Prerequisites`.
|
|
67
|
+
- Ledger older than the latest git commit.
|
|
68
|
+
- Active task with more than 80 lines.
|
|
69
|
+
- Completed task still under `Active` without `Close summary`.
|
|
70
|
+
- Backlog with more than 10 items.
|
|
71
|
+
|
|
72
|
+
## `list`
|
|
73
|
+
|
|
74
|
+
Prints a compact summary of active tasks, current focus, resume next action, backlog count, and completed count.
|
|
75
|
+
|
|
76
|
+
If `.claude/WORKFLOW.md` is missing, `list` prints a message and exits `0`.
|
|
77
|
+
|
|
78
|
+
## Hooks
|
|
79
|
+
|
|
80
|
+
Hooks are optional and advisory.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
.claude/bin/workflow-ledger hooks status
|
|
84
|
+
.claude/bin/workflow-ledger hooks install
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`hooks install` writes these project-local hook files:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
.claude/hooks/hooks.json
|
|
91
|
+
.claude/hooks/session-start
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
It does not overwrite existing hook files and does not modify global Claude Code settings.
|
package/docs/design.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Design
|
|
2
|
+
|
|
3
|
+
`workflow-ledger` is a lightweight OpenSpec-style change ledger for Claude Code projects.
|
|
4
|
+
|
|
5
|
+
## Problem
|
|
6
|
+
|
|
7
|
+
Long-running Claude Code tasks can be interrupted, resumed in a new session, or continued by another agent. Plain chat history and current-session todos are not enough for reliable recovery. Heavy spec systems solve this with many files and formal stages, but that is too much for everyday development.
|
|
8
|
+
|
|
9
|
+
## Approach
|
|
10
|
+
|
|
11
|
+
Use one single-file change ledger, `.claude/WORKFLOW.md`, plus a reusable Claude Code skill.
|
|
12
|
+
|
|
13
|
+
The skill teaches Claude how to:
|
|
14
|
+
|
|
15
|
+
- classify task weight
|
|
16
|
+
- create or update one intent-first task entry
|
|
17
|
+
- keep `Current todo` mutable as implementation reveals new work
|
|
18
|
+
- track prerequisites, blockers, and discovered future work
|
|
19
|
+
- close completed work into a concise history section
|
|
20
|
+
|
|
21
|
+
## Non-goals
|
|
22
|
+
|
|
23
|
+
- No per-task file by default.
|
|
24
|
+
- No mandatory proposal/design/tasks documents.
|
|
25
|
+
- No mandatory hook automation.
|
|
26
|
+
- No heavyweight CLI runtime or package manager; the optional CLI stays zero-dependency and project-local.
|
|
27
|
+
|
|
28
|
+
## File model
|
|
29
|
+
|
|
30
|
+
- `.claude/WORKFLOW.md`: project-local change ledger.
|
|
31
|
+
- `.claude/skills/workflow-ledger/SKILL.md`: reusable workflow instructions.
|
|
32
|
+
- Optional attachments: only for long Level 3 details.
|
|
33
|
+
|
|
34
|
+
## Task levels
|
|
35
|
+
|
|
36
|
+
- Level 0: Q&A/read-only, no ledger.
|
|
37
|
+
- Level 1: lightweight edit, ledger optional.
|
|
38
|
+
- Level 2: standard code work, ledger required.
|
|
39
|
+
- Level 3: complex work, ledger required and optional attachments allowed.
|
|
40
|
+
|
|
41
|
+
## Recovery model
|
|
42
|
+
|
|
43
|
+
To resume work, read `.claude/WORKFLOW.md`, find `Active`, follow `Intent`, `Current phase`, `Current todo`, `Prerequisites`, `Blocked by`, and `Resume next`. Verify the current repository state before trusting stale ledger entries.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# 设计说明
|
|
2
|
+
|
|
3
|
+
`workflow-ledger` 是面向 Claude Code 项目的轻量级 OpenSpec-style change ledger。
|
|
4
|
+
|
|
5
|
+
## 问题
|
|
6
|
+
|
|
7
|
+
长时间运行的 Claude Code 任务可能会中断、在新会话中恢复,或者交给另一个 agent 继续。单靠聊天历史和当前会话 todo,不足以可靠恢复任务状态。
|
|
8
|
+
|
|
9
|
+
重型 spec 系统可以通过许多文件和正式阶段解决这个问题,但这对日常开发来说经常太重。
|
|
10
|
+
|
|
11
|
+
## 方案
|
|
12
|
+
|
|
13
|
+
使用一个单文件 change ledger `.claude/WORKFLOW.md`,再配合一个可复用 Claude Code skill。
|
|
14
|
+
|
|
15
|
+
skill 指导 Claude:
|
|
16
|
+
|
|
17
|
+
- 判断任务重量级别。
|
|
18
|
+
- 创建或更新一个 intent-first 任务条目。
|
|
19
|
+
- 执行中发现新情况时允许调整 `Current todo`。
|
|
20
|
+
- 跟踪前置依赖、阻塞和执行中发现的未来任务。
|
|
21
|
+
- 把完成任务归档为简洁历史。
|
|
22
|
+
|
|
23
|
+
## 非目标
|
|
24
|
+
|
|
25
|
+
- 默认不为每个任务创建独立文件。
|
|
26
|
+
- 不强制创建 proposal / design / tasks 文档。
|
|
27
|
+
- 不强制使用 hook 自动化。
|
|
28
|
+
- 不引入重型 CLI 运行时或包管理器;可选 CLI 保持零依赖、项目本地。
|
|
29
|
+
|
|
30
|
+
## 文件模型
|
|
31
|
+
|
|
32
|
+
- `.claude/WORKFLOW.md`:项目本地 change ledger。
|
|
33
|
+
- `.claude/skills/workflow-ledger/SKILL.md`:可复用工作流说明。
|
|
34
|
+
- 可选附件:只用于 Level 3 的长细节。
|
|
35
|
+
|
|
36
|
+
## 任务级别
|
|
37
|
+
|
|
38
|
+
- Level 0:问答 / 只读解释,不需要 ledger。
|
|
39
|
+
- Level 1:轻量修改,ledger 可选。
|
|
40
|
+
- Level 2:标准代码任务,需要 ledger。
|
|
41
|
+
- Level 3:复杂任务,需要 ledger,可选附件。
|
|
42
|
+
|
|
43
|
+
## 恢复模型
|
|
44
|
+
|
|
45
|
+
恢复任务时读取 `.claude/WORKFLOW.md`,找到 `Active`,根据 `Intent`、`Current phase`、`Current todo`、`Prerequisites`、`Blocked by` 和 `Resume next` 继续。
|
|
46
|
+
|
|
47
|
+
在信任 ledger 前,应先检查当前仓库状态;如果代码现状和 ledger 不一致,以当前代码和 git 状态为准,并更新 ledger。
|
package/docs/usage.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Usage
|
|
2
|
+
|
|
3
|
+
## Install into a project
|
|
4
|
+
|
|
5
|
+
Recommended global setup:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx workflow-ledger setup
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Configure a specific AI coding tool:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx workflow-ledger setup --tool claude-code
|
|
15
|
+
npx workflow-ledger setup --tool codex
|
|
16
|
+
npx workflow-ledger setup --tool all
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Then initialize the project ledger from the project root:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx workflow-ledger init
|
|
23
|
+
npx workflow-ledger init --tool claude-code
|
|
24
|
+
npx workflow-ledger init --tool codex
|
|
25
|
+
npx workflow-ledger init --tool all
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The `claude-code` project adapter creates `.claude/WORKFLOW.md` and updates `CLAUDE.md`. The `codex` project adapter creates `.workflow-ledger/WORKFLOW.md` and updates `AGENTS.md`.
|
|
29
|
+
|
|
30
|
+
The Bash installer remains available:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
curl -fsSL https://raw.githubusercontent.com/MorseWayne/workflow-ledger/main/install.sh | bash
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The init flow is idempotent:
|
|
37
|
+
|
|
38
|
+
- creates the relevant Workflow Ledger file only if missing
|
|
39
|
+
- preserves existing instruction sections and ledgers
|
|
40
|
+
|
|
41
|
+
If you already have a local checkout:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
/path/to/workflow-ledger/install.sh /path/to/your/project
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Manual Claude Code install has three required project-local steps: copy the skill, add the `CLAUDE.md` snippet, and create the ledger file.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
mkdir -p .claude/skills .claude
|
|
51
|
+
cp -R /path/to/workflow-ledger/skills/workflow-ledger .claude/skills/workflow-ledger
|
|
52
|
+
cp /path/to/workflow-ledger/skills/workflow-ledger/templates/WORKFLOW.md .claude/WORKFLOW.md
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Add the `CLAUDE.md` snippet so Claude has an always-loaded reminder to use the skill for Level 2/3 work:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cat /path/to/workflow-ledger/examples/claude-project/CLAUDE.md.snippet >> CLAUDE.md
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## CLI guardrails
|
|
62
|
+
|
|
63
|
+
After installation, you can run the CLI:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
workflow-ledger doctor
|
|
67
|
+
workflow-ledger list
|
|
68
|
+
workflow-ledger hooks status
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For Claude Code project-local installs, the copied CLI is also available:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
.claude/bin/workflow-ledger doctor
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Install optional advisory hooks only when you want SessionStart reminders:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
.claude/bin/workflow-ledger hooks install
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The CLI is a guardrail and summary tool. Claude still uses the `workflow-ledger` skill for the actual workflow.
|
|
84
|
+
|
|
85
|
+
## Start tracking work
|
|
86
|
+
|
|
87
|
+
In Claude Code:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
/workflow-ledger start "add streaming usage accounting"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Claude should:
|
|
94
|
+
|
|
95
|
+
1. classify the task level
|
|
96
|
+
2. create or update `.claude/WORKFLOW.md`
|
|
97
|
+
3. write the smallest `Intent`
|
|
98
|
+
4. set mutable `Current todo`, `Prerequisites`, and `Resume next`
|
|
99
|
+
5. use TodoWrite for the current session
|
|
100
|
+
|
|
101
|
+
## Resume work
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
/workflow-ledger resume
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Claude should read `.claude/WORKFLOW.md`, verify repo state, and continue from `Intent`, `Current phase`, `Current todo`, `Prerequisites`, `Blocked by`, and `Resume next`.
|
|
108
|
+
|
|
109
|
+
## Close work
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
/workflow-ledger close
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Claude should move the task from `Active` to `Completed` and record a short `Close summary` with outcome, validation, and gaps.
|
|
116
|
+
|
|
117
|
+
## Keep it lightweight
|
|
118
|
+
|
|
119
|
+
Do not create attachments unless a Level 3 task needs long research, design details, or large validation output.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# 使用指南
|
|
2
|
+
|
|
3
|
+
本文介绍如何在 Claude Code 项目中使用 `workflow-ledger`。
|
|
4
|
+
|
|
5
|
+
## 安装到项目
|
|
6
|
+
|
|
7
|
+
先做全局工具接入:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx workflow-ledger setup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
配置特定工具:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx workflow-ledger setup --tool claude-code
|
|
17
|
+
npx workflow-ledger setup --tool codex
|
|
18
|
+
npx workflow-ledger setup --tool all
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
然后在项目根目录初始化 ledger:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx workflow-ledger init
|
|
25
|
+
npx workflow-ledger init --tool claude-code
|
|
26
|
+
npx workflow-ledger init --tool codex
|
|
27
|
+
npx workflow-ledger init --tool all
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`claude-code` 项目 adapter 会创建 `.claude/WORKFLOW.md` 并更新 `CLAUDE.md`。`codex` 项目 adapter 会创建 `.workflow-ledger/WORKFLOW.md` 并更新 `AGENTS.md`。
|
|
31
|
+
|
|
32
|
+
Bash 安装脚本仍然可用:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
curl -fsSL https://raw.githubusercontent.com/MorseWayne/workflow-ledger/main/install.sh | bash
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
初始化流程是幂等的:
|
|
39
|
+
|
|
40
|
+
- 只在缺失时创建对应的 Workflow Ledger 文件
|
|
41
|
+
- 保留已有工具指令片段和 ledger
|
|
42
|
+
|
|
43
|
+
如果你已经有本地 checkout:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
/path/to/workflow-ledger/install.sh /path/to/your/project
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
手动安装仍然有三个项目本地必需步骤:复制 skill、追加 `CLAUDE.md` 规则片段、创建 ledger 文件。
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
mkdir -p .claude/skills .claude
|
|
53
|
+
cp -R /path/to/workflow-ledger/skills/workflow-ledger .claude/skills/workflow-ledger
|
|
54
|
+
cp /path/to/workflow-ledger/skills/workflow-ledger/templates/WORKFLOW.md .claude/WORKFLOW.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
把项目规则片段追加到 `CLAUDE.md`,让 Claude 始终能看到 Level 2/3 任务需要使用 skill 和 ledger 的简短提醒:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cat /path/to/workflow-ledger/examples/claude-project/CLAUDE.md.snippet >> CLAUDE.md
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 开始跟踪任务
|
|
64
|
+
|
|
65
|
+
在 Claude Code 中输入:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
/workflow-ledger start "add streaming usage accounting"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Claude 应该:
|
|
72
|
+
|
|
73
|
+
1. 判断任务级别。
|
|
74
|
+
2. 创建或更新 `.claude/WORKFLOW.md`。
|
|
75
|
+
3. 写最小 `Intent`。
|
|
76
|
+
4. 设置可变的 `Current todo`、`Prerequisites` 和 `Resume next`。
|
|
77
|
+
5. 使用 TodoWrite 跟踪当前会话执行。
|
|
78
|
+
|
|
79
|
+
## 恢复任务
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
/workflow-ledger resume
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Claude 应该读取 `.claude/WORKFLOW.md`,检查当前仓库状态,然后根据 `Intent`、`Current phase`、`Current todo`、`Prerequisites`、`Blocked by` 和 `Resume next` 继续执行。
|
|
86
|
+
|
|
87
|
+
## 更新任务
|
|
88
|
+
|
|
89
|
+
在执行过程中,只在里程碑节点更新 ledger:
|
|
90
|
+
|
|
91
|
+
- 任务开始
|
|
92
|
+
- todo/scope 出现实质变化
|
|
93
|
+
- 新增前置依赖
|
|
94
|
+
- 工作被阻塞
|
|
95
|
+
- 验证结果
|
|
96
|
+
- 中断交接
|
|
97
|
+
- 提交或关闭任务
|
|
98
|
+
|
|
99
|
+
不要每次小编辑都更新。
|
|
100
|
+
|
|
101
|
+
## 关闭任务
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
/workflow-ledger close
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Claude 应该:
|
|
108
|
+
|
|
109
|
+
1. 确认必要工作已完成,或明确延期。
|
|
110
|
+
2. 把任务从 `Active` 移到 `Completed`。
|
|
111
|
+
3. 用 `Close summary:` 替换 active-only 字段。
|
|
112
|
+
4. 只记录 outcome、validation 和 gaps。
|
|
113
|
+
5. 把未来工作保留在 `Backlog / Future`。
|
|
114
|
+
|
|
115
|
+
## 保持轻量
|
|
116
|
+
|
|
117
|
+
不要默认创建附件。只有 Level 3 任务需要长调研、详细设计或大量验证输出时,才创建附件并从 `.claude/WORKFLOW.md` 链接过去。
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## Workflow Ledger
|
|
2
|
+
|
|
3
|
+
Use `workflow-ledger` for recoverable development work.
|
|
4
|
+
|
|
5
|
+
- Classify tasks before executing: Level 0 Q&A, Level 1 lightweight edit, Level 2 standard code work, Level 3 complex work.
|
|
6
|
+
- Maintain `.claude/WORKFLOW.md` for Level 2/3 tasks and for any task the user wants tracked across sessions.
|
|
7
|
+
- Organize tracked work as resume state: `Intent`, mutable `Current todo`, `Prerequisites`, optional `Blocked by`, and one concrete `Resume next`.
|
|
8
|
+
- Before closing work, move it to `Completed` with a short `Close summary`: outcome, validation, and gaps; failed validation means the task stays In Progress or Blocked.
|
|
9
|
+
- Record dependencies and discovered future tasks; complete prerequisites before blocked work, and defer non-blocking discoveries to Backlog/Future.
|
|
10
|
+
- Use TodoWrite for current-session execution; use `.claude/WORKFLOW.md` for milestone history and resume points.
|
|
11
|
+
- Do not create attachments or extra spec files unless Level 3 work genuinely needs them or the user asks.
|
|
12
|
+
|
|
13
|
+
Do not rationalize skipping the ledger:
|
|
14
|
+
|
|
15
|
+
- “This is small” still requires Level classification; Level 2/3 work is tracked.
|
|
16
|
+
- “I will update it later” is unsafe; update at material todo/scope changes, blockers, validation results, and handoff points.
|
|
17
|
+
- TodoWrite is session-local; `.claude/WORKFLOW.md` is the durable recovery state.
|
|
18
|
+
- Keep core fields stable so `.claude/bin/workflow-ledger doctor` can check the ledger.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Example Workflow Ledger
|
|
2
|
+
|
|
3
|
+
## Active
|
|
4
|
+
|
|
5
|
+
### WF-2026-05-16-001 — Add reusable workflow tracking
|
|
6
|
+
Status: In Progress
|
|
7
|
+
Level: 2
|
|
8
|
+
Started: 2026-05-16
|
|
9
|
+
Last updated: 2026-05-16
|
|
10
|
+
Current phase: Validate installation path
|
|
11
|
+
|
|
12
|
+
Intent:
|
|
13
|
+
- Add a reusable Claude Code workflow ledger skill without turning the ledger into a transcript or heavyweight spec.
|
|
14
|
+
|
|
15
|
+
Current todo:
|
|
16
|
+
- [x] Create skill directory.
|
|
17
|
+
- [x] Write SKILL.md.
|
|
18
|
+
- [ ] Validate README install flow.
|
|
19
|
+
- [ ] Close the task if install validation passes.
|
|
20
|
+
|
|
21
|
+
Changes:
|
|
22
|
+
- 2026-05-16 — Use one .claude/WORKFLOW.md overview instead of one file per task.
|
|
23
|
+
- 2026-05-16 — Keep optional attachments only for Level 3 detail that would make the ledger too long.
|
|
24
|
+
|
|
25
|
+
Prerequisites:
|
|
26
|
+
- README install instructions must match the actual setup command.
|
|
27
|
+
|
|
28
|
+
Resume next:
|
|
29
|
+
- Validate the README install flow and close the task if it works.
|
|
30
|
+
|
|
31
|
+
## Backlog / Future
|
|
32
|
+
|
|
33
|
+
- [ ] Add an optional hook recipe — deferred because install validation does not require it.
|
|
34
|
+
- [ ] Add a CLI wrapper — deferred unless the skill-only workflow becomes insufficient.
|
|
35
|
+
|
|
36
|
+
## Completed
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Workflow Ledger
|
|
2
|
+
|
|
3
|
+
Use Workflow Ledger as shared resume state for Codex sessions.
|
|
4
|
+
|
|
5
|
+
- Read `.workflow-ledger/WORKFLOW.md` before resuming tracked work.
|
|
6
|
+
- Track Level 2/3 or cross-session tasks in `.workflow-ledger/WORKFLOW.md`.
|
|
7
|
+
- Keep the ledger short: current work, progress, and one concrete `Resume next` action.
|
|
8
|
+
- Default to one Active task; move uncertain follow-ups to Backlog/Future.
|
|
9
|
+
- Use `Intent`, mutable `Current todo`, `Prerequisites`, optional `Blocked by`, and one concrete `Resume next`.
|
|
10
|
+
- Record a short `Close summary` before closing work: outcome, validation, and gaps.
|
|
11
|
+
- Do not paste full command output, raw tool JSON, detailed diffs, or temporary reasoning into the ledger.
|
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -u
|
|
3
|
+
|
|
4
|
+
ledger=".claude/WORKFLOW.md"
|
|
5
|
+
cli=".claude/bin/workflow-ledger"
|
|
6
|
+
|
|
7
|
+
if [ ! -f "$ledger" ]; then
|
|
8
|
+
exit 0
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then
|
|
12
|
+
cat <<'PLUGIN_JSON'
|
|
13
|
+
{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"Workflow Ledger detected.\n- Read .claude/WORKFLOW.md before resuming tracked work.\n- Check Active tasks, Current phase/current focus, Current todo, and Resume next.\n- Run workflow-ledger doctor if state may be stale."}}
|
|
14
|
+
PLUGIN_JSON
|
|
15
|
+
exit 0
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
printf 'Workflow Ledger detected.\n'
|
|
19
|
+
printf -- '- Read .claude/WORKFLOW.md before resuming tracked work.\n'
|
|
20
|
+
printf -- '- Check Active tasks, Current phase/current focus, Current todo, and Resume next.\n'
|
|
21
|
+
|
|
22
|
+
if [ -x "$cli" ]; then
|
|
23
|
+
printf -- '- Run .claude/bin/workflow-ledger doctor if state may be stale.\n'
|
|
24
|
+
else
|
|
25
|
+
printf -- '- Run workflow-ledger doctor if the project CLI is available.\n'
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
exit 0
|
package/install.sh
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
REPO_URL="https://github.com/MorseWayne/workflow-ledger"
|
|
5
|
+
ARCHIVE_URL="https://github.com/MorseWayne/workflow-ledger/archive/refs/heads/main.tar.gz"
|
|
6
|
+
MARKER="## Workflow Ledger"
|
|
7
|
+
TARGET_DIR="${1:-$PWD}"
|
|
8
|
+
|
|
9
|
+
TARGET_DIR="$(cd "$TARGET_DIR" && pwd)"
|
|
10
|
+
SCRIPT_PATH="${BASH_SOURCE[0]-}"
|
|
11
|
+
SCRIPT_DIR=""
|
|
12
|
+
if [ -n "$SCRIPT_PATH" ] && [ "$SCRIPT_PATH" != "bash" ] && [ "$SCRIPT_PATH" != "-" ]; then
|
|
13
|
+
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
cleanup_dir=""
|
|
17
|
+
cleanup() {
|
|
18
|
+
if [ -n "$cleanup_dir" ] && [ -d "$cleanup_dir" ]; then
|
|
19
|
+
rm -rf "$cleanup_dir"
|
|
20
|
+
fi
|
|
21
|
+
}
|
|
22
|
+
trap cleanup EXIT
|
|
23
|
+
|
|
24
|
+
SOURCE_DIR="$SCRIPT_DIR"
|
|
25
|
+
if [ ! -d "$SOURCE_DIR/skills/workflow-ledger" ] || [ ! -f "$SOURCE_DIR/examples/claude-project/CLAUDE.md.snippet" ] || [ ! -f "$SOURCE_DIR/bin/workflow-ledger" ]; then
|
|
26
|
+
if ! command -v curl >/dev/null 2>&1; then
|
|
27
|
+
echo "error: curl is required when install.sh is run outside a workflow-ledger checkout" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
if ! command -v tar >/dev/null 2>&1; then
|
|
31
|
+
echo "error: tar is required when install.sh is run outside a workflow-ledger checkout" >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
cleanup_dir="$(mktemp -d)"
|
|
36
|
+
curl -fsSL "$ARCHIVE_URL" | tar -xz -C "$cleanup_dir"
|
|
37
|
+
SOURCE_DIR="$cleanup_dir/workflow-ledger-main"
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
if command -v node >/dev/null 2>&1 && [ -f "$SOURCE_DIR/bin/workflow-ledger.js" ]; then
|
|
41
|
+
node "$SOURCE_DIR/bin/workflow-ledger.js" init --tool claude-code --root "$TARGET_DIR"
|
|
42
|
+
else
|
|
43
|
+
mkdir -p "$TARGET_DIR/.claude/skills" "$TARGET_DIR/.claude" "$TARGET_DIR/.claude/bin"
|
|
44
|
+
rm -rf "$TARGET_DIR/.claude/skills/workflow-ledger"
|
|
45
|
+
cp -R "$SOURCE_DIR/skills/workflow-ledger" "$TARGET_DIR/.claude/skills/workflow-ledger"
|
|
46
|
+
cp "$SOURCE_DIR/bin/workflow-ledger" "$TARGET_DIR/.claude/bin/workflow-ledger"
|
|
47
|
+
chmod +x "$TARGET_DIR/.claude/bin/workflow-ledger"
|
|
48
|
+
|
|
49
|
+
if [ ! -f "$TARGET_DIR/.claude/WORKFLOW.md" ]; then
|
|
50
|
+
cp "$SOURCE_DIR/skills/workflow-ledger/templates/WORKFLOW.md" "$TARGET_DIR/.claude/WORKFLOW.md"
|
|
51
|
+
echo "created .claude/WORKFLOW.md"
|
|
52
|
+
else
|
|
53
|
+
echo "kept existing .claude/WORKFLOW.md"
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
if [ ! -f "$TARGET_DIR/CLAUDE.md" ]; then
|
|
57
|
+
touch "$TARGET_DIR/CLAUDE.md"
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
if grep -Fq "$MARKER" "$TARGET_DIR/CLAUDE.md"; then
|
|
61
|
+
echo "kept existing Workflow Ledger section in CLAUDE.md"
|
|
62
|
+
else
|
|
63
|
+
if [ -s "$TARGET_DIR/CLAUDE.md" ]; then
|
|
64
|
+
printf '\n\n' >> "$TARGET_DIR/CLAUDE.md"
|
|
65
|
+
fi
|
|
66
|
+
cat "$SOURCE_DIR/examples/claude-project/CLAUDE.md.snippet" >> "$TARGET_DIR/CLAUDE.md"
|
|
67
|
+
echo "updated CLAUDE.md"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
echo "installed workflow-ledger for Claude Code"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
echo "installed workflow-ledger into $TARGET_DIR"
|
|
74
|
+
echo "next: run /workflow-ledger start \"your task\" in Claude Code"
|
|
75
|
+
echo "optional: run .claude/bin/workflow-ledger doctor"
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workflow-ledger",
|
|
3
|
+
"version": "0.3.5",
|
|
4
|
+
"description": "Lightweight, recoverable workflow ledger for AI coding agents.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/MorseWayne/workflow-ledger.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/MorseWayne/workflow-ledger/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/MorseWayne/workflow-ledger#readme",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"claude-code",
|
|
16
|
+
"workflow",
|
|
17
|
+
"ledger",
|
|
18
|
+
"ai-coding",
|
|
19
|
+
"skills"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"workflow-ledger": "bin/workflow-ledger.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/",
|
|
26
|
+
"skills/",
|
|
27
|
+
"examples/",
|
|
28
|
+
"templates/",
|
|
29
|
+
"docs/*.md",
|
|
30
|
+
"hooks/",
|
|
31
|
+
".claude-plugin/",
|
|
32
|
+
"install.sh",
|
|
33
|
+
"README.md",
|
|
34
|
+
"README.zh-CN.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"test": "tests/run-cli-tests.sh && node tests/run-node-cli-tests.cjs && bash tests/claude-code/run-skill-behavior-test.sh"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18"
|
|
42
|
+
}
|
|
43
|
+
}
|