@biaoo/tiangong-wiki 0.2.0 → 0.2.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/README.md +39 -50
- package/README.zh-CN.md +39 -50
- package/SKILL.md +75 -107
- package/assets/templates/achievement.md +8 -8
- package/assets/templates/bridge.md +8 -8
- package/assets/templates/concept.md +14 -18
- package/assets/templates/faq.md +8 -10
- package/assets/templates/lesson.md +8 -8
- package/assets/templates/method.md +16 -8
- package/assets/templates/misconception.md +10 -10
- package/assets/templates/person.md +8 -8
- package/assets/templates/research-note.md +10 -10
- package/assets/templates/resume.md +11 -10
- package/assets/templates/source-summary.md +8 -12
- package/assets/tiangong-wiki-framework.png +0 -0
- package/assets/wiki.config.default.json +6 -3
- package/dist/commands/asset.js +21 -0
- package/dist/commands/skill.js +78 -0
- package/dist/commands/template.js +30 -0
- package/dist/core/cli-env.js +34 -5
- package/dist/core/global-config.js +61 -0
- package/dist/core/onboarding.js +252 -102
- package/dist/core/workflow-context.js +58 -21
- package/dist/core/workspace-skills.js +496 -60
- package/dist/daemon/server.js +8 -0
- package/dist/index.js +36 -1
- package/dist/operations/asset.js +81 -0
- package/dist/operations/query.js +25 -1
- package/dist/operations/template-lint.js +160 -0
- package/dist/utils/asset.js +75 -0
- package/dist/utils/errors.js +6 -0
- package/package.json +2 -1
- package/references/cli-interface.md +32 -1
- package/references/template-design-guide.md +125 -113
- package/references/{env.md → troubleshooting.md} +64 -33
- package/references/vault-to-wiki-instruction.md +109 -51
- package/references/wiki-maintenance-instruction.md +15 -15
|
@@ -1,16 +1,50 @@
|
|
|
1
|
-
# Template
|
|
1
|
+
# Template Design Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
How to design a new page type and its template for the wiki. Use this guide when the current ontology cannot cleanly represent new knowledge and a new type is genuinely needed.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## When to Create a New Type vs. Use an Existing One
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Before creating a new type, check whether the knowledge fits an existing type:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- **Structural difference** → new type needed (different fields, different sections)
|
|
12
|
+
- **Topic difference only** → use an existing type with different tags
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
Examples:
|
|
15
|
+
- "Environmental research note" vs. "Education research note" → same `research-note` type, different tags
|
|
16
|
+
- "Meeting minutes" vs. "Research note" → structurally different (participants, decisions, action items vs. research questions, literature, findings), new type needed
|
|
17
|
+
|
|
18
|
+
**Always discover the current ontology first:**
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
tiangong-wiki type list --format json
|
|
22
|
+
tiangong-wiki type recommend --text "<summary>" --keywords "a,b,c" --limit 5 --format json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If `type recommend` returns a good fit with high confidence, use that type. Only proceed with type creation when the fit is clearly poor.
|
|
26
|
+
|
|
27
|
+
## Create vs. Propose Only
|
|
28
|
+
|
|
29
|
+
When the existing type system is not a clean fit:
|
|
30
|
+
|
|
31
|
+
- **Create the template yourself** when the need is clear, the structure is well-defined, and you can design a complete template following this guide.
|
|
32
|
+
- **Use `propose_only`** (in vault-to-wiki workflow) or flag for human review when:
|
|
33
|
+
- The knowledge domain is unfamiliar and the right structure is uncertain
|
|
34
|
+
- Multiple reasonable type designs exist and the choice has long-term ontology impact
|
|
35
|
+
- The new type would overlap significantly with existing types
|
|
36
|
+
|
|
37
|
+
See `references/vault-to-wiki-instruction.md` for how `propose_only` works in the vault workflow.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Template Composition
|
|
42
|
+
|
|
43
|
+
A template has two parts — both are required:
|
|
44
|
+
|
|
45
|
+
### Template File (`templates/<type>.md`)
|
|
46
|
+
|
|
47
|
+
Defines the frontmatter fields and body section skeleton:
|
|
14
48
|
|
|
15
49
|
```yaml
|
|
16
50
|
---
|
|
@@ -29,16 +63,16 @@ updatedAt: 2026-04-06
|
|
|
29
63
|
|
|
30
64
|
## Section 1
|
|
31
65
|
|
|
32
|
-
|
|
66
|
+
Guiding prompt that tells the author what to write in this section.
|
|
33
67
|
|
|
34
68
|
## Section 2
|
|
35
69
|
|
|
36
70
|
...
|
|
37
71
|
```
|
|
38
72
|
|
|
39
|
-
###
|
|
73
|
+
### Config Registration (`wiki.config.json` under `templates.<type>`)
|
|
40
74
|
|
|
41
|
-
|
|
75
|
+
Defines how the type is indexed:
|
|
42
76
|
|
|
43
77
|
```json
|
|
44
78
|
{
|
|
@@ -49,57 +83,42 @@ updatedAt: 2026-04-06
|
|
|
49
83
|
}
|
|
50
84
|
```
|
|
51
85
|
|
|
52
|
-
|
|
86
|
+
The template file defines "what to write"; the config registration defines "how to index".
|
|
53
87
|
|
|
54
88
|
---
|
|
55
89
|
|
|
56
|
-
##
|
|
90
|
+
## Frontmatter Field Design
|
|
57
91
|
|
|
58
|
-
|
|
92
|
+
### Common Fields (inherited automatically)
|
|
59
93
|
|
|
60
|
-
|
|
61
|
-
- 还是仅仅是**主题**不同?(同样的结构,只是内容领域不同)
|
|
62
|
-
|
|
63
|
-
**主题差异用 tags 区分,结构差异才建新 type。**
|
|
64
|
-
|
|
65
|
-
示例判断:
|
|
66
|
-
- "环境领域的研究笔记" vs "教育领域的研究笔记" → 用 `research-note` + 不同 tags
|
|
67
|
-
- "会议纪要" vs "研究笔记" → 结构不同(参会人、决议、待办 vs 研究问题、文献、发现),需要新 type
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## 3. Frontmatter 字段设计
|
|
72
|
-
|
|
73
|
-
### 通用字段(不需要设计,自动继承)
|
|
74
|
-
|
|
75
|
-
所有 type 共享以下字段,模板中必须包含:
|
|
94
|
+
All types share these fields — always include them in the template:
|
|
76
95
|
|
|
77
96
|
```yaml
|
|
78
97
|
pageType, title, nodeId, status, visibility,
|
|
79
98
|
sourceRefs, relatedPages, tags, createdAt, updatedAt
|
|
80
99
|
```
|
|
81
100
|
|
|
82
|
-
### Type-
|
|
101
|
+
### Type-Specific Field Principles
|
|
83
102
|
|
|
84
|
-
1.
|
|
85
|
-
2.
|
|
86
|
-
3.
|
|
87
|
-
4.
|
|
103
|
+
1. **Only add fields that serve querying or classification.** If a field only appears in the body, it does not belong in frontmatter.
|
|
104
|
+
2. **Field values should be short text or enums**, not long paragraphs. Long content belongs in body sections.
|
|
105
|
+
3. **Use camelCase for field names** — the system maps them to snake_case column names automatically.
|
|
106
|
+
4. **Do not duplicate common field semantics.** For example, do not add a `category` field when `tags` already serves that purpose.
|
|
88
107
|
|
|
89
|
-
###
|
|
108
|
+
### Where to Register Each Field
|
|
90
109
|
|
|
91
|
-
|
|
|
110
|
+
| Question | Register in | Reason |
|
|
92
111
|
| --- | --- | --- |
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
112
|
+
| Need `tiangong-wiki find --<field>` filtering? | `columns` | Creates a SQLite indexed column for structured queries |
|
|
113
|
+
| Should appear in `search` / `fts` summaries? | `summaryFields` | Included in `summary_text` for retrieval |
|
|
114
|
+
| Generates an edge to another page/node? | `edges` | Written to the edges table for graph traversal |
|
|
115
|
+
| Just supplementary page info? | Still must be declared | Current implementation rejects undeclared fields — register in `columns`, `edges`, or `commonEdges` |
|
|
97
116
|
|
|
98
117
|
---
|
|
99
118
|
|
|
100
|
-
##
|
|
119
|
+
## Columns Design
|
|
101
120
|
|
|
102
|
-
`columns`
|
|
121
|
+
Fields in `columns` become indexed columns on the `pages` table, supporting `tiangong-wiki find` filtering.
|
|
103
122
|
|
|
104
123
|
```json
|
|
105
124
|
"columns": {
|
|
@@ -108,18 +127,18 @@ sourceRefs, relatedPages, tags, createdAt, updatedAt
|
|
|
108
127
|
}
|
|
109
128
|
```
|
|
110
129
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
130
|
+
Key points:
|
|
131
|
+
- Column type is currently only `"text"`
|
|
132
|
+
- Only fields that need frequent value-based filtering are worth indexing
|
|
133
|
+
- Different types share the same `pages` table — columns from other types are NULL
|
|
134
|
+
- Column names are globally unique — if two types both have `severity`, they share one column
|
|
135
|
+
- Every type-specific frontmatter field must be declared in at least `columns`, `edges`, or `commonEdges`; otherwise lint reports `unregistered_fields`
|
|
117
136
|
|
|
118
137
|
---
|
|
119
138
|
|
|
120
|
-
##
|
|
139
|
+
## Edges Design
|
|
121
140
|
|
|
122
|
-
`edges`
|
|
141
|
+
`edges` defines how frontmatter array fields generate graph edges.
|
|
123
142
|
|
|
124
143
|
```json
|
|
125
144
|
"edges": {
|
|
@@ -130,75 +149,68 @@ sourceRefs, relatedPages, tags, createdAt, updatedAt
|
|
|
130
149
|
}
|
|
131
150
|
```
|
|
132
151
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
| 字段 | 必填 | 说明 |
|
|
152
|
+
| Field | Required | Description |
|
|
136
153
|
| --- | --- | --- |
|
|
137
|
-
| `edgeType` |
|
|
138
|
-
| `resolve` |
|
|
139
|
-
| `match` |
|
|
140
|
-
|
|
141
|
-
**设计要点**:
|
|
154
|
+
| `edgeType` | Yes | Edge type identifier, written to `edges.edge_type` |
|
|
155
|
+
| `resolve` | Yes | Target matching: `"nodeId"` matches `pages.node_id`; `"path"` matches `pages.id` |
|
|
156
|
+
| `match` | No | Regex pre-filter — only matching values participate in resolve |
|
|
142
157
|
|
|
143
|
-
|
|
144
|
-
-
|
|
145
|
-
- `
|
|
146
|
-
- `
|
|
147
|
-
- `commonEdges`(`relatedPages`, `sourceRefs`)已全局生效,template 中不需要重复定义
|
|
158
|
+
Key points:
|
|
159
|
+
- Only array fields **pointing to other pages or nodes** need edge definitions
|
|
160
|
+
- `edgeType` should express a semantic relationship (`prerequisite`, `corrects`, `bridges_from`), not just the field name
|
|
161
|
+
- `commonEdges` (`relatedPages`, `sourceRefs`) are global — do not redefine them in templates
|
|
148
162
|
|
|
149
163
|
---
|
|
150
164
|
|
|
151
|
-
##
|
|
165
|
+
## SummaryFields Design
|
|
152
166
|
|
|
153
|
-
`summaryFields`
|
|
167
|
+
Fields in `summaryFields` are concatenated into `pages.summary_text` for semantic search and full-text search.
|
|
154
168
|
|
|
155
169
|
```json
|
|
156
170
|
"summaryFields": ["confidence", "masteryLevel", "prerequisites"]
|
|
157
171
|
```
|
|
158
172
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
- `
|
|
173
|
+
Key points:
|
|
174
|
+
- Choose fields that help retrieval — e.g., `domain: "environmental engineering"` helps search find the page
|
|
175
|
+
- Avoid long-text fields; `summary_text` should stay concise
|
|
176
|
+
- `defaultSummaryFields` (`title`, `tags`) are included automatically
|
|
177
|
+
- `summaryFields` only controls inclusion in `summary_text` — the field itself must still be declared in `columns`, `edges`, or `commonEdges`
|
|
164
178
|
|
|
165
179
|
---
|
|
166
180
|
|
|
167
|
-
##
|
|
168
|
-
|
|
169
|
-
Body section 是模板文件中 frontmatter 之后的 Markdown 骨架,引导作者(人或 AI)写出结构化内容。
|
|
181
|
+
## Body Section Design
|
|
170
182
|
|
|
171
|
-
|
|
183
|
+
Body sections are the Markdown skeleton after frontmatter, guiding the author (human or AI) to write structured content.
|
|
172
184
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
185
|
+
Principles:
|
|
186
|
+
1. **Each section starts with `##`**
|
|
187
|
+
2. **Write a specific guiding prompt** that explains the purpose and expected content
|
|
188
|
+
3. **Keep section count to 3–6** — too few lacks structure, too many adds burden
|
|
189
|
+
4. **Sections should have logical progression** — e.g., "what it is" → "why it matters" → "how to use it"
|
|
178
190
|
|
|
179
|
-
|
|
191
|
+
Good prompt example:
|
|
180
192
|
|
|
181
193
|
```markdown
|
|
182
|
-
##
|
|
194
|
+
## Core Understanding
|
|
183
195
|
|
|
184
|
-
|
|
196
|
+
In two to four sentences, explain what this concept is and why it is worth remembering.
|
|
185
197
|
```
|
|
186
198
|
|
|
187
|
-
|
|
199
|
+
Bad prompt example:
|
|
188
200
|
|
|
189
201
|
```markdown
|
|
190
|
-
##
|
|
202
|
+
## Content
|
|
191
203
|
|
|
192
|
-
<!--
|
|
204
|
+
<!-- Fill in content here -->
|
|
193
205
|
```
|
|
194
206
|
|
|
195
207
|
---
|
|
196
208
|
|
|
197
|
-
##
|
|
209
|
+
## Complete Example
|
|
198
210
|
|
|
199
|
-
|
|
211
|
+
Designing a `meeting-note` type:
|
|
200
212
|
|
|
201
|
-
###
|
|
213
|
+
### Template File `templates/meeting-note.md`
|
|
202
214
|
|
|
203
215
|
```yaml
|
|
204
216
|
---
|
|
@@ -217,24 +229,24 @@ participants: []
|
|
|
217
229
|
decisions: []
|
|
218
230
|
---
|
|
219
231
|
|
|
220
|
-
##
|
|
232
|
+
## Background
|
|
221
233
|
|
|
222
|
-
|
|
234
|
+
Briefly explain the purpose and context of this meeting so someone who did not attend can quickly understand why it was held.
|
|
223
235
|
|
|
224
|
-
##
|
|
236
|
+
## Key Discussion
|
|
225
237
|
|
|
226
|
-
|
|
238
|
+
Record the most important discussion points and disagreements. Focus on conflicts and final consensus, not a chronological transcript.
|
|
227
239
|
|
|
228
|
-
##
|
|
240
|
+
## Decisions
|
|
229
241
|
|
|
230
|
-
|
|
242
|
+
List specific decisions reached. Each decision should be actionable, not a vague direction.
|
|
231
243
|
|
|
232
|
-
##
|
|
244
|
+
## Follow-up Actions
|
|
233
245
|
|
|
234
|
-
|
|
246
|
+
List action items with owners and expected completion dates.
|
|
235
247
|
```
|
|
236
248
|
|
|
237
|
-
###
|
|
249
|
+
### Config Registration
|
|
238
250
|
|
|
239
251
|
```json
|
|
240
252
|
"meeting-note": {
|
|
@@ -247,25 +259,25 @@ decisions: []
|
|
|
247
259
|
}
|
|
248
260
|
```
|
|
249
261
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
- `
|
|
253
|
-
- `participants`
|
|
254
|
-
- `
|
|
255
|
-
-
|
|
256
|
-
- Body 4 个 section — 背景 → 讨论 → 决议 → 待办,逻辑递进
|
|
262
|
+
Design rationale:
|
|
263
|
+
- `meetingDate` as column — needed for date-based filtering
|
|
264
|
+
- `participants` not a column — searching via `tiangong-wiki fts` on summary_text is sufficient
|
|
265
|
+
- `participants` and `decisions` in summaryFields — helps search hits
|
|
266
|
+
- `decisions` not an edge — decisions are text, not references to other pages
|
|
267
|
+
- 4 body sections — background → discussion → decisions → follow-up, logical progression
|
|
257
268
|
|
|
258
269
|
---
|
|
259
270
|
|
|
260
|
-
##
|
|
271
|
+
## Checklist
|
|
261
272
|
|
|
262
|
-
|
|
273
|
+
After designing a template, verify:
|
|
263
274
|
|
|
264
|
-
- [ ]
|
|
265
|
-
- [ ]
|
|
266
|
-
- [ ]
|
|
267
|
-
- [ ]
|
|
268
|
-
- [ ] `summaryFields`
|
|
269
|
-
- [ ]
|
|
270
|
-
- [ ]
|
|
271
|
-
- [ ]
|
|
275
|
+
- [ ] The new type is structurally different from all existing types (not just topically different)?
|
|
276
|
+
- [ ] Every frontmatter field has a clear querying or classification purpose?
|
|
277
|
+
- [ ] Fields needing `tiangong-wiki find` filtering are in `columns`?
|
|
278
|
+
- [ ] Array fields generating graph edges are defined in `edges`?
|
|
279
|
+
- [ ] `summaryFields` includes key fields that aid retrieval?
|
|
280
|
+
- [ ] Every type-specific frontmatter field is declared in `columns`, `edges`, or `commonEdges`?
|
|
281
|
+
- [ ] Body has 3–6 sections with logical progression?
|
|
282
|
+
- [ ] Section prompts are specific, not generic placeholders?
|
|
283
|
+
- [ ] After creating a test page with `tiangong-wiki create --type <type> --title <title>`, both `tiangong-wiki lint` and `tiangong-wiki sync` pass with no errors?
|
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Troubleshooting
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Diagnosis and configuration reference for the wiki skill. Start with `tiangong-wiki doctor` for automated health checks.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Quick Diagnosis
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Run the built-in diagnostic
|
|
11
|
+
tiangong-wiki doctor
|
|
12
|
+
|
|
13
|
+
# Check configuration validity
|
|
14
|
+
tiangong-wiki check-config
|
|
15
|
+
|
|
16
|
+
# Check workspace health
|
|
17
|
+
tiangong-wiki stat
|
|
18
|
+
tiangong-wiki lint
|
|
19
|
+
```
|
|
4
20
|
|
|
5
21
|
---
|
|
6
22
|
|
|
7
|
-
##
|
|
23
|
+
## Environment Variables
|
|
24
|
+
|
|
25
|
+
All configuration is managed through `.wiki.env` (created by `tiangong-wiki setup`). Variables can also be set in shell environment or a `.env` file.
|
|
26
|
+
|
|
27
|
+
### Core
|
|
8
28
|
|
|
9
29
|
| Variable | Required | Description |
|
|
10
30
|
| --- | --- | --- |
|
|
@@ -14,7 +34,7 @@ All configuration is managed through `.wiki.env` (created by `tiangong-wiki setu
|
|
|
14
34
|
| `WIKI_TEMPLATES_PATH` | Yes | Path to the templates directory |
|
|
15
35
|
| `WIKI_SYNC_INTERVAL` | No | Auto-sync interval in seconds (default: `86400`) |
|
|
16
36
|
|
|
17
|
-
|
|
37
|
+
### Vault
|
|
18
38
|
|
|
19
39
|
| Variable | Required | Description |
|
|
20
40
|
| --- | --- | --- |
|
|
@@ -23,7 +43,7 @@ All configuration is managed through `.wiki.env` (created by `tiangong-wiki setu
|
|
|
23
43
|
| `VAULT_HASH_MODE` | No | Hash mode for change detection (`content` or `mtime`, default: `mtime`) |
|
|
24
44
|
| `VAULT_SYNOLOGY_REMOTE_PATH` | If `synology` | Remote path on Synology NAS |
|
|
25
45
|
|
|
26
|
-
|
|
46
|
+
### Synology (when `VAULT_SOURCE=synology`)
|
|
27
47
|
|
|
28
48
|
| Variable | Required | Description |
|
|
29
49
|
| --- | --- | --- |
|
|
@@ -33,7 +53,7 @@ All configuration is managed through `.wiki.env` (created by `tiangong-wiki setu
|
|
|
33
53
|
| `SYNOLOGY_VERIFY_SSL` | No | Verify SSL certificates (default: `true`) |
|
|
34
54
|
| `SYNOLOGY_READONLY` | No | Read-only mode (default: `false`) |
|
|
35
55
|
|
|
36
|
-
|
|
56
|
+
### Embedding
|
|
37
57
|
|
|
38
58
|
| Variable | Required | Description |
|
|
39
59
|
| --- | --- | --- |
|
|
@@ -42,9 +62,9 @@ All configuration is managed through `.wiki.env` (created by `tiangong-wiki setu
|
|
|
42
62
|
| `EMBEDDING_MODEL` | Yes | Embedding model name |
|
|
43
63
|
| `EMBEDDING_DIMENSIONS` | No | Vector dimensions (default: model-dependent) |
|
|
44
64
|
|
|
45
|
-
|
|
65
|
+
### Agent (Agentic Workflow)
|
|
46
66
|
|
|
47
|
-
The agent uses [Codex SDK](https://www.npmjs.com/package/@openai/codex-sdk) to process vault items. When `WIKI_AGENT_BASE_URL` is set, a custom `model_provider` is injected to override any global `~/.codex/config.toml` settings
|
|
67
|
+
The agent uses [Codex SDK](https://www.npmjs.com/package/@openai/codex-sdk) to process vault items. When `WIKI_AGENT_BASE_URL` is set, a custom `model_provider` is injected to override any global `~/.codex/config.toml` settings.
|
|
48
68
|
|
|
49
69
|
| Variable | Required | Description |
|
|
50
70
|
| --- | --- | --- |
|
|
@@ -55,9 +75,38 @@ The agent uses [Codex SDK](https://www.npmjs.com/package/@openai/codex-sdk) to p
|
|
|
55
75
|
| `WIKI_AGENT_BATCH_SIZE` | No | Max concurrent vault items per batch (default: `5`) |
|
|
56
76
|
| `WIKI_PARSER_SKILLS` | No | Comma-separated parser skill list (e.g. `pdf,docx,pptx,xlsx`) |
|
|
57
77
|
|
|
58
|
-
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Common Issues
|
|
81
|
+
|
|
82
|
+
### "WIKI_PATH is not set" or config errors
|
|
83
|
+
|
|
84
|
+
Run `tiangong-wiki setup` to create `.wiki.env` with all required paths. Verify with `tiangong-wiki check-config`.
|
|
85
|
+
|
|
86
|
+
### Semantic search returns no results
|
|
87
|
+
|
|
88
|
+
`tiangong-wiki search` and `tiangong-wiki type recommend` (with embeddings) require `EMBEDDING_*` variables. If not configured, use `tiangong-wiki fts` (full-text search) or `tiangong-wiki find` (metadata filter) instead.
|
|
89
|
+
|
|
90
|
+
### Index out of sync
|
|
59
91
|
|
|
60
|
-
|
|
92
|
+
Run `tiangong-wiki sync` to rebuild. For a single page: `tiangong-wiki sync --path <page-id>`.
|
|
93
|
+
|
|
94
|
+
### Lint errors after page edits
|
|
95
|
+
|
|
96
|
+
Always run `tiangong-wiki lint --path <page-id> --format json` after mutations. Common lint issues:
|
|
97
|
+
- Missing required frontmatter fields for the page type
|
|
98
|
+
- Broken `sourceRefs` pointing to non-existent pages
|
|
99
|
+
- Orphan pages with no graph connections
|
|
100
|
+
|
|
101
|
+
### Parser skills not found
|
|
102
|
+
|
|
103
|
+
Parser skills must be installed under `<workspace-root>/.agents/skills/`. Run `tiangong-wiki skill` to inspect installed skills. Use `tiangong-wiki skill update --all` to update.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## LLM Provider Setup
|
|
108
|
+
|
|
109
|
+
### OpenAI (default)
|
|
61
110
|
|
|
62
111
|
```env
|
|
63
112
|
WIKI_AGENT_ENABLED=true
|
|
@@ -65,9 +114,9 @@ WIKI_AGENT_API_KEY=sk-...
|
|
|
65
114
|
WIKI_AGENT_MODEL=gpt-5.4
|
|
66
115
|
```
|
|
67
116
|
|
|
68
|
-
### vLLM
|
|
117
|
+
### vLLM (self-hosted)
|
|
69
118
|
|
|
70
|
-
vLLM
|
|
119
|
+
Requires vLLM **v0.8.5+** for Responses API support (`/v1/responses`).
|
|
71
120
|
|
|
72
121
|
```env
|
|
73
122
|
WIKI_AGENT_ENABLED=true
|
|
@@ -78,19 +127,9 @@ WIKI_AGENT_MODEL=Qwen/Qwen3.5-397B-A17B-GPTQ-Int4
|
|
|
78
127
|
|
|
79
128
|
#### Chat template: `developer` role support
|
|
80
129
|
|
|
81
|
-
The Codex CLI sends `developer`-role messages
|
|
130
|
+
The Codex CLI sends `developer`-role messages. Most model chat templates only recognize `system`, `user`, `assistant`, and `tool` — they will reject `developer` with `400 Bad Request: "Unexpected message role."`.
|
|
82
131
|
|
|
83
|
-
|
|
84
|
-
400 Bad Request: "Unexpected message role."
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
**Fix:** Use a modified chat template that maps `developer` → `system`. A ready-to-use template for Qwen3.5 is included at:
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
assets/vllm/qwen3_5_openai_developer.jinja
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Launch vLLM with the custom template:
|
|
132
|
+
**Fix:** Use a modified chat template that maps `developer` → `system`. A ready-to-use template for Qwen3.5 is at `assets/vllm/qwen3_5_openai_developer.jinja`.
|
|
94
133
|
|
|
95
134
|
```bash
|
|
96
135
|
vllm serve <model> \
|
|
@@ -98,17 +137,11 @@ vllm serve <model> \
|
|
|
98
137
|
--port 7730
|
|
99
138
|
```
|
|
100
139
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
1. **Instruction prefix detection** — counts both `system` and `developer` at the start of the conversation (line 56)
|
|
104
|
-
2. **Role normalization** — `developer` → `system` throughout the conversation loop (lines 111, 160, 166)
|
|
105
|
-
|
|
106
|
-
> For other model families (LLaMA, Mistral, etc.), apply the same pattern: find `message.role == "system"` checks in the template and extend them to also match `"developer"`.
|
|
140
|
+
For other model families, apply the same pattern: extend `message.role == "system"` checks to also match `"developer"`.
|
|
107
141
|
|
|
108
142
|
#### Verifying vLLM compatibility
|
|
109
143
|
|
|
110
144
|
```bash
|
|
111
|
-
# Test the /v1/responses endpoint directly
|
|
112
145
|
curl -s http://<host>:<port>/v1/responses \
|
|
113
146
|
-H "Content-Type: application/json" \
|
|
114
147
|
-H "Authorization: Bearer <token>" \
|
|
@@ -118,5 +151,3 @@ curl -s http://<host>:<port>/v1/responses \
|
|
|
118
151
|
"reasoning": {"effort": "low"}
|
|
119
152
|
}' | head -c 500
|
|
120
153
|
```
|
|
121
|
-
|
|
122
|
-
A successful response returns a JSON object with `output` containing the model's reply.
|