geo-ai-search-optimization 1.2.16 → 1.2.18

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 CHANGED
@@ -42,6 +42,27 @@ geo-ai-search-optimization skills --json
42
42
  - agent 执行闭环相关 skills
43
43
  - 分享 / 导出 / 最终交付相关 skills
44
44
 
45
+ ## Agent Orchestrator 命令
46
+
47
+ 如果你希望 agent 不要看长链路,而是直接拿到“现在唯一该跑哪条命令”,可以直接用 `agent-orchestrator`:
48
+
49
+ ```bash
50
+ geo-ai-search-optimization agent-orchestrator "继续这个 GEO 任务"
51
+ geo-ai-search-optimization agent-orchestrator https://example.com
52
+ geo-ai-search-optimization agent-orchestrator ./your-site
53
+ geo-ai-search-optimization agent-orchestrator ./reports/agent-playbook-pack.json --format json --out ./reports/agent-orchestrator.json
54
+ ```
55
+
56
+ 它会输出:
57
+
58
+ - 当前阶段
59
+ - 为什么现在该做这一步
60
+ - 现在只该跑哪条命令
61
+ - 预期产物
62
+ - 什么时候先停下
63
+ - 做完之后下一条是什么
64
+ - 可直接复制给 agent 的 orchestrator prompt
65
+
45
66
  ## Auto Flow 命令
46
67
 
47
68
  如果你希望 agent 不用自己判断现在该用哪个 skill、该跑哪个命令,可以直接用 `auto-flow`:
@@ -246,6 +267,27 @@ geo-ai-search-optimization agent-retrospective ./reports/agent-decision-log.json
246
267
  - 多轮时间线
247
268
  - 可直接复制给 agent 的 retrospective prompt
248
269
 
270
+ ## Agent Playbook Pack 命令
271
+
272
+ 如果你希望把多轮复盘、决策历史和交接信息压成一个“下一位 agent 一拿到就能继续做”的单入口工件,可以直接用 `agent-playbook-pack`:
273
+
274
+ ```bash
275
+ geo-ai-search-optimization agent-playbook-pack ./your-site
276
+ geo-ai-search-optimization agent-playbook-pack ./reports/agent-decision-log.json
277
+ geo-ai-search-optimization agent-playbook-pack ./reports/agent-retrospective.json --format json --out ./reports/agent-playbook-pack.json
278
+ ```
279
+
280
+ `agent-playbook-pack` 会输出:
281
+
282
+ - 当前状态
283
+ - 恢复摘要
284
+ - 启动命令
285
+ - 当前包与下一包
286
+ - 先读什么
287
+ - 现在先做什么 / 现在不要做什么
288
+ - 后续命令
289
+ - 可直接复制给 agent 的 playbook prompt
290
+
249
291
  ## Quick Start
250
292
 
251
293
  如果你要从 0 到 1 启动一个 GEO 项目,建议照这个顺序做。
@@ -639,6 +681,7 @@ geo-ai-search-optimization onboard --url https://example.com --json --out ./repo
639
681
  geo-ai-search-optimization
640
682
  geo-ai-search-optimization install
641
683
  geo-ai-search-optimization install --target ./tmp/custom-skills --json
684
+ geo-ai-search-optimization agent-orchestrator ./your-site
642
685
  geo-ai-search-optimization auto-flow "audit this site and tell me the next skill"
643
686
  geo-ai-search-optimization agent-session ./your-site
644
687
  geo-ai-search-optimization agent-runbook ./your-site
@@ -649,6 +692,7 @@ geo-ai-search-optimization agent-status-board ./your-site
649
692
  geo-ai-search-optimization agent-checkpoint ./your-site
650
693
  geo-ai-search-optimization agent-decision-log ./your-site
651
694
  geo-ai-search-optimization agent-retrospective ./your-site
695
+ geo-ai-search-optimization agent-playbook-pack ./your-site
652
696
  geo-ai-search-optimization skills
653
697
  geo-ai-search-optimization where
654
698
  geo-ai-search-optimization doctor
@@ -719,6 +763,22 @@ geo-ai-search-optimization help
719
763
  - 输出 do-now checklist、stop checklist、success checklist、验证命令和回报模板
720
764
  - 新增 `geo-ai-search-optimization-agent-executor` skill
721
765
 
