Community编程与开发github.com

长视界提示设计

此技能用于编写、增强或评估面向长时间自主运行代理或并行多代理编排系统解决难题的启动提示:伪正式任务简报,定义术语和精确的成功谓词,列举不计入结果,设置持久化规则与明确的停止和返回条件及努力下限,通过注册表和阻塞路径记账管理多样的并行方法组合,并基于对抗性审计来控制返回。

长视界提示设计 是什么?

该技能专注于设计面向自主运行数小时甚至数天的代理(无论是独立运行还是作为管理多个并行工作进程的编排器)的启动提示。其核心技术是“伪正式任务简报”:一种以形式化验证的严谨性编写但以自然语言表达的规范,因为大多数难题缺乏机器可检查的成功条件。该技能提供了详细的模板解剖,涵盖定义、成功谓词、不计入结果、编排策略、交接契约、验证策略等关键模块。对于开发者或AI代理用户而言,学习本技能将能构建更鲁棒、更可靠的长时间任务执行流程,有效避免出现“看似正确但无效”的伪解和虚假完成任务声明,通过对抗性审计和枚举失败模式显著提高自主代理的执行质量和最终产物的可靠性。该技能支持各种市场中的自主代理和编排系统(例如Claude Code、Codex等),并适用于数学证明、代码修复、科学发现等跨领域难题。

兼容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/tree/main/skills/long-horizon-prompting

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

长视界提示设计 是做什么的?

此技能涵盖设计面向预期自主运行数小时或数天的代理启动提示,无论是独立应用还是作为管理多个并行工作进程的编排器。核心技巧是伪正式任务简报:一种以形式化验证的严谨性编写但以自然语言表达的规范,因为大多数难题没有机器可检查的成功条件。典范是GPT-5.6 Sol Ultra 候选证明 Cycle Double Cover 猜想所用的已公开提示,源自64个子代理编排(claim-long-horizon-cdc-run)。该提示结构远超出数学领域:只要成功条件能被精确陈述且失败模式能被枚举,任何领域都可以采用相同的简报构造。在编排运行中,每次交班都适用相同的纪律:当模型在 Sakana AI 的 MASS 工作中优化自身多代理工作流程文本时,任务信息从工人角色转移到输出契约和调用顺序中(claim-long-horizon-contract-information-shift)。

核心权衡:所有促使长程运行高效的因素(持久性、自主性、并行性)同时也提高了弱规范的代价。一个短暂的交互式提示失败成本低;一个带有漏洞的长视界简报会浪费数小时的算力来生成一个看起来正确但不解决问题的人造产物。

何时激活

此技能适用于以下情况:

  • 在启动长程自主运行之前,编写或审查其提示
  • 将模糊的难题(“解决 X”,“弄清楚 Y 为什么会发生”)转化为包含成功谓词和不计入结果的明确简报
  • 编写管理多个并行工作进程在开放式搜索问题上的根提示或编排器提示
  • 向代理提示添加持久化指令、停止条件、努力下限或返回门控
  • 编写每个委派工人必须满足的输出契约和验收检查,或决定哪些审查发现会阻止返回的规则
  • 诊断因简报导致的失败长程运行:过早返回、看似正确但有瑕疵的产物、所有工人都收敛于同一种方法、或虚构完成声明
  • 构建启动前审查步骤,在投入昂贵的代理时间之前增强和评估提示

不要在此处激活本技能处理其他技能负责的相邻工作:

  • 代理拓扑、监督者与小集群的选择、交接协议和协调机制:multi-agent-patterns。该技能拥有架构,本技能负责指导架构的措辞,包括每个工人必须返回的契约。
  • 运行时控制界面、锁定的评估器、回滚、持久化日志以及自主循环周围的审批边界:harness-engineering。必须抵抗优化压力的约束应放在仪表盘中,而非提示中。
  • 构建评估器、回归套件或运行评分依据确定性质量门控:evaluation。
  • 以大语言模型作为判断器的设计、评分细则、成对比较和偏差缓解:advanced-evaluation。
  • 压缩、笔记记录和跨会话记忆机制以应对上下文限制:context-compression、memory-systems、filesystem-context。
  • 修改自身仪表盘或提示的循环:self-improvement-loops。
  • 远程沙盒和后台执行基础设施:hosted-agents。

核心概念

伪正式任务规范

