Skip to content

feat(prompts): inject external knowledge into codegen#364

Merged
ceilf6 merged 1 commit into
developfrom
improve/code-gen-external-knowledge-protocol
Jun 16, 2026
Merged

feat(prompts): inject external knowledge into codegen#364
ceilf6 merged 1 commit into
developfrom
improve/code-gen-external-knowledge-protocol

Conversation

@ceilf6

@ceilf6 ceilf6 commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Linked Issue Or Context

Closes #363.

Summary

  • Reuses the existing EXTERNAL_KNOWLEDGE_PROTOCOL in code-generation prompts.
  • Injects the protocol into generateCodeForFile and generateModifiedCode so executor codegen follows the same external-knowledge discipline already added to planner prompts.
  • Adds focused prompt-capture tests for both codegen paths, including the reverse constraint that stable known APIs do not need web_fetch.

Impact Scope

Prompt-only change in packages/core/src/llm/code-generation.ts plus focused tests in packages/core/src/llm/code-generation.test.ts. No schema, tool routing, executor contract, planner, or web_fetch runtime changes.

GitNexus Impact Summary

  • Risk level: LOW
  • Critical skeleton changes: none
  • GitNexus impact: impact(generateCodeForFile, upstream) and impact(generateModifiedCode, upstream) both returned LOW with direct=0, processes_affected=0. Additional call-site inspection shows the changed codegen functions are reached through LLMService thin wrappers from executor create_file/apply_patch codegen paths; signatures and return contracts are unchanged.
  • Verification: gitnexus detect_changes compare against develop reported changed_count=2, changed_files=2, affected_count=0, risk_level=low; changed symbols were generateCodeForFile and generateModifiedCode only.

Verification

Checklist

  • I have linked an issue or explained why this PR stands alone.
  • I have kept the diff focused on the stated change.
  • I have run pnpm quality:precommit, or explained why it could not run.
  • I have run pnpm quality:local for critical skeleton changes, or explained why it could not run.
  • I have updated docs or tests when behavior, public APIs, or Harness contracts changed.
  • For critical skeleton changes, I have filled the GitNexus impact summary with concrete results.

@github-actions

Copy link
Copy Markdown

🛡️ ceilf6/repo-guard

代码评审报告: feat(prompts): inject external knowledge into codegen

风险等级:
处理建议: 批准
决策摘要: ** 可以合并;变更按 Issue #363 的最小范围复用现有 EXTERNAL_KNOWLEDGE_PROTOCOL 注入两条 codegen system prompt,未改变签名、schema、工具路由或执行契约。

级联分析

  • 变更符号: 原始模型未提供结构化级联字段。
  • 受影响流程: 原始模型未提供结构化级联字段。
  • 变更集外调用方: unknown
  • 置信度: degraded

问题发现

  1. [低] 未发现阻塞性问题
    • 证据: diff 仅新增 EXTERNAL_KNOWLEDGE_PROTOCOL import,并插入到 generateCodeForFilegenerateModifiedCode 的 system prompt 末尾;测试直接捕获 generateTextsystem 参数并断言完整协议与关键反向约束短语存在。
    • 受影响调用方/流程: create/modify codegen 路径会收到更完整的 system prompt,但函数输入输出契约保持不变。
    • 最小可行修复: 无需合并前修改;若后续协议常量内容变动,现有测试会继续验证 codegen 侧复用同一常量而非复制漂移。

行级发现

  • 无明确变更行归属。

Karpathy 评审

  • 假设: 模型输出需要归一化为固定 Markdown 契约。
  • 简洁性: 已提取 summary、finding、evidence 与 fix;原始 prose 不再附在评论中,避免占用下游解析与代理上下文。
  • 变更范围: 原始模型未提供结构化范围字段。
  • 验证: 需要查看 CI、测试或人工 CR 证据补强合并信心。

缺失覆盖

  • 输出未命中 Repo Guard Markdown 契约;建议补充真实模型质量评估覆盖。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(prompts): inject external-knowledge discipline into code-generation prompts (learned from CLAUDE-FABLE-5)

1 participant