Skip to main content

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

Release files for ghostprompt 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ghostprompt 0.1.1
File Size Uploaded
ghostprompt-0.1.1.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ghostprompt 0.1.1
File Interpreter ABI Platform
ghostprompt-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.6 kB

Release files / ghostprompt-0.1.1.tar.gz

Download URL ghostprompt-0.1.1.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7eeed2ff46702c0cd23d4e3ee20d21a86b8c356ccdbe791a15def9420c422168
BLAKE2b-256 checksum
How to use checksums
7cd6049a26220d67f3c04b442ab3f720512ba3a687d91ee3c1db169f9848c333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / ghostprompt-0.1.1-py3-none-any.whl

Download URL ghostprompt-0.1.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9861d5e4f50a8d1377985a9bdaef0b2675cb672fe6d869b641706f84c6549724
BLAKE2b-256 checksum
How to use checksums
adb203ffd3e84ff9bfbc9fdf6a503b181295b46509d237b3e46b4486b3790695
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page