Schema Reference
Schema Reference
The core schema is defined in
local_resources/typedb/alhazen_notebook.tql. Skill namespace schemas live inlocal_skills/<skill>/schema.tql. Runmake docs-schema-wikito regenerate detailed per-namespace documentation (requires TypeDB running).
TypeDB 3.x Syntax Notes
This schema uses TypeDB 3.x syntax (3.8.0+). Key differences from 2.x:
| Feature | TypeDB 3.x | TypeDB 2.x (old) |
|---|---|---|
| Attribute definition | attribute x, value string; |
x sub attribute, value string; |
| Integer type | value integer |
value long |
| Entity definition | entity x sub y, (requires entity keyword) |
x sub y, |
| Relation definition | relation x, |
x sub relation, |
| Abstract annotation | entity x @abstract, sub y, |
x sub y @abstract, |
| Fetch syntax | fetch { "key": $var.attr }; |
fetch $var: attr1, attr2; |
| Transactions | driver.transaction(db, Type) |
driver.session(...).transaction(...) |
Core Schema Hierarchy
All entities in the Alhazen system inherit from identifiable-entity. The hierarchy has three branches:
identifiable-entity (abstract)
├── domain-thing — real-world objects you reason about
│ ├── agent — AI agents and human actors
│ │ └── author — publication authors
│ └── [namespace types] — one or more types per skill
│ scilit-paper, career-opportunity, trec-system, ...
├── collection — typed sets of domain objects
│ └── [namespace types] — per-skill collection types
│ scilit-corpus, career-search, trec-investigation, ...
└── information-content-entity (abstract) — content-bearing entities
├── artifact — raw captured content (HTML, PDF, API response)
├── fragment — extracted piece of an artifact
└── note — agent analysis or annotation
Additional root entities (not in the main hierarchy):
organization— affiliations and institutionsinformation-resource— databases, knowledgebases, APIsuser-question— questions/instructions from usersvocabulary/vocabulary-type/vocabulary-property— external classification systemstag— lightweight classification labels
Core Attributes
Identity and Naming
| Attribute | Type | Description |
|---|---|---|
id |
string (key) | UUID — inherited by all identifiable-entity subtypes |
name |
string | Human-readable name |
description |
string | Longer text description |
iri |
string | URI/IRI identifier (for linked data) |
abstract-text |
string | Abstract or summary text |
Content and Cache
| Attribute | Type | Description |
|---|---|---|
content |
string | Inline content (< 50 KB) |
content-hash |
string | SHA hash for deduplication |
format |
string | MIME type or format string |
token-count |
integer | Token count for LLM context sizing |
cache-path |
string | Relative path in ~/.alhazen/cache/ (for ≥ 50 KB content) |
mime-type |
string | MIME type of cached file |
file-size |
integer | Size in bytes |
Temporal
| Attribute | Type | Description |
|---|---|---|
created-at |
datetime | Creation timestamp |
updated-at |
datetime | Last modified timestamp |
publication-date |
datetime | Date of publication |
valid-from / valid-until |
datetime | Validity window (affiliations, etc.) |
Provenance
| Attribute | Type | Description |
|---|---|---|
provenance |
string | Source description or URL |
source-uri |
string | Original source URI |
confidence |
double | Confidence score (0.0–1.0) |
license |
string | Content license |
Core Relations
Knowledge Model
| Relation | Roles | Purpose |
|---|---|---|
aboutness |
note, subject |
Links notes to any identifiable-entity |
representation |
artifact, referent |
Links artifacts to the things they represent |
collection-membership |
collection, member |
Membership of entities in collections |
collection-nesting |
parent-collection, child-collection |
Hierarchical collections |
fragmentation |
whole, part |
Artifact → fragment relationship |
derivation |
derivative, derived-from-source |
Provenance chain |
note-threading |
parent-note, child-note |
Hierarchical note organization |
citation-reference |
citing-item, cited-item |
Citation relationships |
authorship |
author, work, publication-author |
Who created what |
affiliation |
affiliated-agent, organization |
Agent membership in organizations |
Classification System
| Relation | Roles | Purpose |
|---|---|---|
classification |
classified-entity, type-facet |
Assign vocabulary types to entities |
tagging |
tagged-entity, tag |
Lightweight tagging |
property-assertion |
subject-entity, property-definition |
Dynamic property assignment |
semantic-triple |
triple-subject, triple-predicate, triple-object |
RDF-style assertions |
evidence-chain |
claim, evidence |
Linking claims to supporting evidence |
Skill Namespaces
Each skill extends the core schema with domain-specific types. All types use a namespace prefix to avoid collisions.
Namespaces are grouped by the application whose database loads them.
| Namespace Prefix | Skill | Application / database | Description |
|---|---|---|---|
nbmem- |
agentic-memory | Core · alh_core |
Operator profile, memory claims, episodes |
dm- |
curation-skill-builder | Core · alh_core |
Domain designs, phases, decisions |
scilit- |
scientific-literature | Deep Research · alh_deep_research |
Papers, corpora, sources |
trec- |
tech-recon | Deep Research · alh_deep_research |
Systems, investigations, analyses |
career- |
career | Personal Assistant · alh_personal |
People, collaborators, projects, opportunities |
anlst- |
analyst | Personal Assistant · alh_personal |
Missions, questions, dispatches, findings |
advsr- |
advisor | Personal Assistant · alh_personal |
Advisors, decisions, journal entries |
scribe- |
scribe | Personal Assistant · alh_personal |
Voice profiles, personas, pieces, drafts |
ops- |
ops | Personal Assistant · alh_personal |
Brief specs, dossiers, commitments, monitors |
coach- |
coach | Personal Assistant · alh_personal |
Health metrics, workouts, goals |
myth- |
mythras-gm | Mythras GM · alh_mythras |
Campaigns, characters, encounters, rules |
For detailed per-namespace schema, see each skill’s page under its application — for example Scientific Literature, Tech Recon, Career, or Research Analyst.
Design Conventions
Prefix everything. url is fine for a single-domain schema; career-url avoids collision when multiple skills share a database.
Reuse core attributes. Check the core schema before defining a new attribute — name, description, content, source-uri, created-at, confidence, license are already defined and inherited.
Domain objects are not information content. A paper, a gene, a job posting — these are domain-thing. The HTML page that describes the job posting is an artifact. The extracted salary requirement is a fragment. The fit analysis is a note.
Collections are typed per skill. Never use bare collection — define scilit-corpus sub collection so queries can target it specifically.
Relations before entities in namespace schemas. Define all relations first so role names resolve when entities use plays clauses.
No @key on custom attributes. Only the inherited id @key (from identifiable-entity) is permitted. Adding @key to namespace attributes causes schema errors.
See Also
- Design Concepts — the three-branch hierarchy in context
- Skill Architecture — how skill schemas are discovered and loaded
- Gap Architecture — schema gap detection and the improvement loop