Skip to content

refactor(prompts): extract knowledge system prompts to .md, unify product name to dikw#246

Merged
helebest merged 2 commits into
mainfrom
worktree-refactor+extract-system-prompts
Jun 28, 2026
Merged

refactor(prompts): extract knowledge system prompts to .md, unify product name to dikw#246
helebest merged 2 commits into
mainfrom
worktree-refactor+extract-system-prompts

Conversation

@helebest

Copy link
Copy Markdown
Collaborator

What

Extract the three inline system-prompt constants under domains/knowledge into
packaged prompts/*.md, loaded via prompts.load(...) like every other prompt
(CLAUDE.md "Don't inline prompts in code"). Unify every packaged prompt's product
self-reference from dikw-core to dikw, and give the two lint system prompts
the same standard self-intro the other authoring prompts already carry.

constant (name kept) now loads from
DEFAULT_SYNTH_SYSTEM prompts/synthesize_system.md
_MERGE_SYSTEM prompts/lint_fix_orphan_merge_system.md
_GROUNDED_SYSTEM prompts/lint_fix_broken_wikilink_grounded_system.md
  • Constant names, call sites, and the public surface are unchanged — prompts.load()
    returns the text the literals held.
  • dikw-coredikw across all 10 packaged prompts (synth SP, 2 lint user
    templates, 2 lint system prompts, 5 eval judges). eval/judge.py system constants
    carry no dikw-core and are left untouched.
  • The two lint system prompts drop the bare for `dikw-core` and open with
    the **lint-fix** component of `dikw`, an AI-native knowledge engine that refines raw sources up the … (DIKW) pyramid — task instructions preserved verbatim.

Why no-baseline-needed

K-layer authoring prompts changed, so this is gated by an evals/BASELINES.md
entry or the no-baseline-needed label. The change is cosmetic: the synth system
prompt is byte-identical modulo the product rename; the two lint system prompts
gain only the standard self-intro framing (no task-instruction change); eval-judge
edits are the product name only (eval is report-only, never blocks). No on-disk
format, schema, CLI, or API change.

Tests

tests/test_synth_prompt_examples.py adds three guards (TDD, red→green): each
constant equals its packaged file read independently of the cached load; no
prompts/*.md still says dikw-core; the two lint system prompts carry the
standard self-intro and their task instructions.

Delivery receipt

# step status evidence
3 verify tools/check.py: ruff + mypy + 2386 passed, 138 skipped (skips = live-Postgres contract, run in CI)
4 codex n/a folded into the xhigh code-review workflow
5 fresh-review ✅ PASS extraction verified byte-faithful (synth SP identical modulo rename); lint SP instructions preserved; eval/judge.py correctly untouched
5 /code-review (xhigh) 1 TP fixed (tautological guard test → now reads the packaged file independently + pins task instructions); trailing-\n + import-time-load findings rejected as nit/by-design with rationale
6 doc-sync CHANGELOG Unreleased entry; design.md prompt tree is illustrative (already elides eval prompts) — no change

Triage of rejected findings

  • Trailing \n on extracted .md: the synth SP cache key already rotates once via the intended dikw-coredikw rename; a trailing \n is byte-stable across calls (no cache regression), immaterial to output, and matches the repo .md convention.
  • Import-time load: DEFAULT_SYNTH_SYSTEM was always a module-level constant; packaged resources are guaranteed present (the guard test imports them). Call-time resolve exists for overridable user prompts; these system prompts are non-overridable, so import-time load is the correct, minimal shape.

🤖 Generated with Claude Code

…duct name to `dikw`

Move the three inline system-prompt constants under domains/knowledge into
packaged prompts/*.md, loaded via prompts.load() like every other prompt
(CLAUDE.md "Don't inline prompts in code"). Constant names, call sites and the
public surface are unchanged:

  DEFAULT_SYNTH_SYSTEM -> prompts/synthesize_system.md
  _MERGE_SYSTEM        -> prompts/lint_fix_orphan_merge_system.md
  _GROUNDED_SYSTEM     -> prompts/lint_fix_broken_wikilink_grounded_system.md

Unify every packaged prompt's product self-reference from `dikw-core` to `dikw`
(synth + lint + eval). The two lint system prompts, previously a bare
"for `dikw-core`", now open with the same self-intro the other authoring
prompts use ("the **lint-fix** component of `dikw`, an AI-native knowledge
engine that refines raw sources up the ... (DIKW) pyramid").

Guard tests pin: the constants source from the packaged files, no packaged
prompt still says `dikw-core`, and the two lint system prompts carry the
standard self-intro.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@helebest helebest added the no-baseline-needed Bypass Eval gate: change is genuinely non-functional w.r.t. retrieval/synth metrics label Jun 28, 2026
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@helebest, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 38 minutes and 41 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f7b9e755-04f4-4977-9a21-384476ef7b99

📥 Commits

Reviewing files that changed from the base of the PR and between e3032e4 and 8dd26f8.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • src/dikw_core/domains/knowledge/lint_fixers/broken_wikilink.py
  • src/dikw_core/domains/knowledge/lint_fixers/orphan_page.py
  • src/dikw_core/domains/knowledge/synthesize.py
  • src/dikw_core/prompts/eval_judge_atomicity.md
  • src/dikw_core/prompts/eval_judge_category.md
  • src/dikw_core/prompts/eval_judge_entailment.md
  • src/dikw_core/prompts/eval_judge_synth.md
  • src/dikw_core/prompts/eval_judge_wikilink.md
  • src/dikw_core/prompts/lint_fix_broken_wikilink_grounded.md
  • src/dikw_core/prompts/lint_fix_broken_wikilink_grounded_system.md
  • src/dikw_core/prompts/lint_fix_orphan_merge.md
  • src/dikw_core/prompts/lint_fix_orphan_merge_system.md
  • src/dikw_core/prompts/synthesize_system.md
  • tests/test_synth_prompt_examples.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-refactor+extract-system-prompts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@helebest helebest merged commit 8d61455 into main Jun 28, 2026
11 checks passed
@helebest helebest deleted the worktree-refactor+extract-system-prompts branch June 28, 2026 00:36
helebest added a commit that referenced this pull request Jun 28, 2026
Cut the 0.6.4 release and bump every user-facing version reference ahead
of tagging. Unlike 0.6.3 (a cadence release with `src/` untouched), 0.6.4
ships a real engine-side change: PR #246 extracted the three inline K-layer
system-prompt constants (`DEFAULT_SYNTH_SYSTEM`, `_MERGE_SYSTEM`,
`_GROUNDED_SYSTEM`) into packaged `prompts/*.md` and unified every packaged
prompt's product self-reference from `dikw-core` to `dikw`. Constant names,
call sites, on-disk format, schema, CLI, and API are all unchanged; the wheel
now carries three new prompt resource files.

- Version bump `0.6.3 -> 0.6.4` (`pyproject.toml` + `uv.lock` self-entry).
- CHANGELOG: rename `## Unreleased` -> `## 0.6.4 — …`, open a fresh empty
  `## Unreleased`. The 0.6.4 heading is awk-extractable by `release.yml`'s
  notes extractor.
- Docs/examples: bump the GHCR image tags (`docs/deployment-docker.md`), the
  pip-install pin (`docs/getting-started.md`), the compose `.env` default +
  error-message example (`examples/docker/.env.example`,
  `docker-compose.yml`), and the bug-report version placeholder.
- `examples/docker/Dockerfile` intentionally NOT bumped — `release.yml`'s
  `sync-dockerfile` job auto-bumps it after the tag publishes to PyPI; its
  current `0.6.3` is published, so the Dockerfile guard stays green.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-baseline-needed Bypass Eval gate: change is genuinely non-functional w.r.t. retrieval/synth metrics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant