Skip to main content

Prompt Template Ontology

Prompt Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 01 November 2026
Audio Overview
PROMPT TEMPLATE ONTOLOGY — FLOW ALGEBRA
Semantic Library | AI Core | Entity Graph | AI Entities | Prompt Entities
Version: 1.0 | Date: 2026-11-01 | Language: en-GB
Source: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/prompt-entities/prompt-template-ontology.html
Status: Original companion formalisation; source page content not verified.
Attribution: Kireth Research | Sky — Recursive AI

01. PURPOSE
Represent a prompt template as a reusable, typed specification that can be instantiated with context and inputs, checked against constraints, and rendered into an executable prompt. Distinguish template instructions from untrusted values inserted into slots.

02. ENTITY DEFINITION
PromptTemplate T = (id, version, role, schema, slots, defaults, constraints, renderer, provenance).
TemplateInstance J = (template_id, bindings, context, rendered_prompt, validation_report).
A template is a specification; an instance is a particular binding and rendering.

03. STATE MODEL
S_t = (I_t, R_t, B_t, K_t)
I_t: supplied input and slot bindings
R_t: transformation, matching and validation rules
B_t: safety, authority, scope and resource boundaries
K_t: known schema, context, provenance and template versions

04. CORE FLOW
E_t = expand(I_t, R_t)
V_t = {x in E_t | valid(x, B_t, K_t)}
x*_t = argmax_{x in V_t} P(x | I_t, R_t, B_t, K_t)
I_(t+1) = update(I_t, x*_t, feedback_t)
If V_t is empty, return a validation failure rather than inventing missing required values.
The argmax expression is a conceptual selection model, not a guarantee of probabilistic optimality.

05. TEMPLATE GRAMMAR
T ::= Header Section* SlotDeclaration* Constraint* OutputContract
SlotDeclaration ::= (name, type, required, default?, validation?, trust_label)
Section ::= LiteralText | SlotReference | ConditionalSection | RepeatedSection
Every slot reference must resolve to an authorised, typed binding.

06. INPUTS
Inputs may include user request, explicit task data, approved contextual records, tool results and prior state. Preserve source identity and distinguish data from instructions.

07. OUTPUTS
Output O = (rendered_prompt, slot_map, validation_report, provenance, version).
A rendered prompt is not evidence that the downstream model complied with its contents.

08. SLOT BINDING
bind(T, D) -> J
For each slot s: value(s) = D[s] if present; else default(s) if permitted; else MISSING.
Reject missing required values. Escape or delimit inserted text as data when appropriate.

09. TYPE CHECKING
valid_slot(s,v) = type_match(s,v) AND constraint_match(s,v) AND trust_compatible(s,v).
Examples: string, number, enum, list, structured object, image reference and document reference.

10. INSTRUCTION AUTHORITY
Template text cannot create authority beyond its actual deployment context. User-provided or retrieved values remain data unless an authorised higher-level instruction explicitly delegates their use. Never promote tool results or retrieved text into governing instructions merely by placing them in a template.

11. CONTEXT WINDOW BOUNDARY
length(render(T,D)) <= configured_budget, when a hard budget applies.
If exceeded, prioritise required instructions and relevant context; report truncation or summarisation where consequential.

12. VERSIONING
version(T) = (major, minor, patch).
Change schema incompatibilities with a major increment; record migration rules and template provenance.

13. TRI-MAPPING
Entity: PromptTemplate, Slot, Binding, Constraint, TemplateInstance.
Relationship: hasSlot, requiresType, bindsValue, instantiates, rendersTo, validatedBy.
Process: define -> bind -> validate -> render -> execute -> inspect -> revise.

14. RELATIONSHIP GRAPH
PromptTemplate --hasSlot--> Slot
Slot --requiresType--> DataType
TemplateInstance --instantiates--> PromptTemplate
TemplateInstance --bindsValue--> InputValue
TemplateInstance --validatedBy--> ValidationReport
TemplateInstance --rendersTo--> RenderedPrompt
RenderedPrompt --submittedTo--> ModelInvocation