766
+ ## New in 1.2.18
767
+
768
+ - 新增 `agent-orchestrator`
769
+ - 把 `auto-flow + agent-session` 收敛成一个“现在只该做哪条命令”的总入口
770
+ - 输出固定 contract:`current_stage`、`why_now`、`next_command`、`expected_artifact`、`stop_if`、`after_that`
771
+ - 更适合 PM 把任务直接交给 agent,或 agent 接着前一个工件继续做
772
+ - 新增 `geo-ai-search-optimization-agent-orchestrator` skill
773
+
774
+ ## New in 1.2.17
775
+
776
+ - 新增 `agent-playbook-pack`
777
+ - 把 `agent-retrospective + agent-decision-log + handoff-bundle` 压成一个单入口执行包
778
+ - 让下一位 agent 可以直接从 current packet、start command 和 do-now checklist 继续
779
+ - `completion-report` 现在也能直接吃 retrospective / handoff bundle / playbook pack 这类工件
780
+ - 新增 `geo-ai-search-optimization-agent-playbook-pack` skill
781
+
722
782
  ## New in 1.2.16
723
783
 
724
784
  - 新增 `agent-retrospective` 命令
@@ -948,6 +1008,7 @@ The installed package now includes a bundled GEO skill pack, including:
948
1008
 
949
1009
  - `geo-ai-search-optimization`
950
1010
  - `geo-ai-search-optimization-auto-flow`
1011
+ - `geo-ai-search-optimization-agent-orchestrator`
951
1012
  - `geo-ai-search-optimization-agent-session`
952
1013
  - `geo-ai-search-optimization-agent-runbook`
953
1014
  - `geo-ai-search-optimization-agent-executor`
@@ -957,6 +1018,7 @@ The installed package now includes a bundled GEO skill pack, including:
957
1018
  - `geo-ai-search-optimization-agent-checkpoint`
958
1019
  - `geo-ai-search-optimization-agent-decision-log`
959
1020
  - `geo-ai-search-optimization-agent-retrospective`
1021
+ - `geo-ai-search-optimization-agent-playbook-pack`
960
1022
  - `geo-ai-search-optimization-usage`
961
1023
  - `geo-ai-search-optimization-agent-handoff`
962
1024
  - `geo-ai-search-optimization-repair-loop`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geo-ai-search-optimization",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "description": "Install and run a Generative Engine Optimization (GEO)-first, SEO-supported Codex skill for website optimization.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,6 +32,16 @@ Best for:
32
32
  - turning one-line task briefs into a concrete command sequence
33
33
  - deciding whether the work should move into diagnosis, execution, closeout, or delivery
34
34
 
35
+ ### `geo-ai-search-optimization-agent-orchestrator`
36
+
37
+ Use this when the next agent should get one immediate next command instead of reading a full command chain.
38
+
39
+ Best for:
40
+
41
+ - deciding the one command to run now
42
+ - returning a short contract with expected artifact, stop conditions, and follow-up command
43
+ - reducing ambiguity for PM-to-agent or agent-to-agent handoffs
44
+
35
45
  ### `geo-ai-search-optimization-agent-session`
36
46
 
37
47
  Use this when the next agent needs a runnable session plan, not just a routing answer.
@@ -122,6 +132,16 @@ Best for:
122
132
  - turning decision history into lessons learned and next-round advice
123
133
  - producing a cross-round retrospective before meetings, closeout, or final delivery
124
134
 
135
+ ### `geo-ai-search-optimization-agent-playbook-pack`
136
+
137
+ Use this when the next agent should get one single-entry resume pack instead of piecing together retrospective, decision history, and handoff artifacts manually.
138
+
139
+ Best for:
140
+
141
+ - handing one GEO artifact to the next agent and saying "continue from here"
142
+ - compressing multi-round history into one current packet, one start command, and one follow-up chain
143
+ - reducing restart risk after several GEO rounds or multiple handoffs
144
+
125
145
  ## Usage guide
126
146
 