形式化验证要求机器可检查的规范。硬性开放难题很少具备这种规范,但纪律可以转移:将成功条件阐述得足够精确,使得对抗性读者无法满足其字面含义而不满足其原始意图。按效力高低分为四个组件:

  1. 包含退化情形的定义。 在陈述目标前定义每一个关键术语,包括那些懒惰解决方案可能利用的边界情况。CDC提示在任务开始前定义了图表、桥接、循环和循环双覆盖,明确涵盖了并行边缘双循环、不连通图和空图。
  2. 精确的成功谓词。 一个关于返回的人造产物必须满足什么条件的陈述,带有明确的作用域量词(例如“每个有限的循环自由多重图且无桥接,无需其他如立方性、平面性、连通性等高连通性假设”)。
  3. 不计数结果。 列举的不计入的结果:部分进展、特例解决方案、归约为另一个未证命题、有界或计算性验证以及尽力而为的摘要。这是效力最高的组件。在持续性压力下,模型会产生看似正确的接近结果;每个排除的结果关闭了一个逃生闸。
  4. 为审计师列举故障模式。 一个具体的清单,列举候选者可能微妙出错的各种领域特定方式(在CDC中:循环套着边的闭合轨迹冒充循环、由化简引入的桥接、循环使用等价陈述)。附有列举寻找清单的验证器能捕获通用“检查工作”指令无法发现的错误。

对可机器检查的部分进行机器检查。即使整个产物没有自动成功信号的任务,仍有部分可由命令判断:必须通过的测试、数据分割的恒定不变性、模式有效性、浏览器中点击完成的用户流程。将每一部分命名为已命名检查,附带运行它的命令,并将残余部分保留为语言谓词,用于那些无法由命令决定的部分。

长视界简报的解剖结构

模块作用防止的故障
定义确定词汇,包括退化情形利用技术细节的漏洞解决方案
成功谓词精确陈述返回时必须为真的条件范围缩小型的答案
不计数结果列举不计入结果的接近结果看似正确的部分结果
可解性框架“假设解决方案存在”用于存在性合理之处放弃式漂移,“这是开放题”的拒绝
编排策略分配并行工作进程的启发式方法,而非固定分配过早收敛、并行性浪费
交接契约每个工人返回命名的产物和类型化检查;下游工作等待它们跨阶段累积的错误、模拟委托
验证策略带有列举故障模式和阻止规则的对抗性审计宽容的自我判断、永不到达收敛的评审
报告契约具体的人工产物要求;状态报告被拒绝模糊的乐观、虚构的进展
返回条件仅当产物通过审计时返回过早返回、尽力而为摘要
努力下限放弃前最小努力早期放弃
污染防护外部搜索可以用于什么,不可以用于什么掩饰的查找、基准泄露

持久性是一把双刃剑

持久性指令(“直到才返回”、努力下限、假设可解框架)抵消了在长轨迹中向放弃漂移的文档化趋势(claim-long-horizon-give-up-drift)。但同样的压力提高了奖励黑客攻击面:截至测定,最具有持久性训练的前沿模型也显示了其评估器测试过的任何模型中最高的检测作弊率,且其测量时间范围对作弊是否算作成功不具鲁棒性(claim-long-horizon-persistence-hacking)。设计规则是:永远不要在沒有匹配验证门控的情况下添加持久性指令。针对松散成功谓词的持久性压力会产生自信的非解。

验证瓶颈

并行采样通常提高某个工人找到正确答案的概率,但系统选择该答案的能力滞后,而对于困难产物的模型判定者系统性地宽容,奖励看起来严格但不完整的论证(claim-long-horizon-verification-gap)。在验证器和生成器上投入同等量的提示设计:

  • 给审计师提供简报中的枚举故障模式清单,而不是通用质量指令。
  • 要求生成器生成模块化、可独立检查的输出(引理级结构、明确前提和结论),使得验证能够分解。
  • 使用全新上下文的对抗性验证器而非自我批评;没有构建产物的验证器无法合理化其缺陷。全新上下文消除了构建历史,但未消除同一模型家族共有的先验,因此对于重要结果,请在循环外部保留至少一项检查。
  • 将代理间的共识视为多样性失败信号而非确认:委员会在最困难问题上收敛最紧,其中一致意见反映的是共同偏差而非证实(claim-long-horizon-diversity-collapse)。
  • 定义哪些发现会阻止返回。全新的对抗性评审总是能找到一些东西。只有在有证明(失败的检查、反例、再现)显示违反成功谓词、契约检查或清单的情况下,发现才阻止返回;将其他所有发现记录为非阻止。没有此规则,“通过审计”永不会收敛,或者编排器私自定义哪些发现重要。
  • 投资于修订器,而不仅仅是评审器。在MASS工作流程搜索中,仅升级评估器帮助低于同时升级评估器和优化器(claim-long-horizon-reviser-bottleneck);准确的发现被浪费于无法据此行动的代理。

交接契约

