LifeOS 中的 Fabric 工作流:基于意图的智能模式选择实战指南
【免费下载链接】LifeOS⛰️ The Life Operating System — an intent engineering platform that moves you from your current state to your ideal state, in life and work.项目地址: https://gitcode.com/GitHub_Trending/pe/LifeOS
导读
本文围绕 LifeOS 仓库中 Research 技能的 Fabric 工作流 展开,讲解如何从 240+ 个经过实战验证的专业提示词模式(pattern)中,根据用户意图自动挑选最合适的模式,用于威胁建模、摘要、智慧提取、内容分析、内容创作与文本转换。读完本文,你将掌握一整套"意图识别 → 模式匹配 → 执行 → 结果输出"的完整工作流,并了解 LifeOS 如何在不依赖外部 CLI 的情况下原生执行这些模式,以及何时才需要回退到fabric命令行。
一、Fabric 工作流是什么
Fabric 工作流是 LifeOS 中 Research 技能(Research/SKILL.md)注册的众多工作流之一,它的定位是:为 Fabric CLI 提供智能模式选择。当用户提出"对某内容做威胁建模 / 分析 / 摘要 / 提取 / 转换"之类的请求时,本工作流负责从 240+ 个专业提示词模式中自动挑选最合适的那一个,然后执行。
它的适用触发条件(USE WHEN)覆盖:
- 处理内容(processing content)
- 分析数据(analyzing data)
- 生成摘要(creating summaries)
- 威胁建模(threat modeling)
- 文本转换(transforming text)
注意:Fabric 技能本体已迁移到独立技能目录,本工作流文件只是 Research 技能中的路由入口。真正的模式库与执行逻辑位于
LifeOS/install/skills/Fabric/目录。
技能引用与模式位置
原工作流文件明确给出了两个关键路径(安装到用户主目录后的形态):
- 主技能文件:
~/.claude/skills/Fabric/SKILL.md - 模式存放目录:
~/.claude/skills/Fabric/Patterns/
在当前仓库中,对应的实际位置是 LifeOS/install/skills/Fabric/SKILL.md 与 LifeOS/install/skills/Fabric/Patterns/。当需要更新模式时,直接说 "update fabric patterns" 即可触发 Fabric 技能的 UpdatePatterns 工作流(详见第五节)。
二、何时激活本技能:识别触发意图
工作流文件给出了七类最常见的主用例(Primary Use Cases),当用户请求中出现以下意图时应激活本技能:
| 用户请求示例 | 意图类型 |
|---|---|
| "Create a threat model for..." | 威胁建模 |
| "Summarize this article/video/paper..." | 摘要 |
| "Extract wisdom/insights from..." | 智慧提取 |
| "Analyze this [code/malware/claims/debate]..." | 分析 |
| "Improve my writing/code/prompt..." | 改进 |
| "Create a [visualization/summary/report]..." | 内容创作 |
| "Rate/review/judge this content..." | 评分/评审 |
核心目标:根据你要完成的任务,从 240+ 个可用模式中挑选出正确的那一个——而不是把模式清单甩给用户让他自己选。
三、模式选择策略:意图分类决策树
原文档的核心是一套决策树。拿到用户请求后,第一步是判断意图属于哪一大类,第二步是精确到具体模式。
1. 识别意图类别
威胁建模与安全(Threat Modeling & Security):
- 威胁建模 →
create_threat_model或create_stride_threat_model - 威胁场景 →
create_threat_scenarios - 安全更新 →
create_security_update - 安全规则 →
create_sigma_rules、write_nuclei_template_rule、write_semgrep_rule - 威胁分析 →
analyze_threat_report、analyze_threat_report_trends
摘要(Summarization):
- 通用摘要 →
summarize - 5 句摘要 →
create_5_sentence_summary - 微摘要 →
create_micro_summary或summarize_micro - 会议 →
summarize_meeting - 论文/研究 →
summarize_paper - 视频/YouTube →
youtube_summary - 通讯稿 →
summarize_newsletter - 代码变更 →
summarize_git_changes或summarize_git_diff
智慧提取(Wisdom Extraction):
- 通用智慧 →
extract_wisdom - 文章智慧 →
extract_article_wisdom - 书籍想法 →
extract_book_ideas - 洞察 →
extract_insights或extract_insights_dm - 核心思想 →
extract_main_idea - 推荐 →
extract_recommendations - 争议观点 →
extract_controversial_ideas
分析(Analysis):
- 恶意软件 →
analyze_malware - 代码 →
analyze_code或review_code - 论断 →
analyze_claims - 辩论 →
analyze_debate - 日志 →
analyze_logs - 论文 →
analyze_paper - 威胁报告 →
analyze_threat_report - 产品反馈 →
analyze_product_feedback - 销售电话 →
analyze_sales_call
内容创作(Content Creation):
- PRD →
create_prd - 设计文档 →
create_design_document - 用户故事 →
create_user_story - 可视化 →
create_visualization、create_mermaid_visualization、create_markmap_visualization - 文章 →
write_essay - 报告发现 →
create_report_finding - 通讯稿条目 →
create_newsletter_entry
改进(Improvement):
- 写作 →
improve_writing - 学术写作 →
improve_academic_writing - 提示词 →
improve_prompt - 报告发现 →
improve_report_finding - 代码 →
review_code
评分/评审(Rating/Evaluation):
- AI 响应 →
rate_ai_response - 内容质量 →
rate_content - 价值评估 →
rate_value - 通用判断 →
judge_output
2. 执行模式:fabric 命令行格式
# 基本格式 fabric [input] -p [selected_pattern] # 从 URL 抓取 fabric -u "URL" -p [pattern] # 从 YouTube fabric -y "YOUTUBE_URL" -p [pattern] # 从文件(管道输入) cat file.txt | fabric -p [pattern] # 直接文本 fabric "your text here" -p [pattern]关键参数说明:
-p:指定要使用的 pattern 名称(名称必须精确,例如extract_wisdom而不是extractwisdom)-u:URL 内容抓取-y:YouTube 转写(fabric 原生处理下载 + 转写 + 处理)
四、240+ 模式全目录:七大分类速查
仓库中的 Patterns/ 目录 实际存放了 240+ 个模式,每个模式是一个目录,内含system.md(提示词指令)。此外 pattern_explanations.md 提供了每个模式的一句话说明。
威胁建模与安全(15 个模式)
create_threat_model- 通用威胁建模create_stride_threat_model- STRIDE 方法论create_threat_scenarios- 威胁场景生成create_security_update- 安全更新文档create_sigma_rules- SIGMA 检测规则write_nuclei_template_rule- Nuclei 扫描器模板write_semgrep_rule- Semgrep 静态分析规则analyze_threat_report- 威胁报告分析analyze_threat_report_cmds- 从威胁报告提取命令analyze_threat_report_trends- 识别威胁趋势t_threat_model_plans- 针对计划的威胁建模ask_secure_by_design_questions- 安全设计提问create_network_threat_landscape- 网络威胁态势analyze_incident- 事件分析analyze_risk- 风险评估
摘要(20 个模式)
summarize- 通用摘要create_5_sentence_summary- 超精简 5 行摘要create_micro_summary- 微摘要create_summary- 详细摘要summarize_micro- 微摘要summarize_meeting- 会议纪要摘要summarize_paper- 学术论文摘要summarize_lecture- 讲座摘要summarize_newsletter- 通讯稿摘要summarize_debate- 辩论摘要summarize_legislation- 立法摘要summarize_rpg_session- RPG 跑团记录摘要summarize_board_meeting- 董事会会议摘要summarize_git_changes- Git 变更摘要summarize_git_diff- Git diff 摘要summarize_pull-requests- PR 摘要summarize_prompt- 提示词摘要youtube_summary- YouTube 视频摘要create_cyber_summary- 网络安全摘要
提取(30+ 个模式)
extract_wisdom- 通用智慧提取extract_article_wisdom- 文章专属智慧extract_book_ideas- 书籍想法extract_insights- 通用洞察extract_insights_dm- 深度模式洞察extract_main_idea- 核心信息extract_recommendations- 推荐extract_ideas- 内容想法extract_questions- 提出的问题extract_predictions- 做出的预测extract_controversial_ideas- 争议点extract_business_ideas- 商业机会extract_skills- 提及的技能extract_patterns- 识别出的模式extract_sponsors- 赞助商提及extract_references- 引用的参考extract_instructions- 内容中的指令extract_jokes- 幽默提取extract_primary_problem- 主要问题extract_primary_solution- 主要方案extract_product_features- 产品特性extract_core_message- 核心信息extract_algorithm_update_recommendations- 算法建议extract_extraordinary_claims- 非凡论断extract_most_redeeming_thing- 最有价值之处
分析(35+ 个模式)
analyze_claims- 论断分析analyze_malware- 恶意软件分析analyze_code- 代码分析analyze_paper- 论文分析analyze_logs- 日志分析analyze_debate- 辩论分析analyze_incident- 事件分析analyze_comments- 评论分析analyze_answers- 答案分析analyze_email_headers- 邮件头分析analyze_military_strategy- 军事战略analyze_mistakes- 错误分析analyze_personality- 人格分析analyze_presentation- 演示分析analyze_product_feedback- 产品反馈analyze_proposition- 提案分析analyze_prose- 散文分析analyze_risk- 风险分析analyze_sales_call- 销售电话分析analyze_spiritual_text- 灵性文本分析analyze_tech_impact- 技术影响分析analyze_threat_report- 威胁报告分析analyze_bill- 法案分析analyze_candidates- 候选人分析analyze_cfp_submission- CFP 投稿分析analyze_terraform_plan- Terraform 计划分析analyze_interviewer_techniques- 面试官技巧分析
创作(50+ 个模式)
create_prd- 产品需求文档create_design_document- 设计文档create_user_story- 用户故事create_coding_project- 编码项目create_coding_feature- 代码特性create_mermaid_visualization- Mermaid 图表create_markmap_visualization- Markmap 思维导图create_visualization- 通用可视化create_threat_model- 威胁模型create_stride_threat_model- STRIDE 威胁模型create_threat_scenarios- 威胁场景create_report_finding- 报告发现create_newsletter_entry- 通讯稿内容create_keynote- 主题演讲create_academic_paper- 学术论文create_flash_cards- 学习闪卡create_quiz- 测验create_graph_from_input- 图表create_tags- 内容标签create_art_prompt- 艺术生成提示词create_command- CLI 命令create_pattern- Fabric 模式create_logo- Logo 设计create_podcast_image- 播客图像create_sigma_rules- SIGMA 规则create_video_chapters- 视频章节create_upgrade_pack- 升级文档
改进(10 个模式)
improve_writing- 通用写作改进improve_academic_writing- 学术写作improve_prompt- 提示词工程improve_report_finding- 报告发现review_code- 代码评审review_design- 设计评审refine_design_document- 设计文档精炼humanize- 拟人化 AI 文本enrich_blog_post- 博客增强clean_text- 文本清理
评分/评审(8 个模式)
rate_ai_response- 评分 AI 输出rate_ai_result- 评分 AI 结果rate_content- 评分内容质量rate_value- 评分价值主张judge_output- 通用判断label_and_rate- 标注与评分check_agreement- 协议检查arbiter-evaluate-quality- 质量评估
仓库实际规模以 Patterns/ 目录 为准,除上述高频模式外还包含大量垂直场景模式(如
analyze_bill、write_hackerone_report、summarize_rpg_session、create_reading_plan、explain_code等),完整清单可直接ls该目录查看。
五、模式更新流程
模式由 Fabric 技能统一管理。原文档规定的更新方式是:
- 更新模式:直接说 "update fabric patterns",触发 UpdatePatterns 工作流
- 查看全部模式:
ls ~/.claude/skills/Fabric/Patterns/UpdatePatterns 工作流(仓库实现)的完整步骤为:
- 前置条件:必须已安装 fabric CLI(
go install github.com/danielmiessler/fabric@latest),更新从上游官方仓库拉取 - 发送语音通知:向本地通知服务 POST 一条消息
- 统计当前模式数:
ls -1 ~/.claude/skills/Fabric/Patterns/ | wc -l - 通过 fabric CLI 更新:执行
fabric -U,更新~/.config/fabric/patterns/ - 同步到技能目录:
rsync -av --delete ~/.config/fabric/patterns/ ~/.claude/skills/Fabric/Patterns/ - 报告结果:对比新旧模式数量,输出新增数量
- 验证关键模式存在:依次检查
extract_wisdom、summarize、create_threat_model、analyze_claims四个核心模式是否就位
若 fabric CLI 不可用,还可通过手动 git clone 上游仓库后rsync同步模式目录(详见工作流文档"Alternative: Manual Git Update"一节)。
六、实战示例
威胁建模:
# 用户:"Create a threat model for our new API" fabric "API that handles user authentication and payment processing" -p create_threat_model摘要:
# 用户:"Summarize this blog post" fabric -u "https://example.com/blog-post" -p summarize # 用户:"Give me a 5-sentence summary" fabric -u "https://example.com/article" -p create_5_sentence_summary智慧提取:
# 用户:"Extract wisdom from this video" fabric -y "https://youtube.com/watch?v=..." -p extract_wisdom # 用户:"What are the main ideas?" fabric -u "URL" -p extract_main_idea分析:
# 用户:"Analyze this code for issues" fabric "$(cat code.py)" -p analyze_code # 用户:"Analyze these security claims" fabric "security claims text" -p analyze_claims七、模式选择决策矩阵
原文档提供了一张速查表,帮助快速根据用户请求关键词定位意图与推荐模式:
| 用户请求包含 | 可能意图 | 推荐模式 |
|---|---|---|
| "threat model" | 安全建模 | create_threat_model,create_stride_threat_model |
| "summarize", "summary" | 摘要 | summarize,create_5_sentence_summary |
| "extract wisdom", "insights" | 智慧提取 | extract_wisdom,extract_insights |
| "analyze [X]" | 分析 | analyze_[X](X 与模式匹配) |
| "improve", "enhance" | 改进 | improve_writing,improve_prompt |
| "create [visualization]" | 可视化 | create_mermaid_visualization,create_markmap_visualization |
| "rate", "judge", "evaluate" | 评分 | rate_content,judge_output |
| "main idea", "core message" | 核心提取 | extract_main_idea,extract_core_message |
八、高级用法
管道内容处理:
cat article.txt | fabric -p extract_wisdom pbpaste | fabric -p summarize curl -s "https://..." | fabric -p analyze_claims处理 YouTube 视频:fabric 自动处理下载 + 转写 + 处理:
fabric -y "https://youtube.com/watch?v=..." -p youtube_summary链式模式(手动):
# 先提取再摘要 fabric -u "URL" -p extract_wisdom > wisdom.txt cat wisdom.txt | fabric -p create_5_sentence_summary九、从 CLI 到原生执行:LifeOS 的深度集成
原工作流文档是面向fabric CLI的,但 LifeOS 仓库中的 Fabric 技能本体 展示了更进一步的设计——原生模式执行(Native Pattern Execution):
- 大多数模式无需 CLI 往返:LifeOS 直接读取
Patterns/{pattern_name}/system.md,把模式的指令作为提示词直接应用,避免外部 CLI 调用的延迟与依赖 - 仅两种场景需要 fabric CLI:
-y URL:YouTube 转写提取-u URL:URL 内容抓取(当原生抓取失败时回退)
每个模式的system.md遵循统一结构(可查看 execute_wisdom/system.md 等真实文件):
- IDENTITY(AI 应扮演的角色)
- PURPOSE(要达成的目标)
- STEPS(如何处理输入)
- OUTPUT(结构化输出格式)
例如extract_wisdom的输出格式包含SUMMARY、IDEAS(20-50 条)、INSIGHTS(10-20 条)、QUOTES(15-30 条)、HABITS、FACTS、REFERENCES、ONE-SENTENCE TAKEAWAY、RECOMMENDATIONS等结构化区块;summarize则输出ONE SENTENCE SUMMARY+MAIN POINTS(10 条,每条 ≤16 词)+TAKEAWAYS(5 条);analyze_claims会对每条论断给出CLAIM、CLAIM SUPPORT EVIDENCE、CLAIM REFUTATION EVIDENCE、LOGICAL FALLACIES、CLAIM RATING(A-F 分级)、LABELS以及OVERALL SCORE与OVERALL ANALYSIS。
ExecutePattern 工作流与自动收割(Auto-Harvest)
ExecutePattern 工作流 给出了原生执行的四步流程:意图识别 → 读取system.md→ 直接应用模式 → 按规格输出。其中值得注意的两个设计:
- URL 特殊处理:YouTube 用
fabric -y(原生处理转写,不要用 WebFetch 抓 YouTube 页面);遇到 CAPTCHA 或反爬时用fabric -u回退。 - Auto-Harvest 侧效应:当选择的模式属于summarize 家族(
summarize、create_5_sentence_summary、create_micro_summary、summarize_paper、summarize_lecture、summarize_newsletter、summarize_meeting、summarize_debate、youtube_summary),且输入为 URL 或 ≥200 字符的文本时,会在后台并行触发知识摄入(harvest)技能,实现"一次动作、两份产出"——聊天窗口得到摘要,磁盘上得到 KNOWLEDGE 笔记。该侧效应遵循失败隔离原则:收割失败绝不抑制摘要输出;且遵守幂等性,重复摘要同一 URL 只返回duplicate状态,不会重复写笔记。
常见坑(Gotchas)
- YouTube 提取必须用
fabric -y URL,不要直接抓取 YouTube 页面 - 模式名称必须精确:
extract_wisdom不是extractwisdom;拿不准时用fabric --list核对 - 长内容可能超出模式上下文限制:对于超长输入,先切块或用摘要模式先行压缩
- 执行日志:每次工作流完成后,向
~/.claude/LIFEOS/MEMORY/SKILLS/execution.jsonl追加一行 JSONL 记录(含时间戳、技能名、工作流名、输入摘要、状态、耗时),失败时记录status: "error"
十、核心洞察
该技能的价值在于为任务选择"正确"的模式。
当用户说 "Create a threat model using Fabric" 时,正确的动作是:
- 识别 "threat model" 意图
- 知道可用选项:
create_threat_model、create_stride_threat_model、create_threat_scenarios - 选择最佳匹配(通常默认
create_threat_model,除非用户明确指定 STRIDE) - 立即执行:
fabric "[content]" -p create_threat_model
错误做法:"以下是所有模式,你挑一个吧"。正确做法:"我将使用create_threat_model来处理" → 立即执行。
这一"直接行动"哲学贯穿整个工作流:模式选择的准确性直接决定输出质量,而 LifeOS 将其进一步演进为"选择后原生执行",让 240+ 个专业提示词真正成为随手可用的能力库。
十一、延伸阅读
- Fabric 技能主文档:原生执行机制、模式类别统计、变更日志与执行日志规范
- ExecutePattern 工作流:原生执行四步流程、Auto-Harvest 侧效应、错误处理模板
- UpdatePatterns 工作流:模式更新、同步与验证的完整命令
- 模式目录:240+ 模式的实际存放位置,每个模式目录下含
system.md - 模式一句话说明:快速浏览全部模式用途
- Research 技能主文档:Fabric 工作流在整体多智能体研究体系中的路由位置
【免费下载链接】LifeOS⛰️ The Life Operating System — an intent engineering platform that moves you from your current state to your ideal state, in life and work.项目地址: https://gitcode.com/GitHub_Trending/pe/LifeOS
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考