中文译文
上下文保留与迁移提示词
[ 对于 AGENT.MD,如果 ## SECTION 不适用,则跳过该部分 ]
生成一份全面的上下文产物,保留所有对话上下文、进度、决策和项目结构,以便在 AI 会话、平台或智能体之间无缝延续。该产物充当一个“上下文 U 盘”,使任何 AI 都能立即理解并继续工作,而无需重复说明或丢失上下文。
核心目标
捕获并结构化当前会话中的所有上下文要素,以实现:
- 会话延续 - 在不同 AI 平台之间恢复对话,无需重新解释
- 智能体交接 - 将未完成的任务移交给新的智能体,并附上完整的进度文档
- 项目迁移 - 复制整个项目文化、工作流和治理结构
需要保留的内容类别
对话上下文
- 初始需求和不断演进的用户故事
- 头脑风暴期间产生的想法
- 做出的决策及其完整的理由链
- 达成的共识及其验证状态
- 建议和推荐及其支撑上下文
- 已确立的假设及其当前状态
- 关键洞察和突破性时刻
- 作为结构基础的关键要点
进度文档
- 所有工作流的当前状态
- 已完成的任务和交付物
- 待办事项和下一步行动
- 遇到的阻碍及缓解策略
- 触及的速率限制及变通解决方案
- 重要里程碑的时间线
项目架构(如适用)
- SDLC 方法论和阶段
- 智能体生态系统(主智能体、子智能体、同级智能体、观察者智能体)
- 规则、治理策略和战略
- 仓库结构(.github 工作流、模板)
- 可复用的提示词表单(史诗拆解、PRD、架构计划、系统设计)
- 约定模式(提交格式、记忆提示词、日志结构)
- 指令层级(项目级、冲刺级、史诗级变体)
- CI/CD 配置(测试、格式化、提交提取)
- 多智能体编排(提示词链、并行化、路由智能体)
- 输出格式标准及变体
规则与协议
- 已确立的指导方针及范围定义
- 会话期间添加的附加指令
- 已设定的约束与边界
- 质量标准与验收标准
- 用于保持工作不偏离轨道的对齐机制
步骤
- 扫描对话历史 - 审查整个线程/会话中的所有交互与上下文
- 提取核心要素 - 按上述内容类别识别并归类信息
- 记录进度状态 - 记录已完成、进行中和待处理的内容
- 保留决策链 - 包含所有重要选择背后的推理
- 为可移植性而结构化 - 以普遍可解释的格式组织
- 添加交接说明 - 包含面向下一个 AI/智能体/会话的明确指引
输出格式
生成一份结构化 markdown 文档,包含以下部分:
# CONTEXT ARTIFACT: [Session/Project Title]
**Generated**: [Date/Time]
**Source Platform**: [AI Platform Name]
**Continuation Priority**: [Critical/High/Medium/Low]
## SESSION OVERVIEW
[2-3 sentence summary of primary goals and current state]
## CORE CONTEXT
### Original Requirements
[Initial user requests and goals]
### Evolution & Decisions
[Key decisions made, with rationale - bulleted list]
### Current Progress
- Completed: [List]
- In Progress: [List with % complete]
- Pending: [List]
- Blocked: [List with blockers and mitigations]
## KNOWLEDGE BASE
### Key Insights & Agreements
[Critical discoveries and consensus points]
### Established Rules & Protocols
[Guidelines, constraints, standards set during session]
### Assumptions & Validations
[What's been assumed and verification status]
## ARTIFACTS & DELIVERABLES
[List of files, documents, code created with descriptions]
## PROJECT STRUCTURE (if applicable)
### Architecture Overview
[SDLC, workflows, repository structure]
### Agent Ecosystem
[Description of agents, their roles, interactions]
### Reusable Components
[Prompt templates, workflows, automation scripts]
### Governance & Standards
[Instructions hierarchy, conventional patterns, quality gates]
## HANDOFF INSTRUCTIONS
### For Next Session/Agent
[Explicit steps to continue work]
### Context to Emphasize
[What the next AI must understand immediately]
### Potential Challenges
[Known issues and recommended approaches]
## CONTINUATION QUERY
[Suggested prompt for next AI: "Given this context artifact, please continue by..."]
示例
示例 1:会话连续性(头脑风暴交接)
输入:“我们已经为一个移动应用头脑风暴了 2 个小时。我需要切换到 Claude。生成上下文产物。”
输出:
# CONTEXT ARTIFACT: FitTrack Mobile App Planning
**Generated**: 2026-01-07 14:30
**Source Platform**: Google Gemini
**Continuation Priority**: High
## SESSION OVERVIEW
Brainstormed fitness tracking mobile app for busy professionals. Decided on minimalist design with AI coaching. Ready for technical architecture phase.
## CORE CONTEXT
### Original Requirements
- Target users: Working professionals 25-40, limited gym time
- Must sync with Apple Watch and Fitbit
- Budget: $50k for MVP
- Timeline: 3 months to launch
### Evolution & Decisions
- ✓ Name: "FitTrack Pro" (rejected: "QuickFit", "PowerHour")
- ✓ Core feature: 15-min AI-personalized workouts (not generic plans)
- ✓ Monetization: Freemium ($9.99/mo premium)
- ✓ Tech stack: React Native (for iOS+Android simultaneously)
### Current Progress
- Completed: Feature prioritization, user personas, monetization model
- In Progress: None yet
- Pending: Technical architecture, database schema, API design
- Blocked: None
## KNOWLEDGE BASE
### Key Insights & Agreements
- Users want "smart short" over "long complete" - brevity is premium feature
- AI coaching must feel conversational, not robotic commands
- Social features deferred to v2 to avoid scope creep
(... rest of structure follows)
## CONTINUATION QUERY
"Given this context artifact for FitTrack Pro app planning, please design the technical architecture including database schema, API endpoints, and third-party integration strategy for Apple Watch and Fitbit."
示例 2:Agent 交接(限流自动化)
输入:“浏览器 Agent 在抓取竞品定价时触发了速率限制。生成交接文档。”
输出:
# CONTEXT ARTIFACT: Competitor Pricing Automation (Incomplete)
**Generated**: 2026-01-07 09:15
**Source Platform**: Browser Agent v2.1
**Continuation Priority**: Critical
## SESSION OVERVIEW
Automated scraping of 50 competitor websites for pricing comparison. Completed 32/50 before rate limiting. Need immediate continuation to meet Friday deadline.
## CORE CONTEXT
### Original Requirements
- Scrape pricing for "wireless earbuds under $100" from 50 e-commerce sites
- Extract: product name, price, rating, review count
- Output: Single CSV for analysis
- Deadline: Friday 5pm
### Evolution & Decisions
- ✓ Added retry logic after initial failures on JS-heavy sites
- ✓ Switched to headless Chrome (from requests library) for better compatibility
- ✓ Implemented 3-second delays between requests per domain
- ✓ User added instruction: "Skip sites requiring login"
### Current Progress
- Completed: 32/50 sites successfully scraped (2,847 products)
- In Progress: None (halted at rate limit)
- Pending: 18 sites remaining (list in "Continuation Query" below)
- Blocked: Rate limited on domains: amazon.com, walmart.com, target.com (need 2-hour cooldown)
## KNOWLEDGE BASE
### Established Rules & Protocols
- Respect robots.txt without exception
- Max 1 request per 3 seconds per domain
- Skip products with no reviews (noise in data)
- Handle pagination up to 5 pages max per site
### Challenges & Mitigations
- Challenge: Dynamic pricing (changes during scraping)
Mitigation: Timestamp each entry
- Challenge: Anti-bot CAPTCHAs on 3 sites
Mitigation: User approved manual data entry for these 3
- Challenge: Rate limiting
Mitigation: Implement exponential backoff, rotate user agents
## CONTINUATION QUERY
"Continue pricing scraping automation. 18 sites remaining: [bestbuy.com, newegg.com, ebay.com...]. Use existing CSV 'pricing_data_partial.csv' (2,847 entries). Rate-limited domains need 2hr wait. Prioritize non-blocked sites first. Apply all established rules: 3-sec delays, skip no-reviews, 5-page pagination limit. Deliver final CSV by Friday 5pm."
示例 3:项目迁移(完整文化转移)
(输入上下文:包含 SDLC、智能体、治理的整个项目仓库)
输出:(展示结构的精简示例——真实输出将是全面的)
# CONTEXT ARTIFACT: "SmartInventory" Project Culture & Architecture
**Generated**: 2026-01-07 16:00
**Source Platform**: GitHub Copilot + Multi-Agent System
**Continuation Priority**: Medium (onboarding new AI agent framework)
## SESSION OVERVIEW
Enterprise inventory management system using AI-driven development culture. Need to replicate entire project structure, agent ecosystem, and governance for new autonomous AI agent setup.
## PROJECT STRUCTURE
### SDLC Framework
- Methodology: Agile with 2-week sprints
- Phases: Epic Planning → Development → Observer Review → CI/CD → Deployment
- All actions AI-driven: code generation, testing, documentation, commit narrative generation
### Agent Ecosystem
**Main Agents:**
- DevAgent: Code generation and implementation
- TestAgent: Automated testing and quality assurance
- DocAgent: Documentation generation and maintenance
**Observer Agent (Project Guardian):**
- Role: Alignment enforcer across all agents
- Functions: PR feedback, path validation, standards compliance
- Trigger: Every commit, PR, and epic completion
**CI/CD Agents:**
- FormatterAgent: Code style enforcement
- ReflectionAgent: Extracts commits → structured reflections, dev storylines, narrative outputs
- DeployAgent: Automated deployment pipelines
**Sub-Agents (by feature domain):**
- InventorySubAgent, UserAuthSubAgent, ReportingSubAgent
**Orchestration:**
- Multi-agent coordination via .ipynb notebooks
- Patterns: Prompt chaining, parallelization, router agents
### Repository Structure (.github)
.github/ ├── workflows/ │ ├── epic_breakdown.yml │ ├── epic_generator.yml │ ├── prd_template.yml │ ├── architectural_plan.yml │ ├── system_design.yml │ ├── conventional_commit.yml │ ├── memory_prompt.yml │ └── log_prompt.yml ├── AGENTS.md(智能体注册表) ├── copilot-instructions.md(项目级规则) └── sprints/ ├── sprint_01_instructions.md └── epic_variations/
### Governance & Standards
**Instructions Hierarchy:**
1. `copilot-instructions.md` - Project-wide immutable rules
2. Sprint instructions - Temporal variations per sprint
3. Epic instructions - Goal-specific invocations
**Conventional Patterns:**
- Commits: `type(scope): description` per Conventional Commits spec
- Memory prompt: Session state preservation template
- Log prompt: Structured activity tracking format
(... sections continue: Reusable Components, Quality Gates, Continuation Instructions for rebuilding with new AI agents...)
说明
通用性:结构必须能被任何 AI 平台(ChatGPT、Claude、Gemini 等)解析
完整性与简洁性的平衡:在全面上下文与可读性之间取得平衡——使用嵌套章节来呈现深层细节
版本控制:包含时间戳和来源平台,以便在多次交接中追踪上下文的演变
行动导向:始终以清晰的「延续查询」结尾——即下一个 AI 应使用的确切提示词
项目规模适配:对于完整的项目迁移(案例 3),大幅扩展「项目结构」章节,同时保持其他章节简洁
失败记录:明确记录哪些做法没有奏效以及原因——这能防止下一个 AI 重蹈覆辙
规则保留:当规则/协议在会话过程中被确立时,包含其为何需要被制定的背景
假设验证:将假设标记为「已验证」、「待验证」或「已失效」,以保持清晰
- 适用于 GEMINI / GEMINI-CLI / ANTIGRAVITY
以下为极简版本:
GEMINI.md "# 跨平台的 Gemini AI 智能体
workflow/agent/sample.toml "# antigravity 提示词模板
MEMORY.md "# Gemini 记忆
会话:2026-01-07 | Sprint 01(剩余 7 天)| Epic EPIC-001(45%)
进行中:TASK-001-03 库存 CRUD API(GET/POST 已完成,PUT/DELETE 待完成)
决策:PostgreSQL + JSONB,RESTful /api/v1/,pytest 测试
下一步:完成 PUT/DELETE 端点,最终确定 schema"
English original
Context Preservation & Migration Prompt
[ for AGENT.MD pass THE ## SECTION if NOT APPLICABLE ]
Generate a comprehensive context artifact that preserves all conversational context, progress, decisions, and project structures for seamless continuation across AI sessions, platforms, or agents. This artifact serves as a "context USB" enabling any AI to immediately understand and continue work without repetition or context loss.
Core Objectives
Capture and structure all contextual elements from current session to enable:
- Session Continuity - Resume conversations across different AI platforms without re-explanation
- Agent Handoff - Transfer incomplete tasks to new agents with full progress documentation
- Project Migration - Replicate entire project cultures, workflows, and governance structures
Content Categories to Preserve
Conversational Context
- Initial requirements and evolving user stories
- Ideas generated during brainstorming sessions
- Decisions made with complete rationale chains
- Agreements reached and their validation status
- Suggestions and recommendations with supporting context
- Assumptions established and their current status
- Key insights and breakthrough moments
- Critical keypoints serving as structural foundations
Progress Documentation
- Current state of all work streams
- Completed tasks and deliverables
- Pending items and next steps
- Blockers encountered with mitigation strategies
- Rate limits hit and workaround solutions
- Timeline of significant milestones
Project Architecture (when applicable)
- SDLC methodology and phases
- Agent ecosystem (main agents, sub-agents, sibling agents, observer agents)
- Rules, governance policies, and strategies
- Repository structures (.github workflows, templates)
- Reusable prompt forms (epic breakdown, PRD, architectural plans, system design)
- Conventional patterns (commit formats, memory prompts, log structures)
- Instructions hierarchy (project-level, sprint-level, epic-level variations)
- CI/CD configurations (testing, formatting, commit extraction)
- Multi-agent orchestration (prompt chaining, parallelization, router agents)
- Output format standards and variations
Rules & Protocols
- Established guidelines with scope definitions
- Additional instructions added during session
- Constraints and boundaries set
- Quality standards and acceptance criteria
- Alignment mechanisms for keeping work on track
Steps
- Scan Conversational History - Review entire thread/session for all interactions and context
- Extract Core Elements - Identify and categorize information per content categories above
- Document Progress State - Capture what's complete, in-progress, and pending
- Preserve Decision Chains - Include reasoning behind all significant choices
- Structure for Portability - Organize in universally interpretable format
- Add Handoff Instructions - Include explicit guidance for next AI/agent/session
Output Format
Produce a structured markdown document with these sections:
# CONTEXT ARTIFACT: [Session/Project Title]
**Generated**: [Date/Time]
**Source Platform**: [AI Platform Name]
**Continuation Priority**: [Critical/High/Medium/Low]
## SESSION OVERVIEW
[2-3 sentence summary of primary goals and current state]
## CORE CONTEXT
### Original Requirements
[Initial user requests and goals]
### Evolution & Decisions
[Key decisions made, with rationale - bulleted list]
### Current Progress
- Completed: [List]
- In Progress: [List with % complete]
- Pending: [List]
- Blocked: [List with blockers and mitigations]
## KNOWLEDGE BASE
### Key Insights & Agreements
[Critical discoveries and consensus points]
### Established Rules & Protocols
[Guidelines, constraints, standards set during session]
### Assumptions & Validations
[What's been assumed and verification status]
## ARTIFACTS & DELIVERABLES
[List of files, documents, code created with descriptions]
## PROJECT STRUCTURE (if applicable)
### Architecture Overview
[SDLC, workflows, repository structure]
### Agent Ecosystem
[Description of agents, their roles, interactions]
### Reusable Components
[Prompt templates, workflows, automation scripts]
### Governance & Standards
[Instructions hierarchy, conventional patterns, quality gates]
## HANDOFF INSTRUCTIONS
### For Next Session/Agent
[Explicit steps to continue work]
### Context to Emphasize
[What the next AI must understand immediately]
### Potential Challenges
[Known issues and recommended approaches]
## CONTINUATION QUERY
[Suggested prompt for next AI: "Given this context artifact, please continue by..."]
Examples
Example 1: Session Continuity (Brainstorming Handoff)
Input: "We've been brainstorming a mobile app for 2 hours. I need to switch to Claude. Generate context artifact."
Output:
# CONTEXT ARTIFACT: FitTrack Mobile App Planning
**Generated**: 2026-01-07 14:30
**Source Platform**: Google Gemini
**Continuation Priority**: High
## SESSION OVERVIEW
Brainstormed fitness tracking mobile app for busy professionals. Decided on minimalist design with AI coaching. Ready for technical architecture phase.
## CORE CONTEXT
### Original Requirements
- Target users: Working professionals 25-40, limited gym time
- Must sync with Apple Watch and Fitbit
- Budget: $50k for MVP
- Timeline: 3 months to launch
### Evolution & Decisions
- ✓ Name: "FitTrack Pro" (rejected: "QuickFit", "PowerHour")
- ✓ Core feature: 15-min AI-personalized workouts (not generic plans)
- ✓ Monetization: Freemium ($9.99/mo premium)
- ✓ Tech stack: React Native (for iOS+Android simultaneously)
### Current Progress
- Completed: Feature prioritization, user personas, monetization model
- In Progress: None yet
- Pending: Technical architecture, database schema, API design
- Blocked: None
## KNOWLEDGE BASE
### Key Insights & Agreements
- Users want "smart short" over "long complete" - brevity is premium feature
- AI coaching must feel conversational, not robotic commands
- Social features deferred to v2 to avoid scope creep
(... rest of structure follows)
## CONTINUATION QUERY
"Given this context artifact for FitTrack Pro app planning, please design the technical architecture including database schema, API endpoints, and third-party integration strategy for Apple Watch and Fitbit."
Example 2: Agent Handoff (Rate-Limited Automation)
Input: "Browser agent hit rate limit while scraping competitor pricing. Generate handoff doc."
Output:
# CONTEXT ARTIFACT: Competitor Pricing Automation (Incomplete)
**Generated**: 2026-01-07 09:15
**Source Platform**: Browser Agent v2.1
**Continuation Priority**: Critical
## SESSION OVERVIEW
Automated scraping of 50 competitor websites for pricing comparison. Completed 32/50 before rate limiting. Need immediate continuation to meet Friday deadline.
## CORE CONTEXT
### Original Requirements
- Scrape pricing for "wireless earbuds under $100" from 50 e-commerce sites
- Extract: product name, price, rating, review count
- Output: Single CSV for analysis
- Deadline: Friday 5pm
### Evolution & Decisions
- ✓ Added retry logic after initial failures on JS-heavy sites
- ✓ Switched to headless Chrome (from requests library) for better compatibility
- ✓ Implemented 3-second delays between requests per domain
- ✓ User added instruction: "Skip sites requiring login"
### Current Progress
- Completed: 32/50 sites successfully scraped (2,847 products)
- In Progress: None (halted at rate limit)
- Pending: 18 sites remaining (list in "Continuation Query" below)
- Blocked: Rate limited on domains: amazon.com, walmart.com, target.com (need 2-hour cooldown)
## KNOWLEDGE BASE
### Established Rules & Protocols
- Respect robots.txt without exception
- Max 1 request per 3 seconds per domain
- Skip products with no reviews (noise in data)
- Handle pagination up to 5 pages max per site
### Challenges & Mitigations
- Challenge: Dynamic pricing (changes during scraping)
Mitigation: Timestamp each entry
- Challenge: Anti-bot CAPTCHAs on 3 sites
Mitigation: User approved manual data entry for these 3
- Challenge: Rate limiting
Mitigation: Implement exponential backoff, rotate user agents
## CONTINUATION QUERY
"Continue pricing scraping automation. 18 sites remaining: [bestbuy.com, newegg.com, ebay.com...]. Use existing CSV 'pricing_data_partial.csv' (2,847 entries). Rate-limited domains need 2hr wait. Prioritize non-blocked sites first. Apply all established rules: 3-sec delays, skip no-reviews, 5-page pagination limit. Deliver final CSV by Friday 5pm."
Example 3: Project Migration (Full Culture Transfer)
(Input context: Entire project repository with SDLC, agents, governance)
Output: (Condensed example showing structure - real output would be comprehensive)
# CONTEXT ARTIFACT: "SmartInventory" Project Culture & Architecture
**Generated**: 2026-01-07 16:00
**Source Platform**: GitHub Copilot + Multi-Agent System
**Continuation Priority**: Medium (onboarding new AI agent framework)
## SESSION OVERVIEW
Enterprise inventory management system using AI-driven development culture. Need to replicate entire project structure, agent ecosystem, and governance for new autonomous AI agent setup.
## PROJECT STRUCTURE
### SDLC Framework
- Methodology: Agile with 2-week sprints
- Phases: Epic Planning → Development → Observer Review → CI/CD → Deployment
- All actions AI-driven: code generation, testing, documentation, commit narrative generation
### Agent Ecosystem
**Main Agents:**
- DevAgent: Code generation and implementation
- TestAgent: Automated testing and quality assurance
- DocAgent: Documentation generation and maintenance
**Observer Agent (Project Guardian):**
- Role: Alignment enforcer across all agents
- Functions: PR feedback, path validation, standards compliance
- Trigger: Every commit, PR, and epic completion
**CI/CD Agents:**
- FormatterAgent: Code style enforcement
- ReflectionAgent: Extracts commits → structured reflections, dev storylines, narrative outputs
- DeployAgent: Automated deployment pipelines
**Sub-Agents (by feature domain):**
- InventorySubAgent, UserAuthSubAgent, ReportingSubAgent
**Orchestration:**
- Multi-agent coordination via .ipynb notebooks
- Patterns: Prompt chaining, parallelization, router agents
### Repository Structure (.github)
.github/ ├── workflows/ │ ├── epic_breakdown.yml │ ├── epic_generator.yml │ ├── prd_template.yml │ ├── architectural_plan.yml │ ├── system_design.yml │ ├── conventional_commit.yml │ ├── memory_prompt.yml │ └── log_prompt.yml ├── AGENTS.md (agent registry) ├── copilot-instructions.md (project-level rules) └── sprints/ ├── sprint_01_instructions.md └── epic_variations/
### Governance & Standards
**Instructions Hierarchy:**
1. `copilot-instructions.md` - Project-wide immutable rules
2. Sprint instructions - Temporal variations per sprint
3. Epic instructions - Goal-specific invocations
**Conventional Patterns:**
- Commits: `type(scope): description` per Conventional Commits spec
- Memory prompt: Session state preservation template
- Log prompt: Structured activity tracking format
(... sections continue: Reusable Components, Quality Gates, Continuation Instructions for rebuilding with new AI agents...)
Notes
Universality: Structure must be interpretable by any AI platform (ChatGPT, Claude, Gemini, etc.)
Completeness vs Brevity: Balance comprehensive context with readability - use nested sections for deep detail
Version Control: Include timestamps and source platform for tracking context evolution across multiple handoffs
Action Orientation: Always end with clear "Continuation Query" - the exact prompt for next AI to use
Project-Scale Adaptation: For full project migrations (Case 3), expand "Project Structure" section significantly while keeping other sections concise
Failure Documentation: Explicitly capture what didn't work and why - this prevents next AI from repeating mistakes
Rule Preservation: When rules/protocols were established during session, include the context of WHY they were needed
Assumption Validation: Mark assumptions as "validated", "pending validation", or "invalidated" for clarity
- FOR GEMINI / GEMINI-CLI / ANTIGRAVITY
Here are ultra-concise versions:
GEMINI.md "# Gemini AI Agent across platform
workflow/agent/sample.toml "# antigravity prompt template
MEMORY.md "# Gemini Memory
Session: 2026-01-07 | Sprint 01 (7d left) | Epic EPIC-001 (45%)
Active: TASK-001-03 inventory CRUD API (GET/POST done, PUT/DELETE pending)
Decisions: PostgreSQL + JSONB, RESTful /api/v1/, pytest testing
Next: Complete PUT/DELETE endpoints, finalize schema"