127
147
  ### `geo-ai-search-optimization-usage`
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: geo-ai-search-optimization-agent-orchestrator
3
+ description: Choose the one next GEO command an agent should run right now. Use when an agent, PM, or another workflow has a GEO URL, codebase, task brief, or artifact and wants a single next command, expected artifact, stop conditions, and follow-up command instead of a full chain.
4
+ ---
5
+
6
+ # GEO Agent Orchestrator
7
+
8
+ Use this skill when the next agent should not browse a long command chain.
9
+
10
+ `GEO = Generative Engine Optimization`
11
+
12
+ ## What it does
13
+
14
+ - turns a GEO input into one immediate next command
15
+ - explains why this command should run now
16
+ - shows what artifact should come out of that command
17
+ - tells the next agent when to stop and what to run after that
18
+
19
+ ## Best use
20
+
21
+ - when PM wants the next agent to start without reading the whole GEO stack
22
+ - when another agent says "just tell me the next command"
23
+ - when GEO work should continue from a URL, codebase, playbook pack, decision log, or other GEO artifact with minimal ambiguity
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "GEO Agent Orchestrator"
3
+ short_description: "Choose the one next GEO command to run now"
4
+ default_prompt: "Use $geo-ai-search-optimization-agent-orchestrator to pick the one next GEO command to run now, explain why, define the expected artifact, and list stop conditions plus the follow-up command."
@@ -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,37 +13,40 @@ 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-three layers:
17
-
18
- 1. `auto-flow`: auto-select the next skill and command chain
19
- 2. `agent-session`: build a runnable session for the next agent
20
- 3. `agent-runbook`: execution manual and checklist for the next agent
21
- 4. `agent-executor`: choose one packet to execute right now
22
- 5. `agent-batch-executor`: queue the first few packets, but still advance one packet at a time
23
- 6. `agent-progress-tracker`: track which packet is done, which one is active, and what comes next
24
- 7. `agent-status-board`: turn the execution state into a board view for PM and agents
25
- 8. `agent-checkpoint`: freeze the current round into a continue / unblock / closeout decision
26
- 9. `agent-decision-log`: preserve why each round continued, paused, or closed out
27
- 10. `agent-retrospective`: explain multi-round patterns, lessons, and next-round advice
28
- 11. `skills`: inspect the bundled skill package
29
- 12. `onboard-url` / `onboard`: first look
30
- 13. `scan`: raw signal check
31
- 14. `audit` / `report`: diagnosis
32
- 15. `fix-plan` / `owner-board`: execution planning
33
- 16. `agent-handoff`: agent takeover package
34
- 17. `apply-plan`: execution loop
35
- 18. `completion-report`: closeout
36
- 19. `handoff-bundle`: all-in-one package
37
- 20. `share-pack`: audience-ready delivery
38
- 21. `export-pack`: folder export
39
- 22. `html-pack` / `publish-pack`: browsable and final delivery output
40
- 23. `pm-brief` / `roadmap`: stakeholder alignment
16
+ The package is best explained as twenty-five layers:
17
+
18
+ 1. `agent-orchestrator`: choose the one next GEO command to run right now
19
+ 2. `auto-flow`: auto-select the next skill and command chain
20
+ 3. `agent-session`: build a runnable session for the next agent
21
+ 4. `agent-runbook`: execution manual and checklist for the next agent
22
+ 5. `agent-executor`: choose one packet to execute right now
23
+ 6. `agent-batch-executor`: queue the first few packets, but still advance one packet at a time
24
+ 7. `agent-progress-tracker`: track which packet is done, which one is active, and what comes next
25
+ 8. `agent-status-board`: turn the execution state into a board view for PM and agents
26
+ 9. `agent-checkpoint`: freeze the current round into a continue / unblock / closeout decision
27
+ 10. `agent-decision-log`: preserve why each round continued, paused, or closed out
28
+ 11. `agent-retrospective`: explain multi-round patterns, lessons, and next-round advice
29
+ 12. `agent-playbook-pack`: compress retrospective, decision history, and handoff into one resume entrypoint
30
+ 13. `skills`: inspect the bundled skill package
31
+ 14. `onboard-url` / `onboard`: first look
32
+ 15. `scan`: raw signal check
33
+ 16. `audit` / `report`: diagnosis
34
+ 17. `fix-plan` / `owner-board`: execution planning
35
+ 18. `agent-handoff`: agent takeover package
36
+ 19. `apply-plan`: execution loop
37
+ 20. `completion-report`: closeout
38
+ 21. `handoff-bundle`: all-in-one package
39
+ 22. `share-pack`: audience-ready delivery
40
+ 23. `export-pack`: folder export
41
+ 24. `html-pack` / `publish-pack`: browsable and final delivery output
42
+ 25. `pm-brief` / `roadmap`: stakeholder alignment
41
43
 
42
44
  ## Recommended command order
43
45
 
44
46
  If the user only has a website URL:
45
47
 
46
48
  ```bash
49
+ npx geo-ai-search-optimization agent-orchestrator https://example.com
47
50
  npx geo-ai-search-optimization auto-flow https://example.com
48
51
  npx geo-ai-search-optimization agent-session https://example.com
49
52
  npx geo-ai-search-optimization agent-runbook https://example.com
@@ -54,6 +57,7 @@ npx geo-ai-search-optimization agent-status-board https://example.com
54
57
  npx geo-ai-search-optimization agent-checkpoint https://example.com
55
58
  npx geo-ai-search-optimization agent-decision-log https://example.com
56
59
  npx geo-ai-search-optimization agent-retrospective https://example.com
60
+ npx geo-ai-search-optimization agent-playbook-pack https://example.com
57
61
  npx geo-ai-search-optimization onboard-url https://example.com
58
62
  npx geo-ai-search-optimization pm-brief https://example.com
59
63
  npx geo-ai-search-optimization roadmap https://example.com
@@ -62,6 +66,7 @@ npx geo-ai-search-optimization roadmap https://example.com
62
66
  If the user has the website codebase:
63
67
 
64
68
  ```bash
