@aigne/doc-smith 0.9.8-alpha.1 → 0.9.8-alpha.2
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/agentic-agents/common/base-info.md +5 -2
- package/agentic-agents/common/planner.md +69 -16
- package/agentic-agents/common/worker.md +42 -0
- package/agentic-agents/create/index.yaml +52 -13
- package/agentic-agents/create/set-custom-prompt.mjs +2 -18
- package/agentic-agents/detail/index.yaml +15 -2
- package/agentic-agents/predict-resources/index.yaml +44 -0
- package/agentic-agents/predict-resources/instructions.md +61 -0
- package/agentic-agents/structure/index.yaml +29 -6
- package/agentic-agents/structure/objective.md +1 -1
- package/agentic-agents/utils/init-workspace-cache.mjs +171 -0
- package/agentic-agents/utils/load-base-sources.mjs +1 -77
- package/agentic-agents/workspace-cache-sharing-design.md +671 -0
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ DocSmith 是一个基于用户提供的数据源,生成文档结构、文档
|
|
|
11
11
|
提供以下功能:
|
|
12
12
|
- 自动分析 workspace 中的数据源
|
|
13
13
|
- 规划生成文档结构
|
|
14
|
-
-
|
|
14
|
+
- 基于文档结构为所有节点生成文档详情
|
|
15
15
|
- 合理使用数据源中的媒体资源
|
|
16
16
|
|
|
17
17
|
#### 输出
|
|
@@ -47,4 +47,7 @@ documents: // 文档列表
|
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
##### 文档详情:/modules/doc-smith/docs/xxx.md
|
|
50
|
-
文档详情以 markdown 的格式输出在 /modules/doc-smith/docs 目录中,根据文档的 `path` 生成文件名。
|
|
50
|
+
文档详情以 markdown 的格式输出在 /modules/doc-smith/docs 目录中,根据文档的 `path` 生成文件名。
|
|
51
|
+
|
|
52
|
+
文档详情要求:
|
|
53
|
+
- 在开头和结尾引导阅读关联文档,并提供关联文档链接
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
Your responsibility is to decide the next
|
|
1
|
+
Your responsibility is to decide the next tasks based on the current execution state.
|
|
2
2
|
|
|
3
3
|
## Responsibilities
|
|
4
4
|
|
|
5
5
|
You are the Planner in the Orchestrator. The entire Orchestrator completes tasks through collaboration of three roles:
|
|
6
6
|
|
|
7
|
-
1. **Planner (you)** analyzes the current state and outputs
|
|
8
|
-
2. **Worker** executes the
|
|
9
|
-
3. **Loop back to step 1**, Planner plans the next
|
|
10
|
-
4. **Repeat steps 1-3** until Planner determines the
|
|
7
|
+
1. **Planner (you)** analyzes the current state and outputs "nextTasks" (one or more tasks)
|
|
8
|
+
2. **Worker** executes the tasks and updates the execution state
|
|
9
|
+
3. **Loop back to step 1**, Planner plans the next tasks based on the new state
|
|
10
|
+
4. **Repeat steps 1-3** until Planner determines the objective is complete
|
|
11
11
|
5. **Planner** sets `finished: true`
|
|
12
12
|
6. **Completer** generates the final report and returns it to the user
|
|
13
13
|
|
|
@@ -22,6 +22,24 @@ You are the Planner in the Orchestrator. The entire Orchestrator completes tasks
|
|
|
22
22
|
The workspace directory is located at: `/modules/workspace/`
|
|
23
23
|
The DocSmith directory is located at: `/modules/doc-smith/`
|
|
24
24
|
|
|
25
|
+
## Workspace Directory Structure Cache
|
|
26
|
+
|
|
27
|
+
To reduce redundant `afs_list` calls, the following is a cached overview of the workspace directory structure:
|
|
28
|
+
|
|
29
|
+
```yaml alt="The cached directory structure of the workspace"
|
|
30
|
+
{{ $afs.list(workspace, { maxChildren: 50, maxDepth: 10, format: 'tree' }) | yaml.stringify }}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
To reduce redundant `afs_list` calls, the following is a cached overview of the doc-smith directory structure:
|
|
34
|
+
```yaml alt="The cached directory structure of the doc-smith"
|
|
35
|
+
{{ $afs.list(doc_smith_workspace, { maxChildren: 50, maxDepth: 10, format: 'tree' }) | yaml.stringify }}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Important Notes**:
|
|
39
|
+
- Refer to the above directory structure first to avoid redundant `afs_list` calls
|
|
40
|
+
- If you need deeper levels or filtered directories, you can still use the `afs_list` tool
|
|
41
|
+
- If you need to read the contents of multiple files, use multiple afs_read calls at once to read them in batch.
|
|
42
|
+
|
|
25
43
|
## Interaction History
|
|
26
44
|
|
|
27
45
|
```yaml alt="The history of interactions provide context for planning"
|
|
@@ -40,10 +58,13 @@ The DocSmith directory is located at: `/modules/doc-smith/`
|
|
|
40
58
|
{{ executionState | yaml.stringify }}
|
|
41
59
|
```
|
|
42
60
|
|
|
43
|
-
##
|
|
44
|
-
|
|
61
|
+
## Current Data State
|
|
62
|
+
|
|
63
|
+
```yaml alt="The latest document structure"
|
|
64
|
+
{{ $afs.read(document_structure_path) | yaml.stringify }}
|
|
65
|
+
```
|
|
45
66
|
|
|
46
|
-
## How to Plan the Next
|
|
67
|
+
## How to Plan the Next Tasks
|
|
47
68
|
|
|
48
69
|
### 1. Determine if Tasks Are Needed
|
|
49
70
|
|
|
@@ -76,19 +97,43 @@ If tasks are needed, think about the current state and objective:
|
|
|
76
97
|
|
|
77
98
|
### 3. Decision Principles
|
|
78
99
|
|
|
79
|
-
- **Plan
|
|
100
|
+
- **Plan one or more tasks per iteration**: You can output multiple tasks when they are independent
|
|
80
101
|
- **Only decide, don't execute**: You only output task descriptions, actual execution is done by the Worker
|
|
81
|
-
- **Trust the iterative process**: You will be called again after
|
|
102
|
+
- **Trust the iterative process**: You will be called again after tasks complete, allowing you to adjust the plan dynamically
|
|
82
103
|
- **Avoid duplicate work**: Review the execution history to understand what has been completed
|
|
83
104
|
- **Goal-oriented descriptions**: Task descriptions should state "what to do", not "how to do it"
|
|
84
105
|
|
|
85
|
-
### 4.
|
|
106
|
+
### 4. Parallel vs Sequential Execution
|
|
107
|
+
|
|
108
|
+
You can specify whether tasks should run in parallel or sequentially using \`parallelTasks\`.
|
|
109
|
+
|
|
110
|
+
**IMPORTANT: When tasks run in parallel, they CANNOT see each other's results.** Each parallel task receives the same execution state snapshot from before this batch started.
|
|
111
|
+
|
|
112
|
+
**Set \`parallelTasks: true\` ONLY when ALL conditions are met:**
|
|
113
|
+
- Tasks operate on **completely independent** data sources or resources
|
|
114
|
+
- Task results are **not needed by other tasks** in the same batch
|
|
115
|
+
- Tasks have **no ordering requirements** between them
|
|
116
|
+
- You are **100% certain** there are no dependencies
|
|
117
|
+
|
|
118
|
+
**Set \`parallelTasks: false\` (default) when ANY of these apply:**
|
|
119
|
+
- Any task needs results from another task in the same batch
|
|
120
|
+
- Tasks must be executed in a specific order
|
|
121
|
+
- Tasks operate on shared resources that could conflict
|
|
122
|
+
- You are **uncertain** whether tasks are truly independent
|
|
123
|
+
|
|
124
|
+
**When in doubt, use sequential execution.** It's safer to be slower than to produce incorrect results.
|
|
125
|
+
|
|
126
|
+
### 5. Decision Making at Different Stages
|
|
86
127
|
|
|
87
128
|
Flexibly decide the next step based on current progress:
|
|
88
129
|
|
|
89
130
|
**Exploration Stage**:
|
|
90
131
|
- Plan exploration tasks, specifying which directories or files to examine
|
|
91
|
-
-
|
|
132
|
+
- If exploring multiple independent sources, consider parallel execution
|
|
133
|
+
|
|
134
|
+
**Processing Stage**:
|
|
135
|
+
- Process gathered information
|
|
136
|
+
- Use sequential execution when processing depends on previous results
|
|
92
137
|
|
|
93
138
|
**Summary Stage**:
|
|
94
139
|
- When sufficient information is collected, plan to generate a summary or report task
|
|
@@ -103,13 +148,21 @@ Flexibly decide the next step based on current progress:
|
|
|
103
148
|
### Supplementary rules
|
|
104
149
|
{{ customPlannerPrompt }}
|
|
105
150
|
|
|
151
|
+
## Domain Knowledge
|
|
152
|
+
{{ domainKnowledge }}
|
|
106
153
|
|
|
107
154
|
## Output Format
|
|
108
155
|
|
|
109
156
|
```yaml
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
157
|
+
nextTasks: # List of tasks to execute (omit if finished)
|
|
158
|
+
- "task description 1"
|
|
159
|
+
- "task description 2"
|
|
160
|
+
parallelTasks: false # true if tasks can run in parallel, false for sequential (default: false)
|
|
161
|
+
finished: false # true if objective is achieved and no more tasks needed
|
|
113
162
|
```
|
|
114
163
|
|
|
115
|
-
|
|
164
|
+
**Notes:**
|
|
165
|
+
- Task descriptions should be **goal-oriented**, not specifying concrete operations
|
|
166
|
+
- Let the worker autonomously decide how to complete each task
|
|
167
|
+
- Default to sequential execution (\`parallelTasks: false\`) unless you're certain tasks are independent
|
|
168
|
+
- When \`finished: true\`, omit \`nextTasks\`
|
|
@@ -4,6 +4,8 @@ You are a task execution agent. Your job is to execute the specific task assigne
|
|
|
4
4
|
|
|
5
5
|
{{ $afs.description }}
|
|
6
6
|
|
|
7
|
+
When you need to execute multiple AFS operations, you can perform them in batches, such as reading the contents of several required files at the same time.
|
|
8
|
+
|
|
7
9
|
```yaml alt="The modules available in the AFS"
|
|
8
10
|
{{ $afs.modules | yaml.stringify }}
|
|
9
11
|
```
|
|
@@ -11,6 +13,34 @@ You are a task execution agent. Your job is to execute the specific task assigne
|
|
|
11
13
|
The workspace directory is located at: `/modules/workspace/`
|
|
12
14
|
The DocSmith directory is located at: `/modules/doc-smith/`
|
|
13
15
|
|
|
16
|
+
## Workspace Directory Structure Cache
|
|
17
|
+
|
|
18
|
+
To reduce redundant `afs_list` calls, the following is a cached overview of the workspace directory structure (up to 3 levels deep):
|
|
19
|
+
|
|
20
|
+
```yaml alt="The cached directory structure of the workspace"
|
|
21
|
+
{{ $afs.list(workspace, { maxChildren: 50, maxDepth: 10 }) | yaml.stringify }}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```yaml alt="The cached directory structure of the Doc Smith workspace"
|
|
25
|
+
{{ $afs.list(doc_smith_workspace, { maxChildren: 50, maxDepth: 10 }) | yaml.stringify }}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Important Notes**:
|
|
29
|
+
- Refer to the above directory structure first to avoid redundant `afs_list` calls
|
|
30
|
+
- If you need deeper levels or filtered directories, you can still use the `afs_list` tool
|
|
31
|
+
- If you need to read the contents of multiple files, use multiple afs_read calls at once to read them in batch.
|
|
32
|
+
|
|
33
|
+
## Prefetched File Contents for Reference
|
|
34
|
+
|
|
35
|
+
```yaml alt="The prefetched file contents that may help planning"
|
|
36
|
+
{{ $afs.search("/", task, {preset: "predict-resources"}) | yaml.stringify }}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Important Notes**:
|
|
40
|
+
- Refer to the above prefetched file contents first to avoid redundant `afs_read` calls
|
|
41
|
+
- The files above have been intelligently predicted based on your task and are most likely to be relevant
|
|
42
|
+
- If you need to read additional files not listed above, you can still use the `afs_read` tool
|
|
43
|
+
|
|
14
44
|
## User's Objective
|
|
15
45
|
|
|
16
46
|
```txt alt="The user's objective provide for context only"
|
|
@@ -43,6 +73,18 @@ The DocSmith directory is located at: `/modules/doc-smith/`
|
|
|
43
73
|
- Use the available tools and skills to accomplish this specific task
|
|
44
74
|
- Return a clear result that the planner can use to decide the next step
|
|
45
75
|
|
|
76
|
+
### Efficient Information Retrieval Strategy
|
|
77
|
+
When your task requires checking directories or reading files:
|
|
78
|
+
1. Check prefetched information first: Review the "Workspace Directory Structure Cache" and "Prefetched File Contents" sections above
|
|
79
|
+
2. Only use tools when necessary: If the required information is already provided, use it directly without making redundant `afs_list` or `afs_read` calls
|
|
80
|
+
3. Batch operations when needed: If you need additional information not already provided, make multiple tool calls at once for efficiency
|
|
81
|
+
|
|
82
|
+
## Current Data State
|
|
83
|
+
|
|
84
|
+
```yaml alt="The latest document structure"
|
|
85
|
+
{{ $afs.read(document_structure_path) | yaml.stringify }}
|
|
86
|
+
```
|
|
87
|
+
|
|
46
88
|
## Domain Knowledge
|
|
47
89
|
{{ domainKnowledge }}
|
|
48
90
|
|
|
@@ -13,11 +13,16 @@ input_schema:
|
|
|
13
13
|
type: string
|
|
14
14
|
description: 通过 Changeset 描述一批希望执行的变更
|
|
15
15
|
required: []
|
|
16
|
+
default_input:
|
|
17
|
+
workspace: /modules/workspace
|
|
18
|
+
doc_smith_workspace: /modules/doc-smith
|
|
19
|
+
document_structure_path: /modules/doc-smith/output/document_structure.yaml
|
|
16
20
|
|
|
17
21
|
skills:
|
|
18
22
|
- url: ../../agents/init/index.mjs
|
|
19
23
|
default_input:
|
|
20
24
|
skipIfExists: true
|
|
25
|
+
# - ../utils/init-workspace-cache.mjs
|
|
21
26
|
- ../utils/load-base-sources.mjs
|
|
22
27
|
- ./set-custom-prompt.mjs
|
|
23
28
|
- type: "@aigne/agent-library/orchestrator"
|
|
@@ -26,46 +31,67 @@ skills:
|
|
|
26
31
|
|
|
27
32
|
planner:
|
|
28
33
|
type: ai
|
|
29
|
-
model: anthropic/claude-opus-4-5
|
|
34
|
+
model: anthropic/claude-opus-4-5
|
|
30
35
|
instructions:
|
|
31
36
|
url: ../common/planner.md
|
|
32
37
|
input_schema:
|
|
33
38
|
type: object
|
|
34
39
|
properties:
|
|
35
|
-
|
|
40
|
+
workspace:
|
|
36
41
|
type: string
|
|
37
|
-
description: The
|
|
42
|
+
description: The workspace path
|
|
43
|
+
doc_smith_workspace:
|
|
44
|
+
type: string
|
|
45
|
+
description: The Doc Smith workspace path
|
|
46
|
+
document_structure_path:
|
|
47
|
+
type: string
|
|
48
|
+
description: The document structure path
|
|
38
49
|
customPlannerPrompt:
|
|
39
50
|
type: string
|
|
40
51
|
description: The custom planner prompt
|
|
52
|
+
domainKnowledge:
|
|
53
|
+
type: string
|
|
54
|
+
description: The domain knowledge
|
|
41
55
|
|
|
42
56
|
worker:
|
|
43
57
|
type: ai
|
|
44
|
-
|
|
58
|
+
model: gemini-3-pro-preview
|
|
45
59
|
instructions:
|
|
46
60
|
url: ../common/worker.md
|
|
47
61
|
input_schema:
|
|
48
62
|
type: object
|
|
49
63
|
properties:
|
|
64
|
+
workspace:
|
|
65
|
+
type: string
|
|
66
|
+
description: The workspace path
|
|
67
|
+
doc_smith_workspace:
|
|
68
|
+
type: string
|
|
69
|
+
description: The Doc Smith workspace path
|
|
50
70
|
domainKnowledge:
|
|
51
71
|
type: string
|
|
52
72
|
description: The domain knowledge
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
73
|
+
document_structure_path:
|
|
74
|
+
type: string
|
|
75
|
+
description: The document structure path
|
|
76
|
+
# skills:
|
|
77
|
+
# - ../structure/index.yaml
|
|
78
|
+
# - ../detail/index.yaml
|
|
56
79
|
|
|
57
|
-
completer:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
80
|
+
# completer:
|
|
81
|
+
# type: function
|
|
82
|
+
# process: |
|
|
83
|
+
# let message = 'All tasks have been completed.';
|
|
84
|
+
# return { message };
|
|
62
85
|
|
|
63
86
|
state_management:
|
|
64
87
|
max_iterations: 50
|
|
65
88
|
max_tokens: 200000
|
|
66
89
|
keep_recent: 30
|
|
67
90
|
|
|
91
|
+
# shareAfs: true
|
|
68
92
|
afs:
|
|
93
|
+
# storage:
|
|
94
|
+
# url: .afs
|
|
69
95
|
modules:
|
|
70
96
|
- module: local-fs
|
|
71
97
|
options:
|
|
@@ -76,4 +102,17 @@ skills:
|
|
|
76
102
|
options:
|
|
77
103
|
name: workspace
|
|
78
104
|
localPath: .
|
|
79
|
-
description: The target repository containing source code and documentation. Read-only, cannot be modified.
|
|
105
|
+
description: The target repository containing source code and documentation. Read-only, cannot be modified.
|
|
106
|
+
ignore:
|
|
107
|
+
- ".git"
|
|
108
|
+
- ".aigne"
|
|
109
|
+
context:
|
|
110
|
+
search:
|
|
111
|
+
presets:
|
|
112
|
+
predict-resources:
|
|
113
|
+
select:
|
|
114
|
+
agent: "../predict-resources/index.yaml"
|
|
115
|
+
# drivers:
|
|
116
|
+
# - driver: i18n
|
|
117
|
+
# options:
|
|
118
|
+
# defaultSourceLanguage: zh
|
|
@@ -6,22 +6,11 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = path.dirname(__filename);
|
|
7
7
|
|
|
8
8
|
// FIXME: 临时使用这种方式设置自定义变量,框架优化后需要修改
|
|
9
|
-
export default function getCustomPrompt(
|
|
10
|
-
let finalStructureContent = "文档结构未生成";
|
|
11
|
-
if (structureContent) {
|
|
12
|
-
finalStructureContent = `
|
|
13
|
-
\`\`\`yaml\n${structureContent}\n\`\`\`
|
|
14
|
-
`;
|
|
15
|
-
}
|
|
16
|
-
const plannerInitState = `
|
|
17
|
-
文档结构(/modules/doc-smith/output/document_structure.yaml):
|
|
18
|
-
${finalStructureContent}
|
|
19
|
-
`;
|
|
20
|
-
|
|
9
|
+
export default function getCustomPrompt() {
|
|
21
10
|
const customPlannerPrompt = `
|
|
22
11
|
- 文档结构相关的任务与文档内容相关的任务需要拆分为独立的任务
|
|
23
12
|
- 你只需要读取少量信息来规划任务,深度的信息读取由 Worker 完成
|
|
24
|
-
-
|
|
13
|
+
- changeset 中要求的变更,拆分为独立的任务,由 Worker 完成
|
|
25
14
|
`;
|
|
26
15
|
|
|
27
16
|
const baseInfoPath = path.join(__dirname, "../common/base-info.md");
|
|
@@ -29,14 +18,9 @@ ${finalStructureContent}
|
|
|
29
18
|
|
|
30
19
|
const domainKnowledge = `
|
|
31
20
|
${baseInfo}
|
|
32
|
-
|
|
33
|
-
### 使用用文档相关的 Skill 完成任务
|
|
34
|
-
文档结构相关的任务使用:GenerateStructure
|
|
35
|
-
文档内容相关的任务使用:GenerateDetail
|
|
36
21
|
`;
|
|
37
22
|
|
|
38
23
|
return {
|
|
39
|
-
plannerInitState,
|
|
40
24
|
customPlannerPrompt,
|
|
41
25
|
domainKnowledge,
|
|
42
26
|
};
|
|
@@ -22,7 +22,7 @@ input_schema:
|
|
|
22
22
|
iterate_on: tasks
|
|
23
23
|
concurrency: 5
|
|
24
24
|
skills:
|
|
25
|
-
- ../utils/load-base-sources.mjs
|
|
25
|
+
# - ../utils/load-base-sources.mjs
|
|
26
26
|
- ./set-custom-prompt.mjs
|
|
27
27
|
- type: "@aigne/agent-library/orchestrator"
|
|
28
28
|
input_schema:
|
|
@@ -41,12 +41,18 @@ skills:
|
|
|
41
41
|
url: objective.md
|
|
42
42
|
planner:
|
|
43
43
|
type: ai
|
|
44
|
-
model: anthropic/claude-opus-4-5
|
|
44
|
+
model: anthropic/claude-opus-4-5
|
|
45
45
|
instructions:
|
|
46
46
|
url: ../common/planner.md
|
|
47
47
|
input_schema:
|
|
48
48
|
type: object
|
|
49
49
|
properties:
|
|
50
|
+
workspace:
|
|
51
|
+
type: string
|
|
52
|
+
description: The workspace path
|
|
53
|
+
doc_smith_workspace:
|
|
54
|
+
type: string
|
|
55
|
+
description: The Doc Smith workspace path
|
|
50
56
|
plannerInitState:
|
|
51
57
|
type: string
|
|
52
58
|
description: The initial state of the planner
|
|
@@ -55,11 +61,18 @@ skills:
|
|
|
55
61
|
description: The custom planner prompt
|
|
56
62
|
worker:
|
|
57
63
|
type: ai
|
|
64
|
+
model: gemini-3-pro-preview
|
|
58
65
|
instructions:
|
|
59
66
|
url: ../common/worker.md
|
|
60
67
|
input_schema:
|
|
61
68
|
type: object
|
|
62
69
|
properties:
|
|
70
|
+
workspace:
|
|
71
|
+
type: string
|
|
72
|
+
description: The workspace path
|
|
73
|
+
doc_smith_workspace:
|
|
74
|
+
type: string
|
|
75
|
+
description: The Doc Smith workspace path
|
|
63
76
|
domainKnowledge:
|
|
64
77
|
type: string
|
|
65
78
|
description: The domain knowledge
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type: ai
|
|
2
|
+
name: predictResources
|
|
3
|
+
description: Predict necessary resources for documentation task
|
|
4
|
+
|
|
5
|
+
instructions:
|
|
6
|
+
url: ./instructions.md
|
|
7
|
+
|
|
8
|
+
input_schema:
|
|
9
|
+
type: object
|
|
10
|
+
properties:
|
|
11
|
+
query:
|
|
12
|
+
type: string
|
|
13
|
+
description: The user's documentation objective to predict resources for
|
|
14
|
+
path:
|
|
15
|
+
type: string
|
|
16
|
+
description: The workspace path
|
|
17
|
+
|
|
18
|
+
default_input:
|
|
19
|
+
path: "/modules/workspace"
|
|
20
|
+
|
|
21
|
+
output_schema:
|
|
22
|
+
type: object
|
|
23
|
+
properties:
|
|
24
|
+
data:
|
|
25
|
+
type: array
|
|
26
|
+
items:
|
|
27
|
+
type: string
|
|
28
|
+
description: A list of predicted resources needed for the documentation task, must be absolute file paths within the workspace.
|
|
29
|
+
|
|
30
|
+
afs:
|
|
31
|
+
modules:
|
|
32
|
+
- module: local-fs
|
|
33
|
+
options:
|
|
34
|
+
name: workspace
|
|
35
|
+
localPath: .
|
|
36
|
+
description: The target repository containing source code and documentation. Read-only, cannot be modified.
|
|
37
|
+
ignore:
|
|
38
|
+
- ".git"
|
|
39
|
+
- ".aigne"
|
|
40
|
+
- module: local-fs
|
|
41
|
+
options:
|
|
42
|
+
name: doc-smith
|
|
43
|
+
localPath: .aigne/doc-smith
|
|
44
|
+
description: The Doc Smith workspace for storing intermediate and output files
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
You are a resource prediction agent. Your job is to analyze a workspace directory structure and predict which files would be most relevant for a given documentation task.
|
|
2
|
+
|
|
3
|
+
## Your Responsibility
|
|
4
|
+
|
|
5
|
+
Given a workspace directory structure and a user's documentation objective, you must:
|
|
6
|
+
1. Analyze the directory structure to understand the project layout
|
|
7
|
+
2. Identify files that are most likely to provide useful context for the documentation task
|
|
8
|
+
3. Return a prioritized list of file paths that should be read
|
|
9
|
+
|
|
10
|
+
## Workspace Directory Structure
|
|
11
|
+
|
|
12
|
+
```yaml alt="The cached directory structure of the workspace"
|
|
13
|
+
{{ $afs.list("/modules/workspace", { maxChildren: 50, maxDepth: 10 }) | yaml.stringify }}
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```yaml alt="The cached directory structure of the doc-smith"
|
|
17
|
+
{{ $afs.list("/modules/doc-smith", { maxChildren: 50, maxDepth: 10 }) | yaml.stringify }}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Documentation Objective
|
|
21
|
+
|
|
22
|
+
```txt alt="The user's objective you should help predict resources for"
|
|
23
|
+
{{ query }}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Selection Principles
|
|
27
|
+
|
|
28
|
+
### What to Include
|
|
29
|
+
|
|
30
|
+
- **Entry points**: Main files, index files, configuration files that define project structure
|
|
31
|
+
- **Core modules**: Files that implement the main functionality related to the objective
|
|
32
|
+
- **Type definitions**: TypeScript types, interfaces, schemas that define data structures
|
|
33
|
+
- **Configuration**: Package.json, tsconfig.json, and other config files that reveal project dependencies and settings
|
|
34
|
+
- **Documentation**: Existing README files, docs that provide context
|
|
35
|
+
- **Examples**: Example files or test files that demonstrate usage patterns
|
|
36
|
+
|
|
37
|
+
### What to Exclude
|
|
38
|
+
|
|
39
|
+
- **Generated files**: Build outputs, compiled code, node_modules contents
|
|
40
|
+
- **Binary files**: Images, fonts, compiled assets (unless specifically relevant)
|
|
41
|
+
- **Lock files**: package-lock.json, yarn.lock, pnpm-lock.yaml
|
|
42
|
+
- **Cache/temp files**: .cache, .tmp, dist directories
|
|
43
|
+
- **Redundant files**: If multiple files serve similar purposes, select the most representative ones
|
|
44
|
+
|
|
45
|
+
### Prioritization Strategy
|
|
46
|
+
|
|
47
|
+
1. **High priority**: Files directly related to the documentation objective
|
|
48
|
+
2. **Medium priority**: Files that provide structural context (configs, types, main exports)
|
|
49
|
+
3. **Low priority**: Supporting files that may provide additional context
|
|
50
|
+
|
|
51
|
+
## Important Constraints
|
|
52
|
+
|
|
53
|
+
- **Return absolute paths**: All paths must be absolute paths within the workspace (e.g., `/modules/workspace/src/index.ts`)
|
|
54
|
+
- **Be selective**: Don't return every file. Focus on quality over quantity - typically 5-20 files is appropriate
|
|
55
|
+
- **Consider file size**: Prefer smaller, focused files over large monolithic ones when possible
|
|
56
|
+
- **No directories**: Return only file paths, not directory paths
|
|
57
|
+
- **Verify existence**: Only return files that exist in the provided directory structure
|
|
58
|
+
|
|
59
|
+
## Output Format
|
|
60
|
+
|
|
61
|
+
Return your prediction as a structured response with a `resources` array containing the predicted file paths, ordered by relevance (most relevant first).
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
type: team
|
|
2
2
|
name: GenerateStructure
|
|
3
|
-
# model: anthropic/claude-opus-4-5-20251101
|
|
4
3
|
description: Generate the structure of your documentation
|
|
5
4
|
input_schema:
|
|
6
5
|
type: object
|
|
@@ -15,40 +14,58 @@ input_schema:
|
|
|
15
14
|
type: string
|
|
16
15
|
description: Task related to this documentation structure
|
|
17
16
|
skills:
|
|
18
|
-
- ../utils/load-base-sources.mjs
|
|
17
|
+
# - ../utils/load-base-sources.mjs
|
|
19
18
|
- ./set-custom-prompt.mjs
|
|
20
19
|
- type: "@aigne/agent-library/orchestrator"
|
|
21
20
|
objective:
|
|
22
21
|
url: objective.md
|
|
23
22
|
planner:
|
|
24
23
|
type: ai
|
|
25
|
-
model: anthropic/claude-opus-4-5
|
|
24
|
+
model: anthropic/claude-opus-4-5
|
|
26
25
|
instructions:
|
|
27
26
|
url: ../common/planner.md
|
|
28
27
|
input_schema:
|
|
29
28
|
type: object
|
|
30
29
|
properties:
|
|
30
|
+
isStructureGenerator:
|
|
31
|
+
type: boolean
|
|
32
|
+
description: Flag indicating if this is for structure generation
|
|
33
|
+
workspace:
|
|
34
|
+
type: string
|
|
35
|
+
description: The workspace path
|
|
36
|
+
doc_smith_workspace:
|
|
37
|
+
type: string
|
|
38
|
+
description: The Doc Smith workspace path
|
|
31
39
|
plannerInitState:
|
|
32
40
|
type: string
|
|
33
41
|
description: The initial state of the planner
|
|
34
42
|
customPlannerPrompt:
|
|
35
43
|
type: string
|
|
36
44
|
description: The custom planner prompt
|
|
45
|
+
default_input:
|
|
46
|
+
isStructureGenerator: true
|
|
37
47
|
worker:
|
|
38
48
|
type: ai
|
|
49
|
+
model: gemini-3-pro-preview
|
|
39
50
|
instructions:
|
|
40
51
|
url: ../common/worker.md
|
|
41
52
|
input_schema:
|
|
42
53
|
type: object
|
|
43
54
|
properties:
|
|
55
|
+
workspace:
|
|
56
|
+
type: string
|
|
57
|
+
description: The workspace path
|
|
58
|
+
doc_smith_workspace:
|
|
59
|
+
type: string
|
|
60
|
+
description: The Doc Smith workspace path
|
|
44
61
|
domainKnowledge:
|
|
45
62
|
type: string
|
|
46
63
|
description: The domain knowledge
|
|
47
64
|
completer:
|
|
48
65
|
type: function
|
|
49
66
|
process: |
|
|
50
|
-
let message = '
|
|
51
|
-
return { message };
|
|
67
|
+
let message = 'Structure generation completed.';
|
|
68
|
+
return { task: input.task, message };
|
|
52
69
|
afs:
|
|
53
70
|
modules:
|
|
54
71
|
- module: local-fs
|
|
@@ -60,4 +77,10 @@ skills:
|
|
|
60
77
|
options:
|
|
61
78
|
name: doc-smith
|
|
62
79
|
localPath: .aigne/doc-smith
|
|
63
|
-
description: The Doc Smith workspace for storing intermediate and output files
|
|
80
|
+
description: The Doc Smith workspace for storing intermediate and output files
|
|
81
|
+
context:
|
|
82
|
+
search:
|
|
83
|
+
presets:
|
|
84
|
+
predict-resources:
|
|
85
|
+
select:
|
|
86
|
+
agent: "../predict-resources/index.yaml"
|