with one click
science-create-graph
// Build a project knowledge graph from canonical upstream sources, then materialize graph.trig.
// Build a project knowledge graph from canonical upstream sources, then materialize graph.trig.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | science-create-graph |
| description | Build a project knowledge graph from canonical upstream sources, then materialize graph.trig. |
Converted from Claude command /science:create-graph.
Before executing any research command:
Resolve project profile: Read science.yaml and identify the project's profile.
Use the canonical layout for that profile:
research → doc/, specs/, tasks/, knowledge/, papers/, models/, data/, code/software → doc/, specs/, tasks/, knowledge/, plus native implementation roots such as src/ and tests/Load role prompt: .ai/prompts/<role>.md if present, else references/role-prompts/<role>.md.
Load the science-research-methodology and science-scientific-writing Codex skills. If native skill loading is unavailable, use codex-skills/INDEX.md to map canonical Science skill names to generated skill files and source paths.
Read specs/research-question.md for project context when it exists.
Load project aspects: Read aspects from science.yaml (default: empty list).
For each declared aspect, resolve the aspect file in this order:
aspects/<name>/<name>.md — canonical Science aspects.ai/aspects/<name>.md — project-local aspect override or additionIf neither path exists (the project declares an aspect that isn't shipped with
Science and has no project-local definition), do not block: log a single line
like aspect "<name>" declared in science.yaml but no definition found — proceeding without it and continue. Suggest the user either (a) drop the
aspect from science.yaml, (b) author it under .ai/aspects/<name>.md, or
(c) align the name with one shipped under aspects/.
When executing command steps, incorporate the additional sections, guidance, and signal categories from loaded aspects. Aspect-contributed sections are whole sections inserted at the placement indicated in each aspect file.
Check for missing aspects: Scan for structural signals that suggest aspects the project could benefit from but hasn't declared:
| Signal | Suggests |
|---|---|
Files in specs/hypotheses/ | hypothesis-testing |
Files in models/ (.dot, .json DAG files) | causal-modeling |
Workflow files, notebooks, or benchmark scripts in code/ | computational-analysis |
Package manifests (pyproject.toml, package.json, Cargo.toml) at project root with project source code (not just tool dependencies) | software-development |
If a signal is detected and the corresponding aspect is not in the aspects list,
briefly note it to the user before proceeding:
"This project has [signal] but the
[aspect]aspect isn't enabled. This would add [brief description of what the aspect contributes]. Want me to add it toscience.yaml?"
If the user agrees, add the aspect to science.yaml and load the aspect file
before continuing. If they decline, proceed without it.
Only check once per command invocation — do not re-prompt for the same aspect if the user has previously declined it in this session.
Resolve templates: When a command says "Read .ai/templates/<name>.md",
check the project's .ai/templates/ directory first. If not found, read from
templates/<name>.md. If neither exists, warn the
user and proceed without a template — the command's Writing section provides
sufficient structure.
Resolve science CLI invocation: When a command says to run science,
prefer the project-local install path: uv run science <command>.
This assumes the root pyproject.toml includes science as a dev
dependency installed via uv add --dev --editable "$SCIENCE_TOOL_PATH"
(the distribution is science; the entry point it installs is science).
If that fails (no root pyproject.toml or science not in dependencies),
fall back to:
uv run --with <science-plugin-root>/science science <command>
Prerequisite: Read
docs/specs/2026-03-01-knowledge-graph-design.mdanddocs/proposition-and-evidence-model.mdbefore starting.
This command does not author triples directly. It organizes project knowledge into canonical upstream sources, audits reference resolution, and materializes knowledge/graph.trig as a generated artifact.
All science commands below use this pattern:
uv run science <command>
For brevity, the examples below write just science <command>; always expand them to uv run science <command> when executing.
knowledge/graph.trig directly.knowledge_profiles in science.yaml before building the graph.knowledge/sources/ files as the canonical graph inputs.knowledge/sources/<local-profile>/, not as ad hoc triples.science graph audit before science graph build.Before adding new entities, check the cross-project registry for existing definitions. Run science sync status to see if the registry is populated. If it is, new entities added during graph creation will be checked against the registry during graph build to detect potential duplicates across projects. If a match is found, prefer reusing the existing canonical ID and aliases rather than creating a new entity.
For every new entity, read docs/process/entity-creation-cookbook.md and
check shared kinds before creating project-local entries. If no shared identity fits,
prefer a local concept:* entity for project-scoped concepts rather than
inventing a shared canonical ID.
Build the graph from these upstream sources:
specs/ and doc/ with YAML frontmatter (id, type, title, related, source_refs, etc.)tasks/active.md and tasks/done/*.mdknowledge/sources/<local-profile>/entities.yamlknowledge/sources/<local-profile>/relations.yamlknowledge/sources/<local-profile>/mappings.yamlUse science-model/core semantics for shared entity and relation types. Declare domain ontologies (e.g., biolink) in science.yaml to enable vocabulary for entity types and relation predicates. Put anything project-local but still useful in the configured local profile directory, which defaults to local.
Ensure science.yaml declares the ontologies and profiles you want to compose:
ontologies: [biolink]
knowledge_profiles:
local: local
ontologies declares which community ontologies provide vocabulary for entity types and relation predicates. Currently available: biolink. core is always implied.
local also determines the directory name under knowledge/sources/; if omitted, use local.
For each project entity:
specs/hypotheses/doc/questions/doc/ locationstasks/*.md related: / blocked-by: fields using canonical IDs.knowledge/sources/<local-profile>/:
entities.yaml for local entities such as project topics or legacy questions not yet migrated into standalone docsmappings.yaml for explicit aliases during migrationrelations.yaml only when you need project-local relation declarationsExample entities.yaml entry:
entities:
- canonical_id: topic:evaluation
kind: topic
title: Evaluation
profile: local
source_path: knowledge/sources/local/entities.yaml
Run:
science graph audit --project-root . --format json
Fix every unresolved reference in the canonical sources before building:
mappings.yaml when a temporary migration bridge is still neededtheme markdown entities under doc/themes/ when the missing node is a durable cross-cutting organizing frame that links multiple questions, hypotheses, tasks, reports, methods, concepts, child projects, or guardrails.Once audit is clean:
science graph build --project-root .
science graph validate --format json
science graph stats --format json
science graph build generates knowledge/graph.trig deterministically from the upstream sources. That file is a view over the canonical inputs, not the place to curate knowledge manually.
At completion, the project should have:
knowledge/sources/<local-profile>/ for local extensions and explicit aliasesknowledge/graph.triggraph audit and graph validate outputgraph.trig, stop and add or repair the missing upstream source instead.