69
+ npx geo-ai-search-optimization agent-orchestrator ./your-site
65
70
  npx geo-ai-search-optimization auto-flow ./your-site
66
71
  npx geo-ai-search-optimization agent-session ./your-site
67
72
  npx geo-ai-search-optimization agent-runbook ./your-site
@@ -72,6 +77,7 @@ npx geo-ai-search-optimization agent-status-board ./your-site
72
77
  npx geo-ai-search-optimization agent-checkpoint ./your-site
73
78
  npx geo-ai-search-optimization agent-decision-log ./your-site
74
79
  npx geo-ai-search-optimization agent-retrospective ./your-site
80
+ npx geo-ai-search-optimization agent-playbook-pack ./your-site
75
81
  npx geo-ai-search-optimization scan ./your-site
76
82
  npx geo-ai-search-optimization audit ./your-site
77
83
  npx geo-ai-search-optimization fix-plan ./your-site
@@ -89,6 +95,7 @@ npx geo-ai-search-optimization roadmap ./your-site
89
95
 
90
96
  ## When to recommend each command
91
97
 
98
+ - `agent-orchestrator`: choose the one next GEO command to run now, plus expected artifact, stop conditions, and follow-up command
92
99
  - `auto-flow`: auto-select the next skill and command order from a task brief, URL, project path, or GEO artifact
93
100
  - `agent-session`: build a step-by-step session packet for the next agent from the same kinds of inputs
94
101
  - `agent-runbook`: build a checklist-driven runbook with preflight, validation, and reporting rules
@@ -99,6 +106,7 @@ npx geo-ai-search-optimization roadmap ./your-site
99
106
  - `agent-checkpoint`: convert the current round into a checkpoint decision for continue, unblock, or closeout
100
107
  - `agent-decision-log`: preserve multiple rounds of checkpoint history so the next agent can inherit the reasoning
101
108
  - `agent-retrospective`: explain why the last few rounds advanced or stalled, and turn that into lessons and next-round guidance
109
+ - `agent-playbook-pack`: compress retrospective, decision history, and handoff into one single-entry resume pack for the next agent
102
110
  - `onboard-url`: first-time website check from a live URL
103
111
  - `onboard`: interactive first-time onboarding
104
112
  - `skills`: list the bundled skills and decide which skill or command chain fits the task
@@ -123,6 +131,7 @@ npx geo-ai-search-optimization roadmap ./your-site
123
131
  When explaining the tool to a user:
124
132
 
125
133
  - prefer telling them which command to run next, not listing every command
134
+ - if the user or next agent wants just one next command, move them to `agent-orchestrator`
126
135
  - if the user or the next agent is unsure where to start, move them to `auto-flow` first
127
136
  - if the user wants something the next agent can follow step by step, move them to `agent-session`
128
137
  - if the user wants the next agent to follow a checklist and execution manual, move them to `agent-runbook`
@@ -133,6 +142,7 @@ When explaining the tool to a user:
133
142
  - if the user wants a per-round decision artifact that says continue, unblock, or close out, move them to `agent-checkpoint`
134
143
  - if the user wants cross-round decision memory and not just one checkpoint, move them to `agent-decision-log`
135
144
  - if the user wants to understand why multiple rounds kept advancing or getting stuck, move them to `agent-retrospective`
145
+ - if the user wants one artifact that the next agent can take over from immediately, move them to `agent-playbook-pack`
136
146
  - explain the result in PM language, not implementation jargon
137
147
  - if the user sounds new, start with `onboard-url` or `quick-start`
138
148
  - if the user wants another agent to take over, move them to `agent-handoff`
