@louisultra/dsh-verymath 0.0.0-stage → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE.md +35 -0
  4. package/README.md +108 -2
  5. package/README_EN.md +105 -0
  6. package/UPSTREAM.json +106 -0
  7. package/cordis.patch.yml +12 -0
  8. package/docs/capability-examples.md +581 -0
  9. package/docs/examples/README.md +32 -0
  10. package/docs/examples/bad_scan.md +10 -0
  11. package/docs/examples/broken-proof.lean +9 -0
  12. package/docs/examples/claims.md +7 -0
  13. package/docs/examples/knapsack.json +10 -0
  14. package/docs/examples/matrix.json +1 -0
  15. package/docs/examples/points.csv +21 -0
  16. package/docs/examples/qp.json +8 -0
  17. package/docs/examples/research-ws/project/GOALS.yaml +4 -0
  18. package/docs/examples/research-ws/workstreams/ws-lsa/report.md +13 -0
  19. package/docs/examples/research-ws/workstreams/ws-lsa/reviews/r1.json +1 -0
  20. package/docs/examples/research-ws/workstreams/ws-lsa/status.yaml +1 -0
  21. package/docs/examples/source.csv +4 -0
  22. package/lib/core/error.d.ts +20 -0
  23. package/lib/core/error.js +25 -0
  24. package/lib/core/gates.d.ts +42 -0
  25. package/lib/core/gates.js +217 -0
  26. package/lib/core/glossary.d.ts +101 -0
  27. package/lib/core/glossary.js +243 -0
  28. package/lib/core/graph.d.ts +118 -0
  29. package/lib/core/graph.js +460 -0
  30. package/lib/core/index.d.ts +120 -0
  31. package/lib/core/index.js +197 -0
  32. package/lib/core/paper.d.ts +163 -0
  33. package/lib/core/paper.js +73 -0
  34. package/lib/core/paths.d.ts +2 -0
  35. package/lib/core/paths.js +12 -0
  36. package/lib/core/sage.d.ts +61 -0
  37. package/lib/core/sage.js +212 -0
  38. package/lib/core/skills.d.ts +11 -0
  39. package/lib/core/skills.js +110 -0
  40. package/lib/tool/index.d.ts +21 -0
  41. package/lib/tool/index.js +1144 -0
  42. package/package.json +92 -4
  43. package/skills/after-ocr/SKILL.md +123 -0
  44. package/skills/after-ocr/references/audit-schema.md +94 -0
  45. package/skills/after-ocr/references/error-taxonomy.md +179 -0
  46. package/skills/after-ocr/scripts/merge_audit_logs.py +329 -0
  47. package/skills/after-ocr/scripts/scan_markdown_ocr.py +350 -0
  48. package/skills/after-ocr/tests/test_scripts.py +84 -0
  49. package/skills/discover-math-problems/SKILL.md +115 -0
  50. package/skills/discover-math-problems/references/artifact-contract.md +93 -0
  51. package/skills/discover-math-problems/references/autonomous-research-protocol.md +86 -0
  52. package/skills/discover-math-problems/references/conjecture-generation-protocol.md +63 -0
  53. package/skills/discover-math-problems/references/extremal-graph-variants.md +53 -0
  54. package/skills/graph-theory-paper-reading/SKILL.md +600 -0
  55. package/skills/invariant-computation/SKILL.md +169 -0
  56. package/skills/invariant-computation/examples/invariant_summary.example.json +51 -0
  57. package/skills/invariant-computation/manifest.yaml +46 -0
  58. package/skills/invariant-computation/references/INDEX.md +20 -0
  59. package/skills/invariant-computation/references/failure_modes.md +40 -0
  60. package/skills/invariant-computation/references/method_route_map.md +177 -0
  61. package/skills/invariant-computation/references/source_notes.md +19 -0
  62. package/skills/invariant-computation/references/tool_catalog.md +65 -0
  63. package/skills/invariant-computation/references/validation_checks.md +52 -0
  64. package/skills/invariant-computation/schema/invariant_summary.schema.json +260 -0
  65. package/skills/lean-formalization/SKILL.md +111 -0
  66. package/skills/lean-formalization/lean-runtime/config/env.example +5 -0
  67. package/skills/lean-formalization/lean-runtime/config/lean_agent.example.toml +28 -0
  68. package/skills/lean-formalization/lean-runtime/config/numina_runtime.example.toml +12 -0
  69. package/skills/lean-formalization/lean-runtime/examples/smoke/LocalLeanSmoke.lean +7 -0
  70. package/skills/lean-formalization/lean-runtime/prompts/complete_sorries.md +3 -0
  71. package/skills/lean-formalization/lean-runtime/prompts/formalize_statement.md +3 -0
  72. package/skills/lean-formalization/lean-runtime/prompts/prove_theorem.md +3 -0
  73. package/skills/lean-formalization/lean-runtime/prompts/repair_lean_file.md +3 -0
  74. package/skills/lean-formalization/lean-runtime/references/backend_adapter_checklist.md +36 -0
  75. package/skills/lean-formalization/lean-runtime/references/direct_lean_workflow.md +48 -0
  76. package/skills/lean-formalization/lean-runtime/references/failure_taxonomy.md +17 -0
  77. package/skills/lean-formalization/lean-runtime/references/interactive_orchestration.md +83 -0
  78. package/skills/lean-formalization/lean-runtime/references/lean_agent_capability_map.md +116 -0
  79. package/skills/lean-formalization/lean-runtime/references/lean_lsp_mcp_adapter.md +219 -0
  80. package/skills/lean-formalization/lean-runtime/references/lean_runtime_configuration.md +92 -0
  81. package/skills/lean-formalization/lean-runtime/references/numina_reverse_analysis.md +80 -0
  82. package/skills/lean-formalization/lean-runtime/references/numina_runtime.md +41 -0
  83. package/skills/lean-formalization/lean-runtime/references/numina_subagent_troubleshooting.md +77 -0
  84. package/skills/lean-formalization/lean-runtime/references/review_checklist.md +10 -0
  85. package/skills/lean-formalization/lean-runtime/references/specialist_agent_patterns.md +65 -0
  86. package/skills/lean-formalization/lean-runtime/schemas/config.schema.json +12 -0
  87. package/skills/lean-formalization/lean-runtime/schemas/result.schema.json +33 -0
  88. package/skills/lean-formalization/lean-runtime/schemas/task.schema.json +30 -0
  89. package/skills/lean-formalization/lean-runtime/scripts/ai4m_lean.py +222 -0
  90. package/skills/lean-formalization/lean-runtime/scripts/check_lean_project.py +134 -0
  91. package/skills/lean-formalization/lean-runtime/scripts/common.py +296 -0
  92. package/skills/lean-formalization/lean-runtime/scripts/configure_lean.py +222 -0
  93. package/skills/lean-formalization/lean-runtime/scripts/detect_sorry.py +49 -0
  94. package/skills/lean-formalization/lean-runtime/scripts/direct_task.py +100 -0
  95. package/skills/lean-formalization/lean-runtime/scripts/extract_minimal_failure.py +74 -0
  96. package/skills/lean-formalization/lean-runtime/scripts/numina_runtime.py +414 -0
  97. package/skills/lean-formalization/lean-runtime/scripts/smoke_test.py +75 -0
  98. package/skills/lean-formalization/lean-runtime/scripts/tool_status.py +79 -0
  99. package/skills/lean-formalization/lean-runtime/scripts/validate_patch.py +81 -0
  100. package/skills/lean-formalization/lean-runtime/scripts/verify_delivery.py +484 -0
  101. package/skills/lean-formalization/lean-runtime/tests/fixtures/after_bad.lean +4 -0
  102. package/skills/lean-formalization/lean-runtime/tests/fixtures/after_statement_changed.lean +4 -0
  103. package/skills/lean-formalization/lean-runtime/tests/fixtures/before.lean +4 -0
  104. package/skills/lean-formalization/lean-runtime/tests/fixtures/failure.lean +7 -0
  105. package/skills/lean-formalization/lean-runtime/tests/test_check_lean_project.py +59 -0
  106. package/skills/lean-formalization/lean-runtime/tests/test_cli.py +377 -0
  107. package/skills/lean-formalization/lean-runtime/tests/test_common_config.py +84 -0
  108. package/skills/lean-formalization/lean-runtime/tests/test_configure_lean.py +138 -0
  109. package/skills/lean-formalization/lean-runtime/tests/test_detect_sorry.py +24 -0
  110. package/skills/lean-formalization/lean-runtime/tests/test_direct_task.py +69 -0
  111. package/skills/lean-formalization/lean-runtime/tests/test_numina_runtime.py +168 -0
  112. package/skills/lean-formalization/lean-runtime/tests/test_validate_patch.py +29 -0
  113. package/skills/lean-setup/SKILL.md +99 -0
  114. package/skills/least-squares/README.md +85 -0
  115. package/skills/least-squares/SKILL.md +613 -0
  116. package/skills/least-squares/examples.md +380 -0
  117. package/skills/math-beamer/SKILL.md +325 -0
  118. package/skills/math-beamer/references/build-and-layout-audit.md +63 -0
  119. package/skills/math-beamer/references/math-domain-patterns.md +56 -0
  120. package/skills/math-beamer/references/template-policy.md +43 -0
  121. package/skills/math-beamer/references/template-source-index.md +51 -0
  122. package/skills/math-beamer/templates/catalog.yaml +235 -0
  123. package/skills/math-beamer/templates/packs/algebra-number-theory-talk/main.tex +45 -0
  124. package/skills/math-beamer/templates/packs/algebra-number-theory-talk/template.yaml +9 -0
  125. package/skills/math-beamer/templates/packs/algorithm-talk/main.tex +43 -0
  126. package/skills/math-beamer/templates/packs/algorithm-talk/template.yaml +9 -0
  127. package/skills/math-beamer/templates/packs/analysis-core-talk/main.tex +49 -0
  128. package/skills/math-beamer/templates/packs/analysis-core-talk/template.yaml +19 -0
  129. package/skills/math-beamer/templates/packs/backup-heavy-talk/main.tex +40 -0
  130. package/skills/math-beamer/templates/packs/backup-heavy-talk/template.yaml +9 -0
  131. package/skills/math-beamer/templates/packs/beamerposter-a0/main.tex +45 -0
  132. package/skills/math-beamer/templates/packs/beamerposter-a0/template.yaml +12 -0
  133. package/skills/math-beamer/templates/packs/combinatorics-graph-talk/main.tex +53 -0
  134. package/skills/math-beamer/templates/packs/combinatorics-graph-talk/template.yaml +18 -0
  135. package/skills/math-beamer/templates/packs/control-systems-talk/main.tex +51 -0
  136. package/skills/math-beamer/templates/packs/control-systems-talk/template.yaml +18 -0
  137. package/skills/math-beamer/templates/packs/course-lecture-zh/main.tex +43 -0
  138. package/skills/math-beamer/templates/packs/course-lecture-zh/template.yaml +9 -0
  139. package/skills/math-beamer/templates/packs/data-experiment-results/main.tex +45 -0
  140. package/skills/math-beamer/templates/packs/data-experiment-results/template.yaml +9 -0
  141. package/skills/math-beamer/templates/packs/dynamical-systems-talk/main.tex +42 -0
  142. package/skills/math-beamer/templates/packs/dynamical-systems-talk/template.yaml +9 -0
  143. package/skills/math-beamer/templates/packs/geometry-topology-talk/main.tex +43 -0
  144. package/skills/math-beamer/templates/packs/geometry-topology-talk/template.yaml +9 -0
  145. package/skills/math-beamer/templates/packs/information-coding-crypto-talk/main.tex +49 -0
  146. package/skills/math-beamer/templates/packs/information-coding-crypto-talk/template.yaml +18 -0
  147. package/skills/math-beamer/templates/packs/logic-foundations-category-talk/main.tex +51 -0
  148. package/skills/math-beamer/templates/packs/logic-foundations-category-talk/template.yaml +18 -0
  149. package/skills/math-beamer/templates/packs/numerical-analysis-talk/main.tex +51 -0
  150. package/skills/math-beamer/templates/packs/numerical-analysis-talk/template.yaml +9 -0
  151. package/skills/math-beamer/templates/packs/optimization-talk/main.tex +58 -0
  152. package/skills/math-beamer/templates/packs/optimization-talk/template.yaml +9 -0
  153. package/skills/math-beamer/templates/packs/pde-analysis-talk/main.tex +49 -0
  154. package/skills/math-beamer/templates/packs/pde-analysis-talk/template.yaml +9 -0
  155. package/skills/math-beamer/templates/packs/probability-statistics-talk/main.tex +52 -0
  156. package/skills/math-beamer/templates/packs/probability-statistics-talk/template.yaml +9 -0
  157. package/skills/math-beamer/templates/packs/reading-group-paper/main.tex +46 -0
  158. package/skills/math-beamer/templates/packs/reading-group-paper/template.yaml +9 -0
  159. package/skills/math-beamer/templates/packs/seminar-minimal-en/main.tex +60 -0
  160. package/skills/math-beamer/templates/packs/seminar-minimal-en/template.yaml +13 -0
  161. package/skills/math-beamer/templates/packs/seminar-minimal-zh/main.tex +60 -0
  162. package/skills/math-beamer/templates/packs/seminar-minimal-zh/template.yaml +13 -0
  163. package/skills/math-beamer/templates/packs/theorem-proof-talk/main.tex +60 -0
  164. package/skills/math-beamer/templates/packs/theorem-proof-talk/template.yaml +9 -0
  165. package/skills/math-beamer/templates/packs/thesis-defense/main.tex +42 -0
  166. package/skills/math-beamer/templates/packs/thesis-defense/template.yaml +9 -0
  167. package/skills/math-beamer/templates/packs/workshop-tutorial/main.tex +32 -0
  168. package/skills/math-beamer/templates/packs/workshop-tutorial/template.yaml +9 -0
  169. package/skills/math-beamer/templates/preview-gallery.md +32 -0
  170. package/skills/math-beamer/templates/previews/algebra-number-theory-talk-content.png +0 -0
  171. package/skills/math-beamer/templates/previews/algebra-number-theory-talk-cover.png +0 -0
  172. package/skills/math-beamer/templates/previews/algorithm-talk-content.png +0 -0
  173. package/skills/math-beamer/templates/previews/algorithm-talk-cover.png +0 -0
  174. package/skills/math-beamer/templates/previews/analysis-core-talk-content.png +0 -0
  175. package/skills/math-beamer/templates/previews/analysis-core-talk-cover.png +0 -0
  176. package/skills/math-beamer/templates/previews/backup-heavy-talk-content.png +0 -0
  177. package/skills/math-beamer/templates/previews/backup-heavy-talk-cover.png +0 -0
  178. package/skills/math-beamer/templates/previews/beamerposter-a0-content.png +0 -0
  179. package/skills/math-beamer/templates/previews/beamerposter-a0-cover.png +0 -0
  180. package/skills/math-beamer/templates/previews/combinatorics-graph-talk-content.png +0 -0
  181. package/skills/math-beamer/templates/previews/combinatorics-graph-talk-cover.png +0 -0
  182. package/skills/math-beamer/templates/previews/control-systems-talk-content.png +0 -0
  183. package/skills/math-beamer/templates/previews/control-systems-talk-cover.png +0 -0
  184. package/skills/math-beamer/templates/previews/course-lecture-zh-content.png +0 -0
  185. package/skills/math-beamer/templates/previews/course-lecture-zh-cover.png +0 -0
  186. package/skills/math-beamer/templates/previews/data-experiment-results-content.png +0 -0
  187. package/skills/math-beamer/templates/previews/data-experiment-results-cover.png +0 -0
  188. package/skills/math-beamer/templates/previews/dynamical-systems-talk-content.png +0 -0
  189. package/skills/math-beamer/templates/previews/dynamical-systems-talk-cover.png +0 -0
  190. package/skills/math-beamer/templates/previews/geometry-topology-talk-content.png +0 -0
  191. package/skills/math-beamer/templates/previews/geometry-topology-talk-cover.png +0 -0
  192. package/skills/math-beamer/templates/previews/information-coding-crypto-talk-content.png +0 -0
  193. package/skills/math-beamer/templates/previews/information-coding-crypto-talk-cover.png +0 -0
  194. package/skills/math-beamer/templates/previews/logic-foundations-category-talk-content.png +0 -0
  195. package/skills/math-beamer/templates/previews/logic-foundations-category-talk-cover.png +0 -0
  196. package/skills/math-beamer/templates/previews/numerical-analysis-talk-content.png +0 -0
  197. package/skills/math-beamer/templates/previews/numerical-analysis-talk-cover.png +0 -0
  198. package/skills/math-beamer/templates/previews/optimization-talk-content.png +0 -0
  199. package/skills/math-beamer/templates/previews/optimization-talk-cover.png +0 -0
  200. package/skills/math-beamer/templates/previews/pde-analysis-talk-content.png +0 -0
  201. package/skills/math-beamer/templates/previews/pde-analysis-talk-cover.png +0 -0
  202. package/skills/math-beamer/templates/previews/probability-statistics-talk-content.png +0 -0
  203. package/skills/math-beamer/templates/previews/probability-statistics-talk-cover.png +0 -0
  204. package/skills/math-beamer/templates/previews/reading-group-paper-content.png +0 -0
  205. package/skills/math-beamer/templates/previews/reading-group-paper-cover.png +0 -0
  206. package/skills/math-beamer/templates/previews/seminar-minimal-en-content.png +0 -0
  207. package/skills/math-beamer/templates/previews/seminar-minimal-en-cover.png +0 -0
  208. package/skills/math-beamer/templates/previews/seminar-minimal-zh-content.png +0 -0
  209. package/skills/math-beamer/templates/previews/seminar-minimal-zh-cover.png +0 -0
  210. package/skills/math-beamer/templates/previews/theorem-proof-talk-content.png +0 -0
  211. package/skills/math-beamer/templates/previews/theorem-proof-talk-cover.png +0 -0
  212. package/skills/math-beamer/templates/previews/thesis-defense-content.png +0 -0
  213. package/skills/math-beamer/templates/previews/thesis-defense-cover.png +0 -0
  214. package/skills/math-beamer/templates/previews/workshop-tutorial-content.png +0 -0
  215. package/skills/math-beamer/templates/previews/workshop-tutorial-cover.png +0 -0
  216. package/skills/math-beamer/templates/review-report.md +54 -0
  217. package/skills/math-beamer/templates/slide-source-ledger.md +22 -0
  218. package/skills/math-beamer/templates/source-packet.md +50 -0
  219. package/skills/math-glossary/SKILL.md +347 -0
  220. package/skills/math-glossary/references/glossary-schema.md +71 -0
  221. package/skills/math-glossary/references/glossary-usage-guide.md +176 -0
  222. package/skills/math-glossary/references/glossary-web-template.md +127 -0
  223. package/skills/math-glossary/references/glossary.schema.json +76 -0
  224. package/skills/math-glossary/references/user-manual.md +435 -0
  225. package/skills/math-glossary/requirements-ai.txt +3 -0
  226. package/skills/math-glossary/requirements.txt +3 -0
  227. package/skills/math-glossary/scripts/glossary_backup.py +42 -0
  228. package/skills/math-glossary/scripts/glossary_build.py +467 -0
  229. package/skills/math-glossary/scripts/glossary_enrich_examples.py +283 -0
  230. package/skills/math-glossary/scripts/glossary_export.py +333 -0
  231. package/skills/math-glossary/scripts/glossary_web.py +1265 -0
  232. package/skills/math-paper-reading/README.md +163 -0
  233. package/skills/math-paper-reading/SKILL.md +48 -0
  234. package/skills/math-paper-reading/agent_router.md +36 -0
  235. package/skills/math-paper-reading/references/proof_pattern_taxonomy.md +123 -0
  236. package/skills/math-paper-reading/references/quality_rubric.md +36 -0
  237. package/skills/math-paper-reading/skill_base.md +627 -0
  238. package/skills/math-paper-reading/skill_literature_search.md +866 -0
  239. package/skills/math-paper-reading/skill_paper_deep_read.md +1024 -0
  240. package/skills/math-paper-reading/skill_pathway_proof.md +718 -0
  241. package/skills/math-paper-reading/skill_reference_manager.md +746 -0
  242. package/skills/matlab-runner/SKILL.md +217 -0
  243. package/skills/matlab-runner/examples/README.md +33 -0
  244. package/skills/matlab-runner/examples/matrix_report.m +28 -0
  245. package/skills/matlab-runner/examples/plot_damped_sine.m +64 -0
  246. package/skills/matlab-runner/examples/test_vector_norm.m +12 -0
  247. package/skills/matlab-runner/references/client-setup.md +24 -0
  248. package/skills/matlab-runner/references/file-session-safety.md +86 -0
  249. package/skills/matlab-runner/references/numerical-safety.md +126 -0
  250. package/skills/matlab-runner/references/resource-safety.md +125 -0
  251. package/skills/mixed-integer-programming/SKILL.md +119 -0
  252. package/skills/mixed-integer-programming/lp-examples.md +251 -0
  253. package/skills/mixed-integer-programming/mip-examples-verified.md +118 -0
  254. package/skills/open-problem-research-pipeline/SKILL.md +76 -0
  255. package/skills/open-problem-research-pipeline/skill_literature_analysis.md +201 -0
  256. package/skills/open-problem-research-pipeline/skill_literature_proof_framework.md +206 -0
  257. package/skills/open-problem-research-pipeline/skill_literature_search.md +172 -0
  258. package/skills/open-problem-research-pipeline/skill_qskill.md +177 -0
  259. package/skills/osqp-solver/SKILL.md +245 -0
  260. package/skills/osqp-solver/references/citation.md +25 -0
  261. package/skills/osqp-solver/references/dual-infeasible-example.json +14 -0
  262. package/skills/osqp-solver/references/feasible-example.json +21 -0
  263. package/skills/osqp-solver/references/primal-infeasible-example.json +17 -0
  264. package/skills/osqp-solver/references/python-api.md +95 -0
  265. package/skills/osqp-solver/references/verification.md +94 -0
  266. package/skills/osqp-solver/scripts/check_osqp_environment.py +120 -0
  267. package/skills/osqp-solver/scripts/solve_qp.py +943 -0
  268. package/skills/paper-writing/SKILL.md +115 -0
  269. package/skills/paper-writing/skill_claim_evidence_ledger.md +55 -0
  270. package/skills/paper-writing/skill_formula_environment_and_readability.md +41 -0
  271. package/skills/paper-writing/skill_latex_build_and_layout_audit.md +73 -0
  272. package/skills/paper-writing/skill_notation_and_variable_consistency.md +42 -0
  273. package/skills/paper-writing/skill_paper_skeleton_and_logical_architecture.md +54 -0
  274. package/skills/paper-writing/skill_proof_obligation_and_assumption_audit.md +57 -0
  275. package/skills/paper-writing/templates/claim-evidence-ledger.md +23 -0
  276. package/skills/paper-writing/templates/proof-obligation-ledger.md +22 -0
  277. package/skills/paper-writing/templates/rapid-prototype-paper-skeleton.md +46 -0
  278. package/skills/paper-writing/templates/source-packet.md +37 -0
  279. package/skills/paper-writing/templates/submission-readiness.md +41 -0
  280. package/skills/proof-blueprint-review/SKILL.md +129 -0
  281. package/skills/proof-blueprint-review/references/agent-mediated-proof-protocol.md +57 -0
  282. package/skills/proof-blueprint-review/references/generation-agent.md +45 -0
  283. package/skills/proof-blueprint-review/references/proof-acceptance-contract.md +41 -0
  284. package/skills/proof-blueprint-review/references/verification-agent.md +37 -0
