// Package presetcoding provides the Claude Code-style prompt preset for // Flyto Agent. It is the first concrete implementation of the promptkit // three-layer pattern (static base + conditional sections + runtime // reminders), mirroring the public mechanism Anthropic's Claude Code CLI // uses internally. // // preset-coding 包提供 Flyto Agent 的 Claude Code 风格 prompt 预设. 它是 // promptkit 三层模式 (静态基座 + 条件块 + 运行时 reminder) 的第一个具体 // 实现, mirror Anthropic Claude Code CLI 内部使用的公开机制. // // # ELEVATED — Product positioning pivot anchor // // Flyto Agent transitions from "Claude Code re-implemented in Go" to // "neutral transport + pluggable prompt framework + multi-preset // ecosystem" (see ADR-0005 § 1.5). This package is the physical evidence // of the pivot — all Claude Code-style content (8-section coding // protocol, 23 builtin tools, FLYTO.md loader, env_info, git status // snapshot, MCP server instructions) moves out of core/pkg/engine and // core/pkg/context into here, exposed through promptkit.PromptBundle, no // longer hardcoded inside the engine. // // Flyto Agent 从 "Claude Code 在 Go 的再造" 转向 "中性 transport + 可插拔 // prompt framework + 多 preset 共生体系" (见 ADR-0005 § 1.5). 本包是这个 // 转向的物理证据 — Claude Code 风格的所有内容 (8 段编程协议 / 23 个 builtin // 工具 / FLYTO.md 加载器 / env_info / git status snapshot / MCP server // instructions) 从 core/pkg/engine 和 core/pkg/context 搬到这里, 通过 // promptkit.PromptBundle 接口暴露, 不再 hardcoded 于引擎内部. // // # Layout (incremental, populated across ADR-0005 commit chain C2-C8) // // base.go 6 always-on sections (cc Layer 1). Cache-stable // prefix. Populated by C3. // 始终在的 6 段, cache 稳定前缀, C3 落. // // conditional/ Sections evaluated once at session setup // git.go (cc Layer 2). C2-C4 落: // mcp.go git.go: 检测到 git 仓库才加 git status // flyto_md.go mcp.go: 配 MCP server 才加 instructions // env_info.go flyto_md.go: 找到 FLYTO.md 才加 (C2) // memory.go env_info.go: cwd / platform / date (C2) // memory.go: 启用 memory 才加 // // reminders/ Runtime triggers injected to user message // triggers.go (cc Layer 3). C7 落. Reminder lives outside // inject.go system prompt to preserve cache stability. // user message 中的运行时 reminder 注入, 不进 // system prompt 保持 cache 稳定, C7 落. // // builtins.go AllBuiltins(deps) re-exports the 23 builtin // tools from core/pkg/tools/builtin. Caller wires // via cfg.Toolset Allowlist. C5 落. // re-export 23 builtin 工具供 cfg.Toolset 选用. // // bundle.go Implements promptkit.PromptBundle composing // base + conditional + reminders. C5.6 落. // 实现三层装配, C5.6 落. // // register.go Public Register(reg) entrypoint for callers // wanting the cc-style preset wired in. C5.6 落. // 一行启用编程预设的入口. // // # Anti-pattern this package replaces // // Pre-ADR-0005 the engine baked Claude Code's coding-assistant content // directly into core/pkg/engine and core/pkg/context: 8-section system // prompt unconditionally injected (~16KB), 23 builtin tools auto-registered // when cfg.Tools=nil, FLYTO.md auto-loaded even when SystemPrompt // ostensibly overridden, sub-agents inheriting parent bundle without // explicit opt-in. r17 dump (FLYTO_DUMP_PAYLOAD=1, work-tree only) // confirmed: probe configured 1 tool + 6KB system prompt, engine actually // sent 25 tools + 22KB. This package is the destination for those moved // concerns. Full 18-bug audit: ADR-0005 § 1.4. // // ADR-0005 之前引擎硬塞 Claude Code 内容于 core/pkg/engine 和 core/pkg/context: // 8 段 system prompt 无条件注 (~16KB) / cfg.Tools=nil 自动 23 工具 / FLYTO.md // 即使 SystemPrompt 名义覆盖也偷加 / sub-agent 继承父 bundle 不需显式 opt-in. // r17 dump 实测: probe 配 1 工具 + 6KB, 引擎实发 25 + 22KB. 本包是上述被搬出 // 内容的归宿. 完整 18 bug 见 ADR-0005 § 1.4. // // # See also // // - ADR-0005 (core/docs/adr/0005-engine-neutralization.md) — // decision rationale + 22 commit chain. // - core/pkg/promptkit/ — three-layer framework interface; // this package is its first implementation. // - core/extra/preset-extraction/ (future) — second implementation // for logistics quote extraction; will validate framework interface // correctness via rule-of-two. package presetcoding