@@ -0,0 +1,191 @@
1
+ import { createAgentSession } from "./agent-session.js";
2
+ import { writeScanOutput } from "./scan.js";
3
+
4
+ const VALID_FORMATS = new Set(["markdown", "json"]);
5
+
6
+ function normalizeFormat(format) {
7
+ const resolved = (format || "markdown").toLowerCase();
8
+ if (!VALID_FORMATS.has(resolved)) {
9
+ throw new Error(`不支持的 agent-orchestrator 格式:${format}。可选值:${Array.from(VALID_FORMATS).join(", ")}`);
10
+ }
11
+ return resolved;
12
+ }
13
+
14
+ function inferOrchestrationMode(session) {
15
+ if (session.status === "needs-context") {
16
+ return "needs-context";
17
+ }
18
+ if (session.intent === "share") {
19
+ return "delivery";
20
+ }
21
+ if (session.intent === "closeout") {
22
+ return "closeout";
23
+ }
24
+ if (session.intent === "execute") {
25
+ return "execution";
26
+ }
27
+ if (session.intent === "guide") {
28
+ return "guidance";
29
+ }
30
+ return "diagnosis";
31
+ }
32
+
33
+ function buildWhyNow(session, nextStep) {
34
+ if (!nextStep) {
35
+ return "当前还没有足够上下文来确定下一步命令,先补输入。";
36
+ }
37
+
38
+ if (session.artifactKind === "geo-agent-playbook-pack") {
39
+ return "当前已经有单入口 playbook,不应该重新规划整条链,直接沿着既有恢复点继续最稳。";
40
+ }
41
+ if (session.artifactKind === "geo-agent-decision-log") {
42
+ return "当前已经有跨轮决策历史,下一步应沿着最近一次决策继续,而不是重新做全量判断。";
43
+ }
44
+ if (session.artifactKind === "geo-agent-retrospective") {
45
+ return "当前已经有多轮复盘,下一步应该把复盘结论转成正式动作,而不是回到最前面的扫描阶段。";
46
+ }
47
+ if (session.sourceType === "url" && session.intent === "execute") {
48
+ return "当前只有公开网址,最重要的是先把建议型执行入口建立好,再决定是否需要仓库上下文。";
49
+ }
50
+
51
+ return `${session.whyThisSkill} 当前最该先跑的是 ${nextStep.commandName},因为它会直接产出下一阶段需要的关键工件。`;
52
+ }
53
+
54
+ function buildStopIf(session, nextStep) {
55
+ const items = [...session.contextNeeded];
56
+
57
+ if (session.sourceType === "url" && session.intent === "execute") {
58
+ items.push("只有网址时,不要宣称已经完成代码级修复。");
59
+ }
60
+ if (session.artifactKind === "geo-agent-playbook-pack") {
61
+ items.push("不要绕开 playbook 重新拆一条新链,除非当前 playbook 已明显过时。");
62
+ }
63
+ if (nextStep?.commandName === "agent-executor") {
64
+ items.push("不要同时展开多个任务包;这一轮先推进当前单包。");
65
+ }
66
+ if (nextStep?.commandName === "completion-report") {
67
+ items.push("如果这一轮还没有完成或没有明确验证结果,不要过早进入 closeout。");
68
+ }
69
+ if (nextStep?.commandName === "publish-pack") {
70
+ items.push("如果前面的 completion-report 或 share 结果还不完整,不要直接产出最终交付包。");
71
+ }
72
+
73
+ return Array.from(new Set(items));
74
+ }
75
+
76
+ function buildAfterThat(session) {
77
+ return session.steps[1]?.command || null;
78
+ }
79
+
80
+ function buildOrchestratorPrompt(orchestrator) {
81
+ const lines = [
82
+ `Use $${orchestrator.selectedSkill.name} to continue this GEO task.`,
83
+ `当前输入:${orchestrator.source}`,
84
+ `当前阶段:${orchestrator.current_stage}`,
85
+ `当前模式:${orchestrator.orchestration_mode}`,
86
+ `为什么现在做这一步:${orchestrator.why_now}`
87
+ ];
88
+
89
+ if (orchestrator.next_command) {
90
+ lines.push(`现在只运行这一条命令:${orchestrator.next_command}`);
91
+ }
92
+ if (orchestrator.expected_artifact) {
93
+ lines.push(`预期产物:${orchestrator.expected_artifact}`);
94
+ }
95
+ if (orchestrator.after_that) {
96
+ lines.push(`完成后下一条:${orchestrator.after_that}`);
97
+ }
98
+ if (orchestrator.stop_if.length > 0) {
99
+ lines.push("出现以下情况就先停下:");
100
+ for (const item of orchestrator.stop_if) {
101
+ lines.push(`- ${item}`);
102
+ }
103
+ }
104
+
105
+ lines.push("输出时先说明为什么执行这一步,再说明得到什么,以及之后怎么继续。");
106
+ return lines.join("\n");
107
+ }
108
+
109
+ export async function createAgentOrchestrator(input, options = {}) {
110
+ const format = normalizeFormat(options.format);
111
+ const session = await createAgentSession(input, {
112
+ intent: options.intent
113
+ });
114
+ const nextStep = session.steps[0] || null;
115
+
116
+ const orchestrator = {
117
+ kind: "geo-agent-orchestrator",
118
+ input,
119
+ source: session.source,
120
+ sourceType: session.sourceType,
121
+ artifactKind: session.artifactKind,
122
+ format,
123
+ orchestration_mode: inferOrchestrationMode(session),
124
+ current_stage: session.stage,
125
+ why_now: buildWhyNow(session, nextStep),
126
+ next_command: nextStep?.command || null,
127
+ expected_artifact: nextStep?.expectedArtifact || null,
128
+ stop_if: buildStopIf(session, nextStep),
129
+ after_that: buildAfterThat(session),
130
+ selectedSkill: session.selectedSkill,
131
+ next_skill: nextStep?.suggestedSkill || session.selectedSkill.name,
132
+ session_status: session.status,
133
+ next_action: session.nextAction,
134
+ session,
135
+ orchestrator_prompt: ""
136
+ };
137
+
138
+ orchestrator.orchestrator_prompt = buildOrchestratorPrompt(orchestrator);
139
+ return orchestrator;
140
+ }
141
+
142
+ export function renderAgentOrchestratorMarkdown(orchestrator) {
143
+ const lines = [
144
+ "# GEO Agent Orchestrator",
145
+ "",
146
+ `- 输入:\`${orchestrator.source}\``,
147
+ `- 输入类型:\`${orchestrator.sourceType}\``,
148
+ `- 工件类型:\`${orchestrator.artifactKind}\``,
149
+ `- 当前阶段:${orchestrator.current_stage}`,
150
+ `- orchestration mode:\`${orchestrator.orchestration_mode}\``,
151
+ `- 当前建议 skill:\`${orchestrator.next_skill}\``,
152
+ "",
153
+ "## 为什么现在做这一步",
154
+ "",
155
+ `- ${orchestrator.why_now}`,
156
+ "",
157
+ "## 现在只做这一条",
158
+ "",
159
+ `- 命令:\`${orchestrator.next_command || "先补输入"}\``,
160
+ `- 预期产物:${orchestrator.expected_artifact || "先明确需要什么上下文"}`,
161
+ ""
162
+ ];
163
+
164
+ if (orchestrator.after_that) {
165
+ lines.push("## 做完之后", "", `- 下一条:\`${orchestrator.after_that}\``, "");
166
+ }
167
+
168
+ lines.push("## 什么时候先停下", "");
169
+ if (orchestrator.stop_if.length === 0) {
170
+ lines.push("- 当前没有额外 stop 条件。");
171
+ } else {
172
+ for (const item of orchestrator.stop_if) {
173
+ lines.push(`- ${item}`);
174
+ }
175
+ }
176
+
177
+ lines.push(
178
+ "",
179
+ "## 可直接复制给 Agent 的 Orchestrator Prompt",
180
+ "",
181
+ "```text",
182
+ orchestrator.orchestrator_prompt,
183
+ "```"
184
+ );
185
+
186
+ return `${lines.join("\n")}\n`;
187
+ }
188
+
189
+ export async function writeAgentOrchestratorOutput(outputPath, content) {
190
+ return writeScanOutput(outputPath, content);
191
+ }
@@ -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
+ }
@@ -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,16 @@ 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
+ createAgentOrchestrator,
21
+ renderAgentOrchestratorMarkdown,
22
+ writeAgentOrchestratorOutput
23
+ } from "./agent-orchestrator.js";
24
+ import {
25
+ createAgentPlaybookPack,
26
+ renderAgentPlaybookPackMarkdown,
27
+ writeAgentPlaybookPackOutput
28
+ } from "./agent-playbook-pack.js";
19
29
  import { createAgentRetrospective, renderAgentRetrospectiveMarkdown, writeAgentRetrospectiveOutput } from "./agent-retrospective.js";