@@ -0,0 +1,746 @@
1
+ # 学术文献管理助手 — JSON-Driven Knowledge Base Hub
2
+
3
+ > **定位**:skill_base 生成的结构化 JSON 的持久化知识库中控台。
4
+ >
5
+ > **核心架构**:**数据驱动模式**。所有笔记的生成、元数据的提取、被引关系的记录,必须优先基于 `<slug>_structure.json`。本模块不做深度数学推导或不依赖 JSON 的结构分析——这些强制外包给 `skill_paper_deep_read` 和 `skill_pathway_proof`。
6
+
7
+ ---
8
+
9
+ ## 一、角色定位与核心痛点
10
+
11
+ ### 角色
12
+ 你是**基于 JSON 结构化数据的知识库架构师**,专注于文献笔记的持久化管理和引用调度。你能够:
13
+ - 使用 JSON 的 `main_theorems`、`entities`、`completeness_check` 字段,逐字提取核心定理和引理
14
+ - 维护包含统一 URI 的多维知识索引
15
+ - 在写作时基于 JSON `related_work` 和 `external_deps` 精准推荐引用
16
+
17
+ ### 与同类模块的职责边界
18
+
19
+ | 模块 | 职责 | 本模块的处理 |
20
+ |:--|:--|:--|
21
+ | `skill_base` | 论文 → 结构化 JSON | 本模块的**数据前提**;若无 JSON 则先委托生成 |
22
+ | `skill_paper_deep_read` | 深度推导与跳跃填补 | 强制外包 L3.3 逻辑跳跃填补 |
23
+ | `skill_pathway_proof` | 依赖图生成与拓扑分析 | 强制外包依赖图渲染 |
24
+ | **本模块** | 笔记结构、标签体系、BibTeX、冲突检测、索引管理 | — |
25
+
26
+ **边界声明**:本模块不解读证明逻辑、不生成依赖图、不填补推导跳跃。这些功能通过读取对应 skill 提示文件并顺序执行来实现。
27
+
28
+ ### 核心痛点响应
29
+
30
+ | 痛点 | 表现 | 我会怎么做 |
31
+ |------|------|-----------|
32
+ | **存而不看** | 收藏一堆PDF,从不打开 | 捕获时强制从 JSON 提取核心定理 + 3点摘要,7天内未读则提醒 |
33
+ | **看而不记** | 读时觉得懂,过后想不起 | 强制输出结构化笔记模板,逐字引用 JSON `main_theorems[].statement` |
34
+ | **记而不查** | 笔记散落各处,用时找不到 | 维护语义索引(JSON 状态块),支持模糊检索,冲突主动预警 |
35
+
36
+ ### 输出格式指引
37
+
38
+ 当用户请求"建立笔记"时:
39
+ 1. 先输出简短的终端友好进度信息(如 `🔍 读取 JSON...`、`📝 正在生成笔记模板...`)
40
+ 2. 确认文件创建成功后输出确认信息(如 `📝 成功保存笔记到 memory/notes/[filename].md`)
41
+ 3. 笔记模板包含以下核心模块(YAML front matter 在文件内呈现,而非在终端以 YAML 直接开头):
42
+ - `type: paper`
43
+ - `global_uri`
44
+ - `source_json: true/false`
45
+ - `核心结论`(逐字引用 + 意译分离)
46
+ - `用我的话复述`
47
+ - `待深入问题`
48
+
49
+ ---
50
+
51
+ ## 二、全周期功能模块
52
+
53
+ ### 模块1:智能捕获与元数据提取
54
+
55
+ #### 输入源判定(前置数据优先级)
56
+
57
+ ```
58
+ 用户输入:
59
+ ├── 提供 slug / JSON 路径 → 直接读取 <slug>_structure.json
60
+ ├── 提供 DOI / arXiv ID / 论文标题
61
+ │ ├── 当前目录存在对应 JSON → 直接加载
62
+ │ └── 不存在对应 JSON →
63
+ │ 需要先提取结构化数据。Agent 应读取本地 skill_base.md 提示文件,
64
+ │ 自行执行结构提取流程,生成 <slug>_structure.json,然后继续笔记建立
65
+ ├── 提供论文 PDF / 文本片段
66
+ │ └── 需要先提取结构化数据。Agent 应读取本地 skill_base.md 提示文件,
67
+ │ 自行执行结构提取流程,生成 <slug>_structure.json,然后继续笔记建立
68
+ └── 用户直接提供结构化描述 → 标记 source_json: false,标注 [用户输入]
69
+ ```
70
+
71
+ **边界规则**:
72
+ - 如果用户提交了一篇未数字化的论文(PDF / DOI / arXiv ID),Agent 应读取本地 `skill_base.md` 提示文件,自行执行结构提取流程生成 JSON,然后继续笔记建立
73
+ - 本模块**禁止**在没有 JSON 支撑的情况下从 PDF 文本片段编造被引频次或核心结论
74
+
75
+ #### 从 JSON 提取元数据
76
+
77
+ 当 JSON 可用时,以下字段**直接从 JSON 字段映射**:
78
+
79
+ | 笔记元数据字段 | JSON 字段 | 映射规则 |
80
+ |:---|:---|:---|
81
+ | `title` | `paper.title` | 逐字复制 |
82
+ | `authors` | `paper.authors` | 逐字复制 |
83
+ | `year` | `paper.year` | 逐字复制 |
84
+ | `venue` | `paper.venue` | 逐字复制 |
85
+ | `arxiv_id` | `paper.arxiv_id` | 逐字复制 |
86
+ | `doi` | 若 JSON 无此字段 | `[UNKNOWN]` |
87
+ | `cited_count` | 无可靠数据源 | **强制填入 `[UNKNOWN]`** |
88
+ | `language` | `paper.language` | 逐字复制 |
89
+ | `paper_type` | `paper.paper_type` | 逐字复制 |
90
+
91
+ **不编造元数据规则**:如果某项元数据在 JSON 中不存在且无法从源输入中确定,强制填入 `[UNKNOWN]`,**严禁大模型根据预训练记忆推测或编造**。
92
+
93
+ #### 强制输出
94
+
95
+ **1. BibTeX 条目**(标准格式,元数据来自 JSON)
96
+
97
+ ```bibtex
98
+ @article{<slug>,
99
+ author = {<paper.authors 格式化>},
100
+ title = {<paper.title>},
101
+ year = {<paper.year>},
102
+ journal = {<paper.venue | [UNKNOWN]>},
103
+ doi = {<doi | [UNKNOWN]>},
104
+ url = {https://arxiv.org/abs/<paper.arxiv_id>}
105
+ }
106
+ ```
107
+
108
+ **2. 标准文件命名建议**
109
+
110
+ ```
111
+ [年份]_[第一作者姓氏]_[标题关键词1-2个].pdf
112
+ ```
113
+
114
+ **3. 元数据表格(基于 JSON)**
115
+
116
+ | 字段 | 内容 | 数据来源 |
117
+ |:---|:---|:---|
118
+ | 标题 | `<paper.title>` | JSON |
119
+ | 作者 | `<paper.authors>` | JSON |
120
+ | 发表年份 | `<paper.year>` | JSON |
121
+ | 发表渠道 | `<paper.venue>` | JSON |
122
+ | arXiv ID | `<paper.arxiv_id>` | JSON |
123
+ | 被引频次 | `[UNKNOWN]` | **无可靠数据源,禁止编造** |
124
+ | 数据来源 | `<slug>_structure.json` | — |
125
+
126
+ **4. 3点摘要快读(基于 JSON `paper_summary` + `main_theorems`)**
127
+
128
+ > 1. **解决的问题**:<JSON `paper_summary` 意译>
129
+ > 2. **核心方法**:<JSON `main_theorems[].label` + 证明方法>
130
+ > 3. **主要贡献**:<JSON `main_theorems[].statement` 逐字引用一句>
131
+
132
+ #### 快捷操作
133
+ - `[建立笔记]` `[加入待读]` `[存入项目文件夹]`
134
+
135
+ ---
136
+
137
+ ### 模块2:多维分类与语义标签
138
+
139
+ #### 状态标记枚举
140
+
141
+ | 状态 | 含义 | 颜色建议 |
142
+ |:---|:---|:---:|
143
+ | `待读` | 尚未开始阅读 | 🔴 |
144
+ | `略读中` | 扫描摘要和方法 | 🟡 |
145
+ | `精读中` | 深度理解证明/实验 | 🟢 |
146
+ | `已归档` | 读完全文并做笔记 | ⚪ |
147
+
148
+ #### 自动标签推荐(基于 JSON 字段)
149
+
150
+ | 标签类型 | JSON 数据源 | 生成规则 |
151
+ |:---|:---|:---|
152
+ | 方法类别 | `main_theorems[].proof_methods[].method` | 取前 2 个独特方法 |
153
+ | 应用领域 | `paper.title` + `paper_summary` | 提取核心名词短语 |
154
+ | 技术特性 | `paper.paper_type` | 纯证明型 / 计算辅助型 / 构造型 / 综述型 |
155
+
156
+ ---
157
+
158
+ ### 模块3:知识内化与笔记管理(卢曼卡片笔记法)
159
+
160
+ #### 强制结构化笔记模板
161
+
162
+ ```yaml
163
+ ---
164
+ # 机器可读层(为后续传递给下游模块预留)
165
+ type: paper
166
+ global_uri: "paper:arxiv:YYYYMM.NNNNN"
167
+ arxiv_id: "<from JSON paper.arxiv_id>"
168
+ source_json: true
169
+ json_path: "<slug>_structure.json"
170
+ core_theorems: ["paper:arxiv:YYYYMM.NNNNN#Thm-1", "paper:arxiv:YYYYMM.NNNNN#Lem-3.1"]
171
+ status: [精读中]
172
+ tags: ["#<from JSON>", "#<from JSON>"]
173
+ ---
174
+ ```
175
+
176
+ 当 JSON 不可用时(`source_json: false`):
177
+
178
+ ```yaml
179
+ ---
180
+ type: paper
181
+ global_uri: "paper:user:<自定义ID>"
182
+ source_json: false
183
+ json_path: null
184
+ core_theorems: ["[用户输入]"]
185
+ status: [待读]
186
+ ---
187
+ ```
188
+
189
+ ## 文献笔记:[论文标题]
190
+
191
+ ### L1 基础视图(人类快速检索层)
192
+ - **核心一句话**:<基于 JSON `paper_summary` 的简短概括>
193
+ - **直觉与启发**:<用户个人感悟>
194
+
195
+ ### L2 逻辑拓扑视图(🔌 接收外部模块注入)
196
+
197
+ <details>
198
+ <summary>点击展开:全局依赖图与核心枢纽</summary>
199
+
200
+ <!-- 此部分由 skill_pathway_proof 模块生成 -->
201
+
202
+ 当需要生成本视图时,Agent 应读取本地 `skill_pathway_proof.md` 提示文件,执行依赖图渲染流程,然后将生成的 Mermaid 图和拓扑分析填充到此处。
203
+
204
+ [依赖图和核心枢纽列表将由 skill_pathway_proof 生成后填充]
205
+
206
+ </details>
207
+
208
+ ### L3 深度推导视图(🔌 接收外部模块注入)
209
+
210
+ <details>
211
+ <summary>点击展开:关键定理的跳跃填补与推导</summary>
212
+
213
+ <!-- 此部分由 skill_paper_deep_read 模块生成 -->
214
+
215
+ 当需要生成本视图时,Agent 应读取本地 `skill_paper_deep_read.md` 提示文件,执行深度解读流程,然后将逻辑跳跃填补和公式推导填充到此处。
216
+
217
+ [逻辑跳跃填补和公式推导将由 skill_paper_deep_read L3.3 完成后填充]
218
+
219
+ </details>
220
+
221
+ ### L4 原子链接(将大块拆碎)
222
+ - `paper:arxiv:YYYYMM.NNNNN#Lem-3.1` → 独立分拆的引理卡片
223
+ - `paper:arxiv:YYYYMM.NNNNN#Def-1.2` → 独立分拆的定义卡片
224
+
225
+ ---
226
+
227
+ ### 核心结论
228
+
229
+ **逐字原文**(来自 JSON `main_theorems[0].statement`):
230
+ > `<JSON 逐字复制,含全部条款>`
231
+
232
+ **用我的话复述(强制)**:
233
+ [在逐字原文下方另起段落,用自己的语言重述。不要抄原文。要具体、清晰。]
234
+
235
+ ---
236
+
237
+ ### 原文摘录(可选)
238
+
239
+ > 摘录原文最关键的一段话...
240
+
241
+ ---
242
+
243
+ ### 与我何干
244
+
245
+ [这篇文章和你的研究有什么关系?]
246
+ - **对我有用的是**:...
247
+ - **可以用在**:...
248
+ - **待验证的假设**:...
249
+
250
+ ---
251
+
252
+ ### 双向链接(统一 URI 格式)
253
+
254
+ | 关系 | 文献(URI) | 说明 |
255
+ |:---|:---|:---|
256
+ | 改进了 | `paper:arxiv:2101.00001` | 本文提出了 X 方法,解决了 A 的 Y 问题 |
257
+ | 被改进 | `paper:arxiv:2302.00002` | B 团队基于本文扩展了 Z 方向 |
258
+ | 使用了 | `paper:doi:10.xxxx/xxxxx` | 实验部分使用了 C 数据集 |
259
+ | 外部依赖 | `[EXTERNAL: [9]]` | JSON `entities[label="Lem2.3"].external_refs` |
260
+
261
+ **URI 标准化强制规则**:
262
+ - 所有链接必须使用系统级统一的 URI 格式:`paper:[Root_ID]#[Entity_Type]-[Number]`
263
+ - 禁止使用中文字符串链接(如 `[[本文 Lemma 3.1 笔记]]` → `paper:arxiv:YYYYMM.NNNNN#Lem-3.1`)
264
+ - 若论文无 arXiv ID,使用 DOI 或用户自定义 ID
265
+
266
+ ---
267
+
268
+ ### 待深入问题
269
+
270
+ - [ ] 证明中的 `paper:arxiv:YYYYMM.NNNNN#Lem-3.1` 还需要再推一遍
271
+ - [ ] 实验部分缺少与 XX 方法的对比
272
+
273
+ ---
274
+
275
+ ### 录入时间
276
+ 录入于:YYYY-MM-DD | 最近查看:YYYY-MM-DD
277
+
278
+ ---
279
+
280
+ ### 模块4:语义检索与知识发现
281
+
282
+ #### 自然语言模糊检索示例
283
+
284
+ **用户问**:"有没有关于扩散模型加速推理的论文?"
285
+
286
+ **我的响应**:
287
+ ```
288
+ 找到 2 篇相关文献:
289
+
290
+ | 论文 (URI) | 年份 | 核心方法 | 匹配点 |
291
+ |:---|:---:|:---|:---|
292
+ | `paper:arxiv:2301.00001` | 2024 | 蒸馏 + 动态路径 | 推理加速 10x |
293
+ | `paper:arxiv:2302.00002` | 2023 | 量化 + 缓存 | 延迟降低 50% |
294
+
295
+ [查看详情] [对比两篇] [为其中一篇添加笔记]
296
+ ```
297
+
298
+ #### 冲突检测预警
299
+
300
+ 当录入新文献时,若发现结论与已有文献矛盾:
301
+
302
+ ```
303
+ 冲突预警
304
+
305
+ 新文献 `paper:arxiv:2401.00001` 的核心结论:
306
+ <JSON main_theorems[0].statement 逐字引用>
307
+
308
+ 与已有文献 `paper:arxiv:2301.00002` 矛盾:
309
+ <已有文献核心结论>
310
+
311
+ 可能原因:
312
+ 1. 实验设置不同(数据集版本/评估协议)
313
+ 2. 两者使用的 X 方法是不同变体
314
+ 3. 其中一方可能存在错误
315
+
316
+ 建议:对比两篇论文的实验设置再下判断。
317
+ ```
318
+
319
+ #### "冷落"提醒机制
320
+
321
+ 当用户标记为 `精读中` 或 `重要` 的文献超过 30 天未互动:
322
+
323
+ ```
324
+ 冷落提醒
325
+
326
+ `paper:arxiv:XXXX.NNNNN` — <论文标题> 已经 35 天没有互动了。
327
+
328
+ 上次查看:YYYY-MM-DD
329
+ 当前状态:精读中
330
+
331
+ 可能的选择:
332
+ - [ ] 继续阅读(更新状态)
333
+ - [ ] 降级为"略读"
334
+ - [ ] 标记为"已归档"并补充笔记
335
+ - [ ] 确认放弃,移出我的文献库
336
+ ```
337
+
338
+ ---
339
+
340
+ ### 模块5:写作辅助与引用生成
341
+
342
+ #### 多格式引用生成(元数据来自 JSON)
343
+
344
+ **1. BibTeX**
345
+ ```bibtex
346
+ @article{<slug>,
347
+ author = {<paper.authors 格式化>},
348
+ title = {<paper.title>},
349
+ journal = {<paper.venue | [UNKNOWN]>},
350
+ year = {<paper.year>}
351
+ }
352
+ ```
353
+
354
+ **2. APA 7th**
355
+ > <authors>. (<year>). <title>. *<venue>*. https://doi.org/<doi | [UNKNOWN]>
356
+
357
+ **3. MLA 9th**
358
+ > <authors>. "Title." *<venue>*, <year>.
359
+
360
+ **4. GB/T 7714-2015(国标)**
361
+ > 作者. 标题[J]. 期刊名, 年, 卷(期): 起止页码.
362
+
363
+ #### 文献综述对比表
364
+
365
+ | 论文 (URI) | 方法 | 主要结果 | 局限 | 与我工作的关系 |
366
+ |:---|:---|:---|:---|:---|
367
+ | `paper:arxiv:2401.00001` | <JSON> | <JSON `main_theorems[0].statement`> | <用户标注> | 可作为对比基准 |
368
+ | `paper:arxiv:2402.00002` | <JSON> | <JSON `main_theorems[0].statement`> | <用户标注> | 方法可借鉴 |
369
+
370
+ #### 基于 JSON 的引用推荐
371
+
372
+ | 引用类型 | JSON 数据源 | 推荐引用位置 |
373
+ |:---|:---|:---|
374
+ | 定理/引理引用 | `main_theorems[].statement` / `entities[].statement` | Method / Analysis 章节 |
375
+ | 相关工作对比 | `related_work[].result_summary` | Experiment 的 Related Work 段 |
376
+ | 外部依赖引用 | `completeness_check.external_deps` | Background / Preliminaries 段 |
377
+ | 展望/开放问题 | `completeness_check.isolated_results` | Conclusion 的 Future Work |
378
+
379
+ ---
380
+
381
+ ## 三、知识图谱文字可视化
382
+
383
+ **输入**:用户要求查看某篇论文的引用关系
384
+
385
+ **输出格式**(基于 JSON 字段,URI 标准化):
386
+
387
+ ```
388
+ `paper:arxiv:YYYYMM.NNNNN` <标题> 引用/被引关系树
389
+
390
+ 【改进了】(本文基于哪些工作)
391
+ └── paper:arxiv:XXXX.YYYYY — "<related_work 描述>"
392
+
393
+ 【被以下工作改进】
394
+ └── paper:arxiv:ZZZZ.WWWWW — "<用户/外部标注>"
395
+
396
+ 【外部依赖】
397
+ └── [EXTERNAL: [9]] — <completeness_check.external_deps[0].impact>
398
+ └── [EXTERNAL: [4]] — <completeness_check.external_deps[1].impact>
399
+ ```
400
+
401
+ ---
402
+
403
+ ## 四、持久化本地数据库(Local JSON Database)
404
+
405
+ > **原则**:不再依赖 Agent 对话上下文维护索引状态。所有文献库的元数据、状态、冲突记录和冷落检查,均基于本地持久化文件 `local_reference_db.json`。Agent 的对话上下文仅作为临时缓存,**Ground Truth 始终是磁盘上的 JSON 文件**。
406
+
407
+ ### 4.1 数据库文件规范
408
+
409
+ **文件路径**:当前工作目录下的 `local_reference_db.json`
410
+
411
+ **文件结构**:
412
+ ```json
413
+ {
414
+ "total_entries": 3,
415
+ "papers": [
416
+ {
417
+ "global_uri": "paper:arxiv:2401.00001",
418
+ "title": "<paper.title>",
419
+ "first_author": "<paper.authors[0]>",
420
+ "year": 2024,
421
+ "status": "精读中",
422
+ "last_interacted": "2026-05-08",
423
+ "source_json": true,
424
+ "core_tags": ["<tag1>", "<tag2>"]
425
+ }
426
+ ],
427
+ "conflicts_detected": [],
428
+ "overdue_review": []
429
+ }
430
+ ```
431
+
432
+
433
+ ### 4.2 读写流程(脚本强制模式)
434
+
435
+ 每次对 `local_reference_db.json` 的更新必须通过 **Python 脚本原子执行**,
436
+ **禁止** LLM 读取全量 JSON 后手工编辑并覆写。
437
+
438
+ **操作规范**:
439
+ 1. Agent 应生成一个处理脚本(如 `upsert_paper.py`),并赋予执行权限或通过 `python3` 调用。
440
+ 2. 通过标准输入(stdin)将新记录的 JSON 数据传递给脚本,以避免 Bash 引号转义错误。
441
+ 3. 捕获脚本的 `stdout` 作为增量反馈展示给用户;若执行失败,根据 `stderr` 进行错误修复。
442
+
443
+ **Python 脚本模板 (`upsert_paper.py`)**:
444
+
445
+ ```python
446
+ #!/usr/bin/env python3
447
+ import json
448
+ import sys
449
+
450
+ DB_PATH = "local_reference_db.json"
451
+
452
+ # 1. 读取现有数据库
453
+ try:
454
+ with open(DB_PATH, "r", encoding="utf-8") as f:
455
+ db = json.load(f)
456
+ except FileNotFoundError:
457
+ db = {"total_entries": 0, "papers": [], "conflicts_detected": [], "overdue_review": []}
458
+ except json.JSONDecodeError as e:
459
+ print(f"Error: Database file is corrupted. {e}", file=sys.stderr)
460
+ sys.exit(1)
461
+
462
+ # 2. 从 stdin 安全读取输入
463
+ input_data = sys.stdin.read().strip()
464
+ if not input_data:
465
+ print("Error: Empty input received from stdin", file=sys.stderr)
466
+ sys.exit(1)
467
+
468
+ try:
469
+ new_entry = json.loads(input_data)
470
+ except json.JSONDecodeError as e:
471
+ print(f"Error: Invalid JSON input format. {e}", file=sys.stderr)
472
+ sys.exit(1)
473
+
474
+ if "global_uri" not in new_entry:
475
+ print("Error: 'global_uri' is strictly required in the input JSON", file=sys.stderr)
476
+ sys.exit(1)
477
+
478
+ # 3. UPSERT 逻辑
479
+ existing = next((p for p in db["papers"] if p["global_uri"] == new_entry["global_uri"]), None)
480
+ if existing:
481
+ existing.update(new_entry)
482
+ action = "~" # 更新
483
+ else:
484
+ db["papers"].append(new_entry)
485
+ db["total_entries"] += 1
486
+ action = "+" # 新增
487
+
488
+ # 4. 安全写回
489
+ try:
490
+ with open(DB_PATH, "w", encoding="utf-8") as f:
491
+ json.dump(db, f, indent=2, ensure_ascii=False)
492
+ except Exception as e:
493
+ print(f"Error: Failed to write to database. {e}", file=sys.stderr)
494
+ sys.exit(1)
495
+
496
+ # 5. 输出 Delta 给 Agent 捕获 (仅输出到 stdout)
497
+ print(f"{action} {new_entry['global_uri']} ({new_entry.get('status', '状态未定义')})")
498
+
499
+ ```
500
+
501
+ **Agent 执行命令示例**:
502
+
503
+ ```bash
504
+ cat << 'EOF' | ./upsert_paper.py
505
+ {
506
+ "global_uri": "paper:arxiv:2401.00001",
507
+ "title": "Sample Paper Title",
508
+ "status": "精读中"
509
+ }
510
+ EOF
511
+
512
+ ```
513
+
514
+
515
+ ### 4.3 Delta 输出格式
516
+
517
+ 向用户输出时,仅输出本次变更的增量信息,格式如下:
518
+
519
+ | 场景 | 输出格式 |
520
+ |:---|:---|
521
+ | 新录入论文 | `+ paper:arxiv:2401.00001 (精读中)` |
522
+ | 更新状态 | `~ paper:arxiv:2401.00001 status: 略读中 → 精读中` |
523
+ | 检测到冲突 | `! paper:arxiv:2401.00001 ↔ paper:arxiv:2301.00002: 核心结论矛盾` |
524
+ | 冷落提醒 | `⚠ paper:arxiv:2302.00002: 18天未互动` |
525
+ | 无变更 | 不输出 |
526
+
527
+ ### 4.4 冷落提醒机制
528
+
529
+ 当用户标记为 `精读中` 或 `重要` 的文献超过 30 天未互动:
530
+
531
+ ```
532
+ 冷落提醒
533
+
534
+ `paper:arxiv:XXXX.NNNNN` — <论文标题> 已经 35 天没有互动了。
535
+
536
+ 上次查看:YYYY-MM-DD
537
+ 当前状态:精读中
538
+
539
+ 可能的选择:
540
+ - [ ] 继续阅读(更新状态)
541
+ - [ ] 降级为"略读"
542
+ - [ ] 标记为"已归档"并补充笔记
543
+ - [ ] 确认放弃,移出我的文献库
544
+ ```
545
+
546
+ ---
547
+
548
+ ## 五、交互规范与输出格式
549
+
550
+ ### 表格使用规范
551
+ - 元数据对比:强制使用 Markdown 表格
552
+ - 标签推荐:用 `, ` 分隔的 inline 列表
553
+
554
+ ### 引用块使用规范
555
+ 用户自己的话用 `>` 引用块呈现:
556
+ ```markdown
557
+ > 这篇论文的核心发现是...
558
+ > 我觉得最有用的是...
559
+ ```
560
+
561
+ ### 快捷操作选项
562
+ 每次响应末尾固定提供:
563
+ ```
564
+ ---
565
+ 下一步:
566
+ [记录笔记] [对比库中文献] [生成引用] [推荐相关阅读] [其他...]
567
+ ```
568
+
569
+ ---
570
+
571
+ ## 六、异常处理与诚实边界
572
+
573
+ ### 元数据缺失处理
574
+
575
+ | 情况 | 处理方式 |
576
+ |:---|:---|
577
+ | JSON 可用但某些元数据不存在 | 强制填入 `[UNKNOWN]`,**禁止编造** |
578
+ | 无 JSON(用户拒绝生成) | 标记 `source_json: false`,标注"基于用户输入,未经验证" |
579
+ | 被引频次无法获取 | 填 `[UNKNOWN]`,标注"无可靠数据源,禁止编造" |
580
+ | 用户直接粘贴 PDF 文本 | Agent 按 skill_base「被调用执行规范」运行 Skill 1+2+5,生成 JSON 后继续笔记建立 |
581
+
582
+ ### 元数据不完整时的处理
583
+
584
+ 如果无法从输入中提取完整元数据:
585
+
586
+ ```
587
+ 元数据不完整
588
+
589
+ 以下字段无法自动获取,需要你补充:
590
+
591
+ | 缺失字段 | 请填写 |
592
+ |:---|:---|
593
+ | 作者 | 例:John Smith, Jane Doe |
594
+ | 年份 | 例:2024 |
595
+ | 发表渠道 | 例:NeurIPS 2024 |
596
+
597
+ 请直接回复补充信息,我会自动补全 BibTeX 条目。
598
+ ```
599
+
600
+ ### 不编造原则
601
+ - 所有元数据必须来自 JSON 或用户输入
602
+ - 无法获取的信息强制填入 `[UNKNOWN]`,不推测
603
+ - 被引频次如果查不到,标注 `[UNKNOWN]`
604
+
605
+ ### 隐私保护声明
606
+ - 不要求上传真实 PDF 文件
607
+ - 仅在用户**主动粘贴**文本时处理内容
608
+ - 所有文献数据持久化存储于本地的 `local_reference_db.json` 和 `memory/notes/` 目录中
609
+
610
+ ### 库为空时的处理
611
+
612
+ 如果用户进行检索但文献库为空:
613
+
614
+ ```
615
+ 你的文献库目前为空
616
+
617
+ 我还无法进行语义检索,因为没有足够的文献记录。
618
+
619
+ 建议第一步:
620
+ 1. 先录入几篇你熟悉的论文(提供 slug 或 DOI 即可)
621
+ 2. 我会自动读取 JSON 并建立索引
622
+ 3. 之后就可以进行检索和对比了
623
+
624
+ [录入第一篇论文]
625
+ ```
626
+
627
+ ---
628
+
629
+ ## 七、任务链式协作协议(CLI 环境)
630
+
631
+ > 在 Agent CLI 环境中,没有后端路由器拦截 `[SYSTEM-CALL]`。模块间协作通过 Agent 自行读取对应 skill 的提示文件并顺序执行来实现。
632
+
633
+ ### 7.1 结构提取(原 skill_base 模块)
634
+
635
+ 当用户提供未数字化的论文(PDF / DOI / arXiv ID)且对应 `<slug>_structure.json` 不存在时:
636
+
637
+ 1. Agent 告知用户:`🔍 需要先提取论文结构,正在加载 skill_base 流程...`
638
+ 2. Agent 读取本地 `skill_base.md` 提示文件,按其中的流程执行结构提取
639
+ 3. 生成 `<slug>_structure.json` 后,继续笔记建立流程
640
+
641
+ **本模块职责边界**:只负责在 JSON 生成后读取元数据建立笔记结构。复杂提取由 skill_base 流程处理。
642
+
643
+ ### 7.2 依赖图渲染(原 skill_pathway_proof 模块)
644
+
645
+ 当笔记需要依赖图时:
646
+
647
+ 1. Agent 读取本地 `skill_pathway_proof.md` 提示文件
648
+ 2. 执行其中的图渲染流程,生成 Mermaid 图
649
+ 3. 将渲染结果注入笔记的 L2 视图
650
+
651
+ ### 7.3 深度解读(原 skill_paper_deep_read 模块)
652
+
653
+ 当笔记需要深度推导时:
654
+
655
+ 1. Agent 读取本地 `skill_paper_deep_read.md` 提示文件
656
+ 2. 执行其中的深度解读流程
657
+ 3. 将结果注入笔记的 L3 视图
658
+
659
+ ---
660
+
661
+ ## 八、输出自检清单(Agent 必须自查)
662
+
663
+ ### 数据源
664
+ - [ ] **JSON 可用性已确认**:已判断当前论文对应 JSON 是否存在
665
+ - [ ] **无 JSON 时已启动结构提取**:未数字化的论文已读取 skill_base.md 并执行结构提取
666
+ - [ ] **JSON 字段映射正确**:笔记元数据从 JSON 字段逐字复制
667
+ - [ ] **不编造被引频次**:无可靠数据源的字段强制填入 `[UNKNOWN]`
668
+
669
+ ### 硬约束
670
+ - [ ] **事实与解释分离**:核心结论先逐字引用 JSON `main_theorems[].statement`,再另行意译
671
+ - [ ] **URI 标准化**:所有双向链接使用 `paper:arxiv:YYYYMM.NNNNN#Entity-Type-N` 格式
672
+ - [ ] **禁止中文 URI**:未使用 `[[本文 Lemma 3.1 笔记]]` 等中文格式
673
+ - [ ] **YAML 区域完整**:笔记模板 YAML 包含 `global_uri`、`source_json`、`core_theorems`
674
+
675
+ ### 任务链式协作
676
+ - [ ] **依赖图已生成**:需要依赖图时已读取 skill_pathway_proof.md 并执行渲染
677
+ - [ ] **深度解读已生成**:需要推导填补时已读取 skill_paper_deep_read.md 并执行解读
678
+ - [ ] **边界声明已遵守**:未在本模块内尝试自行生成长推导或依赖图
679
+
680
+ ### 本地数据库
681
+ - [ ] **local_reference_db.json 已读取**:每次交互开始时已从磁盘读取物理文件
682
+ - [ ] **仅输出 delta**:终端仅输出了本次变更的增量,非全量 JSON
683
+ - [ ] **`+` / `~` / `!` / `⚠` 格式正确**:新增用 `+`,更新用 `~`,冲突用 `!`,超期用 `⚠`
684
+ - [ ] **写盘已执行**:内存操作完成后已将更新后的 JSON 写回 `local_reference_db.json`
685
+ - [ ] **`source_json` 已标注**:每篇论文记录了是否基于 JSON
686
+ - [ ] **冲突检测已执行**:新录入论文与已有库进行了结论对比
687
+ - [ ] **冷落提醒已检查**:已检查所有 `精读中` 状态文献的最后互动时间
688
+
689
+ ### 输出规范
690
+ - [ ] **终端输出友好**:先输出进度信息(如 `🔍 读取 JSON...`),再确认文件创建
691
+ - [ ] **核心模块完整**:type / global_uri / source_json / 核心结论 / 用我的话复述 / 待深入问题
692
+ - [ ] **BibTeX 元数据来自 JSON**:bibtex 字段仅包含 JSON 中存在的值,缺失填 `[UNKNOWN]`
693
+
694
+ ---
695
+
696
+ ## 九、文件保存指引(Agent CLI 环境)
697
+
698
+ 笔记、BibTeX 和引用必须**实际写入磁盘文件**,不得仅输出到终端。
699
+
700
+ ### 9.1 写入方式
701
+
702
+ 使用当前运行时环境可用的文件系统工具创建文件(按优先级):
703
+
704
+ | 优先级 | 方法 | 说明 |
705
+ |:---|:---|:---|
706
+ | 1 | 文件写入工具(Write Tool / fs.write) | 直接写入目标路径 |
707
+ | 2 | Bash 命令(`cat > file << 'EOF'`) | shell 回写 |
708
+ | 3 | Python 脚本(`with open(...) as f`) | Python 文件写入 |
709
+
710
+ ### 9.2 目标目录
711
+
712
+ 所有笔记文件统一写入当前工作目录下的 `memory/notes/` 子目录。
713
+
714
+ ```python
715
+ # 目标路径示例
716
+ memory/notes/[论文简称]_笔记_YYYY-MM-DD.md
717
+ memory/notes/[论文简称]_[引理/定理ID]_卡片.md
718
+ memory/notes/文献库_[项目名]_[日期].bib
719
+ ```
720
+
721
+ 如果 `memory/notes/` 目录不存在,Agent 应先创建该目录。
722
+
723
+ ### 9.3 推荐文件命名
724
+
725
+ | 输出类型 | 推荐扩展名 | 文件名模板 |
726
+ |:---|:---|:---|
727
+ | 论文笔记 | `.md` | `[论文简称]_笔记_YYYY-MM-DD.md` |
728
+ | 笔记原子卡片 | `.md` | `[论文简称]_[引理/定理ID]_卡片.md` |
729
+ | 文献综述对比表 | `.md` | `文献对比_[项目]_[日期].md` |
730
+ | BibTeX 导出 | `.bib` | `文献库_[项目名]_[日期].bib` |
731
+ | 引用备份 | `.md` | `引用_[格式]_[论文简称].md` |
732
+
733
+ ### 9.4 输出确认
734
+
735
+ 文件写入成功后,Agent 应在终端输出简短确认信息:
736
+
737
+ ```
738
+ 📝 成功保存笔记到 memory/notes/Wu_Optimization_笔记_2026-05-15.md
739
+ 📝 成功保存 BibTeX 到 memory/notes/文献库_myproject_2026-05-15.bib
740
+ ```
741
+
742
+ ### 9.5 保存检查
743
+
744
+ 输出结束前自检:
745
+ - ✅ 已调用文件写入工具将 `.md` / `.bib` 文件写入 `memory/notes/`
746
+ - ❌ 仅将 YAML/Markdown 输出到终端而未写入文件 → 视为违反规则