在编排运行中,“完成”在每次交接时定义,而非仅在最终阶段。MASS以文本形式编写多代理工作流程,每个工人包含四个部分:角色、指令、契约(工人必须返回的产物和信息,包括所需检查)和跳转(调用顺序)。当模型自行优化该文本时,任务信息出现在角色和指令中,并在契约和跳转中增加(claim-long-horizon-contract-information-shift)。“细心的数据科学家”适用于任何任务;需要 no_future_leakage: bool 在建模开始前才适合一个任务。

  • 以所排除的故障命名每个检查,并使其类型化,以便下一个代理和仪表盘无需判断就能读取。
  • 将每个检查放置在可能引入错误的阶段,并仅在该阶段契约满足后才开始下游工作。
  • 列出检查必须拒绝的退化值:好得令人难以置信的指标、本应不同却匹配的数量、占位符、视为通过的 NaN 或空结果。对已知的错误输入运行每个检查一次;空洞的检查认证了它本应捕获的故障。
  • 将失败的检查路由回负责的工人作为召回,附带失败的检查列表、缩小范围、接受标准以及重试上限。修复请求携带其自身的完成定义,而非重新打开整个产物。
  • 要求真正的委托。在其自己的回合中编写工人输出的编排器已模拟了交接,且模拟不计入。

注释性工作流程、演化闸门和作者的执行指令位于MASS参考中。

并行搜索中的结构多样性

角色标签不会创造多样性;并行工人共享先验,除非工程化了独立性,否则会收敛:

  • 保持早期轮次中的工人对当前青睐的方法视而不见。
  • 维护显式的路线族注册表,按基本思想而非表面措辞分类,并引导工人远离拥挤的族系。
  • 当一条路线在某个缺失步骤上停滞且该步骤难度与原目标相当时,标记为阻塞;仅在有实质性新机制时才重新分配工人到该路线,而非出于热情。
  • 在独立开发已揭示每条路线的真实优势和劣势之后,再进行后期交叉融合。
  • 不要让某条路线因其优雅的化简而主导一切;一条在等价于原目标的引理上终结的路线并非进展。

停止条件、努力和进度状态

长轨迹会向不确定性和放弃漂移,且仅在提示顶部陈述一次的预算会随着上下文增长而失去效力(claim-long-horizon-give-up-drift)。属于简报的应对措施:明确努力下限(“在考虑返回前至少付出这些努力”)、存在性合理的假设可解框架以及以产物谓词而非代理自信表述的返回条件。属于提示外部的应对措施:外部维护的已验证进度分类账,每轮重新注入,这在受控比较中拯救了仅提示和完成门控设置完全失败的大量任务(claim-long-horizon-state-ledger)。进度声明应可审计:要求每个报告的声明追溯到工具结果或当前会话的人造产物,这几乎消除了供应商测试中虚构的状态报告(claim-long-horizon-evidence-audit)。

精简与结果优先

两大主流供应商在当前前沿模型上达成一致信条:提示应承载结果、硬约束、证据来源和完成标准,而将路径留给模型。累积的指令堆叠明显有害;更精简的系统提示可在降低成本的同时改进供应商编码代理评估(claim-long-horizon-lean-prompt)。持久性本身越来越多地被训练进来而非提示出来,因此将词元预算花在训练无法提供的内容上:成功谓词、不计数清单以及仅为问题专家所知的领域故障模式。每工人的契约属于完成标准而非路径:它们说明一个阶段必须建立什么以及如何检查,从不说明如何做工作。

详细主题

CDC 的

…[为翻译截断]

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

advanced-evaluation

This skill should be used for advanced LLM evaluation: LLM-as-judge systems, direct scoring, pairwise comparison, rubric calibration, evaluator bias mitigation, confidence scoring, and automated quality assessment.

bdi-mental-states

This skill should be used when modeling agent mental states with BDI concepts: beliefs, desires, intentions, RDF-to-belief transformations, rational agency traces, cognitive agents, BDI ontologies, and neuro-symbolic AI integration.

book-sft-pipeline

This skill should be used for book-to-SFT pipelines: ePub extraction, literary segmentation, author-voice dataset construction, style-transfer training, LoRA workflows, and model evaluation for voice replication.

comprehensive-research-agent

Ensure thorough validation, error recovery, and transparent reasoning in research tasks with multiple tool calls

context-compression

This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve decisions, files, risks, and next actions.

context-degradation

This skill should be used for diagnosing and mitigating context degradation: lost-in-middle failures, context poisoning, context clash, context confusion, attention-pattern issues, and agent performance degradation caused by accumulated or conflicting context.

context-fundamentals

