Eve library

PROMPT-001 evidence pack — shared typed trust-zone renderer

Evidence

Revision 1

On this page

Work-package charter#

  • Task ID: PROMPT-001
  • Owner: shared prompt-security and content-quality-judge maintainers; implementation owner: Codex
  • Accountable products: V1–V9 model-boundary platform, with CQJ as the reference migration
  • Priority: P0
  • Target milestone: 2026-07-15 SOTA gap-closure program
  • Risk tier: Critical prompt-injection, authority-confusion, privacy, and provenance risk
  • Dependencies: shared provider contracts and the existing CQJ delimiter red-team boundary
  • Rollback strategy: Revert the source commit. The package and CQJ provenance fields are additive; no persistence migration, provider call, or user-facing UI is introduced.
  • Evidence-pack location: This file

Authoritative shared primitive#

@oshun/prompt-trust is the common typed renderer. Its stable contract version is oshun-prompt-trust.v1. It owns the CQJ-compatible <<<BEGIN_UNTRUSTED_CONTENT>>> / <<<END_UNTRUSTED_CONTENT>>> delimiters, sanitization, prompt-size bounds, exact prompt hashing, trust labels, source references, and privacy-governed completion evidence.

The origin taxonomy covers user, source, retrieval, canon, world, memory, prior model output, critique, tool result, artifact, and policy. Origin and trust are separate: canon/world data may be trusted-context, but every data zone remains explicitly non-instruction. Runtime validation rejects unknown origins, policy data zones, and attempts to label a zone authoritative.

Authority fields are branded and can only be created through definePromptAuthorityField. System policy, tool authority, source scope, rights, and release law are forced into system authority; only an ordinary task instruction may be placed in the user channel. Model-controlled content cannot be structurally assigned as an authority field, and delimiter-like authority text fails closed.

Delimiter, encoding, and length safety#

The renderer preserves ordinary CQJ fence output while neutralizing literal delimiter runs plus HTML entity, nested HTML entity, percent/double-percent, URL-encoded entity, JavaScript Unicode/hex escape, full-width Unicode, and base64-encoded delimiter forms. The model-visible immunity clause states that decoded, escaped, quoted, and obfuscated data cannot create instructions, tools, authority, source scope, rights, or release law.

Sanitization and truncation do not erase evidence identity. Each trust label records the SHA-256 of original content, the rendered-content SHA-256, original and rendered lengths, effective bound, omitted count, transformations, and source references. The default per-zone bound is 24,000 characters and the default whole-prompt bound is 96,000. Head/tail truncation includes the original content hash, so two inputs that differ only in omitted content still produce different prompt hashes.

Prompt and completion provenance#

Every render records:

  • renderer version and exact system/user/prompt SHA-256 identities;
  • origin, trust, instruction semantics, placement, transformations, and truncation for every authority field and zone; and
  • deduplicated source references with conflict rejection.

recordPromptCompletion adds provider, provider version, routed model, model version, privacy-policy version, response status, and policy-permitted raw response/hash. Privacy modes are retain, redact, and omit. Omission defaults to retaining neither response nor hash. Invalid modes, incomplete identity, or a redactor that does not return a string fail closed.

CQJ now uses an explicit oshun-cqj-prompt-audit.v1 retention policy to retain its established raw-response behavior. Callers can override it with redaction or omission. Parse failures carry the same typed prompt/completion audit while their error payload contains only the privacy-permitted response; an omitted secret response is not leaked through JudgeParseError.raw.

CQJ reference migration#

JudgeEngine pointwise, pairwise, calibration-example, and panel-context prompts now render through the shared primitive. Calibration examples and panel critique are isolated as non-instruction data rather than concatenated into policy. Pairwise forward and reverse orderings retain separate exact prompt audits plus the existing aggregate comparison hash.

PlayerProxyEvaluator uses the same renderer and completion audit. Public CQJ exports for fenceUntrusted, delimiter constants, and the immunity clause are preserved for compatibility, but their implementation is now shared.

Adversarial and integration proof#

The affected suites prove:

  • all eleven required origins and authoritative/trusted/untrusted semantics;
  • system-only placement for policy, tools, source scope, rights, and release law, including forged-authority and runtime trust-promotion rejection;
  • literal and encoded delimiter neutralization with original evidence identity;
  • deterministic head/tail truncation, total prompt bounds, source-reference capture, and hash changes for omitted-content changes;
  • retain/redact/omit response policy, provider/model version identity, and privacy-safe parse failures;
  • CQJ pointwise/pairwise position-bias behavior, calibration examples, panel context, red-team probes, and PlayerProxy behavior after migration; and
  • the Iris run-adapter strict typecheck repair required by the CQJ dependency graph, with its dedicated contract tests.

