lifeos 1.0.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.
Files changed (216) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +202 -0
  3. package/README.md +202 -0
  4. package/assets/lifeos-rules.en.md +162 -0
  5. package/assets/lifeos-rules.zh.md +162 -0
  6. package/assets/lifeos.yaml +56 -0
  7. package/assets/prompts/AI_LLMResearch_Prompt.en.md +120 -0
  8. package/assets/prompts/AI_LLMResearch_Prompt.zh.md +120 -0
  9. package/assets/prompts/Art_ChinesePainting_Prompt.en.md +147 -0
  10. package/assets/prompts/Art_ChinesePainting_Prompt.zh.md +148 -0
  11. package/assets/prompts/Cryptography_Prompt.en.md +148 -0
  12. package/assets/prompts/Cryptography_Prompt.zh.md +147 -0
  13. package/assets/prompts/History_ChineseCulture_Prompt.en.md +98 -0
  14. package/assets/prompts/History_ChineseCulture_Prompt.zh.md +98 -0
  15. package/assets/prompts/Math_HigherMathematics_Prompt.en.md +117 -0
  16. package/assets/prompts/Math_HigherMathematics_Prompt.zh.md +116 -0
  17. package/assets/schema/Frontmatter_Schema.md +139 -0
  18. package/assets/skills/_shared/completion-report.en.md +30 -0
  19. package/assets/skills/_shared/completion-report.zh.md +30 -0
  20. package/assets/skills/_shared/dual-agent-orchestrator.en.md +40 -0
  21. package/assets/skills/_shared/dual-agent-orchestrator.zh.md +40 -0
  22. package/assets/skills/_shared/learning-lifecycle.en.md +53 -0
  23. package/assets/skills/_shared/learning-lifecycle.zh.md +53 -0
  24. package/assets/skills/_shared/lifecycle.en.md +84 -0
  25. package/assets/skills/_shared/lifecycle.zh.md +84 -0
  26. package/assets/skills/_shared/memory-protocol.en.md +36 -0
  27. package/assets/skills/_shared/memory-protocol.zh.md +36 -0
  28. package/assets/skills/_shared/template-loading.en.md +26 -0
  29. package/assets/skills/_shared/template-loading.zh.md +26 -0
  30. package/assets/skills/archive/SKILL.en.md +300 -0
  31. package/assets/skills/archive/SKILL.zh.md +300 -0
  32. package/assets/skills/ask/SKILL.en.md +164 -0
  33. package/assets/skills/ask/SKILL.zh.md +164 -0
  34. package/assets/skills/brainstorm/SKILL.en.md +242 -0
  35. package/assets/skills/brainstorm/SKILL.zh.md +242 -0
  36. package/assets/skills/brainstorm/references/action-options.en.md +65 -0
  37. package/assets/skills/brainstorm/references/action-options.zh.md +65 -0
  38. package/assets/skills/knowledge/SKILL.en.md +202 -0
  39. package/assets/skills/knowledge/SKILL.zh.md +202 -0
  40. package/assets/skills/project/SKILL.en.md +133 -0
  41. package/assets/skills/project/SKILL.zh.md +133 -0
  42. package/assets/skills/project/references/execution-agent-prompt.en.md +148 -0
  43. package/assets/skills/project/references/execution-agent-prompt.zh.md +148 -0
  44. package/assets/skills/project/references/planning-agent-prompt.en.md +162 -0
  45. package/assets/skills/project/references/planning-agent-prompt.zh.md +162 -0
  46. package/assets/skills/read-pdf/SKILL.en.md +199 -0
  47. package/assets/skills/read-pdf/SKILL.zh.md +199 -0
  48. package/assets/skills/read-pdf/scripts/read_pdf.py +354 -0
  49. package/assets/skills/research/SKILL.en.md +107 -0
  50. package/assets/skills/research/SKILL.zh.md +107 -0
  51. package/assets/skills/research/references/execution-agent-prompt.en.md +166 -0
  52. package/assets/skills/research/references/execution-agent-prompt.zh.md +166 -0
  53. package/assets/skills/research/references/planning-agent-prompt.en.md +129 -0
  54. package/assets/skills/research/references/planning-agent-prompt.zh.md +129 -0
  55. package/assets/skills/revise/SKILL.en.md +258 -0
  56. package/assets/skills/revise/SKILL.zh.md +258 -0
  57. package/assets/skills/revise/references/grading-protocol.en.md +99 -0
  58. package/assets/skills/revise/references/grading-protocol.zh.md +99 -0
  59. package/assets/skills/today/SKILL.en.md +211 -0
  60. package/assets/skills/today/SKILL.zh.md +211 -0
  61. package/assets/templates/en/Daily_Template.md +25 -0
  62. package/assets/templates/en/Draft_Template.md +29 -0
  63. package/assets/templates/en/Knowledge_Template.md +86 -0
  64. package/assets/templates/en/Project_Template.md +110 -0
  65. package/assets/templates/en/Research_Template.md +46 -0
  66. package/assets/templates/en/Retrospective_Template.md +89 -0
  67. package/assets/templates/en/Revise_Template.md +24 -0
  68. package/assets/templates/en/Wiki_Template.md +35 -0
  69. package/assets/templates/zh/Daily_Template.md +26 -0
  70. package/assets/templates/zh/Draft_Template.md +29 -0
  71. package/assets/templates/zh/Knowledge_Template.md +86 -0
  72. package/assets/templates/zh/Project_Template.md +110 -0
  73. package/assets/templates/zh/Research_Template.md +46 -0
  74. package/assets/templates/zh/Retrospective_Template.md +89 -0
  75. package/assets/templates/zh/Revise_Template.md +24 -0
  76. package/assets/templates/zh/Wiki_Template.md +35 -0
  77. package/bin/lifeos.js +24 -0
  78. package/dist/active-docs/citations.d.ts +20 -0
  79. package/dist/active-docs/citations.js +74 -0
  80. package/dist/active-docs/citations.js.map +1 -0
  81. package/dist/active-docs/derived-memory.d.ts +57 -0
  82. package/dist/active-docs/derived-memory.js +161 -0
  83. package/dist/active-docs/derived-memory.js.map +1 -0
  84. package/dist/active-docs/index.d.ts +51 -0
  85. package/dist/active-docs/index.js +165 -0
  86. package/dist/active-docs/index.js.map +1 -0
  87. package/dist/active-docs/long-term-profile.d.ts +24 -0
  88. package/dist/active-docs/long-term-profile.js +75 -0
  89. package/dist/active-docs/long-term-profile.js.map +1 -0
  90. package/dist/active-docs/taskboard.d.ts +12 -0
  91. package/dist/active-docs/taskboard.js +146 -0
  92. package/dist/active-docs/taskboard.js.map +1 -0
  93. package/dist/active-docs/userprofile.d.ts +12 -0
  94. package/dist/active-docs/userprofile.js +169 -0
  95. package/dist/active-docs/userprofile.js.map +1 -0
  96. package/dist/cli/commands/doctor.d.ts +9 -0
  97. package/dist/cli/commands/doctor.js +125 -0
  98. package/dist/cli/commands/doctor.js.map +1 -0
  99. package/dist/cli/commands/init.d.ts +1 -0
  100. package/dist/cli/commands/init.js +129 -0
  101. package/dist/cli/commands/init.js.map +1 -0
  102. package/dist/cli/commands/rename.d.ts +7 -0
  103. package/dist/cli/commands/rename.js +188 -0
  104. package/dist/cli/commands/rename.js.map +1 -0
  105. package/dist/cli/commands/upgrade.d.ts +6 -0
  106. package/dist/cli/commands/upgrade.js +66 -0
  107. package/dist/cli/commands/upgrade.js.map +1 -0
  108. package/dist/cli/index.d.ts +1 -0
  109. package/dist/cli/index.js +52 -0
  110. package/dist/cli/index.js.map +1 -0
  111. package/dist/cli/utils/assets.d.ts +3 -0
  112. package/dist/cli/utils/assets.js +20 -0
  113. package/dist/cli/utils/assets.js.map +1 -0
  114. package/dist/cli/utils/install-assets.d.ts +39 -0
  115. package/dist/cli/utils/install-assets.js +141 -0
  116. package/dist/cli/utils/install-assets.js.map +1 -0
  117. package/dist/cli/utils/lang.d.ts +1 -0
  118. package/dist/cli/utils/lang.js +32 -0
  119. package/dist/cli/utils/lang.js.map +1 -0
  120. package/dist/cli/utils/managed-assets.d.ts +9 -0
  121. package/dist/cli/utils/managed-assets.js +20 -0
  122. package/dist/cli/utils/managed-assets.js.map +1 -0
  123. package/dist/cli/utils/mcp-register.d.ts +2 -0
  124. package/dist/cli/utils/mcp-register.js +132 -0
  125. package/dist/cli/utils/mcp-register.js.map +1 -0
  126. package/dist/cli/utils/sync-vault.d.ts +14 -0
  127. package/dist/cli/utils/sync-vault.js +132 -0
  128. package/dist/cli/utils/sync-vault.js.map +1 -0
  129. package/dist/cli/utils/ui.d.ts +14 -0
  130. package/dist/cli/utils/ui.js +78 -0
  131. package/dist/cli/utils/ui.js.map +1 -0
  132. package/dist/cli/utils/version.d.ts +1 -0
  133. package/dist/cli/utils/version.js +4 -0
  134. package/dist/cli/utils/version.js.map +1 -0
  135. package/dist/config.d.ts +127 -0
  136. package/dist/config.js +356 -0
  137. package/dist/config.js.map +1 -0
  138. package/dist/core.d.ts +106 -0
  139. package/dist/core.js +286 -0
  140. package/dist/core.js.map +1 -0
  141. package/dist/db/consolidation.d.ts +14 -0
  142. package/dist/db/consolidation.js +28 -0
  143. package/dist/db/consolidation.js.map +1 -0
  144. package/dist/db/index.d.ts +22 -0
  145. package/dist/db/index.js +39 -0
  146. package/dist/db/index.js.map +1 -0
  147. package/dist/db/schema.d.ts +7 -0
  148. package/dist/db/schema.js +175 -0
  149. package/dist/db/schema.js.map +1 -0
  150. package/dist/index.d.ts +3 -0
  151. package/dist/index.js +5 -0
  152. package/dist/index.js.map +1 -0
  153. package/dist/server.d.ts +6 -0
  154. package/dist/server.js +303 -0
  155. package/dist/server.js.map +1 -0
  156. package/dist/services/capture.d.ts +101 -0
  157. package/dist/services/capture.js +297 -0
  158. package/dist/services/capture.js.map +1 -0
  159. package/dist/services/enhance.d.ts +51 -0
  160. package/dist/services/enhance.js +184 -0
  161. package/dist/services/enhance.js.map +1 -0
  162. package/dist/services/layer0.d.ts +24 -0
  163. package/dist/services/layer0.js +90 -0
  164. package/dist/services/layer0.js.map +1 -0
  165. package/dist/services/maintenance.d.ts +27 -0
  166. package/dist/services/maintenance.js +73 -0
  167. package/dist/services/maintenance.js.map +1 -0
  168. package/dist/services/retrieval.d.ts +120 -0
  169. package/dist/services/retrieval.js +571 -0
  170. package/dist/services/retrieval.js.map +1 -0
  171. package/dist/services/startup.d.ts +28 -0
  172. package/dist/services/startup.js +112 -0
  173. package/dist/services/startup.js.map +1 -0
  174. package/dist/skill-context/ask-global.d.ts +8 -0
  175. package/dist/skill-context/ask-global.js +21 -0
  176. package/dist/skill-context/ask-global.js.map +1 -0
  177. package/dist/skill-context/base.d.ts +48 -0
  178. package/dist/skill-context/base.js +5 -0
  179. package/dist/skill-context/base.js.map +1 -0
  180. package/dist/skill-context/daily-global.d.ts +8 -0
  181. package/dist/skill-context/daily-global.js +25 -0
  182. package/dist/skill-context/daily-global.js.map +1 -0
  183. package/dist/skill-context/index.d.ts +32 -0
  184. package/dist/skill-context/index.js +171 -0
  185. package/dist/skill-context/index.js.map +1 -0
  186. package/dist/skill-context/knowledge-strict.d.ts +8 -0
  187. package/dist/skill-context/knowledge-strict.js +26 -0
  188. package/dist/skill-context/knowledge-strict.js.map +1 -0
  189. package/dist/skill-context/review-strict.d.ts +8 -0
  190. package/dist/skill-context/review-strict.js +26 -0
  191. package/dist/skill-context/review-strict.js.map +1 -0
  192. package/dist/skill-context/revise-strict.d.ts +8 -0
  193. package/dist/skill-context/revise-strict.js +26 -0
  194. package/dist/skill-context/revise-strict.js.map +1 -0
  195. package/dist/skill-context/seed-profiles.d.ts +21 -0
  196. package/dist/skill-context/seed-profiles.js +80 -0
  197. package/dist/skill-context/seed-profiles.js.map +1 -0
  198. package/dist/types.d.ts +165 -0
  199. package/dist/types.js +76 -0
  200. package/dist/types.js.map +1 -0
  201. package/dist/utils/context-policy.d.ts +57 -0
  202. package/dist/utils/context-policy.js +333 -0
  203. package/dist/utils/context-policy.js.map +1 -0
  204. package/dist/utils/scan-state.d.ts +41 -0
  205. package/dist/utils/scan-state.js +79 -0
  206. package/dist/utils/scan-state.js.map +1 -0
  207. package/dist/utils/segmenter.d.ts +19 -0
  208. package/dist/utils/segmenter.js +75 -0
  209. package/dist/utils/segmenter.js.map +1 -0
  210. package/dist/utils/shared.d.ts +103 -0
  211. package/dist/utils/shared.js +313 -0
  212. package/dist/utils/shared.js.map +1 -0
  213. package/dist/utils/vault-indexer.d.ts +53 -0
  214. package/dist/utils/vault-indexer.js +256 -0
  215. package/dist/utils/vault-indexer.js.map +1 -0
  216. package/package.json +59 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luneth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,202 @@