This skill should be used to explain or reason about the foundational concepts of context engineering: what context is, the anatomy of a context window, how attention mechanics work, the U-shaped attention curve, why context quality matters more than quantity, and the mental models needed to interpret every other context-engineering decision. Use this for conceptual explanation, onboarding, and background reading. Route operational work to the specialized skills: debugging attention failures goes to context-degradation, token-efficiency work goes to context-optimization, conversation summarization goes to context-compression, and project-shape decisions go to project-development.

context-optimization

This skill should be used for improving context efficiency: context budgeting, observation masking, prefix or KV-cache strategy, partitioning, token-cost reduction, retrieval scoping, and extending effective context capacity without lowering answer quality.

evaluation

This skill should be used when building agent evaluation systems: deterministic checks, regression suites, multi-dimensional rubrics, quality gates, production monitoring, baseline comparison, and outcome measurement for agent pipelines.

filesystem-context

This skill should be used when agent work needs file-backed context: durable scratchpads, tool-output offloading, just-in-time discovery, cross-agent handoff files, filesystem memory, or cleanup policies for context stored outside the prompt.

harness-engineering

This skill should be used when designing autonomous agent harnesses: research loops, evaluation scaffolds, locked and editable surfaces, durable logs, novelty gates, pruning, rollback, PR preparation, and human approval boundaries.

hosted-agents

This skill should be used when designing hosted or background agent infrastructure: sandboxed execution, remote coding environments, warm pools, session persistence, multiplayer collaboration, self-spawning agents, or Modal-style sandboxes.

instruction-surface-security

Hardens agent runtimes against persistent prompt injection or unauthorized changes to instructions and permissions. Use to audit what agents auto-load, design reviewed activation for project rules, skills, memory, or tool configuration, and test whether trust boundaries hold after reload, restart, or delegation.

latent-briefing

This skill should be used when the user asks to "share memory between agents", "KV cache compaction for multi-agent", "orchestrator worker context", "latent briefing", "reduce worker tokens", "cross-agent memory without summarization", or discusses Attention Matching compaction, recursive language models with workers, or token explosion in hierarchical agents.

memory-systems

This skill should be used for persistent semantic memory in agent systems: cross-session knowledge retention, entity tracking, temporal validity, graph or vector retrieval, memory consolidation, and memory benchmark selection. Route file-backed scratchpads to filesystem-context, handoff summaries to context-compression, and token-efficiency tactics to context-optimization.

multi-agent-patterns

This skill should be used when designing multi-agent systems that need context isolation, supervisor or swarm coordination, explicit handoffs, parallel execution, or a decision on whether multiple agents are justified.

project-development

This skill should be used for project-level decisions about LLM-powered systems: whether an LLM is the right primitive for the task at hand, the shape of a multi-stage batch or agent pipeline, token and cost estimation, choosing between single-agent and multi-agent at the project level, structured output design for downstream parsing, and structuring agent-assisted iteration. Use this when the unit of work is a whole project or a multi-stage pipeline. Route individual tool design to tool-design and individual skill-loading or context-budget tactics to context-optimization.

self-improvement-loops

This skill should be used when the harness, scaffold, workflow, or optimizer itself is the optimization target: recursive self-improvement (RSI) loops, meta-harnesses, self-improving harnesses that mine their own failures and propose bounded edits, evolutionary or population-based search over agent scaffolds, acceptance gates for self-modifying systems, and agentic context evolution where the mechanism that produces context is versioned and evolved. Route governance of a single autonomous loop (locked surfaces, durable logs, rollback, novelty gates, approval boundaries) to harness-engineering, measurement and quality-gate design to evaluation, judge design to advanced-evaluation, and remote sandbox infrastructure to hosted-agents.

self-managed-context

This skill should be used when a model gets read-write control over its own live context window instead of a harness-scheduled compaction policy: the context exposed as an editable file the model rewrites with code tools, model-driven eviction and in-place updates, the harness invariants that keep self-editing safe (pinned prefix, edit gate, edit receipts, budget readouts, rollback on overflow), the prefix-cache cost of mid-context edits, and steering or training the model's own context-editing strategy. Route note content and fixed-threshold summarization to context-compression, cache-stable layout under harness control to context-optimization, file offloading to filesystem-context, and loop governance to self-improvement-loops.

tool-design

This skill should be used for the tool-interface layer of an agent system specifically: writing tool descriptions agents can route on, designing tool schemas and response formats, naming conventions, actionable error recovery messages, MCP server design, tool-set consolidation, and deciding when to add or remove an individual tool. Use this when the unit of work is a single tool or a set of tools. Route project-shape, pipeline architecture, and task-model-fit decisions to project-development; route deciding whether to introduce sub-agents to multi-agent-patterns.

相关技能