[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-davidkimai--Context-Engineering":3,"tool-davidkimai--Context-Engineering":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",142651,2,"2026-04-06T23:34:12",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":74,"owner_location":74,"owner_email":77,"owner_twitter":74,"owner_website":78,"owner_url":79,"languages":80,"stars":85,"forks":86,"last_commit_at":87,"license":88,"difficulty_score":89,"env_os":90,"env_gpu":91,"env_ram":91,"env_deps":92,"category_tags":95,"github_topics":74,"view_count":32,"oss_zip_url":74,"oss_zip_packed_at":74,"status":17,"created_at":96,"updated_at":97,"faqs":98,"releases":99},4714,"davidkimai\u002FContext-Engineering","Context-Engineering","\"Context engineering is the delicate art and science of filling the context window with just the right information for the next step.\" — Andrej Karpathy. A frontier, first-principles handbook inspired by Karpathy and 3Blue1Brown for moving beyond prompt engineering to the wider discipline of context design, orchestration, and optimization.","Context-Engineering 是一本面向未来的实战指南，旨在帮助开发者从单一的“提示词工程”进阶到更系统的“上下文工程”。正如 Andrej Karpathy 所言，其核心在于掌握向模型上下文窗口填充“恰到好处信息”的艺术与科学。\n\n传统提示词仅关注单条指令，而 Context-Engineering 解决的是如何统筹管理模型在推理时看到的完整信息负载，包括示例、记忆、检索内容、工具状态及控制流等。通过优化这些要素的设计与编排，它能显著提升大模型在复杂任务中的表现，避免因上下文混乱导致的性能下降。\n\n该项目基于对 1400 多篇前沿论文的系统性分析，融合了来自 ICML、IBM 及普林斯顿等机构的最新研究成果。它不仅提供了从第一性原理出发的理论框架，还包含可视化教程、综合课程草案以及适配 Claude Code、Gemini CLI 等多种主流 AI 编程助手的智能体命令集。\n\n无论是希望构建高可靠性 AI 应用的软件工程师、探索模型机制的研究人员，还是致力于优化交互体验的产品设计师，都能从中获得关于上下文设计、编排与优化的深度洞察。它不再局限于“说什么”，而是专注于让模型“","Context-Engineering 是一本面向未来的实战指南，旨在帮助开发者从单一的“提示词工程”进阶到更系统的“上下文工程”。正如 Andrej Karpathy 所言，其核心在于掌握向模型上下文窗口填充“恰到好处信息”的艺术与科学。\n\n传统提示词仅关注单条指令，而 Context-Engineering 解决的是如何统筹管理模型在推理时看到的完整信息负载，包括示例、记忆、检索内容、工具状态及控制流等。通过优化这些要素的设计与编排，它能显著提升大模型在复杂任务中的表现，避免因上下文混乱导致的性能下降。\n\n该项目基于对 1400 多篇前沿论文的系统性分析，融合了来自 ICML、IBM 及普林斯顿等机构的最新研究成果。它不仅提供了从第一性原理出发的理论框架，还包含可视化教程、综合课程草案以及适配 Claude Code、Gemini CLI 等多种主流 AI 编程助手的智能体命令集。\n\n无论是希望构建高可靠性 AI 应用的软件工程师、探索模型机制的研究人员，还是致力于优化交互体验的产品设计师，都能从中获得关于上下文设计、编排与优化的深度洞察。它不再局限于“说什么”，而是专注于让模型“看见”什么，从而释放更强的推理潜能。","\u003Cdiv align=\"center\">\n  \n# Context Engineering\n\n\u003C\u002Fdiv>\n\n\n\u003Cimg width=\"1600\" height=\"400\" alt=\"image\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_37835ce23fa0.png\" \u002F>\n\n> **\"Context engineering is the delicate art and science of filling the context window with just the right information for the next step.\" — [**Andrej Karpathy**](https:\u002F\u002Fx.com\u002Fkarpathy\u002Fstatus\u002F1937902205765607626)**\n>\n> [**Software Is Changing (Again) Talk @YC AI Startup School**](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=LCEmiRjPEtQ)\n\n\u003Cdiv align=\"center\">\n  \n## [![Ask DeepWiki](https:\u002F\u002Fdeepwiki.com\u002Fbadge.svg)](https:\u002F\u002Fdeepwiki.com\u002Fdavidkimai\u002FContext-Engineering)\n\n\u003Cimg width=\"1917\" height=\"360\" alt=\"image\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_dbcd306e95c4.png\" \u002F>\n\n\u003C\u002Fdiv>\n\n\u003Cdiv align=\"center\">\n  \n ## [DeepGraph](https:\u002F\u002Fwww.deepgraph.co\u002Fdavidkimai\u002FContext-Engineering)\n \n## [Chat with NotebookLM + Podcast Deep Dive](https:\u002F\u002Fnotebooklm.google.com\u002Fnotebook\u002F0c6e4dc6-9c30-4f53-8e1a-05cc9ff3bc7e)\n\n## [![Discord](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord-join%20chat-7289DA.svg?logo=discord\")](https:\u002F\u002Fdiscord.gg\u002FJeFENHNNNQ)\n\n\n\u003C\u002Fdiv>\n\n## [Comprehensive Course Under Construction](https:\u002F\u002Fgithub.com\u002Fdavidkimai\u002FContext-Engineering\u002Ftree\u002Fmain\u002F00_COURSE)\n\n> ### **[Context Engineering Survey-Review of 1400 Research Papers](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.13334)**\n>\n> [**Awesome Context Engineering Repo**](https:\u002F\u002Fgithub.com\u002FMeirtz\u002FAwesome-Context-Engineering)\n\nOperationalizing the Latest Research on Context With First Principles & Visuals — July 2025 from ICML, IBM, NeurIPS, OHBM, and more \n\n\n> **\"Providing “cognitive tools” to GPT-4.1 increases its pass@1 performance on AIME2024 from 26.7% to 43.3%, bringing it very close to the performance of o1-preview.\"** — [**IBM Zurich**](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.12115)\n\n\u003Cdiv align=\"center\">\n  \n## [`Agent Commands`](https:\u002F\u002Fgithub.com\u002Fdavidkimai\u002FContext-Engineering\u002Ftree\u002Fmain\u002F.claude\u002Fcommands)\n**Support for [Claude Code](https:\u002F\u002Fwww.anthropic.com\u002Fclaude-code) | [OpenCode](https:\u002F\u002Fopencode.ai\u002F) | [Amp](https:\u002F\u002Fsourcegraph.com\u002Famp) | [Kiro](https:\u002F\u002Fkiro.dev\u002F) | [Codex](https:\u002F\u002Fopenai.com\u002Fcodex\u002F) | [Gemini CLI](https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli)**\n\n#### [Context Engineering Survey-Review of 1400 Research Papers](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.13334) | [Context Rot](https:\u002F\u002Fresearch.trychroma.com\u002Fcontext-rot) | [IBM Zurich](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.12115) | [Quantum Semantics](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2506.10077) | [Emergent Symbolics ICML Princeton](https:\u002F\u002Fopenreview.net\u002Fforum?id=y1SnRPDWx4) | [MEM1 Singapore-MIT](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2506.15841) | [LLM Attractors Shanghai AI](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2502.15208?) | [MemOS Shanghai](https:\u002F\u002Fgithub.com\u002FMemTensor\u002FMemOS) | [Latent Reasoning](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.06203) | [Dynamic Recursive Depths](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.10524)\n\n\n\u003C\u002Fdiv>\n\nA frontier, first-principles handbook for moving beyond prompt engineering to the wider discipline of context design, orchestration, and optimization.\n\n\n```\n                    Prompt Engineering  │  Context Engineering\n                       ↓                │            ↓                      \n               \"What you say\"           │  \"Everything else the model sees\"\n             (Single instruction)       │    (Examples, memory, retrieval,\n                                        │     tools, state, control flow)\n```\n\n## Definition of Context Engineering\n\n> **Context is not just the single prompt users send to an LLM. Context is the complete information payload provided to a LLM at inference time, encompassing all structured informational components that the model needs to plausibly accomplish a given task.**\n>\n> — [**Definition of Context Engineering from A Systematic Analysis of Over 1400 Research Papers**](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.13334)\n\n```\n╭─────────────────────────────────────────────────────────────╮\n│              CONTEXT ENGINEERING MASTERY COURSE             │\n│                    From Zero to Frontier                    │\n╰─────────────────────────────────────────────────────────────╯\n                          ▲\n                          │\n                 Mathematical Foundations\n                  C = A(c₁, c₂, ..., cₙ)\n                          │\n                          ▼\n┌─────────────┬──────────────┬──────────────┬─────────────────┐\n│ FOUNDATIONS │ SYSTEM IMPL  │ INTEGRATION  │ FRONTIER        │\n│ (Weeks 1-4) │ (Weeks 5-8)  │ (Weeks 9-10) │ (Weeks 11-12)   │\n└─────┬───────┴──────┬───────┴──────┬───────┴─────────┬───────┘\n      │              │              │                 │\n      ▼              ▼              ▼                 ▼\n┌─────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐\n│ Math Models │ │ RAG Systems  │ │ Multi-Agent  │ │ Meta-Recurs  │\n│ Components  │ │ Memory Arch  │ │ Orchestrat   │ │ Quantum Sem  │\n│ Processing  │ │ Tool Integr  │ │ Field Theory │ │ Self-Improv  │\n│ Management  │ │ Agent Systems│ │ Evaluation   │ │ Collaboration│\n└─────────────┘ └──────────────┘ └──────────────┘ └──────────────┘\n```\n\n\n## Why This Repository Exists\n\n> **\"Meaning is not an intrinsic, static property of a semantic expression, but rather an emergent phenomenon\"\n— [Agostino et al. — July 2025, Indiana University](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2506.10077)**\n\nPrompt engineering received all the attention, but we can now get excited for what comes next. Once you've mastered prompts, the real power comes from engineering the **entire context window** that surrounds those prompts. Guiding thought, if you will. \n\nThis repository provides a progressive, first-principles approach to context engineering, built around a biological metaphor:\n\n```\natoms → molecules → cells → organs → neural systems → neural & semantic field theory \n  │        │         │         │             │                         │        \nsingle    few-     memory +   multi-   cognitive tools +     context = fields +\nprompt    shot     agents     agents   operating systems     persistence & resonance\n```\n> \"Abstraction is the cost of generalization\"— [**Grant Sanderson (3Blue1Brown)**](https:\u002F\u002Fwww.3blue1brown.com\u002F)\n\n\n\u003Cdiv align=\"center\">\n\n\u003Cimg width=\"931\" height=\"854\" alt=\"image\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_19d7873e02e8.png\" \u002F>\n\n*[A Survey of Context Engineering - July 2025](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.13334)*\n\n\n  \n **[On Emergence, Attractors, and Dynamical Systems Theory](https:\u002F\u002Fcontent.csbs.utah.edu\u002F~butner\u002Fsystems\u002FDynamicalSystemsIntro.html) | [Columbia DST](http:\u002F\u002Fwordpress.ei.columbia.edu\u002Fac4\u002Fabout\u002Four-approach\u002Fdynamical-systems-theory\u002F)**\n\n\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F9f046259-e5ec-4160-8ed0-41a608d8adf3\n\n\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_ce23c7cf8e37.png)\n\n\u003C\u002Fdiv>\n\n\n\n```mermaid\ngraph TD\n    classDef basic fill:#e1f5fe,stroke:#01579b,stroke-width:2px,color:#01579b\n    classDef intermediate fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px,color:#2e7d32\n    classDef advanced fill:#fff3e0,stroke:#e65100,stroke-width:2px,color:#e65100\n    classDef meta fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px,color:#6a1b9a\n    \n    subgraph Basic[\"Level 1: Basic Context Engineering\"]\n        A[Atoms]\n        B[Molecules]\n        C[Cells]\n        D[Organs]\n    end\n    \n    subgraph Field[\"Level 2: Field Theory\"]\n        E[Neural Systems]\n        F[Neural Fields]\n    end\n    \n    subgraph Protocol[\"Level 3: Protocol System\"]\n        G[Protocol Shells]\n        H[Unified System]\n    end\n    \n    subgraph Meta[\"Level 4: Meta-Recursion\"]\n        I[Meta-Recursive Framework]\n    end\n    \n    %% Connections\n    A --> B\n    B --> C\n    C --> D\n    D --> E\n    E --> F\n    F --> G\n    G --> H\n    H --> I\n    \n    %% Descriptions for each level\n    A1[\"Single instructions\u003Cbr>Simple constraints\u003Cbr>Basic prompts\"] --> A\n    B1[\"Example pairs\u003Cbr>Few-shot patterns\u003Cbr>Demonstration sets\"] --> B\n    C1[\"Persistent memory\u003Cbr>State management\u003Cbr>Context window\"] --> C\n    D1[\"Multi-step flows\u003Cbr>Specialists\u003Cbr>System orchestration\"] --> D\n    E1[\"Reasoning frameworks\u003Cbr>Verification tools\u003Cbr>Cognitive patterns\"] --> E\n    F1[\"Continuous meaning\u003Cbr>Attractors & resonance\u003Cbr>Symbolic residue\"] --> F\n    G1[\"Structured templates\u003Cbr>Field operations\u003Cbr>Emergence protocols\"] --> G\n    H1[\"Protocol integration\u003Cbr>System-level emergence\u003Cbr>Self-maintenance\"] --> H\n    I1[\"Self-reflection\u003Cbr>Recursive improvement\u003Cbr>Interpretable evolution\"] --> I\n    \n    %% Real-world parallels\n    A2[\"Like: Basic prompt\u003Cbr>engineering\"] -.-> A\n    B2[\"Like: Few-shot\u003Cbr>learning\"] -.-> B\n    C2[\"Like: Conversational\u003Cbr>chatbots\"] -.-> C\n    D2[\"Like: Multi-agent\u003Cbr>systems\"] -.-> D\n    E2[\"Like: ReAct\u003Cbr>Chain-of-Thought\"] -.-> E\n    F2[\"Like: Semantic\u003Cbr>field theory\"] -.-> F\n    G2[\"Like: Protocol\u003Cbr>orchestration\"] -.-> G\n    H2[\"Like: Self-organizing\u003Cbr>systems\"] -.-> H\n    I2[\"Like: Self-improving\u003Cbr>intelligence\"] -.-> I\n    \n    %% Apply classes\n    class A,B,C,D,A1,A2,B1,B2,C1,C2,D1,D2 basic\n    class E,F,E1,E2,F1,F2 intermediate\n    class G,H,G1,G2,H1,H2 advanced\n    class I,I1,I2 meta\n```\n\n## Quick Start\n\n1. **Read [`00_foundations\u002F01_atoms_prompting.md`](00_foundations\u002F01_atoms_prompting.md)** (5 min)  \n   Understand why prompts alone often underperform\n\n2. **Run [`10_guides_zero_to_hero\u002F01_min_prompt.py`](10_guides_zero_to_hero\u002F01_min_prompt.py)**  (Jupyter Notebook style) \n   Experiment with a minimal working example\n\n3. **Explore [`20_templates\u002Fminimal_context.yaml`](20_templates\u002Fminimal_context.yaml)**  \n   Copy\u002Fpaste a template into your own project  \n\n4. **Study [`30_examples\u002F00_toy_chatbot\u002F`](30_examples\u002F00_toy_chatbot\u002F)**  \n   See a complete implementation with context management\n\n## Learning Path\n\n```\n┌─────────────────┐     ┌──────────────────┐     ┌────────────────┐\n│ 00_foundations\u002F │     │ 10_guides_zero_  │     │ 20_templates\u002F  │\n│                 │────▶│ to_one\u002F          │────▶│                │\n│ Theory & core   │     │ Hands-on         │     │ Copy-paste     │\n│ concepts        │     │ walkthroughs     │     │ snippets       │\n└─────────────────┘     └──────────────────┘     └────────────────┘\n         │                                                │\n         │                                                │\n         ▼                                                ▼\n┌─────────────────┐                             ┌────────────────┐\n│ 40_reference\u002F   │◀───────────────────────────▶│ 30_examples\u002F   │\n│                 │                             │                │\n│ Deep dives &    │                             │ Real projects, │\n│ eval cookbook   │                             │ progressively  │\n└─────────────────┘                             │ complex        │\n         ▲                                      └────────────────┘\n         │                                                ▲\n         │                                                │\n         └────────────────────┐               ┌───────────┘\n                              ▼               ▼\n                         ┌─────────────────────┐\n                         │ 50_contrib\u002F         │\n                         │                     │\n                         │ Community           │\n                         │ contributions       │\n                         └─────────────────────┘\n```\n\n## What You'll Learn\n\n| Concept | What It Is | Why It Matters |\n|---------|------------|----------------|\n| **Token Budget** | Optimizing every token in your context | More tokens = more $$ and slower responses |\n| **Few-Shot Learning** | Teaching by showing examples | Often works better than explanation alone |\n| **Memory Systems** | Persisting information across turns | Enables stateful, coherent interactions |\n| **Retrieval Augmentation** | Finding & injecting relevant documents | Grounds responses in facts, reduces hallucination |\n| **Control Flow** | Breaking complex tasks into steps | Solve harder problems with simpler prompts |\n| **Context Pruning** | Removing irrelevant information | Keep only what's necessary for performance |\n| **Metrics & Evaluation** | Measuring context effectiveness | Iterative optimization of token use vs. quality |\n| **Cognitive Tools & Prompt Programming** | Learm to build custom tools and templates | Prompt programming enables new layers for context engineering |\n| **Neural Field Theory** | Context as a Neural Field | Modeling context as a dynamic neural field allows for iterative context updating |\n| **Symbolic Mechanisms** | Symbolic architectures enable higher order reasoning | Smarter systems = less work |\n| **Quantum Semantics** |  Meaning as observer-dependent  | Design context systems leveraging superpositional techniques |\n\n\n\n## Karpathy + 3Blue1Brown Inspired Style\n\n> For learners of all experience levels\n\n1. **First principles** – start with the fundamental context\n2. **Iterative add-on** – add only what the model demonstrably lacks\n3. **Measure everything** – token cost, latency, quality score\n4. **Delete ruthlessly** – pruning beats padding\n5. **Code > slides** – every concept has a runnable cell\n6. **Visualize everything** — every concept is visualized with ASCII and symbolic diagrams\n\n# Research Evidence \n## Memory + Reasoning\n\n### **[MEM1: Learning to Synergize Memory and Reasoning for Efficient Long-Horizon Agents - Singapore-MIT June 2025](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.15841)**\n\n> “Our results demonstrate the promise of reasoning-driven memory consolidation as a scalable alternative to existing solutions for training long-horizon interactive agents, where both efficiency and performance are optimized.\" — [Singapore-MIT](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2506.15841)\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_76a48299c047.png)\n\n1. **MEM1 trains AI agents to keep only what matters—merging memory and reasoning at every step—so they never get overwhelmed, no matter how long the task.**\n\n2. **Instead of piling up endless context, MEM1 compresses each interaction into a compact “internal state,” just like a smart note that gets updated, not recopied.**\n\n3. **By blending memory and thinking into a single flow, MEM1 learns to remember only the essentials—making agents faster, sharper, and able to handle much longer conversations.**\n\n4. **Everything the agent does is tagged and structured, so each action, question, or fact is clear and easy to audit—no more mystery meat memory.**\n\n5. **With every cycle, old clutter is pruned and only the latest, most relevant insights are carried forward, mirroring how expert problem-solvers distill their notes.**\n\n6. **MEM1 proves that recursive, protocol-driven memory—where you always refine and integrate—outperforms traditional “just add more context” approaches in both speed and accuracy.**\n## Cognitive Tools\n\n### **[Eliciting Reasoning in Language Models with Cognitive Tools - IBM Zurich June 2025](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.12115)**\n\n### Prompts and Prompt Programs as Reasoning Tool Calls\n> “Cognitive tools” encapsulate reasoning operations within the LLM itself — [IBM Zurich](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.12115)\n\n\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_c0a51289bbe5.png)\n\n> **These cognitive tools (structured prompt templates as tool calls) break down the problem by identifying the main concepts at hand, extracting relevant information in the question, and highlighting meaningful properties, theorems, and techniques that\nmight be helpful in solving the problem.**\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_ef67c3ed7ada.png)\n\n\n> **These templates scaffold reasoning layers similar to cognitive mental shortcuts, commonly studied as \"heuristics\".**\n\n1. **This research shows that breaking complex tasks into modular “cognitive tools” lets AI solve problems more thoughtfully—mirroring how expert humans reason step by step.**\n\n2. **Instead of relying on a single, big prompt, the model calls specialized prompt templates, aka cognitive tools like “understand question,” “recall related,” “examine answer,” and “backtracking”—each handling a distinct mental operation.**\n\n3. **Cognitive tools work like inner mental shortcuts: the AI picks the right program at each stage and runs it to plan its reasoning and downstream actions before conducting the task for greater accuracy and flexibility.**\n\n4. **By compartmentalizing reasoning steps into modular blocks, these tools prevent confusion, reduce error, and make the model’s thought process transparent and auditable—even on hard math problems.**\n\n5. **This modular approach upgrades both open and closed models—boosting real-world math problem-solving and approaching the performance of advanced RL-trained “reasoning” models, without extra training.**\n\n6. **The results suggest that the seeds of powerful reasoning are already inside large language models—cognitive tools simply unlock and orchestrate these abilities, offering a transparent, efficient, and interpretable alternative to black-box tuning.**\n## Emergent Symbols\n\n## **[Emergent Symbolic Mechanisms Support Abstract Reasoning in Large Language Models - ICML Princeton June 18, 2025](https:\u002F\u002Fopenreview.net\u002Fforum?id=y1SnRPDWx4)**\n\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_b1ad1fe409d6.png)\n\n> **TL;DR: A three-stage architecture is identified that supports abstract reasoning in LLMs via a set of emergent symbol-processing mechanisms.**\n>\n>\n\n\n**These include symbolic induction heads, symbolic abstraction heads, and retrieval heads.**\n\n**1. In early layers, symbol abstraction heads convert input tokens to abstract variables based on the relations between those tokens.**\n\n**2. In intermediate layers, symbolic induction heads perform sequence induction over these abstract variables.**\n\n**3. Finally, in later layers, retrieval heads predict the next token by retrieving the value associated with the predicted abstract variable.**\n\n**These results point toward a resolution of the longstanding debate between symbolic and neural network approaches, suggesting that emergent reasoning in neural networks depends on the emergence of symbolic mechanisms.** — [**ICML Princeton**](https:\u002F\u002Fopenreview.net\u002Fforum?id=y1SnRPDWx4) \n\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_784098ed9abf.png)\n\n\n>\n> **Why Useful?**\n>\n>\n> **This supports why Markdown, Json, and similar structured, symbolic formats are more easily LLM parsable**\n>\n> **Concept: Collaborate with agents to apply delimiters, syntax, symbols, symbolic words, metaphors and structure to improve reasoning\u002Fcontext\u002Fmemory\u002Fpersistence during inference**\n\n1. **This paper proves that large language models develop their own inner symbolic “logic circuits”—enabling them to reason with abstract variables, not just surface word patterns.**\n\n2. **LLMs show a three-stage process: first abstracting symbols from input, then reasoning over these variables, and finally mapping the abstract answer back to real-world tokens.**\n\n3. **These emergent mechanisms mean LLMs don’t just memorize—they actually create internal, flexible representations that let them generalize to new problems and analogies.**\n\n4. **Attention heads in early layers act like “symbol extractors,” intermediate heads perform symbolic reasoning, and late heads retrieve the concrete answer—mirroring human-like abstraction and retrieval.**\n\n5. **By running targeted experiments and interventions, the authors show these symbolic processes are both necessary and sufficient for abstract reasoning, across multiple models and tasks.**\n\n6. **The results bridge the historic gap between symbolic AI and neural nets—showing that, at scale, neural networks can invent and use symbolic machinery, supporting real generalization and reasoning.**\n\n\n\n## Star History\n\n[![Star History Chart](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_718c15a30659.png)](https:\u002F\u002Fwww.star-history.com\u002F#davidkimai\u002FContext-Engineering&Date)\n\n## Contributing\n\nWe welcome contributions! Check out [CONTRIBUTING.md](.github\u002FCONTRIBUTING.md) for guidelines.\n\n## License\n\n[MIT License](LICENSE)\n\n## Citation\n\n```bibtex\n@misc{context-engineering,\n  author = {Context Engineering Contributors},\n  title = {Context Engineering: Beyond Prompt Engineering},\n  year = {2025},\n  publisher = {GitHub},\n  url = {https:\u002F\u002Fgithub.com\u002Fdavidkimai\u002Fcontext-engineering}\n}\n```\n\n## Acknowledgements\n> I've been looking forward to this being conceptualized and formalized as there wasn't a prior established field. Prompt engineering receives quite the stigma and doesn't quite cover what most researchers and I do.\n\n- [Andrej Karpathy](https:\u002F\u002Fx.com\u002Fkarpathy\u002Fstatus\u002F1937902205765607626) for coining \"context engineering\" and inspiring this repo \n- All contributors and the open source community\n","\u003Cdiv align=\"center\">\n  \n# 上下文工程\n\n\u003C\u002Fdiv>\n\n\n\u003Cimg width=\"1600\" height=\"400\" alt=\"image\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_37835ce23fa0.png\" \u002F>\n\n> **“上下文工程是一门精妙的艺术与科学，旨在为下一步操作恰到好处地填充上下文窗口。” — [**安德烈·卡帕西**](https:\u002F\u002Fx.com\u002Fkarpathy\u002Fstatus\u002F1937902205765607626)**\n>\n> [**软件再次变革：YC AI 创业学校演讲**](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=LCEmiRjPEtQ)\n\n\u003Cdiv align=\"center\">\n  \n## [![Ask DeepWiki](https:\u002F\u002Fdeepwiki.com\u002Fbadge.svg)](https:\u002F\u002Fdeepwiki.com\u002Fdavidkimai\u002FContext-Engineering)\n\n\u003Cimg width=\"1917\" height=\"360\" alt=\"image\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_dbcd306e95c4.png\" \u002F>\n\n\u003C\u002Fdiv>\n\n\u003Cdiv align=\"center\">\n  \n ## [DeepGraph](https:\u002F\u002Fwww.deepgraph.co\u002Fdavidkimai\u002FContext-Engineering)\n \n## [与 NotebookLM 聊天 + 播客深度解析](https:\u002F\u002Fnotebooklm.google.com\u002Fnotebook\u002F0c6e4dc6-9c30-4f53-8e1a-05cc9ff3bc7e)\n\n## [![Discord](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord-join%20chat-7289DA.svg?logo=discord\")](https:\u002F\u002Fdiscord.gg\u002FJeFENHNNNQ)\n\n\n\u003C\u002Fdiv>\n\n## [综合课程正在建设中](https:\u002F\u002Fgithub.com\u002Fdavidkimai\u002FContext-Engineering\u002Ftree\u002Fmain\u002F00_COURSE)\n\n> ### **[上下文工程调查——1400篇研究论文综述](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.13334)**\n>\n> [**超棒的上下文工程仓库**](https:\u002F\u002Fgithub.com\u002FMeirtz\u002FAwesome-Context-Engineering)\n\n以第一性原理和可视化方式落地关于上下文的最新研究——2025年7月来自 ICML、IBM、NeurIPS、OHBM 等\n\n\n> **“为 GPT-4.1 提供‘认知工具’后，其在 AIME2024 中的 pass@1 准确率从 26.7% 提升至 43.3%，使其性能非常接近 o1-preview。”** — [**IBM 苏黎世研究院**](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.12115)\n\n\u003Cdiv align=\"center\">\n  \n## [`Agent Commands`](https:\u002F\u002Fgithub.com\u002Fdavidkimai\u002FContext-Engineering\u002Ftree\u002Fmain\u002F.claude\u002Fcommands)\n**支持 [Claude Code](https:\u002F\u002Fwww.anthropic.com\u002Fclaude-code) | [OpenCode](https:\u002F\u002Fopencode.ai\u002F) | [Amp](https:\u002F\u002Fsourcegraph.com\u002Famp) | [Kiro](https:\u002F\u002Fkiro.dev\u002F) | [Codex](https:\u002F\u002Fopenai.com\u002Fcodex\u002F) | [Gemini CLI](https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli)**\n\n#### [上下文工程调查——1400篇研究论文综述](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.13334) | [上下文退化](https:\u002F\u002Fresearch.trychroma.com\u002Fcontext-rot) | [IBM 苏黎世研究院](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.12115) | [量子语义学](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2506.10077) | [ICML 普林斯顿的涌现符号学](https:\u002F\u002Fopenreview.net\u002Fforum?id=y1SnRPDWx4) | [MEM1 新加坡-MIT](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2506.15841) | [上海人工智能实验室的 LLM 吸引子](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2502.15208?) | [MemOS 上海](https:\u002F\u002Fgithub.com\u002FMemTensor\u002FMemOS) | [潜在推理](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.06203) | [动态递归深度](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.10524)\n\n\n\u003C\u002Fdiv>\n\n一本前沿且基于第一性原理的手册，旨在超越提示工程，迈向更广泛的上下文设计、编排与优化领域。\n\n\n```\n                    提示工程  │  上下文工程\n                       ↓                │            ↓                      \n               “你说了什么”           │  “模型所见的一切其他内容”\n             (单条指令)       │    (示例、记忆、检索、\n                                        │     工具、状态、控制流)\n```\n\n## 上下文工程的定义\n\n> **上下文不仅仅是用户发送给 LLM 的单一提示。上下文是在推理时提供给 LLM 的完整信息载荷，涵盖了模型为合理完成特定任务所需的所有结构化信息组件。**\n>\n> — [**基于对超过1400篇研究论文的系统分析得出的上下文工程定义**](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.13334)\n\n```\n╭─────────────────────────────────────────────────────────────╮\n│              上下文工程精通课程             │\n│                    从零到前沿                    │\n╰─────────────────────────────────────────────────────────────╯\n                          ▲\n                          │\n                 数学基础\n                  C = A(c₁, c₂, ..., cₙ)\n                          │\n                          ▼\n┌─────────────┬──────────────┬──────────────┬─────────────────┐\n│ 基础        │ 系统实现     │ 集成         │ 前沿            │\n│ (第1–4周)   │ (第5–8周)    │ (第9–10周)   │ (第11–12周)     │\n└─────┬───────┴──────┬───────┴──────┬───────┴─────────┬───────┘\n      │              │              │                 │\n      ▼              ▼              ▼                 ▼\n┌─────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐\n│ 数学模型    │ │ RAG 系统     │ │ 多智能体     │ │ 元递归        │\n│ 组件        │ │ 内存架构     │ │ 编排理论     │ │ 量子语义学    │\n│ 处理        │ │ 工具集成     │ │ 评估         │ │ 协作          │\n│ 管理        │ │ 代理系统     │ │ 评价         │ │ 自我提升      │\n└─────────────┘ └──────────────┘ └──────────────┘ └──────────────┘\n```\n\n## 为什么存在这个仓库\n\n> **“意义并不是语义表达的内在、静态属性，而是一种涌现现象”**\n> — [Agostino 等人 — 2025年7月，印第安纳大学](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2506.10077)\n\n提示工程曾备受关注，但现在我们可以期待接下来的发展。一旦你掌握了提示词的运用，真正的力量就来自于对围绕这些提示词的**整个上下文窗口**进行工程化设计。换句话说，就是引导思维的过程。\n\n本仓库提供了一种基于生物隐喻的、由浅入深的上下文工程方法论：\n\n```\n原子 → 分子 → 细胞 → 器官 → 神经系统 → 神经与语义场理论 \n  │        │         │         │             │                         │        \n单个    少量     记忆 +   多代理   认知工具 +     上下文 = 场 +\n提示    示例     代理      代理   操作系统     持久性 & 共振\n```\n> “抽象是泛化的代价”——[**Grant Sanderson (3Blue1Brown)**](https:\u002F\u002Fwww.3blue1brown.com\u002F)\n\n\n\u003Cdiv align=\"center\">\n\n\u003Cimg width=\"931\" height=\"854\" alt=\"image\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_19d7873e02e8.png\" \u002F>\n\n*[上下文工程综述 - 2025年7月](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2507.13334)*\n\n\n  \n **[关于涌现、吸引子与动力系统理论](https:\u002F\u002Fcontent.csbs.utah.edu\u002F~butner\u002Fsystems\u002FDynamicalSystemsIntro.html) | [哥伦比亚大学 DST](http:\u002F\u002Fwordpress.ei.columbia.edu\u002Fac4\u002Fabout\u002Four-approach\u002Fdynamical-systems-theory\u002F)**\n\n\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F9f046259-e5ec-4160-8ed0-41a608d8adf3\n\n\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_ce23c7cf8e37.png)\n\n\u003C\u002Fdiv>\n\n\n\n```mermaid\ngraph TD\n    classDef basic fill:#e1f5fe,stroke:#01579b,stroke-width:2px,color:#01579b\n    classDef intermediate fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px,color:#2e7d32\n    classDef advanced fill:#fff3e0,stroke:#e65100,stroke-width:2px,color:#e65100\n    classDef meta fill:#f3e5f5,stroke:#6a1b9a,stroke-width:2px,color:#6a1b9a\n    \n    subgraph Basic[\"第一层：基础上下文工程\"]\n        A[原子]\n        B[分子]\n        C[细胞]\n        D[器官]\n    end\n    \n    subgraph Field[\"第二层：场理论\"]\n        E[神经系统]\n        F[神经场]\n    end\n    \n    subgraph Protocol[\"第三层：协议体系\"]\n        G[协议壳]\n        H[统一系统]\n    end\n    \n    subgraph Meta[\"第四层：元递归\"]\n        I[元递归框架]\n    end\n    \n    %% 连接线\n    A --> B\n    B --> C\n    C --> D\n    D --> E\n    E --> F\n    F --> G\n    G --> H\n    H --> I\n    \n    %% 各层级描述\n    A1[\"单条指令\u003Cbr>简单约束\u003Cbr>基础提示\"] --> A\n    B1[\"示例对\u003Cbr>少样本模式\u003Cbr>演示集\"] --> B\n    C1[\"持久记忆\u003Cbr>状态管理\u003Cbr>上下文窗口\"] --> C\n    D1[\"多步流程\u003Cbr>专家角色\u003Cbr>系统编排\"] --> D\n    E1[\"推理框架\u003Cbr>验证工具\u003Cbr>认知模式\"] --> E\n    F1[\"持续意义\u003Cbr>吸引子与共振\u003Cbr>符号残留\"] --> F\n    G1[\"结构化模板\u003Cbr>场操作\u003Cbr>涌现协议\"] --> G\n    H1[\"协议集成\u003Cbr>系统级涌现\u003Cbr>自我维持\"] --> H\n    I1[\"自我反思\u003Cbr>递归改进\u003Cbr>可解释的演化\"] --> I\n    \n    %% 现实类比\n    A2[\"类似：基础提示\u003Cbr>工程\"] -.-> A\n    B2[\"类似：少样本\u003Cbr>学习\"] -.-> B\n    C2[\"类似：对话式\u003Cbr>聊天机器人\"] -.-> C\n    D2[\"类似：多智能体\u003Cbr>系统\"] -.-> D\n    E2[\"类似：ReAct\u003Cbr>思维链\"] -.-> E\n    F2[\"类似：语义\u003Cbr>场理论\"] -.-> F\n    G2[\"类似：协议\u003Cbr>编排\"] -.-> G\n    H2[\"类似：自组织\u003Cbr>系统\"] -.-> H\n    I2[\"类似：自我提升\u003Cbr>智能\"] -.-> I\n    \n    %% 应用样式\n    class A,B,C,D,A1,A2,B1,B2,C1,C2,D1,D2 basic\n    class E,F,E1,E2,F1,F2 intermediate\n    class G,H,G1,G2,H1,H2 advanced\n    class I,I1,I2 meta\n```\n\n## 快速入门\n\n1. **阅读 [`00_foundations\u002F01_atoms_prompting.md`](00_foundations\u002F01_atoms_prompting.md)**（5分钟）  \n   了解为什么仅靠提示词往往效果不佳\n\n2. **运行 [`10_guides_zero_to_hero\u002F01_min_prompt.py`](10_guides_zero_to_hero\u002F01_min_prompt.py)**（Jupyter Notebook 风格）  \n   体验一个最小可行示例\n\n3. **探索 [`20_templates\u002Fminimal_context.yaml`](20_templates\u002Fminimal_context.yaml)**  \n   将模板复制到你的项目中\n\n4. **研究 [`30_examples\u002F00_toy_chatbot\u002F`](30_examples\u002F00_toy_chatbot\u002F)**  \n   查看包含上下文管理的完整实现\n\n## 学习路径\n\n```\n┌─────────────────┐     ┌──────────────────┐     ┌────────────────┐\n│ 00_foundations\u002F │     │ 10_guides_zero_  │     │ 20_templates\u002F  │\n│                 │────▶│ to_one\u002F          │────▶│                │\n│ 理论与核心    │     │ 实战指导         │     │ 复制粘贴       │\n│ 概念          │     │ 演示 walkthroughs│     │ 片段           │\n└─────────────────┘     └──────────────────┘     └────────────────┘\n         │                                                │\n         │                                                │\n         ▼                                                ▼\n┌─────────────────┐                             ┌────────────────┐\n│ 40_reference\u002F   │◀───────────────────────────▶│ 30_examples\u002F   │\n│                 │                             │                │\n│ 深度解析 &    │                             │ 实际项目、     │\n│ 评估手册      │                             │ 逐步复杂       │\n└─────────────────┘                             │ 的实现         │\n         ▲                                      └────────────────┘\n         │                                                ▲\n         │                                                │\n         └────────────────────┐               ┌───────────┘\n                              ▼               ▼\n                         ┌─────────────────────┐\n                         │ 50_contrib\u002F         │\n                         │                     │\n                         │ 社区贡献          │\n                         │                    │\n                         └─────────────────────┘\n```\n\n## 你将学到的内容\n\n| 概念 | 是什么 | 为什么重要 |\n|---------|------------|----------------|\n| **Token预算** | 优化上下文中的每一个token | 更多的token意味着更高的成本和更慢的响应 |\n| **少样本学习** | 通过展示示例进行教学 | 通常比单独的解释效果更好 |\n| **记忆系统** | 在多次交互中持久化信息 | 实现有状态、连贯的交互 |\n| **检索增强** | 查找并注入相关文档 | 使回答基于事实，减少幻觉 |\n| **控制流** | 将复杂任务分解为步骤 | 用更简单的提示解决更难的问题 |\n| **上下文修剪** | 移除不相关信息 | 只保留对性能必要的内容 |\n| **指标与评估** | 衡量上下文的有效性 | 迭代优化token使用与质量之间的平衡 |\n| **认知工具与提示编程** | 学习构建自定义工具和模板 | 提示编程为上下文工程提供了新的层次 |\n| **神经场理论** | 上下文作为神经场 | 将上下文建模为动态神经场，允许迭代更新上下文 |\n| **符号机制** | 符号架构支持高阶推理 | 更智能的系统意味着更少的工作量 |\n| **量子语义学** | 意义依赖于观察者 | 设计利用叠加技术的上下文系统 |\n\n\n\n## 卡帕西 + 3Blue1Brown 风格\n\n> 适合所有经验水平的学习者\n\n1. **第一性原理** – 从最基本的上下文开始\n2. **迭代添加** – 只添加模型明显缺乏的部分\n3. **测量一切** – token成本、延迟、质量评分\n4. **无情删除** – 修剪胜过填充\n5. **代码 > 幻灯片** – 每个概念都有可运行的代码单元\n6. **可视化一切** — 每个概念都用ASCII和符号图示进行可视化\n\n# 研究证据 \n## 记忆 + 推理\n\n### **[MEM1：学习协同记忆与推理以构建高效长时序智能体 - 新加坡-麻省理工学院 2025年6月](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.15841)**\n\n> “我们的研究结果表明，基于推理的记忆整合作为一种可扩展的替代方案，有望用于训练长时序交互式智能体，在效率和性能上均达到最优。”— [新加坡-麻省理工学院](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2506.15841)\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_76a48299c047.png)\n\n1. **MEM1训练AI智能体只保留关键信息——在每一步都将记忆与推理融合——因此无论任务持续多久，它们都不会被压垮。**\n\n2. **不同于堆积无尽的上下文，MEM1将每次交互压缩成一个紧凑的“内部状态”，就像一张不断更新而非重复复制的智能笔记。**\n\n3. **通过将记忆与思考融为一体，MEM1学会只记住最重要的内容——使智能体更快、更敏锐，并能处理更长时间的对话。**\n\n4. **智能体所做的每一件事都被标记和结构化，因此每个动作、问题或事实都清晰易懂，便于审计——不再有神秘莫测的记忆。**\n\n5. **在每个循环中，旧的冗余信息会被修剪，只有最新、最相关的信息会被保留下来，这就像专家解决问题时会不断提炼自己的笔记一样。**\n\n6. **MEM1证明了，这种递归式的、基于协议的记忆方法——即始终精炼和整合——在速度和准确性方面都优于传统的“只是增加更多上下文”的方法。**\n## 认知工具\n\n### **[利用认知工具激发语言模型的推理能力 - IBM苏黎世 2025年6月](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.12115)**\n\n### 提示及提示程序作为推理工具调用\n> “认知工具”将推理操作封装在LLM自身之中 — [IBM苏黎世](https:\u002F\u002Fwww.arxiv.org\u002Fpdf\u002F2506.12115)\n\n\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_c0a51289bbe5.png)\n\n> **这些认知工具（作为工具调用的结构化提示模板）通过识别当前的主要概念、提取问题中的相关信息，并突出可能有助于解决问题的有意义的性质、定理和技巧来分解问题。**\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_ef67c3ed7ada.png)\n\n\n> **这些模板搭建起类似于认知心理捷径的推理层级，而这类捷径通常被称为“启发式”。**\n\n1. **这项研究表明，将复杂任务分解为模块化的“认知工具”，可以让AI更周密地解决问题——这与专家人类逐步推理的方式如出一辙。**\n\n2. **模型不再依赖单一的大提示，而是调用专门的提示模板，即“理解问题”、“回忆相关知识”、“检查答案”和“回溯”等认知工具——每个工具负责一种特定的心理操作。**\n\n3. **认知工具的作用就像内在的心理捷径：AI会在每个阶段选择合适的程序并运行它，以规划其推理过程和后续行动，从而提高准确性和灵活性。**\n\n4. **通过将推理步骤划分为模块化的区块，这些工具可以防止混淆、减少错误，并使模型的思维过程透明且可审计——即使是在复杂的数学问题上也是如此。**\n\n5. **这种模块化的方法适用于开放和封闭模型——能够提升现实世界中的数学问题解决能力，并接近经过强化学习训练的高级“推理”模型的表现，而无需额外的训练。**\n\n6. **研究结果表明，大型语言模型中已经蕴含着强大的推理能力——认知工具只是将其解锁并加以协调，提供了一种透明、高效且可解释的替代黑箱调优的方法。**\n## 涌现符号\n\n## **[涌现的符号机制支持大型语言模型中的抽象推理 - ICML 普林斯顿，2025年6月18日](https:\u002F\u002Fopenreview.net\u002Fforum?id=y1SnRPDWx4)**\n\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_b1ad1fe409d6.png)\n\n> **简而言之：研究发现了一种三阶段架构，它通过一系列涌现的符号处理机制来支持大型语言模型中的抽象推理。**\n>\n>\n\n\n**这些机制包括符号归纳头、符号抽象头以及检索头。**\n\n**1. 在早期层中，符号抽象头根据输入标记之间的关系，将输入标记转换为抽象变量。**\n\n**2. 在中间层中，符号归纳头对这些抽象变量进行序列归纳。**\n\n**3. 最后，在较晚的层中，检索头通过检索与预测的抽象变量相关联的值来预测下一个标记。**\n\n**这些结果指向了长期以来关于符号方法与神经网络方法之间争论的解决方案，表明神经网络中的涌现式推理依赖于符号机制的出现。** — [**ICML 普林斯顿**](https:\u002F\u002Fopenreview.net\u002Fforum?id=y1SnRPDWx4) \n\n\n![image](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_784098ed9abf.png)\n\n\n>\n> **为何有用？**\n>\n>\n> **这解释了为什么 Markdown、Json 等结构化、符号化的格式更容易被大型语言模型解析。**\n>\n> **概念：与智能体协作，使用分隔符、语法、符号、象征性词汇、隐喻和结构，以提升推理、上下文理解、记忆保持等能力。**\n\n1. **本文证明，大型语言模型会发展出自身内部的符号“逻辑电路”，使其能够基于抽象变量进行推理，而不仅仅是表面的文字模式。**\n\n2. **大型语言模型表现出一个三阶段的过程：首先从输入中抽象出符号，然后对这些变量进行推理，最后再将抽象答案映射回现实世界的标记。**\n\n3. **这些涌现的机制意味着大型语言模型并非单纯地记忆，而是能够创建灵活的内部表示，从而推广到新的问题和类比情境中。**\n\n4. **早期层中的注意力头类似于“符号提取器”，中间层执行符号推理，而晚期层则负责检索具体的答案——这一过程模仿了人类的抽象与检索机制。**\n\n5. **通过有针对性的实验和干预，作者们证明了这些符号过程对于抽象推理来说既是必要条件，也是充分条件，并且这一规律在多种模型和任务中都成立。**\n\n6. **研究结果弥合了符号人工智能与神经网络之间的历史性鸿沟——表明在足够规模下，神经网络能够自发地发明并使用符号机制，从而支持真正的泛化与推理能力。**\n\n\n\n## 星标历史\n\n[![星标历史图](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_readme_718c15a30659.png)](https:\u002F\u002Fwww.star-history.com\u002F#davidkimai\u002FContext-Engineering&Date)\n\n## 贡献\n\n我们欢迎各位贡献！请查看 [CONTRIBUTING.md](.github\u002FCONTRIBUTING.md) 以获取相关指南。\n\n## 许可证\n\n[MIT 许可证](LICENSE)\n\n## 引用\n\n```bibtex\n@misc{context-engineering,\n  author = {Context Engineering 贡献者},\n  title = {Context Engineering: Beyond Prompt Engineering},\n  year = {2025},\n  publisher = {GitHub},\n  url = {https:\u002F\u002Fgithub.com\u002Fdavidkimai\u002Fcontext-engineering}\n}\n```\n\n## 致谢\n> 我一直期待这一领域能够被概念化并正式确立，因为此前并没有这样一个既定的研究方向。提示工程常常带有负面标签，而且并不能完全涵盖大多数研究人员以及我个人所从事的工作。\n\n- 感谢 [Andrej Karpathy](https:\u002F\u002Fx.com\u002Fkarpathy\u002Fstatus\u002F1937902205765607626) 提出“上下文工程”这一术语，并启发了本仓库的创建。\n- 感谢所有贡献者及开源社区。","# Context-Engineering 快速上手指南\n\nContext-Engineering 是一套超越传统提示工程（Prompt Engineering）的方法论，旨在通过设计、编排和优化提供给大语言模型（LLM）的**完整上下文窗口**（包括示例、记忆、检索内容、工具状态和控制流），从而显著提升模型性能。\n\n本指南将帮助你快速搭建环境并运行最小化示例。\n\n## 环境准备\n\n在开始之前，请确保你的开发环境满足以下要求：\n\n*   **操作系统**: Linux, macOS 或 Windows (WSL2 推荐)\n*   **Python 版本**: Python 3.9 或更高版本\n*   **依赖管理**: pip 或 conda\n*   **前置知识**: 基础的 Python 编程能力，了解 LLM 基本概念\n\n**安装必要依赖：**\n\n虽然本项目主要提供理论和模板，但运行示例代码通常需要基础的 LLM 交互库。建议安装以下通用依赖：\n\n```bash\npip install openai anthropic pyyaml jupyter\n```\n\n> **提示**：国内开发者如遇下载缓慢，可使用清华或阿里镜像源加速安装：\n> ```bash\n> pip install -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple openai anthropic pyyaml jupyter\n> ```\n\n## 安装步骤\n\n本项目主要为知识库和代码模板集合，无需复杂的编译安装，直接克隆仓库即可。\n\n1.  **克隆仓库**\n\n    ```bash\n    git clone https:\u002F\u002Fgithub.com\u002Fdavidkimai\u002FContext-Engineering.git\n    cd Context-Engineering\n    ```\n\n2.  **验证目录结构**\n\n    确保你看到了核心的学习和示例目录：\n    *   `00_foundations\u002F`: 理论基础文档\n    *   `10_guides_zero_to_hero\u002F`: 从零开始的实践指南\n    *   `20_templates\u002F`: 可复用的上下文模板\n    *   `30_examples\u002F`: 完整的项目示例\n\n## 基本使用\n\n按照以下三个步骤，从理论理解到代码实战，快速体验 Context Engineering 的核心流程。\n\n### 1. 理解核心概念 (5 分钟)\n\n首先阅读基础文档，理解为何单一的 Prompt 往往效果有限，以及“上下文工程”如何包含更广泛的信息载荷。\n\n```bash\n# 查看原子级提示工程的基础理论\ncat 00_foundations\u002F01_atoms_prompting.md\n```\n> **核心观点**：上下文不仅仅是用户发送的单条指令，而是推理时提供给模型的**完整信息负载**（包括结构化组件、记忆、状态等）。\n\n### 2. 运行最小化示例\n\n进入实践指南目录，运行一个最小化的 Python 脚本（类似 Jupyter Notebook 风格），体验如何通过构建上下文来提升模型表现。\n\n```bash\n# 进入指南目录\ncd 10_guides_zero_to_hero\n\n# 运行最小提示示例 (需确保已配置相关 LLM API Key)\npython 01_min_prompt.py\n```\n\n*注意：运行前请在脚本中或环境变量中配置好你的 `OPENAI_API_KEY` 或其他兼容的 API Key。*\n\n### 3. 应用上下文模板\n\n复制项目的最小化上下文模板到你的项目中，作为构建复杂 Agent 或对话系统的起点。\n\n```bash\n# 返回根目录\ncd ..\n\n# 查看并复制最小上下文模板\ncat 20_templates\u002Fminimal_context.yaml\n```\n\n你可以将 `minimal_context.yaml` 的内容集成到你的应用中，用于定义：\n*   **Few-Shot Examples**: 少样本学习示例\n*   **Memory Structure**: 记忆持久化结构\n*   **Control Flow**: 任务控制流定义\n\n### 4. 进阶：研究完整案例\n\n查看 `30_examples` 目录下的玩具聊天机器人实现，观察如何在实际代码中管理上下文窗口、状态和历史记录。\n\n```bash\nls 30_examples\u002F00_toy_chatbot\u002F\n```\n\n---\n\n**下一步学习路径**：\n完成上述步骤后，建议按照仓库中的 `Learning Path` 继续深入：\n1.  **Foundations**: 深入学习数学模型和组件处理。\n2.  **System Impl**: 探索 RAG 系统和记忆架构。\n3.  **Integration**: 研究多智能体编排。","某全栈开发团队正在利用 Claude Code 重构一个遗留的电商微服务系统，需要模型同时理解复杂的业务逻辑、数据库架构及最新的 API 规范。\n\n### 没有 Context-Engineering 时\n- **信息过载与丢失**：开发者试图将全部代码库塞入上下文窗口，导致关键的业务规则被“淹没”，模型频繁产生幻觉或忽略核心约束。\n- **状态记忆断裂**：在多轮对话重构中，模型无法有效维持之前的修改状态，经常重复生成已废弃的代码或破坏已修复的逻辑。\n- **响应效率低下**：由于缺乏对上下文的动态编排，每次交互都需重新解释背景，导致 Token 消耗巨大且推理速度缓慢。\n- **工具调用盲目**：模型在不清楚当前文件依赖关系的情况下盲目调用搜索或编辑工具，引发连锁错误。\n\n### 使用 Context-Engineering 后\n- **精准信息注入**：Context-Engineering 自动筛选并注入当前任务最相关的代码片段与文档，确保模型聚焦于核心逻辑，显著提升准确率。\n- **动态状态管理**：通过优化的上下文编排，模型能清晰感知代码变更的历史状态，像资深工程师一样保持重构过程的连贯性。\n- **资源高效利用**：仅保留必要的上下文信息，大幅减少冗余 Token 占用，使复杂任务的推理成本降低且响应更敏捷。\n- **智能工具协同**：结合结构化上下文，模型能精准判断何时调用何种开发工具，实现从“盲目尝试”到“按需执行”的跨越。\n\nContext-Engineering 通过将杂乱的提示词升级为精密的上下文设计，让 AI 从单纯的指令执行者进化为具备全局视野的智能协作伙伴。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fdavidkimai_Context-Engineering_ac8a0eec.png","davidkimai",null,"https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fdavidkimai_435147ce.png","Stay hungry. Stay foolish. - Steve Jobs. \r\n\r\nBuilding Kubernetes for Agents","ai.interpreter@proton.me","https:\u002F\u002Fkim.bearblog.dev\u002F","https:\u002F\u002Fgithub.com\u002Fdavidkimai",[81],{"name":82,"color":83,"percentage":84},"Python","#3572A5",100,8673,970,"2026-04-06T18:49:35","MIT",1,"","未说明",{"notes":93,"python":91,"dependencies":94},"该项目主要是一个关于'上下文工程'（Context Engineering）的教程、指南和研究综述仓库，而非一个需要特定运行环境的单一可执行软件包。README 中提到的示例代码（如 .py 文件）和模板（.yaml）旨在作为学习材料供用户参考和复制，具体的运行环境需求取决于用户选择集成的后端模型或工具（如 Claude Code, Jupyter Notebook 等）。文中未提供统一的安装脚本或具体的依赖列表。",[],[35,14,13],"2026-03-27T02:49:30.150509","2026-04-07T09:48:31.076579",[],[]]