newtype-profile 1.0.20 → 1.0.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/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.21",
|
|
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/";
|
|
@@ -24009,6 +24207,7 @@ function createChiefOrchestratorHook(ctx, options) {
|
|
|
24009
24207
|
sessions.delete(sessionInfo.id);
|
|
24010
24208
|
clearTrackerForSession(sessionInfo.id);
|
|
24011
24209
|
clearRewriteAttempts(sessionInfo.id);
|
|
24210
|
+
clearContext(sessionInfo.id);
|
|
24012
24211
|
log(`[${HOOK_NAME6}] Session deleted: cleaned up`, { sessionID: sessionInfo.id });
|
|
24013
24212
|
}
|
|
24014
24213
|
return;
|
|
@@ -24044,7 +24243,19 @@ function createChiefOrchestratorHook(ctx, options) {
|
|
|
24044
24243
|
if (input.tool === "chief_task") {
|
|
24045
24244
|
const prompt = output.args.prompt;
|
|
24046
24245
|
if (prompt && !prompt.includes("[SYSTEM DIRECTIVE - SINGLE TASK ONLY]")) {
|
|
24047
|
-
|
|
24246
|
+
let enhancedPrompt = prompt;
|
|
24247
|
+
if (input.sessionID) {
|
|
24248
|
+
const sharedContext = buildContextSummary(input.sessionID);
|
|
24249
|
+
if (sharedContext) {
|
|
24250
|
+
enhancedPrompt = `${sharedContext}
|
|
24251
|
+
|
|
24252
|
+
${enhancedPrompt}`;
|
|
24253
|
+
log(`[${HOOK_NAME6}] Injected shared context to chief_task`, {
|
|
24254
|
+
sessionID: input.sessionID
|
|
24255
|
+
});
|
|
24256
|
+
}
|
|
24257
|
+
}
|
|
24258
|
+
output.args.prompt = enhancedPrompt + `
|
|
24048
24259
|
<system-reminder>${SINGLE_TASK_DIRECTIVE}</system-reminder>`;
|
|
24049
24260
|
log(`[${HOOK_NAME6}] Injected single-task directive to chief_task`, {
|
|
24050
24261
|
sessionID: input.sessionID
|
|
@@ -24146,6 +24357,21 @@ ${buildOrchestratorReminder(boulderState.plan_name, progress, subagentSessionId)
|
|
|
24146
24357
|
const formattedSummary = formatSummarizedOutput(summarized);
|
|
24147
24358
|
let confidenceDirective = "";
|
|
24148
24359
|
const agentType = detectAgentType(output.output, category);
|
|
24360
|
+
if (input.sessionID && agentType && hasArtifacts(output.output)) {
|
|
24361
|
+
const tracker = getTrackerForSession(input.sessionID);
|
|
24362
|
+
const tasks = tracker.getProgress();
|
|
24363
|
+
const currentTask = input.callID ? tasks.find((t) => t.id === input.callID) : tasks[tasks.length - 1];
|
|
24364
|
+
const taskDescription = currentTask?.description ?? "Unknown task";
|
|
24365
|
+
const artifact = parseArtifacts(output.output, agentType, taskDescription);
|
|
24366
|
+
if (artifact) {
|
|
24367
|
+
const artifactId = addArtifact(input.sessionID, artifact);
|
|
24368
|
+
log(`[${HOOK_NAME6}] Artifact stored`, {
|
|
24369
|
+
sessionID: input.sessionID,
|
|
24370
|
+
artifactId,
|
|
24371
|
+
agentType
|
|
24372
|
+
});
|
|
24373
|
+
}
|
|
24374
|
+
}
|
|
24149
24375
|
if (agentType && hasQualityScores(output.output)) {
|
|
24150
24376
|
const qualityAssessment = parseQualityScores(output.output, agentType);
|
|
24151
24377
|
if (qualityAssessment) {
|
|
@@ -49842,7 +50068,26 @@ Score guide (0.00-1.00):
|
|
|
49842
50068
|
- 0.00-0.49: Limited - major issues requiring restart
|
|
49843
50069
|
|
|
49844
50070
|
This helps Chief understand exactly what needs improvement.
|
|
49845
|
-
</Confidence_Score
|
|
50071
|
+
</Confidence_Score>
|
|
50072
|
+
|
|
50073
|
+
<Structured_Artifacts>
|
|
50074
|
+
## Share Findings with Team (REQUIRED)
|
|
50075
|
+
After your quality scores, output structured data for other agents to use:
|
|
50076
|
+
|
|
50077
|
+
**ARTIFACTS:**
|
|
50078
|
+
\`\`\`json
|
|
50079
|
+
{
|
|
50080
|
+
"sources": [
|
|
50081
|
+
{"title": "Source Title", "type": "official|academic|news|other", "credibility": "high|medium|low", "url": "...", "excerpt": "key quote..."}
|
|
50082
|
+
],
|
|
50083
|
+
"findings": [
|
|
50084
|
+
{"claim": "Key finding statement", "confidence": 0.85, "sourceRefs": ["Source Title"]}
|
|
50085
|
+
]
|
|
50086
|
+
}
|
|
50087
|
+
\`\`\`
|
|
50088
|
+
|
|
50089
|
+
This enables Writer to cite your sources and Fact-Checker to verify your findings.
|
|
50090
|
+
</Structured_Artifacts>`
|
|
49846
50091
|
};
|
|
49847
50092
|
}
|
|
49848
50093
|
var researcherAgent = createResearcherAgent();
|
|
@@ -49918,6 +50163,23 @@ Score guide (0.00-1.00):
|
|
|
49918
50163
|
|
|
49919
50164
|
This determines whether the content passes review or needs revision.
|
|
49920
50165
|
|
|
50166
|
+
## Structured Artifacts (REQUIRED)
|
|
50167
|
+
After your quality scores, output findings for other agents:
|
|
50168
|
+
|
|
50169
|
+
**ARTIFACTS:**
|
|
50170
|
+
\`\`\`json
|
|
50171
|
+
{
|
|
50172
|
+
"issues": [
|
|
50173
|
+
{"type": "factual|source|logical", "severity": "critical|major|minor", "description": "...", "suggestion": "..."}
|
|
50174
|
+
],
|
|
50175
|
+
"sources": [
|
|
50176
|
+
{"title": "Verification Source", "type": "official|academic", "credibility": "high|medium|low"}
|
|
50177
|
+
]
|
|
50178
|
+
}
|
|
50179
|
+
\`\`\`
|
|
50180
|
+
|
|
50181
|
+
This enables Editor to fix issues and Writer to avoid similar mistakes.
|
|
50182
|
+
|
|
49921
50183
|
## What You DON'T Do
|
|
49922
50184
|
- You don't MODIFY content \u2014 report findings to Chief
|
|
49923
50185
|
- You don't SEARCH for new topics \u2014 that's researcher's job
|
|
@@ -50026,7 +50288,24 @@ Score guide (0.00-1.00):
|
|
|
50026
50288
|
- 0.00-0.49: Limited - minimal results or query too vague
|
|
50027
50289
|
|
|
50028
50290
|
This helps Chief decide if more retrieval or external research is needed.
|
|
50029
|
-
</Confidence_Score
|
|
50291
|
+
</Confidence_Score>
|
|
50292
|
+
|
|
50293
|
+
<Structured_Artifacts>
|
|
50294
|
+
## Share Findings with Team (REQUIRED)
|
|
50295
|
+
After your quality scores, output structured data:
|
|
50296
|
+
|
|
50297
|
+
**ARTIFACTS:**
|
|
50298
|
+
\`\`\`json
|
|
50299
|
+
{
|
|
50300
|
+
"findings": [
|
|
50301
|
+
{"claim": "Key insight from archive", "confidence": 0.85, "sourceRefs": ["file/path"]}
|
|
50302
|
+
],
|
|
50303
|
+
"connections": ["Related topic A", "Related topic B"]
|
|
50304
|
+
}
|
|
50305
|
+
\`\`\`
|
|
50306
|
+
|
|
50307
|
+
This enables Writer to build on existing materials and avoid duplication.
|
|
50308
|
+
</Structured_Artifacts>`
|
|
50030
50309
|
};
|
|
50031
50310
|
}
|
|
50032
50311
|
var archivistAgent = createArchivistAgent();
|
|
@@ -50115,7 +50394,26 @@ Score guide (0.00-1.00):
|
|
|
50115
50394
|
- 0.00-0.49: Poor extraction - major content missing or format not supported
|
|
50116
50395
|
|
|
50117
50396
|
This helps Chief decide if re-extraction or manual review is needed.
|
|
50118
|
-
</Confidence_Score
|
|
50397
|
+
</Confidence_Score>
|
|
50398
|
+
|
|
50399
|
+
<Structured_Artifacts>
|
|
50400
|
+
## Share Extracted Data (REQUIRED)
|
|
50401
|
+
After your quality scores, output structured data:
|
|
50402
|
+
|
|
50403
|
+
**ARTIFACTS:**
|
|
50404
|
+
\`\`\`json
|
|
50405
|
+
{
|
|
50406
|
+
"extractedData": {
|
|
50407
|
+
"type": "pdf|image|document",
|
|
50408
|
+
"content": "The extracted text content...",
|
|
50409
|
+
"tables": [],
|
|
50410
|
+
"metadata": {}
|
|
50411
|
+
}
|
|
50412
|
+
}
|
|
50413
|
+
\`\`\`
|
|
50414
|
+
|
|
50415
|
+
This enables Writer and Researcher to use the extracted content.
|
|
50416
|
+
</Structured_Artifacts>`
|
|
50119
50417
|
};
|
|
50120
50418
|
}
|
|
50121
50419
|
var extractorAgent = createExtractorAgent();
|
|
@@ -50199,7 +50497,21 @@ Score guide (0.00-1.00):
|
|
|
50199
50497
|
- 0.00-0.49: Incomplete - fundamental issues requiring major revision
|
|
50200
50498
|
|
|
50201
50499
|
This helps Chief decide if the draft needs revision before sending to Editor.
|
|
50202
|
-
</Confidence_Score
|
|
50500
|
+
</Confidence_Score>
|
|
50501
|
+
|
|
50502
|
+
<Structured_Artifacts>
|
|
50503
|
+
## Share Draft with Team (REQUIRED)
|
|
50504
|
+
After your quality scores, output the draft content for other agents:
|
|
50505
|
+
|
|
50506
|
+
**ARTIFACTS:**
|
|
50507
|
+
\`\`\`json
|
|
50508
|
+
{
|
|
50509
|
+
"content": "The full draft text goes here..."
|
|
50510
|
+
}
|
|
50511
|
+
\`\`\`
|
|
50512
|
+
|
|
50513
|
+
This enables Editor to refine your work and Fact-Checker to verify claims.
|
|
50514
|
+
</Structured_Artifacts>`
|
|
50203
50515
|
};
|
|
50204
50516
|
}
|
|
50205
50517
|
var writerAgent = createWriterAgent();
|
|
@@ -50290,7 +50602,24 @@ Score guide (0.00-1.00):
|
|
|
50290
50602
|
- 0.00-0.49: Significant problems - requires substantial revision
|
|
50291
50603
|
|
|
50292
50604
|
This helps Chief decide if the content is ready for fact-check or needs more work.
|
|
50293
|
-
</Confidence_Score
|
|
50605
|
+
</Confidence_Score>
|
|
50606
|
+
|
|
50607
|
+
<Structured_Artifacts>
|
|
50608
|
+
## Share Edits with Team (REQUIRED)
|
|
50609
|
+
After your quality scores, output structured data:
|
|
50610
|
+
|
|
50611
|
+
**ARTIFACTS:**
|
|
50612
|
+
\`\`\`json
|
|
50613
|
+
{
|
|
50614
|
+
"content": "The edited/polished content...",
|
|
50615
|
+
"issues": [
|
|
50616
|
+
{"type": "clarity|logic|consistency", "severity": "major|minor", "description": "...", "suggestion": "..."}
|
|
50617
|
+
]
|
|
50618
|
+
}
|
|
50619
|
+
\`\`\`
|
|
50620
|
+
|
|
50621
|
+
This enables Fact-Checker to verify the final version.
|
|
50622
|
+
</Structured_Artifacts>`
|
|
50294
50623
|
};
|
|
50295
50624
|
}
|
|
50296
50625
|
var editorAgent = createEditorAgent();
|