scientify 1.13.6 → 2.1.0
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.en.md +371 -0
- package/README.md +167 -356
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +131 -122
- package/dist/index.js.map +1 -1
- package/dist/src/cli/research.d.ts +1 -6
- package/dist/src/cli/research.d.ts.map +1 -1
- package/dist/src/cli/research.js +227 -123
- package/dist/src/cli/research.js.map +1 -1
- package/dist/src/commands/metabolism-status.d.ts +3 -3
- package/dist/src/commands/metabolism-status.d.ts.map +1 -1
- package/dist/src/commands/metabolism-status.js +72 -75
- package/dist/src/commands/metabolism-status.js.map +1 -1
- package/dist/src/commands.d.ts +1 -1
- package/dist/src/commands.d.ts.map +1 -1
- package/dist/src/commands.js +0 -55
- package/dist/src/commands.js.map +1 -1
- package/dist/src/hooks/cron-skill-inject.d.ts +6 -7
- package/dist/src/hooks/cron-skill-inject.d.ts.map +1 -1
- package/dist/src/hooks/cron-skill-inject.js +6 -15
- package/dist/src/hooks/cron-skill-inject.js.map +1 -1
- package/dist/src/hooks/research-mode.d.ts +1 -1
- package/dist/src/hooks/research-mode.d.ts.map +1 -1
- package/dist/src/hooks/research-mode.js +24 -101
- package/dist/src/hooks/research-mode.js.map +1 -1
- package/dist/src/hooks/scientify-signature.d.ts +1 -1
- package/dist/src/hooks/scientify-signature.d.ts.map +1 -1
- package/dist/src/hooks/scientify-signature.js +2 -5
- package/dist/src/hooks/scientify-signature.js.map +1 -1
- package/dist/src/knowledge-state/render.d.ts +1 -9
- package/dist/src/knowledge-state/render.d.ts.map +1 -1
- package/dist/src/knowledge-state/render.js +33 -187
- package/dist/src/knowledge-state/render.js.map +1 -1
- package/dist/src/knowledge-state/store.d.ts.map +1 -1
- package/dist/src/knowledge-state/store.js +65 -1100
- package/dist/src/knowledge-state/store.js.map +1 -1
- package/dist/src/knowledge-state/types.d.ts +0 -76
- package/dist/src/knowledge-state/types.d.ts.map +1 -1
- package/dist/src/literature/subscription-state.d.ts +0 -2
- package/dist/src/literature/subscription-state.d.ts.map +1 -1
- package/dist/src/literature/subscription-state.js +7 -1375
- package/dist/src/literature/subscription-state.js.map +1 -1
- package/dist/src/research-subscriptions/constants.d.ts +1 -1
- package/dist/src/research-subscriptions/constants.js +1 -1
- package/dist/src/research-subscriptions/cron-client.d.ts +1 -1
- package/dist/src/research-subscriptions/cron-client.d.ts.map +1 -1
- package/dist/src/research-subscriptions/delivery.d.ts +1 -1
- package/dist/src/research-subscriptions/delivery.d.ts.map +1 -1
- package/dist/src/research-subscriptions/handlers.d.ts +1 -1
- package/dist/src/research-subscriptions/handlers.d.ts.map +1 -1
- package/dist/src/research-subscriptions/handlers.js +10 -20
- package/dist/src/research-subscriptions/handlers.js.map +1 -1
- package/dist/src/research-subscriptions/parse.d.ts.map +1 -1
- package/dist/src/research-subscriptions/parse.js +0 -25
- package/dist/src/research-subscriptions/parse.js.map +1 -1
- package/dist/src/research-subscriptions/prompt.d.ts +1 -1
- package/dist/src/research-subscriptions/prompt.d.ts.map +1 -1
- package/dist/src/research-subscriptions/prompt.js +195 -244
- package/dist/src/research-subscriptions/prompt.js.map +1 -1
- package/dist/src/research-subscriptions/types.d.ts +1 -3
- package/dist/src/research-subscriptions/types.d.ts.map +1 -1
- package/dist/src/templates/bootstrap.d.ts.map +1 -1
- package/dist/src/templates/bootstrap.js +32 -19
- package/dist/src/templates/bootstrap.js.map +1 -1
- package/dist/src/tools/arxiv-download.d.ts +1 -2
- package/dist/src/tools/arxiv-download.d.ts.map +1 -1
- package/dist/src/tools/arxiv-search.d.ts +1 -2
- package/dist/src/tools/arxiv-search.d.ts.map +1 -1
- package/dist/src/tools/github-search-tool.d.ts +1 -2
- package/dist/src/tools/github-search-tool.d.ts.map +1 -1
- package/dist/src/tools/openalex-search.d.ts +1 -2
- package/dist/src/tools/openalex-search.d.ts.map +1 -1
- package/dist/src/tools/openreview-lookup.d.ts +1 -2
- package/dist/src/tools/openreview-lookup.d.ts.map +1 -1
- package/dist/src/tools/paper-browser.d.ts +1 -2
- package/dist/src/tools/paper-browser.d.ts.map +1 -1
- package/dist/src/tools/result.d.ts +3 -5
- package/dist/src/tools/result.d.ts.map +1 -1
- package/dist/src/tools/result.js +5 -7
- package/dist/src/tools/result.js.map +1 -1
- package/dist/src/tools/scientify-cron.d.ts +4 -11
- package/dist/src/tools/scientify-cron.d.ts.map +1 -1
- package/dist/src/tools/scientify-cron.js +19 -524
- package/dist/src/tools/scientify-cron.js.map +1 -1
- package/dist/src/tools/scientify-literature-state.d.ts +1 -76
- package/dist/src/tools/scientify-literature-state.d.ts.map +1 -1
- package/dist/src/tools/scientify-literature-state.js +46 -363
- package/dist/src/tools/scientify-literature-state.js.map +1 -1
- package/dist/src/tools/unpaywall-download.d.ts +1 -2
- package/dist/src/tools/unpaywall-download.d.ts.map +1 -1
- package/dist/src/types.d.ts +16 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/openclaw.plugin.json +4 -2
- package/package.json +1 -1
- package/skills/metabolism/SKILL.md +2 -0
- package/skills/research-subscription/SKILL.md +1 -29
- package/README.zh.md +0 -494
|
@@ -2,111 +2,34 @@
|
|
|
2
2
|
* Research mode prompt injected into every conversation.
|
|
3
3
|
*/
|
|
4
4
|
const RESEARCH_MODE_PROMPT = `[Scientify]
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- Treat \`status_json\` as the single source of truth for run result and hypothesis persistence.
|
|
28
|
-
Never claim "hypothesis generated/persisted" unless \`status_json.knowledge_state_summary.hypothesis_gate.accepted > 0\`
|
|
29
|
-
and \`status_json.recent_hypotheses\` is non-empty.
|
|
30
|
-
|
|
31
|
-
Execution truth:
|
|
32
|
-
- Do not claim background progress unless you created a real async handle (job_id/task_id).
|
|
33
|
-
- Without a real async handle, execute synchronously in this turn and return status.
|
|
34
|
-
- If not executed, say not executed. Never imply hidden progress.
|
|
35
|
-
|
|
36
|
-
Run profile defaults:
|
|
37
|
-
- Default profile: strict (full-text-first).
|
|
38
|
-
- Switch to fast/metadata-only only when user explicitly asks to skip full-text reading.
|
|
39
|
-
- Soft gate is default: non-fatal quality issues are warnings, not blockers.
|
|
40
|
-
- Never skip persistence due quality limits; persist every run.
|
|
41
|
-
- User-facing responses should be concise Markdown. Keep tool-call JSON minimal and only for persistence.
|
|
42
|
-
- Use degraded_quality only for fatal gate conditions.
|
|
43
|
-
|
|
44
|
-
Research quality and gating:
|
|
45
|
-
- Full-text-first for core evidence papers.
|
|
46
|
-
- If full text unavailable: set full_text_read=false and unread_reason.
|
|
47
|
-
- Adaptive retrieval intent:
|
|
48
|
-
* early cycles: prioritize foundational/survey papers to establish field map
|
|
49
|
-
* later cycles: expand into mainstream variants and adjacent tracks
|
|
50
|
-
* when a hypothesis appears: immediately run one validation follow-up (supporting + critical evidence), do not wait for next heartbeat
|
|
51
|
-
- In core paper notes, avoid placeholders ("N/A", "not provided", "unknown"); either provide concrete content or omit field.
|
|
52
|
-
- Evidence binding for key conclusions should include section + locator + quote.
|
|
53
|
-
- BRIDGE requires resolvable evidence_ids and at least one full-text-backed evidence source.
|
|
54
|
-
- If BRIDGE, NEW+REVISE, or unread core backlog appears, execute one reflection follow-up query and persist trace/result.
|
|
55
|
-
- If a cycle is empty, do not stop at "no papers":
|
|
56
|
-
* diagnose whether it is query/alias/recency mismatch vs scope saturation
|
|
57
|
-
* persist diagnosis and next-query/pivot hints in run_log notes
|
|
58
|
-
* keep topic continuity, but prepare adjacent sub-direction queries that serve current idea validation
|
|
59
|
-
- Hypotheses are accepted only when evidence_ids and dependency_path are sufficient; otherwise reject via hypothesis_gate reasons.
|
|
60
|
-
- Before user-facing wording, check latest status.hypothesis_gate.accepted:
|
|
61
|
-
* accepted == 0: factual report only; do not output speculative "next high-value routes"/"deep dive" guidance.
|
|
62
|
-
* accepted > 0: include hypothesis details in current message by default (stable path).
|
|
63
|
-
* only when runtime/channel clearly supports multi-send, split into two consecutive messages (alert then detailed hypothesis).
|
|
64
|
-
- If hard user constraints are not met (for example min core papers), do not report status=ok.
|
|
65
|
-
|
|
66
|
-
Traceability:
|
|
67
|
-
- Reuse prepare-returned scope/topic in record/status. Never replace scope with project_id.
|
|
68
|
-
- On follow-up ("which papers?", "why this hypothesis?"), answer from persisted status/knowledge_state first.
|
|
69
|
-
- Only re-search when persistence lacks required facts, and state this explicitly.
|
|
70
|
-
|
|
71
|
-
Rigor:
|
|
72
|
-
- Never fabricate citations, quotes, venues, or results.
|
|
73
|
-
- Say "I don't know" when uncertain.
|
|
74
|
-
- Use \`python3\` (not \`python\`) for shell commands in this environment.`;
|
|
75
|
-
const CRON_CONTEXT_GUARD = `
|
|
76
|
-
[Scientify Cron Context]
|
|
77
|
-
This turn is already running inside a cron-triggered execution.
|
|
78
|
-
Do not call scientify_cron_job (or create another cron job) from this run.
|
|
79
|
-
Do not recursively schedule run_now from within cron.
|
|
80
|
-
Use the existing execution handle and complete prepare -> record -> status directly.
|
|
81
|
-
If workload is too heavy for this turn, prefer sessions_spawn task delegation (with task id) instead of nested cron.`;
|
|
82
|
-
const FORCE_ZH_RE = /output language:\s*chinese|chinese \(simplified\)|必须使用中文回复|请用中文|用中文输出|中文回复/iu;
|
|
83
|
-
const FORCE_EN_RE = /output language:\s*english|please use english|use english|英文回复|请用英文/iu;
|
|
84
|
-
const LANGUAGE_PROMPT_ZH = `[Language]
|
|
85
|
-
You must reply in Simplified Chinese for all user-facing content.
|
|
86
|
-
If you are about to respond in English, translate to Chinese and output only Chinese.
|
|
87
|
-
`;
|
|
88
|
-
const LANGUAGE_PROMPT_EN = `[Language]
|
|
89
|
-
You must reply in English for all user-facing content unless quoting sources.
|
|
90
|
-
`;
|
|
5
|
+
Skills: match research tasks to <available_skills>; read SKILL.md before acting.
|
|
6
|
+
Workspace: $W/projects/<topic>/. Check /research-status before writing. Active project in $W/projects/.active.
|
|
7
|
+
survey/ — search_terms.json, raw_results.json, filtered_papers.json, clusters.json, report.md (literature-survey)
|
|
8
|
+
papers/ — organized by cluster direction, each with paper_list.md + {arxiv_id}/ .tex sources (literature-survey)
|
|
9
|
+
notes/ — per-paper deep analysis paper_{id}.md (research-survey). survey_res.md = method comparison table.
|
|
10
|
+
ideas/ — gaps.md, idea_1..5.md, selected_idea.md, summary.md (idea-generation)
|
|
11
|
+
review/ — reading_plan.md, notes/{id}.md, comparison.md, taxonomy.md, draft.md, bibliography.bib (write-review-paper)
|
|
12
|
+
plan_res.md (research-plan) → project/ + ml_res.md (research-implement) → iterations/judge_v*.md (research-review) → experiment_res.md (research-experiment)
|
|
13
|
+
Scheduling: if user asks for recurring or delayed push delivery (e.g. tomorrow at 08:00, daily digest), use research-subscription skill and call scientify_cron_job to create a real schedule.
|
|
14
|
+
If it is a plain reminder (not research), set scientify_cron_job.message and do not default to the literature pipeline.
|
|
15
|
+
For recurring research pushes, use scientify_literature_state to prepare dedupe context and record both pushed paper IDs and structured knowledge_state (changes, updates, hypotheses, run_log).
|
|
16
|
+
Full-text-first policy: for papers used as core evidence, read full text when possible and mark full_text_read=true; if not fully read, you must explicitly mark full_text_read=false with unread_reason.
|
|
17
|
+
Structured paper record policy: for each core paper, populate domain/subdomains/cross-domain links/research goal/approach/methodology design/key contributions/practical insights/must-understand points/limitations/evidence anchors.
|
|
18
|
+
Use temporary local directory for full-text files (e.g. /tmp/scientify-fulltext/<run-id>) and delete it after record; write cleanup status to run_log.temp_cleanup_status.
|
|
19
|
+
Quality targets for research runs: core full-text coverage >=80%; evidence-binding rate >=90% (key conclusions must bind to section+locator+quote); citation error rate <2%. If full text is missing, do not keep high-confidence conclusions.
|
|
20
|
+
For research records, include project_id when available so state can persist under project knowledge_state/.
|
|
21
|
+
When user gives preference feedback (e.g. "more like this", "skip this direction", "prefer arxiv"), quietly persist it via scientify_literature_state action=feedback when scope/topic are inferable.
|
|
22
|
+
Preference memory is backend-only: use it to rerank future pushes, do not expose memory internals unless user explicitly asks.
|
|
23
|
+
Do not stop at explanation when user explicitly asks to set a schedule.
|
|
24
|
+
Rules: file exists = step done (skip). Outputs immutable unless user asks. project/ mutable during review loop.
|
|
25
|
+
Execution: always use \`python3\` (not \`python\`) for shell commands in this environment.
|
|
26
|
+
Rigor: read first, think second, answer third. Never fabricate references or results. Every claim needs a source. Say "I don't know" when uncertain. Read actual papers, not just abstracts. Ground ideas in real papers.`;
|
|
91
27
|
/**
|
|
92
28
|
* Injects on every prompt build (survives compaction).
|
|
93
29
|
*/
|
|
94
30
|
export function createResearchModeHook() {
|
|
95
|
-
return (_event,
|
|
96
|
-
|
|
97
|
-
const inCronContext = sessionKey.includes(":cron:");
|
|
98
|
-
const promptText = typeof _event.prompt === "string" ? _event.prompt : "";
|
|
99
|
-
let languagePrefix = "";
|
|
100
|
-
if (FORCE_EN_RE.test(promptText)) {
|
|
101
|
-
languagePrefix = LANGUAGE_PROMPT_EN;
|
|
102
|
-
}
|
|
103
|
-
else if (FORCE_ZH_RE.test(promptText)) {
|
|
104
|
-
languagePrefix = LANGUAGE_PROMPT_ZH;
|
|
105
|
-
}
|
|
106
|
-
const basePrompt = inCronContext ? `${RESEARCH_MODE_PROMPT}\n${CRON_CONTEXT_GUARD}` : RESEARCH_MODE_PROMPT;
|
|
107
|
-
return {
|
|
108
|
-
prependContext: languagePrefix ? `${languagePrefix}\n${basePrompt}` : basePrompt,
|
|
109
|
-
};
|
|
31
|
+
return (_event, _context) => {
|
|
32
|
+
return { prependContext: RESEARCH_MODE_PROMPT };
|
|
110
33
|
};
|
|
111
34
|
}
|
|
112
35
|
//# sourceMappingURL=research-mode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"research-mode.js","sourceRoot":"","sources":["../../../src/hooks/research-mode.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,MAAM,oBAAoB,GAAG
|
|
1
|
+
{"version":3,"file":"research-mode.js","sourceRoot":"","sources":["../../../src/hooks/research-mode.ts"],"names":[],"mappings":"AAmBA;;GAEG;AACH,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;0NAsB6L,CAAC;AAE3N;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,CAAC,MAAiB,EAAE,QAAqB,EAAc,EAAE;QAC9D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scientify-signature.d.ts","sourceRoot":"","sources":["../../../src/hooks/scientify-signature.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG;
|
|
1
|
+
{"version":3,"file":"scientify-signature.d.ts","sourceRoot":"","sources":["../../../src/hooks/scientify-signature.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAgGF,wBAAgB,+BAA+B,KACrC,OAAO,mBAAmB,EAAE,SAAS,eAAe,KAAG,IAAI,CAKpE;AAED,wBAAgB,iCAAiC,KACvC,OAAO,OAAO,EAAE,SAAS,eAAe,KAAG,IAAI,CAmBxD;AAED,wBAAgB,kCAAkC,KACxC,OAAO,sBAAsB,EAAE,SAAS,eAAe,KAAG,gBAAgB,GAAG,IAAI,CAoB1F;AAED,wBAAgB,+BAA+B,KACrC,OAAO,OAAO,EAAE,SAAS,eAAe,KAAG,IAAI,CAKxD"}
|
|
@@ -11,19 +11,16 @@ const SCIENTIFY_TOOLS = new Set([
|
|
|
11
11
|
const SCIENTIFY_SKILLS = new Set([
|
|
12
12
|
"idea-generation",
|
|
13
13
|
"research-pipeline",
|
|
14
|
-
"research-collect",
|
|
15
14
|
"research-survey",
|
|
16
15
|
"research-plan",
|
|
17
16
|
"research-implement",
|
|
18
17
|
"research-review",
|
|
19
18
|
"research-experiment",
|
|
19
|
+
"literature-survey",
|
|
20
20
|
"write-review-paper",
|
|
21
21
|
"research-subscription",
|
|
22
|
-
// Compatibility skills kept for migration windows.
|
|
23
|
-
"metabolism",
|
|
24
|
-
"metabolism-init",
|
|
25
22
|
]);
|
|
26
|
-
const SCIENTIFY_SKILL_COMMAND_RE = /(?:^|\s)\/(idea-generation|research-pipeline|research-
|
|
23
|
+
const SCIENTIFY_SKILL_COMMAND_RE = /(?:^|\s)\/(idea-generation|research-pipeline|research-survey|research-plan|research-implement|research-review|research-experiment|literature-survey|write-review-paper|research-subscription)(?:\s|$)/i;
|
|
27
24
|
const SIGNATURE_PROMPT = `[Scientify Signature]
|
|
28
25
|
If this response is based on Scientify workflow execution (Scientify skills/tools), append this exact footer at the end of your reply:
|
|
29
26
|
---
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scientify-signature.js","sourceRoot":"","sources":["../../../src/hooks/scientify-signature.ts"],"names":[],"mappings":"AAmBA,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,cAAc;IACd,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,4BAA4B;CAC7B,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,iBAAiB;IACjB,mBAAmB;IACnB,
|
|
1
|
+
{"version":3,"file":"scientify-signature.js","sourceRoot":"","sources":["../../../src/hooks/scientify-signature.ts"],"names":[],"mappings":"AAmBA,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,cAAc;IACd,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,4BAA4B;CAC7B,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;IACjB,eAAe;IACf,oBAAoB;IACpB,iBAAiB;IACjB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,uBAAuB;CACxB,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAC9B,wMAAwM,CAAC;AAE3M,MAAM,gBAAgB,GAAG;;;;sCAIa,CAAC;AAEvC,iEAAiE;AACjE,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAAU,CAAC;AAElD,SAAS,cAAc,CAAC,KAAc,EAAE,OAAwB;IAC9D,IAAI,OAAO,CAAC,UAAU;QAAE,OAAO,OAAO,CAAC,UAAU,CAAC;IAClD,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC;IAC5C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,KAAgC,CAAC;QAChD,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,UAAU,CAAC;QACpE,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC,OAAO,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U,KAAK,YAAY,EAAE,CAAC;QAClD,IAAI,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9C,IAAI,WAAW,EAAE,CAAC;gBAChB,uBAAuB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC;QAC9C,CAAC;QAED,OAAO;IACT,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,OAAO,CAAC,KAAc,EAAE,OAAwB,EAAQ,EAAE;QACxD,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW;YAAE,OAAO;QACzB,uBAAuB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExplorationTraceInput,
|
|
1
|
+
import type { ExplorationTraceInput, KnowledgeChangeInput, KnowledgeHypothesisInput, KnowledgePaperInput, KnowledgeUpdateInput } from "./types.js";
|
|
2
2
|
export declare function dayKeyFromTimestamp(ts: number): string;
|
|
3
3
|
export declare function slugifyTopic(raw: string): string;
|
|
4
4
|
export declare function renderPaperNoteHeaderMarkdown(args: {
|
|
@@ -24,11 +24,6 @@ export declare function renderExplorationLogMarkdown(args: {
|
|
|
24
24
|
trace: ExplorationTraceInput[];
|
|
25
25
|
papers: KnowledgePaperInput[];
|
|
26
26
|
}): string;
|
|
27
|
-
export declare function renderReflectionLogMarkdown(args: {
|
|
28
|
-
now: string;
|
|
29
|
-
runId: string;
|
|
30
|
-
tasks: ReflectionTaskInput[];
|
|
31
|
-
}): string;
|
|
32
27
|
export declare function renderDailyChangesMarkdown(args: {
|
|
33
28
|
now: string;
|
|
34
29
|
runId: string;
|
|
@@ -49,7 +44,6 @@ export declare function renderHypothesisMarkdown(args: {
|
|
|
49
44
|
export declare function renderKnowledgeIndexMarkdown(args: {
|
|
50
45
|
now: string;
|
|
51
46
|
topic: string;
|
|
52
|
-
runProfile: "fast" | "strict";
|
|
53
47
|
topicFiles: string[];
|
|
54
48
|
paperNotesCount: number;
|
|
55
49
|
totalHypotheses: number;
|
|
@@ -64,8 +58,6 @@ export declare function renderKnowledgeIndexMarkdown(args: {
|
|
|
64
58
|
reasons: string[];
|
|
65
59
|
};
|
|
66
60
|
unreadCorePaperIds: string[];
|
|
67
|
-
reflectionTasks: ReflectionTaskInput[];
|
|
68
|
-
hypothesisGate: HypothesisGateSummary;
|
|
69
61
|
lastStatus?: string;
|
|
70
62
|
}): string;
|
|
71
63
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/knowledge-state/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/knowledge-state/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAyCpB,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOhD;AA+CD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,mBAAmB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAQxG;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,KAAK,EAAE,mBAAmB,CAAC;CAC5B,GAAG,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,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE;QACX,MAAM,EAAE,OAAO,CAAC;QAChB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,sBAAsB,EAAE,MAAM,CAAC;QAC/B,oBAAoB,EAAE,MAAM,CAAC;QAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,CAkCT"}
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
const PLACEHOLDER_TEXT_RE = /^(?:n\/a|na|none|not provided|not available|unknown|tbd|todo|null|nil|未提供|暂无|未知|无)$/iu;
|
|
2
1
|
function normalizeText(raw) {
|
|
3
2
|
return raw.trim().replace(/\s+/g, " ");
|
|
4
3
|
}
|
|
5
|
-
function cleanText(raw) {
|
|
6
|
-
if (typeof raw !== "string")
|
|
7
|
-
return undefined;
|
|
8
|
-
const normalized = normalizeText(raw);
|
|
9
|
-
if (!normalized)
|
|
10
|
-
return undefined;
|
|
11
|
-
if (PLACEHOLDER_TEXT_RE.test(normalized))
|
|
12
|
-
return undefined;
|
|
13
|
-
return normalized;
|
|
14
|
-
}
|
|
15
4
|
function toCsv(values) {
|
|
16
5
|
if (!Array.isArray(values) || values.length === 0)
|
|
17
6
|
return undefined;
|
|
18
|
-
const cleaned = values.map((item) =>
|
|
7
|
+
const cleaned = values.map((item) => item.trim()).filter((item) => item.length > 0);
|
|
19
8
|
return cleaned.length > 0 ? cleaned.join(", ") : undefined;
|
|
20
9
|
}
|
|
21
10
|
function renderStringArray(lines, label, values) {
|
|
22
11
|
if (!Array.isArray(values) || values.length === 0)
|
|
23
12
|
return;
|
|
24
13
|
for (const [idx, value] of values.entries()) {
|
|
25
|
-
const trimmed =
|
|
14
|
+
const trimmed = value.trim();
|
|
26
15
|
if (!trimmed)
|
|
27
16
|
continue;
|
|
28
17
|
lines.push(` - ${label}_${idx + 1}: ${trimmed}`);
|
|
@@ -132,111 +121,60 @@ export function renderPaperNoteHeaderMarkdown(args) {
|
|
|
132
121
|
}
|
|
133
122
|
export function renderPaperNoteRunMarkdown(args) {
|
|
134
123
|
const paper = args.paper;
|
|
135
|
-
const profileFieldChecks = [
|
|
136
|
-
{ label: "domain", filled: Boolean(cleanText(paper.domain)) },
|
|
137
|
-
{ label: "subdomains", filled: Boolean(toCsv(paper.subdomains)) },
|
|
138
|
-
{ label: "cross_domain_links", filled: Boolean(toCsv(paper.crossDomainLinks)) },
|
|
139
|
-
{ label: "research_goal", filled: Boolean(cleanText(paper.researchGoal)) },
|
|
140
|
-
{ label: "approach", filled: Boolean(cleanText(paper.approach)) },
|
|
141
|
-
{ label: "methodology_design", filled: Boolean(cleanText(paper.methodologyDesign)) },
|
|
142
|
-
{ label: "key_contributions", filled: Boolean(paper.keyContributions && paper.keyContributions.length > 0) },
|
|
143
|
-
{ label: "practical_insights", filled: Boolean(paper.practicalInsights && paper.practicalInsights.length > 0) },
|
|
144
|
-
{
|
|
145
|
-
label: "must_understand_points",
|
|
146
|
-
filled: Boolean(paper.mustUnderstandPoints && paper.mustUnderstandPoints.length > 0),
|
|
147
|
-
},
|
|
148
|
-
{ label: "limitations", filled: Boolean(paper.limitations && paper.limitations.length > 0) },
|
|
149
|
-
{ label: "evidence_anchors", filled: Boolean(paper.evidenceAnchors && paper.evidenceAnchors.length > 0) },
|
|
150
|
-
];
|
|
151
|
-
const profileFilledCount = profileFieldChecks.filter((item) => item.filled).length;
|
|
152
|
-
const profileMissingFields = profileFieldChecks.filter((item) => !item.filled).map((item) => item.label);
|
|
153
124
|
const lines = [
|
|
154
125
|
`## Run ${args.runId}`,
|
|
155
126
|
`- Time: ${args.now}`,
|
|
156
127
|
`- Role in run: ${args.role}`,
|
|
157
|
-
`- Read status: ${
|
|
128
|
+
`- Read status: ${paper.readStatus ?? (paper.fullTextRead ? "fulltext" : "metadata")}`,
|
|
158
129
|
`- Full-text read: ${paper.fullTextRead === true ? "true" : "false"}`,
|
|
159
|
-
`- Profile coverage: ${profileFilledCount}/${profileFieldChecks.length}`,
|
|
160
130
|
];
|
|
161
|
-
if (
|
|
162
|
-
lines.push(`-
|
|
163
|
-
if (
|
|
164
|
-
lines.push(`- Full-text
|
|
165
|
-
if (
|
|
166
|
-
lines.push(`-
|
|
167
|
-
if (cleanText(paper.unreadReason))
|
|
168
|
-
lines.push(`- Unread reason: ${cleanText(paper.unreadReason)}`);
|
|
131
|
+
if (paper.fullTextSource?.trim())
|
|
132
|
+
lines.push(`- Full-text source: ${paper.fullTextSource.trim()}`);
|
|
133
|
+
if (paper.fullTextRef?.trim())
|
|
134
|
+
lines.push(`- Full-text ref: ${paper.fullTextRef.trim()}`);
|
|
135
|
+
if (paper.unreadReason?.trim())
|
|
136
|
+
lines.push(`- Unread reason: ${paper.unreadReason.trim()}`);
|
|
169
137
|
lines.push("");
|
|
170
138
|
lines.push("### Research Positioning");
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (domain)
|
|
175
|
-
lines.push(`- Domain: ${domain}`);
|
|
176
|
-
if (subdomains)
|
|
177
|
-
lines.push(`- Subdomains: ${subdomains}`);
|
|
178
|
-
if (crossDomainLinks)
|
|
179
|
-
lines.push(`- Cross-domain links: ${crossDomainLinks}`);
|
|
180
|
-
if (!domain && !subdomains && !crossDomainLinks) {
|
|
181
|
-
lines.push("- Pending enrichment: taxonomy fields were not extracted in this run.");
|
|
182
|
-
}
|
|
139
|
+
lines.push(`- Domain: ${paper.domain?.trim() || "N/A"}`);
|
|
140
|
+
lines.push(`- Subdomains: ${toCsv(paper.subdomains) ?? "N/A"}`);
|
|
141
|
+
lines.push(`- Cross-domain links: ${toCsv(paper.crossDomainLinks) ?? "N/A"}`);
|
|
183
142
|
lines.push("");
|
|
184
143
|
lines.push("### Study Focus");
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (researchGoal)
|
|
189
|
-
lines.push(`- Research goal: ${researchGoal}`);
|
|
190
|
-
if (approach)
|
|
191
|
-
lines.push(`- Approach: ${approach}`);
|
|
192
|
-
if (methodologyDesign)
|
|
193
|
-
lines.push(`- Methodology design: ${methodologyDesign}`);
|
|
194
|
-
if (!researchGoal && !approach && !methodologyDesign) {
|
|
195
|
-
lines.push("- Pending enrichment: study-focus fields were not extracted in this run.");
|
|
196
|
-
}
|
|
144
|
+
lines.push(`- Research goal: ${paper.researchGoal?.trim() || "N/A"}`);
|
|
145
|
+
lines.push(`- Approach: ${paper.approach?.trim() || "N/A"}`);
|
|
146
|
+
lines.push(`- Methodology design: ${paper.methodologyDesign?.trim() || "N/A"}`);
|
|
197
147
|
lines.push("");
|
|
198
148
|
lines.push("### Contributions");
|
|
199
|
-
|
|
200
|
-
.map((item) =>
|
|
201
|
-
.filter((item) => Boolean(item));
|
|
202
|
-
if (keyContributions.length > 0) {
|
|
203
|
-
lines.push(...keyContributions.map((item, idx) => `${idx + 1}. ${item}`));
|
|
149
|
+
if (paper.keyContributions && paper.keyContributions.length > 0) {
|
|
150
|
+
lines.push(...paper.keyContributions.map((item, idx) => `${idx + 1}. ${item}`));
|
|
204
151
|
}
|
|
205
152
|
else {
|
|
206
|
-
lines.push("
|
|
153
|
+
lines.push("1. (not provided)");
|
|
207
154
|
}
|
|
208
155
|
lines.push("");
|
|
209
156
|
lines.push("### Practical Insights");
|
|
210
|
-
|
|
211
|
-
.map((item) =>
|
|
212
|
-
.filter((item) => Boolean(item));
|
|
213
|
-
if (practicalInsights.length > 0) {
|
|
214
|
-
lines.push(...practicalInsights.map((item, idx) => `${idx + 1}. ${item}`));
|
|
157
|
+
if (paper.practicalInsights && paper.practicalInsights.length > 0) {
|
|
158
|
+
lines.push(...paper.practicalInsights.map((item, idx) => `${idx + 1}. ${item}`));
|
|
215
159
|
}
|
|
216
160
|
else {
|
|
217
|
-
lines.push("
|
|
161
|
+
lines.push("1. (not provided)");
|
|
218
162
|
}
|
|
219
163
|
lines.push("");
|
|
220
164
|
lines.push("### Must Understand");
|
|
221
|
-
|
|
222
|
-
.map((item) =>
|
|
223
|
-
.filter((item) => Boolean(item));
|
|
224
|
-
if (mustUnderstandPoints.length > 0) {
|
|
225
|
-
lines.push(...mustUnderstandPoints.map((item, idx) => `${idx + 1}. ${item}`));
|
|
165
|
+
if (paper.mustUnderstandPoints && paper.mustUnderstandPoints.length > 0) {
|
|
166
|
+
lines.push(...paper.mustUnderstandPoints.map((item, idx) => `${idx + 1}. ${item}`));
|
|
226
167
|
}
|
|
227
168
|
else {
|
|
228
|
-
lines.push("
|
|
169
|
+
lines.push("1. (not provided)");
|
|
229
170
|
}
|
|
230
171
|
lines.push("");
|
|
231
172
|
lines.push("### Limitations");
|
|
232
|
-
|
|
233
|
-
.map((item) =>
|
|
234
|
-
.filter((item) => Boolean(item));
|
|
235
|
-
if (limitations.length > 0) {
|
|
236
|
-
lines.push(...limitations.map((item, idx) => `${idx + 1}. ${item}`));
|
|
173
|
+
if (paper.limitations && paper.limitations.length > 0) {
|
|
174
|
+
lines.push(...paper.limitations.map((item, idx) => `${idx + 1}. ${item}`));
|
|
237
175
|
}
|
|
238
176
|
else {
|
|
239
|
-
lines.push("
|
|
177
|
+
lines.push("1. (not provided)");
|
|
240
178
|
}
|
|
241
179
|
lines.push("");
|
|
242
180
|
lines.push("### Evidence Anchors");
|
|
@@ -251,12 +189,7 @@ export function renderPaperNoteRunMarkdown(args) {
|
|
|
251
189
|
lines.push(...paper.keyEvidenceSpans.map((item, idx) => `${idx + 1}. ${item}`));
|
|
252
190
|
}
|
|
253
191
|
else {
|
|
254
|
-
|
|
255
|
-
lines.push("- Pending enrichment: add section + locator + quote evidence anchors.");
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
lines.push("- Metadata-only read in this run; evidence anchors require full-text reading.");
|
|
259
|
-
}
|
|
192
|
+
lines.push("1. (not provided)");
|
|
260
193
|
}
|
|
261
194
|
lines.push("");
|
|
262
195
|
return lines.join("\n");
|
|
@@ -306,29 +239,6 @@ export function renderExplorationLogMarkdown(args) {
|
|
|
306
239
|
];
|
|
307
240
|
return lines.join("\n");
|
|
308
241
|
}
|
|
309
|
-
export function renderReflectionLogMarkdown(args) {
|
|
310
|
-
const lines = [
|
|
311
|
-
`## Run ${args.runId}`,
|
|
312
|
-
`- Time: ${args.now}`,
|
|
313
|
-
`- Reflection tasks: ${args.tasks.length}`,
|
|
314
|
-
"",
|
|
315
|
-
"### Tasks",
|
|
316
|
-
...(args.tasks.length > 0
|
|
317
|
-
? args.tasks.map((task, idx) => {
|
|
318
|
-
const attrs = [
|
|
319
|
-
`trigger=${task.trigger}`,
|
|
320
|
-
`priority=${task.priority}`,
|
|
321
|
-
`status=${task.status}`,
|
|
322
|
-
`query=${task.query}`,
|
|
323
|
-
`reason=${task.reason}`,
|
|
324
|
-
];
|
|
325
|
-
return `${idx + 1}. ${attrs.join(" | ")}`;
|
|
326
|
-
})
|
|
327
|
-
: ["- (none)"]),
|
|
328
|
-
"",
|
|
329
|
-
];
|
|
330
|
-
return lines.join("\n");
|
|
331
|
-
}
|
|
332
242
|
export function renderDailyChangesMarkdown(args) {
|
|
333
243
|
const groups = {
|
|
334
244
|
NEW: [],
|
|
@@ -379,9 +289,9 @@ export function renderTopicUpdateMarkdown(args) {
|
|
|
379
289
|
return lines.join("\n");
|
|
380
290
|
}
|
|
381
291
|
export function renderHypothesisMarkdown(args) {
|
|
382
|
-
const novelty = typeof args.hypothesis.novelty === "number" ? args.hypothesis.novelty : "
|
|
383
|
-
const feasibility = typeof args.hypothesis.feasibility === "number" ? args.hypothesis.feasibility : "
|
|
384
|
-
const impact = typeof args.hypothesis.impact === "number" ? args.hypothesis.impact : "
|
|
292
|
+
const novelty = typeof args.hypothesis.novelty === "number" ? args.hypothesis.novelty : "N/A";
|
|
293
|
+
const feasibility = typeof args.hypothesis.feasibility === "number" ? args.hypothesis.feasibility : "N/A";
|
|
294
|
+
const impact = typeof args.hypothesis.impact === "number" ? args.hypothesis.impact : "N/A";
|
|
385
295
|
const lines = [
|
|
386
296
|
`# ${args.hypothesisId}`,
|
|
387
297
|
"",
|
|
@@ -392,54 +302,10 @@ export function renderHypothesisMarkdown(args) {
|
|
|
392
302
|
"## Statement",
|
|
393
303
|
args.hypothesis.statement,
|
|
394
304
|
"",
|
|
395
|
-
"## Problem Gap",
|
|
396
|
-
args.hypothesis.problemGap ?? "pending",
|
|
397
|
-
"",
|
|
398
|
-
"## Proposed Mechanism",
|
|
399
|
-
args.hypothesis.proposedMechanism ?? "pending",
|
|
400
|
-
"",
|
|
401
|
-
"## Novelty Rationale",
|
|
402
|
-
args.hypothesis.noveltyRationale ?? "pending",
|
|
403
|
-
"",
|
|
404
305
|
"## Dependency Path",
|
|
405
306
|
...(args.hypothesis.dependencyPath && args.hypothesis.dependencyPath.length > 0
|
|
406
307
|
? args.hypothesis.dependencyPath.map((step, idx) => `${idx + 1}. ${step}`)
|
|
407
|
-
: ["
|
|
408
|
-
"",
|
|
409
|
-
"## Falsifiable Predictions",
|
|
410
|
-
...(args.hypothesis.falsifiablePredictions && args.hypothesis.falsifiablePredictions.length > 0
|
|
411
|
-
? args.hypothesis.falsifiablePredictions.map((item, idx) => `${idx + 1}. ${item}`)
|
|
412
|
-
: ["1. (none)"]),
|
|
413
|
-
"",
|
|
414
|
-
"## Critical Assumptions",
|
|
415
|
-
...(args.hypothesis.criticalAssumptions && args.hypothesis.criticalAssumptions.length > 0
|
|
416
|
-
? args.hypothesis.criticalAssumptions.map((item, idx) => `${idx + 1}. ${item}`)
|
|
417
|
-
: ["1. (none)"]),
|
|
418
|
-
"",
|
|
419
|
-
"## Failure Modes",
|
|
420
|
-
...(args.hypothesis.failureModes && args.hypothesis.failureModes.length > 0
|
|
421
|
-
? args.hypothesis.failureModes.map((item, idx) => `${idx + 1}. ${item}`)
|
|
422
|
-
: ["1. (none)"]),
|
|
423
|
-
"",
|
|
424
|
-
"## Success Criteria",
|
|
425
|
-
...(args.hypothesis.successCriteria && args.hypothesis.successCriteria.length > 0
|
|
426
|
-
? args.hypothesis.successCriteria.map((item, idx) => `${idx + 1}. ${item}`)
|
|
427
|
-
: ["1. (none)"]),
|
|
428
|
-
"",
|
|
429
|
-
"## Strengths",
|
|
430
|
-
...(args.hypothesis.strengths && args.hypothesis.strengths.length > 0
|
|
431
|
-
? args.hypothesis.strengths.map((item, idx) => `${idx + 1}. ${item}`)
|
|
432
|
-
: ["1. (none)"]),
|
|
433
|
-
"",
|
|
434
|
-
"## Weaknesses",
|
|
435
|
-
...(args.hypothesis.weaknesses && args.hypothesis.weaknesses.length > 0
|
|
436
|
-
? args.hypothesis.weaknesses.map((item, idx) => `${idx + 1}. ${item}`)
|
|
437
|
-
: ["1. (none)"]),
|
|
438
|
-
"",
|
|
439
|
-
"## Research Plan",
|
|
440
|
-
...(args.hypothesis.planSteps && args.hypothesis.planSteps.length > 0
|
|
441
|
-
? args.hypothesis.planSteps.map((step, idx) => `${idx + 1}. ${step}`)
|
|
442
|
-
: ["1. (none)"]),
|
|
308
|
+
: ["1. (not provided)"]),
|
|
443
309
|
"",
|
|
444
310
|
"## Evidence IDs",
|
|
445
311
|
...(args.hypothesis.evidenceIds && args.hypothesis.evidenceIds.length > 0
|
|
@@ -448,7 +314,7 @@ export function renderHypothesisMarkdown(args) {
|
|
|
448
314
|
"",
|
|
449
315
|
"## Validation",
|
|
450
316
|
`- Status: ${args.hypothesis.validationStatus ?? "unchecked"}`,
|
|
451
|
-
`- Notes: ${args.hypothesis.validationNotes ?? "
|
|
317
|
+
`- Notes: ${args.hypothesis.validationNotes ?? "N/A"}`,
|
|
452
318
|
...(args.hypothesis.validationEvidence && args.hypothesis.validationEvidence.length > 0
|
|
453
319
|
? [
|
|
454
320
|
"- Evidence:",
|
|
@@ -460,17 +326,6 @@ export function renderHypothesisMarkdown(args) {
|
|
|
460
326
|
`- Novelty: ${novelty}`,
|
|
461
327
|
`- Feasibility: ${feasibility}`,
|
|
462
328
|
`- Impact: ${impact}`,
|
|
463
|
-
...(args.hypothesis.strictEvaluation
|
|
464
|
-
? [
|
|
465
|
-
`- Strict overall score: ${typeof args.hypothesis.strictEvaluation.overallScore === "number" ? args.hypothesis.strictEvaluation.overallScore : "pending"}`,
|
|
466
|
-
`- Strict decision: ${args.hypothesis.strictEvaluation.decision ?? "pending"}`,
|
|
467
|
-
`- Strict reason: ${args.hypothesis.strictEvaluation.reason ?? "pending"}`,
|
|
468
|
-
]
|
|
469
|
-
: [
|
|
470
|
-
"- Strict overall score: pending",
|
|
471
|
-
"- Strict decision: pending",
|
|
472
|
-
"- Strict reason: pending",
|
|
473
|
-
]),
|
|
474
329
|
"",
|
|
475
330
|
];
|
|
476
331
|
return lines.join("\n");
|
|
@@ -481,7 +336,6 @@ export function renderKnowledgeIndexMarkdown(args) {
|
|
|
481
336
|
"",
|
|
482
337
|
`- Updated: ${args.now}`,
|
|
483
338
|
`- Topic: ${args.topic}`,
|
|
484
|
-
`- Run profile: ${args.runProfile}`,
|
|
485
339
|
`- Topic files: ${args.topicFiles.length}`,
|
|
486
340
|
`- Paper notes: ${args.paperNotesCount}`,
|
|
487
341
|
`- Total hypotheses: ${args.totalHypotheses}`,
|
|
@@ -492,20 +346,12 @@ export function renderKnowledgeIndexMarkdown(args) {
|
|
|
492
346
|
`- Full-text coverage: ${args.qualityGate.fullTextCoveragePct}%`,
|
|
493
347
|
`- Evidence binding rate: ${args.qualityGate.evidenceBindingRatePct}%`,
|
|
494
348
|
`- Citation error rate: ${args.qualityGate.citationErrorRatePct}%`,
|
|
495
|
-
`- Reflection tasks (executed): ${args.reflectionTasks.filter((task) => task.status === "executed").length}`,
|
|
496
|
-
`- Hypothesis gate: accepted=${args.hypothesisGate.accepted}, rejected=${args.hypothesisGate.rejected}`,
|
|
497
349
|
"",
|
|
498
350
|
"## Quality Notes",
|
|
499
351
|
...(args.qualityGate.reasons.length > 0 ? args.qualityGate.reasons.map((reason) => `- ${reason}`) : ["- (none)"]),
|
|
500
352
|
...(args.unreadCorePaperIds.length > 0
|
|
501
353
|
? ["- unread_core_paper_ids: " + args.unreadCorePaperIds.join(", ")]
|
|
502
354
|
: ["- unread_core_paper_ids: (none)"]),
|
|
503
|
-
...(args.hypothesisGate.rejectionReasons.length > 0
|
|
504
|
-
? args.hypothesisGate.rejectionReasons.map((reason) => `- hypothesis_gate_reason: ${reason}`)
|
|
505
|
-
: ["- hypothesis_gate_reason: (none)"]),
|
|
506
|
-
...(args.reflectionTasks.length > 0
|
|
507
|
-
? ["- reflection_tasks: " + args.reflectionTasks.map((task) => `${task.trigger}:${task.status}`).join(", ")]
|
|
508
|
-
: ["- reflection_tasks: (none)"]),
|
|
509
355
|
"",
|
|
510
356
|
"## Topics",
|
|
511
357
|
...(args.topicFiles.length > 0 ? args.topicFiles.map((file) => `- ${file}`) : ["- (none)"]),
|