20
30
  import { createAgentStatusBoard, renderAgentStatusBoardMarkdown, writeAgentStatusBoardOutput } from "./agent-status-board.js";
21
31
  import { createAgentRunbook, renderAgentRunbookMarkdown, writeAgentRunbookOutput } from "./agent-runbook.js";
@@ -75,6 +85,7 @@ function printHelp() {
75
85
  "Usage:",
76
86
  " geo-ai-search-optimization",
77
87
  " geo-ai-search-optimization install [--target <dir>] [--json]",
88
+ " geo-ai-search-optimization agent-orchestrator <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--format <markdown|json>] [--out <file>]",
78
89
  " geo-ai-search-optimization auto-flow <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--json] [--out <file>]",
79
90
  " geo-ai-search-optimization agent-session <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--json] [--out <file>]",
80
91
  " geo-ai-search-optimization agent-runbook <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--task <id>] [--format <markdown|json>] [--out <file>]",
@@ -85,6 +96,7 @@ function printHelp() {
85
96
  " geo-ai-search-optimization agent-checkpoint <input> [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
86
97
  " 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
98
  " geo-ai-search-optimization agent-retrospective <input> [--format <markdown|json>] [--out <file>]",
99
+ " geo-ai-search-optimization agent-playbook-pack <input> [--task <id>] [--format <markdown|json>] [--out <file>]",
88
100
  " geo-ai-search-optimization skills [--json]",
89
101
  " geo-ai-search-optimization where",
90
102
  " geo-ai-search-optimization doctor [--json]",
@@ -177,6 +189,32 @@ async function handleAutoFlow(args) {
177
189
  process.stdout.write(renderedOutput);
178
190
  }
179
191
 
192
+ async function handleAgentOrchestrator(args) {
193
+ const input = args.find((value) => !value.startsWith("-"));
194
+ if (!input) {
195
+ throw new Error("agent-orchestrator 需要一个输入值,可以是任务描述、项目路径、网站网址或已导出的工件");
196
+ }
197
+
198
+ const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
199
+ const orchestrator = await createAgentOrchestrator(input, {
200
+ intent: getFlagValue(args, "--intent"),
201
+ format
202
+ });
203
+ const outputJson = orchestrator.format === "json";
204
+ const renderedOutput = outputJson
205
+ ? `${JSON.stringify(orchestrator, null, 2)}\n`
206
+ : renderAgentOrchestratorMarkdown(orchestrator);
207
+
208
+ const outputPath = getFlagValue(args, "--out");
209
+ if (outputPath) {
210
+ const resolvedOutputPath = await writeAgentOrchestratorOutput(outputPath, renderedOutput);
211
+ process.stdout.write(`已保存 agent-orchestrator 结果:${resolvedOutputPath}\n`);
212
+ return;
213
+ }
214
+
215
+ process.stdout.write(renderedOutput);
216
+ }
217
+
180
218
  async function handleAgentSession(args) {
181
219
  const input = args.find((value) => !value.startsWith("-"));
182
220
  if (!input) {
@@ -422,6 +460,32 @@ async function handleAgentRetrospective(args) {
422
460
  process.stdout.write(renderedOutput);
423
461
  }
424
462
 
463
+ async function handleAgentPlaybookPack(args) {
464
+ const input = args.find((value) => !value.startsWith("-"));
465
+ if (!input) {
466
+ throw new Error("agent-playbook-pack 需要一个输入值,可以是项目路径、网站网址或已导出的工件");
467
+ }
468
+
469
+ const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
470
+ const pack = await createAgentPlaybookPack(input, {
471
+ format,
472
+ taskId: getFlagValue(args, "--task")
473
+ });
474
+ const outputJson = pack.format === "json";
475
+ const renderedOutput = outputJson
476
+ ? `${JSON.stringify(pack, null, 2)}\n`
477
+ : renderAgentPlaybookPackMarkdown(pack);
478
+
479
+ const outputPath = getFlagValue(args, "--out");
480
+ if (outputPath) {
481
+ const resolvedOutputPath = await writeAgentPlaybookPackOutput(outputPath, renderedOutput);
482
+ process.stdout.write(`已保存 agent playbook pack:${resolvedOutputPath}\n`);
483
+ return;
484
+ }
485
+
486
+ process.stdout.write(renderedOutput);
487
+ }
488
+
425
489
  function handleWhere() {
426
490
  process.stdout.write(
427
491
  [
@@ -967,6 +1031,11 @@ export async function runCli(args = []) {
967
1031
  return;
968
1032
  }
969
1033
 
1034
+ if (command === "agent-orchestrator") {
1035
+ await handleAgentOrchestrator(rest);
1036
+ return;
1037
+ }
1038
+
970
1039
  if (command === "agent-session") {
971
1040
  await handleAgentSession(rest);
972
1041
  return;
@@ -1012,6 +1081,11 @@ export async function runCli(args = []) {
1012
1081
  return;
1013
1082
  }
1014
1083
 
1084
+ if (command === "agent-playbook-pack") {
1085
+ await handleAgentPlaybookPack(rest);
1086
+ return;
1087
+ }
1088
+
1015
1089
  if (command === "skills") {
1016
1090
  await handleSkills(rest);
1017
1091
  return;
@@ -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
@@ -7,9 +7,11 @@ export {
7
7
  } from "./interactive-onboarding.js";
8
8
  export { createAutoFlow, renderAutoFlowMarkdown, writeAutoFlowOutput } from "./auto-flow.js";
9
9
  export { createApplyPlan, renderApplyPlanMarkdown, writeApplyPlanOutput } from "./apply-plan.js";
10
+ export { createAgentOrchestrator, renderAgentOrchestratorMarkdown, writeAgentOrchestratorOutput } from "./agent-orchestrator.js";
10
11
  export { createAgentBatchExecutor, renderAgentBatchExecutorMarkdown, writeAgentBatchExecutorOutput } from "./agent-batch-executor.js";
11
12
  export { createAgentCheckpoint, renderAgentCheckpointMarkdown, writeAgentCheckpointOutput } from "./agent-checkpoint.js";
12
13
  export { createAgentDecisionLog, renderAgentDecisionLogMarkdown, writeAgentDecisionLogOutput } from "./agent-decision-log.js";
14
+ export { createAgentPlaybookPack, renderAgentPlaybookPackMarkdown, writeAgentPlaybookPackOutput } from "./agent-playbook-pack.js";
13
15
  export { createAgentRetrospective, renderAgentRetrospectiveMarkdown, writeAgentRetrospectiveOutput } from "./agent-retrospective.js";
14
16
  export { createAgentHandoff, renderAgentHandoffMarkdown, writeAgentHandoffOutput } from "./agent-handoff.js";
15
17
  export { createAgentExecutor, renderAgentExecutorMarkdown, writeAgentExecutorOutput } from "./agent-executor.js";
package/src/skills.js CHANGED
@@ -5,6 +5,7 @@ import { getPackageRoot } from "./paths.js";
5
5
  const SKILL_ORDER = [
6
6
  "geo-ai-search-optimization",
7
7
  "geo-ai-search-optimization-auto-flow",
8
+ "geo-ai-search-optimization-agent-orchestrator",
8
9
  "geo-ai-search-optimization-agent-session",
9
10
  "geo-ai-search-optimization-agent-runbook",
10
11
  "geo-ai-search-optimization-agent-executor",
@@ -14,6 +15,7 @@ const SKILL_ORDER = [
14
15
  "geo-ai-search-optimization-agent-checkpoint",
15
16
  "geo-ai-search-optimization-agent-decision-log",
16
17
  "geo-ai-search-optimization-agent-retrospective",
18
+ "geo-ai-search-optimization-agent-playbook-pack",
17
19
  "geo-ai-search-optimization-usage",
18
20
  "geo-ai-search-optimization-agent-handoff",
19
21
  "geo-ai-search-optimization-repair-loop",
@@ -28,6 +30,7 @@ const SKILL_ORDER = [
28
30
  const SKILL_CATEGORY = {
29
31
  "geo-ai-search-optimization": "core",
30
32
  "geo-ai-search-optimization-auto-flow": "routing",
33
+ "geo-ai-search-optimization-agent-orchestrator": "routing",
31
34
  "geo-ai-search-optimization-agent-session": "routing",
32
35
  "geo-ai-search-optimization-agent-runbook": "execution",
33
36
  "geo-ai-search-optimization-agent-executor": "execution",
@@ -37,6 +40,7 @@ const SKILL_CATEGORY = {
37
40
  "geo-ai-search-optimization-agent-checkpoint": "execution",
38
41
  "geo-ai-search-optimization-agent-decision-log": "execution",
39
42
  "geo-ai-search-optimization-agent-retrospective": "execution",
43
+ "geo-ai-search-optimization-agent-playbook-pack": "execution",
40
44
  "geo-ai-search-optimization-usage": "guidance",
41
45
  "geo-ai-search-optimization-agent-handoff": "execution",
42
46
  "geo-ai-search-optimization-repair-loop": "execution",
@@ -169,6 +173,7 @@ export function renderBundledSkillsMarkdown(bundle) {
169
173
  "## 推荐理解顺序",
170
174
  "",
171
175
  "- 先看核心 GEO skill。",
176
+ "- 如果你只想让 agent 立刻知道现在唯一该跑哪条命令,先跑 agent-orchestrator。",
172
177
  "- 如果 agent 需要自动选 skill,先跑 auto-flow。",
173
178
  "- 如果要给 agent 明确步骤,继续进入 agent-session。",
174
179
  "- 如果要给 agent 一份执行手册和检查表,再进入 agent-runbook。",
@@ -179,6 +184,7 @@ export function renderBundledSkillsMarkdown(bundle) {
179
184
  "- 如果要在每轮结束时做继续 / 阻塞 / 收尾决策,再进入 agent-checkpoint。",
180
185
  "- 如果要把多轮决策沉淀成可继承的历史,再进入 agent-decision-log。",
181
186
  "- 如果要总结多轮为什么推进顺利或反复卡住,再进入 agent-retrospective。",
187
+ "- 如果要把复盘、决策和交接压成下一位 agent 的单入口,再进入 agent-playbook-pack。",
182
188
  "- 再看 usage skill,知道什么时候该跑哪个命令。",
183
189
  "- 如果要交给 agent 执行,再进入 handoff / apply / completion 这一条执行链。",
184
190
  "- 如果要产出给团队分发,再进入 share / export / html / publish 这一条交付链。",