Skip to content

fix: align system prompt with PI rules - #14

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
5258MF:2026-08-13_system-prompt-align
Aug 13, 2026
Merged

fix: align system prompt with PI rules#14
ranxianglei merged 1 commit into
ranxianglei:masterfrom
5258MF:2026-08-13_system-prompt-align

Conversation

@5258MF

@5258MF 5258MF commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR refreshes and replaces #5 on the current monorepo. It aligns the shared OpenCode system prompt with the more mature PI implementation by embedding the complete compression guidance exported by acp-kernel@0.0.19.

The change is prompt-only: it does not modify tool registration, V1/V2 message conversion, state, schemas, or kernel behavior.

What changed

  • Embed these four kernel constants verbatim and exactly once:
    • COMPRESS_PHILOSOPHY
    • HOW_TO_COMPRESS_RULES
    • TIER2_DISTILL_RULES
    • TIER3_CONDENSE_RULES
  • Expand the OpenCode-specific guide for:
    • bili_compress, including single, batch, and block-boundary examples
    • bili_decompress, including block and single-message refs, default output modes, inline:true, and full:true
    • bili_search, including search-before-decompress guidance
    • bili_status, including the supported scope and view modes
  • Explain that compressed summaries are historical model-generated metadata, not current user instructions.
  • Add host-neutral ACP-tag wording because the shared prompt is used by both host paths.
  • Remove the inaccurate adaptive-threshold claim. In acp-kernel@0.0.19, the configured floor and cap are both 50,000 tokens.
  • Add four focused regression tests.

Known limitation: compress vs bili_compress

acp-kernel@0.0.19 uses the generic tool name compress in HOW_TO_COMPRESS_RULES and in its injected nudge text, while this plugin registers the tool as bili_compress.

This PR deliberately:

  • keeps all kernel constants verbatim;
  • does not replace compress with bili_compress;
  • does not add an alias;
  • does not add a temporary mapping explanation to the prompt; and
  • does not claim that the naming mismatch is fixed.

Before this change, the mismatch was exposed when the kernel injected a nudge. After this change, the same generic wording also appears in the persistent system prompt because HOW_TO_COMPRESS_RULES is now embedded there. The model can see the separately documented registered tool name, but it may still attempt to call the unavailable compress name.

A precise OpenCode adapter mapping, if adopted, should be reviewed in a separate follow-up PR after this prompt PR is merged.

Scope

  • packages/core/src/system-prompt.ts
  • packages/billion-context-opencode/tests/system-prompt.test.ts
  • devlog/2026-08-13_system-prompt-align/

No dependency or lockfile changes are included.

Validation

  • npm run typecheck — pass
  • npm test — pass, 30/30 (4 new tests)
  • npm run build — pass
  • bash scripts/ci/check-pr.sh 2026-08-13_system-prompt-align upstream/master — pass
  • git diff --check — pass

The rendered prompt is 15,261 characters (approximately 3,815 tokens using the rough characters/4 estimate; this is not an exact tokenizer count).

Independent review

Two independent review agents approved the final change. Their adversarial review led to two accuracy fixes before approval: protected tool output is excluded from compression but may still be emergency-truncated, and bili_decompress supports both block IDs and single-message refs.

Risk and rollback

The principal risk is the explicitly unresolved tool-name mismatch above, plus the larger static prompt. Rollback requires reverting only this prompt/test/devlog change; there is no persisted-data or schema migration.

@5258MF

5258MF commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Dual-agent review record

Two independent review agents reviewed the source change and approved the final revision.

  • Reviewer 1 checked the four verbatim kernel constants, actual tool schemas/capabilities, V1/V2-neutral wording, threshold claims, type safety, compatibility scope, tests, and devlog. Final result: APPROVE, no blocking findings.
  • Reviewer 2 performed an adversarial review and initially found two accuracy issues: protected tool output was incorrectly described as always intact, and single-message decompression had been omitted. Both were corrected with focused positive/negative assertions. The reviewer then rechecked the final diff. Final result: APPROVE, no remaining blocking findings.

Both reviewers explicitly confirmed that this PR introduces no compress to bili_compress conversion or alias. The unresolved naming mismatch remains a disclosed, accepted non-blocking risk for this PR.

Final local verification:

  • npm run typecheck: pass
  • npm test: 30/30 pass
  • npm run build: pass
  • PR validation script: pass
  • git diff --check: pass

@ranxianglei
ranxianglei merged commit 97b76af into ranxianglei:master Aug 13, 2026
3 checks passed
@ranxianglei ranxianglei mentioned this pull request Aug 15, 2026
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.

2 participants