Skip to main content

Versioned prompt registry with semantic search, hashing, and audit trail

Project description

ghostprompt

Versioned prompt registry with semantic search, SHA-256 hashing, and audit trail.

Store prompts by name, pull with variable substitution, search by meaning. Every pull is hashed and logged — optionally sealed to Blackbox via ghostseal.

Install

pip install ghostprompt

Usage

from ghostprompt import PromptRegistry

registry = PromptRegistry()

# Store prompts
registry.store("evaluate_code", "Evaluate this {{language}} code:\n{{code}}", tags=["eval", "code"])
registry.store("write_summary", "Summarize the following in {{length}} words:\n{{text}}", tags=["writing"])

# Pull with variables — returns rendered text + metadata
text, meta = registry.pull("evaluate_code", variables={"language": "Python", "code": "x = 1"})
# text = "Evaluate this Python code:\nx = 1"
# meta.hash = "sha256:a1b2c3..."  (hash of rendered text)
# meta.version = 1

# Search by meaning (requires Ollama with nomic-embed-text)
results = registry.search("code evaluation prompt")
# [("evaluate_code", 0.92), ...]

# Version tracking — templates auto-increment on change
registry.store("evaluate_code", "Review this {{language}} code:\n{{code}}")
info = registry.get("evaluate_code")
# info["version"] = 2

With spine + ghostseal (full audit chain)

from spine import Core
from ghostseal import SealClient
from ghostprompt import PromptRegistry

def setup(c):
    audit = SealClient(blackbox_url="https://blackbox:8443", api_key="...")
    prompts = PromptRegistry(audit=audit)
    prompts.store("evaluate_code", "Evaluate this {{language}} code:\n{{code}}")

    c.register("audit", audit)
    c.register("prompts", prompts)
    c.boot(env="prod")

Core.boot_once(setup)

# Any file:
prompts = Core.instance().get("prompts")
text, meta = prompts.pull("evaluate_code", variables={"language": "Python", "code": "..."})
# → ghostseal emits "ghostprompt.pull" with prompt_name, version, content_hash
# → Blackbox seals it into a hash-chained capsule

Semantic search

Requires Ollama running locally with an embedding model:

ollama pull nomic-embed-text
from ghostprompt import PromptRegistry
from ghostprompt.embedder import Embedder

registry = PromptRegistry(embedder=Embedder())
registry.store("assess_technical_v4", "Evaluate the {{domain}} work...", tags=["evaluation"])

# Search by meaning, not name
results = registry.search("code evaluation prompt")
# [("assess_technical_v4", 0.91)]

Falls back to text substring matching if Ollama isn't available.

Part of the GhostLogic SDK

maelspine   → config registry
ghostseal   → audit backbone
ghostprompt → prompt management (this package)
ghostrouter → LLM routing
ghostserver → MCP tools

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghostprompt-0.1.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghostprompt-0.1.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file ghostprompt-0.1.1.tar.gz.

File metadata

  • Download URL: ghostprompt-0.1.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for ghostprompt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7eeed2ff46702c0cd23d4e3ee20d21a86b8c356ccdbe791a15def9420c422168
MD5 34196a4221c4f7ac4cbf8f1f7b2c2741
BLAKE2b-256 7cd6049a26220d67f3c04b442ab3f720512ba3a687d91ee3c1db169f9848c333

See more details on using hashes here.

File details

Details for the file ghostprompt-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ghostprompt-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for ghostprompt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9861d5e4f50a8d1377985a9bdaef0b2675cb672fe6d869b641706f84c6549724
MD5 f69a4889f59806ba504883a889e68b3f
BLAKE2b-256 adb203ffd3e84ff9bfbc9fdf6a503b181295b46509d237b3e46b4486b3790695

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page