work-rhythm 0.2.15 → 0.2.20
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/collectors/local.env.example +1 -1
- package/docs/formats.md +11 -11
- package/docs/scheduled-tasks.md +1 -0
- package/package.json +1 -1
- package/scripts/cmd/events.js +6 -6
- package/scripts/cmd/listen.js +1 -1
- package/scripts/cmd/rhythm.js +1 -1
- package/scripts/lib/agent.js +3 -3
- package/scripts/lib/bot.js +1 -1
- package/scripts/lib/engine.js +25 -20
- package/scripts/lib/handoff.js +1 -1
- package/scripts/lib/rhythm.js +4 -4
- package/scripts/lib/router.js +5 -4
- package/scripts/lib/view.js +2 -1
- package/scripts/test/check.test.js +1 -1
- package/scripts/test/events.test.js +19 -9
- package/scripts/test/listen.test.js +1 -1
- package/scripts/test/rhythm.test.js +2 -2
- package/scripts/test/router.test.js +6 -6
- package/tasks/daily-persona.md +23 -0
- package/templates/00-config/profile.example.yaml +1 -0
- package/templates/04-patterns/PERSONA.md +13 -0
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
# 会话:绑的正好是正在调 skill 的那个 agent 时,work-rhythm agent bind 会把它当前这个会话绑上(YZJ_BOT_SESSION),
|
|
67
67
|
# 机器人在 IM 里说的话从这个会话接着走。换绑 work-rhythm agent session <id>(agent sessions 列出 dsh 在这个工作区的会话),--clear 清掉
|
|
68
68
|
# YZJ_BOT_SESSION=""
|
|
69
|
-
# 值守跑在本地服务(work-rhythm rhythm
|
|
69
|
+
# 值守跑在本地服务(work-rhythm rhythm)那一个进程里,默认开启;写 YZJ_BOT_LISTEN="0" 或 work-rhythm listen uninstall 关掉
|
|
70
70
|
# YZJ_BOT_LISTEN="1"
|
|
71
71
|
# 配完跑 work-rhythm agent test 让它答一句;开值守后 work-rhythm listen status 看它在不在听
|
|
72
72
|
# YZJ_BOT_AGENT="dsh"
|
package/docs/formats.md
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
## 事件流
|
|
21
21
|
|
|
22
|
-
| 时间 | 类型 | 事项 | 来源 | 项目 |
|
|
23
|
-
|
|
22
|
+
| 时间 | 类型 | 事项 | 来源 | 项目 | 索引 |
|
|
23
|
+
|------|------|------|------|------|------|
|
|
24
24
|
|
|
25
25
|
## 备注
|
|
26
26
|
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
|
|
64
64
|
## 事件流
|
|
65
65
|
|
|
66
|
-
| 时间 | 类型 | 事项 | 来源 | 项目 |
|
|
67
|
-
|
|
68
|
-
| 09:05 | 沟通 | 在「导出项目群」同步接口联调进度 | im-yzj | 导出 |
|
|
69
|
-
| 09:20 | 文档 | 写导出接口文档,改了 3 个文件 | file-activity | 导出 |
|
|
70
|
-
| 10:00 | 会议 | 需求评审(150min,超时 90min) | calendar-yzj | |
|
|
71
|
-
| 13:45 | 沟通 | 在「导出项目群」发周会进展材料 | 口述 | 导出 |
|
|
72
|
-
| 14:00 | 会议 | 导出项目周会(30min,组织者) | calendar-yzj | 导出 |
|
|
73
|
-
| 14:40 | 编码 | 在 report-service 提交 3 次:导出接口联调修复 | git-activity | 导出 |
|
|
74
|
-
| 16:20 | 沟通 | 把试点数据发给平台负责人 | 口述 | work-rhythm-rollout |
|
|
66
|
+
| 时间 | 类型 | 事项 | 来源 | 项目 | 索引 |
|
|
67
|
+
|------|------|------|------|------|------|
|
|
68
|
+
| 09:05 | 沟通 | 在「导出项目群」同步接口联调进度 | im-yzj | 导出 | 01-inbox/im-yzj/2026-11-30/messages-export.json |
|
|
69
|
+
| 09:20 | 文档 | 写导出接口文档,改了 3 个文件 | file-activity | 导出 | docs/export-api.md |
|
|
70
|
+
| 10:00 | 会议 | 需求评审(150min,超时 90min) | calendar-yzj | | 01-inbox/calendar-yzj/2026-11-30/events.json |
|
|
71
|
+
| 13:45 | 沟通 | 在「导出项目群」发周会进展材料 | 口述 | 导出 | |
|
|
72
|
+
| 14:00 | 会议 | 导出项目周会(30min,组织者) | calendar-yzj | 导出 | 01-inbox/calendar-yzj/2026-11-30/events.json |
|
|
73
|
+
| 14:40 | 编码 | 在 report-service 提交 3 次:导出接口联调修复 | git-activity | 导出 | ws=report-service main@a1b2c3d |
|
|
74
|
+
| 16:20 | 沟通 | 把试点数据发给平台负责人 | 口述 | work-rhythm-rollout | |
|
|
75
75
|
|
|
76
76
|
## 备注
|
|
77
77
|
|
package/docs/scheduled-tasks.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
| `daily-plan` | 每日工作计划 | 工作日上班前 10 分钟 | [tasks/daily-plan.md](../tasks/daily-plan.md) | 今日的「计划」 |
|
|
14
14
|
| `noon-checkin` | 中午工作进展 | 工作日午休开始 | [tasks/noon-checkin.md](../tasks/noon-checkin.md) | 今日的「进展」「事件流」「备注」 |
|
|
15
15
|
| `evening-review` | 晚间工作复盘 | 工作日下班前 15 分钟 | [tasks/evening-review.md](../tasks/evening-review.md) | 今日的「复盘」「事件流」,各长期目标的「进展记录」,以及遗留清单 |
|
|
16
|
+
| `daily-persona` | 每日归档与个人分身 | 工作日下班后 | [tasks/daily-persona.md](../tasks/daily-persona.md) | 归档已完结决定与遗留,增量更新 `04-patterns/PERSONA.md` 与工作习惯 |
|
|
16
17
|
| `weekly-rhythm` | 每周工作规律 | 周五 | [tasks/weekly-rhythm.md](../tasks/weekly-rhythm.md) | [04-patterns/WORK_RHYTHM.md](../04-patterns/WORK_RHYTHM.md) |
|
|
17
18
|
| `alerts-morning` | 告警跟进晨报(本目录自定义) | 工作日早上 | [tasks/alerts-morning.md](../tasks/alerts-morning.md) | `01-inbox/reports/` 下的 Markdown 和 HTML,今日的「备注」 |
|
|
18
19
|
| `linky-cost-fill` | 录下周的耗费(本目录自定义) | 周一 | [tasks/linky-cost-fill.md](../tasks/linky-cost-fill.md) | Linky 里下周的耗费格子,今日的「备注」 |
|
package/package.json
CHANGED
package/scripts/cmd/events.js
CHANGED
|
@@ -16,12 +16,12 @@ const USAGE = `work-rhythm events [选项] —— 列出每日文件「## 事件
|
|
|
16
16
|
work-rhythm events --source calendar-yzj 只看这些来源(订阅源的 id,或「口述」)
|
|
17
17
|
work-rhythm events --project 导出 只看这些项目标签(和长期目标相关的事件,项目列是目标 id)
|
|
18
18
|
work-rhythm events --json 每条一个对象,给程序读
|
|
19
|
-
输出是 TSV(制表符分隔),第一行表头 date、time、type、item、source、project,按日期、时间排好序。
|
|
20
|
-
|
|
19
|
+
输出是 TSV(制表符分隔),第一行表头 date、time、type、item、source、project、ref,按日期、时间排好序。
|
|
20
|
+
事件是「一行一事」的记录,不含细节;ref(索引列)指向原始工作现场(如 01-inbox 快照路径、工作区/提交、工作项号、文档路径),方便 agent 一跳回到现场。
|
|
21
21
|
退出码: 0(没有事件也是 0,只有表头);2 选项或日期不对;3 不在工作目录里。`;
|
|
22
22
|
|
|
23
|
-
const FIELDS = ['date', 'time', 'type', 'item', 'source', 'project'];
|
|
24
|
-
const COLUMNS = { 时间: 'time', 类型: 'type', 事项: 'item', 来源: 'source', 项目: 'project' };
|
|
23
|
+
const FIELDS = ['date', 'time', 'type', 'item', 'source', 'project', 'ref'];
|
|
24
|
+
const COLUMNS = { 时间: 'time', 类型: 'type', 事项: 'item', 来源: 'source', 项目: 'project', 索引: 'ref' };
|
|
25
25
|
|
|
26
26
|
// 「## 事件流」那一节里的表:表头给出列名,分隔线跳过。格子里转义的竖线先换成占位符再切。后面几格缺的留空
|
|
27
27
|
function parseEvents(markdown, date) {
|
|
@@ -41,7 +41,7 @@ function parseEvents(markdown, date) {
|
|
|
41
41
|
}
|
|
42
42
|
// 至少要有时间和类型两格;只有一格的(写坏的行、夹在表里的说明)不算事件
|
|
43
43
|
if (cells.length < 2) continue;
|
|
44
|
-
const event = { date, time: '', type: '', item: '', source: '', project: '' };
|
|
44
|
+
const event = { date, time: '', type: '', item: '', source: '', project: '', ref: '' };
|
|
45
45
|
columns.forEach((field, n) => {
|
|
46
46
|
if (field) event[field] = cells[n] || '';
|
|
47
47
|
});
|
|
@@ -96,7 +96,7 @@ async function run(args, ctx) {
|
|
|
96
96
|
return EXIT.OK;
|
|
97
97
|
}
|
|
98
98
|
stdout.write(`${FIELDS.join('\t')}\n`);
|
|
99
|
-
for (const e of list) stdout.write(`${[e.date, e.time, e.type, e.item.replace(/\t/g, ' '), e.source, e.project].join('\t')}\n`);
|
|
99
|
+
for (const e of list) stdout.write(`${[e.date, e.time, e.type, e.item.replace(/\t/g, ' '), e.source, e.project, (e.ref || '').replace(/\t/g, ' ')].join('\t')}\n`);
|
|
100
100
|
return EXIT.OK;
|
|
101
101
|
}
|
|
102
102
|
|
package/scripts/cmd/listen.js
CHANGED
|
@@ -51,7 +51,7 @@ module.exports = {
|
|
|
51
51
|
return lines[lines.length - 1] || '';
|
|
52
52
|
};
|
|
53
53
|
// 值守开着没(跑在服务里的那个开关);改了之后让服务重新读:launchd 管的重启,手动起的提示一下
|
|
54
|
-
const listenWanted = () => (settingsEnv.YZJ_BOT_LISTEN || '').trim()
|
|
54
|
+
const listenWanted = () => (settingsEnv.YZJ_BOT_LISTEN || '').trim() !== '0';
|
|
55
55
|
const applyToService = () => {
|
|
56
56
|
if (!service.serviceAlive()) return '';
|
|
57
57
|
return launchd.kickstart('service', root) ? '本地服务已重启,值守的改动生效。' : '本地服务在跑但不是 launchd 管的(在终端里起的):停了再 start 才生效。';
|
package/scripts/cmd/rhythm.js
CHANGED
|
@@ -108,7 +108,7 @@ module.exports = {
|
|
|
108
108
|
launchd.uninstall('bot', root);
|
|
109
109
|
// 装完看一眼真的起来了:launchd 拉起失败时 bootstrap 也是成功的
|
|
110
110
|
const problem = launchd.startupProblem('service', root, `${root}/01-inbox/_rhythm.launchd.log`);
|
|
111
|
-
stdout.write(`已装成常驻:${plist}\n页面:${service.baseUrl()} 日志:${root}/01-inbox/_rhythm.log\n
|
|
111
|
+
stdout.write(`已装成常驻:${plist}\n页面:${service.baseUrl()} 日志:${root}/01-inbox/_rhythm.log\n值守默认跟着服务一起跑(collectors/local.env 写 YZJ_BOT_LISTEN=0 或 work-rhythm listen uninstall 关掉)。\n`);
|
|
112
112
|
if (problem) throw new Fail(EXIT.FAILED, problem);
|
|
113
113
|
return EXIT.OK;
|
|
114
114
|
}
|
package/scripts/lib/agent.js
CHANGED
|
@@ -656,7 +656,7 @@ function createAgent({ root, agent, mode = 'plan', timeoutS = 300, idleS = 0, pr
|
|
|
656
656
|
let r;
|
|
657
657
|
try {
|
|
658
658
|
r = spawnSync(command, args, {
|
|
659
|
-
cwd: root, env: extraEnv, encoding: 'utf8', timeout: timeoutS * 1000, killSignal: 'SIGTERM', maxBuffer: 64 * 1024 * 1024,
|
|
659
|
+
cwd: root, env: extraEnv, encoding: 'utf8', ...(timeoutS > 0 ? { timeout: timeoutS * 1000 } : {}), killSignal: 'SIGTERM', maxBuffer: 64 * 1024 * 1024,
|
|
660
660
|
});
|
|
661
661
|
} catch (error) {
|
|
662
662
|
return { failed: `起不来 ${path.basename(command)}:${error.message}` };
|
|
@@ -829,7 +829,7 @@ function createAgent({ root, agent, mode = 'plan', timeoutS = 300, idleS = 0, pr
|
|
|
829
829
|
const finish = (r) => {
|
|
830
830
|
if (settled) return;
|
|
831
831
|
settled = r;
|
|
832
|
-
clearTimeout(maxTimer);
|
|
832
|
+
if (maxTimer) clearTimeout(maxTimer);
|
|
833
833
|
if (idleTimer) clearTimeout(idleTimer);
|
|
834
834
|
wake(r);
|
|
835
835
|
};
|
|
@@ -844,7 +844,7 @@ function createAgent({ root, agent, mode = 'plan', timeoutS = 300, idleS = 0, pr
|
|
|
844
844
|
if (idleTimer) clearTimeout(idleTimer);
|
|
845
845
|
idleTimer = setTimeout(() => giveUp(`超过 ${idleS} 秒没有任何输出`, 'idle'), idleS * 1000);
|
|
846
846
|
};
|
|
847
|
-
const maxTimer = setTimeout(() => giveUp(`超过 ${maxS} 秒没做完`, 'max'), maxS * 1000);
|
|
847
|
+
const maxTimer = maxS > 0 ? setTimeout(() => giveUp(`超过 ${maxS} 秒没做完`, 'max'), maxS * 1000) : null;
|
|
848
848
|
bump();
|
|
849
849
|
child.stdout.on('data', (chunk) => {
|
|
850
850
|
if (settled) return;
|
package/scripts/lib/bot.js
CHANGED
|
@@ -21,7 +21,7 @@ const RECONNECT_DELAYS_MS = [1000, 2000, 5000, 10000, 30000, 60000];
|
|
|
21
21
|
const ACK_TEXT = '收到,正在处理,稍等。';
|
|
22
22
|
// 上一句还没答完又来一句:先回这句,告诉他会和上一句一起考虑
|
|
23
23
|
const ACK_MORE_TEXT = '收到,上一句还在答,这句会和它一起考虑。';
|
|
24
|
-
const DEFAULT_PREAMBLE = '
|
|
24
|
+
const DEFAULT_PREAMBLE = '(这句来自云之家:你的回复会原样以纯文本私聊发给人类看。务必简洁明了、直说结论,去掉背景铺垫和内部过程,不用表格,以一眼看懂为准;要查很久就先说大概要多久。)';
|
|
25
25
|
|
|
26
26
|
const positiveInt = (value, fallback) => {
|
|
27
27
|
const n = Number(value);
|
package/scripts/lib/engine.js
CHANGED
|
@@ -133,7 +133,7 @@ function refineBody(file) {
|
|
|
133
133
|
'',
|
|
134
134
|
'1. 读 00-config/sources.yaml:每个启用的源有「提炼成什么事件」的规则(extract)。',
|
|
135
135
|
'2. 读 01-inbox/<源id>/<今天>/ 下各源的输出(刚同步过;哪个源没有目录就跳过)。',
|
|
136
|
-
'3. 按各源的规则提炼事件,对照 docs/formats.md
|
|
136
|
+
'3. 按各源的规则提炼事件,对照 docs/formats.md 的「事件流」:类型用词表里的词,一行一事、不记内容细节;项目能归就归;「索引」列填能回到工作现场的指针(如 01-inbox/<源id>/<今天>/具体文件名、ws=<工作区id> <分支>@<短hash>、工作项编号、文件路径或交接回执路径),没有就留空。',
|
|
137
137
|
`4. 合并进今天每日文件(${file})的「## 事件流」:替换同来源同时段的旧事件,保留来源是「口述」的行,按时间排序;文件不存在就按格式创建。只改这一节。`,
|
|
138
138
|
'5. 回执里写:各源分别提炼出几条、合并后事件流一共几条;哪个源的数据读不到就写「未取到」,不要编。',
|
|
139
139
|
'',
|
|
@@ -216,38 +216,43 @@ function createEngine({ root, env, cfg, log = () => {}, push = async () => false
|
|
|
216
216
|
let pumpScheduled = false; // 这个 tick 里已经排了一轮
|
|
217
217
|
let msgBuf = null;
|
|
218
218
|
let msgTimer = null;
|
|
219
|
-
const activeProgress = new Map(); // id → { t, started
|
|
219
|
+
const activeProgress = new Map(); // id → { t, started }
|
|
220
220
|
let progressTimer = null;
|
|
221
|
+
let progressStepMs = 0;
|
|
222
|
+
const MAX_PROGRESS_STEP_MS = 30 * 60 * 1000; // 指数退避封顶 30 分钟
|
|
221
223
|
function stopProgressTimer() {
|
|
222
|
-
if (progressTimer) {
|
|
224
|
+
if (progressTimer) { clearTimeout(progressTimer); progressTimer = null; }
|
|
225
|
+
progressStepMs = 0;
|
|
223
226
|
}
|
|
224
|
-
function
|
|
225
|
-
if (
|
|
226
|
-
const
|
|
227
|
-
progressTimer =
|
|
227
|
+
function scheduleNextProgress() {
|
|
228
|
+
if (closing || !activeProgress.size || !cfg.progress || cfg.progress <= 0) { stopProgressTimer(); return; }
|
|
229
|
+
const delay = progressStepMs || Math.max(200, cfg.progress * 1000);
|
|
230
|
+
progressTimer = setTimeout(() => {
|
|
231
|
+
progressTimer = null;
|
|
228
232
|
if (closing || !activeProgress.size) { stopProgressTimer(); return; }
|
|
229
233
|
const now = Date.now();
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (now - item.started < stepMs * 0.8) continue;
|
|
234
|
-
due.push(item);
|
|
235
|
-
}
|
|
236
|
-
if (!due.length) return;
|
|
237
|
-
for (const item of due) item.count += 1;
|
|
238
|
-
if (due.length === 1) {
|
|
239
|
-
const { t, started } = due[0];
|
|
234
|
+
const all = [...activeProgress.values()];
|
|
235
|
+
if (all.length === 1) {
|
|
236
|
+
const { t, started } = all[0];
|
|
240
237
|
send(t, `还在做(已经 ${humanDuration((now - started) / 1000)} · 工作区 ${t.ws || '工作目录'}):${t.title || t.id}。做完汇报。`, { mark: false });
|
|
241
238
|
} else {
|
|
242
|
-
const lines = ['手头有 ' +
|
|
243
|
-
|
|
239
|
+
const lines = ['手头有 ' + all.length + ' 件事还在做(做完汇报):'];
|
|
240
|
+
all.forEach(({ t, started }, i) => {
|
|
244
241
|
lines.push(`${i + 1}. [工作区 ${t.ws || '工作目录'}] ${t.title || t.id}(已 ${humanDuration((now - started) / 1000)})`);
|
|
245
242
|
});
|
|
246
243
|
send(null, lines.join('\n'), { mark: false });
|
|
247
244
|
}
|
|
248
|
-
|
|
245
|
+
// 指数退避:前期密(90s → 3m → 6m → 12m → 24m),后期慢(封顶 30m),超长任务不再刷屏也不截断
|
|
246
|
+
progressStepMs = Math.min(delay * 2, MAX_PROGRESS_STEP_MS);
|
|
247
|
+
scheduleNextProgress();
|
|
248
|
+
}, delay);
|
|
249
249
|
if (progressTimer.unref) progressTimer.unref();
|
|
250
250
|
}
|
|
251
|
+
function ensureProgressTimer() {
|
|
252
|
+
if (progressTimer || !cfg.progress || cfg.progress <= 0) return;
|
|
253
|
+
progressStepMs = Math.max(200, cfg.progress * 1000);
|
|
254
|
+
scheduleNextProgress();
|
|
255
|
+
}
|
|
251
256
|
function flushMessages() {
|
|
252
257
|
if (msgTimer) { clearTimeout(msgTimer); msgTimer = null; }
|
|
253
258
|
if (!msgBuf) return null;
|
package/scripts/lib/handoff.js
CHANGED
|
@@ -70,7 +70,7 @@ function taskText(t, body, extra = {}) {
|
|
|
70
70
|
`# 任务书 ${t.id}`,
|
|
71
71
|
'',
|
|
72
72
|
`- 来源:${source}`,
|
|
73
|
-
`- 派给:执行者 · 权限 ${extra.mode || 'plan'} ·
|
|
73
|
+
`- 派给:执行者 · 权限 ${extra.mode || 'plan'} · ${extra.timeoutS > 0 ? `最多 ${extra.timeoutS} 秒` : '不限时'}`,
|
|
74
74
|
`- ${t.kind === 'report' ? '重做自' : '续做自'}:${t.kind === 'report' ? t.of || '' : extra.continueOf || '无'}`,
|
|
75
75
|
'',
|
|
76
76
|
'## 要求',
|
package/scripts/lib/rhythm.js
CHANGED
|
@@ -75,7 +75,7 @@ function loadConfig(root) {
|
|
|
75
75
|
// 定时任务用的模型和思考强度(可选项,profile 里不写也行):不配就和值守一样,用 local.env 的 YZJ_BOT_MODEL / YZJ_BOT_EFFORT
|
|
76
76
|
agentModel: typeof rhythm['agent-model'] === 'string' ? rhythm['agent-model'].trim() : '',
|
|
77
77
|
agentEffort: typeof rhythm['agent-effort'] === 'string' ? rhythm['agent-effort'].trim() : '',
|
|
78
|
-
taskTimeout:
|
|
78
|
+
taskTimeout: seconds(rhythm['task-timeout'], 0),
|
|
79
79
|
syncTimeout: positiveInt(rhythm['sync-timeout'], 600),
|
|
80
80
|
notifyChannel: typeof preferences.notify === 'string' ? preferences.notify.trim() : '',
|
|
81
81
|
schedule,
|
|
@@ -798,7 +798,7 @@ ${sourcesCard(d)}
|
|
|
798
798
|
<span class="pill">workers: ${d.config.workers}</span>
|
|
799
799
|
<span class="pill">refine: ${d.config.refine}</span>
|
|
800
800
|
<span class="pill">refine-interval: ${d.config.refineInterval}m</span>
|
|
801
|
-
<span class="pill">task-timeout: ${d.config.taskTimeout}s</span>
|
|
801
|
+
<span class="pill">task-timeout: ${d.config.taskTimeout ? `${d.config.taskTimeout}s` : '不限'}</span>
|
|
802
802
|
<span class="pill">agent-mode: ${esc(d.config.agentMode)}</span>
|
|
803
803
|
<span class="pill">handoff-keep: ${d.config.handoffKeep}d</span>
|
|
804
804
|
<span class="pill">history-keep: ${d.config.historyKeep}d</span>
|
|
@@ -897,7 +897,7 @@ ${sourcesCard(d)}
|
|
|
897
897
|
log('服务开始', `pid=${process.pid} 页面=${baseUrl()} agent=${env.YZJ_BOT_AGENT || '(没配)'}`);
|
|
898
898
|
process.stdout.write(`页面:${baseUrl()} 停:work-rhythm rhythm stop\n`);
|
|
899
899
|
|
|
900
|
-
//
|
|
900
|
+
// 值守(机器人的收消息一半)也在这里跑:一个后台进程管定时任务、推送、网页和值守。默认开着(collectors/local.env 写 YZJ_BOT_LISTEN=0 才关);
|
|
901
901
|
// 配置有问题不拦着服务起,只记一笔——定时任务和网页照常
|
|
902
902
|
let bot = null;
|
|
903
903
|
let botTask = null;
|
|
@@ -1047,7 +1047,7 @@ ${sourcesCard(d)}
|
|
|
1047
1047
|
|
|
1048
1048
|
// 值守要不要跟着服务一起开
|
|
1049
1049
|
function botWanted() {
|
|
1050
|
-
return (env.YZJ_BOT_LISTEN || '').trim()
|
|
1050
|
+
return (env.YZJ_BOT_LISTEN || '').trim() !== '0';
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
1053
|
function statusText() {
|
package/scripts/lib/router.js
CHANGED
|
@@ -44,17 +44,18 @@ const PROMPT = `${handoff.MARKER}下面是到达的触发,前面是「手头
|
|
|
44
44
|
任务书正文……
|
|
45
45
|
|
|
46
46
|
## reply <短号>
|
|
47
|
-
|
|
47
|
+
给人类在 IM 里看的回复:简洁明了,直说结论,不铺垫、不啰嗦……
|
|
48
48
|
|
|
49
49
|
## notify <短号>
|
|
50
|
-
|
|
50
|
+
给人类在 IM 里看的话:纯文本、不用表格、不放链接。务必简洁明了、说清结论——先给结论和要做的事,去掉背景铺垫、内部过程和重复解释;一条一件事,以一眼看懂为准,要用户拍板的事简短列在最后……
|
|
51
51
|
|
|
52
52
|
五、硬规则
|
|
53
53
|
1. 每条触发都要有、且只有一个决定,写在最前面的「决定:」下面。
|
|
54
54
|
2. 决定行写成「- <短号> <决定>」;小节标题严格是「## <决定> <短号>」。
|
|
55
55
|
3. 任务书正文里不要出现「## reply / ignore / handoff / notify <短号>」这样的标题。
|
|
56
56
|
4. continue / interrupt / stop 后面的短号,必须是「手头的事」里列出来的。
|
|
57
|
-
5. 标了「不推送」的汇报不能 notify
|
|
57
|
+
5. 标了「不推送」的汇报不能 notify。
|
|
58
|
+
6. reply 和 notify 是直接发给人类看的,必须简洁明了、说得清晰:能三行说清不写十行,不汇报内部机制(如任务书、超时细节、重试次数),除非影响结论。`;
|
|
58
59
|
|
|
59
60
|
const short = (stamp) => String(stamp || '').slice(5, 16);
|
|
60
61
|
const readText = (file) => {
|
|
@@ -74,7 +75,7 @@ function triggerLine(t) {
|
|
|
74
75
|
if (t.kind === 'events') {
|
|
75
76
|
const health = (t.sources || []).map((x) => `${x.id} ${x.ok ? '成功' : `失败:${x.detail || `退出码 ${x.code}`}`}`).join('、');
|
|
76
77
|
const head = `[${t.id}] 来源=events 时间=${when} ${t.ok ? `新事件 ${(t.events || []).length} 条` : `提炼没成:${t.reason}`};这次采集:${health || '(没跑)'}`;
|
|
77
|
-
const list = (t.events || []).slice(0, 40).map((e) => ` - ${e.time} ${e.type} ${e.item}(${[e.source, e.project].filter(Boolean).join(',')})`);
|
|
78
|
+
const list = (t.events || []).slice(0, 40).map((e) => ` - ${e.time} ${e.type} ${e.item}(${[e.source, e.project, e.ref].filter(Boolean).join(',')})`);
|
|
78
79
|
return [head, ...list].join('\n');
|
|
79
80
|
}
|
|
80
81
|
if (t.kind === 'answer') {
|
package/scripts/lib/view.js
CHANGED
|
@@ -303,11 +303,12 @@ function renderEventsSection(section) {
|
|
|
303
303
|
? `<div class="filter-bar" role="group" aria-label="按类型筛选"><button type="button" class="filter-pill is-active" data-filter="all">全部 ${parsed.rows.length}</button>${typeEntries.map(([k, v]) => `<button type="button" class="filter-pill" data-filter="${esc(k)}">${esc(k)} ${v}</button>`).join('')}</div>`
|
|
304
304
|
: '';
|
|
305
305
|
const rowsHtml = parsed.rows.map((r) => {
|
|
306
|
-
const [time = '', type = '', desc = '', source = '', project = ''] = r;
|
|
306
|
+
const [time = '', type = '', desc = '', source = '', project = '', ref = ''] = r;
|
|
307
307
|
const cls = eventTypeClass(type, desc);
|
|
308
308
|
const meta = [
|
|
309
309
|
project ? `<span class="meta-tag is-proj">${esc(project)}</span>` : '',
|
|
310
310
|
source ? `<span class="meta-tag">${esc(source)}</span>` : '',
|
|
311
|
+
ref ? `<span class="meta-tag" title="工作现场索引">${esc(ref)}</span>` : '',
|
|
311
312
|
].filter(Boolean).join('');
|
|
312
313
|
return `<div class="tl-row" data-type="${esc(type || '其他')}"><span class="tl-time">${esc(time)}</span><span class="tl-type${cls ? ` ${cls}` : ''}">${esc(type)}</span><div class="tl-desc">${md.inline(desc, MD_OPTS)}</div><div class="tl-meta">${meta}</div></div>`;
|
|
313
314
|
}).join('\n');
|
|
@@ -193,7 +193,7 @@ test('check:只绑了 agent 跑定时任务、没装值守,不报值守的
|
|
|
193
193
|
s.localEnv('# YZJ_BOT_AGENT="dsh"\n');
|
|
194
194
|
const r2 = s.check({ ...s.stubs });
|
|
195
195
|
assert.equal(r2.code, 1, r2.out);
|
|
196
|
-
assert.match(r2.stdout, /schedule 里有任务(daily-plan、noon-checkin、evening-review、carryover、weekly-rhythm)却没绑 agent,到点一个也跑不了:work-rhythm agent bind <zcode\|dsh\|qoder\|claude\|kimi>/);
|
|
196
|
+
assert.match(r2.stdout, /schedule 里有任务(daily-plan、noon-checkin、evening-review、carryover、daily-persona、weekly-rhythm)却没绑 agent,到点一个也跑不了:work-rhythm agent bind <zcode\|dsh\|qoder\|claude\|kimi>/);
|
|
197
197
|
});
|
|
198
198
|
|
|
199
199
|
test('check:值守装了之后,配的命令找不到时报出来', (t) => {
|
|
@@ -25,11 +25,11 @@ test('events:把 7 天内的每日文件里的事件流按日期、时间列
|
|
|
25
25
|
const r = box.run(['events']);
|
|
26
26
|
assert.equal(r.code, 0, r.out);
|
|
27
27
|
assert.equal(r.stdout, [
|
|
28
|
-
`date${T}time${T}type${T}item${T}source${T}project`,
|
|
29
|
-
`${DAY(-6)}${T}10:00${T}文档${T}写接口文档${T}file-activity${T}
|
|
30
|
-
`${DAY(-1)}${T}14:00${T}会议${T}周会(30min)${T}calendar-yzj${T}`,
|
|
31
|
-
`${DAY(0)}${T}08:30${T}编码${T}提交 3 次${T}git-activity${T}
|
|
32
|
-
`${DAY(0)}${T}09:05${T}沟通${T}同步接口联调进度${T}im-yzj${T}
|
|
28
|
+
`date${T}time${T}type${T}item${T}source${T}project${T}ref`,
|
|
29
|
+
`${DAY(-6)}${T}10:00${T}文档${T}写接口文档${T}file-activity${T}导出${T}`,
|
|
30
|
+
`${DAY(-1)}${T}14:00${T}会议${T}周会(30min)${T}calendar-yzj${T}${T}`,
|
|
31
|
+
`${DAY(0)}${T}08:30${T}编码${T}提交 3 次${T}git-activity${T}导出${T}`,
|
|
32
|
+
`${DAY(0)}${T}09:05${T}沟通${T}同步接口联调进度${T}im-yzj${T}导出${T}`,
|
|
33
33
|
'',
|
|
34
34
|
].join('\n'));
|
|
35
35
|
});
|
|
@@ -60,20 +60,30 @@ test('events:按类型、来源、项目筛,可以逗号分隔写多个;--
|
|
|
60
60
|
assert.deepEqual(items(['--project', 'demo-goal']), ['发材料']);
|
|
61
61
|
assert.deepEqual(items(['--project', '导出,demo-goal']), ['同步进度', '发材料']);
|
|
62
62
|
const json = JSON.parse(box.run(['events', '--today', '--json']).stdout);
|
|
63
|
-
assert.deepEqual(json[2], { date: DAY(0), time: '13:45', type: '沟通', item: '发材料', source: '口述', project: 'demo-goal' });
|
|
63
|
+
assert.deepEqual(json[2], { date: DAY(0), time: '13:45', type: '沟通', item: '发材料', source: '口述', project: 'demo-goal', ref: '' });
|
|
64
64
|
assert.equal(json.length, 3);
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
+
test('events:支持第 6 列「索引」(ref)指向工作现场,老的 5 列表格向后兼容', (t) => {
|
|
68
|
+
const box = makeSandbox(t);
|
|
69
|
+
const dir = box.workdir();
|
|
70
|
+
const date = DAY(0);
|
|
71
|
+
write(path.join(dir, '02-daily', date.slice(0, 7), `${date}.md`), `# ${date}\n\n## 事件流\n\n| 时间 | 类型 | 事项 | 来源 | 项目 | 索引 |\n|------|------|------|------|------|------|\n| 09:30 | 编码 | 修导出边界 | git-activity | 导出 | ws=report-service main@a1b2c3d |\n| 10:00 | 沟通 | 群里对齐 | im-yzj | 导出 | 01-inbox/im-yzj/${date}/messages-g1.json |\n`);
|
|
72
|
+
const json = JSON.parse(box.run(['events', '--today', '--json']).stdout);
|
|
73
|
+
assert.equal(json[0].ref, 'ws=report-service main@a1b2c3d');
|
|
74
|
+
assert.equal(json[1].ref, `01-inbox/im-yzj/${date}/messages-g1.json`);
|
|
75
|
+
});
|
|
76
|
+
|
|
67
77
|
test('events:没有文件、没有事件流、空表都只有表头;看不懂的行跳过;格子里转义的竖线算一个格子', (t) => {
|
|
68
78
|
const box = makeSandbox(t);
|
|
69
79
|
const dir = box.workdir();
|
|
70
|
-
assert.equal(box.run(['events']).stdout, `date${T}time${T}type${T}item${T}source${T}project\n`);
|
|
80
|
+
assert.equal(box.run(['events']).stdout, `date${T}time${T}type${T}item${T}source${T}project${T}ref\n`);
|
|
71
81
|
const date = DAY(0);
|
|
72
82
|
write(path.join(dir, '02-daily', date.slice(0, 7), `${date}.md`), `# ${date}\n\n## 事件流\n\n| 时间 | 类型 | 事项 | 来源 | 项目 |\n|------|------|------|------|------|\n这行不是表格\n| 10:00 | 文档 | 带 \\| 竖线的事项 | file-activity | |\n| 没有时间的行 |\n\n## 备注\n`);
|
|
73
|
-
assert.equal(box.run(['events', '--today']).stdout, `date${T}time${T}type${T}item${T}source${T}project\n${date}${T}10:00${T}文档${T}带 | 竖线的事项${T}file-activity${T}\n`);
|
|
83
|
+
assert.equal(box.run(['events', '--today']).stdout, `date${T}time${T}type${T}item${T}source${T}project${T}ref\n${date}${T}10:00${T}文档${T}带 | 竖线的事项${T}file-activity${T}${T}\n`);
|
|
74
84
|
// 事项里混进制表符时换成空格,表不会串列
|
|
75
85
|
write(path.join(dir, '02-daily', date.slice(0, 7), `${date}.md`), `# ${date}\n\n## 事件流\n\n| 时间 | 类型 | 事项 | 来源 | 项目 |\n|---|---|---|---|---|\n| 11:00 | 其他 | a\tb | x | |\n`);
|
|
76
|
-
assert.equal(box.run(['events', '--today']).stdout.split('\n')[1].split(T).length,
|
|
86
|
+
assert.equal(box.run(['events', '--today']).stdout.split('\n')[1].split(T).length, 7);
|
|
77
87
|
});
|
|
78
88
|
|
|
79
89
|
test('events:选项不对、日期不对、起始晚于结束时退出码为 2', (t) => {
|
|
@@ -421,7 +421,7 @@ test('listen install / uninstall / status:值守跑在本地服务那一个进
|
|
|
421
421
|
// 老的单独常驻还在:install 要把它收掉
|
|
422
422
|
write(path.join(agents, 'work-rhythm.bot.work.plist'), '<plist/>');
|
|
423
423
|
assert.equal(s.listen(['status'], env).code, 1);
|
|
424
|
-
assert.match(s.listen(['status'], env).stdout, /本地服务没在跑(work-rhythm rhythm status
|
|
424
|
+
assert.match(s.listen(['status'], env).stdout, /本地服务没在跑(work-rhythm rhythm status 看详情);值守开着,但服务没在跑,所以没在听。\n提醒:还有一个老的单独常驻/);
|
|
425
425
|
const r = s.listen(['install'], env);
|
|
426
426
|
assert.equal(r.code, 0, r.out);
|
|
427
427
|
assert.match(r.stdout, /值守已打开(collectors\/local.env 的 YZJ_BOT_LISTEN=1),跑在本地服务里。本地服务已装成常驻/);
|
|
@@ -481,8 +481,8 @@ test('rhythm:YZJ_BOT_LISTEN=1 时值守在服务的同一个进程里跑;配
|
|
|
481
481
|
const fine = s.rhythm(['doctor'], { ...botEnv, YZJ_BOT_LISTEN: '1', YZJ_MY_OPEN_ID: 'me-0001' });
|
|
482
482
|
assert.equal(fine.code, 0, fine.out);
|
|
483
483
|
assert.match(fine.stdout, /^注意:路由没开(profile 的 rhythm\.router 没写)[\s\S]*\n$/);
|
|
484
|
-
//
|
|
485
|
-
assert.match(s.rhythm(['status'], botEnv).stdout, /值守:关着/);
|
|
484
|
+
// 显式写 0 关掉的时候
|
|
485
|
+
assert.match(s.rhythm(['status'], { ...botEnv, YZJ_BOT_LISTEN: '0' }).stdout, /值守:关着/);
|
|
486
486
|
// 配置不齐(没写我的 openId):doctor 报出来;服务照样起,只记「值守没开」
|
|
487
487
|
const bad = s.rhythm(['doctor'], { ...botEnv, YZJ_BOT_LISTEN: '1', YZJ_MY_OPEN_ID: '' });
|
|
488
488
|
assert.equal(bad.code, 1);
|
|
@@ -68,7 +68,7 @@ test('路由开着:listen handle 走全流程——路由写任务书、执行
|
|
|
68
68
|
assert.match(calls[1], /^【work-rhythm 路由】[\s\S]*\n- t-000001 做完,\d\d-\d\d \d\d:\d\d:任务:转述\n\n触发:\n\[t-000002\] 来源=report 时间=\S+ \S+ 对应=t-000001 结果=成功 用时=\d+s 回执=\.agents\/handoff\/t-000001\.result\.md\n 开头:记一下:刚和测试对完导出边界$/, calls[1]);
|
|
69
69
|
assert.ok(!calls[1].includes('把这句话原样回复给我'), '汇报里只给路径和开头,不塞任务书的正文');
|
|
70
70
|
// 任务书是路由写的小节,带着来源、权限和回执要求
|
|
71
|
-
assert.match(s.task('t-000001'), /^# 任务书 t-000001\n\n- 来源:message(云之家,\d\d-\d\d \d\d:\d\d)· 原话:「记一下:刚和测试对完导出边界」\n- 派给:执行者 · 权限 edit ·
|
|
71
|
+
assert.match(s.task('t-000001'), /^# 任务书 t-000001\n\n- 来源:message(云之家,\d\d-\d\d \d\d:\d\d)· 原话:「记一下:刚和测试对完导出边界」\n- 派给:执行者 · 权限 edit · 不限时\n- 续做自:无\n\n## 要求\n\n# 任务:转述\n\n把这句话原样回复给我:「记一下:刚和测试对完导出边界」\n\n## 回执\n\n做完把结果写到 `\.agents\/handoff\/t-000001\.result\.md`:[\s\S]*没有写权限就把同样内容作为最后一段话输出。[\s\S]*\n$/);
|
|
72
72
|
// 执行者的提示词只有一句话,内容都在任务书里
|
|
73
73
|
const workerCalls = read(s.env.STUB_AGENT_ALL).split('\n').filter((l) => l.startsWith('读 .agents/handoff/'));
|
|
74
74
|
assert.deepEqual(workerCalls, ['读 .agents/handoff/t-000001.md(任务书),照它做完,把回执写到 .agents/handoff/t-000001.result.md;没有写权限就把回执作为你最后一段话输出。不要向我提问,不要等待确认,不要自己发消息。']);
|
|
@@ -188,7 +188,7 @@ test('续做与叫停:continue 接着原来那个执行者的会话、排在
|
|
|
188
188
|
assert.equal(cont.decision, 'continue');
|
|
189
189
|
assert.equal(cont.of, 't-000001');
|
|
190
190
|
assert.equal(cont.worker.status, 'ok');
|
|
191
|
-
assert.match(s.task('t-000002'), /^# 任务书 t-000002\n\n- 来源:message(云之家,[^)]*)· 原话:「刚才那条,项目改成导出改造」\n- 派给:执行者 · 权限 edit ·
|
|
191
|
+
assert.match(s.task('t-000002'), /^# 任务书 t-000002\n\n- 来源:message(云之家,[^)]*)· 原话:「刚才那条,项目改成导出改造」\n- 派给:执行者 · 权限 edit · 不限时\n- 续做自:t-000001\n\n## 要求\n\n接着 t-000001 那件事做。旧任务书在 \.agents\/handoff\/t-000001\.md,旧回执在 \.agents\/handoff\/t-000001\.result\.md,先读它们。\n\n用户追加:「刚才那条,项目改成导出改造」\n/);
|
|
192
192
|
// 续做的执行者接着原来那个的会话(假的 zcode 每次回 sess_fake),并且排在它做完之后
|
|
193
193
|
const workerCalls = read(s.env.STUB_ZCODE_ALL).split('\n').filter((l) => l.includes(' 读 .agents/handoff/'));
|
|
194
194
|
assert.equal(workerCalls.length, 2);
|
|
@@ -278,7 +278,7 @@ test('服务里:到点的任务变成触发走路由,推送带页面地址
|
|
|
278
278
|
assert.equal(sent, `做了:每日工作计划\n\n→ 今天的文件:http://127.0.0.1:${port}/day/${today}`);
|
|
279
279
|
// 任务书就是指令文件的全文,后面带着回执要求;路由没写任务书(定时任务默认照指令跑)
|
|
280
280
|
const task = s.task('t-000001');
|
|
281
|
-
assert.match(task, /^# 任务书 t-000001\n\n- 来源:schedule(到点 [^)]*)· 任务:daily-plan(tasks\/daily-plan\.md)\n- 派给:执行者 · 权限 edit ·
|
|
281
|
+
assert.match(task, /^# 任务书 t-000001\n\n- 来源:schedule(到点 [^)]*)· 任务:daily-plan(tasks\/daily-plan\.md)\n- 派给:执行者 · 权限 edit · 不限时\n/);
|
|
282
282
|
assert.match(task, /## 要求\n\n你是我的个人工作助理。[\s\S]*任务:每日工作计划。[\s\S]*(这次运行由 work-rhythm rhythm 发起:你最后写的那段总结写进回执[\s\S]*## 回执\n/);
|
|
283
283
|
assert.match(proc.text(), /引擎开始 路由=dsh 执行者=dsh 并发=3/);
|
|
284
284
|
// 监控中心:页面和 JSON
|
|
@@ -528,7 +528,7 @@ test('路由模式插话:有执行者在跑时新来的话立刻回「收到
|
|
|
528
528
|
assert.equal(st['t-000002'].title, '任务:转述(插话)');
|
|
529
529
|
assert.equal(st['t-000002'].worker.status, 'ok');
|
|
530
530
|
assert.equal(st['t-000002'].worker.sessionId, 'session_fake', '接着被停那次的会话跑');
|
|
531
|
-
assert.match(s.task('t-000002'), /^# 任务书 t-000002\n\n- 来源:message(云之家,[^)]*)· 原话:「等等,项目名改成导出改造」\n- 派给:执行者 · 权限 edit ·
|
|
531
|
+
assert.match(s.task('t-000002'), /^# 任务书 t-000002\n\n- 来源:message(云之家,[^)]*)· 原话:「等等,项目名改成导出改造」\n- 派给:执行者 · 权限 edit · 不限时\n- 续做自:t-000001\n\n## 要求\n\n接着 t-000001 那件事做,但要求变了。旧任务书在 \.agents\/handoff\/t-000001\.md,先读它;上一次做到一半被用户叫停,回执在 \.agents\/handoff\/t-000001\.result\.md。\n\n用户插话:「等等,项目名改成导出改造」\n/);
|
|
532
532
|
// 被停的那次不汇报:只有插话那次的一条汇报;也没给用户发「没做成」
|
|
533
533
|
const reports = Object.values(st).filter((x) => x.kind === 'report');
|
|
534
534
|
assert.deepEqual(reports.map((x) => x.of), ['t-000002']);
|
|
@@ -621,14 +621,14 @@ test('采集之后:有新数据就起一轮提炼,新增的事件打包成 e
|
|
|
621
621
|
assert.match(s.routerCalls()[0], /\n触发:\n\[t-000001\] 来源=events 时间=\d\d-\d\d \d\d:\d\d 新事件 0 条;这次采集:im-yzj 失败:errorCode 10000429$/);
|
|
622
622
|
// 派出去的任务书是固定的那份(路由没写任务书),带着采集故障
|
|
623
623
|
// 任务书用的是这条触发自己的短号
|
|
624
|
-
assert.match(s.task('t-000001'), /^# 任务书 t-000001\n\n- 来源:events([^)]*)· 定时采集之后新到的一批事件\n- 派给:执行者 · 权限 edit ·
|
|
624
|
+
assert.match(s.task('t-000001'), /^# 任务书 t-000001\n\n- 来源:events([^)]*)· 定时采集之后新到的一批事件\n- 派给:执行者 · 权限 edit · 不限时\n- 续做自:无\n\n## 要求\n\n# 任务:根据新到的事件更新今日重点和待办\n\n今天新到的事件(0 条):\n(没有新事件)\n\n这次采集有源没取到数据(回执里说清,涉及的事标「未取到」):im-yzj:errorCode 10000429\n\n1\. 读今天每日文件(\S+\/02-daily\/\d{4}-\d{2}\/\d{4}-\d{2}-\d{2}\.md)的「## 计划」/);
|
|
625
625
|
// 有新数据:起一轮提炼(假的执行者往今天的事件流里加两条),CLI 比出新增的两条,打包给路由
|
|
626
626
|
const date = todayStr();
|
|
627
627
|
const r = await eng.afterSync({ results: [{ id: 'calendar-yzj', ok: true, code: 3, seconds: 3, detail: '' }], changed: true });
|
|
628
628
|
assert.ok(r && r.ok, JSON.stringify(r));
|
|
629
629
|
const refine = Object.values(triggers()).find((x) => x.kind === 'refine');
|
|
630
630
|
assert.deepEqual([refine.decision, refine.title, refine.worker.status, refine.worker.mode], ['refine', '把今天新采到的数据提炼成事件', 'ok', 'edit']);
|
|
631
|
-
assert.match(s.task(refine.id), /^# 任务书 t-000003\n\n- 来源:refine([^)]*)· 定时采集之后提炼新数据\n- 派给:执行者 · 权限 edit ·
|
|
631
|
+
assert.match(s.task(refine.id), /^# 任务书 t-000003\n\n- 来源:refine([^)]*)· 定时采集之后提炼新数据\n- 派给:执行者 · 权限 edit · 不限时\n- 续做自:无\n\n## 要求\n\n# 任务:把今天新采到的数据提炼成事件\n\n1\. 读 00-config\/sources\.yaml[\s\S]*4\. 合并进今天每日文件(\S+\/02-daily\/\d{4}-\d{2}\/\d{4}-\d{2}-\d{2}\.md)的「## 事件流」/);
|
|
632
632
|
assert.deepEqual(engineLib.dayEvents(s.box.work, date).map((e) => `${e.date} ${e.time} ${e.type} ${e.item} ${e.source} ${e.project}`), [`${date} 09:00 会议 需求评审 calendar-yzj 导出`, `${date} 10:30 沟通 和测试对完导出边界 im-yzj 导出`]);
|
|
633
633
|
assert.ok(await eng.waitIdle(30000));
|
|
634
634
|
const ev = Object.values(triggers()).find((x) => x.kind === 'events' && x.of === refine.id);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
你是我的个人工作助理。当前工作目录就是我的个人工作目录,流程以 AGENTS.md 为准,
|
|
2
|
+
文件格式以 docs/formats.md 为准。这次是无人值守的定时运行:不要向我提问,不要等待确认;
|
|
3
|
+
遇到数据取不到、命令失败,就如实注明并继续,把结果写进文件后结束。
|
|
4
|
+
|
|
5
|
+
任务:每日归档与个人分身更新。收尾当天记录,把今天沉淀出的工作习惯、决策风格和角色变化更新到个人分身档案里。
|
|
6
|
+
1. 运行 work-rhythm today。IS_WORKDAY 为 0 时直接结束,不写任何文件。
|
|
7
|
+
2. 归档收尾:
|
|
8
|
+
- 运行 work-rhythm decisions archive,归档已落实或过期的老决定。
|
|
9
|
+
- 读 03-carryover/CARRYOVER.md,把已明确完结或失效的条目清理/归档到「已完成」区域,保持未了结列表干净。
|
|
10
|
+
3. 收集今天的分身信号:
|
|
11
|
+
- 读今天及最近 2 个工作日的每日文件(事件流、复盘、备注)。
|
|
12
|
+
- 运行 work-rhythm decisions list 7,看最近 7 天我亲自拍板的决定和理由(「未答」「过期未答」不算决定)。
|
|
13
|
+
- 读 00-config/profile.yaml、04-patterns/WORK_RHYTHM.md 和 04-patterns/PERSONA.md(不存在就新建)。
|
|
14
|
+
4. 增量更新 04-patterns/PERSONA.md(个人分身档案,供所有 agent 干活前快速对齐「我是谁、我怎么做事」):
|
|
15
|
+
- 分五节维护:角色与职责边界、决策原则与风格、沟通与表达偏好、工作习惯与节奏、近期核心关注点。
|
|
16
|
+
- 只写有证据支撑的内容,每条新沉淀注明日期;推测性的判断标「?」。不要编造,也不要删掉仍然有效的旧条目。
|
|
17
|
+
- 如有新的工作习惯线索,同步增量补充到 04-patterns/WORK_RHYTHM.md 的「做事的习惯」。
|
|
18
|
+
5. 检查角色身份变化:
|
|
19
|
+
- 对照 00-config/profile.yaml 里的角色、项目和偏好;**不要直接修改 profile.yaml**。
|
|
20
|
+
- 如果今天有明确信号表明角色职责或常驻项目发生了变化,用 `work-rhythm ask --json '…'` 丢一张确认卡,等我拍板后再改。
|
|
21
|
+
6. 最后一步,写完文件之后:用三行以内的纯文本写下今天归档了什么、分身档案更新了哪几条、有没有需要我确认的卡。
|
|
22
|
+
这是发给人类看的,务必简洁明了、直说结论,不用表格、不放链接,不要提内部细节。
|
|
23
|
+
如果指令的末尾没有人注明「会替你推送」,就把这段话经管道交给 `work-rhythm notify -` 自己发出去。
|
|
@@ -42,6 +42,7 @@ schedule: # 标准定时任务的时间,定义见 docs/schedul
|
|
|
42
42
|
noon-checkin: "12:30"
|
|
43
43
|
evening-review: "17:30" # 下班前 15 分钟
|
|
44
44
|
carryover: "17:40" # 遗留的输入是复盘的结论,紧随其后
|
|
45
|
+
daily-persona: "18:30" # 每日归档、整理工作习惯与个人分身档案(04-patterns/PERSONA.md)
|
|
45
46
|
weekly-rhythm: "Fri 16:30"
|
|
46
47
|
# 待决的事不做定时巡查:推送里会提醒有几件等我定,我对任何一个能读到这个工作目录的 agent 说「有什么要我定」就开始逐件问
|
|
47
48
|
|