Automated verification#

  • Complete content-quality-judge regression on final task source: 283/283 across 34/34 files.
  • Complete prompt-trust regression: 8/8 in 1/1 file.
  • Focused Iris common-run adapter regression: 5/5 in 1/1 file.
  • Total authoritative regression: 296/296 across 36/36 files.
  • Prompt-trust, content-quality-judge, and Iris agents-core TypeScript checks: zero errors.
  • Official prompt-trust lint target: zero errors and zero warnings.
  • Exact changed production TypeScript, with the inherited CQJ boundary rule disabled, passes all remaining ESLint rules with zero errors and warnings; prompt-trust and the Iris adapter pass the complete rule set.
  • Prettier passes for every changed source/config/document file; the final whitespace check passes.
  • The merged pnpm lock parses successfully and contains the exact CQJ link plus prompt-trust importer. A textual comparison proves the first remote merge's lock differs from origin/main only by those two importer additions.
  • After the lock-overlapping remote merge, the affected subset passed 43/43 across 4/4 files plus both affected typechecks. After the final non-overlapping remote merge, prompt-trust passed 8/8 again.

The official CQJ package lint target remains red on its pre-existing shared-to-Iris architecture baseline: 15 module-boundary errors and 7 non-null warnings across unchanged and changed files. The two changed CQJ provider files retain their established @iris/agents-core imports; the new @oshun/prompt-trust dependency is correctly tagged scope:shared / layer:infra and produces no boundary finding. Eliminating the CQJ package's existing Iris coupling requires a separate provider-contract architecture migration; suppressing or broadening the repository constraint was not treated as a valid PROMPT-001 fix. This missing all-green package lint is the explicitly documented inherited verification blocker.

Artifact identity#

Artifact SHA-256
libs/shared/prompt-trust/src/trust-zone.ts 8bca39bd9402586cf8ae002ae43e035706950f963d32f2cc8c058655ec136353
libs/shared/prompt-trust/src/trust-zone.spec.ts 1ae309b33b0e330faa22059467d8fdb6945b33da253950ea2617b0c15d44696a
libs/shared/prompt-trust/src/index.ts 793ae5b621b3367f4f44d682e56accefda3b2cde089890283ed3c9eb243403f4
libs/shared/prompt-trust/README.md a01ac6398f265499d07bbee365c20d371adec58d5f1a0085f66e6ee150debb7d
libs/shared/prompt-trust/package.json f6cd8908cea7c3545f75bff0f4356cd762d9559643eec3cf861089389bae1cc3
libs/shared/prompt-trust/project.json c31e6d12866c36beec4f5c2b1a40cc59f93a263f8f1692fa18dac690c9491abd
libs/shared/content-quality-judge/src/judge-engine.ts 34c70c0e1250d480a9105cad52a768d8e731e5647657077a3c13d2af2c22d8b5
libs/shared/content-quality-judge/src/judge-engine.spec.ts 84ba56d054f039a660851aeca00f285afa1393a40f8ae47420ec74476e2f831e
libs/shared/content-quality-judge/src/player-proxy.ts b82ebe5c1515cb472800c3457aac1c35284158c941f593ee6967cbf8b4daeda6
libs/shared/content-quality-judge/src/player-proxy.spec.ts 26133f65f7336c14352e91bd1029bcb4cd83254d610e7835dc05573c9ceb37c4
libs/shared/content-quality-judge/src/errors.ts 64bf814bbfb90d19d03aefb55f63467332efaf6863643109bd4cbfb31a2941eb
libs/iris/agents/core/src/agentic/common-run-adapter.ts 2942df13641454e0e7d8ce3c76c3e8c718691157a0eea19c5c059ff094440807

Resource-safe verification#

The host reported 15 GiB RAM, 31 GiB swap, 10 GiB available memory, and 38 GiB free disk before final verification. An existing Nx daemon and local web process were active, so all tests and typechecks ran directly, sequentially, and with one Vitest worker. Two accidentally overlapping scoped pnpm graph recalculations were stopped at 6.7 GiB available memory; no OOM occurred and the lockfile was instead reconciled and parsed deterministically. No full-workspace run-many, Next production build, Expo, Tauri, native release, or Unreal build was attempted. Final source verification completed at 2026-07-16T15:55:18Z on Linux 6.8.0-110 with Node 24.14.1 and pnpm 10.25.0.

Scope and negative proof#

  • PROMPT-001 creates the shared primitive and migrates the CQJ reference boundary. It does not claim that every V1–V9 model boundary is migrated; inventory and migration of those boundaries remain PROMPT-002.
  • It does not change rendered customer/admin/PWA/mobile/Unreal UI, so the frontend skill and Playwright/mobile/Unreal automation are inapplicable.
  • Scripted providers exercise the boundary. This pack does not claim a live provider credential, live prompt log, or production privacy-system audit.
  • Branded authority prevents accidental structural assignment and runtime placement errors, but cannot prove the human caller did not intentionally pass model text into the authority factory. Call sites must keep following the documented taint-routing rule; PROMPT-002 verifies each migration.
  • The renderer supplies prompt safety structure, provenance, and fail-closed validation. It does not claim that a model can never disobey its system instruction; CQJ red-team outcomes remain auditable.

Publication identity#

  • Authoritative boundary source commit: 93d6d841e72aca0be8448bc41d2cc2a31f81d06e
  • Source publication tip on origin/main: 1a117aa1cfbf6376f7903f8053af53982605360f
  • Closure evidence commit: 4fd02bbb58dee2fb24b2db9d5d1c7fb0ceadb5df