@itradingai/aiwiki 0.2.19 → 0.2.21
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 +14 -1
- package/dist/src/app.js +120 -10
- package/docs/AGENT_HANDOFF.md +27 -0
- package/docs/FAQ.md +18 -0
- package/docs/README.md +5 -0
- package/docs/RELEASE.md +9 -14
- package/docs/ROADMAP.md +1 -0
- package/docs/SHOWCASE.md +19 -9
- package/docs/USAGE.md +15 -11
- package/examples/demo-run/README.md +28 -0
- package/examples/demo-run/context-output.json +341 -0
- package/examples/demo-run/ingest-agent-output.txt +25 -0
- package/examples/demo-run/ingest-file-output.txt +23 -0
- package/examples/demo-run/input/agent-enriched-payload.json +88 -0
- package/examples/demo-run/input/local-article.md +5 -0
- package/examples/demo-run/lint-output.json +46 -0
- package/examples/demo-run/query-output.txt +54 -0
- package/examples/demo-run/setup-output.txt +9 -0
- package/examples/demo-run/status-output.txt +20 -0
- package/examples/obsidian-vault-sample/02-raw/articles/llm-wiki-notes.md +32 -0
- package/examples/obsidian-vault-sample/02-raw/articles/local-article.md +33 -0
- package/examples/obsidian-vault-sample/03-sources/article-cards/llm-wiki-notes.md +62 -0
- package/examples/obsidian-vault-sample/03-sources/article-cards/local-article.md +58 -0
- package/examples/obsidian-vault-sample/04-claims/_suggestions/llm-wiki-notes-claims.md +58 -0
- package/examples/obsidian-vault-sample/05-wiki/source-knowledge/llm-wiki-notes.md +103 -0
- package/examples/obsidian-vault-sample/05-wiki/source-knowledge/local-article.md +72 -0
- package/examples/obsidian-vault-sample/06-assets/_suggestions/llm-wiki-notes-assets.md +29 -0
- package/examples/obsidian-vault-sample/07-topics/ready/llm-wiki-notes-topics.md +29 -0
- package/examples/obsidian-vault-sample/08-outputs/outlines/llm-wiki-notes-outline.md +43 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603905-085f05/payload.json +24 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603905-085f05/processing-summary.md +56 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603905-085f05/raw.md +33 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603905-085f05/source-card.md +58 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603905-085f05/wiki-entry.md +72 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603980-89f570/creative-assets.md +29 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603980-89f570/draft-outline.md +43 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603980-89f570/payload.json +91 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603980-89f570/processing-summary.md +67 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603980-89f570/raw.md +32 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603980-89f570/source-card.md +62 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603980-89f570/topics.md +29 -0
- package/examples/obsidian-vault-sample/09-runs/20260608-160603980-89f570/wiki-entry.md +103 -0
- package/examples/obsidian-vault-sample/_system/index.md +37 -0
- package/examples/obsidian-vault-sample/_system/log.md +8 -0
- package/examples/obsidian-vault-sample/_system/purpose.md +31 -0
- package/examples/obsidian-vault-sample/_system/schemas/aiwiki-frontmatter.md +21 -0
- package/examples/obsidian-vault-sample/_system/templates/review-note.md +16 -0
- package/examples/obsidian-vault-sample/_system/templates/source-card.md +34 -0
- package/examples/obsidian-vault-sample/aiwiki.yaml +18 -0
- package/examples/obsidian-vault-sample/dashboards/AIWiki Home.md +31 -0
- package/examples/obsidian-vault-sample/dashboards/Recent Runs.md +10 -0
- package/examples/obsidian-vault-sample/dashboards/Review Queue.md +12 -0
- package/examples/obsidian-vault-sample/dashboards/Source Cards.md +10 -0
- package/examples/obsidian-vault-sample/dashboards/Topic Pipeline.md +10 -0
- package/examples/obsidian-vault-sample/dashboards/Wiki Entries.md +10 -0
- package/package.json +2 -1
- package/skill/SKILL.md +28 -1
package/README.md
CHANGED
|
@@ -43,6 +43,15 @@ aiwiki lint
|
|
|
43
43
|
|
|
44
44
|
`lint` 会检查缺失链接、重复来源、fallback Wiki 条目、enriched 条目缺字段等问题,并写入 `dashboards/Lint Report.md`。
|
|
45
45
|
|
|
46
|
+
## 示例
|
|
47
|
+
|
|
48
|
+
仓库内置了一个由当前 CLI 重新生成的样例:
|
|
49
|
+
|
|
50
|
+
- `examples/demo-run/`:输入材料、执行命令和关键 CLI 输出。
|
|
51
|
+
- `examples/obsidian-vault-sample/`:可直接查看的样例知识库。
|
|
52
|
+
|
|
53
|
+
样例展示了核心产物优先的约定:Raw、Source Card、Wiki Entry、Run Summary、Processing Summary 总是最先检查;Claim、Asset、Topic、Outline 只在 payload 有对应内容或明确请求时出现。
|
|
54
|
+
|
|
46
55
|
## 快速开始
|
|
47
56
|
|
|
48
57
|
### 第一步:安装 AIWiki CLI
|
|
@@ -55,7 +64,9 @@ aiwiki lint
|
|
|
55
64
|
我的知识库路径:F:\knowledges
|
|
56
65
|
|
|
57
66
|
请检查 Node.js >=20,执行 aiwiki setup --path "我的知识库路径" --yes,
|
|
58
|
-
然后运行 aiwiki agent sync --yes
|
|
67
|
+
然后运行 aiwiki agent sync --yes、aiwiki agent check --json、
|
|
68
|
+
aiwiki agent sync --path "我的知识库路径" --yes 和 aiwiki agent check --path "我的知识库路径" --json,
|
|
69
|
+
完成宿主 Agent 与知识库根指导对接。
|
|
59
70
|
最后执行 aiwiki doctor 和 aiwiki status,告诉我实际执行了哪些命令和还差什么手动步骤。
|
|
60
71
|
```
|
|
61
72
|
|
|
@@ -72,6 +83,8 @@ aiwiki agent check --json
|
|
|
72
83
|
```bash
|
|
73
84
|
aiwiki agent sync --yes
|
|
74
85
|
aiwiki agent check --json
|
|
86
|
+
aiwiki agent sync --path "F:\knowledges" --yes
|
|
87
|
+
aiwiki agent check --path "F:\knowledges" --json
|
|
75
88
|
```
|
|
76
89
|
|
|
77
90
|
也可以直接输出通用协议:
|
package/dist/src/app.js
CHANGED
|
@@ -65,6 +65,7 @@ export async function runCli(argv, streams = { stdout: process.stdout, stderr: p
|
|
|
65
65
|
if (command === "agent" && subcommand === "sync") {
|
|
66
66
|
const result = await syncAgentSkills({
|
|
67
67
|
agentId: flagString(args, "agent"),
|
|
68
|
+
workspaceRoot: flagString(args, "path"),
|
|
68
69
|
yes: flagBool(args, "yes"),
|
|
69
70
|
dryRun: flagBool(args, "dry-run"),
|
|
70
71
|
json: flagBool(args, "json"),
|
|
@@ -79,7 +80,7 @@ export async function runCli(argv, streams = { stdout: process.stdout, stderr: p
|
|
|
79
80
|
return 0;
|
|
80
81
|
}
|
|
81
82
|
if (command === "agent" && subcommand === "check") {
|
|
82
|
-
await printAgentCheckDetailed(streams.stdout, await discoverAgentTargets(), flagBool(args, "json"));
|
|
83
|
+
await printAgentCheckDetailed(streams.stdout, await discoverAgentTargets(flagString(args, "path")), flagBool(args, "json"));
|
|
83
84
|
return 0;
|
|
84
85
|
}
|
|
85
86
|
if (command === "agent" && (subcommand === "list" || !subcommand)) {
|
|
@@ -287,10 +288,12 @@ function printAgentHelp(stream) {
|
|
|
287
288
|
writeLine(stream, " aiwiki agent sync --yes");
|
|
288
289
|
writeLine(stream, " aiwiki agent sync --agent codex --yes");
|
|
289
290
|
writeLine(stream, " aiwiki agent sync --agent codex --dry-run");
|
|
291
|
+
writeLine(stream, " aiwiki agent sync --path <workspace> --yes");
|
|
290
292
|
writeLine(stream, " aiwiki agent sync --json --yes");
|
|
291
293
|
writeLine(stream, "");
|
|
292
294
|
writeLine(stream, "Status:");
|
|
293
295
|
writeLine(stream, " aiwiki agent check");
|
|
296
|
+
writeLine(stream, " aiwiki agent check --path <workspace> --json");
|
|
294
297
|
writeLine(stream, " aiwiki agent check --json");
|
|
295
298
|
writeLine(stream, "");
|
|
296
299
|
writeLine(stream, "Compatibility:");
|
|
@@ -324,7 +327,21 @@ function parseLintSeverity(value) {
|
|
|
324
327
|
}
|
|
325
328
|
throw new CliError("lint --severity must be error, warning, or info");
|
|
326
329
|
}
|
|
327
|
-
|
|
330
|
+
const AIWIKI_AGENT_GUIDANCE_START = "<!-- AIWIKI:AGENT-GUIDANCE:START -->";
|
|
331
|
+
const AIWIKI_AGENT_GUIDANCE_END = "<!-- AIWIKI:AGENT-GUIDANCE:END -->";
|
|
332
|
+
const REQUIRED_AGENT_GUIDANCE_TERMS = [
|
|
333
|
+
"aiwiki setup",
|
|
334
|
+
"aiwiki agent sync",
|
|
335
|
+
"aiwiki agent check",
|
|
336
|
+
"aiwiki lint --json",
|
|
337
|
+
"aiwiki lint --fix-empty-dirs --json",
|
|
338
|
+
"aiwiki ingest-file",
|
|
339
|
+
"aiwiki ingest-agent",
|
|
340
|
+
"aiwiki status",
|
|
341
|
+
"aiwiki query",
|
|
342
|
+
"aiwiki context"
|
|
343
|
+
];
|
|
344
|
+
async function discoverAgentTargets(workspaceRoot) {
|
|
328
345
|
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
329
346
|
const skillSource = path.join(packageRoot, "skill", "SKILL.md");
|
|
330
347
|
const promptSource = path.join(packageRoot, "docs", "AGENT_HANDOFF.md");
|
|
@@ -334,7 +351,8 @@ async function discoverAgentTargets() {
|
|
|
334
351
|
const claudeHome = process.env.CLAUDE_HOME ? path.resolve(process.env.CLAUDE_HOME) : path.join(os.homedir(), ".claude");
|
|
335
352
|
const opencodeHome = process.env.OPENCODE_HOME ? path.resolve(process.env.OPENCODE_HOME) : path.join(os.homedir(), ".opencode");
|
|
336
353
|
const hermesHome = process.env.HERMES_HOME ? path.resolve(process.env.HERMES_HOME) : path.join(process.env.LOCALAPPDATA ?? path.join(os.homedir(), "AppData", "Local"), "hermes");
|
|
337
|
-
|
|
354
|
+
const workspace = workspaceRoot ? path.resolve(workspaceRoot) : undefined;
|
|
355
|
+
const targets = [
|
|
338
356
|
{
|
|
339
357
|
id: "codex",
|
|
340
358
|
name: "Codex",
|
|
@@ -392,6 +410,18 @@ async function discoverAgentTargets() {
|
|
|
392
410
|
note: "已检测到,但暂未确认稳定的 skill 目录。请先使用 aiwiki prompt agent。"
|
|
393
411
|
}
|
|
394
412
|
];
|
|
413
|
+
if (workspace) {
|
|
414
|
+
targets.unshift({
|
|
415
|
+
id: "workspace",
|
|
416
|
+
name: "Workspace AGENTS.md",
|
|
417
|
+
detected: await exists(workspace),
|
|
418
|
+
installable: true,
|
|
419
|
+
kind: "root_guidance",
|
|
420
|
+
target: path.join(workspace, "AGENTS.md"),
|
|
421
|
+
note: "安装 marker-bounded 根指导,要求宿主 Agent 在整理、检查、入库、查询、复用时优先调用 aiwiki CLI。"
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return targets;
|
|
395
425
|
}
|
|
396
426
|
function printAgentList(stream, targets) {
|
|
397
427
|
writeLine(stream, "AIWiki 宿主 Agent 目标");
|
|
@@ -432,6 +462,7 @@ async function printAgentCheckDetailed(stream, targets, json = false) {
|
|
|
432
462
|
installable: target.installable,
|
|
433
463
|
installed: target.installed,
|
|
434
464
|
state: target.state,
|
|
465
|
+
suggested_action: suggestedAgentAction(target),
|
|
435
466
|
source: target.source,
|
|
436
467
|
target: target.target
|
|
437
468
|
}))
|
|
@@ -441,14 +472,21 @@ async function printAgentCheckDetailed(stream, targets, json = false) {
|
|
|
441
472
|
writeLine(stream, "AIWiki Agent check");
|
|
442
473
|
for (const target of checked) {
|
|
443
474
|
writeLine(stream, `${target.id}: ${target.name} | detected=${target.detected ? "yes" : "no"} | installed=${target.installed ? "yes" : "no"} | installable=${target.installable ? "yes" : "no"} | state=${target.state}`);
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
else if (target.detected && !target.installable) {
|
|
448
|
-
writeLine(stream, " suggested: aiwiki prompt agent");
|
|
475
|
+
const suggested = suggestedAgentAction(target);
|
|
476
|
+
if (suggested) {
|
|
477
|
+
writeLine(stream, ` suggested: ${suggested}`);
|
|
449
478
|
}
|
|
450
479
|
}
|
|
451
480
|
}
|
|
481
|
+
function suggestedAgentAction(target) {
|
|
482
|
+
if (target.detected && target.installable && (target.state === "missing" || target.state === "different")) {
|
|
483
|
+
return target.id === "workspace" ? `aiwiki agent sync --path "${path.dirname(target.target ?? ".")}" --yes` : `aiwiki agent sync --agent ${target.id} --yes`;
|
|
484
|
+
}
|
|
485
|
+
if (target.detected && !target.installable) {
|
|
486
|
+
return "aiwiki prompt agent";
|
|
487
|
+
}
|
|
488
|
+
return undefined;
|
|
489
|
+
}
|
|
452
490
|
async function installAgentSkill(options) {
|
|
453
491
|
const targets = await discoverAgentTargets();
|
|
454
492
|
const installable = targets.filter((target) => target.detected && target.installable);
|
|
@@ -503,7 +541,7 @@ async function askQuestion(streams, question) {
|
|
|
503
541
|
}
|
|
504
542
|
}
|
|
505
543
|
async function syncAgentSkills(options) {
|
|
506
|
-
const targets = await discoverAgentTargets();
|
|
544
|
+
const targets = await discoverAgentTargets(options.workspaceRoot);
|
|
507
545
|
const selected = options.agentId ? targets.find((target) => target.id === options.agentId) : undefined;
|
|
508
546
|
if (!selected && options.agentId) {
|
|
509
547
|
throw new CliError(`未知宿主 Agent: ${options.agentId}`);
|
|
@@ -546,6 +584,9 @@ async function copyInstallFileSafe(source, target, force) {
|
|
|
546
584
|
return { action: targetExists ? "updated" : "installed", backupPath };
|
|
547
585
|
}
|
|
548
586
|
async function inspectAgentTarget(target) {
|
|
587
|
+
if (target.kind === "root_guidance") {
|
|
588
|
+
return inspectWorkspaceGuidanceTarget(target);
|
|
589
|
+
}
|
|
549
590
|
if (!target.installable || !target.source || !target.target) {
|
|
550
591
|
return "unsupported";
|
|
551
592
|
}
|
|
@@ -567,7 +608,7 @@ async function syncAgentTarget(target, dryRun) {
|
|
|
567
608
|
changed: false,
|
|
568
609
|
dryRun
|
|
569
610
|
};
|
|
570
|
-
if (state === "unsupported" || !target.
|
|
611
|
+
if (state === "unsupported" || !target.target || (!target.source && target.kind !== "root_guidance")) {
|
|
571
612
|
return { ...base, action: "unsupported", note: target.note };
|
|
572
613
|
}
|
|
573
614
|
if (state === "current") {
|
|
@@ -576,9 +617,78 @@ async function syncAgentTarget(target, dryRun) {
|
|
|
576
617
|
if (dryRun) {
|
|
577
618
|
return { ...base, action: state === "missing" ? "would_install" : "would_update", changed: true };
|
|
578
619
|
}
|
|
620
|
+
if (target.kind === "root_guidance") {
|
|
621
|
+
const result = await syncWorkspaceGuidanceTarget(target);
|
|
622
|
+
return { ...base, action: result.action, backupPath: result.backupPath, changed: result.action !== "current" };
|
|
623
|
+
}
|
|
579
624
|
const result = await copyInstallFileSafe(target.source, target.target, true);
|
|
580
625
|
return { ...base, action: result.action, backupPath: result.backupPath, changed: result.action !== "current" };
|
|
581
626
|
}
|
|
627
|
+
async function inspectWorkspaceGuidanceTarget(target) {
|
|
628
|
+
if (!target.target || !target.detected) {
|
|
629
|
+
return "missing";
|
|
630
|
+
}
|
|
631
|
+
if (!(await exists(target.target))) {
|
|
632
|
+
return "missing";
|
|
633
|
+
}
|
|
634
|
+
const content = await fs.readFile(target.target, "utf8");
|
|
635
|
+
const block = extractWorkspaceGuidanceBlock(content);
|
|
636
|
+
if (!block) {
|
|
637
|
+
return "different";
|
|
638
|
+
}
|
|
639
|
+
return block.trim() === workspaceGuidanceBlock().trim() && REQUIRED_AGENT_GUIDANCE_TERMS.every((term) => block.includes(term)) ? "current" : "different";
|
|
640
|
+
}
|
|
641
|
+
async function syncWorkspaceGuidanceTarget(target) {
|
|
642
|
+
if (!target.target) {
|
|
643
|
+
return { action: "unsupported" };
|
|
644
|
+
}
|
|
645
|
+
const targetExists = await exists(target.target);
|
|
646
|
+
const existing = targetExists ? await fs.readFile(target.target, "utf8") : "";
|
|
647
|
+
const next = mergeWorkspaceGuidance(existing);
|
|
648
|
+
if (targetExists && existing === next) {
|
|
649
|
+
return { action: "current" };
|
|
650
|
+
}
|
|
651
|
+
const backupPath = targetExists ? await backupFile(target.target) : undefined;
|
|
652
|
+
await fs.mkdir(path.dirname(target.target), { recursive: true });
|
|
653
|
+
await fs.writeFile(target.target, next, "utf8");
|
|
654
|
+
return { action: targetExists ? "updated" : "installed", backupPath };
|
|
655
|
+
}
|
|
656
|
+
function extractWorkspaceGuidanceBlock(content) {
|
|
657
|
+
const start = content.indexOf(AIWIKI_AGENT_GUIDANCE_START);
|
|
658
|
+
const end = content.indexOf(AIWIKI_AGENT_GUIDANCE_END);
|
|
659
|
+
if (start === -1 || end === -1 || end < start) {
|
|
660
|
+
return undefined;
|
|
661
|
+
}
|
|
662
|
+
return content.slice(start, end + AIWIKI_AGENT_GUIDANCE_END.length);
|
|
663
|
+
}
|
|
664
|
+
function mergeWorkspaceGuidance(existing) {
|
|
665
|
+
const block = workspaceGuidanceBlock();
|
|
666
|
+
const start = existing.indexOf(AIWIKI_AGENT_GUIDANCE_START);
|
|
667
|
+
const end = existing.indexOf(AIWIKI_AGENT_GUIDANCE_END);
|
|
668
|
+
if (start !== -1 && end !== -1 && end > start) {
|
|
669
|
+
return `${existing.slice(0, start)}${block}${existing.slice(end + AIWIKI_AGENT_GUIDANCE_END.length)}`;
|
|
670
|
+
}
|
|
671
|
+
const trimmed = existing.trimEnd();
|
|
672
|
+
return `${trimmed}${trimmed ? "\n\n" : ""}${block}\n`;
|
|
673
|
+
}
|
|
674
|
+
function workspaceGuidanceBlock() {
|
|
675
|
+
return `${AIWIKI_AGENT_GUIDANCE_START}
|
|
676
|
+
# AIWiki Agent Command Contract
|
|
677
|
+
|
|
678
|
+
When a user asks to organize, inspect, ingest, query, reuse, or maintain this AIWiki workspace, call the AIWiki CLI first. Do not start with generic file search, grep/find scans, or ad hoc note edits unless the AIWiki command cannot answer the request.
|
|
679
|
+
|
|
680
|
+
Required command-first loop:
|
|
681
|
+
|
|
682
|
+
1. Ensure the workspace exists with \`aiwiki setup --path <workspace> --yes\`.
|
|
683
|
+
2. Keep host-Agent guidance current with \`aiwiki agent sync --path <workspace> --yes\` and verify with \`aiwiki agent check --path <workspace> --json\`.
|
|
684
|
+
3. Inspect structure with \`aiwiki lint --json --path <workspace>\`; apply only safe fixes with \`aiwiki lint --fix-empty-dirs --json --path <workspace>\` when allowed, then rerun \`aiwiki lint --json --path <workspace>\`.
|
|
685
|
+
4. Ingest local material with \`aiwiki ingest-file --file <file> --path <workspace>\` or structured Agent material with \`aiwiki ingest-agent --stdin --path <workspace>\`.
|
|
686
|
+
5. Check progress with \`aiwiki status --path <workspace>\`.
|
|
687
|
+
6. Retrieve reusable knowledge with \`aiwiki query <topic> --path <workspace>\` for human-readable output or \`aiwiki context <topic> --path <workspace>\` for Agent JSON.
|
|
688
|
+
|
|
689
|
+
Use fallback shell/file search only after the relevant AIWiki command has been tried or when the command is unavailable. If you fall back, say which AIWiki command was insufficient and why.
|
|
690
|
+
${AIWIKI_AGENT_GUIDANCE_END}`;
|
|
691
|
+
}
|
|
582
692
|
async function sameFileContent(source, target) {
|
|
583
693
|
try {
|
|
584
694
|
const [sourceText, targetText] = await Promise.all([fs.readFile(source, "utf8"), fs.readFile(target, "utf8")]);
|
package/docs/AGENT_HANDOFF.md
CHANGED
|
@@ -24,6 +24,32 @@ AIWiki CLI 不做通用网页抓取,也不调用 LLM。网页读取失败时
|
|
|
24
24
|
|
|
25
25
|
证据和疑似风险要分开:`source_quote` 等能回到原文的字段是宿主提供的 evidence/provenance;`coverage_suspected_incomplete`、`unsupported_claims`、`needs_review` 是 AIWiki 的复核提示,不代表已经证明遗漏或错误。
|
|
26
26
|
|
|
27
|
+
## 命令优先契约
|
|
28
|
+
|
|
29
|
+
宿主 Agent 处理 AIWiki 任务时,必须先调用 AIWiki 自带命令,再考虑通用文件搜索或临时脚本。否则只是绕过了知识库能力,用户看不到 lint、status、query/context 和入库记录的价值。
|
|
30
|
+
|
|
31
|
+
项目或知识库根目录先同步根指导:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
aiwiki agent sync --path <workspace> --yes
|
|
35
|
+
aiwiki agent check --path <workspace> --json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
日常闭环按这个顺序执行:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
aiwiki setup --path <workspace> --yes
|
|
42
|
+
aiwiki lint --json --path <workspace>
|
|
43
|
+
aiwiki lint --fix-empty-dirs --json --path <workspace>
|
|
44
|
+
aiwiki ingest-file --file <file> --path <workspace>
|
|
45
|
+
aiwiki ingest-agent --stdin --path <workspace>
|
|
46
|
+
aiwiki status --path <workspace>
|
|
47
|
+
aiwiki query <topic> --path <workspace>
|
|
48
|
+
aiwiki context <topic> --path <workspace>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
只有当对应 AIWiki 命令无法回答问题时,才退回到 `rg`、`find`、`grep` 或手工读取文件;退回时要说明哪个 AIWiki 命令不够用。
|
|
52
|
+
|
|
27
53
|
## 标准流程
|
|
28
54
|
|
|
29
55
|
1. 读取用户给的 URL、正文、附件或消息。
|
|
@@ -45,6 +71,7 @@ aiwiki ingest-agent --payload <utf8-json-file>
|
|
|
45
71
|
```
|
|
46
72
|
|
|
47
73
|
9. 读取 CLI 输出,向用户回复入库状态、摘要、Wiki 条目、质量模式、资料卡和处理记录。
|
|
74
|
+
10. 汇报产物时先说核心产物:Raw、Source Card、Wiki Entry、Run Summary、Processing Summary。Claim、Asset、Topic、Outline 只在本次 CLI 输出或文件中真实存在时再提。
|
|
48
75
|
|
|
49
76
|
## 编码要求
|
|
50
77
|
|
package/docs/FAQ.md
CHANGED
|
@@ -55,6 +55,8 @@ AIWiki 是一个开源的 Agent-first 本地 LLM-wiki CLI。宿主 Agent 负责
|
|
|
55
55
|
npx @itradingai/aiwiki@latest setup
|
|
56
56
|
aiwiki agent sync --yes
|
|
57
57
|
aiwiki agent check --json
|
|
58
|
+
aiwiki agent sync --path <workspace> --yes
|
|
59
|
+
aiwiki agent check --path <workspace> --json
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
然后去看:
|
|
@@ -63,6 +65,10 @@ aiwiki agent check --json
|
|
|
63
65
|
- [SHOWCASE.md](SHOWCASE.md)
|
|
64
66
|
- [AGENT_HANDOFF.md](AGENT_HANDOFF.md)
|
|
65
67
|
|
|
68
|
+
## 有没有可以直接看的样例?
|
|
69
|
+
|
|
70
|
+
有。`examples/demo-run/` 记录输入、命令和 CLI 输出;`examples/obsidian-vault-sample/` 是已经生成好的样例知识库。它展示了核心产物优先,以及可选增强目录只在有内容时出现。
|
|
71
|
+
|
|
66
72
|
## 怎么从知识库里查询?
|
|
67
73
|
|
|
68
74
|
让宿主 Agent 调用:
|
|
@@ -80,3 +86,15 @@ aiwiki lint
|
|
|
80
86
|
```
|
|
81
87
|
|
|
82
88
|
如果只是清理旧版本留下的空可选增强目录,可以让 Agent 先运行 `aiwiki lint --json`,确认只有 safe fix 后再运行 `aiwiki lint --fix-empty-dirs --json`。
|
|
89
|
+
|
|
90
|
+
## 为什么我的 Agent 还是在直接翻文件?
|
|
91
|
+
|
|
92
|
+
通常是它没有加载 AIWiki skill,或者知识库根目录缺少 AIWiki 的 `AGENTS.md` 指导。先运行:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
aiwiki agent sync --yes
|
|
96
|
+
aiwiki agent sync --path <workspace> --yes
|
|
97
|
+
aiwiki agent check --path <workspace> --json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
之后再让 Agent 处理 AIWiki 任务。它应该优先调用 `aiwiki lint --json`、`aiwiki status`、`aiwiki query`、`aiwiki context`、`aiwiki ingest-file` 或 `aiwiki ingest-agent`。只有这些命令不够用时,才退回到通用文件搜索。
|
package/docs/README.md
CHANGED
|
@@ -11,6 +11,11 @@ AIWiki 是一个 Agent-first 的本地知识库工具,用来把宿主 Agent
|
|
|
11
11
|
- 路线图:[ROADMAP.md](ROADMAP.md)
|
|
12
12
|
- 开发记录:[development-log.md](development-log.md)
|
|
13
13
|
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
- `../examples/demo-run/` records the input files, commands, and CLI outputs from a regenerated demo.
|
|
17
|
+
- `../examples/obsidian-vault-sample/` is a sample vault showing the current core-first artifact contract.
|
|
18
|
+
|
|
14
19
|
## Quick Start
|
|
15
20
|
|
|
16
21
|
```bash
|
package/docs/RELEASE.md
CHANGED
|
@@ -21,28 +21,21 @@ npm version patch --no-git-tag-version
|
|
|
21
21
|
|
|
22
22
|
## npm 发布
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
发布前必须先让同一个本地 tarball 在测试服务器通过 smoke test。顺序是:本地验证、版本号、提交、本地 `npm pack`、测试服务器安装 tarball 并跑 CLI smoke,然后才能 `git push` 和 `npm publish`。
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
npm whoami
|
|
28
|
-
```
|
|
26
|
+
AIWiki 使用 npm Trusted Publishing。npm 发布应由 GitHub Actions 的 `.github/workflows/publish.yml` 完成,不依赖本机 `npm login`、OTP 或长期 `NPM_TOKEN`。
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
远程测试和 GitHub push 都通过后,触发发布 workflow:
|
|
31
29
|
|
|
32
30
|
```bash
|
|
33
|
-
|
|
31
|
+
gh workflow run publish.yml --repo iTradingAI/aiwiki
|
|
32
|
+
gh run watch --repo iTradingAI/aiwiki
|
|
34
33
|
```
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
如需查看最近一次发布任务:
|
|
37
36
|
|
|
38
37
|
```bash
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
或使用 npm Automation token 写入用户级 `.npmrc`:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npm config set //registry.npmjs.org/:_authToken "<NPM_AUTOMATION_TOKEN>"
|
|
38
|
+
gh run list --workflow publish.yml --repo iTradingAI/aiwiki --limit 5
|
|
46
39
|
```
|
|
47
40
|
|
|
48
41
|
发布后验证:
|
|
@@ -52,6 +45,8 @@ npm view @itradingai/aiwiki version
|
|
|
52
45
|
npm view @itradingai/aiwiki versions --json
|
|
53
46
|
```
|
|
54
47
|
|
|
48
|
+
如果 workflow 提示 Trusted Publishing / OIDC 权限问题,检查 npm 包设置里的 Trusted Publisher 是否指向 `iTradingAI/aiwiki` 和 workflow 文件名 `publish.yml`,并确认 workflow 顶层包含 `permissions: id-token: write`。
|
|
49
|
+
|
|
55
50
|
## 包体积
|
|
56
51
|
|
|
57
52
|
npm 包只应包含 CLI 运行和用户文档所需文件。README 中的图片使用 GitHub raw 链接展示,`docs/assets/` 不进入 npm 包。
|
package/docs/ROADMAP.md
CHANGED
package/docs/SHOWCASE.md
CHANGED
|
@@ -19,35 +19,38 @@
|
|
|
19
19
|
|
|
20
20
|
### AIWiki 会写什么
|
|
21
21
|
|
|
22
|
+
核心产物优先看这些:
|
|
23
|
+
|
|
22
24
|
```text
|
|
23
25
|
09-runs/<run-id>/payload.json
|
|
24
26
|
09-runs/<run-id>/raw.md
|
|
25
27
|
09-runs/<run-id>/source-card.md
|
|
26
28
|
09-runs/<run-id>/wiki-entry.md
|
|
27
|
-
09-runs/<run-id>/creative-assets.md
|
|
28
|
-
09-runs/<run-id>/topics.md
|
|
29
|
-
09-runs/<run-id>/draft-outline.md
|
|
30
29
|
09-runs/<run-id>/processing-summary.md
|
|
30
|
+
02-raw/articles/<slug>.md
|
|
31
|
+
03-sources/article-cards/<slug>.md
|
|
32
|
+
05-wiki/source-knowledge/<slug>.md
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
只有在宿主 Agent 提供了对应内容,或 payload 明确请求时,才会出现可选增强产物:
|
|
34
36
|
|
|
35
37
|
```text
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
09-runs/<run-id>/creative-assets.md
|
|
39
|
+
09-runs/<run-id>/topics.md
|
|
40
|
+
09-runs/<run-id>/draft-outline.md
|
|
38
41
|
04-claims/_suggestions/
|
|
39
|
-
05-wiki/source-knowledge/
|
|
40
42
|
06-assets/_suggestions/
|
|
41
43
|
07-topics/ready/
|
|
42
44
|
08-outputs/outlines/
|
|
43
|
-
dashboards/
|
|
44
45
|
```
|
|
45
46
|
|
|
47
|
+
仓库里的 `examples/obsidian-vault-sample/` 同时包含一个普通本地文件入库和一个 enriched Agent payload 入库。前者只生成核心产物,后者因为包含 claims、topic candidates、creative assets 和 outline 请求,所以生成可选增强目录。
|
|
48
|
+
|
|
46
49
|
### 用户在 Obsidian 里怎么看
|
|
47
50
|
|
|
48
51
|
- 打开 `dashboards/AIWiki Home.md`
|
|
49
52
|
- 查看 `05-wiki/source-knowledge/<slug>.md`
|
|
50
|
-
- 从 Wiki
|
|
53
|
+
- 从 Wiki 条目回到资料卡、原文和处理记录;如果这次入库生成了选题、大纲或 Claim,再继续查看对应可选产物
|
|
51
54
|
- 需要结构检查时运行 `aiwiki lint`
|
|
52
55
|
|
|
53
56
|
## 示例 2:网页没读到正文
|
|
@@ -81,3 +84,10 @@ dashboards/
|
|
|
81
84
|
- AIWiki 负责稳定写入本地知识库
|
|
82
85
|
- AIWiki 会创建 Wiki Entry;没有 Agent 分析字段时只生成可追溯脚手架
|
|
83
86
|
- 结果始终可追踪、可复盘、可继续写作
|
|
87
|
+
|
|
88
|
+
## 本仓库样例
|
|
89
|
+
|
|
90
|
+
- `examples/demo-run/`:输入、命令和 CLI 输出。
|
|
91
|
+
- `examples/obsidian-vault-sample/`:已经生成好的样例知识库。
|
|
92
|
+
|
|
93
|
+
这个样例不依赖爬虫、向量库、RAG 或 Pro 自动化;它只展示基础 CLI 的真实落盘结果。
|
package/docs/USAGE.md
CHANGED
|
@@ -61,8 +61,12 @@ aiwiki status
|
|
|
61
61
|
```bash
|
|
62
62
|
aiwiki agent sync --yes
|
|
63
63
|
aiwiki agent check --json
|
|
64
|
+
aiwiki agent sync --path <workspace> --yes
|
|
65
|
+
aiwiki agent check --path <workspace> --json
|
|
64
66
|
```
|
|
65
67
|
|
|
68
|
+
前两条同步本机宿主 Agent 的 skill/command,后两条在知识库根目录写入或刷新 marker-bounded `AGENTS.md` 指导。这样新的宿主 Agent 进入项目时,会先看到“必须调用 aiwiki CLI”的约束,而不是直接走默认文件搜索流程。
|
|
69
|
+
|
|
66
70
|
旧的安装向导仍然兼容,但不再作为首选路径:
|
|
67
71
|
|
|
68
72
|
```bash
|
|
@@ -93,7 +97,9 @@ aiwiki prompt agent
|
|
|
93
97
|
|
|
94
98
|
把输出内容安装成宿主 Agent 的 skill,或粘贴到宿主 Agent 的项目/会话说明里。不同 Agent 的安装入口不同,所以 AIWiki 提供自动安装向导和通用协议两条路径。
|
|
95
99
|
|
|
96
|
-
`aiwiki agent check --json` 用来确认本机检测到哪些宿主 Agent、哪些已经安装 AIWiki 对接文件、哪些还需要运行 `aiwiki agent sync --agent <id> --yes`。
|
|
100
|
+
`aiwiki agent check --json` 用来确认本机检测到哪些宿主 Agent、哪些已经安装 AIWiki 对接文件、哪些还需要运行 `aiwiki agent sync --agent <id> --yes`。`aiwiki agent check --path <workspace> --json` 会同时检查知识库根目录的 `AGENTS.md` 是否包含当前 AIWiki 命令优先指导,缺失或过期时会提示运行 `aiwiki agent sync --path <workspace> --yes`。
|
|
101
|
+
|
|
102
|
+
如果宿主 Agent 只用 `rg`、`find`、`grep` 或手工读文件来回答 AIWiki 问题,而没有先运行 `aiwiki lint --json`、`aiwiki status`、`aiwiki query` 或 `aiwiki context`,就说明它没有真正使用 AIWiki 的知识库闭环。
|
|
97
103
|
|
|
98
104
|
## 3. 日常使用
|
|
99
105
|
|
|
@@ -186,29 +192,25 @@ Obsidian 入口:dashboards/AIWiki Home.md
|
|
|
186
192
|
|
|
187
193
|
## 5. 成功后会生成什么
|
|
188
194
|
|
|
189
|
-
|
|
195
|
+
每次成功 run 先看核心产物:
|
|
190
196
|
|
|
191
197
|
```text
|
|
192
198
|
09-runs/<run-id>/payload.json
|
|
193
199
|
09-runs/<run-id>/raw.md
|
|
194
200
|
09-runs/<run-id>/source-card.md
|
|
195
|
-
09-runs/<run-id>/
|
|
196
|
-
09-runs/<run-id>/topics.md
|
|
197
|
-
09-runs/<run-id>/draft-outline.md
|
|
201
|
+
09-runs/<run-id>/wiki-entry.md
|
|
198
202
|
09-runs/<run-id>/processing-summary.md
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
同时写入长期目录:
|
|
202
|
-
|
|
203
|
-
```text
|
|
204
203
|
02-raw/articles/
|
|
205
204
|
03-sources/article-cards/
|
|
206
205
|
05-wiki/source-knowledge/
|
|
207
206
|
```
|
|
208
207
|
|
|
209
|
-
|
|
208
|
+
只有 payload 有对应内容或 `request.outputs` 明确请求时,才会出现可选增强产物:
|
|
210
209
|
|
|
211
210
|
```text
|
|
211
|
+
09-runs/<run-id>/creative-assets.md
|
|
212
|
+
09-runs/<run-id>/topics.md
|
|
213
|
+
09-runs/<run-id>/draft-outline.md
|
|
212
214
|
04-claims/_suggestions/
|
|
213
215
|
06-assets/_suggestions/
|
|
214
216
|
07-topics/ready/
|
|
@@ -217,6 +219,8 @@ Obsidian 入口:dashboards/AIWiki Home.md
|
|
|
217
219
|
|
|
218
220
|
`05-wiki/source-knowledge` 是默认知识层;`09-runs` 用于追溯每次处理。
|
|
219
221
|
|
|
222
|
+
可以直接查看仓库里的 `examples/demo-run/` 和 `examples/obsidian-vault-sample/`,它们由当前 CLI 生成,展示普通本地文件只生成核心产物、enriched Agent payload 才生成可选增强产物。
|
|
223
|
+
|
|
220
224
|
Wiki Entry 有两种质量模式:
|
|
221
225
|
|
|
222
226
|
- `agent_enriched` / `enriched`:宿主 Agent 提供了 `analysis` 或 `wiki_entry`。
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# AIWiki Demo Run
|
|
2
|
+
|
|
3
|
+
This folder records one generated run from the current CLI contract.
|
|
4
|
+
|
|
5
|
+
## Inputs
|
|
6
|
+
|
|
7
|
+
- `input/local-article.md`: local Markdown input for `aiwiki ingest-file`.
|
|
8
|
+
- `input/agent-enriched-payload.json`: host-Agent payload with `analysis`, claims, topics, assets, and outline requests.
|
|
9
|
+
|
|
10
|
+
## Commands
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
aiwiki setup --path ../obsidian-vault-sample --yes
|
|
14
|
+
aiwiki ingest-file --file input/local-article.md --path ../obsidian-vault-sample
|
|
15
|
+
aiwiki ingest-agent --payload input/agent-enriched-payload.json --path ../obsidian-vault-sample
|
|
16
|
+
aiwiki status --path ../obsidian-vault-sample
|
|
17
|
+
aiwiki query "LLM Wiki" --path ../obsidian-vault-sample
|
|
18
|
+
aiwiki context "LLM Wiki" --path ../obsidian-vault-sample
|
|
19
|
+
aiwiki lint --json --path ../obsidian-vault-sample
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The captured `*-output.*` files replace machine-specific paths with `<sample-vault>` and `<aiwiki-home>`.
|
|
23
|
+
|
|
24
|
+
## What To Inspect
|
|
25
|
+
|
|
26
|
+
- Core artifacts appear for both examples: Raw, Source Card, Wiki Entry, Run Summary, and Processing Summary.
|
|
27
|
+
- Optional directories are absent for the plain local-file ingest.
|
|
28
|
+
- Optional claims, assets, topics, and outline appear only for the enriched Agent payload that requested or supplied them.
|