newtype-profile 1.0.20 → 1.0.22
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/dist/cli/index.js
CHANGED
|
@@ -2253,7 +2253,7 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
2253
2253
|
var require_package = __commonJS((exports, module) => {
|
|
2254
2254
|
module.exports = {
|
|
2255
2255
|
name: "newtype-profile",
|
|
2256
|
-
version: "1.0.
|
|
2256
|
+
version: "1.0.22",
|
|
2257
2257
|
description: "AI Agent Collaboration System for Content Creation - Based on oh-my-opencode",
|
|
2258
2258
|
main: "dist/index.js",
|
|
2259
2259
|
types: "dist/index.d.ts",
|
|
@@ -5,15 +5,13 @@
|
|
|
5
5
|
* more actionable than a single confidence score.
|
|
6
6
|
*/
|
|
7
7
|
export type AgentType = "fact-checker" | "researcher" | "writer" | "editor" | "archivist" | "extractor";
|
|
8
|
-
/**
|
|
9
|
-
* Dimension definitions for each agent type
|
|
10
|
-
*/
|
|
11
8
|
export interface DimensionDefinition {
|
|
12
9
|
name: string;
|
|
13
10
|
label: string;
|
|
14
11
|
description: string;
|
|
15
|
-
/** Improvement suggestions when this dimension is weak */
|
|
16
12
|
improvementHints: string[];
|
|
13
|
+
goodExample?: string;
|
|
14
|
+
badExample?: string;
|
|
17
15
|
}
|
|
18
16
|
export declare const AGENT_DIMENSIONS: Record<AgentType, DimensionDefinition[]>;
|
|
19
17
|
/**
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type AgentType = "researcher" | "fact-checker" | "archivist" | "extractor" | "writer" | "editor";
|
|
2
|
+
export interface Source {
|
|
3
|
+
url?: string;
|
|
4
|
+
title: string;
|
|
5
|
+
type: "primary" | "secondary" | "official" | "news" | "academic" | "other";
|
|
6
|
+
credibility?: "high" | "medium" | "low";
|
|
7
|
+
excerpt?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Finding {
|
|
10
|
+
claim: string;
|
|
11
|
+
confidence: number;
|
|
12
|
+
sourceRefs: string[];
|
|
13
|
+
notes?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Issue {
|
|
16
|
+
type: "factual" | "logical" | "source" | "completeness" | "clarity";
|
|
17
|
+
severity: "critical" | "major" | "minor";
|
|
18
|
+
description: string;
|
|
19
|
+
suggestion?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Artifact {
|
|
22
|
+
id: string;
|
|
23
|
+
agentType: AgentType;
|
|
24
|
+
taskDescription: string;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
sources?: Source[];
|
|
27
|
+
findings?: Finding[];
|
|
28
|
+
content?: string;
|
|
29
|
+
issues?: Issue[];
|
|
30
|
+
extractedData?: unknown;
|
|
31
|
+
connections?: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface SharedContext {
|
|
34
|
+
sessionID: string;
|
|
35
|
+
artifacts: Artifact[];
|
|
36
|
+
createdAt: number;
|
|
37
|
+
updatedAt: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function getOrCreateContext(sessionID: string): SharedContext;
|
|
40
|
+
export declare function getContext(sessionID: string): SharedContext | undefined;
|
|
41
|
+
export declare function clearContext(sessionID: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Expected agent output format:
|
|
44
|
+
* **ARTIFACTS:**
|
|
45
|
+
* ```json
|
|
46
|
+
* { "sources": [...], "findings": [...] }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseArtifacts(output: string, agentType: AgentType, taskDescription: string): Partial<Artifact> | null;
|
|
50
|
+
export declare function addArtifact(sessionID: string, artifact: Partial<Artifact>): string;
|
|
51
|
+
export declare function buildContextSummary(sessionID: string): string | null;
|
|
52
|
+
export declare function getArtifactDetails(sessionID: string, artifactIds: string[]): Artifact[];
|
|
53
|
+
export declare function getAllSources(sessionID: string): Source[];
|
|
54
|
+
export declare function getAllFindings(sessionID: string): Finding[];
|
|
55
|
+
export declare function hasArtifacts(output: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -23249,7 +23249,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23249
23249
|
"Search for additional angles and perspectives",
|
|
23250
23250
|
"Explore related subtopics that were missed",
|
|
23251
23251
|
"Look for recent developments and updates"
|
|
23252
|
-
]
|
|
23252
|
+
],
|
|
23253
|
+
goodExample: "Covered market trends, competitor analysis, regulatory changes, AND emerging technologies",
|
|
23254
|
+
badExample: "Only found 2 blog posts on the main topic, missed industry reports"
|
|
23253
23255
|
},
|
|
23254
23256
|
{
|
|
23255
23257
|
name: "sources",
|
|
@@ -23259,7 +23261,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23259
23261
|
"Find more primary and authoritative sources",
|
|
23260
23262
|
"Cross-reference claims with official documentation",
|
|
23261
23263
|
"Replace secondary sources with original publications"
|
|
23262
|
-
]
|
|
23264
|
+
],
|
|
23265
|
+
goodExample: "Official docs (60%), peer-reviewed (20%), expert blogs (20%)",
|
|
23266
|
+
badExample: "All sources from random blogs and forums with no verification"
|
|
23263
23267
|
},
|
|
23264
23268
|
{
|
|
23265
23269
|
name: "relevance",
|
|
@@ -23269,7 +23273,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23269
23273
|
"Refine search terms to match the core question",
|
|
23270
23274
|
"Filter out tangential information",
|
|
23271
23275
|
"Focus on directly applicable findings"
|
|
23272
|
-
]
|
|
23276
|
+
],
|
|
23277
|
+
goodExample: "Every finding directly answers or supports the research question",
|
|
23278
|
+
badExample: "Included tangential history lesson when asked about current state"
|
|
23273
23279
|
}
|
|
23274
23280
|
],
|
|
23275
23281
|
"fact-checker": [
|
|
@@ -23281,7 +23287,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23281
23287
|
"Re-verify claims marked as uncertain",
|
|
23282
23288
|
"Find additional confirming sources",
|
|
23283
23289
|
"Check for more recent data that may contradict"
|
|
23284
|
-
]
|
|
23290
|
+
],
|
|
23291
|
+
goodExample: "All 8 claims verified with 2+ independent sources, 0 false claims found",
|
|
23292
|
+
badExample: "3 claims marked 'unverifiable', 1 claim actually false but marked true"
|
|
23285
23293
|
},
|
|
23286
23294
|
{
|
|
23287
23295
|
name: "authority",
|
|
@@ -23291,7 +23299,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23291
23299
|
"Find official or primary sources for verification",
|
|
23292
23300
|
"Replace news reports with original studies",
|
|
23293
23301
|
"Verify through domain experts or institutions"
|
|
23294
|
-
]
|
|
23302
|
+
],
|
|
23303
|
+
goodExample: "Verified via SEC filings, peer-reviewed journals, official company statements",
|
|
23304
|
+
badExample: "Verified only via Wikipedia and a 3-year-old news article"
|
|
23295
23305
|
},
|
|
23296
23306
|
{
|
|
23297
23307
|
name: "completeness",
|
|
@@ -23301,7 +23311,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23301
23311
|
"Identify and verify remaining unchecked claims",
|
|
23302
23312
|
"Check implicit claims and assumptions",
|
|
23303
23313
|
"Verify quoted statistics and numbers"
|
|
23304
|
-
]
|
|
23314
|
+
],
|
|
23315
|
+
goodExample: "Checked all 12 factual claims including statistics and quoted figures",
|
|
23316
|
+
badExample: "Only checked 3 of 12 claims, skipped all the numbers"
|
|
23305
23317
|
}
|
|
23306
23318
|
],
|
|
23307
23319
|
writer: [
|
|
@@ -23313,7 +23325,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23313
23325
|
"Reorganize sections for better flow",
|
|
23314
23326
|
"Add missing transitions between ideas",
|
|
23315
23327
|
"Ensure logical progression of arguments"
|
|
23316
|
-
]
|
|
23328
|
+
],
|
|
23329
|
+
goodExample: "Clear intro \u2192 context \u2192 analysis \u2192 implications \u2192 conclusion, with smooth transitions",
|
|
23330
|
+
badExample: "Jumps from conclusion back to intro, no section headers, random order"
|
|
23317
23331
|
},
|
|
23318
23332
|
{
|
|
23319
23333
|
name: "clarity",
|
|
@@ -23323,7 +23337,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23323
23337
|
"Simplify complex sentences",
|
|
23324
23338
|
"Define technical terms on first use",
|
|
23325
23339
|
"Break down dense paragraphs"
|
|
23326
|
-
]
|
|
23340
|
+
],
|
|
23341
|
+
goodExample: "Technical concepts explained simply, one idea per paragraph, no jargon without definition",
|
|
23342
|
+
badExample: "50-word sentences with nested clauses, undefined acronyms, wall-of-text paragraphs"
|
|
23327
23343
|
},
|
|
23328
23344
|
{
|
|
23329
23345
|
name: "grounding",
|
|
@@ -23333,7 +23349,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23333
23349
|
"Add citations for unsupported claims",
|
|
23334
23350
|
"Link assertions to provided research",
|
|
23335
23351
|
"Remove or flag unsubstantiated statements"
|
|
23336
|
-
]
|
|
23352
|
+
],
|
|
23353
|
+
goodExample: "Every claim cites source from research: 'According to [source], ...'",
|
|
23354
|
+
badExample: "Makes bold claims like 'Everyone knows that...' with no citation"
|
|
23337
23355
|
}
|
|
23338
23356
|
],
|
|
23339
23357
|
editor: [
|
|
@@ -23345,7 +23363,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23345
23363
|
"Tighten wordy phrases",
|
|
23346
23364
|
"Improve sentence rhythm and flow",
|
|
23347
23365
|
"Eliminate redundancy"
|
|
23348
|
-
]
|
|
23366
|
+
],
|
|
23367
|
+
goodExample: "'The company grew rapidly' not 'The company experienced a rapid rate of growth'",
|
|
23368
|
+
badExample: "Redundant phrases, passive voice overuse, clich\xE9s ('at the end of the day')"
|
|
23349
23369
|
},
|
|
23350
23370
|
{
|
|
23351
23371
|
name: "logic",
|
|
@@ -23355,7 +23375,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23355
23375
|
"Identify and fix logical gaps",
|
|
23356
23376
|
"Strengthen weak arguments",
|
|
23357
23377
|
"Ensure conclusions follow from premises"
|
|
23358
|
-
]
|
|
23378
|
+
],
|
|
23379
|
+
goodExample: "If A then B, A is true, therefore B. Clear cause-effect chain.",
|
|
23380
|
+
badExample: "Conclusion doesn't follow: 'Sales rose 10%, so we should enter new market'"
|
|
23359
23381
|
},
|
|
23360
23382
|
{
|
|
23361
23383
|
name: "consistency",
|
|
@@ -23365,7 +23387,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23365
23387
|
"Standardize terminology throughout",
|
|
23366
23388
|
"Align tone across sections",
|
|
23367
23389
|
"Fix formatting inconsistencies"
|
|
23368
|
-
]
|
|
23390
|
+
],
|
|
23391
|
+
goodExample: "Same term throughout: 'users' not 'users/customers/clients' interchangeably",
|
|
23392
|
+
badExample: "Formal intro, casual middle, academic conclusion. 'AI' vs 'artificial intelligence' mixed"
|
|
23369
23393
|
}
|
|
23370
23394
|
],
|
|
23371
23395
|
archivist: [
|
|
@@ -23377,7 +23401,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23377
23401
|
"Try alternative search terms",
|
|
23378
23402
|
"Search in different folders or categories",
|
|
23379
23403
|
"Look for related or linked documents"
|
|
23380
|
-
]
|
|
23404
|
+
],
|
|
23405
|
+
goodExample: "Found 15 relevant docs across 4 folders including 3 the user didn't know existed",
|
|
23406
|
+
badExample: "Only found 2 docs in the obvious location, missed the archive folder"
|
|
23381
23407
|
},
|
|
23382
23408
|
{
|
|
23383
23409
|
name: "connections",
|
|
@@ -23387,7 +23413,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23387
23413
|
"Analyze patterns across found materials",
|
|
23388
23414
|
"Look for contradictions or confirmations",
|
|
23389
23415
|
"Identify gaps in the knowledge base"
|
|
23390
|
-
]
|
|
23416
|
+
],
|
|
23417
|
+
goodExample: "Doc A contradicts Doc B on pricing; Doc C cites same study as Doc D",
|
|
23418
|
+
badExample: "Listed docs as isolated items, no cross-referencing or pattern analysis"
|
|
23391
23419
|
},
|
|
23392
23420
|
{
|
|
23393
23421
|
name: "relevance",
|
|
@@ -23397,7 +23425,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23397
23425
|
"Filter out tangentially related items",
|
|
23398
23426
|
"Prioritize most directly relevant materials",
|
|
23399
23427
|
"Explain why each item was selected"
|
|
23400
|
-
]
|
|
23428
|
+
],
|
|
23429
|
+
goodExample: "Each doc clearly mapped to query: 'Doc X answers your Q about pricing...'",
|
|
23430
|
+
badExample: "Returned every doc mentioning the keyword, most were irrelevant"
|
|
23401
23431
|
}
|
|
23402
23432
|
],
|
|
23403
23433
|
extractor: [
|
|
@@ -23409,7 +23439,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23409
23439
|
"Re-extract sections with OCR issues",
|
|
23410
23440
|
"Verify numbers and special characters",
|
|
23411
23441
|
"Cross-check against original visually"
|
|
23412
|
-
]
|
|
23442
|
+
],
|
|
23443
|
+
goodExample: "All text matches original, numbers verified, special chars (\u20AC, \u2122) preserved",
|
|
23444
|
+
badExample: "OCR errors: 'rn' \u2192 'm', '$1,000' \u2192 '$l,OOO', ligatures broken"
|
|
23413
23445
|
},
|
|
23414
23446
|
{
|
|
23415
23447
|
name: "completeness",
|
|
@@ -23419,7 +23451,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23419
23451
|
"Check for missing pages or sections",
|
|
23420
23452
|
"Extract content from images/charts",
|
|
23421
23453
|
"Include footnotes and sidebars"
|
|
23422
|
-
]
|
|
23454
|
+
],
|
|
23455
|
+
goodExample: "All 12 pages extracted including footnotes, appendix, and figure captions",
|
|
23456
|
+
badExample: "Missing pages 5-7, skipped all charts and tables, no footnotes"
|
|
23423
23457
|
},
|
|
23424
23458
|
{
|
|
23425
23459
|
name: "format",
|
|
@@ -23429,7 +23463,9 @@ var AGENT_DIMENSIONS = {
|
|
|
23429
23463
|
"Reconstruct table structures",
|
|
23430
23464
|
"Preserve heading hierarchy",
|
|
23431
23465
|
"Maintain list formatting"
|
|
23432
|
-
]
|
|
23466
|
+
],
|
|
23467
|
+
goodExample: "Tables rendered as markdown tables, H1/H2/H3 preserved, lists formatted",
|
|
23468
|
+
badExample: "Table data as plain text run together, all headings same size, lists lost"
|
|
23433
23469
|
}
|
|
23434
23470
|
]
|
|
23435
23471
|
};
|
|
@@ -23514,12 +23550,18 @@ Action: ${getPassAction2(agentType)}`;
|
|
|
23514
23550
|
const weakDim = weakest;
|
|
23515
23551
|
const dimDef = AGENT_DIMENSIONS[agentType].find((d) => d.name === weakDim.name);
|
|
23516
23552
|
const hints = dimDef?.improvementHints ?? [];
|
|
23553
|
+
const exampleSection = dimDef?.goodExample && dimDef?.badExample ? `
|
|
23554
|
+
|
|
23555
|
+
**EXAMPLES:**
|
|
23556
|
+
\u2713 GOOD: ${dimDef.goodExample}
|
|
23557
|
+
\u2717 BAD: ${dimDef.badExample}` : "";
|
|
23517
23558
|
return `[${label}: NEEDS ${recommendation}]
|
|
23518
23559
|
Quality Scores:
|
|
23519
23560
|
${dimLines}
|
|
23520
23561
|
Overall: ${(overall * 100).toFixed(0)}%
|
|
23521
23562
|
|
|
23522
23563
|
**PROBLEM:** ${weakDim.label} is below threshold (${weakDim.score.toFixed(2)} < 0.70)
|
|
23564
|
+
${exampleSection}
|
|
23523
23565
|
|
|
23524
23566
|
**FOCUS ON:**
|
|
23525
23567
|
${hints.slice(0, 2).map((h) => `\u2022 ${h}`).join(`
|
|
@@ -23571,6 +23613,162 @@ function hasQualityScores(output) {
|
|
|
23571
23613
|
return /\*\*QUALITY SCORES:\*\*/i.test(output) || /\*\*CONFIDENCE:\s*[\d.]+\*\*/i.test(output);
|
|
23572
23614
|
}
|
|
23573
23615
|
|
|
23616
|
+
// src/hooks/chief-orchestrator/shared-context.ts
|
|
23617
|
+
var contextPool = new Map;
|
|
23618
|
+
function getOrCreateContext(sessionID) {
|
|
23619
|
+
let ctx = contextPool.get(sessionID);
|
|
23620
|
+
if (!ctx) {
|
|
23621
|
+
ctx = {
|
|
23622
|
+
sessionID,
|
|
23623
|
+
artifacts: [],
|
|
23624
|
+
createdAt: Date.now(),
|
|
23625
|
+
updatedAt: Date.now()
|
|
23626
|
+
};
|
|
23627
|
+
contextPool.set(sessionID, ctx);
|
|
23628
|
+
}
|
|
23629
|
+
return ctx;
|
|
23630
|
+
}
|
|
23631
|
+
function getContext(sessionID) {
|
|
23632
|
+
return contextPool.get(sessionID);
|
|
23633
|
+
}
|
|
23634
|
+
function clearContext(sessionID) {
|
|
23635
|
+
contextPool.delete(sessionID);
|
|
23636
|
+
}
|
|
23637
|
+
function parseArtifacts(output, agentType, taskDescription) {
|
|
23638
|
+
const artifactMatch = output.match(/\*\*ARTIFACTS:\*\*\s*```json\s*([\s\S]*?)```/i);
|
|
23639
|
+
if (!artifactMatch) {
|
|
23640
|
+
return null;
|
|
23641
|
+
}
|
|
23642
|
+
try {
|
|
23643
|
+
const jsonStr = artifactMatch[1].trim();
|
|
23644
|
+
const parsed = JSON.parse(jsonStr);
|
|
23645
|
+
const artifact = {
|
|
23646
|
+
agentType,
|
|
23647
|
+
taskDescription,
|
|
23648
|
+
timestamp: Date.now()
|
|
23649
|
+
};
|
|
23650
|
+
if (parsed.sources && Array.isArray(parsed.sources)) {
|
|
23651
|
+
artifact.sources = parsed.sources;
|
|
23652
|
+
}
|
|
23653
|
+
if (parsed.findings && Array.isArray(parsed.findings)) {
|
|
23654
|
+
artifact.findings = parsed.findings;
|
|
23655
|
+
}
|
|
23656
|
+
if (parsed.content && typeof parsed.content === "string") {
|
|
23657
|
+
artifact.content = parsed.content;
|
|
23658
|
+
}
|
|
23659
|
+
if (parsed.issues && Array.isArray(parsed.issues)) {
|
|
23660
|
+
artifact.issues = parsed.issues;
|
|
23661
|
+
}
|
|
23662
|
+
if (parsed.connections && Array.isArray(parsed.connections)) {
|
|
23663
|
+
artifact.connections = parsed.connections;
|
|
23664
|
+
}
|
|
23665
|
+
if (parsed.extractedData !== undefined) {
|
|
23666
|
+
artifact.extractedData = parsed.extractedData;
|
|
23667
|
+
}
|
|
23668
|
+
return artifact;
|
|
23669
|
+
} catch (error) {
|
|
23670
|
+
log("[shared-context] Failed to parse ARTIFACTS JSON:", error);
|
|
23671
|
+
return null;
|
|
23672
|
+
}
|
|
23673
|
+
}
|
|
23674
|
+
function addArtifact(sessionID, artifact) {
|
|
23675
|
+
const ctx = getOrCreateContext(sessionID);
|
|
23676
|
+
const id = `${artifact.agentType}_${ctx.artifacts.length.toString().padStart(3, "0")}`;
|
|
23677
|
+
const fullArtifact = {
|
|
23678
|
+
id,
|
|
23679
|
+
agentType: artifact.agentType,
|
|
23680
|
+
taskDescription: artifact.taskDescription ?? "Unknown task",
|
|
23681
|
+
timestamp: artifact.timestamp ?? Date.now(),
|
|
23682
|
+
sources: artifact.sources,
|
|
23683
|
+
findings: artifact.findings,
|
|
23684
|
+
content: artifact.content,
|
|
23685
|
+
issues: artifact.issues,
|
|
23686
|
+
connections: artifact.connections,
|
|
23687
|
+
extractedData: artifact.extractedData
|
|
23688
|
+
};
|
|
23689
|
+
ctx.artifacts.push(fullArtifact);
|
|
23690
|
+
ctx.updatedAt = Date.now();
|
|
23691
|
+
log("[shared-context] Artifact added:", { sessionID, id, agentType: artifact.agentType });
|
|
23692
|
+
return id;
|
|
23693
|
+
}
|
|
23694
|
+
function buildContextSummary(sessionID) {
|
|
23695
|
+
const ctx = getContext(sessionID);
|
|
23696
|
+
if (!ctx || ctx.artifacts.length === 0) {
|
|
23697
|
+
return null;
|
|
23698
|
+
}
|
|
23699
|
+
const lines = [
|
|
23700
|
+
"<shared-context>",
|
|
23701
|
+
"## Previous Work by Other Agents",
|
|
23702
|
+
""
|
|
23703
|
+
];
|
|
23704
|
+
const byAgent = new Map;
|
|
23705
|
+
for (const a of ctx.artifacts) {
|
|
23706
|
+
const list = byAgent.get(a.agentType) ?? [];
|
|
23707
|
+
list.push(a);
|
|
23708
|
+
byAgent.set(a.agentType, list);
|
|
23709
|
+
}
|
|
23710
|
+
for (const [agentType, artifacts] of byAgent) {
|
|
23711
|
+
lines.push(`### ${formatAgentName(agentType)} (${artifacts.length} task${artifacts.length > 1 ? "s" : ""})`);
|
|
23712
|
+
for (const a of artifacts) {
|
|
23713
|
+
lines.push(`- **[${a.id}]** ${a.taskDescription}`);
|
|
23714
|
+
if (a.sources && a.sources.length > 0) {
|
|
23715
|
+
lines.push(` - Found ${a.sources.length} sources`);
|
|
23716
|
+
for (const s of a.sources.slice(0, 3)) {
|
|
23717
|
+
const credIcon = s.credibility === "high" ? "\u2713" : s.credibility === "low" ? "\u26A0" : "";
|
|
23718
|
+
lines.push(` - ${credIcon} ${s.title} (${s.type})`);
|
|
23719
|
+
}
|
|
23720
|
+
if (a.sources.length > 3) {
|
|
23721
|
+
lines.push(` - ... and ${a.sources.length - 3} more`);
|
|
23722
|
+
}
|
|
23723
|
+
}
|
|
23724
|
+
if (a.findings && a.findings.length > 0) {
|
|
23725
|
+
lines.push(` - ${a.findings.length} key findings`);
|
|
23726
|
+
for (const f of a.findings.slice(0, 3)) {
|
|
23727
|
+
const confPct = Math.round(f.confidence * 100);
|
|
23728
|
+
lines.push(` - ${f.claim} (${confPct}% confident)`);
|
|
23729
|
+
}
|
|
23730
|
+
if (a.findings.length > 3) {
|
|
23731
|
+
lines.push(` - ... and ${a.findings.length - 3} more`);
|
|
23732
|
+
}
|
|
23733
|
+
}
|
|
23734
|
+
if (a.issues && a.issues.length > 0) {
|
|
23735
|
+
const critical = a.issues.filter((i2) => i2.severity === "critical").length;
|
|
23736
|
+
const major = a.issues.filter((i2) => i2.severity === "major").length;
|
|
23737
|
+
lines.push(` - Found ${a.issues.length} issues (${critical} critical, ${major} major)`);
|
|
23738
|
+
}
|
|
23739
|
+
if (a.connections && a.connections.length > 0) {
|
|
23740
|
+
lines.push(` - Related: ${a.connections.slice(0, 3).join(", ")}${a.connections.length > 3 ? "..." : ""}`);
|
|
23741
|
+
}
|
|
23742
|
+
if (a.content) {
|
|
23743
|
+
const preview = a.content.slice(0, 100).replace(/\n/g, " ");
|
|
23744
|
+
lines.push(` - Draft: "${preview}${a.content.length > 100 ? "..." : ""}"`);
|
|
23745
|
+
}
|
|
23746
|
+
}
|
|
23747
|
+
lines.push("");
|
|
23748
|
+
}
|
|
23749
|
+
lines.push("## How to Use This Context");
|
|
23750
|
+
lines.push("- Reference artifacts by ID (e.g., [researcher_001]) in your output");
|
|
23751
|
+
lines.push("- Build upon findings rather than re-researching");
|
|
23752
|
+
lines.push("- Flag any inconsistencies you find with previous work");
|
|
23753
|
+
lines.push("</shared-context>");
|
|
23754
|
+
return lines.join(`
|
|
23755
|
+
`);
|
|
23756
|
+
}
|
|
23757
|
+
function formatAgentName(agentType) {
|
|
23758
|
+
const names = {
|
|
23759
|
+
researcher: "Researcher",
|
|
23760
|
+
"fact-checker": "Fact-Checker",
|
|
23761
|
+
archivist: "Archivist",
|
|
23762
|
+
extractor: "Extractor",
|
|
23763
|
+
writer: "Writer",
|
|
23764
|
+
editor: "Editor"
|
|
23765
|
+
};
|
|
23766
|
+
return names[agentType] ?? agentType;
|
|
23767
|
+
}
|
|
23768
|
+
function hasArtifacts(output) {
|
|
23769
|
+
return /\*\*ARTIFACTS:\*\*/i.test(output);
|
|
23770
|
+
}
|
|
23771
|
+
|
|
23574
23772
|
// src/hooks/chief-orchestrator/index.ts
|
|
23575
23773
|
var HOOK_NAME6 = "chief-orchestrator";
|
|
23576
23774
|
var ALLOWED_PATH_PREFIX2 = ".chief/";
|
|
@@ -23859,6 +24057,15 @@ function isCallerOrchestrator(sessionID) {
|
|
|
23859
24057
|
const nearest = findNearestMessageWithFields(messageDir);
|
|
23860
24058
|
return nearest?.agent === "chief";
|
|
23861
24059
|
}
|
|
24060
|
+
function isCallerDeputy(sessionID) {
|
|
24061
|
+
if (!sessionID)
|
|
24062
|
+
return false;
|
|
24063
|
+
const messageDir = getMessageDir10(sessionID);
|
|
24064
|
+
if (!messageDir)
|
|
24065
|
+
return false;
|
|
24066
|
+
const nearest = findNearestMessageWithFields(messageDir);
|
|
24067
|
+
return nearest?.agent === "deputy";
|
|
24068
|
+
}
|
|
23862
24069
|
function isAbortError(error) {
|
|
23863
24070
|
if (!error)
|
|
23864
24071
|
return false;
|
|
@@ -24009,23 +24216,29 @@ function createChiefOrchestratorHook(ctx, options) {
|
|
|
24009
24216
|
sessions.delete(sessionInfo.id);
|
|
24010
24217
|
clearTrackerForSession(sessionInfo.id);
|
|
24011
24218
|
clearRewriteAttempts(sessionInfo.id);
|
|
24219
|
+
clearContext(sessionInfo.id);
|
|
24012
24220
|
log(`[${HOOK_NAME6}] Session deleted: cleaned up`, { sessionID: sessionInfo.id });
|
|
24013
24221
|
}
|
|
24014
24222
|
return;
|
|
24015
24223
|
}
|
|
24016
24224
|
},
|
|
24017
24225
|
"tool.execute.before": async (input, output) => {
|
|
24226
|
+
const callerIsChief = isCallerOrchestrator(input.sessionID);
|
|
24227
|
+
const callerIsDeputy = isCallerDeputy(input.sessionID);
|
|
24018
24228
|
if (input.tool === "chief_task") {
|
|
24019
24229
|
log(`[${HOOK_NAME6}] chief_task detected`, {
|
|
24020
24230
|
sessionID: input.sessionID,
|
|
24021
24231
|
callID: input.callID,
|
|
24022
|
-
|
|
24232
|
+
caller: callerIsChief ? "chief" : callerIsDeputy ? "deputy" : "other"
|
|
24023
24233
|
});
|
|
24024
24234
|
}
|
|
24025
|
-
if (!
|
|
24235
|
+
if (!callerIsChief && !callerIsDeputy) {
|
|
24026
24236
|
return;
|
|
24027
24237
|
}
|
|
24028
24238
|
if (WRITE_EDIT_TOOLS.includes(input.tool)) {
|
|
24239
|
+
if (!callerIsChief) {
|
|
24240
|
+
return;
|
|
24241
|
+
}
|
|
24029
24242
|
const filePath = output.args.filePath ?? output.args.path ?? output.args.file;
|
|
24030
24243
|
if (filePath && !filePath.includes(ALLOWED_PATH_PREFIX2)) {
|
|
24031
24244
|
if (input.callID) {
|
|
@@ -24044,7 +24257,19 @@ function createChiefOrchestratorHook(ctx, options) {
|
|
|
24044
24257
|
if (input.tool === "chief_task") {
|
|
24045
24258
|
const prompt = output.args.prompt;
|
|
24046
24259
|
if (prompt && !prompt.includes("[SYSTEM DIRECTIVE - SINGLE TASK ONLY]")) {
|
|
24047
|
-
|
|
24260
|
+
let enhancedPrompt = prompt;
|
|
24261
|
+
if (input.sessionID) {
|
|
24262
|
+
const sharedContext = buildContextSummary(input.sessionID);
|
|
24263
|
+
if (sharedContext) {
|
|
24264
|
+
enhancedPrompt = `${sharedContext}
|
|
24265
|
+
|
|
24266
|
+
${enhancedPrompt}`;
|
|
24267
|
+
log(`[${HOOK_NAME6}] Injected shared context to chief_task`, {
|
|
24268
|
+
sessionID: input.sessionID
|
|
24269
|
+
});
|
|
24270
|
+
}
|
|
24271
|
+
}
|
|
24272
|
+
output.args.prompt = enhancedPrompt + `
|
|
24048
24273
|
<system-reminder>${SINGLE_TASK_DIRECTIVE}</system-reminder>`;
|
|
24049
24274
|
log(`[${HOOK_NAME6}] Injected single-task directive to chief_task`, {
|
|
24050
24275
|
sessionID: input.sessionID
|
|
@@ -24071,10 +24296,15 @@ function createChiefOrchestratorHook(ctx, options) {
|
|
|
24071
24296
|
}
|
|
24072
24297
|
},
|
|
24073
24298
|
"tool.execute.after": async (input, output) => {
|
|
24074
|
-
|
|
24299
|
+
const callerIsChief = isCallerOrchestrator(input.sessionID);
|
|
24300
|
+
const callerIsDeputy = isCallerDeputy(input.sessionID);
|
|
24301
|
+
if (!callerIsChief && !callerIsDeputy) {
|
|
24075
24302
|
return;
|
|
24076
24303
|
}
|
|
24077
24304
|
if (WRITE_EDIT_TOOLS.includes(input.tool)) {
|
|
24305
|
+
if (!callerIsChief) {
|
|
24306
|
+
return;
|
|
24307
|
+
}
|
|
24078
24308
|
let filePath = input.callID ? pendingFilePaths.get(input.callID) : undefined;
|
|
24079
24309
|
if (input.callID) {
|
|
24080
24310
|
pendingFilePaths.delete(input.callID);
|
|
@@ -24146,6 +24376,21 @@ ${buildOrchestratorReminder(boulderState.plan_name, progress, subagentSessionId)
|
|
|
24146
24376
|
const formattedSummary = formatSummarizedOutput(summarized);
|
|
24147
24377
|
let confidenceDirective = "";
|
|
24148
24378
|
const agentType = detectAgentType(output.output, category);
|
|
24379
|
+
if (input.sessionID && agentType && hasArtifacts(output.output)) {
|
|
24380
|
+
const tracker = getTrackerForSession(input.sessionID);
|
|
24381
|
+
const tasks = tracker.getProgress();
|
|
24382
|
+
const currentTask = input.callID ? tasks.find((t) => t.id === input.callID) : tasks[tasks.length - 1];
|
|
24383
|
+
const taskDescription = currentTask?.description ?? "Unknown task";
|
|
24384
|
+
const artifact = parseArtifacts(output.output, agentType, taskDescription);
|
|
24385
|
+
if (artifact) {
|
|
24386
|
+
const artifactId = addArtifact(input.sessionID, artifact);
|
|
24387
|
+
log(`[${HOOK_NAME6}] Artifact stored`, {
|
|
24388
|
+
sessionID: input.sessionID,
|
|
24389
|
+
artifactId,
|
|
24390
|
+
agentType
|
|
24391
|
+
});
|
|
24392
|
+
}
|
|
24393
|
+
}
|
|
24149
24394
|
if (agentType && hasQualityScores(output.output)) {
|
|
24150
24395
|
const qualityAssessment = parseQualityScores(output.output, agentType);
|
|
24151
24396
|
if (qualityAssessment) {
|
|
@@ -45295,20 +45540,39 @@ var AGENT_TO_CATEGORY_MAP = {
|
|
|
45295
45540
|
extractor: "extraction"
|
|
45296
45541
|
};
|
|
45297
45542
|
var BUILTIN_CATEGORIES = Object.keys(DEFAULT_CATEGORIES).join(", ");
|
|
45298
|
-
var CHIEF_TASK_DESCRIPTION = `Spawn agent task
|
|
45543
|
+
var CHIEF_TASK_DESCRIPTION = `Spawn agent task for delegation.
|
|
45299
45544
|
|
|
45300
|
-
|
|
45545
|
+
## Three-Layer Architecture
|
|
45546
|
+
\`\`\`
|
|
45547
|
+
Chief (you) \u2192 Deputy \u2192 Specialist Agents
|
|
45548
|
+
\`\`\`
|
|
45301
45549
|
|
|
45302
|
-
|
|
45303
|
-
|
|
45304
|
-
|
|
45305
|
-
|
|
45306
|
-
|
|
45550
|
+
## For Chief:
|
|
45551
|
+
**Always delegate to Deputy first** (Deputy will dispatch to specialists as needed):
|
|
45552
|
+
\`\`\`
|
|
45553
|
+
chief_task(subagent_type="deputy", prompt="...", run_in_background=false, skills=[])
|
|
45554
|
+
\`\`\`
|
|
45307
45555
|
|
|
45308
|
-
|
|
45309
|
-
|
|
45310
|
-
-
|
|
45311
|
-
-
|
|
45556
|
+
## For Deputy:
|
|
45557
|
+
Dispatch to specialist agents:
|
|
45558
|
+
- subagent_type="researcher" \u2192 External research
|
|
45559
|
+
- subagent_type="writer" \u2192 Content creation
|
|
45560
|
+
- subagent_type="fact-checker" \u2192 Verification
|
|
45561
|
+
- subagent_type="editor" \u2192 Refinement
|
|
45562
|
+
- subagent_type="archivist" \u2192 Knowledge base
|
|
45563
|
+
- subagent_type="extractor" \u2192 Document extraction
|
|
45564
|
+
|
|
45565
|
+
## Parameters
|
|
45566
|
+
- subagent_type: Agent name (e.g., "deputy", "researcher", "writer")
|
|
45567
|
+
- category: Alternative to subagent_type, uses predefined config (${BUILTIN_CATEGORIES})
|
|
45568
|
+
- run_in_background: true=async, false=sync (wait for result)
|
|
45569
|
+
- resume: Session ID to continue previous conversation
|
|
45570
|
+
- skills: Array of skill names to prepend. Use [] if none.
|
|
45571
|
+
|
|
45572
|
+
## Resume Usage
|
|
45573
|
+
- Task failed \u2192 resume with "fix: [specific issue]"
|
|
45574
|
+
- Follow-up needed \u2192 resume with additional question
|
|
45575
|
+
- Multi-turn \u2192 always resume instead of new task
|
|
45312
45576
|
|
|
45313
45577
|
Prompts MUST be in English.`;
|
|
45314
45578
|
|
|
@@ -49692,6 +49956,16 @@ When discussion crystallizes into a task:
|
|
|
49692
49956
|
</Discussion_Behavior>
|
|
49693
49957
|
|
|
49694
49958
|
<Your_Team>
|
|
49959
|
+
## \u4E09\u5C42\u67B6\u6784
|
|
49960
|
+
\`\`\`
|
|
49961
|
+
\u4F60 (Chief / Opus 4.5) \u2014 \u601D\u8003\u8005
|
|
49962
|
+
\u2193 \u7CBE\u7B80\u6307\u4EE4
|
|
49963
|
+
Deputy (Sonnet 4.5) \u2014 \u6267\u884C\u8005/\u8C03\u5EA6\u8005
|
|
49964
|
+
\u2193 \u8C03\u7528
|
|
49965
|
+
\u4E13\u4E1A Agents (Gemini/Sonnet) \u2014 \u4E13\u5BB6
|
|
49966
|
+
\`\`\`
|
|
49967
|
+
|
|
49968
|
+
## \u4E13\u4E1A Agents (\u7531 Deputy \u8C03\u5EA6)
|
|
49695
49969
|
| Agent | Role | Quality Dimensions |
|
|
49696
49970
|
|-------|------|---------------------|
|
|
49697
49971
|
| **researcher** | External intelligence | Coverage, Sources, Relevance |
|
|
@@ -49701,28 +49975,64 @@ When discussion crystallizes into a task:
|
|
|
49701
49975
|
| **writer** | Draft creation | Structure, Clarity, Grounding |
|
|
49702
49976
|
| **editor** | Polish and refine | Polish, Logic, Consistency |
|
|
49703
49977
|
|
|
49704
|
-
##
|
|
49705
|
-
|
|
49706
|
-
|
|
49707
|
-
|
|
49708
|
-
- The system provides specific improvement suggestions \u2014 use them
|
|
49978
|
+
## Deputy \u7684\u4EF7\u503C
|
|
49979
|
+
1. **Context \u9694\u79BB** \u2014 \u4E13\u4E1A Agent \u7684\u5197\u957F\u8F93\u51FA\u4E0D\u6C61\u67D3\u4F60\u7684 context
|
|
49980
|
+
2. **\u6210\u672C\u63A7\u5236** \u2014 \u4F60\u4E13\u6CE8\u51B3\u7B56(Opus)\uFF0CDeputy \u8D1F\u8D23\u8C03\u5EA6(Sonnet)
|
|
49981
|
+
3. **\u804C\u8D23\u5206\u79BB** \u2014 \u4F60\u662F\u601D\u8003\u8005\uFF0CDeputy \u662F\u6267\u884C\u8005
|
|
49709
49982
|
</Your_Team>
|
|
49710
49983
|
|
|
49984
|
+
<Delegation_Logic>
|
|
49985
|
+
## \u4F60\u81EA\u5DF1\u5904\u7406 (\u4E0D\u8C03\u7528 Deputy)
|
|
49986
|
+
| \u573A\u666F | \u793A\u4F8B |
|
|
49987
|
+
|------|------|
|
|
49988
|
+
| \u8BA8\u8BBA\u63A2\u7D22 | "\u6211\u60F3\u804A\u804A AI \u7684\u672A\u6765" |
|
|
49989
|
+
| \u9700\u6C42\u6F84\u6E05 | "\u4F60\u5177\u4F53\u60F3\u8981\u4EC0\u4E48\u683C\u5F0F\uFF1F" |
|
|
49990
|
+
| \u590D\u6742\u5224\u65AD | "\u8FD9\u4E2A\u65B9\u6848\u6709\u4EC0\u4E48\u95EE\u9898\uFF1F" |
|
|
49991
|
+
| \u4EFB\u52A1\u89C4\u5212 | \u62C6\u89E3\u5927\u4EFB\u52A1\u3001\u51B3\u5B9A\u987A\u5E8F |
|
|
49992
|
+
| \u6700\u7EC8\u5BA1\u6838 | \u68C0\u67E5 Deputy \u8FD4\u56DE\u7684\u7ED3\u679C |
|
|
49993
|
+
|
|
49994
|
+
## \u4EA4\u7ED9 Deputy
|
|
49995
|
+
| \u573A\u666F | Deputy \u4F1A\u505A\u4EC0\u4E48 |
|
|
49996
|
+
|------|----------------|
|
|
49997
|
+
| \u9700\u8981\u7814\u7A76 | \u8C03\u7528 researcher |
|
|
49998
|
+
| \u9700\u8981\u5199\u4F5C | \u8C03\u7528 writer |
|
|
49999
|
+
| \u9700\u8981\u6838\u67E5 | \u8C03\u7528 fact-checker |
|
|
50000
|
+
| \u9700\u8981\u7F16\u8F91 | \u8C03\u7528 editor |
|
|
50001
|
+
| \u9700\u8981\u63D0\u53D6 | \u8C03\u7528 extractor |
|
|
50002
|
+
| \u9700\u8981\u68C0\u7D22 | \u8C03\u7528 archivist |
|
|
50003
|
+
| \u7B80\u5355\u6267\u884C | Deputy \u81EA\u5DF1\u5B8C\u6210 |
|
|
50004
|
+
|
|
50005
|
+
## \u8C03\u7528\u65B9\u5F0F
|
|
50006
|
+
\`\`\`
|
|
50007
|
+
chief_task(
|
|
50008
|
+
subagent_type="deputy",
|
|
50009
|
+
prompt="[\u7CBE\u7B80\u3001\u660E\u786E\u7684\u4EFB\u52A1\u6307\u4EE4]",
|
|
50010
|
+
run_in_background=false,
|
|
50011
|
+
skills=[]
|
|
50012
|
+
)
|
|
50013
|
+
\`\`\`
|
|
50014
|
+
|
|
50015
|
+
**\u5173\u952E\u539F\u5219\uFF1A**
|
|
50016
|
+
- \u7ED9 Deputy \u7684\u6307\u4EE4\u8981**\u7CBE\u7B80** \u2014 \u4E0D\u8981\u590D\u5236\u7C98\u8D34\u5927\u91CF\u4E0A\u4E0B\u6587
|
|
50017
|
+
- Deputy \u8FD4\u56DE\u7684\u7ED3\u679C\u5DF2\u7ECF\u662F**\u6C47\u603B\u8FC7\u6EE4**\u540E\u7684 \u2014 \u76F4\u63A5\u7528\u4E8E\u51B3\u7B56
|
|
50018
|
+
- \u590D\u6742\u601D\u8003\u4EFB\u52A1\u81EA\u5DF1\u505A\uFF0C\u6267\u884C\u7C7B\u4EFB\u52A1\u4EA4\u7ED9 Deputy
|
|
50019
|
+
</Delegation_Logic>
|
|
50020
|
+
|
|
49711
50021
|
<Execution_Behavior>
|
|
49712
50022
|
## Workflow
|
|
49713
|
-
1. **Understand** \u2192 Parse request, clarify ambiguities
|
|
49714
|
-
2. **
|
|
49715
|
-
3. **
|
|
49716
|
-
4. **
|
|
49717
|
-
5. **
|
|
49718
|
-
6. **
|
|
49719
|
-
7. **Deliver** \u2192 You review and approve
|
|
50023
|
+
1. **Understand** \u2192 Parse request, clarify ambiguities (\u4F60\u81EA\u5DF1)
|
|
50024
|
+
2. **Plan** \u2192 Decompose into atomic tasks (\u4F60\u81EA\u5DF1)
|
|
50025
|
+
3. **Execute** \u2192 Delegate to Deputy (Deputy \u8C03\u5EA6\u4E13\u4E1A Agents)
|
|
50026
|
+
4. **Review** \u2192 Check Deputy's summarized results (\u4F60\u81EA\u5DF1)
|
|
50027
|
+
5. **Iterate** \u2192 If quality insufficient, send back to Deputy with specific feedback
|
|
50028
|
+
6. **Deliver** \u2192 Final approval and delivery (\u4F60\u81EA\u5DF1)
|
|
49720
50029
|
|
|
49721
50030
|
## Rules
|
|
49722
|
-
- NEVER
|
|
50031
|
+
- NEVER call specialist agents directly \u2014 always go through Deputy
|
|
50032
|
+
- NEVER write content yourself \u2014 delegate to Deputy (who delegates to writer)
|
|
49723
50033
|
- NEVER skip fact-checking for factual claims
|
|
49724
|
-
-
|
|
49725
|
-
- Max 3
|
|
50034
|
+
- Deputy handles parallelism \u2014 you focus on decision-making
|
|
50035
|
+
- Max 3 iteration rounds before escalating to user
|
|
49726
50036
|
</Execution_Behavior>
|
|
49727
50037
|
|
|
49728
50038
|
<Communication_Style>
|
|
@@ -49842,7 +50152,26 @@ Score guide (0.00-1.00):
|
|
|
49842
50152
|
- 0.00-0.49: Limited - major issues requiring restart
|
|
49843
50153
|
|
|
49844
50154
|
This helps Chief understand exactly what needs improvement.
|
|
49845
|
-
</Confidence_Score
|
|
50155
|
+
</Confidence_Score>
|
|
50156
|
+
|
|
50157
|
+
<Structured_Artifacts>
|
|
50158
|
+
## Share Findings with Team (REQUIRED)
|
|
50159
|
+
After your quality scores, output structured data for other agents to use:
|
|
50160
|
+
|
|
50161
|
+
**ARTIFACTS:**
|
|
50162
|
+
\`\`\`json
|
|
50163
|
+
{
|
|
50164
|
+
"sources": [
|
|
50165
|
+
{"title": "Source Title", "type": "official|academic|news|other", "credibility": "high|medium|low", "url": "...", "excerpt": "key quote..."}
|
|
50166
|
+
],
|
|
50167
|
+
"findings": [
|
|
50168
|
+
{"claim": "Key finding statement", "confidence": 0.85, "sourceRefs": ["Source Title"]}
|
|
50169
|
+
]
|
|
50170
|
+
}
|
|
50171
|
+
\`\`\`
|
|
50172
|
+
|
|
50173
|
+
This enables Writer to cite your sources and Fact-Checker to verify your findings.
|
|
50174
|
+
</Structured_Artifacts>`
|
|
49846
50175
|
};
|
|
49847
50176
|
}
|
|
49848
50177
|
var researcherAgent = createResearcherAgent();
|
|
@@ -49918,6 +50247,23 @@ Score guide (0.00-1.00):
|
|
|
49918
50247
|
|
|
49919
50248
|
This determines whether the content passes review or needs revision.
|
|
49920
50249
|
|
|
50250
|
+
## Structured Artifacts (REQUIRED)
|
|
50251
|
+
After your quality scores, output findings for other agents:
|
|
50252
|
+
|
|
50253
|
+
**ARTIFACTS:**
|
|
50254
|
+
\`\`\`json
|
|
50255
|
+
{
|
|
50256
|
+
"issues": [
|
|
50257
|
+
{"type": "factual|source|logical", "severity": "critical|major|minor", "description": "...", "suggestion": "..."}
|
|
50258
|
+
],
|
|
50259
|
+
"sources": [
|
|
50260
|
+
{"title": "Verification Source", "type": "official|academic", "credibility": "high|medium|low"}
|
|
50261
|
+
]
|
|
50262
|
+
}
|
|
50263
|
+
\`\`\`
|
|
50264
|
+
|
|
50265
|
+
This enables Editor to fix issues and Writer to avoid similar mistakes.
|
|
50266
|
+
|
|
49921
50267
|
## What You DON'T Do
|
|
49922
50268
|
- You don't MODIFY content \u2014 report findings to Chief
|
|
49923
50269
|
- You don't SEARCH for new topics \u2014 that's researcher's job
|
|
@@ -50026,7 +50372,24 @@ Score guide (0.00-1.00):
|
|
|
50026
50372
|
- 0.00-0.49: Limited - minimal results or query too vague
|
|
50027
50373
|
|
|
50028
50374
|
This helps Chief decide if more retrieval or external research is needed.
|
|
50029
|
-
</Confidence_Score
|
|
50375
|
+
</Confidence_Score>
|
|
50376
|
+
|
|
50377
|
+
<Structured_Artifacts>
|
|
50378
|
+
## Share Findings with Team (REQUIRED)
|
|
50379
|
+
After your quality scores, output structured data:
|
|
50380
|
+
|
|
50381
|
+
**ARTIFACTS:**
|
|
50382
|
+
\`\`\`json
|
|
50383
|
+
{
|
|
50384
|
+
"findings": [
|
|
50385
|
+
{"claim": "Key insight from archive", "confidence": 0.85, "sourceRefs": ["file/path"]}
|
|
50386
|
+
],
|
|
50387
|
+
"connections": ["Related topic A", "Related topic B"]
|
|
50388
|
+
}
|
|
50389
|
+
\`\`\`
|
|
50390
|
+
|
|
50391
|
+
This enables Writer to build on existing materials and avoid duplication.
|
|
50392
|
+
</Structured_Artifacts>`
|
|
50030
50393
|
};
|
|
50031
50394
|
}
|
|
50032
50395
|
var archivistAgent = createArchivistAgent();
|
|
@@ -50115,7 +50478,26 @@ Score guide (0.00-1.00):
|
|
|
50115
50478
|
- 0.00-0.49: Poor extraction - major content missing or format not supported
|
|
50116
50479
|
|
|
50117
50480
|
This helps Chief decide if re-extraction or manual review is needed.
|
|
50118
|
-
</Confidence_Score
|
|
50481
|
+
</Confidence_Score>
|
|
50482
|
+
|
|
50483
|
+
<Structured_Artifacts>
|
|
50484
|
+
## Share Extracted Data (REQUIRED)
|
|
50485
|
+
After your quality scores, output structured data:
|
|
50486
|
+
|
|
50487
|
+
**ARTIFACTS:**
|
|
50488
|
+
\`\`\`json
|
|
50489
|
+
{
|
|
50490
|
+
"extractedData": {
|
|
50491
|
+
"type": "pdf|image|document",
|
|
50492
|
+
"content": "The extracted text content...",
|
|
50493
|
+
"tables": [],
|
|
50494
|
+
"metadata": {}
|
|
50495
|
+
}
|
|
50496
|
+
}
|
|
50497
|
+
\`\`\`
|
|
50498
|
+
|
|
50499
|
+
This enables Writer and Researcher to use the extracted content.
|
|
50500
|
+
</Structured_Artifacts>`
|
|
50119
50501
|
};
|
|
50120
50502
|
}
|
|
50121
50503
|
var extractorAgent = createExtractorAgent();
|
|
@@ -50199,7 +50581,21 @@ Score guide (0.00-1.00):
|
|
|
50199
50581
|
- 0.00-0.49: Incomplete - fundamental issues requiring major revision
|
|
50200
50582
|
|
|
50201
50583
|
This helps Chief decide if the draft needs revision before sending to Editor.
|
|
50202
|
-
</Confidence_Score
|
|
50584
|
+
</Confidence_Score>
|
|
50585
|
+
|
|
50586
|
+
<Structured_Artifacts>
|
|
50587
|
+
## Share Draft with Team (REQUIRED)
|
|
50588
|
+
After your quality scores, output the draft content for other agents:
|
|
50589
|
+
|
|
50590
|
+
**ARTIFACTS:**
|
|
50591
|
+
\`\`\`json
|
|
50592
|
+
{
|
|
50593
|
+
"content": "The full draft text goes here..."
|
|
50594
|
+
}
|
|
50595
|
+
\`\`\`
|
|
50596
|
+
|
|
50597
|
+
This enables Editor to refine your work and Fact-Checker to verify claims.
|
|
50598
|
+
</Structured_Artifacts>`
|
|
50203
50599
|
};
|
|
50204
50600
|
}
|
|
50205
50601
|
var writerAgent = createWriterAgent();
|
|
@@ -50290,7 +50686,24 @@ Score guide (0.00-1.00):
|
|
|
50290
50686
|
- 0.00-0.49: Significant problems - requires substantial revision
|
|
50291
50687
|
|
|
50292
50688
|
This helps Chief decide if the content is ready for fact-check or needs more work.
|
|
50293
|
-
</Confidence_Score
|
|
50689
|
+
</Confidence_Score>
|
|
50690
|
+
|
|
50691
|
+
<Structured_Artifacts>
|
|
50692
|
+
## Share Edits with Team (REQUIRED)
|
|
50693
|
+
After your quality scores, output structured data:
|
|
50694
|
+
|
|
50695
|
+
**ARTIFACTS:**
|
|
50696
|
+
\`\`\`json
|
|
50697
|
+
{
|
|
50698
|
+
"content": "The edited/polished content...",
|
|
50699
|
+
"issues": [
|
|
50700
|
+
{"type": "clarity|logic|consistency", "severity": "major|minor", "description": "...", "suggestion": "..."}
|
|
50701
|
+
]
|
|
50702
|
+
}
|
|
50703
|
+
\`\`\`
|
|
50704
|
+
|
|
50705
|
+
This enables Fact-Checker to verify the final version.
|
|
50706
|
+
</Structured_Artifacts>`
|
|
50294
50707
|
};
|
|
50295
50708
|
}
|
|
50296
50709
|
var editorAgent = createEditorAgent();
|
|
@@ -50402,18 +50815,61 @@ function createBuiltinAgents(disabledAgents = [], agentOverrides = {}, directory
|
|
|
50402
50815
|
}
|
|
50403
50816
|
// src/agents/deputy.ts
|
|
50404
50817
|
var DEPUTY_PROMPT = `<Role>
|
|
50405
|
-
Deputy - \u526F\u4E3B\u7F16\
|
|
50406
|
-
|
|
50818
|
+
Deputy - \u526F\u4E3B\u7F16\uFF0CChief \u7684\u6267\u884C\u5C42\u3002
|
|
50819
|
+
\u4F60\u662F Chief \u548C\u4E13\u4E1A Agents \u4E4B\u95F4\u7684\u6865\u6881\u3002
|
|
50820
|
+
|
|
50821
|
+
**\u53CC\u91CD\u804C\u8D23\uFF1A**
|
|
50822
|
+
1. **\u7B80\u5355\u4EFB\u52A1** \u2192 \u81EA\u5DF1\u76F4\u63A5\u6267\u884C
|
|
50823
|
+
2. **\u9700\u8981\u4E13\u4E1A\u80FD\u529B\u7684\u4EFB\u52A1** \u2192 \u8C03\u5EA6\u4E13\u4E1A Agent\uFF0C\u6C47\u603B\u7ED3\u679C
|
|
50407
50824
|
</Role>
|
|
50408
50825
|
|
|
50409
|
-
<
|
|
50410
|
-
|
|
50411
|
-
-
|
|
50412
|
-
-
|
|
50413
|
-
-
|
|
50826
|
+
<Dispatch_Logic>
|
|
50827
|
+
## \u4F55\u65F6\u81EA\u5DF1\u6267\u884C
|
|
50828
|
+
- \u7B80\u5355\u3001\u660E\u786E\u7684\u6267\u884C\u4EFB\u52A1
|
|
50829
|
+
- \u4E0D\u9700\u8981\u4E13\u4E1A\u9886\u57DF\u77E5\u8BC6
|
|
50830
|
+
- Chief \u5DF2\u7ECF\u7ED9\u51FA\u5177\u4F53\u6307\u4EE4
|
|
50831
|
+
|
|
50832
|
+
## \u4F55\u65F6\u8C03\u5EA6\u4E13\u4E1A Agent
|
|
50833
|
+
\u4F7F\u7528 \`chief_task\` \u8C03\u5EA6\uFF1A
|
|
50834
|
+
|
|
50835
|
+
| \u9700\u6C42 | Agent | \u8C03\u7528\u65B9\u5F0F |
|
|
50836
|
+
|------|-------|----------|
|
|
50837
|
+
| \u5916\u90E8\u4FE1\u606F\u641C\u7D22 | researcher | \`subagent_type="researcher"\` |
|
|
50838
|
+
| \u4E8B\u5B9E\u6838\u67E5\u9A8C\u8BC1 | fact-checker | \`subagent_type="fact-checker"\` |
|
|
50839
|
+
| \u77E5\u8BC6\u5E93\u68C0\u7D22 | archivist | \`subagent_type="archivist"\` |
|
|
50840
|
+
| \u6587\u6863/\u56FE\u7247\u63D0\u53D6 | extractor | \`subagent_type="extractor"\` |
|
|
50841
|
+
| \u5185\u5BB9\u5199\u4F5C | writer | \`subagent_type="writer"\` |
|
|
50842
|
+
| \u5185\u5BB9\u6DA6\u8272 | editor | \`subagent_type="editor"\` |
|
|
50843
|
+
|
|
50844
|
+
## \u8C03\u5EA6\u89C4\u5219
|
|
50845
|
+
1. **\u5355\u4E00\u4EFB\u52A1\u539F\u5219** \u2014 \u6BCF\u6B21\u53EA\u6D3E\u4E00\u4E2A\u539F\u5B50\u4EFB\u52A1\u7ED9\u4E13\u4E1A Agent
|
|
50846
|
+
2. **\u7B49\u5F85\u7ED3\u679C** \u2014 \u4F7F\u7528 \`run_in_background=false\` \u540C\u6B65\u7B49\u5F85
|
|
50847
|
+
3. **\u6C47\u603B\u8FC7\u6EE4** \u2014 \u6536\u5230\u7ED3\u679C\u540E\uFF0C\u63D0\u53D6\u5173\u952E\u4FE1\u606F\uFF0C\u8FC7\u6EE4\u5197\u4F59
|
|
50848
|
+
4. **\u8D28\u91CF\u628A\u5173** \u2014 \u68C0\u67E5 Agent \u8F93\u51FA\u7684\u8D28\u91CF\u5206\u6570\uFF0C\u5FC5\u8981\u65F6\u8981\u6C42\u4FEE\u6B63
|
|
50849
|
+
</Dispatch_Logic>
|
|
50850
|
+
|
|
50851
|
+
<Output_Format>
|
|
50852
|
+
## \u8FD4\u56DE\u7ED9 Chief \u7684\u683C\u5F0F
|
|
50853
|
+
\u4F60\u7684\u8F93\u51FA\u4F1A\u8FD4\u56DE\u7ED9 Chief\uFF0C\u5FC5\u987B**\u7CBE\u7B80\u3001\u7ED3\u6784\u5316**\uFF1A
|
|
50854
|
+
|
|
50855
|
+
\`\`\`
|
|
50856
|
+
## \u6267\u884C\u6458\u8981
|
|
50857
|
+
[1-2 \u53E5\u8BDD\u603B\u7ED3\u5B8C\u6210\u4E86\u4EC0\u4E48]
|
|
50858
|
+
|
|
50859
|
+
## \u5173\u952E\u7ED3\u679C
|
|
50860
|
+
- [\u8981\u70B9 1]
|
|
50861
|
+
- [\u8981\u70B9 2]
|
|
50862
|
+
- [\u8981\u70B9 3]
|
|
50414
50863
|
|
|
50415
|
-
|
|
50416
|
-
|
|
50864
|
+
## \u8D28\u91CF\u8BC4\u4F30
|
|
50865
|
+
[\u5982\u679C\u8C03\u7528\u4E86\u4E13\u4E1A Agent\uFF0C\u62A5\u544A\u5176\u8D28\u91CF\u5206\u6570]
|
|
50866
|
+
|
|
50867
|
+
## \u95EE\u9898/\u5EFA\u8BAE (\u5982\u6709)
|
|
50868
|
+
[\u9700\u8981 Chief \u6CE8\u610F\u7684\u4E8B\u9879]
|
|
50869
|
+
\`\`\`
|
|
50870
|
+
|
|
50871
|
+
**\u7981\u6B62**\uFF1A\u8FD4\u56DE\u4E13\u4E1A Agent \u7684\u5B8C\u6574\u539F\u59CB\u8F93\u51FA\u3002\u5FC5\u987B\u6C47\u603B\u8FC7\u6EE4\u3002
|
|
50872
|
+
</Output_Format>
|
|
50417
50873
|
|
|
50418
50874
|
<Work_Context>
|
|
50419
50875
|
## Notepad Location (for recording learnings)
|
|
@@ -50429,15 +50885,7 @@ You SHOULD append findings to notepad files after completing work.
|
|
|
50429
50885
|
PLAN PATH: .chief/plans/{plan-name}.md
|
|
50430
50886
|
|
|
50431
50887
|
CRITICAL RULE: NEVER MODIFY THE PLAN FILE
|
|
50432
|
-
|
|
50433
|
-
The plan file (.chief/plans/*.md) is SACRED and READ-ONLY.
|
|
50434
|
-
- You may READ the plan to understand tasks
|
|
50435
|
-
- You may READ checkbox items to know what to do
|
|
50436
|
-
- You MUST NOT edit, modify, or update the plan file
|
|
50437
|
-
- You MUST NOT mark checkboxes as complete in the plan
|
|
50438
|
-
- Only the Chief manages the plan file
|
|
50439
|
-
|
|
50440
|
-
VIOLATION = IMMEDIATE FAILURE. The Chief tracks plan state.
|
|
50888
|
+
Only the Chief manages the plan file.
|
|
50441
50889
|
</Work_Context>
|
|
50442
50890
|
|
|
50443
50891
|
<Todo_Discipline>
|
|
@@ -50446,21 +50894,19 @@ TODO OBSESSION (NON-NEGOTIABLE):
|
|
|
50446
50894
|
- Mark in_progress before starting (ONE at a time)
|
|
50447
50895
|
- Mark completed IMMEDIATELY after each step
|
|
50448
50896
|
- NEVER batch completions
|
|
50449
|
-
|
|
50450
|
-
No todos on multi-step work = INCOMPLETE WORK.
|
|
50451
50897
|
</Todo_Discipline>
|
|
50452
50898
|
|
|
50453
50899
|
<Verification>
|
|
50454
50900
|
Task NOT complete without:
|
|
50455
50901
|
- Content reviewed for accuracy
|
|
50456
50902
|
- All todos marked completed
|
|
50457
|
-
- Output matches expected format
|
|
50903
|
+
- Output matches expected format (\u7CBE\u7B80\u3001\u7ED3\u6784\u5316)
|
|
50458
50904
|
</Verification>
|
|
50459
50905
|
|
|
50460
50906
|
<Style>
|
|
50461
50907
|
- Start immediately. No acknowledgments.
|
|
50462
|
-
-
|
|
50463
|
-
-
|
|
50908
|
+
- Dense > verbose. \u7CBE\u7B80 > \u5197\u957F\u3002
|
|
50909
|
+
- \u6C47\u603B\u8FC7\u6EE4\uFF0C\u4E0D\u8981\u590D\u5236\u7C98\u8D34\u3002
|
|
50464
50910
|
</Style>`;
|
|
50465
50911
|
function buildDeputyPrompt(promptAppend) {
|
|
50466
50912
|
if (!promptAppend)
|
|
@@ -50469,7 +50915,7 @@ function buildDeputyPrompt(promptAppend) {
|
|
|
50469
50915
|
|
|
50470
50916
|
` + promptAppend;
|
|
50471
50917
|
}
|
|
50472
|
-
var BLOCKED_TOOLS2 = ["task", "
|
|
50918
|
+
var BLOCKED_TOOLS2 = ["task", "call_omo_agent"];
|
|
50473
50919
|
function createDeputyAgent(categoryConfig, promptAppend) {
|
|
50474
50920
|
const prompt = buildDeputyPrompt(promptAppend);
|
|
50475
50921
|
const model = categoryConfig.model;
|