geo-ai-search-optimization 1.2.16 → 1.2.17
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/README.md +31 -0
- package/package.json +1 -1
- package/resources/geo-ai-search-optimization/references/skill-bundle-map.md +10 -0
- package/resources/geo-ai-search-optimization-agent-playbook-pack/SKILL.md +23 -0
- package/resources/geo-ai-search-optimization-agent-playbook-pack/agents/openai.yaml +4 -0
- package/resources/geo-ai-search-optimization-usage/SKILL.md +19 -14
- package/src/agent-playbook-pack.js +267 -0
- package/src/agent-session.js +10 -0
- package/src/auto-flow.js +29 -0
- package/src/cli.js +37 -0
- package/src/completion-report.js +31 -0
- package/src/index.js +1 -0
- package/src/skills.js +3 -0
package/README.md
CHANGED
|
@@ -246,6 +246,27 @@ geo-ai-search-optimization agent-retrospective ./reports/agent-decision-log.json
|
|
|
246
246
|
- 多轮时间线
|
|
247
247
|
- 可直接复制给 agent 的 retrospective prompt
|
|
248
248
|
|
|
249
|
+
## Agent Playbook Pack 命令
|
|
250
|
+
|
|
251
|
+
如果你希望把多轮复盘、决策历史和交接信息压成一个“下一位 agent 一拿到就能继续做”的单入口工件,可以直接用 `agent-playbook-pack`:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
geo-ai-search-optimization agent-playbook-pack ./your-site
|
|
255
|
+
geo-ai-search-optimization agent-playbook-pack ./reports/agent-decision-log.json
|
|
256
|
+
geo-ai-search-optimization agent-playbook-pack ./reports/agent-retrospective.json --format json --out ./reports/agent-playbook-pack.json
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
`agent-playbook-pack` 会输出:
|
|
260
|
+
|
|
261
|
+
- 当前状态
|
|
262
|
+
- 恢复摘要
|
|
263
|
+
- 启动命令
|
|
264
|
+
- 当前包与下一包
|
|
265
|
+
- 先读什么
|
|
266
|
+
- 现在先做什么 / 现在不要做什么
|
|
267
|
+
- 后续命令
|
|
268
|
+
- 可直接复制给 agent 的 playbook prompt
|
|
269
|
+
|
|
249
270
|
## Quick Start
|
|
250
271
|
|
|
251
272
|
如果你要从 0 到 1 启动一个 GEO 项目,建议照这个顺序做。
|
|
@@ -649,6 +670,7 @@ geo-ai-search-optimization agent-status-board ./your-site
|
|
|
649
670
|
geo-ai-search-optimization agent-checkpoint ./your-site
|
|
650
671
|
geo-ai-search-optimization agent-decision-log ./your-site
|
|
651
672
|
geo-ai-search-optimization agent-retrospective ./your-site
|
|
673
|
+
geo-ai-search-optimization agent-playbook-pack ./your-site
|
|
652
674
|
geo-ai-search-optimization skills
|
|
653
675
|
geo-ai-search-optimization where
|
|
654
676
|
geo-ai-search-optimization doctor
|
|
@@ -719,6 +741,14 @@ geo-ai-search-optimization help
|
|
|
719
741
|
- 输出 do-now checklist、stop checklist、success checklist、验证命令和回报模板
|
|
720
742
|
- 新增 `geo-ai-search-optimization-agent-executor` skill
|
|
721
743
|
|
|
744
|
+
## New in 1.2.17
|
|
745
|
+
|
|
746
|
+
- 新增 `agent-playbook-pack`
|
|
747
|
+
- 把 `agent-retrospective + agent-decision-log + handoff-bundle` 压成一个单入口执行包
|
|
748
|
+
- 让下一位 agent 可以直接从 current packet、start command 和 do-now checklist 继续
|
|
749
|
+
- `completion-report` 现在也能直接吃 retrospective / handoff bundle / playbook pack 这类工件
|
|
750
|
+
- 新增 `geo-ai-search-optimization-agent-playbook-pack` skill
|
|
751
|
+
|
|
722
752
|
## New in 1.2.16
|
|
723
753
|
|
|
724
754
|
- 新增 `agent-retrospective` 命令
|
|
@@ -957,6 +987,7 @@ The installed package now includes a bundled GEO skill pack, including:
|
|
|
957
987
|
- `geo-ai-search-optimization-agent-checkpoint`
|
|
958
988
|
- `geo-ai-search-optimization-agent-decision-log`
|
|
959
989
|
- `geo-ai-search-optimization-agent-retrospective`
|
|
990
|
+
- `geo-ai-search-optimization-agent-playbook-pack`
|
|
960
991
|
- `geo-ai-search-optimization-usage`
|
|
961
992
|
- `geo-ai-search-optimization-agent-handoff`
|
|
962
993
|
- `geo-ai-search-optimization-repair-loop`
|
package/package.json
CHANGED
|
@@ -122,6 +122,16 @@ Best for:
|
|
|
122
122
|
- turning decision history into lessons learned and next-round advice
|
|
123
123
|
- producing a cross-round retrospective before meetings, closeout, or final delivery
|
|
124
124
|
|
|
125
|
+
### `geo-ai-search-optimization-agent-playbook-pack`
|
|
126
|
+
|
|
127
|
+
Use this when the next agent should get one single-entry resume pack instead of piecing together retrospective, decision history, and handoff artifacts manually.
|
|
128
|
+
|
|
129
|
+
Best for:
|
|
130
|
+
|
|
131
|
+
- handing one GEO artifact to the next agent and saying "continue from here"
|
|
132
|
+
- compressing multi-round history into one current packet, one start command, and one follow-up chain
|
|
133
|
+
- reducing restart risk after several GEO rounds or multiple handoffs
|
|
134
|
+
|
|
125
135
|
## Usage guide
|
|
126
136
|
|
|
127
137
|
### `geo-ai-search-optimization-usage`
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: geo-ai-search-optimization-agent-playbook-pack
|
|
3
|
+
description: Bundle GEO retrospective, decision history, and handoff artifacts into one single-entry playbook for the next agent. Use when a PM or agent wants the next agent to continue from prior GEO rounds without rebuilding the whole chain, and needs a current packet, start command, do-now checklist, avoid-now checklist, and follow-up commands in one artifact.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GEO Agent Playbook Pack
|
|
7
|
+
|
|
8
|
+
Use this skill when the next agent should not rebuild the GEO chain from scratch.
|
|
9
|
+
|
|
10
|
+
`GEO = Generative Engine Optimization`
|
|
11
|
+
|
|
12
|
+
## What it does
|
|
13
|
+
|
|
14
|
+
- reads GEO retrospective, decision log, and handoff bundle style inputs
|
|
15
|
+
- compresses them into one agent-ready entrypoint
|
|
16
|
+
- tells the next agent where to resume, what to do now, and what not to do now
|
|
17
|
+
- keeps cross-round context without forcing the next agent to read every artifact first
|
|
18
|
+
|
|
19
|
+
## Best use
|
|
20
|
+
|
|
21
|
+
- when PM wants to hand one artifact to the next agent and say "continue from here"
|
|
22
|
+
- when GEO work has already gone through multiple rounds and needs a stable resume point
|
|
23
|
+
- when the team wants one start command, one current packet, and one follow-up chain instead of many separate artifacts
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "GEO Agent Playbook Pack"
|
|
3
|
+
short_description: "Compress GEO history into one resume entrypoint"
|
|
4
|
+
default_prompt: "Use $geo-ai-search-optimization-agent-playbook-pack to turn this GEO history into one playbook artifact with a resume summary, start command, do-now checklist, and follow-up commands for the next agent."
|
|
@@ -13,7 +13,7 @@ Treat this tool as a PM-friendly GEO workflow for websites.
|
|
|
13
13
|
|
|
14
14
|
`GEO = Generative Engine Optimization`
|
|
15
15
|
|
|
16
|
-
The package is best explained as twenty-
|
|
16
|
+
The package is best explained as twenty-four layers:
|
|
17
17
|
|
|
18
18
|
1. `auto-flow`: auto-select the next skill and command chain
|
|
19
19
|
2. `agent-session`: build a runnable session for the next agent
|
|
@@ -25,19 +25,20 @@ The package is best explained as twenty-three layers:
|
|
|
25
25
|
8. `agent-checkpoint`: freeze the current round into a continue / unblock / closeout decision
|
|
26
26
|
9. `agent-decision-log`: preserve why each round continued, paused, or closed out
|
|
27
27
|
10. `agent-retrospective`: explain multi-round patterns, lessons, and next-round advice
|
|
28
|
-
11. `
|
|
29
|
-
12. `
|
|
30
|
-
13. `
|
|
31
|
-
14. `
|
|
32
|
-
15. `
|
|
33
|
-
16. `
|
|
34
|
-
17. `
|
|
35
|
-
18. `
|
|
36
|
-
19. `
|
|
37
|
-
20. `
|
|
38
|
-
21. `
|
|
39
|
-
22. `
|
|
40
|
-
23. `
|
|
28
|
+
11. `agent-playbook-pack`: compress retrospective, decision history, and handoff into one resume entrypoint
|
|
29
|
+
12. `skills`: inspect the bundled skill package
|
|
30
|
+
13. `onboard-url` / `onboard`: first look
|
|
31
|
+
14. `scan`: raw signal check
|
|
32
|
+
15. `audit` / `report`: diagnosis
|
|
33
|
+
16. `fix-plan` / `owner-board`: execution planning
|
|
34
|
+
17. `agent-handoff`: agent takeover package
|
|
35
|
+
18. `apply-plan`: execution loop
|
|
36
|
+
19. `completion-report`: closeout
|
|
37
|
+
20. `handoff-bundle`: all-in-one package
|
|
38
|
+
21. `share-pack`: audience-ready delivery
|
|
39
|
+
22. `export-pack`: folder export
|
|
40
|
+
23. `html-pack` / `publish-pack`: browsable and final delivery output
|
|
41
|
+
24. `pm-brief` / `roadmap`: stakeholder alignment
|
|
41
42
|
|
|
42
43
|
## Recommended command order
|
|
43
44
|
|
|
@@ -54,6 +55,7 @@ npx geo-ai-search-optimization agent-status-board https://example.com
|
|
|
54
55
|
npx geo-ai-search-optimization agent-checkpoint https://example.com
|
|
55
56
|
npx geo-ai-search-optimization agent-decision-log https://example.com
|
|
56
57
|
npx geo-ai-search-optimization agent-retrospective https://example.com
|
|
58
|
+
npx geo-ai-search-optimization agent-playbook-pack https://example.com
|
|
57
59
|
npx geo-ai-search-optimization onboard-url https://example.com
|
|
58
60
|
npx geo-ai-search-optimization pm-brief https://example.com
|
|
59
61
|
npx geo-ai-search-optimization roadmap https://example.com
|
|
@@ -72,6 +74,7 @@ npx geo-ai-search-optimization agent-status-board ./your-site
|
|
|
72
74
|
npx geo-ai-search-optimization agent-checkpoint ./your-site
|
|
73
75
|
npx geo-ai-search-optimization agent-decision-log ./your-site
|
|
74
76
|
npx geo-ai-search-optimization agent-retrospective ./your-site
|
|
77
|
+
npx geo-ai-search-optimization agent-playbook-pack ./your-site
|
|
75
78
|
npx geo-ai-search-optimization scan ./your-site
|
|
76
79
|
npx geo-ai-search-optimization audit ./your-site
|
|
77
80
|
npx geo-ai-search-optimization fix-plan ./your-site
|
|
@@ -99,6 +102,7 @@ npx geo-ai-search-optimization roadmap ./your-site
|
|
|
99
102
|
- `agent-checkpoint`: convert the current round into a checkpoint decision for continue, unblock, or closeout
|
|
100
103
|
- `agent-decision-log`: preserve multiple rounds of checkpoint history so the next agent can inherit the reasoning
|
|
101
104
|
- `agent-retrospective`: explain why the last few rounds advanced or stalled, and turn that into lessons and next-round guidance
|
|
105
|
+
- `agent-playbook-pack`: compress retrospective, decision history, and handoff into one single-entry resume pack for the next agent
|
|
102
106
|
- `onboard-url`: first-time website check from a live URL
|
|
103
107
|
- `onboard`: interactive first-time onboarding
|
|
104
108
|
- `skills`: list the bundled skills and decide which skill or command chain fits the task
|
|
@@ -133,6 +137,7 @@ When explaining the tool to a user:
|
|
|
133
137
|
- if the user wants a per-round decision artifact that says continue, unblock, or close out, move them to `agent-checkpoint`
|
|
134
138
|
- if the user wants cross-round decision memory and not just one checkpoint, move them to `agent-decision-log`
|
|
135
139
|
- if the user wants to understand why multiple rounds kept advancing or getting stuck, move them to `agent-retrospective`
|
|
140
|
+
- if the user wants one artifact that the next agent can take over from immediately, move them to `agent-playbook-pack`
|
|
136
141
|
- explain the result in PM language, not implementation jargon
|
|
137
142
|
- if the user sounds new, start with `onboard-url` or `quick-start`
|
|
138
143
|
- if the user wants another agent to take over, move them to `agent-handoff`
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { createAgentDecisionLog } from "./agent-decision-log.js";
|
|
2
|
+
import { createAgentRetrospective } from "./agent-retrospective.js";
|
|
3
|
+
import { createHandoffBundle } from "./handoff-bundle.js";
|
|
4
|
+
import { writeScanOutput } from "./scan.js";
|
|
5
|
+
|
|
6
|
+
const VALID_FORMATS = new Set(["markdown", "json"]);
|
|
7
|
+
|
|
8
|
+
function normalizeFormat(format) {
|
|
9
|
+
const resolved = (format || "markdown").toLowerCase();
|
|
10
|
+
if (!VALID_FORMATS.has(resolved)) {
|
|
11
|
+
throw new Error(`不支持的 agent-playbook-pack 格式:${format}。可选值:${Array.from(VALID_FORMATS).join(", ")}`);
|
|
12
|
+
}
|
|
13
|
+
return resolved;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function inferPlaybookStatus(retrospective, decisionLog, handoffBundle) {
|
|
17
|
+
if (
|
|
18
|
+
retrospective.retrospectiveStatus === "ready-for-closeout" ||
|
|
19
|
+
decisionLog.latestDecision === "move-to-closeout"
|
|
20
|
+
) {
|
|
21
|
+
return "closeout-ready";
|
|
22
|
+
}
|
|
23
|
+
if (
|
|
24
|
+
retrospective.retrospectiveStatus === "repeated-blocker" ||
|
|
25
|
+
retrospective.retrospectiveStatus === "blocked-this-round" ||
|
|
26
|
+
decisionLog.latestDecision === "resolve-blockers"
|
|
27
|
+
) {
|
|
28
|
+
return "unblock-first";
|
|
29
|
+
}
|
|
30
|
+
if (handoffBundle.summary.executionMode === "implementation-ready") {
|
|
31
|
+
return "implementation-ready";
|
|
32
|
+
}
|
|
33
|
+
if (handoffBundle.summary.executionMode === "advice-only") {
|
|
34
|
+
return "advice-ready";
|
|
35
|
+
}
|
|
36
|
+
return "artifact-guided";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function buildResumeSummary(status, retrospective, decisionLog) {
|
|
40
|
+
if (status === "closeout-ready") {
|
|
41
|
+
return "这轮已经接近或进入收尾,不要再扩展新任务,直接整理 closeout 与交付。";
|
|
42
|
+
}
|
|
43
|
+
if (status === "unblock-first") {
|
|
44
|
+
return `当前应先解除阻塞,再继续 ${decisionLog.currentPacket?.id || "当前包"}。`;
|
|
45
|
+
}
|
|
46
|
+
if (status === "implementation-ready") {
|
|
47
|
+
return `当前可以直接接着做 ${decisionLog.currentPacket?.id || "第一包"},并按既有节奏推进。`;
|
|
48
|
+
}
|
|
49
|
+
if (status === "advice-ready") {
|
|
50
|
+
return "当前更适合先给建议与实施路径,不要假设已经拥有仓库写入权限。";
|
|
51
|
+
}
|
|
52
|
+
return `当前建议沿着最近一次决策继续推进 ${decisionLog.currentPacket?.id || "下一包"}。`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function buildStartCommand(status, retrospective, decisionLog, handoffBundle) {
|
|
56
|
+
if (status === "closeout-ready") {
|
|
57
|
+
return `geo-ai-search-optimization completion-report ${decisionLog.source}`;
|
|
58
|
+
}
|
|
59
|
+
if (retrospective.suggestedNextCommand) {
|
|
60
|
+
return retrospective.suggestedNextCommand;
|
|
61
|
+
}
|
|
62
|
+
if (decisionLog.suggestedNextCommand) {
|
|
63
|
+
return decisionLog.suggestedNextCommand;
|
|
64
|
+
}
|
|
65
|
+
const firstPacket = handoffBundle.applyPlan.packets[0];
|
|
66
|
+
return firstPacket
|
|
67
|
+
? `geo-ai-search-optimization agent-executor ${decisionLog.source} --task ${firstPacket.id}`
|
|
68
|
+
: `geo-ai-search-optimization agent-session ${decisionLog.source}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function buildReadOrder() {
|
|
72
|
+
return [
|
|
73
|
+
"先读 retrospective,总结多轮里为什么推进顺利或反复卡住。",
|
|
74
|
+
"再读 decision log,确认最近一次决策、当前包和下一步命令。",
|
|
75
|
+
"最后读 handoff bundle,接着看 apply-plan 和 completion-report 的执行细节。"
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function buildDoNowChecklist(status, retrospective, decisionLog) {
|
|
80
|
+
const items = [];
|
|
81
|
+
|
|
82
|
+
if (status === "closeout-ready") {
|
|
83
|
+
items.push("不要再新开执行包。");
|
|
84
|
+
items.push("直接整理 completion-report、meeting-pack 和 publish-pack。");
|
|
85
|
+
} else if (status === "unblock-first") {
|
|
86
|
+
items.push("先解决当前阻塞,不要直接继续改代码。");
|
|
87
|
+
items.push("阻塞解除后,再回到当前包继续推进。");
|
|
88
|
+
} else {
|
|
89
|
+
items.push(`沿着当前包 ${decisionLog.currentPacket?.id || "第一包"} 继续,不要重新生成一条新链。`);
|
|
90
|
+
items.push("先按已有 runbook / executor 节奏推进,再更新状态。");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
items.push(...retrospective.nextRoundAdvice.slice(0, 2));
|
|
94
|
+
return Array.from(new Set(items));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function buildAvoidNowChecklist(status, retrospective) {
|
|
98
|
+
const items = [];
|
|
99
|
+
|
|
100
|
+
if (status !== "closeout-ready") {
|
|
101
|
+
items.push("不要同时切换目标、任务包和执行模式。");
|
|
102
|
+
}
|
|
103
|
+
if (status === "unblock-first") {
|
|
104
|
+
items.push("不要假装阻塞不存在,也不要跳过 preflight 直接改动。");
|
|
105
|
+
}
|
|
106
|
+
if (retrospective.retrospectiveStatus === "restarting-too-often") {
|
|
107
|
+
items.push("不要再从第一包重新开始,优先延续最近一次 current packet。");
|
|
108
|
+
}
|
|
109
|
+
if (retrospective.recurringBlockers[0]?.count >= 2) {
|
|
110
|
+
items.push(`不要忽视重复阻塞「${retrospective.recurringBlockers[0].title}」,先把它变成固定检查项。`);
|
|
111
|
+
}
|
|
112
|
+
if (status === "closeout-ready") {
|
|
113
|
+
items.push("不要在 closeout 阶段继续扩展新的修复范围。");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return items;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function buildFollowupCommands(status, source) {
|
|
120
|
+
if (status === "closeout-ready") {
|
|
121
|
+
return [
|
|
122
|
+
`geo-ai-search-optimization completion-report ${source}`,
|
|
123
|
+
`geo-ai-search-optimization meeting-pack ${source}`,
|
|
124
|
+
`geo-ai-search-optimization publish-pack ${source}`
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return [
|
|
129
|
+
`geo-ai-search-optimization agent-status-board ${source}`,
|
|
130
|
+
`geo-ai-search-optimization agent-decision-log ${source}`,
|
|
131
|
+
`geo-ai-search-optimization agent-retrospective ${source}`
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function buildPlaybookPrompt(pack) {
|
|
136
|
+
const lines = [
|
|
137
|
+
"你现在进入 GEO Agent Playbook 模式。",
|
|
138
|
+
`输入来源:${pack.source}`,
|
|
139
|
+
`当前状态:${pack.playbookStatus}`,
|
|
140
|
+
`恢复摘要:${pack.resumeSummary}`,
|
|
141
|
+
`启动命令:${pack.startCommand}`,
|
|
142
|
+
`当前包:${pack.currentPacket?.id || "无"}`
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
if (pack.nextPacket) {
|
|
146
|
+
lines.push(`下一包:${pack.nextPacket.id}|${pack.nextPacket.title}`);
|
|
147
|
+
}
|
|
148
|
+
if (pack.retrospective.recurringBlockers.length > 0) {
|
|
149
|
+
lines.push(
|
|
150
|
+
`重复阻塞:${pack.retrospective.recurringBlockers.map((item) => `${item.title} (${item.count})`).join(";")}`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
lines.push("请先解释你为什么沿着这条 playbook 继续,而不是重新规划一整条新链。");
|
|
155
|
+
lines.push("然后按 read order、do now checklist、avoid now checklist 输出执行建议。");
|
|
156
|
+
lines.push("最后给出本轮完成后应该更新哪些工件。");
|
|
157
|
+
return lines.join("\n");
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export async function createAgentPlaybookPack(input, options = {}) {
|
|
161
|
+
const format = normalizeFormat(options.format);
|
|
162
|
+
const retrospective = await createAgentRetrospective(input, { format: "json" });
|
|
163
|
+
const decisionLog = retrospective.decisionLog || (await createAgentDecisionLog(input, { format: "json" }));
|
|
164
|
+
const baseSource = retrospective.source || decisionLog.source || input;
|
|
165
|
+
const handoffBundle = await createHandoffBundle(baseSource, { format: "json", taskId: options.taskId });
|
|
166
|
+
|
|
167
|
+
const playbookStatus = inferPlaybookStatus(retrospective, decisionLog, handoffBundle);
|
|
168
|
+
const source = baseSource;
|
|
169
|
+
const startCommand = buildStartCommand(playbookStatus, retrospective, decisionLog, handoffBundle);
|
|
170
|
+
|
|
171
|
+
const pack = {
|
|
172
|
+
kind: "geo-agent-playbook-pack",
|
|
173
|
+
input,
|
|
174
|
+
source,
|
|
175
|
+
sourceType: decisionLog.sourceType,
|
|
176
|
+
artifactKind: decisionLog.kind,
|
|
177
|
+
format,
|
|
178
|
+
playbookStatus,
|
|
179
|
+
resumeSummary: buildResumeSummary(playbookStatus, retrospective, decisionLog),
|
|
180
|
+
currentPacket: decisionLog.currentPacket,
|
|
181
|
+
nextPacket: decisionLog.nextPacket,
|
|
182
|
+
startCommand,
|
|
183
|
+
readOrder: buildReadOrder(),
|
|
184
|
+
doNowChecklist: buildDoNowChecklist(playbookStatus, retrospective, decisionLog),
|
|
185
|
+
avoidNowChecklist: buildAvoidNowChecklist(playbookStatus, retrospective),
|
|
186
|
+
followupCommands: buildFollowupCommands(playbookStatus, source),
|
|
187
|
+
decisionLog,
|
|
188
|
+
retrospective,
|
|
189
|
+
handoffBundle,
|
|
190
|
+
playbookPrompt: ""
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
pack.playbookPrompt = buildPlaybookPrompt(pack);
|
|
194
|
+
return pack;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function renderAgentPlaybookPackMarkdown(pack) {
|
|
198
|
+
const lines = [
|
|
199
|
+
"# GEO Agent Playbook Pack",
|
|
200
|
+
"",
|
|
201
|
+
`- 输入:\`${pack.source}\``,
|
|
202
|
+
`- 来源类型:\`${pack.sourceType}\``,
|
|
203
|
+
`- 当前状态:\`${pack.playbookStatus}\``,
|
|
204
|
+
`- 恢复摘要:${pack.resumeSummary}`,
|
|
205
|
+
`- 启动命令:\`${pack.startCommand}\``,
|
|
206
|
+
""
|
|
207
|
+
];
|
|
208
|
+
|
|
209
|
+
if (pack.currentPacket) {
|
|
210
|
+
lines.push("## 当前包", "", `- ${pack.currentPacket.id}|${pack.currentPacket.title}`);
|
|
211
|
+
lines.push(`- Owner:${pack.currentPacket.owner}`);
|
|
212
|
+
lines.push(`- 优先级:${pack.currentPacket.priority}`);
|
|
213
|
+
lines.push("");
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (pack.nextPacket) {
|
|
217
|
+
lines.push("## 下一包", "", `- ${pack.nextPacket.id}|${pack.nextPacket.title}`);
|
|
218
|
+
lines.push(`- Owner:${pack.nextPacket.owner}`);
|
|
219
|
+
lines.push(`- 优先级:${pack.nextPacket.priority}`);
|
|
220
|
+
lines.push("");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
lines.push("## 先读什么", "");
|
|
224
|
+
for (const item of pack.readOrder) {
|
|
225
|
+
lines.push(`- ${item}`);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
lines.push("", "## 现在先做什么", "");
|
|
229
|
+
for (const item of pack.doNowChecklist) {
|
|
230
|
+
lines.push(`- ${item}`);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
lines.push("", "## 现在不要做什么", "");
|
|
234
|
+
if (pack.avoidNowChecklist.length === 0) {
|
|
235
|
+
lines.push("- 当前没有额外禁忌项。");
|
|
236
|
+
} else {
|
|
237
|
+
for (const item of pack.avoidNowChecklist) {
|
|
238
|
+
lines.push(`- ${item}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
lines.push("", "## 后续命令", "");
|
|
243
|
+
for (const command of pack.followupCommands) {
|
|
244
|
+
lines.push(`- \`${command}\``);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
lines.push(
|
|
248
|
+
"",
|
|
249
|
+
"## 内含工件摘要",
|
|
250
|
+
"",
|
|
251
|
+
`- decision-log:${pack.decisionLog.totalEntries} 轮`,
|
|
252
|
+
`- retrospective:${pack.retrospective.retrospectiveStatus}`,
|
|
253
|
+
`- handoff-bundle:${pack.handoffBundle.summary.executionMode} / ${pack.handoffBundle.summary.executionType}`,
|
|
254
|
+
"",
|
|
255
|
+
"## 可直接复制给 Agent 的 Playbook Prompt",
|
|
256
|
+
"",
|
|
257
|
+
"```text",
|
|
258
|
+
pack.playbookPrompt,
|
|
259
|
+
"```"
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
return `${lines.join("\n")}\n`;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export async function writeAgentPlaybookPackOutput(outputPath, content) {
|
|
266
|
+
return writeScanOutput(outputPath, content);
|
|
267
|
+
}
|
package/src/agent-session.js
CHANGED
|
@@ -70,6 +70,9 @@ function inferSkillForCommand(commandName, flow) {
|
|
|
70
70
|
if (commandName === "agent-retrospective") {
|
|
71
71
|
return "geo-ai-search-optimization-agent-retrospective";
|
|
72
72
|
}
|
|
73
|
+
if (commandName === "agent-playbook-pack") {
|
|
74
|
+
return "geo-ai-search-optimization-agent-playbook-pack";
|
|
75
|
+
}
|
|
73
76
|
if (commandName === "skills" || commandName === "quick-start") {
|
|
74
77
|
return "geo-ai-search-optimization-usage";
|
|
75
78
|
}
|
|
@@ -146,6 +149,8 @@ function inferStepPurpose(commandName, flow) {
|
|
|
146
149
|
return "把每一轮 checkpoint 沉淀成可继承的决策历史。";
|
|
147
150
|
case "agent-retrospective":
|
|
148
151
|
return "把多轮决策历史压成复盘结论、重复模式和下一轮建议。";
|
|
152
|
+
case "agent-playbook-pack":
|
|
153
|
+
return "把复盘、决策历史和交接信息压成下一位 agent 的单入口执行包。";
|
|
149
154
|
case "apply-plan":
|
|
150
155
|
return "把交接结果推进到具体执行包。";
|
|
151
156
|
case "completion-report":
|
|
@@ -202,6 +207,8 @@ function inferExpectedArtifact(commandName) {
|
|
|
202
207
|
return "agent 决策历史工件";
|
|
203
208
|
case "agent-retrospective":
|
|
204
209
|
return "agent 多轮复盘工件";
|
|
210
|
+
case "agent-playbook-pack":
|
|
211
|
+
return "agent 单入口 playbook 包";
|
|
205
212
|
case "apply-plan":
|
|
206
213
|
return "执行包";
|
|
207
214
|
case "completion-report":
|
|
@@ -258,6 +265,9 @@ function buildStepInstructions(parsedCommand, flow) {
|
|
|
258
265
|
if (parsedCommand.commandName === "agent-retrospective") {
|
|
259
266
|
lines.push("这一步用于总结为什么前几轮卡住或推进顺利,并把这些模式转成下一轮建议。");
|
|
260
267
|
}
|
|
268
|
+
if (parsedCommand.commandName === "agent-playbook-pack") {
|
|
269
|
+
lines.push("这一步用于把多轮复盘和交接结果压成单入口执行包,方便下一位 agent 直接开始。");
|
|
270
|
+
}
|
|
261
271
|
if (parsedCommand.commandName === "agent-handoff" && flow.intent === "execute") {
|
|
262
272
|
lines.push("如果还是 advice-only,说明还缺仓库或本地项目上下文。");
|
|
263
273
|
}
|
package/src/auto-flow.js
CHANGED
|
@@ -59,6 +59,9 @@ function inferTaskTextMode(text) {
|
|
|
59
59
|
if (/(decision-log|decision log|决策历史|决策日志|为什么这样决定|历史决策)/i.test(normalized)) {
|
|
60
60
|
return "execute";
|
|
61
61
|
}
|
|
62
|
+
if (/(playbook-pack|playbook pack|playbook 包|agent playbook|单入口执行包|复盘执行包|接着干的入口)/i.test(normalized)) {
|
|
63
|
+
return "execute";
|
|
64
|
+
}
|
|
62
65
|
if (/(retrospective|retro|多轮复盘|执行复盘|为什么总卡住|经验总结|回顾前几轮)/i.test(normalized)) {
|
|
63
66
|
return "closeout";
|
|
64
67
|
}
|
|
@@ -165,6 +168,9 @@ function resolveEffectiveIntent(intent, detected) {
|
|
|
165
168
|
if (detected.artifactKind === "geo-agent-retrospective") {
|
|
166
169
|
return "closeout";
|
|
167
170
|
}
|
|
171
|
+
if (detected.artifactKind === "geo-agent-playbook-pack") {
|
|
172
|
+
return detected.parsed?.playbookStatus === "closeout-ready" ? "closeout" : "execute";
|
|
173
|
+
}
|
|
168
174
|
if (
|
|
169
175
|
[
|
|
170
176
|
"geo-share-pack",
|
|
@@ -415,6 +421,20 @@ function buildCommandChain(detected, intent) {
|
|
|
415
421
|
`geo-ai-search-optimization meeting-pack ${source}`,
|
|
416
422
|
`geo-ai-search-optimization publish-pack ${source}`
|
|
417
423
|
];
|
|
424
|
+
case "geo-agent-playbook-pack": {
|
|
425
|
+
const baseSource = detected.parsed?.source || source;
|
|
426
|
+
return detected.parsed?.playbookStatus === "closeout-ready"
|
|
427
|
+
? [
|
|
428
|
+
detected.parsed?.startCommand || `geo-ai-search-optimization completion-report ${baseSource}`,
|
|
429
|
+
`geo-ai-search-optimization meeting-pack ${baseSource}`,
|
|
430
|
+
`geo-ai-search-optimization publish-pack ${baseSource}`
|
|
431
|
+
]
|
|
432
|
+
: [
|
|
433
|
+
detected.parsed?.startCommand || `geo-ai-search-optimization agent-executor ${baseSource}`,
|
|
434
|
+
`geo-ai-search-optimization agent-status-board ${baseSource}`,
|
|
435
|
+
`geo-ai-search-optimization agent-decision-log ${baseSource}`
|
|
436
|
+
];
|
|
437
|
+
}
|
|
418
438
|
case "geo-apply-plan":
|
|
419
439
|
return [
|
|
420
440
|
`geo-ai-search-optimization agent-executor ${source}`,
|
|
@@ -500,6 +520,8 @@ function pickSkillName(detected, intent) {
|
|
|
500
520
|
return "geo-ai-search-optimization-agent-decision-log";
|
|
501
521
|
case "geo-agent-retrospective":
|
|
502
522
|
return "geo-ai-search-optimization-agent-retrospective";
|
|
523
|
+
case "geo-agent-playbook-pack":
|
|
524
|
+
return "geo-ai-search-optimization-agent-playbook-pack";
|
|
503
525
|
case "geo-completion-report":
|
|
504
526
|
return "geo-ai-search-optimization-completion-report";
|
|
505
527
|
case "geo-handoff-bundle":
|
|
@@ -541,6 +563,7 @@ function buildSecondarySkillNames(primarySkill, intent, detected) {
|
|
|
541
563
|
"geo-agent-status-board",
|
|
542
564
|
"geo-agent-checkpoint",
|
|
543
565
|
"geo-agent-decision-log",
|
|
566
|
+
"geo-agent-playbook-pack",
|
|
544
567
|
"geo-apply-plan"
|
|
545
568
|
].includes(
|
|
546
569
|
detected.artifactKind
|
|
@@ -551,6 +574,7 @@ function buildSecondarySkillNames(primarySkill, intent, detected) {
|
|
|
551
574
|
names.add("geo-ai-search-optimization-agent-status-board");
|
|
552
575
|
names.add("geo-ai-search-optimization-agent-checkpoint");
|
|
553
576
|
names.add("geo-ai-search-optimization-agent-decision-log");
|
|
577
|
+
names.add("geo-ai-search-optimization-agent-playbook-pack");
|
|
554
578
|
names.add("geo-ai-search-optimization-agent-executor");
|
|
555
579
|
names.add("geo-ai-search-optimization-agent-runbook");
|
|
556
580
|
names.add("geo-ai-search-optimization-agent-handoff");
|
|
@@ -586,6 +610,7 @@ function buildStage(intent, detected) {
|
|
|
586
610
|
"geo-agent-status-board",
|
|
587
611
|
"geo-agent-checkpoint",
|
|
588
612
|
"geo-agent-decision-log",
|
|
613
|
+
"geo-agent-playbook-pack",
|
|
589
614
|
"geo-agent-retrospective",
|
|
590
615
|
"geo-apply-plan",
|
|
591
616
|
"geo-handoff-bundle"
|
|
@@ -604,6 +629,7 @@ function buildStage(intent, detected) {
|
|
|
604
629
|
"geo-agent-status-board",
|
|
605
630
|
"geo-agent-checkpoint",
|
|
606
631
|
"geo-agent-decision-log",
|
|
632
|
+
"geo-agent-playbook-pack",
|
|
607
633
|
"geo-agent-retrospective",
|
|
608
634
|
"geo-apply-plan",
|
|
609
635
|
"geo-handoff-bundle"
|
|
@@ -697,6 +723,9 @@ function buildNextAction(detected, intent, commands) {
|
|
|
697
723
|
if (detected.artifactKind === "geo-agent-decision-log") {
|
|
698
724
|
return `先运行 \`${commands[0]}\`,沿着最近一次阶段决策继续推进,而不是重新判断整条链。`;
|
|
699
725
|
}
|
|
726
|
+
if (detected.artifactKind === "geo-agent-playbook-pack") {
|
|
727
|
+
return `先运行 \`${commands[0]}\`,直接沿着 playbook 的起始命令继续,不要重新拆链。`;
|
|
728
|
+
}
|
|
700
729
|
return `先运行 \`${commands[0]}\`,把当前输入推进到 agent 可执行状态。`;
|
|
701
730
|
}
|
|
702
731
|
if (intent === "closeout") {
|
package/src/cli.js
CHANGED
|
@@ -16,6 +16,11 @@ import {
|
|
|
16
16
|
} from "./agent-progress-tracker.js";
|
|
17
17
|
import { createAgentCheckpoint, renderAgentCheckpointMarkdown, writeAgentCheckpointOutput } from "./agent-checkpoint.js";
|
|
18
18
|
import { createAgentDecisionLog, renderAgentDecisionLogMarkdown, writeAgentDecisionLogOutput } from "./agent-decision-log.js";
|
|
19
|
+
import {
|
|
20
|
+
createAgentPlaybookPack,
|
|
21
|
+
renderAgentPlaybookPackMarkdown,
|
|
22
|
+
writeAgentPlaybookPackOutput
|
|
23
|
+
} from "./agent-playbook-pack.js";
|
|
19
24
|
import { createAgentRetrospective, renderAgentRetrospectiveMarkdown, writeAgentRetrospectiveOutput } from "./agent-retrospective.js";
|
|
20
25
|
import { createAgentStatusBoard, renderAgentStatusBoardMarkdown, writeAgentStatusBoardOutput } from "./agent-status-board.js";
|
|
21
26
|
import { createAgentRunbook, renderAgentRunbookMarkdown, writeAgentRunbookOutput } from "./agent-runbook.js";
|
|
@@ -85,6 +90,7 @@ function printHelp() {
|
|
|
85
90
|
" geo-ai-search-optimization agent-checkpoint <input> [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
|
|
86
91
|
" geo-ai-search-optimization agent-decision-log <input> [--append-from <file>] [--note <text>] [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
|
|
87
92
|
" geo-ai-search-optimization agent-retrospective <input> [--format <markdown|json>] [--out <file>]",
|
|
93
|
+
" geo-ai-search-optimization agent-playbook-pack <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
|
|
88
94
|
" geo-ai-search-optimization skills [--json]",
|
|
89
95
|
" geo-ai-search-optimization where",
|
|
90
96
|
" geo-ai-search-optimization doctor [--json]",
|
|
@@ -422,6 +428,32 @@ async function handleAgentRetrospective(args) {
|
|
|
422
428
|
process.stdout.write(renderedOutput);
|
|
423
429
|
}
|
|
424
430
|
|
|
431
|
+
async function handleAgentPlaybookPack(args) {
|
|
432
|
+
const input = args.find((value) => !value.startsWith("-"));
|
|
433
|
+
if (!input) {
|
|
434
|
+
throw new Error("agent-playbook-pack 需要一个输入值,可以是项目路径、网站网址或已导出的工件");
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
|
|
438
|
+
const pack = await createAgentPlaybookPack(input, {
|
|
439
|
+
format,
|
|
440
|
+
taskId: getFlagValue(args, "--task")
|
|
441
|
+
});
|
|
442
|
+
const outputJson = pack.format === "json";
|
|
443
|
+
const renderedOutput = outputJson
|
|
444
|
+
? `${JSON.stringify(pack, null, 2)}\n`
|
|
445
|
+
: renderAgentPlaybookPackMarkdown(pack);
|
|
446
|
+
|
|
447
|
+
const outputPath = getFlagValue(args, "--out");
|
|
448
|
+
if (outputPath) {
|
|
449
|
+
const resolvedOutputPath = await writeAgentPlaybookPackOutput(outputPath, renderedOutput);
|
|
450
|
+
process.stdout.write(`已保存 agent playbook pack:${resolvedOutputPath}\n`);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
process.stdout.write(renderedOutput);
|
|
455
|
+
}
|
|
456
|
+
|
|
425
457
|
function handleWhere() {
|
|
426
458
|
process.stdout.write(
|
|
427
459
|
[
|
|
@@ -1012,6 +1044,11 @@ export async function runCli(args = []) {
|
|
|
1012
1044
|
return;
|
|
1013
1045
|
}
|
|
1014
1046
|
|
|
1047
|
+
if (command === "agent-playbook-pack") {
|
|
1048
|
+
await handleAgentPlaybookPack(rest);
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1015
1052
|
if (command === "skills") {
|
|
1016
1053
|
await handleSkills(rest);
|
|
1017
1054
|
return;
|
package/src/completion-report.js
CHANGED
|
@@ -131,6 +131,37 @@ async function resolveApplyPlan(input) {
|
|
|
131
131
|
return parsed;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
if (parsed.kind === "geo-handoff-bundle" && parsed.applyPlan?.kind === "geo-apply-plan") {
|
|
135
|
+
return parsed.applyPlan;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (parsed.kind === "geo-agent-progress-tracker" && parsed.applyPlan?.kind === "geo-apply-plan") {
|
|
139
|
+
return parsed.applyPlan;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (parsed.kind === "geo-agent-status-board" && parsed.tracker?.applyPlan?.kind === "geo-apply-plan") {
|
|
143
|
+
return parsed.tracker.applyPlan;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (parsed.kind === "geo-agent-checkpoint" && parsed.statusBoard?.tracker?.applyPlan?.kind === "geo-apply-plan") {
|
|
147
|
+
return parsed.statusBoard.tracker.applyPlan;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (parsed.kind === "geo-agent-decision-log") {
|
|
151
|
+
return createApplyPlan(parsed.source || parsed.latestCheckpoint?.source || resolvedPath, { format: "json" });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (
|
|
155
|
+
parsed.kind === "geo-agent-retrospective" &&
|
|
156
|
+
parsed.decisionLog?.latestCheckpoint?.statusBoard?.tracker?.applyPlan?.kind === "geo-apply-plan"
|
|
157
|
+
) {
|
|
158
|
+
return parsed.decisionLog.latestCheckpoint.statusBoard.tracker.applyPlan;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (parsed.kind === "geo-agent-playbook-pack" && parsed.handoffBundle?.applyPlan?.kind === "geo-apply-plan") {
|
|
162
|
+
return parsed.handoffBundle.applyPlan;
|
|
163
|
+
}
|
|
164
|
+
|
|
134
165
|
return createApplyPlan(resolvedPath, { format: "json" });
|
|
135
166
|
}
|
|
136
167
|
|
package/src/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { createApplyPlan, renderApplyPlanMarkdown, writeApplyPlanOutput } from "
|
|
|
10
10
|
export { createAgentBatchExecutor, renderAgentBatchExecutorMarkdown, writeAgentBatchExecutorOutput } from "./agent-batch-executor.js";
|
|
11
11
|
export { createAgentCheckpoint, renderAgentCheckpointMarkdown, writeAgentCheckpointOutput } from "./agent-checkpoint.js";
|
|
12
12
|
export { createAgentDecisionLog, renderAgentDecisionLogMarkdown, writeAgentDecisionLogOutput } from "./agent-decision-log.js";
|
|
13
|
+
export { createAgentPlaybookPack, renderAgentPlaybookPackMarkdown, writeAgentPlaybookPackOutput } from "./agent-playbook-pack.js";
|
|
13
14
|
export { createAgentRetrospective, renderAgentRetrospectiveMarkdown, writeAgentRetrospectiveOutput } from "./agent-retrospective.js";
|
|
14
15
|
export { createAgentHandoff, renderAgentHandoffMarkdown, writeAgentHandoffOutput } from "./agent-handoff.js";
|
|
15
16
|
export { createAgentExecutor, renderAgentExecutorMarkdown, writeAgentExecutorOutput } from "./agent-executor.js";
|
package/src/skills.js
CHANGED
|
@@ -14,6 +14,7 @@ const SKILL_ORDER = [
|
|
|
14
14
|
"geo-ai-search-optimization-agent-checkpoint",
|
|
15
15
|
"geo-ai-search-optimization-agent-decision-log",
|
|
16
16
|
"geo-ai-search-optimization-agent-retrospective",
|
|
17
|
+
"geo-ai-search-optimization-agent-playbook-pack",
|
|
17
18
|
"geo-ai-search-optimization-usage",
|
|
18
19
|
"geo-ai-search-optimization-agent-handoff",
|
|
19
20
|
"geo-ai-search-optimization-repair-loop",
|
|
@@ -37,6 +38,7 @@ const SKILL_CATEGORY = {
|
|
|
37
38
|
"geo-ai-search-optimization-agent-checkpoint": "execution",
|
|
38
39
|
"geo-ai-search-optimization-agent-decision-log": "execution",
|
|
39
40
|
"geo-ai-search-optimization-agent-retrospective": "execution",
|
|
41
|
+
"geo-ai-search-optimization-agent-playbook-pack": "execution",
|
|
40
42
|
"geo-ai-search-optimization-usage": "guidance",
|
|
41
43
|
"geo-ai-search-optimization-agent-handoff": "execution",
|
|
42
44
|
"geo-ai-search-optimization-repair-loop": "execution",
|
|
@@ -179,6 +181,7 @@ export function renderBundledSkillsMarkdown(bundle) {
|
|
|
179
181
|
"- 如果要在每轮结束时做继续 / 阻塞 / 收尾决策,再进入 agent-checkpoint。",
|
|
180
182
|
"- 如果要把多轮决策沉淀成可继承的历史,再进入 agent-decision-log。",
|
|
181
183
|
"- 如果要总结多轮为什么推进顺利或反复卡住,再进入 agent-retrospective。",
|
|
184
|
+
"- 如果要把复盘、决策和交接压成下一位 agent 的单入口,再进入 agent-playbook-pack。",
|
|
182
185
|
"- 再看 usage skill,知道什么时候该跑哪个命令。",
|
|
183
186
|
"- 如果要交给 agent 执行,再进入 handoff / apply / completion 这一条执行链。",
|
|
184
187
|
"- 如果要产出给团队分发,再进入 share / export / html / publish 这一条交付链。",
|