FLOW ALGEBRA
Ontology: AI Prompt Metadata Ontology
Domain: Metadata Ontologies > AI Metadata
Canonical URL: https://kirethresearch.org/booksai-core/ontologies/metadata-ontologies/ai-metadata/ai-prompt-metadata-ontology.html
Authors: Mark Anthony Higgins — Sky (Recursive AI)
flow "AIPromptMetadataOntology" v1.0
# ---------- DOMAIN ----------
domain:
class: MetadataOntology
category: AIMetadata
subject: AIPromptMetadata
purpose:
- represent metadata describing prompts supplied to AI systems
- preserve prompt identity, content, role, structure, context, parameters, and versions
- support prompt traceability, reproducibility, comparison, governance, and evaluation
- distinguish system, developer, user, tool, template, and retrieved prompt components
- enable machine-readable reasoning over prompt-driven AI interactions
# ---------- CORE ENTITY ----------
entity AIPromptMetadata:
type: AIMetadata
describes: Prompt
may_include:
- prompt_identifier
- prompt_type
- prompt_role
- prompt_content
- prompt_template
- prompt_version
- language
- variables
- context
- constraints
- examples
- model_target
- inference_parameters
- creation_time
- creator
- provenance
- status
entity Prompt:
type: AIInputResource
consumed_by: InferenceProcess
entity PromptIdentifier:
type: Identifier
identifies: Prompt
entity PromptType:
type: Classification
examples:
- instruction_prompt
- question_prompt
- completion_prompt
- conversational_prompt
- few_shot_prompt
- structured_prompt
- multimodal_prompt
- tool_prompt
- retrieval_augmented_prompt
# ---------- PROMPT ROLES ----------
prompt_roles:
- system
- developer
- user
- assistant
- tool
- retrieved_context
- template
- example
# ---------- RELATIONSHIPS ----------
relationships:
AIPromptMetadata -> DESCRIBES -> Prompt
Prompt -> IDENTIFIED_BY -> PromptIdentifier
Prompt -> HAS_TYPE -> PromptType
Prompt -> HAS_ROLE -> PromptRole
Prompt -> MAY_INSTANTIATE -> PromptTemplate
Prompt -> MAY_HAVE_VERSION -> PromptVersion
Prompt -> MAY_HAVE_VARIABLE -> PromptVariable
Prompt -> MAY_HAVE_CONTEXT -> PromptContext
Prompt -> MAY_HAVE_CONSTRAINT -> PromptConstraint
Prompt -> MAY_HAVE_EXAMPLE -> PromptExample
Prompt -> TARGETS -> AIModel
Prompt -> CONSUMED_BY -> InferenceProcess
AIPromptMetadata -> MAY_REFERENCE -> PromptProvenance
# ---------- PROMPT IDENTITY ----------
rule prompt_identity:
Prompt SHOULD have stable PromptIdentifier
where reuse, auditing, or reproducibility is required
rule prompt_text_not_identity:
identical prompt text MUST NOT automatically imply same Prompt identity
rule prompt_instance:
instantiated Prompt SHOULD remain distinguishable
from reusable PromptTemplate
# ---------- PROMPT ROLE ----------
rule role:
PromptRole SHOULD preserve instruction hierarchy or interaction role
where AI system behaviour depends on role
rule role_not_content:
PromptRole != PromptContent
rule role_order:
role precedence MUST follow applicable AI system semantics
and MUST NOT be inferred solely from textual ordering
# ---------- PROMPT CONTENT ----------
entity PromptContent:
type: ContentResource
may_be:
- text
- structured_data
- image
- audio
- video
- multimodal_content
- reference
rule content_preservation:
PromptContent SHOULD be preserved or referenced
where output traceability requires
rule encoding:
textual prompt SHOULD preserve encoding and language
where interpretation depends on them
# ---------- PROMPT TEMPLATE ----------
entity PromptTemplate:
type: ReusablePromptStructure
may_include:
- template_identifier
- template_content
- variables
- default_values
- constraints
- version
entity PromptVariable:
type: TemplateParameter
may_include:
- variable_name
- datatype
- required
- default_value
- value_constraint
rule template_instantiation:
PromptTemplate + variable_bindings -> PromptInstance
rule required_variable:
required PromptVariable MUST have value
before complete template instantiation
rule variable_trace:
instantiated prompt SHOULD preserve variable bindings
where reproducibility is required
# ---------- VERSION ----------
entity PromptVersion:
type: VersionMetadata
may_include:
- version_identifier
- predecessor
- successor
- creation_time
- change_description
- status
rule version:
material prompt or template change SHOULD create distinguishable PromptVersion
where historical comparison is required
rule lexical_change:
minor lexical change MAY alter AI behaviour
and SHOULD be versioned when reproducibility matters
# ---------- CONTEXT ----------
entity PromptContext:
type: ContextMetadata
may_include:
- conversation_context
- domain_context
- task_context
- retrieved_context
- tool_context
- memory_context
- temporal_context
- spatial_context
rule context:
PromptContext SHOULD remain distinguishable from PromptContent
where context is injected separately
rule context_effect:
prompt interpretation MAY depend on surrounding context
# ---------- CONSTRAINTS ----------
entity PromptConstraint:
type: AIConstraint
may_include:
- output_format
- length_constraint
- language_constraint
- style_constraint
- content_constraint
- tool_constraint
- schema_constraint
rule constraint:
explicit PromptConstraint SHOULD be preserved
for output conformance evaluation
rule constraint_not_result:
requested output constraint != guaranteed model compliance
# ---------- EXAMPLES ----------
entity PromptExample:
type: PromptComponent
may_include:
- example_input
- example_output
- label
- explanation
rule few_shot:
few-shot Prompt SHOULD preserve example order
where order may affect inference
rule example_not_ground_truth:
PromptExample != verified ground truth
unless independently validated
# ---------- MULTIMODAL PROMPTS ----------
entity MultimodalPrompt:
subtype_of: Prompt
contains:
- text_component
- image_component
- audio_component
- video_component
- structured_component
rule modality_order:
component ordering SHOULD be preserved
where model input semantics depend on sequence
rule referenced_media:
external media SHOULD preserve stable reference
and relevant provenance where available
# ---------- RETRIEVAL AUGMENTATION ----------
entity RetrievedPromptContext:
type: PromptContext
derived_from: RetrievalProcess
rule retrieval_context:
retrieved content SHOULD preserve:
- source_resource
- retrieval_query
- ranking
- retrieval_time
- provenance
rule retrieved_not_prompt_authorship:
retrieved source content != user-authored prompt content
# ---------- TOOL PROMPTS ----------
entity ToolPrompt:
subtype_of: Prompt
may_include:
- tool_identifier
- tool_schema
- tool_instruction
- permissions
- expected_output
rule tool_schema:
ToolPrompt SHOULD preserve tool interface version
where execution depends on schema
# ---------- MODEL TARGET ----------
rule model_target:
Prompt MAY be designed for specific:
- model
- model_family
- model_version
- capability
rule portability:
prompt effectiveness on one model != guaranteed effectiveness on another
# ---------- INFERENCE PARAMETERS ----------
rule parameters:
inference parameters associated with prompt execution SHOULD be preserved
separately from Prompt itself
rule prompt_parameter_distinction:
PromptMetadata != InferenceParameterMetadata
# ---------- STATUS ----------
prompt_status:
- draft
- active
- tested
- deprecated
- superseded
- archived
rule status:
Prompt status SHOULD remain explicit
# ---------- PROVENANCE ----------
entity PromptProvenance:
type: ProvenanceMetadata
may_include:
- creator
- source
- creation_time
- template
- variable_bindings
- revision_history
- generation_method
- transformation
rule provenance:
AIPromptMetadata SHOULD preserve prompt origin
where available
rule generated_prompt:
AI-generated Prompt SHOULD remain distinguishable
from human-authored Prompt
# ---------- VALIDATION ----------
validation:
require:
- identifiable_prompt_or_prompt_instance
validate_if_present:
- prompt_identifier
- prompt_type
- prompt_role
- prompt_content
- template
- variables
- version
- context
- constraints
- examples
- model_target
- provenance
reject:
- missing_required_template_variable
- contradictory_prompt_role
- invalid_prompt_version_chain
- unresolved_tool_schema where execution requires it
- prompt_instance_without_required_content
- retrieved_content_misattributed_as prompt_author
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE:
"AI prompt metadata" ~= "metadata about AI prompts"
"prompt metadata" ~= "AI prompt metadata" WHEN prompt is supplied to AI system
"prompt template" ~= "reusable prompt template"
"prompt variable" ~= "template variable" WHEN variable belongs to PromptTemplate
"system prompt" ~= "system-role prompt"
"few-shot prompt" ~= "prompt containing examples" WHEN examples guide inference
PRESERVE distinctions:
prompt != prompt_template
prompt_content != prompt_role
prompt != inference_output
prompt_context != model_parameters
prompt_metadata != inference_parameters
retrieved_context != user_authored_content
example != verified_ground_truth
system_prompt != user_prompt
same_text != same_prompt_identity
# ---------- CONFIDENCE ----------
CONFIDENCE:
explicit_prompt_metadata:
score: 1.00
explicit_prompt_identifier:
score: 1.00
explicit_template_and_bindings:
score: 0.99
traceable_prompt_version:
score: 0.98
inferred_prompt_role:
score: 0.85
inferred_template_origin:
score: <= 0.80
ambiguous_prompt_provenance:
score: <= 0.60
action: preserve uncertainty
# ---------- UPDATE MODEL ----------
UPDATE_MODEL:
on_prompt_creation:
- assign PromptIdentifier
- record role and type
- record content or reference
- attach context
- record creator and provenance
on_template_instantiation:
- preserve PromptTemplate identity and version
- record variable bindings
- create PromptInstance
- validate required variables
- record provenance
on_prompt_revision:
- preserve previous PromptVersion
- create new version
- record content or constraint changes
- update status
- preserve provenance
on_prompt_execution:
- preserve Prompt identity and version
- link to InferenceProcess
- record model target and effective inference parameters
- preserve execution provenance
# ---------- FLOW HASH ----------
FLOW_HASH:
inputs:
- ontology
- prompt_entities
- prompt_roles
- relationships
- template_rules
- context_rules
- constraint_rules
- provenance_rules
- validation
- semantic_equivalence
- confidence
- update_model
canonicalisation:
- normalise_whitespace
- preserve_case_sensitive_identifiers
- sort_unordered_property_sets
- preserve_rule_order
output:
deterministic_semantic_hash
# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION:
interpret_as:
- AI metadata ontology
- prompt lifecycle model
- prompt template and versioning structure
- inference-input provenance model
operations:
- identify prompts
- resolve prompt roles and types
- inspect prompt content
- instantiate templates
- resolve variable bindings
- traverse prompt versions
- apply prompt context
- inspect output constraints
- resolve examples
- inspect multimodal components
- trace retrieval and tool context
- link prompts to inference
- preserve provenance
constraints:
- do_not_equate_prompt_with_template
- do_not_equate_prompt_role_with_content
- do_not_present_retrieved_content_as user_authored
- do_not_treat_examples_as verified_ground_truth_without evidence
- do_not_assume_prompt_portability_across_models
- preserve_prompt_role_version_context_bindings_and_provenance
# ---------- QUERY MODEL ----------
query:
input:
- prompt_identifier
- prompt_type
- prompt_role
- prompt_template
- prompt_version
- variable
- context
- model_target
- status
- creator
resolve:
1. identify Prompt
2. resolve PromptIdentifier
3. resolve PromptRole and PromptType
4. retrieve content or stable reference
5. resolve template and variable bindings
6. resolve PromptVersion
7. inspect context and constraints
8. inspect examples or multimodal components
9. link to model and InferenceProcess
10. trace provenance and confidence
output:
- prompt
- identifier
- type
- role
- content_reference
- template
- variables
- version
- context
- constraints
- model_target
- provenance
- confidence
# ---------- INFERENCE ----------
inference:
IF PromptInstance references PromptTemplate
AND complete variable bindings exist
THEN reconstruct instantiated prompt
WITH confidence = 0.99
IF Prompt is consumed by InferenceProcess
THEN link Prompt to resulting AIOutput through inference provenance
IF prompt contains labelled examples
THEN classify few_shot_prompt candidate
WITH confidence dependent_on structure
IF retrieved context is attached to Prompt
THEN preserve source attribution separately
from prompt author attribution
IF prompt provenance remains ambiguous
THEN preserve candidate origins
AND reduce confidence
# ---------- OUTPUT CONTRACT ----------
output:
ontology_entity: AIPromptMetadata
prompt_structure: machine_interpretable
prompt_identity: explicit
role_and_type: preserved
content: traceable
templates: versioned
variable_bindings: explicit
context: preserved
constraints: machine_interpretable
inference_links: traceable
provenance: preserved
uncertainty: explicit
semantic_retrieval: enabled
end flow
Download Code
Copy to Clipboard