Skip to content

feat: enhance prompt system with feature-conditional fragments and enriched tool descriptions#77

Merged
yishuiliunian merged 2 commits intomainfrom
feat/prompt-system-enhancement
Apr 4, 2026
Merged

feat: enhance prompt system with feature-conditional fragments and enriched tool descriptions#77
yishuiliunian merged 2 commits intomainfrom
feat/prompt-system-enhancement

Conversation

@yishuiliunian
Copy link
Copy Markdown
Contributor

Summary

  • Activate the dormant Condition::Feature mechanism and wire it from config state (memory, hooks, subagent, output style)
  • Add 6 new prompt fragments: memory guidance, hooks explanation, sub-agent guidelines, anti-hallucination guardrails, and 2 output styles (explanatory, learning)
  • Enrich tool descriptions for 8 tools (Read, Write, Edit, Fetch, WebSearch, EnterPlanMode, ExitPlanMode, AskUser) with behavioral guidance

Changes

Infrastructure (features wiring)

  • system_prompt.rs: add features: Vec<String> parameter to build_system_prompt
  • agent_setup.rs: build features vec from config (memory/hooks/subagent/style), extract MCP append to prompt_post.rs
  • settings.rs: add output_style: String field

New prompt fragments (23→29)

  • core/memory-guidance.md — when/how to use Memory tool
  • core/hooks.md — treat hook feedback as user input
  • tools/agent-guidelines.md — sub-agent spawning strategy
  • tasks/anti-hallucination.md — no fabrication, verify before referencing
  • styles/explanatory.md — educational response style
  • styles/learning.md — collaborative learning style

Enhanced existing content

  • security.md — expanded from 2 lines to 5-layer threat model
  • memory-maintainer.md — 4-type taxonomy, frontmatter format, merge strategy

Tool descriptions enriched

  • Read (image/PDF/notebook support), Write (read-before-write), Edit (indentation/uniqueness), Fetch (auth failure warning), WebSearch (sources requirement), PlanMode (when to use), AskUser (multiSelect/plan mode notes)

Test plan

  • bazel build //... passes
  • bazel build //... --config=clippy zero warnings
  • bazel test //... — 49/49 pass
  • Fragment count updated 23→29
  • Feature-conditional tests (memory, hooks, subagent, style)
  • New plan-mode tool tests (name, description, permission)
  • Fetch description test added

…hed tool descriptions, and output styles (#76)

Activate the dormant Feature condition mechanism in the fragment system
and populate it from config state (memory, hooks, subagent, output style).

- Add 6 new prompt fragments: memory guidance, hooks explanation, sub-agent
  guidelines, anti-hallucination guardrails, explanatory style, learning style
- Expand security.md from 2-line OWASP mention to 5-layer threat model
- Enhance memory-maintainer agent prompt with 4-type taxonomy and frontmatter format
- Enrich tool descriptions for Read, Write, Edit, Fetch, WebSearch, PlanMode, AskUser
- Extract prompt post-processing into prompt_post.rs (agent_setup.rs 222→189 lines)
- Add output_style setting for configurable response styles
- Add feature-conditional fragment tests and plan-mode tool tests
@yishuiliunian yishuiliunian merged commit ebb8b9f into main Apr 4, 2026
3 checks passed
@yishuiliunian yishuiliunian deleted the feat/prompt-system-enhancement branch April 4, 2026 15:54
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.

1 participant