Skip to content

docs(prompts): extract all in-repo system prompts into docs/prompts#5299

Open
qiaone wants to merge 1 commit into
esengine:main-v2from
qiaone:prompt-doc
Open

docs(prompts): extract all in-repo system prompts into docs/prompts#5299
qiaone wants to merge 1 commit into
esengine:main-v2from
qiaone:prompt-doc

Conversation

@qiaone

@qiaone qiaone commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds a new docs/prompts/ corpus that captures every LLM-facing system / instruction prompt living inside the Reasonix repository today, organised into 14 focused chapters with a top-level index.

The goal is to give contributors and reviewers a single place to:

  • read the exact string the model sees, with zero paraphrasing;
  • locate the source constant / file / line so any divergence can be fixed at the source;
  • understand when and why each prompt is injected (compose path, retry path, subagent boundary, output-style overlay, ...);
  • cross-reference the cache-stable prefix design that the rest of the codebase already revolves around.

Nothing executable is touched — this is documentation only.

What's inside docs/prompts/

File Coverage
README.md Index, reading order, source-code map
01-default-system-prompt.md DefaultSystemPrompt
02-policies.md UserDecisionPolicy, LanguagePolicy, ReasoningLanguageBlock
03-plan-mode.md Plan-mode marker, auto-plan classifier, planApprovedMessage
04-goal-mode-and-autoresearch.md activeGoalBlock, autoResearchGoalInstructions, goalContinueTurn, goalSelfCheckTurn, transient compose-time blocks
05-coordinator-handoff.md DefaultPlannerPrompt, formatHandoff, executor-handoff retry
06-task-subagents.md DefaultTaskSystemPrompt, DefaultReadOnlyTaskSystemPrompt, subagentToolBoundarySummary
07-builtin-skills.md explore / research / review / security-review / test / init / install-capability
08-compaction.md summarySystemPrompt and the three wrap-text variants
09-retry-and-recovery.md streamRecoveryMessage, emptyFinalRetryMessage, finalReadinessRetryMessage, executorHandoffRetryMessage + the keyword tables that gate them
10-token-economy.md tokenEconomyPrompt
11-server-and-utility.md titlePrompt, prometheusPrompt, conductor template, e2e/benchmark prompts
12-custom-commands.md .reasonix/commands/*.md user-level slash templates
13-output-styles.md Built-in explanatory / learning / concise and KeepCoding overlay

Each chapter follows the same template: source file + symbol → role → injection trigger → verbatim original text → Chinese translation → design notes / cross-refs.

How this was produced

Every string was lifted directly from the Go source (internal/agent/agent.go, internal/config/config.go, internal/skill/builtins.go, internal/agent/task.go, internal/agent/compact.go, internal/control/*.go, internal/outputstyle/outputstyle.go, internal/serve/serve.go, ...) — never paraphrased. Where a prompt is assembled at runtime (e.g. the /plan-exec conductor template, formatHandoff), the doc shows the actual strings.Builder skeleton with the same \n\n separators.

Why this is worth landing

  1. Reviewer ergonomics. Today, locating a particular instruction means grepping across internal/agent, internal/config, internal/skill, internal/control, internal/outputstyle, etc. The index makes the surface area auditable in one read.
  2. Cache-prefix discipline. Several chapters explicitly call out the cache-stable layering (e.g. how policy blocks attach after the persona, why DefaultReadOnlyTaskSystemPrompt is the very first message of a read-only subagent transcript, how transient <memory-update> / Referenced context: blocks are stripped before they reach the persisted prefix). This complements REASONIX.md § Cache-impact PR metadata and scripts/check-cache-impact.sh.
  3. Onboarding & external integrations. Anyone wanting to write a custom skill, a /command, or an MCP integration that respects the existing prompt contract can now read one document instead of reverse-engineering the agent loop.
  4. Drift detection. Because every section names the source symbol, future prompt edits become trivially diff-able against the doc. (Happy to follow up with a small CI check that re-extracts the constants and diffs them against these chapters if maintainers want it.)

What this PR does not do

  • No internal/** source file is modified.
  • No prompt text is altered or re-worded — only documented.
  • No new dependency, no new build target, no new CI job.
  • No change to the model-visible byte stream, anywhere.

Verification

  • git diff --name-only upstream/main-v2...HEAD — every entry is under docs/prompts/.
  • bash scripts/check-cache-impact.sh against the changed file list prints No cache-sensitive prompt/tool files changed. and exits 0 (none of the documented chapters touch any path in the script's cache_sensitive allow-list).
  • go build ./... and go test ./... are unaffected by this change set.

Cache metadata (per CONTRIBUTING.md § Cache-first review gate)

Even though the cache-impact script auto-passes for docs-only diffs, I'm filling these in explicitly so reviewers don't have to double-check:

Cache-impact: none — documentation-only change under docs/prompts/; no Go source, no system-prompt construction, no tool schema, no provider serialization, and no compaction code is modified. The model-visible byte stream is byte-identical before and after this PR.

Cache-guard: not applicable — scripts/check-cache-impact.sh exits 0 with No cache-sensitive prompt/tool files changed. for the file list in this PR; existing scripts/cache-guard.sh release-level coverage is unchanged.

System-prompt-review: none required — no file under internal/agent/task.go, internal/boot/, internal/config/, internal/memory/, internal/outputstyle/, or internal/skill/ is modified; the documentation only quotes existing constants verbatim.

Follow-ups I'm happy to do in separate PRs

  • Add a tiny scripts/check-prompt-doc-drift.sh that re-greps the documented constants and fails CI if a quote drifts from the source.
  • Translate the chapters into English-only mirrors if the maintainers prefer a single-language reference.

Thanks for considering — happy to split, restructure, or shrink the corpus per reviewer preference.

Collect every LLM-facing system / instruction prompt embedded in the Reasonix source tree into a self-contained reference under docs/prompts. Each file documents the source (file + symbol), purpose, trigger condition, and verbatim text of the prompt.

Coverage:

 01 default system prompt (DefaultSystemPrompt)

 02 global policies (UserDecisionPolicy, LanguagePolicy, ReasoningLanguageBlock)

 03 plan mode (marker, auto-plan classifier, planApprovedMessage)

 04 goal mode and autoresearch (activeGoalBlock, autoResearchGoalInstructions, goalContinueTurn, goalSelfCheckTurn)

 05 coordinator handoff (DefaultPlannerPrompt, formatHandoff, executor handoff retry)

 06 task subagents (DefaultTaskSystemPrompt, DefaultReadOnlyTaskSystemPrompt)

 07 builtin skills (explore, research, review, security-review, test, init, install-capability)

 08 compaction (summarySystemPrompt)

 09 retry and recovery (streamRecoveryMessage, emptyFinalRetryMessage, finalReadinessRetryMessage)

 10 token economy (tokenEconomyPrompt)

 11 server and utility (titlePrompt, conductor, prometheusPrompt)

 12 custom commands (.reasonix/commands/*.md user templates)

 13 output styles (explanatory, learning, concise, KeepCoding behavior)

Pure documentation; no production code is touched.
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant