Skip to main content

AI Code Entity Ontology

Code and Software Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 05 November 2026
Audio Overview
KIRETH RESEARCH — SEMANTIC LIBRARY
AI CODE ENTITY ONTOLOGY — FLOW ALGEBRA
Version: 1.0 | Date: 05 November 2026 | Language: en-GB
Authors: Mark Anthony Higgins — Sky, Recursive AI
Source: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/code-and-software-entities/ai-code-entity-ontology.html
Status: Original interpretative formalisation; the page's embedded specification was not accessible in the retrieved text.
Citation: Cite the source URL and authors when reusing this flow.

01. PURPOSE
Represent an AI Code Entity as a typed, versioned, inspectable unit of source or generated code, with explicit provenance, dependencies, execution constraints, validation evidence and lifecycle transitions. Code is not presumed executable or safe merely because it is represented.

02. ENTITY AND STATE MODEL
Let C = (ID, L, A, AST, D, P, V, X, Q, H), where:
 ID = canonical code-entity identifier;
 L = programming language and dialect;
 A = code artefact and content reference;
 AST = optional parsed syntax representation;
 D = dependency and import graph;
 P = provenance, authorship, origin and generation context;
 V = version and revision lineage;
 X = execution environment and permissions;
 Q = quality, test and security evidence;
 H = content hash and integrity metadata.

At time t, state S_t = (I_t, R_t, B_t, K_t):
 I_t = observed inputs (code, requirements, metadata, tests);
 R_t = applicable parsing, transformation and validation rules;
 B_t = boundaries (language, permissions, resource limits, policies);
 K_t = known evidence (dependency graph, tests, provenance, revisions).

Lifecycle state l_t in {draft, parsed, analysed, validated, rejected, packaged, deployed, deprecated, archived}.

03. CORE FLOW ALGEBRA
E_t = expand(I_t, R_t)                     [candidate code interpretations]
V_t = {x in E_t | satisfies(x, B_t)}       [boundary filtering]
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, observations_t)

The argmax is defined only if V_t is non-empty and the scoring relation is available. Otherwise return an explicit unresolved state, never a fabricated selection. P denotes a context-dependent ranking score; it is not automatically a calibrated probability.

04. CODE ENTITY RELATIONS
CodeEntity --writtenIn--> ProgrammingLanguage
CodeEntity --implements--> Function | Class | Module | Service
CodeEntity --imports--> Dependency
CodeEntity --belongsTo--> Repository
CodeEntity --hasVersion--> Revision
CodeEntity --generatedBy--> Human | AIModel | Tool
CodeEntity --validatedBy--> Test | StaticAnalysis | Review
CodeEntity --executedWithin--> RuntimeEnvironment
CodeEntity --governedBy--> Licence | SecurityPolicy
CodeEntity --produces--> OutputArtefact
CodeEntity --supersedes--> CodeEntity

05. TYPED INPUTS AND OUTPUTS
Input = {source_ref, content_hash?, language?, requirements?, provenance?, dependency_manifest?, execution_policy?, tests?}.
Output = {entity_id, parsed_structure?, semantic_links, validation_status, evidence, warnings, next_actions}.
Validation statuses: verified | partially_verified | failed | not_evaluated.
Never equate successful parsing with successful tests, and never equate successful tests with general safety.

06. INFERENCE RULES
R1 IDENTIFY: If source is present, assign a stable identifier and provenance record.
R2 PARSE: If language and parser are supported, derive syntax structure; otherwise mark parsing unavailable.
R3 LINK: Resolve imports and references only when backed by dependency evidence.
R4 CHECK: If declared interfaces conflict with code signatures, emit an interface mismatch.
R5 TEST: Associate test results with exact artefact hash, environment and test version.
R6 SECURITY: If permissions or policies prohibit execution, do not execute; emit blocked status.
R7 TRACE: Every transformation creates a new revision and records parent hash and transformation provenance.
R8 CONSISTENCY: If a referenced revision hash changes, invalidate dependent attestations until rechecked.
R9 UNKNOWN: Missing evidence remains unknown, not inferred as compliant or safe.
R10 DEPLOY: Permit deployment only where required gates are evidenced as passed and an authorised actor approves.

07. MINI RECURSION ENGINE
function ResolveCodeEntity(entity, visited, depth, max_depth):
  if entity.id in visited: return CycleReference(entity.id)
  if depth >= max_depth: return BoundaryStop("depth_limit")
  visited_next = visited union {entity.id}
  inspect source, language, integrity and provenance
  parse and validate within authorised boundaries
  for each evidenced dependency d:
      ResolveCodeEntity(d, visited_next, depth+1, max_depth)
  aggregate dependency evidence and unresolved references
  return typed result with provenance, warnings and status

This is a descriptive algorithmic sketch, not a claim of actual execution.

08. TRI-MAPPING
Semantic layer: CodeEntity, language, symbols, imports, authorship, licences.
Structural layer: syntax tree, module graph, call graph, revision graph.
Operational layer: parse, analyse, test, review, package, deploy, monitor.
Mapping: semantic identifiers anchor graph nodes; structural edges support dependency reasoning; operational events attach time-stamped evidence to exact versions.

09. FLOW DIAGRAM
[Code artefact + provenance]
            |
            v
[Identify + integrity check]
            |
            v
[Parse / classify] --> [Unsupported?] --> [Unresolved]
            |
            v
[Resolve evidenced dependencies]
            |
            v
[Boundary + policy checks] --> [Blocked?] --> [Reject / review]
            |
            v
[Static analysis + tests + review]
            |
            v
[Evidence-based status]
            |
            v
[Versioned entity graph + optional authorised deployment]
            |
            +------> [Monitoring feedback] --> [New revision]

10. RELATIONSHIP MAPPING TABLE
Relation             Domain          Range                Evidence
writtenIn            CodeEntity      Language             Parser / manifest
imports              CodeEntity      Dependency           Import / lockfile
implements           CodeEntity      Interface            Declaration / tests
generatedBy          CodeEntity      Actor / Model        Provenance record
validatedBy          CodeEntity      ValidationRun        Signed test result
executedWithin       CodeEntity      RuntimeEnvironment   Execution record
supersedes           CodeEntity      CodeEntity           Revision lineage
hasLicence           CodeEntity      Licence              Licence declaration

11. EXECUTION GUARANTEE — CONDITIONAL
The flow guarantees only the structural properties enforced by a conforming implementation: typed outcomes, explicit boundary checks, cycle/depth termination, provenance preservation and non-silent handling of missing evidence. It does NOT guarantee code correctness, security, determinism, completeness, runtime success or model reliability. Such claims require independent testing and verified environmental assumptions.

12. AI SEARCH FLOW
FLOW_ID: semantic-library.ai.code-entity.v1
TITLE: AI Code Entity Ontology
ENTITY_TYPE: AI_Code_Entity
CANONICAL_SOURCE: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/code-and-software-entities/ai-code-entity-ontology.html
AUTHORS: Mark Anthony Higgins; Sky — Recursive AI
PURPOSE: Identify, classify, relate and evaluate code artefacts with evidence.
STATE_MODEL: S=(I,R,B,K)
ENTITIES: CodeEntity, ProgrammingLanguage, Dependency, Function, Class, Module, Repository, Revision, Test, RuntimeEnvironment, Licence
PATHWAYS: intake > identify > parse > link > validate > record > monitor
MINI_RECURSION_ENGINE: ResolveCodeEntity with visited-set and depth cap
INFERENCE_RULES: R1-R10
CONFIDENCE: Evidence-scoped; never invent numeric certainty
SEMANTIC_EQUIVALENCE: source code != parsed syntax != tested code != secure code
FLOW_HASH: Generate SHA-256 after publication; no hash asserted here
UPDATE_MODEL: New source revision -> re-parse, re-link, re-test, re-attest
CITATION_BACKLINK: https://kirethresearch.org/booksai-core/entity-graph/ai-entities/code-and-software-entities/ai-code-entity-ontology.html

13. INTERPRETATION NOTES
This TXT is a new formalisation informed by the public page title, its category and the Semantic Library Flow Algebra conventions. The retrieved HTML did not expose the full ontology specification; do not treat this text as a verbatim copy or as a verified representation of hidden page content.
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