geo-ai-search-optimization 1.2.20 → 1.3.1
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 +39 -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-state-pack/SKILL.md +44 -0
- package/resources/geo-ai-search-optimization-agent-state-pack/agents/openai.yaml +4 -0
- package/resources/geo-ai-search-optimization-usage/SKILL.md +30 -25
- package/src/agent-resume.js +3 -0
- package/src/agent-state-pack.js +260 -0
- package/src/auto-flow.js +28 -3
- package/src/cli.js +40 -0
- package/src/index.js +1 -0
- package/src/skills.js +3 -0
package/README.md
CHANGED
|
@@ -104,6 +104,26 @@ geo-ai-search-optimization agent-continue ./reports/agent-resume.json --format j
|
|
|
104
104
|
- 可以进入收尾时跑什么
|
|
105
105
|
- 可直接复制给 agent 的 continue prompt
|
|
106
106
|
|
|
107
|
+
## Agent State Pack 命令
|
|
108
|
+
|
|
109
|
+
如果你希望下一个 agent 直接拿到一份统一的当前状态工件,而不是自己拼 `agent-resume / agent-continue / agent-status-board / agent-checkpoint`,可以直接用 `agent-state-pack`:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
geo-ai-search-optimization agent-state-pack ./your-site
|
|
113
|
+
geo-ai-search-optimization agent-state-pack ./reports/agent-playbook-pack.json
|
|
114
|
+
geo-ai-search-optimization agent-state-pack ./reports/agent-continue.json --format json --out ./reports/agent-state-pack.json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
它会输出:
|
|
118
|
+
|
|
119
|
+
- 当前阶段和状态等级
|
|
120
|
+
- 现在先执行哪条命令
|
|
121
|
+
- 当前包与下一包
|
|
122
|
+
- 执行前先确认什么
|
|
123
|
+
- 执行后先验证什么
|
|
124
|
+
- 这一轮完成后要同步哪些工件
|
|
125
|
+
- 可直接复制给 agent 的 state prompt
|
|
126
|
+
|
|
107
127
|
## Auto Flow 命令
|
|
108
128
|
|
|
109
129
|
如果你希望 agent 不用自己判断现在该用哪个 skill、该跑哪个命令,可以直接用 `auto-flow`:
|
|
@@ -725,6 +745,7 @@ geo-ai-search-optimization install --target ./tmp/custom-skills --json
|
|
|
725
745
|
geo-ai-search-optimization agent-orchestrator ./your-site
|
|
726
746
|
geo-ai-search-optimization agent-resume ./your-site
|
|
727
747
|
geo-ai-search-optimization agent-continue ./your-site
|
|
748
|
+
geo-ai-search-optimization agent-state-pack ./your-site
|
|
728
749
|
geo-ai-search-optimization auto-flow "audit this site and tell me the next skill"
|
|
729
750
|
geo-ai-search-optimization agent-session ./your-site
|
|
730
751
|
geo-ai-search-optimization agent-runbook ./your-site
|
|
@@ -806,6 +827,23 @@ geo-ai-search-optimization help
|
|
|
806
827
|
- 输出 do-now checklist、stop checklist、success checklist、验证命令和回报模板
|
|
807
828
|
- 新增 `geo-ai-search-optimization-agent-executor` skill
|
|
808
829
|
|
|
830
|
+
## New in 1.3.0
|
|
831
|
+
|
|
832
|
+
- 正式进入 `1.3` 主线,把 agent-first 的执行闭环收敛成更明确的继续入口
|
|
833
|
+
- 新增 `agent-continue`
|
|
834
|
+
- 把 `agent-resume` 再推进成“继续这一轮并回写状态工件”的微闭环入口
|
|
835
|
+
- 输出 `continue_now`、`validate_after`、`update_artifacts`、`closeout_when_ready`、`report_back`
|
|
836
|
+
- `auto-flow`、`agent-session` 已能把 `playbook-pack / agent-resume / agent-continue` 统一接成继续链
|
|
837
|
+
- 新增 `geo-ai-search-optimization-agent-continue` skill
|
|
838
|
+
|
|
839
|
+
## New in 1.3.1
|
|
840
|
+
|
|
841
|
+
- 新增 `agent-state-pack`
|
|
842
|
+
- 把 `agent-resume + agent-continue + agent-status-board + agent-checkpoint` 压成一个统一状态工件
|
|
843
|
+
- 输出当前阶段、当前包、现在先执行哪条命令、执行后验证项、同步状态命令和收尾路径
|
|
844
|
+
- `auto-flow` 已能识别 `geo-agent-state-pack` 并继续往下路由
|
|
845
|
+
- 新增 `geo-ai-search-optimization-agent-state-pack` skill
|
|
846
|
+
|
|
809
847
|
## New in 1.2.20
|
|
810
848
|
|
|
811
849
|
- 新增 `agent-continue`
|
|
@@ -1070,6 +1108,7 @@ The installed package now includes a bundled GEO skill pack, including:
|
|
|
1070
1108
|
- `geo-ai-search-optimization-agent-orchestrator`
|
|
1071
1109
|
- `geo-ai-search-optimization-agent-resume`
|
|
1072
1110
|
- `geo-ai-search-optimization-agent-continue`
|
|
1111
|
+
- `geo-ai-search-optimization-agent-state-pack`
|
|
1073
1112
|
- `geo-ai-search-optimization-agent-session`
|
|
1074
1113
|
- `geo-ai-search-optimization-agent-runbook`
|
|
1075
1114
|
- `geo-ai-search-optimization-agent-executor`
|
package/package.json
CHANGED
|
@@ -62,6 +62,16 @@ Best for:
|
|
|
62
62
|
- turning a resume point into a one-round execution loop
|
|
63
63
|
- giving the next agent one execution command, one validation set, and one writeback list
|
|
64
64
|
|
|
65
|
+
### `geo-ai-search-optimization-agent-state-pack`
|
|
66
|
+
|
|
67
|
+
Use this when the next agent should get one normalized current-state artifact instead of manually stitching together resume, continue, board, and checkpoint outputs.
|
|
68
|
+
|
|
69
|
+
Best for:
|
|
70
|
+
|
|
71
|
+
- creating one state snapshot from a URL, directory, or GEO execution artifact
|
|
72
|
+
- telling the next agent what command runs now and what must be synced afterward
|
|
73
|
+
- reducing handoff ambiguity between PM, agent, and the next execution round
|
|
74
|
+
|
|
65
75
|
### `geo-ai-search-optimization-agent-session`
|
|
66
76
|
|
|
67
77
|
Use this when the next agent needs a runnable session plan, not just a routing answer.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: geo-ai-search-optimization-agent-state-pack
|
|
3
|
+
description: Normalize the current GEO execution state into one handoff-ready artifact for the next agent. Use when an agent, PM, or workflow already has a GEO URL, codebase, resume point, continue artifact, status board, checkpoint, decision log, or playbook pack and needs one current-state package with the command to run now, the validation steps, the state writeback commands, and the closeout path.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GEO Agent State Pack
|
|
7
|
+
|
|
8
|
+
Use this skill when the next agent should not piece together `agent-resume`, `agent-continue`, `agent-status-board`, and `agent-checkpoint` manually.
|
|
9
|
+
|
|
10
|
+
## What this skill should do
|
|
11
|
+
|
|
12
|
+
- create one normalized current-state artifact
|
|
13
|
+
- state what command should run now
|
|
14
|
+
- state what to validate after this round
|
|
15
|
+
- state which GEO artifacts must be written back
|
|
16
|
+
- state when the workflow is ready for closeout
|
|
17
|
+
|
|
18
|
+
## Preferred command
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx geo-ai-search-optimization agent-state-pack <input>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Where `<input>` can be:
|
|
25
|
+
|
|
26
|
+
- a website URL
|
|
27
|
+
- a local project directory
|
|
28
|
+
- a GEO JSON artifact such as `agent-resume`, `agent-continue`, `agent-status-board`, `agent-checkpoint`, or `agent-playbook-pack`
|
|
29
|
+
|
|
30
|
+
## Output expectations
|
|
31
|
+
|
|
32
|
+
Return the result in PM-readable language while keeping the command contract explicit:
|
|
33
|
+
|
|
34
|
+
- current stage
|
|
35
|
+
- state level
|
|
36
|
+
- now command
|
|
37
|
+
- expected artifact
|
|
38
|
+
- current packet
|
|
39
|
+
- next packet
|
|
40
|
+
- validation list
|
|
41
|
+
- sync-after-round commands
|
|
42
|
+
- closeout path
|
|
43
|
+
|
|
44
|
+
If the state shows blockers or missing context, say that clearly and do not pretend the next agent should already be editing code.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "GEO Agent State Pack"
|
|
3
|
+
short_description: "Normalize current GEO state for the next agent"
|
|
4
|
+
default_prompt: "Use $geo-ai-search-optimization-agent-state-pack to turn this GEO input into one current-state artifact with the command to run now, validation steps, writeback commands, and closeout path."
|
|
@@ -13,35 +13,36 @@ 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-eight layers:
|
|
17
17
|
|
|
18
18
|
1. `agent-orchestrator`: choose the one next GEO command to run right now
|
|
19
19
|
2. `agent-resume`: resume from the latest reliable GEO checkpoint instead of restarting the whole chain
|
|
20
20
|
3. `agent-continue`: continue this round and write status artifacts back after execution
|
|
21
|
-
4. `
|
|
22
|
-
5. `
|
|
23
|
-
6. `agent-
|
|
24
|
-
7. `agent-
|
|
25
|
-
8. `agent-
|
|
26
|
-
9. `agent-
|
|
27
|
-
10. `agent-
|
|
28
|
-
11. `agent-
|
|
29
|
-
12. `agent-
|
|
30
|
-
13. `agent-
|
|
31
|
-
14. `agent-
|
|
32
|
-
15. `
|
|
33
|
-
16. `
|
|
34
|
-
17. `
|
|
35
|
-
18. `
|
|
36
|
-
19. `
|
|
37
|
-
20. `
|
|
38
|
-
21. `
|
|
39
|
-
22. `
|
|
40
|
-
23. `
|
|
41
|
-
24. `
|
|
42
|
-
25. `
|
|
43
|
-
26. `
|
|
44
|
-
27. `
|
|
21
|
+
4. `agent-state-pack`: compress resume, continue, board, and checkpoint into one current-state artifact
|
|
22
|
+
5. `auto-flow`: auto-select the next skill and command chain
|
|
23
|
+
6. `agent-session`: build a runnable session for the next agent
|
|
24
|
+
7. `agent-runbook`: execution manual and checklist for the next agent
|
|
25
|
+
8. `agent-executor`: choose one packet to execute right now
|
|
26
|
+
9. `agent-batch-executor`: queue the first few packets, but still advance one packet at a time
|
|
27
|
+
10. `agent-progress-tracker`: track which packet is done, which one is active, and what comes next
|
|
28
|
+
11. `agent-status-board`: turn the execution state into a board view for PM and agents
|
|
29
|
+
12. `agent-checkpoint`: freeze the current round into a continue / unblock / closeout decision
|
|
30
|
+
13. `agent-decision-log`: preserve why each round continued, paused, or closed out
|
|
31
|
+
14. `agent-retrospective`: explain multi-round patterns, lessons, and next-round advice
|
|
32
|
+
15. `agent-playbook-pack`: compress retrospective, decision history, and handoff into one resume entrypoint
|
|
33
|
+
16. `skills`: inspect the bundled skill package
|
|
34
|
+
17. `onboard-url` / `onboard`: first look
|
|
35
|
+
18. `scan`: raw signal check
|
|
36
|
+
19. `audit` / `report`: diagnosis
|
|
37
|
+
20. `fix-plan` / `owner-board`: execution planning
|
|
38
|
+
21. `agent-handoff`: agent takeover package
|
|
39
|
+
22. `apply-plan`: execution loop
|
|
40
|
+
23. `completion-report`: closeout
|
|
41
|
+
24. `handoff-bundle`: all-in-one package
|
|
42
|
+
25. `share-pack`: audience-ready delivery
|
|
43
|
+
26. `export-pack`: folder export
|
|
44
|
+
27. `html-pack` / `publish-pack`: browsable and final delivery output
|
|
45
|
+
28. `pm-brief` / `roadmap`: stakeholder alignment
|
|
45
46
|
|
|
46
47
|
## Recommended command order
|
|
47
48
|
|
|
@@ -51,6 +52,7 @@ If the user only has a website URL:
|
|
|
51
52
|
npx geo-ai-search-optimization agent-orchestrator https://example.com
|
|
52
53
|
npx geo-ai-search-optimization agent-resume https://example.com
|
|
53
54
|
npx geo-ai-search-optimization agent-continue https://example.com
|
|
55
|
+
npx geo-ai-search-optimization agent-state-pack https://example.com
|
|
54
56
|
npx geo-ai-search-optimization auto-flow https://example.com
|
|
55
57
|
npx geo-ai-search-optimization agent-session https://example.com
|
|
56
58
|
npx geo-ai-search-optimization agent-runbook https://example.com
|
|
@@ -73,6 +75,7 @@ If the user has the website codebase:
|
|
|
73
75
|
npx geo-ai-search-optimization agent-orchestrator ./your-site
|
|
74
76
|
npx geo-ai-search-optimization agent-resume ./your-site
|
|
75
77
|
npx geo-ai-search-optimization agent-continue ./your-site
|
|
78
|
+
npx geo-ai-search-optimization agent-state-pack ./your-site
|
|
76
79
|
npx geo-ai-search-optimization auto-flow ./your-site
|
|
77
80
|
npx geo-ai-search-optimization agent-session ./your-site
|
|
78
81
|
npx geo-ai-search-optimization agent-runbook ./your-site
|
|
@@ -104,6 +107,7 @@ npx geo-ai-search-optimization roadmap ./your-site
|
|
|
104
107
|
- `agent-orchestrator`: choose the one next GEO command to run now, plus expected artifact, stop conditions, and follow-up command
|
|
105
108
|
- `agent-resume`: resume from the latest reliable checkpoint, confirm what not to reset, and tell the next agent the one resume command to run
|
|
106
109
|
- `agent-continue`: continue the current round, validate it, and tell the next agent which state artifacts to update right after execution
|
|
110
|
+
- `agent-state-pack`: turn the current round into one normalized state artifact with the command to run now, the validation list, and the sync-after-round commands
|
|
107
111
|
- `auto-flow`: auto-select the next skill and command order from a task brief, URL, project path, or GEO artifact
|
|
108
112
|
- `agent-session`: build a step-by-step session packet for the next agent from the same kinds of inputs
|
|
109
113
|
- `agent-runbook`: build a checklist-driven runbook with preflight, validation, and reporting rules
|
|
@@ -142,6 +146,7 @@ When explaining the tool to a user:
|
|
|
142
146
|
- if the user or next agent wants just one next command, move them to `agent-orchestrator`
|
|
143
147
|
- if the user or next agent needs to continue from the latest reliable checkpoint without restarting, move them to `agent-resume`
|
|
144
148
|
- if the user or next agent needs one round of execution plus status writeback, move them to `agent-continue`
|
|
149
|
+
- if the user or next agent wants one unified current-state artifact for handoff, move them to `agent-state-pack`
|
|
145
150
|
- if the user or the next agent is unsure where to start, move them to `auto-flow` first
|
|
146
151
|
- if the user wants something the next agent can follow step by step, move them to `agent-session`
|
|
147
152
|
- if the user wants the next agent to follow a checklist and execution manual, move them to `agent-runbook`
|
package/src/agent-resume.js
CHANGED
|
@@ -37,6 +37,9 @@ async function tryReadExistingPlaybookPack(input) {
|
|
|
37
37
|
if (parsed.kind === "geo-agent-resume" && parsed.playbookPack) {
|
|
38
38
|
return parsed.playbookPack;
|
|
39
39
|
}
|
|
40
|
+
if (parsed.kind === "geo-agent-state-pack" && parsed.resume?.playbookPack) {
|
|
41
|
+
return parsed.resume.playbookPack;
|
|
42
|
+
}
|
|
40
43
|
} catch {
|
|
41
44
|
return null;
|
|
42
45
|
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { createAgentCheckpoint } from "./agent-checkpoint.js";
|
|
2
|
+
import { createAgentContinue } from "./agent-continue.js";
|
|
3
|
+
import { createAgentResume } from "./agent-resume.js";
|
|
4
|
+
import { createAgentStatusBoard } from "./agent-status-board.js";
|
|
5
|
+
import { writeScanOutput } from "./scan.js";
|
|
6
|
+
|
|
7
|
+
const VALID_FORMATS = new Set(["markdown", "json"]);
|
|
8
|
+
|
|
9
|
+
function normalizeFormat(format) {
|
|
10
|
+
const resolved = (format || "markdown").toLowerCase();
|
|
11
|
+
if (!VALID_FORMATS.has(resolved)) {
|
|
12
|
+
throw new Error(`不支持的 agent-state-pack 格式:${format}。可选值:${Array.from(VALID_FORMATS).join(", ")}`);
|
|
13
|
+
}
|
|
14
|
+
return resolved;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function uniqueList(items) {
|
|
18
|
+
return Array.from(new Set((items || []).filter(Boolean)));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function inferStateLevel(continueArtifact, board, checkpoint) {
|
|
22
|
+
if (continueArtifact.continue_mode === "needs-context") {
|
|
23
|
+
return "needs-context";
|
|
24
|
+
}
|
|
25
|
+
if (
|
|
26
|
+
continueArtifact.continue_mode === "closeout-loop" ||
|
|
27
|
+
checkpoint.decision === "move-to-closeout" ||
|
|
28
|
+
board.boardStatus === "completed"
|
|
29
|
+
) {
|
|
30
|
+
return "closeout-ready";
|
|
31
|
+
}
|
|
32
|
+
if (checkpoint.decision === "resolve-blockers" || board.boardStatus === "blocked") {
|
|
33
|
+
return "blocked";
|
|
34
|
+
}
|
|
35
|
+
if (board.boardStatus === "in-progress" || continueArtifact.currentPacket) {
|
|
36
|
+
return "active";
|
|
37
|
+
}
|
|
38
|
+
if (board.boardStatus === "not-started") {
|
|
39
|
+
return "ready-to-start";
|
|
40
|
+
}
|
|
41
|
+
return "tracking";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function buildStateSummary(level, resume, continueArtifact, board, checkpoint) {
|
|
45
|
+
if (level === "needs-context") {
|
|
46
|
+
return "当前还缺继续执行所需的上下文,先补网址、目录或现成 GEO 工件。";
|
|
47
|
+
}
|
|
48
|
+
if (level === "closeout-ready") {
|
|
49
|
+
return "当前已经接近或进入收尾,下一步重点是复盘、交接和交付,而不是再开新包。";
|
|
50
|
+
}
|
|
51
|
+
if (level === "blocked") {
|
|
52
|
+
return checkpoint.decisionReason || `当前执行被阻塞,先解除阻塞,再回到 ${continueArtifact.currentPacket?.id || "当前包"}。`;
|
|
53
|
+
}
|
|
54
|
+
if (level === "ready-to-start") {
|
|
55
|
+
return `当前已经有明确入口,可以从 ${continueArtifact.currentPacket?.id || "第一包"} 启动这一轮。`;
|
|
56
|
+
}
|
|
57
|
+
if (continueArtifact.currentPacket) {
|
|
58
|
+
return `当前应继续 ${continueArtifact.currentPacket.id},并在这一轮结束后同步状态工件。`;
|
|
59
|
+
}
|
|
60
|
+
return resume.resume_summary || board.boardSummary;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function buildNowCommand(continueArtifact, resume) {
|
|
64
|
+
return continueArtifact.continue_now || resume.resume_command || resume.orchestrator?.next_command || null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function buildAfterNow(level, continueArtifact, resume) {
|
|
68
|
+
if (level === "closeout-ready") {
|
|
69
|
+
return continueArtifact.closeout_when_ready[0] || resume.after_resume || null;
|
|
70
|
+
}
|
|
71
|
+
return continueArtifact.update_artifacts[0] || resume.after_resume || continueArtifact.closeout_when_ready[0] || null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function buildPreflightChecks(resume, checkpoint) {
|
|
75
|
+
return uniqueList([
|
|
76
|
+
...(resume.verify_before_resume || []),
|
|
77
|
+
checkpoint.gateChecks?.find((item) => item.status === "fail")?.detail,
|
|
78
|
+
checkpoint.gateChecks?.find((item) => item.status === "warn")?.detail
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function buildStatePrompt(pack) {
|
|
83
|
+
const lines = [
|
|
84
|
+
"你现在进入 GEO Agent State Pack 模式。",
|
|
85
|
+
`当前输入:${pack.source}`,
|
|
86
|
+
`当前状态等级:${pack.state_level}`,
|
|
87
|
+
`当前阶段:${pack.current_stage}`,
|
|
88
|
+
`状态摘要:${pack.state_summary}`,
|
|
89
|
+
`现在先执行:${pack.now_command || "先补上下文"}`
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
if (pack.currentPacket) {
|
|
93
|
+
lines.push(`当前包:${pack.currentPacket.id}|${pack.currentPacket.title}`);
|
|
94
|
+
}
|
|
95
|
+
if (pack.nextPacket) {
|
|
96
|
+
lines.push(`下一包:${pack.nextPacket.id}|${pack.nextPacket.title}`);
|
|
97
|
+
}
|
|
98
|
+
lines.push(`看板状态:${pack.board_status}|进度:${pack.progress_percent}%`);
|
|
99
|
+
lines.push(`检查点决策:${pack.checkpoint_decision}`);
|
|
100
|
+
|
|
101
|
+
if (pack.preflight_checks.length > 0) {
|
|
102
|
+
lines.push("执行前先确认:");
|
|
103
|
+
for (const item of pack.preflight_checks) {
|
|
104
|
+
lines.push(`- ${item}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (pack.sync_after_round.length > 0) {
|
|
108
|
+
lines.push("这一轮完成后要同步这些工件:");
|
|
109
|
+
for (const item of pack.sync_after_round) {
|
|
110
|
+
lines.push(`- ${item}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
lines.push("请先解释为什么现在应沿着这份状态包继续,而不是重新生成整条链。");
|
|
115
|
+
lines.push("然后给出本轮动作、验证点、回写动作和何时进入收尾。");
|
|
116
|
+
return lines.join("\n");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export async function createAgentStatePack(input, options = {}) {
|
|
120
|
+
const format = normalizeFormat(options.format);
|
|
121
|
+
const [resume, continueArtifact, statusBoard, checkpoint] = await Promise.all([
|
|
122
|
+
createAgentResume(input, { format: "json", intent: options.intent }),
|
|
123
|
+
createAgentContinue(input, { format: "json", intent: options.intent }),
|
|
124
|
+
createAgentStatusBoard(input, {
|
|
125
|
+
format: "json",
|
|
126
|
+
currentTaskId: options.currentTaskId,
|
|
127
|
+
completedPacketIds: options.completedPacketIds,
|
|
128
|
+
blockedReasons: options.blockedReasons
|
|
129
|
+
}),
|
|
130
|
+
createAgentCheckpoint(input, {
|
|
131
|
+
format: "json",
|
|
132
|
+
currentTaskId: options.currentTaskId,
|
|
133
|
+
completedPacketIds: options.completedPacketIds,
|
|
134
|
+
blockedReasons: options.blockedReasons
|
|
135
|
+
})
|
|
136
|
+
]);
|
|
137
|
+
|
|
138
|
+
const stateLevel = inferStateLevel(continueArtifact, statusBoard, checkpoint);
|
|
139
|
+
const source = continueArtifact.source || resume.source || statusBoard.source;
|
|
140
|
+
|
|
141
|
+
const pack = {
|
|
142
|
+
kind: "geo-agent-state-pack",
|
|
143
|
+
input,
|
|
144
|
+
source,
|
|
145
|
+
sourceType: continueArtifact.sourceType || resume.sourceType || statusBoard.sourceType,
|
|
146
|
+
artifactKind: resume.artifactKind || statusBoard.artifactKind,
|
|
147
|
+
format,
|
|
148
|
+
state_level: stateLevel,
|
|
149
|
+
state_summary: buildStateSummary(stateLevel, resume, continueArtifact, statusBoard, checkpoint),
|
|
150
|
+
current_stage: resume.orchestrator?.current_stage || "Agent 执行",
|
|
151
|
+
now_command: buildNowCommand(continueArtifact, resume),
|
|
152
|
+
expected_artifact: resume.expected_artifact || continueArtifact.executor?.expectedArtifact || null,
|
|
153
|
+
after_now: buildAfterNow(stateLevel, continueArtifact, resume),
|
|
154
|
+
currentPacket: continueArtifact.currentPacket || checkpoint.currentPacket || null,
|
|
155
|
+
nextPacket: continueArtifact.nextPacket || checkpoint.nextPacket || null,
|
|
156
|
+
board_status: statusBoard.boardStatus,
|
|
157
|
+
progress_percent: statusBoard.progressPercent,
|
|
158
|
+
checkpoint_type: checkpoint.checkpointType,
|
|
159
|
+
checkpoint_decision: checkpoint.decision,
|
|
160
|
+
checkpoint_reason: checkpoint.decisionReason,
|
|
161
|
+
preflight_checks: buildPreflightChecks(resume, checkpoint),
|
|
162
|
+
do_now_checklist: uniqueList(continueArtifact.do_now_checklist),
|
|
163
|
+
validate_after: uniqueList(continueArtifact.validate_after),
|
|
164
|
+
sync_after_round: uniqueList(continueArtifact.update_artifacts),
|
|
165
|
+
closeout_when_ready: uniqueList(continueArtifact.closeout_when_ready),
|
|
166
|
+
do_not_reset: uniqueList(continueArtifact.do_not_restart),
|
|
167
|
+
handoff_note: checkpoint.handoffNote,
|
|
168
|
+
selectedSkill: {
|
|
169
|
+
name: "geo-ai-search-optimization-agent-state-pack",
|
|
170
|
+
displayName: "GEO Agent State Pack",
|
|
171
|
+
shortDescription: "Normalize the current GEO state for the next agent"
|
|
172
|
+
},
|
|
173
|
+
next_skill: continueArtifact.selectedSkill?.name || "geo-ai-search-optimization-agent-continue",
|
|
174
|
+
resume,
|
|
175
|
+
continue: continueArtifact,
|
|
176
|
+
statusBoard,
|
|
177
|
+
checkpoint,
|
|
178
|
+
state_prompt: ""
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
pack.state_prompt = buildStatePrompt(pack);
|
|
182
|
+
return pack;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function renderAgentStatePackMarkdown(pack) {
|
|
186
|
+
const lines = [
|
|
187
|
+
"# GEO Agent State Pack",
|
|
188
|
+
"",
|
|
189
|
+
`- 输入:\`${pack.source}\``,
|
|
190
|
+
`- 输入类型:\`${pack.sourceType}\``,
|
|
191
|
+
`- 工件类型:\`${pack.artifactKind}\``,
|
|
192
|
+
`- 当前阶段:${pack.current_stage}`,
|
|
193
|
+
`- 状态等级:\`${pack.state_level}\``,
|
|
194
|
+
`- 看板状态:\`${pack.board_status}\``,
|
|
195
|
+
`- 进度:\`${pack.progress_percent}%\``,
|
|
196
|
+
`- 检查点决策:\`${pack.checkpoint_decision}\``,
|
|
197
|
+
"",
|
|
198
|
+
"## 当前摘要",
|
|
199
|
+
"",
|
|
200
|
+
`- ${pack.state_summary}`,
|
|
201
|
+
`- 现在先执行:\`${pack.now_command || "先补上下文"}\``
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
if (pack.expected_artifact) {
|
|
205
|
+
lines.push(`- 预期产物:${pack.expected_artifact}`);
|
|
206
|
+
}
|
|
207
|
+
if (pack.after_now) {
|
|
208
|
+
lines.push(`- 做完后第一条:\`${pack.after_now}\``);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (pack.currentPacket) {
|
|
212
|
+
lines.push("", "## 当前包", "", `- ${pack.currentPacket.id}|${pack.currentPacket.title}`);
|
|
213
|
+
}
|
|
214
|
+
if (pack.nextPacket) {
|
|
215
|
+
lines.push("", "## 下一包", "", `- ${pack.nextPacket.id}|${pack.nextPacket.title}`);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
lines.push("", "## 执行前先确认", "");
|
|
219
|
+
if (pack.preflight_checks.length === 0) {
|
|
220
|
+
lines.push("- 当前没有额外 preflight 项。");
|
|
221
|
+
} else {
|
|
222
|
+
for (const item of pack.preflight_checks) {
|
|
223
|
+
lines.push(`- ${item}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
lines.push("", "## 这一轮先做什么", "");
|
|
228
|
+
for (const item of pack.do_now_checklist) {
|
|
229
|
+
lines.push(`- ${item}`);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
lines.push("", "## 执行后先验证", "");
|
|
233
|
+
for (const item of pack.validate_after) {
|
|
234
|
+
lines.push(`- ${item}`);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
lines.push("", "## 这一轮完成后同步什么", "");
|
|
238
|
+
for (const item of pack.sync_after_round) {
|
|
239
|
+
lines.push(`- \`${item}\``);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
lines.push("", "## 可以进入收尾时跑什么", "");
|
|
243
|
+
for (const item of pack.closeout_when_ready) {
|
|
244
|
+
lines.push(`- \`${item}\``);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
lines.push("", "## 不要重置什么", "");
|
|
248
|
+
for (const item of pack.do_not_reset) {
|
|
249
|
+
lines.push(`- ${item}`);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
lines.push("", "## 交接说明", "", `- ${pack.handoff_note}`);
|
|
253
|
+
lines.push("", "## 可直接复制给 Agent 的 State Prompt", "", "```text", pack.state_prompt, "```");
|
|
254
|
+
|
|
255
|
+
return `${lines.join("\n")}\n`;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export async function writeAgentStatePackOutput(outputPath, content) {
|
|
259
|
+
return writeScanOutput(outputPath, content);
|
|
260
|
+
}
|
package/src/auto-flow.js
CHANGED
|
@@ -41,6 +41,9 @@ function detectArtifactKindFromParsedJson(parsed) {
|
|
|
41
41
|
function inferTaskTextMode(text) {
|
|
42
42
|
const normalized = String(text).toLowerCase();
|
|
43
43
|
|
|
44
|
+
if (/(agent-state-pack|state pack|state snapshot|统一状态包|当前状态包|state artifact)/i.test(normalized)) {
|
|
45
|
+
return "execute";
|
|
46
|
+
}
|
|
44
47
|
if (/(agent-continue|continue this round|继续这轮|继续当前轮次|回写状态后继续)/i.test(normalized)) {
|
|
45
48
|
return "execute";
|
|
46
49
|
}
|
|
@@ -177,6 +180,9 @@ function resolveEffectiveIntent(intent, detected) {
|
|
|
177
180
|
if (detected.artifactKind === "geo-agent-playbook-pack") {
|
|
178
181
|
return detected.parsed?.playbookStatus === "closeout-ready" ? "closeout" : "execute";
|
|
179
182
|
}
|
|
183
|
+
if (detected.artifactKind === "geo-agent-state-pack") {
|
|
184
|
+
return detected.parsed?.state_level === "closeout-ready" ? "closeout" : "execute";
|
|
185
|
+
}
|
|
180
186
|
if (detected.artifactKind === "geo-agent-resume") {
|
|
181
187
|
return detected.parsed?.resume_mode === "resume-closeout" ? "closeout" : "execute";
|
|
182
188
|
}
|
|
@@ -205,6 +211,7 @@ function resolveEffectiveIntent(intent, detected) {
|
|
|
205
211
|
"geo-agent-status-board",
|
|
206
212
|
"geo-agent-checkpoint",
|
|
207
213
|
"geo-agent-decision-log",
|
|
214
|
+
"geo-agent-state-pack",
|
|
208
215
|
"geo-apply-plan",
|
|
209
216
|
"geo-handoff-bundle",
|
|
210
217
|
"geo-fix-plan"
|
|
@@ -246,10 +253,11 @@ function buildCommandChain(detected, intent) {
|
|
|
246
253
|
}
|
|
247
254
|
|
|
248
255
|
if (intent === "closeout") {
|
|
256
|
+
const baseSource = detected.parsed?.source || source;
|
|
249
257
|
return [
|
|
250
|
-
`geo-ai-search-optimization completion-report ${
|
|
251
|
-
`geo-ai-search-optimization meeting-pack ${
|
|
252
|
-
`geo-ai-search-optimization publish-pack ${
|
|
258
|
+
`geo-ai-search-optimization completion-report ${baseSource}`,
|
|
259
|
+
`geo-ai-search-optimization meeting-pack ${baseSource}`,
|
|
260
|
+
`geo-ai-search-optimization publish-pack ${baseSource}`
|
|
253
261
|
];
|
|
254
262
|
}
|
|
255
263
|
|
|
@@ -447,6 +455,11 @@ function buildCommandChain(detected, intent) {
|
|
|
447
455
|
`geo-ai-search-optimization agent-decision-log ${baseSource}`
|
|
448
456
|
];
|
|
449
457
|
}
|
|
458
|
+
case "geo-agent-state-pack": {
|
|
459
|
+
const nowCommand = detected.parsed?.now_command;
|
|
460
|
+
const syncCommands = Array.isArray(detected.parsed?.sync_after_round) ? detected.parsed.sync_after_round : [];
|
|
461
|
+
return [nowCommand, ...syncCommands.slice(0, 2)].filter(Boolean);
|
|
462
|
+
}
|
|
450
463
|
case "geo-agent-resume": {
|
|
451
464
|
return [`geo-ai-search-optimization agent-continue ${source}`];
|
|
452
465
|
}
|
|
@@ -534,6 +547,8 @@ function pickSkillName(detected, intent) {
|
|
|
534
547
|
case "geo-agent-status-board":
|
|
535
548
|
case "geo-agent-checkpoint":
|
|
536
549
|
case "geo-agent-decision-log":
|
|
550
|
+
case "geo-agent-state-pack":
|
|
551
|
+
return "geo-ai-search-optimization-agent-state-pack";
|
|
537
552
|
case "geo-agent-playbook-pack":
|
|
538
553
|
case "geo-agent-resume":
|
|
539
554
|
case "geo-agent-continue":
|
|
@@ -581,6 +596,7 @@ function buildSecondarySkillNames(primarySkill, intent, detected) {
|
|
|
581
596
|
"geo-agent-status-board",
|
|
582
597
|
"geo-agent-checkpoint",
|
|
583
598
|
"geo-agent-decision-log",
|
|
599
|
+
"geo-agent-state-pack",
|
|
584
600
|
"geo-agent-resume",
|
|
585
601
|
"geo-agent-continue",
|
|
586
602
|
"geo-agent-playbook-pack",
|
|
@@ -591,6 +607,7 @@ function buildSecondarySkillNames(primarySkill, intent, detected) {
|
|
|
591
607
|
) {
|
|
592
608
|
names.add("geo-ai-search-optimization-agent-resume");
|
|
593
609
|
names.add("geo-ai-search-optimization-agent-continue");
|
|
610
|
+
names.add("geo-ai-search-optimization-agent-state-pack");
|
|
594
611
|
names.add("geo-ai-search-optimization-agent-batch-executor");
|
|
595
612
|
names.add("geo-ai-search-optimization-agent-progress-tracker");
|
|
596
613
|
names.add("geo-ai-search-optimization-agent-status-board");
|
|
@@ -612,6 +629,9 @@ function buildSecondarySkillNames(primarySkill, intent, detected) {
|
|
|
612
629
|
}
|
|
613
630
|
|
|
614
631
|
function buildStage(intent, detected) {
|
|
632
|
+
if (detected.artifactKind === "geo-agent-state-pack") {
|
|
633
|
+
return "当前状态";
|
|
634
|
+
}
|
|
615
635
|
if (detected.artifactKind === "geo-agent-continue") {
|
|
616
636
|
return "继续执行";
|
|
617
637
|
}
|
|
@@ -638,6 +658,7 @@ function buildStage(intent, detected) {
|
|
|
638
658
|
"geo-agent-status-board",
|
|
639
659
|
"geo-agent-checkpoint",
|
|
640
660
|
"geo-agent-decision-log",
|
|
661
|
+
"geo-agent-state-pack",
|
|
641
662
|
"geo-agent-resume",
|
|
642
663
|
"geo-agent-continue",
|
|
643
664
|
"geo-agent-playbook-pack",
|
|
@@ -659,6 +680,7 @@ function buildStage(intent, detected) {
|
|
|
659
680
|
"geo-agent-status-board",
|
|
660
681
|
"geo-agent-checkpoint",
|
|
661
682
|
"geo-agent-decision-log",
|
|
683
|
+
"geo-agent-state-pack",
|
|
662
684
|
"geo-agent-resume",
|
|
663
685
|
"geo-agent-continue",
|
|
664
686
|
"geo-agent-playbook-pack",
|
|
@@ -749,6 +771,9 @@ function buildNextAction(detected, intent, commands) {
|
|
|
749
771
|
return `先运行 \`${commands[0]}\` 生成适合外发或交接的结果。`;
|
|
750
772
|
}
|
|
751
773
|
if (intent === "execute") {
|
|
774
|
+
if (detected.artifactKind === "geo-agent-state-pack") {
|
|
775
|
+
return `先运行 \`${commands[0]}\`,沿着这份统一状态包继续当前这一轮,并按包内要求回写状态工件。`;
|
|
776
|
+
}
|
|
752
777
|
if (detected.artifactKind === "geo-agent-continue") {
|
|
753
778
|
return `先运行 \`${commands[0]}\`,继续当前这一轮,并把状态与决策工件一起回写。`;
|
|
754
779
|
}
|
package/src/cli.js
CHANGED
|
@@ -12,6 +12,11 @@ import {
|
|
|
12
12
|
renderAgentContinueMarkdown,
|
|
13
13
|
writeAgentContinueOutput
|
|
14
14
|
} from "./agent-continue.js";
|
|
15
|
+
import {
|
|
16
|
+
createAgentStatePack,
|
|
17
|
+
renderAgentStatePackMarkdown,
|
|
18
|
+
writeAgentStatePackOutput
|
|
19
|
+
} from "./agent-state-pack.js";
|
|
15
20
|
import { createAgentExecutor, renderAgentExecutorMarkdown, writeAgentExecutorOutput } from "./agent-executor.js";
|
|
16
21
|
import { createAgentHandoff, renderAgentHandoffMarkdown, writeAgentHandoffOutput } from "./agent-handoff.js";
|
|
17
22
|
import {
|
|
@@ -94,6 +99,7 @@ function printHelp() {
|
|
|
94
99
|
" geo-ai-search-optimization agent-orchestrator <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--format <markdown|json>] [--out <file>]",
|
|
95
100
|
" geo-ai-search-optimization agent-resume <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--format <markdown|json>] [--out <file>]",
|
|
96
101
|
" geo-ai-search-optimization agent-continue <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--format <markdown|json>] [--out <file>]",
|
|
102
|
+
" geo-ai-search-optimization agent-state-pack <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--current <id>] [--completed <id,id>] [--blocked <reason,reason>] [--format <markdown|json>] [--out <file>]",
|
|
97
103
|
" geo-ai-search-optimization auto-flow <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--json] [--out <file>]",
|
|
98
104
|
" geo-ai-search-optimization agent-session <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--json] [--out <file>]",
|
|
99
105
|
" geo-ai-search-optimization agent-runbook <input> [--intent <auto|diagnose|guide|execute|share|closeout>] [--task <id>] [--format <markdown|json>] [--out <file>]",
|
|
@@ -273,6 +279,35 @@ async function handleAgentContinue(args) {
|
|
|
273
279
|
process.stdout.write(renderedOutput);
|
|
274
280
|
}
|
|
275
281
|
|
|
282
|
+
async function handleAgentStatePack(args) {
|
|
283
|
+
const input = args.find((value) => !value.startsWith("-"));
|
|
284
|
+
if (!input) {
|
|
285
|
+
throw new Error("agent-state-pack 需要一个输入值,可以是任务描述、项目路径、网站网址或已导出的工件");
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const format = getFlagValue(args, "--format") || (hasFlag(args, "--json") ? "json" : undefined);
|
|
289
|
+
const artifact = await createAgentStatePack(input, {
|
|
290
|
+
intent: getFlagValue(args, "--intent"),
|
|
291
|
+
format,
|
|
292
|
+
currentTaskId: getFlagValue(args, "--current"),
|
|
293
|
+
completedPacketIds: getFlagValue(args, "--completed"),
|
|
294
|
+
blockedReasons: getFlagValue(args, "--blocked")
|
|
295
|
+
});
|
|
296
|
+
const outputJson = artifact.format === "json";
|
|
297
|
+
const renderedOutput = outputJson
|
|
298
|
+
? `${JSON.stringify(artifact, null, 2)}\n`
|
|
299
|
+
: renderAgentStatePackMarkdown(artifact);
|
|
300
|
+
|
|
301
|
+
const outputPath = getFlagValue(args, "--out");
|
|
302
|
+
if (outputPath) {
|
|
303
|
+
const resolvedOutputPath = await writeAgentStatePackOutput(outputPath, renderedOutput);
|
|
304
|
+
process.stdout.write(`已保存 agent-state-pack 结果:${resolvedOutputPath}\n`);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
process.stdout.write(renderedOutput);
|
|
309
|
+
}
|
|
310
|
+
|
|
276
311
|
async function handleAgentSession(args) {
|
|
277
312
|
const input = args.find((value) => !value.startsWith("-"));
|
|
278
313
|
if (!input) {
|
|
@@ -1104,6 +1139,11 @@ export async function runCli(args = []) {
|
|
|
1104
1139
|
return;
|
|
1105
1140
|
}
|
|
1106
1141
|
|
|
1142
|
+
if (command === "agent-state-pack") {
|
|
1143
|
+
await handleAgentStatePack(rest);
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1107
1147
|
if (command === "agent-session") {
|
|
1108
1148
|
await handleAgentSession(rest);
|
|
1109
1149
|
return;
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export {
|
|
|
8
8
|
export { createAutoFlow, renderAutoFlowMarkdown, writeAutoFlowOutput } from "./auto-flow.js";
|
|
9
9
|
export { createApplyPlan, renderApplyPlanMarkdown, writeApplyPlanOutput } from "./apply-plan.js";
|
|
10
10
|
export { createAgentContinue, renderAgentContinueMarkdown, writeAgentContinueOutput } from "./agent-continue.js";
|
|
11
|
+
export { createAgentStatePack, renderAgentStatePackMarkdown, writeAgentStatePackOutput } from "./agent-state-pack.js";
|
|
11
12
|
export { createAgentOrchestrator, renderAgentOrchestratorMarkdown, writeAgentOrchestratorOutput } from "./agent-orchestrator.js";
|
|
12
13
|
export { createAgentResume, renderAgentResumeMarkdown, writeAgentResumeOutput } from "./agent-resume.js";
|
|
13
14
|
export { createAgentBatchExecutor, renderAgentBatchExecutorMarkdown, writeAgentBatchExecutorOutput } from "./agent-batch-executor.js";
|
package/src/skills.js
CHANGED
|
@@ -8,6 +8,7 @@ const SKILL_ORDER = [
|
|
|
8
8
|
"geo-ai-search-optimization-agent-orchestrator",
|
|
9
9
|
"geo-ai-search-optimization-agent-resume",
|
|
10
10
|
"geo-ai-search-optimization-agent-continue",
|
|
11
|
+
"geo-ai-search-optimization-agent-state-pack",
|
|
11
12
|
"geo-ai-search-optimization-agent-session",
|
|
12
13
|
"geo-ai-search-optimization-agent-runbook",
|
|
13
14
|
"geo-ai-search-optimization-agent-executor",
|
|
@@ -35,6 +36,7 @@ const SKILL_CATEGORY = {
|
|
|
35
36
|
"geo-ai-search-optimization-agent-orchestrator": "routing",
|
|
36
37
|
"geo-ai-search-optimization-agent-resume": "routing",
|
|
37
38
|
"geo-ai-search-optimization-agent-continue": "routing",
|
|
39
|
+
"geo-ai-search-optimization-agent-state-pack": "routing",
|
|
38
40
|
"geo-ai-search-optimization-agent-session": "routing",
|
|
39
41
|
"geo-ai-search-optimization-agent-runbook": "execution",
|
|
40
42
|
"geo-ai-search-optimization-agent-executor": "execution",
|
|
@@ -180,6 +182,7 @@ export function renderBundledSkillsMarkdown(bundle) {
|
|
|
180
182
|
"- 如果你只想让 agent 立刻知道现在唯一该跑哪条命令,先跑 agent-orchestrator。",
|
|
181
183
|
"- 如果工作中断后要从最近一个可靠恢复点继续,先跑 agent-resume。",
|
|
182
184
|
"- 如果你希望 agent 不只恢复,还要拿到这一轮继续后的状态回写动作,继续跑 agent-continue。",
|
|
185
|
+
"- 如果你希望下一个 agent 直接拿到统一的当前状态工件,而不是自己拼 resume / continue / board / checkpoint,跑 agent-state-pack。",
|
|
183
186
|
"- 如果 agent 需要自动选 skill,先跑 auto-flow。",
|
|
184
187
|
"- 如果要给 agent 明确步骤,继续进入 agent-session。",
|
|
185
188
|
"- 如果要给 agent 一份执行手册和检查表,再进入 agent-runbook。",
|