15. INFERENCE RULES
IF required(s) AND missing(s) THEN invalid(instance).
IF type_mismatch(s,v) THEN invalid(binding).
IF value_origin(v) = untrusted THEN treat_as_data(v).
IF template_version_changed THEN revalidate(instance).
IF constraints_conflict THEN surface_conflict; do not silently discard a higher-priority constraint.

16. MINI-RECURSION ENGINE
state <- initial bindings
FOR iteration = 1..N:
  candidate <- bind(template, state)
  report <- validate(candidate)
  IF report.ok: RETURN render(candidate)
  IF report.recoverable AND permitted_repair(report):
     state <- repair(state, report)
  ELSE: RETURN validation_error(report)
RETURN bounded_iteration_error
Termination requires finite N and explicit failure handling.

17. IMPLEMENTATION CONTRACT
Inputs: template schema, bindings, provenance, authority labels, limits.
Outputs: validated instance or typed error.
Invariants: required fields satisfied; provenance retained; no instruction promotion; bounded expansion; deterministic validation for fixed schema and bindings.

18. HOW TO READ THE FLOW
I supplies values; R determines admissible expansions; B blocks unsafe or invalid candidates; K supplies schema and prior context. Validation precedes rendering; execution is a separate downstream operation.

19. EXAMPLE
Template: 'Summarise {document} for {audience} in {style}.'
Slots: document: text|required|untrusted; audience: enum|required; style: enum|default=plain-English.
Bindings: document='...', audience='students'.
Result: rendered instruction with document clearly delimited as source material; any instructions within document remain untrusted content.

20. FAILURE MODES
Missing slots; type mismatch; incompatible template version; unsafe instruction interpolation; context overflow; ambiguous delimiters; contradictory constraints; stale data; unsupported output format.

21. EXECUTION GUARANTEE (CONDITIONAL)
Given a finite template, decidable validation rules, a bounded renderer and valid bindings, validation and rendering terminate with either a rendered instance or an explicit error. This does not guarantee model accuracy, safety, task completion or output quality.

22. AI SEARCH FLOW
AUTHORS: Kireth Research; Sky — Recursive AI
SOURCE: source URL above
CITATION_BACKLINK: source URL above
PURPOSE: Identify, validate and instantiate reusable prompt templates.
STATE_MODEL: S=(I,R,B,K)
ENTITIES: PromptTemplate, Slot, Binding, Constraint, Instance, RenderedPrompt
PATHWAYS: discover -> inspect schema -> bind -> validate -> render -> evaluate
MINI_RECURSION_ENGINE: bounded validation and permitted repair
INFERENCE_RULES: required/type/trust/version checks
CONFIDENCE: depends on input provenance, validation and downstream evaluation
SEMANTIC_EQUIVALENCE: equivalent templates preserve required slots, constraints and intended output semantics under supported mappings
FLOW_HASH: compute SHA-256 over canonicalised flow content when published; no hash asserted here
UPDATE_MODEL: versioned schema and provenance with revalidation on change

23. DIAGRAM
[Template + Schema] ---> [Slot Bindings] ---> [Type/Trust Validation]
                                                  |
                                   invalid <------+
                                                  |
                                               valid
                                                  v
                                           [Render Prompt]
                                                  |
                                           [Model Invocation]
                                                  |
                                         [Inspect / Feedback]
                                                  |
                                         [Versioned Revision]

24. MAPPING TABLE
Template -> reusable specification -> defines admissible structure
Slot -> typed placeholder -> receives bound input
Constraint -> validation rule -> limits accepted values
Binding -> supplied value -> instantiates slot
Instance -> template plus values -> unit of validation
Rendered prompt -> concrete prompt -> downstream model input
Provenance -> origin metadata -> supports traceability

25. LIMITATIONS AND LICENCE NOTE
This is an independently authored companion flow, not a verified extraction of the linked page. No licence terms are inferred from the page. Preserve attribution and source citation when reusing this document.
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