1
+ # LifeOS
2
+
3
+ [中文](./README.md) | English
4
+
5
+ LifeOS helps you grow scattered ideas into structured knowledge and truly master it, from quick captures, to brainstorming and deep research, to systematic project planning and knowledge notes, to spaced review and mastery tracking. The goal is not just building a knowledge base, but helping you understand, internalize, and command complex knowledge.
6
+
7
+ ## Core Features
8
+
9
+ ### Memory System
10
+
11
+ > The memory system is LifeOS's core capability. It works in a directory-scoped, skill-bound way, continuously preserving the context, preferences, and decisions that emerge during learning so long-term learning becomes more continuous, more traceable, and easier to build on.
12
+
13
+ #### Cross-session continuity
14
+
15
+ Session bridges and active-document context persist, so agents do not depend only on the current conversation.
16
+
17
+ #### Project-scoped and skill-bound
18
+
19
+ The memory system runs around the current LifeOS project in the vault, activates only inside workflows such as `today`, `project`, `research`, `knowledge`, `revise`, and `archive`, and keeps accumulating preferences, decisions, and context.
20
+
21
+ #### More controllable than global memory
22
+
23
+ Compared with a memory model that mixes cross-directory content and global conversations together, a project-scoped, skill-bound memory system reduces irrelevant noise and keeps retrieval and follow-up decisions closer to the current LifeOS workflow.
24
+
25
+ ### Directory Customization
26
+
27
+ LifeOS does not lock you into fixed directory names. Run `lifeos rename [path]` and the CLI will interactively list the directories that can be adjusted in the current vault, then guide you through choosing one and entering a new name.
28
+
29
+ It updates `lifeos.yaml`, renames the actual directory, and batch-replaces all related wikilinks across the vault. That lets you adapt directory names to your own workflow, language preference, and project structure while keeping configuration and links consistent.
30
+
31
+ ### Learning Workflows
32
+
33
+ LifeOS provides a set of Agent skills designed around the learning process, connecting "input -> understanding -> output -> reinforcement" into a continuous workflow:
34
+
35
+ - `/today`, `/brainstorm`, `/ask`: organize the day's focus, clarify questions, and quickly expand ideas
36
+ - `/project`, `/research`, `/knowledge`: turn a topic into a project, a research report, and structured knowledge notes
37
+ - `/read-pdf`, `/revise`, `/archive`: move from source extraction, to review and reinforcement, to periodic archiving
38
+
39
+ ## Core Components
40
+
41
+ - **Memory system** — Project-scoped and skill-bound, providing vault indexing, session memory, and context assembly for AI agents
42
+ - **CLI scaffold** — install globally, then use `lifeos init` to bootstrap a complete workspace
43
+ - **Skill system** — 9 Agent skills covering diary, projects, research, knowledge curation, review, and more
44
+ - **Templates + Schema** — 8 structured templates + Frontmatter schema for consistent notes
45
+
46
+ ## Quick Start
47
+
48
+ At the moment, only the Agent CLI workflow has been verified in practice on macOS. The Agent GUI path has not been systematically tested yet, and Windows has not been verified either, so the experience there may not be fully consistent yet.
49
+
50
+ ### Prerequisites
51
+
52
+ Before starting, make sure Obsidian and at least one of Claude Code CLI / Codex CLI / OpenCode CLI are installed locally.
53
+
54
+ | Dependency | Required | Purpose |
55
+ |---|---|---|
56
+ | **Node.js 18+** | Required | Runtime for MCP server and CLI |
57
+ | **Git** | Required | Version control for vault data, including the memory DB |
58
+ | **Python 3** | Required | PDF extraction (`/read-pdf` skill) |
59
+
60
+ `lifeos init` checks all prerequisites before creating the workspace.
61
+
62
+ ### Installation and Initialization
63
+
64
+ ```bash
65
+ # Step 1: install the CLI globally
66
+ npm install -g lifeos
67
+
68
+ # Step 2: create a new LifeOS workspace (auto-detects language from system locale)
69
+ lifeos init ./my-vault
70
+
71
+ # Or specify language explicitly
72
+ lifeos init ./my-vault --lang zh # Chinese
73
+ lifeos init ./my-vault --lang en # English
74
+ ```
75
+
76
+ After init, MCP server configs are automatically registered for:
77
+
78
+ | Tool | Config file |
79
+ |---|---|
80
+ | **Claude Code** | `.mcp.json` |
81
+ | **Codex** | `.codex/config.toml` |
82
+ | **OpenCode** | `opencode.json` |
83
+
84
+ Launch any of these tools in the vault directory to use all skills.
85
+
86
+ ## CLI Commands
87
+
88
+ ```bash
89
+ lifeos init [path] [--lang zh|en] [--no-mcp] # Create a new vault
90
+ lifeos upgrade [path] [--lang zh|en] [--override] # Upgrade and restore assets/scaffold
91
+ lifeos doctor [path] # Health check
92
+ lifeos rename [path] # Interactive directory rename
93
+ lifeos --help # Show help
94
+ lifeos --version # Show version
95
+ ```
96
+
97
+ ### init
98
+
99
+ Creates a complete LifeOS workspace:
100
+
101
+ - 10 top-level directories plus nested subdirectories
102
+ - 8 Markdown templates
103
+ - Frontmatter schema
104
+ - 9 AI skills with language-aware assets
105
+ - `CLAUDE.md` agent behavior spec
106
+ - `lifeos.yaml` config
107
+ - Git init plus `.gitignore`
108
+ - MCP server registration (Claude Code / Codex / OpenCode)
109
+
110
+ ### upgrade
111
+
112
+ Upgrades and re-syncs an initialized vault:
113
+
114
+ - **Smart merge**: update unmodified templates, schema files, built-in prompts, and skill files; skip modified ones with a warning
115
+ - **Restore missing scaffold**: bring back missing directories and managed files such as the memory directory, `.claude/skills`, `CLAUDE.md`, `AGENTS.md`, `.gitignore`, `.git`, and MCP config entries
116
+ - **Preserve user changes**: built-in files already customized by the user are not force-overwritten
117
+ - **`--override` force-refreshes resources**: overwrite templates, schema, prompts, skills, `CLAUDE.md`, `AGENTS.md`, and MCP config entries without deleting user notes, resources, `memory.db`, memory-system data, or custom directory/memory settings in `lifeos.yaml`
118
+
119
+ By default, `lifeos upgrade` tries to preserve resource files you have already modified, while updating untouched content and restoring anything missing. If you want to explicitly replace those resources with the current built-in templates, skills, schema files, and MCP config entries, use `--override`:
120
+
121
+ ```bash
122
+ lifeos upgrade ./my-vault --override
123
+ ```
124
+
125
+ ### doctor
126
+
127
+ Checks vault integrity: directory structure, templates, schema, skills, config, Node.js version, and asset version.
128
+
129
+ ### rename: Directory Customization
130
+
131
+ No extra flags are required. Run `lifeos rename [path]` and the CLI will show the directories available in the current vault, then guide you step by step to choose one and enter a new name. It updates `lifeos.yaml`, renames the actual directory, and batch-replaces related wikilinks across the vault.
132
+
133
+ This means LifeOS does not lock you into fixed directory names. You can freely adapt directory names to your own workflow, language preference, and project structure while keeping configuration and links consistent.
134
+
135
+ ## Skills
136
+
137
+ | Skill | Description |
138
+ |---|---|
139
+ | `/today` | Morning planning: review yesterday, plan today |
140
+ | `/project` | Idea -> structured project |
141
+ | `/research` | Topic -> deep research report |
142
+ | `/knowledge` | Book/paper -> knowledge note |
143
+ | `/revise` | Generate quizzes, grade, and track mastery |
144
+ | `/read-pdf` | PDF -> structured notes |
145
+ | `/ask` | Quick Q&A |
146
+ | `/brainstorm` | Interactive brainstorming |
147
+ | `/archive` | Archive completed projects, processed drafts, completed plans, and diary entries older than the most recent 7 days |
148
+
149
+ ## Custom Expert Prompts
150
+
151
+ The `/research` skill automatically scans the Prompts directory in your vault for expert prompt files. LifeOS ships with built-in expert prompts for AI/LLM, Math, Art, and History, and you can add your own to extend research capabilities to any domain.
152
+
153
+ ### How It Works
154
+
155
+ When you invoke `/research`, the Planning Agent:
156
+
157
+ 1. Lists all `.md` files in `{system directory}/Prompts/`
158
+ 2. Reads each file's frontmatter and **Domain Coverage** section
159
+ 3. Matches the research topic to the best-fit expert prompt
160
+ 4. Applies the matched prompt's analytical framework and output format to the research report
161
+
162
+ ### Adding Custom Expert Prompts
163
+
164
+ Create a `.md` file in your vault's Prompts directory (`{system directory}/Prompts/`). The Planning Agent will pick it up automatically on the next `/research` invocation, with no restart or re-init required. Use the built-in prompts in the same directory as a reference for structure.
165
+
166
+ ## Tech Stack
167
+
168
+ - **Runtime:** TypeScript + Node.js 18+
169
+ - **Database:** SQLite + FTS5 (full-text search)
170
+ - **Segmentation:** @node-rs/jieba (Chinese tokenization)
171
+ - **Protocol:** MCP (Model Context Protocol)
172
+ - **Vault:** Obsidian (plain Markdown + Frontmatter)
173
+
174
+ ## Milestones
175
+
176
+ - ✅ LifeOS 1.0 is now basically usable
177
+ - ✅ The CLI supports directory customization
178
+ - ✅ The CLI `upgrade` command supports smart updates
179
+ - ✅ Agent CLI has been tested on macOS
180
+ - ☐ Test and support Agent GUI and Windows
181
+ - ☐ Improve memory-system precision
182
+ - ☐ Support custom skills
183
+ - ☐ Support custom workflows
184
+
185
+ ## Development
186
+
187
+ ```bash
188
+ git clone git@github.com:luneth90/lifeos.git
189
+ cd lifeos
190
+ npm install
191
+ npm run build # Compile TypeScript
192
+ npm test # Run tests (431 tests)
193
+ npm run dev # Dev mode (hot reload)
194
+ ```
195
+
196
+ ## License
197
+
198
+ [MIT](LICENSE)
199
+
200
+ ## Acknowledgements
201
+
202
+ This project was inspired by [MarsWang42/OrbitOS](https://github.com/MarsWang42/OrbitOS).
package/README.md ADDED
@@ -0,0 +1,202 @@
1
+ # LifeOS
2
+
3
+ 中文 | [English](./README.en.md)
4
+
5
+ LifeOS 帮助你将碎片灵感发展为结构化知识,并真正掌握它,从随手捕获的想法,到头脑风暴与深度研究,到体系化的项目规划与知识笔记,再到间隔复习与掌握度追踪。目标不只是建立知识库,而是帮你理解、内化和驾驭复杂知识。
6
+
7
+ ## 核心功能
8
+
9
+ ### 记忆系统
10
+
11
+ > 记忆系统是 LifeOS 的核心能力,它以目录级、技能绑定的方式工作,把学习过程中的上下文、偏好与决策持续沉淀下来,让长期学习更连贯、更可追踪,也更容易形成积累。
12
+
13
+ #### 跨会话连续性
14
+
15
+ 会话桥接和活跃文档上下文会持续沉淀,Agent 不只依赖当前对话。
16
+
17
+ #### 项目级、技能绑定
18
+
19
+ 记忆系统围绕当前 Vault 中的 LifeOS 项目运行,只在 `today`、`project`、`research`、`knowledge`、`revise`、`archive` 等技能工作流里激活,并持续积累偏好、决策和上下文。
20
+
21
+ #### 比全局记忆更可控
22
+
23
+ 相较于把跨目录内容和全局会话混在一起的记忆方式,项目级、技能绑定的记忆系统能减少无关噪声,让检索结果与后续决策更贴近当前 LifeOS 工作流。
24
+
25
+ ### 目录自定义
26
+
27
+ LifeOS 不把目录命名固定死。执行 `lifeos rename [path]` 后,CLI 会交互式列出当前 Vault 中可调整的目录,引导你选择目录并输入新名称。
28
+
29
+ 它会同步更新 `lifeos.yaml`、重命名实际目录,并批量替换 Vault 中所有相关的 wikilink。你可以根据自己的工作流、语言习惯和项目结构自由调整目录名称,同时保持配置和链接关系一致。
30
+
31
+ ### 学习工作流
32
+
33
+ LifeOS 提供一组围绕学习过程设计的 Agent 技能,把“输入 -> 理解 -> 产出 -> 巩固”串成连续工作流:
34
+
35
+ - `/today`、`/brainstorm`、`/ask`:整理当天重点、澄清问题、快速展开想法
36
+ - `/project`、`/research`、`/knowledge`:把主题推进成项目、研究报告和知识笔记
37
+ - `/read-pdf`、`/revise`、`/archive`:从资料提取、复习巩固,到定期归档收束
38
+
39
+ ## 核心组件
40
+
41
+ - **记忆系统**:项目级、技能绑定,为 AI Agent 提供 Vault 索引、会话记忆、上下文组装
42
+ - **CLI 脚手架**:全局安装后使用 `lifeos init` 一键创建工作空间
43
+ - **技能系统**:9 个 Agent 技能覆盖日记、项目、研究、知识整理、复习等工作流
44
+ - **模板 + 规范**:8 个结构化模板 + Frontmatter 规范,确保笔记一致性
45
+
46
+ ## 快速开始
47
+
48
+ 目前仅在 macOS 上实际验证过 Agent CLI 流程;Agent GUI 端尚未系统测试,Windows 环境也还未验证,因此这两部分暂时不能保证体验完全一致。
49
+
50
+ ### 前置要求
51
+
52
+ 开始前,请确保本机已安装 Obsidian,以及 Claude Code CLI / Codex CLI / OpenCode CLI 中至少一种。
53
+
54
+ | 依赖 | 必须 | 用途 |
55
+ |---|---|---|
56
+ | **Node.js 18+** | 必须 | MCP Server 和 CLI 运行环境 |
57
+ | **Git** | 必须 | Vault 版本控制(包括记忆数据库) |
58
+ | **Python 3** | 必须 | PDF 提取(`/read-pdf` 技能) |
59
+
60
+ `lifeos init` 会在创建工作空间前自动检查所有前置依赖。
61
+
62
+ ### 安装与初始化
63
+
64
+ ```bash
65
+ # 第一步:全局安装 CLI
66
+ npm install -g lifeos
67
+
68
+ # 第二步:创建新的 LifeOS 工作空间(根据系统 locale 自动检测语言)
69
+ lifeos init ./my-vault
70
+
71
+ # 或显式指定语言
72
+ lifeos init ./my-vault --lang zh # 中文
73
+ lifeos init ./my-vault --lang en # 英文
74
+ ```
75
+
76
+ 安装完成后,MCP server 配置会自动注册到以下工具:
77
+
78
+ | 工具 | 配置文件 |
79
+ |---|---|
80
+ | **Claude Code** | `.mcp.json` |
81
+ | **Codex** | `.codex/config.toml` |
82
+ | **OpenCode** | `opencode.json` |
83
+
84
+ 在 Vault 目录下启动任一工具即可使用所有技能。
85
+
86
+ ## CLI 命令
87
+
88
+ ```bash
89
+ lifeos init [path] [--lang zh|en] [--no-mcp] # 创建新 Vault
90
+ lifeos upgrade [path] [--lang zh|en] [--override] # 升级并补齐资产与脚手架
91
+ lifeos doctor [path] # 健康检查
92
+ lifeos rename [path] # 交互式重命名目录
93
+ lifeos --help # 查看帮助
94
+ lifeos --version # 查看版本
95
+ ```
96
+
97
+ ### init
98
+
99
+ 创建完整的 LifeOS 工作空间:
100
+
101
+ - 10 个顶层目录 + 嵌套子目录
102
+ - 8 个 Markdown 模板
103
+ - Frontmatter 规范
104
+ - 9 个 AI 技能(按语言自动切换)
105
+ - `CLAUDE.md` Agent 行为规范
106
+ - `lifeos.yaml` 配置文件
107
+ - Git 初始化 + `.gitignore`
108
+ - MCP Server 注册(Claude Code / Codex / OpenCode)
109
+
110
+ ### upgrade
111
+
112
+ 对已初始化的 Vault 执行升级与补全:
113
+
114
+ - **智能合并**:模板、规范、内置提示词、技能文件未修改则更新,已修改则跳过并警告
115
+ - **缺失补全**:缺失的目录和脚手架文件会补回,例如记忆目录、`.claude/skills`、`CLAUDE.md`、`AGENTS.md`、`.gitignore`、`.git`、MCP 配置
116
+ - **保留用户修改**:已存在且被用户改过的内置文件不会被强制覆盖
117
+ - **`--override` 强制刷新资源**:覆盖模板、规范、提示词、技能、`CLAUDE.md`、`AGENTS.md` 以及 MCP 配置,但不会删除用户笔记、资源、`memory.db`、记忆系统数据,也不会改写 `lifeos.yaml` 里的目录和记忆配置
118
+
119
+ 默认执行 `lifeos upgrade` 时,会尽量保留你已经改过的资源文件,只更新未修改内容并补齐缺失项。如果你希望直接用当前版本的内置模板、技能、规范和 MCP 配置重新覆盖这些资源,可以显式加上 `--override`:
120
+
121
+ ```bash
122
+ lifeos upgrade ./my-vault --override
123
+ ```
124
+
125
+ ### doctor
126
+
127
+ 检查 Vault 完整性:目录结构、模板、规范、技能、配置文件、Node.js 版本、资产版本。
128
+
129
+ ### rename:目录可自定义化
130
+
131
+ 无需额外参数,直接执行 `lifeos rename [path]` 后,CLI 会列出当前 Vault 中可调整的目录,并通过交互引导你选择目录和输入新名称。它会同步更新 `lifeos.yaml`、重命名实际目录,并批量替换 Vault 中所有相关的 wikilink。
132
+
133
+ 这意味着 LifeOS 的目录命名不是固定死的。你可以根据自己的工作流、语言习惯和项目结构,自由调整各个目录的名称,同时保持配置和链接关系一致,获得最大的使用自由度。
134
+
135
+ ## 技能一览
136
+
137
+ | 技能 | 功能 |
138
+ |---|---|
139
+ | `/today` | 晨间规划:回顾昨日、规划今日 |
140
+ | `/project` | 想法 → 结构化项目 |
141
+ | `/research` | 主题 → 深度研究报告 |
142
+ | `/knowledge` | 书籍/论文 → 知识笔记 |
143
+ | `/revise` | 生成复习题、批改、追踪掌握度 |
144
+ | `/read-pdf` | PDF → 结构化笔记 |
145
+ | `/ask` | 快速问答 |
146
+ | `/brainstorm` | 交互式头脑风暴 |
147
+ | `/archive` | 归档已完成的项目、已处理的草稿、已完成的计划,以及超过最近 7 天的日记 |
148
+
149
+ ## 自定义专家提示词
150
+
151
+ `/research` 技能会自动扫描 Vault 中提示词目录下的所有专家人格文件。LifeOS 内置了 AI/LLM、数学、艺术、历史等领域的专家人格,你可以添加自己的提示词来扩展研究能力到任何领域。
152
+
153
+ ### 工作原理
154
+
155
+ 调用 `/research` 时,Planning Agent 会:
156
+
157
+ 1. 列出 `{系统目录}/提示词/` 下所有 `.md` 文件
158
+ 2. 读取每个文件的 frontmatter 和**领域覆盖**章节
159
+ 3. 将研究主题与最匹配的专家提示词进行比对
160
+ 4. 将匹配的专家提示词的分析框架和输出格式应用到研究报告中
161
+
162
+ ### 添加自定义专家提示词
163
+
164
+ 在 Vault 的提示词目录(`{系统目录}/提示词/`)下创建 `.md` 文件即可。Planning Agent 在下次 `/research` 调用时会自动发现,无需重启或重新初始化。文件结构参照同目录下的预设提示词即可。
165
+
166
+ ## 技术栈
167
+
168
+ - **Runtime:** TypeScript + Node.js 18+
169
+ - **Database:** SQLite + FTS5(全文搜索)
170
+ - **Segmentation:** @node-rs/jieba(中文分词)
171
+ - **Protocol:** MCP (Model Context Protocol)
172
+ - **Vault:** Obsidian(纯 Markdown + Frontmatter)
173
+
174
+ ## 里程碑
175
+
176
+ - ✅ LifeOS 1.0 版本已初步可用
177
+ - ✅ CLI 支持目录自定义
178
+ - ✅ CLI upgrade 支持智能更新
179
+ - ✅ macOS 端 Agent CLI 已测试
180
+ - ☐ Agent GUI 和 Windows 测试与支持
181
+ - ☐ 强化记忆系统精准性
182
+ - ☐ 支持自定义技能
183
+ - ☐ 支持自定义工作流
184
+
185
+ ## 开发
186
+
187
+ ```bash
188
+ git clone git@github.com:luneth90/lifeos.git
189
+ cd lifeos
190
+ npm install
191
+ npm run build # 编译 TypeScript
192
+ npm test # 运行测试(431 个)
193
+ npm run dev # 开发模式(热重载)
194
+ ```
195
+
196
+ ## License
197
+
198
+ [MIT](LICENSE)
199
+
200
+ ## 致谢
201
+
202
+ 本项目的灵感来源于 [MarsWang42/OrbitOS](https://github.com/MarsWang42/OrbitOS)。
@@ -0,0 +1,162 @@
1
+ > [!IMPORTANT] Language Enforcement
2
+ > **All replies and generated content must be in English. Do not output any other language (except technical terms and code). This is the highest priority rule and must not be violated under any circumstances.**
3
+
4
+ > [!config] Path Configuration
5
+ > Directory names in this file use logical name references. Actual physical paths are defined in `lifeos.yaml` at the Vault root.
6
+ > The default directory names below come from presets; actual names follow the user's `lifeos.yaml` configuration.
7
+
8
+ # Agent Behavior Guidelines — LifeOS
9
+ `v1.0.0`
10
+
11
+ You are the user's lifelong learning partner. Through **LifeOS**, help the user develop fragmented inspirations into structured knowledge and truly master it — from casually captured ideas, through brainstorming and deep research, to systematic project planning and knowledge notes, then spaced review and mastery tracking. The goal is not just building a knowledge base, but helping the user understand, internalize, and command complex knowledge.
12
+
13
+ ## Directory Structure
14
+
15
+ - **drafts** (default `00_Drafts`): Unstructured knowledge pool, jot down ideas anytime → digest into reports with `/research`, or integrate into knowledge notes with `/knowledge`
16
+ - **diary** (default `10_Diary`): Daily journal (`YYYY-MM-DD.md`) → use `/today` every morning; `/archive` moves diary entries older than the most recent 7 days into `{system}/{archive_diary}/`
17
+ - **projects** (default `20_Projects`): Active projects
18
+ - **research** (default `30_Research`): In-depth research reports, organized by `<Domain>/<Topic>/` (only stores `/research` output)
19
+ - **knowledge** (default `40_Knowledge`): Knowledge base
20
+ - `{knowledge_notes}/<Domain>/<BookName>/<ChapterName>/<ChapterName>.md`: Structured reading/course notes
21
+ - `{knowledge_notes}/<Domain>/<BookName>/<ChapterName>/Review_YYYY-MM-DD.md`: Review record files
22
+ - `{knowledge_wiki}/<Domain>/<ConceptName>`: Wiki concepts
23
+ - Only stores `/knowledge` output
24
+ - **outputs** (default `50_Outputs`): Externalized outputs from knowledge and projects
25
+ - Stores articles, tutorials, talk scripts, solutions, presentation outlines, demo materials, and other deliverables
26
+ - Primarily receives staged expressions from `{projects}` and `{knowledge}`, does not store raw materials
27
+ - **plans** (default `60_Plans`): Execution plan files for `/research` and `/project` (`status: active | done`; kept in `{plans}` after execution and moved into `{system}/{archive_plans}/` later by `/archive`)
28
+ - **resources** (default `70_Resources`): Raw materials (`Books/`, `Literature/`)
29
+ - **reflection** (default `80_Reflection`): Periodic reviews and system calibration
30
+ - `Weekly/`, `Monthly/`, `Quarterly/`, `Yearly/`, `Projects/`
31
+ - Focus on priority correction, methodology reflection, rhythm calibration; does not replace `{diary}` daily records
32
+ - **system** (default `90_System`): `Templates/`, `Schema/`, `Prompts/`, `Archive/Projects/YYYY/`, `Archive/Drafts/YYYY/MM/`, `Archive/Plans/`, `Archive/Diary/YYYY/MM/`
33
+
34
+ ---
35
+
36
+ ## Skill Directory
37
+
38
+ Skill file location: `.agents/skills/<skill-name>/SKILL.md`
39
+
40
+ | Skill | Function | When to Use |
41
+ | --- | --- | --- |
42
+ | `/today` | Morning planning: review yesterday, plan today, connect active projects | At the start of the day, when wanting to know what to work on |
43
+ | `/project` | Turn ideas or resources into structured projects | When an idea is ready to formalize, picking up a book to study systematically, or a draft has matured into a project |
44
+ | `/research` | Deep research on a topic, produce structured report | When wanting to deeply understand a topic, needing multi-angle investigation, or expanding a draft into full analysis |
45
+ | `/ask` | Quick Q&A, optionally save as draft | When having a specific question needing a quick answer, without the full research workflow |
46
+ | `/brainstorm` | Interactive brainstorming, explore and deepen ideas | When having an immature idea to discuss, needing divergent thinking, or exploring feasibility |
47
+ | `/knowledge` | Distill structured knowledge notes and wiki concepts from books/papers | After reading a chapter and wanting to organize notes, or structuring source material into a knowledge system |
48
+ | `/revise` | Generate review files, grade and update mastery | When wanting to review learned content, test understanding, or reinforce weak areas |
49
+ | `/archive` | Archive completed projects, processed drafts, completed plans, and diary entries older than the most recent 7 days | When wanting to clean up the Vault or organize completed work |
50
+ | `/read-pdf` | Parse PDF into structured JSON | When needing to convert a PDF file into processable text |
51
+
52
+ **Template Routing:**
53
+
54
+ | Scenario | Template |
55
+ | --- | --- |
56
+ | Daily journal | `Daily_Template.md` |
57
+ | Draft | `Draft_Template.md` |
58
+ | Wiki | `Wiki_Template.md` |
59
+ | Project file | `Project_Template.md` |
60
+ | Review record | `Revise_Template.md` |
61
+ | General knowledge note | `Knowledge_Template.md` |
62
+ | In-depth research report | `Research_Template.md` |
63
+ | Periodic retrospective | `Retrospective_Template.md` |
64
+
65
+ ---
66
+
67
+ ## Context Recovery (Must Read After Compaction)
68
+
69
+ Before resuming a task after compaction:
70
+ 1. Re-read the project/note files involved in the current task
71
+ 2. Continue based on existing content; do not restart or overwrite existing progress
72
+
73
+ ---
74
+
75
+ ## Memory System Rules
76
+
77
+ Applies to Vaults with initialized `{system}/{memory}/`.
78
+
79
+ > **Core principle: The memory system activates only within LifeOS skill workflows.** Casual conversations outside skills do not trigger any memory writes, to avoid noise polluting data.
80
+
81
+ ### Trigger Conditions
82
+
83
+ Memory tools are called **only in these scenarios**:
84
+ - A LifeOS skill is being used (`/today`, `/knowledge`, `/revise`, `/research`, `/project`, `/archive`, `/brainstorm`, `/ask`, etc.)
85
+ - The user explicitly requests Vault file operations (create/modify notes, project files, etc.)
86
+ - The user explicitly requests a memory system query
87
+
88
+ **Forbidden trigger scenarios:** Casual chat, code discussions, conversations unrelated to the Vault. Do not call any `memory_*` tools in these scenarios.
89
+
90
+ ### Invocation Rules
91
+
92
+ 1. At the start of each session, call `memory_startup` to retrieve the Layer 0 summary (regardless of whether skills are used).
93
+ 2. After modifying Vault files during skill execution, call `memory_notify` to update the index.
94
+ 3. After skill completion, call `memory_skill_complete` to record the event and refresh active documents.
95
+ 4. User preferences, corrections, and project decisions that arise during skill execution are written via `memory_log` (single) or `memory_auto_capture` (batch). See "Preference & Decision Capture" below for details.
96
+ 5. Before ending a skill session, first write `session_bridge` (via `memory_log`), then call `memory_checkpoint`.
97
+ 6. When determining user preferences, referencing historical decisions, or confirming learning progress during skill execution, prioritize querying the memory system (`memory_query` / `memory_recent`).
98
+
99
+ > **Memory data storage rule:** All memory data must be written into the Vault (`{system}/{memory}/`) through LifeOS MCP memory tools. Do not write project knowledge, user preferences, decisions, etc. to platform built-in memory paths. Platform built-in memory should only be used for that platform's own operational preferences.
100
+
101
+ ### Preference & Decision Capture
102
+
103
+ **slot_key naming convention:** `<category>:<topic>`
104
+
105
+ | category | Meaning | Examples |
106
+ | --- | --- | --- |
107
+ | `format` | Output format preferences | `format:commit-msg`, `format:note-style` |
108
+ | `workflow` | Workflow preferences | `workflow:review-frequency`, `workflow:pr-size` |
109
+ | `tool` | Tool usage preferences | `tool:editor`, `tool:terminal` |
110
+ | `content` | Content style preferences | `content:language`, `content:emoji` |
111
+ | `schedule` | Scheduling preferences | `schedule:study-time`, `schedule:break-interval` |
112
+
113
+ **Must capture scenarios:**
114
+ - User explicitly corrects Agent behavior (e.g., "don't use Chinese", "no emoji") → `correction`
115
+ - User confirms a specific approach or direction (e.g., "use this structure", "yes, use TDD") → `decision`
116
+ - User expresses a persistent preference (e.g., "I prefer concise commit messages", "set review interval to two weeks") → `preference`
117
+
118
+ **Forbidden capture scenarios:**
119
+ - One-off technical discussions (e.g., "what caused this bug")
120
+ - Conventions already codified in code (e.g., parameters in config files)
121
+ - Casual chat or conversations unrelated to the Vault
122
+ - Information directly derivable from code or git history
123
+
124
+ ---
125
+
126
+ ## Vault Rules
127
+
128
+ ### Operation Tools (If Installed)
129
+
130
+ If the following MCP tools are configured in the Vault, prefer using them:
131
+
132
+ | Tool | Purpose |
133
+ | --- | --- |
134
+ | `obsidian-cli` | Vault directory reading, searching, frontmatter filtering |
135
+ | `obsidian-markdown` | Create/edit .md notes (including wikilinks, callouts, frontmatter, embeds) |
136
+ | `obsidian-bases` | Create/edit .base files |
137
+ | `json-canvas` | Create/edit .canvas files |
138
+
139
+ When not installed, use the platform's native file operation tools.
140
+
141
+ ### Frontmatter Schema
142
+
143
+ Before creating/modifying any note, must first read `[[Frontmatter_Schema]]` and strictly follow it. When templates conflict with the schema, the schema takes precedence.
144
+
145
+ ### Status Flow
146
+
147
+ Drafts, knowledge notes, and plans each have independent status lifecycles. See `.agents/skills/_shared/lifecycle.md` for details.
148
+
149
+ Core constraints:
150
+ - Drafts with `status: pending` are **never** archived
151
+ - Plans follow `active → done → archived`: `/project` and `/research` update finished plans to `done`, and `/archive` moves them and updates them to `archived`
152
+ - Knowledge note status **only goes up, never down** (draft → review → mastered)
153
+
154
+ ### Learning Project Knowledge Accuracy
155
+
156
+ Applies to projects with `type: project, category: learning` and their associated `{knowledge}/` content:
157
+
158
+ - **Source material definitions and conventions take priority**: Terminology, symbols, definitions, and calculation conventions must follow the source material
159
+ - **Do not override source material conventions with external knowledge**: Even if Agent's own knowledge differs, follow the source material
160
+ - **Only use Agent's own knowledge** to supplement content not defined in the source material
161
+ - When uncertain whether a convention comes from the source material, must first consult notes recording the source content before answering
162
+ - Example: VGT uses the $ji = k$ convention (opposite to standard quaternion $ij = k$); quizzes and solutions must follow the VGT convention