Documentation
¶
Overview ¶
Package sections 提供引擎层可复用的 PromptBundle Section 库.
这些 Section 是跨行业中立的技术工具原语, 消费层 (platform/ 或第三方) 的 PromptBundle 实现通过 import 本包, 在 StaticSections/DynamicSections 里引用这些 Section, 避免从零写相同的技术行为提示词.
设计边界 (L952d, 2026-04-17):
- 引擎层只出**技术工具原语 Section** (DB / SSH / SystemConfig 等)
- 行业 / 角色 Bundle (SRE / DBA / WMS / HIPAA 等) 是消费层职责
- 对齐 CLAUDE.md 原则 9 "引擎核心不假设特定场景"
命名约定: 导出变量名即 Section.Name (首字母大写驼峰, 底层 name 用 snake_case). 便于消费层直观引用:
type MyIndustryBundle struct{}
func (MyIndustryBundle) StaticSections() []*context.Section {
return []*context.Section{
sections.DBOps, // 引擎提供的 DB 行为准则
customBusinessSection, // 消费层自定义的行业 section
}
}
风格对齐: Section 文本对齐 core/pkg/context/prompts_zh.go 的早期方案编程 Bundle 风格 (markdown header + bullet, 口语化直述, 硬约束与软引导分层).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DBOps = context.StaticSection("db_ops", dbOpsText)
DBOps 是数据库操作的行为准则 Section.
覆盖四块技术行为:
- 读取数据 — 判断力引导, 不硬性 LIMIT (早期方案 GrepTool head_limit 同策略: 工具层默认值 + 显式 override 路径, 提示词只管判断力)
- 写前 Dry-run — 硬约束, 不可逆写必走 (呼应消费层 TODO L1011-1017)
- 并发安全 — CAS + 短事务 + 影子表
- 危险操作强制确认 — DROP/TRUNCATE/ALTER/无 WHERE 删改
跨行业中立: 不出现"库存"/"订单"/"病历"等业务词. 业务约束由消费层 Bundle 的其他 Section 补充 (Section 库只管"怎么操作数据库", 不管"什么业务数据").
静态 Section (Static=true), 全局缓存, Engine 生命周期内不重算.
升华改进(ELEVATED): 早期实现 无对应 Section — 早期方案是编程助手, DB 操作通过 Bash + 第三方 CLI (psql/mysql) 走, 没有 DB 工具的专门提示词. 本 Section 是 Flyto 作为"跨行业 Agent 引擎"首次提供的 DB 行为准则, 与消费层 DB 工具链 (L1011-1017) 言行互证.
Functions ¶
This section is empty.
Types ¶
This section is empty.