life-capture
Turn natural-language life logs into durable records. This skill classifies each input item, generates tags, creates user-visible markdown, writes to a daily note under life/daily, and syncs structured data into life/db/life.db.
Default storage layout
Use these paths unless the user explicitly overrides them:
CODEBLOCK0
Create missing directories as needed. Never delete existing content. Append or update only.
Supported record types
Map every parsed item to exactly one primary type:
- -
expense: spending, bills, purchases, subscriptions, refunds - INLINECODE3 : completed tasks, ongoing work, todos, chores, habits
- INLINECODE4 : calendar items, appointments, time blocks, plans
- INLINECODE5 : ideas, inspiration, possible projects, reflections worth saving
When a sentence contains multiple items, split it into multiple records.
Output contract
For each user request:
- 1. Parse the message into one or more records.
- Generate a stable
id for each record using the pattern:
-
exp_YYYYMMDD_NNN
-
task_YYYYMMDD_NNN
-
sched_YYYYMMDD_NNN
-
idea_YYYYMMDD_NNN
- 3. Generate 1 to 4 short tags.
- Show the user the organized result in markdown.
- Save the records by running
scripts/process_entry.py.
Always keep the original user wording in raw_text. Never invent missing fields. Leave unknown fields null.
User-visible response format
Because this skill is configured for visible output, show a concise but complete result after writing:
CODEBLOCK1 json
CODEBLOCK2
If there are multiple records, repeat the block for each one.
Parsing rules
Use scripts/parse_entries.py for natural-language parsing. The parser now reads configurable rules from references/parser_config.json, so prefer editing that file instead of changing Python when you need new categories, tags, or keyword mappings.
Expense
Extract when present:
- - INLINECODE15
- INLINECODE16 (default
CNY only when the currency symbol or language implies RMB; otherwise null) - INLINECODE18
- INLINECODE19
- INLINECODE20
- INLINECODE21
Default top-level tags often include 开销 plus one semantic tag such as 餐饮 or 交通.
Preferred categories:
Task
Extract when present:
- -
status (todo, doing, done, cancelled) - INLINECODE30 (
low, normal, high) - INLINECODE34
- INLINECODE35
- INLINECODE36
If the user says they already did something, default status to done.
Schedule
Extract when present:
- - INLINECODE38
- INLINECODE39
- INLINECODE40
- INLINECODE41
- INLINECODE42 (
planned, done, skipped)
If the user uses relative dates, resolve them from the current conversation date. Prefer passing --today YYYY-MM-DD to scripts/process_entry.py or scripts/parse_entries.py so relative dates like 明天 are stable across environments.
Idea
Extract when present:
- - INLINECODE50
- INLINECODE51 (
captured, reviewing, used, archived) - INLINECODE56
Default status to captured.
Configurable parsing rules
Before editing Python, check whether the change can be made in references/parser_config.json.
You can change:
- - category and subcategory mappings for expenses
- task project mappings
- idea type mappings
- schedule extra tag mappings
- default tags by record type
- hint regexes used in type inference
To test a modified config without changing the bundled default file:
CODEBLOCK3
Markdown writing rules
Write each record into the daily note for its effective date under one of these sections:
- - INLINECODE59
- INLINECODE60
- INLINECODE61
- INLINECODE62
Use this block structure:
CODEBLOCK4
Then add type-specific fields:
- - Expense: 金额 / 币种 / 分类 / 子分类 / 商家 / 支付方式
- Task: 状态 / 优先级 / 项目 / 截止日期 / 完成时间
- Schedule: 日期 / 开始时间 / 结束时间 / 地点 / 状态
- Idea: 类型 / 状态 / 关联任务
Execution workflow
End-to-end one-command flow
Use this when the user provides natural language and wants the records saved immediately:
CODEBLOCK5
The wrapper script will:
- 1. initialize the database if missing
- parse text into
{"records": [...]} with INLINECODE64 - save markdown and sqlite rows with INLINECODE65
- print parsed records plus save results as json
Split-step flow
Use this when the user asks to inspect or verify the structured output before writing:
CODEBLOCK6
Then save:
CODEBLOCK7
Database init only
Use this once before first write if life/db/life.db does not exist and you are not using process_entry.py:
CODEBLOCK8
Database sync rules
The database design is:
- - INLINECODE68
- INLINECODE69
- INLINECODE70
- INLINECODE71
- INLINECODE72
- INLINECODE73
- INLINECODE74
See references/schema.md for the schema, references/examples.md for sample payloads and commands, and references/configuration.md plus references/parser_config.json for configurable parsing rules.
Failure handling
- - If markdown write succeeds but database sync fails, say so clearly.
- Do not silently drop a record.
- If parsing is ambiguous, make the narrowest safe interpretation and preserve the original text.
- If a record is missing a critical type-specific field, still save the record with null fields rather than discarding it.
life-capture
将自然语言的生活日志转化为持久化记录。该技能对每条输入内容进行分类、生成标签、创建用户可见的 Markdown 文件,写入 life/daily 下的每日笔记,并将结构化数据同步至 life/db/life.db。
默认存储结构
除非用户明确覆盖,否则使用以下路径:
text
life/
daily/
ideas/
db/life.db
按需创建缺失目录。绝不删除已有内容。仅追加或更新。
支持的记录类型
将每条解析项映射到唯一的主类型:
- - expense:支出、账单、购物、订阅、退款
- task:已完成任务、进行中的工作、待办事项、家务、习惯
- schedule:日历项、预约、时间段、计划
- idea:想法、灵感、可能的项目、值得保存的反思
当一句话包含多个事项时,将其拆分为多条记录。
输出约定
对于每个用户请求:
- 1. 将消息解析为一条或多条记录。
- 为每条记录生成稳定的 id,格式如下:
- exp
YYYYMMDDNNN
- task
YYYYMMDDNNN
- sched
YYYYMMDDNNN
- idea
YYYYMMDDNNN
- 3. 生成 1 到 4 个简短标签。
- 以 Markdown 格式向用户展示整理后的结果。
- 通过运行 scripts/process_entry.py 保存记录。
始终在 raw_text 中保留用户的原始措辞。绝不凭空编造缺失字段。未知字段留空。
用户可见的响应格式
由于该技能配置为可见输出,写入后显示简洁但完整的结果:
md
已整理记录
1) <类型标签>
- - ID:
- 标签: #a #b
- 归档: <每日 Markdown 路径>
- 数据库: <已写入/已跳过>
Markdown
<为该条目写入的 Markdown 块>
JSON
json
<解析后的记录 JSON>
如果有多条记录,为每条记录重复上述块。
解析规则
使用 scripts/parseentries.py 进行自然语言解析。解析器现在从 references/parserconfig.json 读取可配置规则,因此当需要新增类别、标签或关键词映射时,优先编辑该文件而非修改 Python 代码。
支出
提取以下字段(如有):
- - amount(金额)
- currency(币种,仅当币种符号或语言暗示人民币时默认 CNY,否则留空)
- category(分类)
- subcategory(子分类)
- merchant(商家)
- pay_method(支付方式)
默认顶层标签通常包含 开销 加一个语义标签,如 餐饮 或 交通。
首选分类:
任务
提取以下字段(如有):
- - status(状态:todo、doing、done、cancelled)
- priority(优先级:low、normal、high)
- project(项目)
- duedate(截止日期)
- completedat(完成时间)
如果用户表示已经做了某事,默认状态设为 done。
日程
提取以下字段(如有):
- - scheduledate(日程日期)
- starttime(开始时间)
- end_time(结束时间)
- location(地点)
- status(状态:planned、done、skipped)
如果用户使用相对日期,从当前对话日期解析。优先向 scripts/processentry.py 或 scripts/parseentries.py 传递 --today YYYY-MM-DD,以便 明天 等相对日期在不同环境中保持稳定。
灵感
提取以下字段(如有):
- - ideatype(灵感类型)
- status(状态:captured、reviewing、used、archived)
- relatedtask_id(关联任务 ID)
默认状态设为 captured。
可配置的解析规则
在修改 Python 代码之前,先检查是否可以在 references/parser_config.json 中完成更改。
可以修改:
- - 支出的分类和子分类映射
- 任务的项目映射
- 灵感类型映射
- 日程的额外标签映射
- 按记录类型的默认标签
- 类型推断中使用的提示正则表达式
在不更改捆绑默认文件的情况下测试修改后的配置:
bash
python scripts/parseentries.py --config /path/to/customconfig.json --text 买咖啡 18 元,明天下午两点去体检
Markdown 写入规则
将每条记录写入其生效日期的每日笔记,放在以下某个章节下:
使用以下块结构:
md
- - 时间:<时间或空>
- 标签:#tag1 #tag2
- 原始描述:
- 摘要:
然后添加类型特定字段:
- - 支出:金额 / 币种 / 分类 / 子分类 / 商家 / 支付方式
- 任务:状态 / 优先级 / 项目 / 截止日期 / 完成时间
- 日程:日期 / 开始时间 / 结束时间 / 地点 / 状态
- 灵感:类型 / 状态 / 关联任务
执行工作流
端到端单命令流程
当用户提供自然语言并希望立即保存记录时使用:
bash
python scripts/process_entry.py --root life --db life/db/life.db --today 2026-03-10 --text 今天中午牛肉面 26 元,下午整理了书桌,想到可以做一个生活数据看板
该包装脚本将:
- 1. 初始化数据库(如缺失)
- 通过 scripts/parseentries.py 将文本解析为 {records: [...]}
- 通过 scripts/saveentry.py 保存 Markdown 和 SQLite 行
- 打印解析后的记录及保存结果(JSON 格式)
分步流程
当用户希望在写入前检查或验证结构化输出时使用:
bash
python scripts/parse_entries.py --text 明天下午两点去体检,买咖啡 18 元
然后保存:
bash
python scripts/save_entry.py --root life --db life/db/life.db --stdin-json
仅初始化数据库
如果 life/db/life.db 不存在且未使用 process_entry.py,在首次写入前使用一次:
bash
python scripts/init_db.py --db life/db/life.db
数据库同步规则
数据库设计包含:
- - entries
- expenses
- tasks
- schedules
- ideas
- tags
- entry_tags
参见 references/schema.md 了解模式定义,references/examples.md 了解示例负载和命令,references/configuration.md 及 references/parser_config.json 了解可配置的解析规则。
失败处理
- - 如果 Markdown 写入成功但数据库同步失败,需明确说明。
- 绝不静默丢弃记录。
- 如果解析存在歧义,做出最窄的安全解释并保留原始文本。
- 如果记录缺少关键的类型特定字段,仍以空字段保存记录,而非丢弃。