Skip to content

blessuselessk/ContextCloak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ContextCloak

Gordian Envelope cryptographic primitives for Promptyst. Granular elision, selective disclosure, and verifiable privacy — down to one character.


Install

#import "@preview/contextcloak:0.1.0": *

Quick Start

#import "@preview/contextcloak:0.1.0": *

// Any dictionary — typically a Promptyst prompt dict
#let my-prompt = (
  id: "deploy-service",
  version: "1.0.0",
  role: "You are a deployment orchestrator.",
  steps: ("Validate.", "Deploy.", "Verify."),
)

// Wrap it in an envelope (computes SHA-256 digests)
#let env = cc-wrap(my-prompt)

// Elide sensitive fields — root digest stays the same
#let redacted = cc-elide(env, fields: ("role",))

// Render as Markdown with elision placeholders
#raw(render-envelope(redacted), lang: "markdown")

Primitives

Constructor Returns
cc-digest(value) SHA-256 hex string
cc-wrap(dict) envelope dict
cc-salt(envelope, salt: str) salted envelope dict
cc-elide(envelope, fields: array) envelope with elided fields
cc-granular-wrap(text, grain: str) granular Merkle tree
cc-granular-elide(granular, indices: array) granular with elided nodes

Renderers

Function Returns
render-envelope(e) Markdown with [ELIDED] placeholders
render-digest-tree(e) audit digest table
render-granular(g) string with for elided units

Character-Level Elision

#let g = cc-granular-wrap("secret key here", grain: "word")
#let redacted = cc-granular-elide(g, indices: (1,))
#render-granular(redacted)
// Output: "secret █ here"

Design

See PLANNING.md for the full project design, Gordian Envelope mapping, dependency analysis, and phased delivery plan.

ContextCloak is an opinionated layer on top of Promptyst, following the Boundary Contract:

  • Imports only Promptyst's public API
  • Uses cc- prefix for all symbols
  • Defines its own _type namespace ("cc-envelope", "cc-elided", "cc-granular")
  • Zero modifications to upstream Promptyst

Dependencies

License

MIT

About

ContextCloak enables capability-scoped prompt construction — where context is not merely written, but selectively revealed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors