← 知识整理
独立开发 / 知识整理 · 中文

newtype 杂项实战:llms.txt 协议 + CrewAI Obsidian 项目 + n8n MCP 工作流

newtype 收录的 3 个独立实战参考。llms.txt 综合指南(网络新提案 2 种 = Access Control Model 类 robots.txt + Inference Guidance Model Markdown 格式 + 工具生态 llms_txt2ctx)/ CrewAI_Obsidian 完整 Python 项目(3 Agent: Research Analyst + Content Editor + Note Taker + Tavily 搜索 + GPT-4 turbo + 写入 Obsidian Vault)/ n8n MCP 配置(MCP Server + MCP Trigger 双工作流:智能 routing 简单 vs Deep Research + LangChain Agent)

资料来源:Newtype · 本站发布:2026-09-26 · 笔记更新:2026-05-17

AI 项目实践多 Agent自动化工作流

何时打开:三个独立但相关的实战参考。

  • llms.txt:你做网站,要不要给 LLM 适配,看这份
  • CrewAI Obsidian:newtype 早期 (2024-05) 多 Agent 实战,3 个 Agent + Tavily + 写 Obsidian
  • n8n MCP:把 n8n workflow 当 MCP Server 让 Claude 调,智能 routing simple vs deep research

一、llms.txt 综合指南(网络新提案)

1.1 是什么 + 现状

llms.txt 是一个新兴的网络标准提案,管理 LLM 如何与网站内容交互。

关键判断:

  • 目前还是社区提案阶段,不是正式标准
  • 由开发者 / 公司提出,希望各方采纳后才能成为标准
  • 目前存在两种格式互不兼容的提案(无法在根目录同时放两个)

1.2 提案 A:Access Control Model(类 robots.txt)

目标:控制网站内容是否被用于模型训练。

格式:指令: 值 对(纯文本,跟 robots.txt 一致)。

主要指令:

指令 用途
user-agent 指定规则适用的模型 / 爬虫(* 代表所有)
allow / disallow 允许 / 禁止访问特定路径
license 链接到许可协议(如 Creative Commons)
crawl-delay 爬虫两次抓取最小间隔(秒)
sitemap 站点地图 URL

示例:

# 禁止所有模型将本站内容用于训练
user-agent: *
disallow: /

# 但允许 some-good-bot,限速
user-agent: some-good-bot
allow: /
crawl-delay: 10

# 用 Creative Commons 非商业 4.0
license: https://creativecommons.org/licenses/by-nc/4.0/

1.3 提案 B:Inference Guidance Model(Markdown 格式)

目标:解决 LLM 上下文窗口有限的问题。用简洁 Markdown 文件帮 LLM 快速理解网站核心内容和结构,在用户提问时表现更像"专家"。

核心动机:

  • 提升 LLM 推理时对网站的理解和使用效率
  • 克服解析复杂 HTML(导航 / 广告 / JS)的困难
  • 为软件文档、API 参考、业务介绍等场景提供 AI 友好的入口

文件结构:

  • 必需:
    • H1 标题:网站 / 项目名称
    • Blockquote 摘要:关键信息简短摘要
  • 可选:
    • H2 分隔的部分:更详细的说明或链接列表
    • 文件列表:Markdown 链接 [名称](URL) + 说明
    • Optional 部分:次要信息,短上下文可跳过

示例(FastHTML 项目):

# FastHTML
> FastHTML 是一个 Python 库,用于创建服务器渲染的超媒体应用。它结合了 Starlette, Uvicorn, HTMX 和 fastcore。

重要说明:
- API 设计受 FastAPI 启发,但不兼容其语法。
- 不支持 React, Vue, 或 Svelte 等 JS 框架。

