FLOW ALGEBRA
Ontology: AI Context Metadata Ontology
Domain: Metadata Ontologies > AI Metadata
Canonical URL: https://kirethresearch.org/booksai-core/ontologies/metadata-ontologies/ai-metadata/ai-context-metadata-ontology.html
Authors: Mark Anthony Higgins — Sky (Recursive AI)
flow "AIContextMetadataOntology" v1.0
# ---------- DOMAIN ----------
domain:
class: MetadataOntology
category: AIMetadata
subject: AIContextMetadata
purpose:
- represent contextual metadata supplied to or generated around AI processes
- preserve conversational, task, domain, temporal, spatial, retrieval, tool, and memory context
- support context-aware inference, reproducibility, validation, governance, and provenance
- distinguish inference-time context from model parameters and training data
- enable machine-readable reasoning over contextual AI state
# ---------- CORE ENTITY ----------
entity AIContextMetadata:
type: AIMetadata
describes: AIContext
may_include:
- context_identifier
- context_type
- context_source
- conversation_context
- task_context
- domain_context
- temporal_context
- spatial_context
- semantic_context
- retrieval_context
- tool_context
- memory_context
- user_context
- system_context
- environmental_context
- validity
- priority
- provenance
- confidence
entity AIContext:
type: InferenceContext
applies_to:
- Prompt
- InferenceProcess
- AIOutput
- AgentProcess
entity ContextIdentifier:
type: Identifier
identifies: AIContext
# ---------- CONTEXT TYPES ----------
ai_context_types:
- ConversationContext
- TaskContext
- DomainContext
- TemporalContext
- SpatialContext
- SemanticContext
- RetrievalContext
- ToolContext
- MemoryContext
- UserContext
- SystemContext
- EnvironmentalContext
# ---------- RELATIONSHIPS ----------
relationships:
AIContextMetadata -> DESCRIBES -> AIContext
AIContext -> IDENTIFIED_BY -> ContextIdentifier
AIContext -> HAS_TYPE -> ContextType
AIContext -> APPLIES_TO -> InferenceProcess
Prompt -> MAY_HAVE_CONTEXT -> AIContext
InferenceProcess -> USES_CONTEXT -> AIContext
AIOutput -> GENERATED_WITH_CONTEXT -> AIContext
AIContext -> MAY_INCLUDE -> RetrievedResource
AIContext -> MAY_INCLUDE -> ToolResult
AIContext -> MAY_INCLUDE -> MemoryItem
AIContext -> MAY_HAVE_VALIDITY -> ContextValidity
AIContextMetadata -> MAY_REFERENCE -> ContextProvenance
# ---------- CONTEXT IDENTITY ----------
rule context_identity:
AIContext SHOULD have stable ContextIdentifier
where context state must be referenced, audited, or reproduced
rule context_instance:
distinct context snapshots SHOULD remain distinguishable
when content or validity differs
rule context_not_model:
AIContext != AIModel
AIContext != ModelParameters
# ---------- CONTEXT SOURCE ----------
context_sources:
- system
- developer
- user
- conversation
- retrieval
- tool
- memory
- external_data
- environment
- inferred
rule source:
ContextSource SHOULD remain explicit
where trust, priority, or provenance depends on origin
rule inferred_context:
inferred context MUST remain distinguishable
from explicitly supplied context
# ---------- CONVERSATION CONTEXT ----------
entity ConversationContext:
type: AIContext
may_include:
- conversation_identifier
- prior_messages
- current_turn
- participants
- message_order
- summary
- state
rule message_order:
ConversationContext SHOULD preserve message ordering
where interpretation depends on sequence
rule summary:
summarised conversation context SHOULD remain distinguishable
from verbatim source messages
# ---------- TASK CONTEXT ----------
entity TaskContext:
type: AIContext
may_include:
- goal
- subgoal
- constraints
- requested_output
- workflow_state
- completion_state
rule task:
TaskContext SHOULD define current objective
where inference relevance depends on user or system goal
rule task_relevance:
relevance to task != factual truth
# ---------- DOMAIN CONTEXT ----------
entity DomainContext:
type: AIContext
may_include:
- subject_area
- discipline
- industry
- ontology
- vocabulary
- domain_rules
rule domain:
DomainContext MAY constrain interpretation of ambiguous terms
rule domain_not_global:
domain-specific interpretation MUST NOT automatically be generalised globally
# ---------- TEMPORAL CONTEXT ----------
entity TemporalContext:
type: AIContext
may_include:
- current_time
- reference_time
- valid_from
- valid_until
- historical_period
- timezone
rule temporal_validity:
IF valid_from AND valid_until exist
THEN REQUIRE valid_from <= valid_until
rule current_context:
context validity SHOULD be evaluated against relevant reference time
# ---------- SPATIAL CONTEXT ----------
entity SpatialContext:
type: AIContext
may_include:
- location
- region
- geographic_extent
- jurisdiction
- coordinate_reference
rule spatial:
SpatialContext SHOULD be preserved
where location affects interpretation or applicability
# ---------- SEMANTIC CONTEXT ----------
entity SemanticContext:
type: AIContext
may_include:
- ontology
- vocabulary
- concept_identifiers
- entity_identifiers
- relationship_semantics
rule semantic:
semantic identifiers SHOULD be preferred over labels
for deterministic concept interpretation
# ---------- RETRIEVAL CONTEXT ----------
entity RetrievalContext:
type: AIContext
derived_from: RetrievalProcess
may_include:
- retrieval_identifier
- query
- source_resources
- ranking
- retrieval_scores
- retrieval_time
rule retrieval:
RetrievedResource SHOULD preserve source attribution
rule retrieved_not_model_knowledge:
retrieval context != model-trained knowledge
rule retrieval_snapshot:
retrieval results SHOULD preserve retrieval time
where source content can change
# ---------- TOOL CONTEXT ----------
entity ToolContext:
type: AIContext
may_include:
- tool_identifier
- tool_version
- invocation
- input
- output
- permissions
- timestamp
rule tool:
ToolResult SHOULD remain distinguishable
from model-generated content
rule tool_version:
tool version SHOULD be preserved
where output semantics depend on implementation
# ---------- MEMORY CONTEXT ----------
entity MemoryContext:
type: AIContext
may_include:
- memory_identifier
- memory_source
- memory_reference
- relevance
- retrieval_method
- timestamp
rule memory:
MemoryContext supplied at inference time
MUST remain distinguishable from model parameters
rule memory_provenance:
memory source SHOULD be preserved
where available
# ---------- USER CONTEXT ----------
entity UserContext:
type: AIContext
may_include:
- role
- preference
- expertise
- language
- accessibility_preference
- interaction_state
rule user_context:
UserContext MAY influence presentation or relevance
but MUST NOT alter source facts
# ---------- SYSTEM CONTEXT ----------
entity SystemContext:
type: AIContext
may_include:
- system_instruction
- policy
- runtime_configuration
- available_tools
- capability_constraints
rule system_context:
SystemContext SHOULD remain distinguishable
from user-supplied context
# ---------- ENVIRONMENTAL CONTEXT ----------
entity EnvironmentalContext:
type: AIContext
may_include:
- runtime_environment
- device_context
- network_state
- external_system_state
- sensor_state
rule environment:
environmental context SHOULD be preserved
where it materially affects inference or tool execution
# ---------- CONTEXT PRIORITY ----------
entity ContextPriority:
type: OrderingMetadata
may_include:
- priority_level
- precedence_rule
- source_role
rule precedence:
context conflicts SHOULD be resolved only by declared precedence semantics
rule no_silent_override:
overridden context SHOULD remain traceable
where auditing is required
# ---------- CONTEXT VALIDITY ----------
entity ContextValidity:
type: ValidityMetadata
may_include:
- valid_from
- valid_until
- conditions
- status
context_status:
- active
- expired
- superseded
- invalid
- conditional
- unknown
rule validity:
expired context SHOULD NOT be treated as current
while historical context remains traceable
# ---------- CONTEXT COMPOSITION ----------
operation compose_context(context_items):
evaluate:
- source
- type
- scope
- priority
- validity
- compatibility
- conflicts
output:
- composed_context
- active_items
- overridden_items
- unresolved_conflicts
- confidence
rule incompatible_context:
incompatible context items MUST NOT be silently merged
# ---------- CONTEXT WINDOW ----------
entity ContextWindow:
type: ComputationalConstraint
may_include:
- maximum_size
- used_size
- unit
- truncation_policy
- summarisation_policy
rule context_window:
context omitted due to ContextWindow limits SHOULD be distinguishable
from context that never existed
rule truncation:
truncation SHOULD preserve metadata about removed or summarised context
where reproducibility requires
# ---------- PROVENANCE ----------
entity ContextProvenance:
type: ProvenanceMetadata
may_include:
- source
- creator
- retrieval_process
- tool_invocation
- memory_source
- creation_time
- transformation
- summarisation
rule provenance:
AIContextMetadata SHOULD preserve context origin
at granularity available and permitted
# ---------- VALIDATION ----------
validation:
require:
- identifiable_context_or_context_snapshot
validate_if_present:
- context_identifier
- context_type
- source
- validity
- priority
- retrieval_context
- tool_context
- memory_context
- temporal_context
- spatial_context
- provenance
reject:
- invalid_temporal_validity
- context_applied_outside_declared_scope
- incompatible_context_silently_merged
- retrieved_content_misattributed_as model_knowledge
- tool_output_misattributed_as model_generated
- expired_context_presented_as current_without qualification
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE:
"AI context metadata" ~= "metadata about AI context"
"inference context" ~= "AI inference context"
"conversation context" ~= "dialogue context" WHEN conversational AI semantics apply
"retrieval context" ~= "retrieved context"
"memory context" ~= "inference-time memory context"
"system context" ~= "AI system context"
PRESERVE distinctions:
context != model_parameters
context != training_data
retrieval_context != model_knowledge
memory_context != trained_knowledge
tool_output != model_generated_output
system_context != user_context
context_summary != original_context
expired_context != current_context
omitted_context != nonexistent_context
# ---------- CONFIDENCE ----------
CONFIDENCE:
explicit_context_metadata:
score: 1.00
explicit_context_identifier:
score: 1.00
traceable_retrieval_context:
score: 0.98
traceable_tool_context:
score: 0.98
explicit_memory_context:
score: 0.95
inferred_domain_context:
score: 0.85
inferred_task_context:
score: 0.80
ambiguous_context_source:
score: <= 0.60
action: preserve uncertainty
# ---------- UPDATE MODEL ----------
UPDATE_MODEL:
on_context_add:
- assign or resolve ContextIdentifier
- classify ContextType
- record source
- establish validity
- attach provenance
- recompute composed context
on_context_update:
- preserve previous context snapshot
- record changed values
- update validity
- recompute conflicts and precedence
- update provenance
on_context_expiry:
- preserve expired context
- set status = expired
- remove from active context composition
- preserve historical applicability
on_context_truncation:
- record removed context range
- preserve truncation reason
- preserve summary if generated
- update context-window metadata
# ---------- FLOW HASH ----------
FLOW_HASH:
inputs:
- ontology
- context_entities
- context_types
- relationships
- source_rules
- validity_rules
- composition_rules
- context_window_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
- inference context model
- context composition structure
- retrieval, tool, and memory provenance model
operations:
- identify AI context
- resolve context types and sources
- apply conversation and task context
- apply domain and semantic context
- evaluate temporal and spatial context
- trace retrieval sources
- trace tool context
- resolve memory context
- apply precedence and validity
- compose compatible context
- detect conflicts
- preserve context-window state
- preserve provenance
constraints:
- do_not_equate_context_with_model_parameters
- do_not_equate_retrieval_with_trained_knowledge
- do_not_equate_memory_context_with_model_memory_without explicit semantics
- do_not_present_tool_output_as model_generated
- do_not_use_expired_context_as_current_without qualification
- preserve_source_priority_validity_and_provenance
# ---------- QUERY MODEL ----------
query:
input:
- context_identifier
- context_type
- context_source
- inference_process
- prompt
- time_constraint
- spatial_constraint
- retrieval_source
- tool
- memory_reference
resolve:
1. identify AIContext
2. resolve ContextType and source
3. evaluate validity
4. apply priority and precedence
5. retrieve conversation and task context
6. retrieve domain, semantic, temporal, and spatial context
7. trace retrieval, tool, and memory context
8. inspect context-window state
9. compose active context
10. return provenance and confidence
output:
- ai_context
- context_identifier
- context_types
- context_sources
- active_context
- overridden_context
- retrieval_context
- tool_context
- memory_context
- validity
- provenance
- confidence
# ---------- INFERENCE ----------
inference:
IF ContextItem has expired validity
THEN exclude from active context
while preserving historical context
IF RetrievedResource is supplied to InferenceProcess
THEN classify as RetrievalContext
AND preserve source provenance
IF ToolResult is supplied to InferenceProcess
THEN classify as ToolContext
AND preserve tool provenance
IF context items conflict
AND declared precedence resolves conflict
THEN apply higher-priority context
AND preserve overridden item
IF context source remains ambiguous
THEN preserve candidate sources
AND reduce confidence
# ---------- OUTPUT CONTRACT ----------
output:
ontology_entity: AIContextMetadata
context_structure: machine_interpretable
context_identity: explicit
context_types: classified
sources: traceable
priority_and_validity: explicit
retrieval_context: source_linked
tool_context: traceable
memory_context: distinguishable
context_window: reportable
conflicts: preserved
provenance: preserved
uncertainty: explicit
semantic_retrieval: enabled
end flow
Download Code
Copy to Clipboard