## 文档
- [快速入门](https://www.fastht.ml/docs/quickstart.html): 安装和基本使用指南
- [教程](https://www.fastht.ml/docs/tutorials/by_example.html): 通过示例学习高级功能

## Optional (可选)
- [高级 API](https://www.fastht.ml/docs/api.html): 详细接口参考

1.4 工具生态(提案 B)

  • CLI:llms_txt2ctx — 解析和生成 LLM 上下文文件
  • 框架插件:vitepress-plugin-llms、docusaurus-plugin-llms、Drupal LLM
  • 库:llms-txt-php、llmstxt-js — 不同语言读写 llms.txt

1.5 关键 Q&A

Q A
llms.txt vs robots.txt robots 控制搜索抓取;llms-A 控制训练用途;llms-B 是 推理上下文(robots 完全不具备)
如何选提案 控制训练 → 提案 A;帮 LLM 推理 → 提案 B
能同时实现两者吗 折衷:robots.txt 实现 A + llms.txt(Markdown)实现 B
模型支持情况 目前仅提案,等大厂采纳

1.6 跟 Karpathy · Software in the era of AI(Software 3.0) 的连接

Karpathy 在他的 Software 3.0 演讲里提出"为 Agent 重写基础设施" —— llms.txt + AGENTS.md 是这条路上的标志性提案。


二、CrewAI_Obsidian 项目(2024-05 早期多 Agent 实战)

2.1 项目结构

CrewAI_Obsidian/
├── gpt.py                          # 主入口 84 行
├── requirements.txt                # 依赖
└── tools/
    ├── __init__.py
    └── custom_tools.py             # 31 行,自定义 Obsidian 写入工具

2.2 核心架构

3 个 Agent(CrewAI 多角色):

Agent role 工具 任务
researcher Research Analyst Tavily 搜索 调研主题,产 report
editor Content Editor (无,纯 LLM) 总结、生成有用 notes
note_taker Note Taker store_note_to_obsidian 把 notes 存到 Obsidian Vault

3 个 Task:research → edit → save to Obsidian

2.3 关键 — Obsidian 写入工具

from langchain.tools import tool
import datetime
import os

class CustomTools():
    @tool("Write File with content")
    def store_note_to_obsidian(content: str) -> str:
        """Useful to write a note to the note taking app obsidian.
           The input to this tool should be a markdown text and 
           is the content of the file you will store on disk.
           """
        try:
            obsidian_dir = r'C:\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\Obsidian Vault'
            current_datetime = datetime.datetime.now()
            formatted_date = current_datetime.strftime("%Y-%m-%d_%H-%M-%S")
            filename = f"crewai_note_{formatted_date}.md"
            full_path = os.path.join(obsidian_dir, filename)
            
            with open(full_path, 'w') as file:
                file.write(content)
            
            return f"File written to {filename}."
        except Exception:
            return "Error with the input for the tool."

2.4 gpt.py 完整流程(简化版)

from crewai import Agent, Task, Crew
from tools.custom_tools import CustomTools
from langchain.utilities.tavily_search import TavilySearchAPIWrapper
from langchain.tools.tavily_search import TavilySearchResults
from langchain_community.chat_models import ChatOpenAI

# 1. 配置 Tavily 搜索 + GPT-4 Turbo
search = TavilySearchAPIWrapper()
search_tool = TavilySearchResults(api_wrapper=search)
llm_gpt4 = ChatOpenAI(model_name="gpt-4-turbo", temperature=0.2)

# 2. 定义 3 个 Agent
researcher = Agent(
    role='Research Analyst',
    goal='Research and create reports',
    tools=[search_tool],
    llm=llm_gpt4,
)
editor = Agent(role='Content Editor', goal='Summarize content', llm=llm_gpt4)
note_taker = Agent(
    role='Note Taker',
    goal='Save content as note',
    tools=[CustomTools.store_note_to_obsidian],
    llm=llm_gpt4,
)

# 3. 定义 3 个 Task
task1 = Task(description="Research how to use obsidian", agent=researcher)
task2 = Task(description="Create a note", agent=editor)
task3 = Task(description="Save the content as a note to Obsidian", agent=note_taker)

# 4. 编排 Crew
crew = Crew(
    agents=[researcher, editor, note_taker],
    tasks=[task1, task2, task3],
    verbose=2
)
result = crew.kickoff()

2.5 这个项目的历史意义

  • 2024-05 newtype 的早期多 Agent 实战
  • 体现 newtype 关注的 3 个核心:
    1. 多 Agent 编排(CrewAI)
    2. Tavily 搜索 + GPT-4 Turbo(技术栈)
    3. 写入 Obsidian Vault(知识沉淀)
  • 跟 newtype 知识系统与 Life OS 全演化 演化路径一致:最早就是用 Agent 帮自己写笔记

三、n8n MCP 工作流(2025-08)

3.1 整体架构(2 个 workflow)

[Claude / 外部 AI] ─MCP─→ MCP Trigger 工作流
                            ↓
                         调用 MCP Server 工作流
                            ↓
                      Basic LLM Chain (路由)
                       ↓                    ↓
                  简单 → output "1"      复杂 → output "2"
                       ↓                    ↓
                    简单回答            Deep Research Agent
                                          (gpt-4.1-mini)

3.2 MCP Server 工作流(mcp server.json)

节点 1:Execute Workflow Trigger

  • 接收外部输入:query 字段

节点 2:Basic LLM Chain(路由器)

  • Prompt:
    If the request is simple, output "1"
    If the request is complex and needs Deep Research, output "2"
    
  • 模型:gpt-4.1-mini

节点 3:Agent

  • System message:"You are an excellent researcher"
  • 接 OpenAI Chat model
  • 处理复杂 query

3.3 MCP Trigger 工作流(mcp trigger.json)

节点 1:MCP Trigger(@n8n/n8n-nodes-langchain.mcpTrigger)

  • Webhook path:6b7ac372-41cc-4ba0-84a3-e0d27bdb78b9
  • 这是 n8n 暴露给 Claude / 其他 AI 的 MCP 入口

节点 2:Call n8n Workflow Tool(@n8n/n8n-nodes-langchain.toolWorkflow)

  • 内部调用 mcp server workflow
  • 把工具暴露为 ai_tool

3.4 关键模式 — n8n 作为 MCP Server

n8n 现在有 langchain 节点,可以直接把整个 workflow 当作 MCP Tool 暴露

两个关键节点:

  • n8n-nodes-langchain.mcpTrigger:MCP Server 入口(webhook)
  • n8n-nodes-langchain.toolWorkflow:把工作流当工具暴露

3.5 路由设计的简洁性

这个配置展示了 n8n + MCP 的简洁组合:

  • MCP Trigger 接 Claude 的工具调用
  • Routing Chain 简单 / 复杂分类(LLM 自己判断)
  • Agent / Plain LLM 分别处理两种 query

适用场景:

  • 把 n8n 当中央 router
  • Claude 通过 MCP 调 n8n 时,n8n 内部做更复杂的 workflow 编排
  • 比直接给 Claude 加 MCP 灵活(workflow 可视化)

3.6 跟 newtype · MCP 协议与生态实战 的连接

  • newtype 一直认为 MCP + n8n / Dify 这条路是看好的
  • 这份配置是其中一种最简化的实现
  • 体现 MCP 协议的灵活性:n8n 既可以是 MCP client(调用 MCP server),也可以是 MCP server(被 Claude 调用)

四、3 份杂项的统一价值

4.1 共同主题

维度 llms.txt CrewAI_Obsidian n8n MCP
方向 为 AI 重写基础设施 多 Agent + 工具 + 知识沉淀 MCP 跨工具编排
协议层 网络标准提案 LangChain agent + tool MCP server / client
应用 让 AI 更好理解我的网站 让 AI 帮我做研究 让 AI 调用 n8n workflow
时间 2025 提案 2024-05 实战 2025-08 配置
状态 探索期 已落地 已落地

4.2 体现 newtype 的 3 个长期判断

  1. MCP 是标准化协议(跨工具调用)
  2. 多 Agent 协同(researcher + editor + note_taker)
  3. Obsidian 是个人知识终点(从 2024 到 2026 没换)

4.3 给独立开发者的启示

场景 建议
你做网站(SEO + AI 友好) 加 robots.txt(提案 A)+ llms.txt Markdown(提案 B)
你想做多 Agent demo 参考 CrewAI_Obsidian 的 3 Agent + 3 Task + Tavily 模式
你已有 n8n 工作流 加 mcpTrigger 节点,让 Claude 直接调你的 n8n workflow

五、跟其他 wiki 的连接


History

  • 2026-05-17:Phase 5.1 ingest 从 file_019/020(llms.txt 综合指南)+ file_003(CrewAI_Obsidian zip)+ file_018(n8n MCP zip)三份合并写 1 个 wiki。

来源与关联资料