
Ontology
Query and traverse a local knowledge-graph ontology (tasks, people, projects, relations) from the CLI or Python while building agent workflows.
Overview
Ontology is an agent skill for the Build phase that documents CLI and Python patterns to query and traverse a typed knowledge graph of tasks, people, and relations.
Install
npx skills add https://github.com/sundial-org/awesome-openclaw-skills --skill ontologyWhat is this skill?
- CLI commands: get by ID, list by type, and property-filtered query via ontology.py
- Relation traversal: outgoing, incoming, and bidirectional related-entity lookups
- Documented patterns for has_task, part_of, blocked_by, has_owner, and attendee_of
- Programmatic Python API import path for embedding queries in agent scripts
- Reference doc for graph-style task/project/person modeling in OpenClaw-style stacks
Adoption & trust: 3.2k installs on skills.sh; 609 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent stores work as graph entities but you lack a consistent cheat sheet for filtered queries and relation walks.
Who is it for?
Indie builders maintaining OpenClaw-style ontology data who want copy-paste query and traversal recipes for agents.
Skip if: Teams with no ontology layer in the repo who only need generic file search or SQL against a normal database.
When should I use this skill?
You maintain ontology-backed task or project data and need standard query and related-entity patterns for agents.
What do I get? / Deliverables
You run documented get/list/query/related commands—or import the Python API—so agents retrieve linked entities without inventing one-off query logic.
- Correct CLI query invocations
- Relation traversal results for agent context
Recommended Skills
Journey fit
Ontology query patterns sit in Build because they support structuring and retrieving structured agent context during implementation, not early market research. agent-tooling is the right shelf for graph/list/related CLI helpers that agents use to read and navigate typed entities and relations.
How it compares
Reference patterns for a local ontology script, not a hosted graph database MCP or vector RAG pipeline.
Common Questions / FAQ
Who is ontology for?
Solo and indie builders wiring Claude Code, Cursor, or Codex to a file-backed ontology of tasks, projects, and people in an OpenClaw-related repo.
When should I use ontology?
During Build when you need to list entities by type, filter by JSON properties, or follow relations like blocked_by or has_owner while implementing agent tooling.
Is ontology safe to install?
It is documentation plus local script usage; review the Security Audits panel on this Prism page and inspect ontology.py in your checkout before granting agent shell access.
SKILL.md
READMESKILL.md - Ontology
# Query Reference Query patterns and graph traversal examples. ## Basic Queries ### Get by ID ```bash python3 scripts/ontology.py get --id task_001 ``` ### List by Type ```bash # All tasks python3 scripts/ontology.py list --type Task # All people python3 scripts/ontology.py list --type Person ``` ### Filter by Properties ```bash # Open tasks python3 scripts/ontology.py query --type Task --where '{"status":"open"}' # High priority tasks python3 scripts/ontology.py query --type Task --where '{"priority":"high"}' # Tasks assigned to specific person (by property) python3 scripts/ontology.py query --type Task --where '{"assignee":"p_001"}' ``` ## Relation Queries ### Get Related Entities ```bash # Tasks belonging to a project (outgoing) python3 scripts/ontology.py related --id proj_001 --rel has_task # What projects does this task belong to (incoming) python3 scripts/ontology.py related --id task_001 --rel part_of --dir incoming # All relations for an entity (both directions) python3 scripts/ontology.py related --id p_001 --dir both ``` ### Common Patterns ```bash # Who owns this project? python3 scripts/ontology.py related --id proj_001 --rel has_owner # What events is this person attending? python3 scripts/ontology.py related --id p_001 --rel attendee_of --dir outgoing # What's blocking this task? python3 scripts/ontology.py related --id task_001 --rel blocked_by --dir incoming ``` ## Programmatic Queries ### Python API ```python from scripts.ontology import load_graph, query_entities, get_related # Load the graph entities, relations = load_graph("memory/ontology/graph.jsonl") # Query entities open_tasks = query_entities("Task", {"status": "open"}, "memory/ontology/graph.jsonl") # Get related project_tasks = get_related("proj_001", "has_task", "memory/ontology/graph.jsonl") ``` ### Complex Queries ```python # Find all tasks blocked by incomplete dependencies def find_blocked_tasks(graph_path): entities, relations = load_graph(graph_path) blocked = [] for entity in entities.values(): if entity["type"] != "Task": continue if entity["properties"].get("status") == "blocked": # Find what's blocking it blockers = get_related(entity["id"], "blocked_by", graph_path, "incoming") incomplete_blockers = [ b for b in blockers if b["entity"]["properties"].get("status") != "done" ] if incomplete_blockers: blocked.append({ "task": entity, "blockers": incomplete_blockers }) return blocked ``` ### Path Queries ```python # Find path between two entities def find_path(from_id, to_id, graph_path, max_depth=5): entities, relations = load_graph(graph_path) visited = set() queue = [(from_id, [])] while queue: current, path = queue.pop(0) if current == to_id: return path if current in visited or len(path) >= max_depth: continue visited.add(current) for rel in relations: if rel["from"] == current and rel["to"] not in visited: queue.append((rel["to"], path + [rel])) if rel["to"] == current and rel["from"] not in visited: queue.append((rel["from"], path + [{**rel, "direction": "incoming"}])) return None # No path found ``` ## Query Patterns by Use Case ### Task Management ```bash # All my open tasks python3 scripts/ontology.py query --type Task --where '{"status":"open","assignee":"p_me"}' # Overdue tasks (requires custom script for date comparison) # See references/schema.md for date handling # Tasks with no blockers python3 scripts/ontology.py query --type Task --where '{"status":"open"}' # Then filter in code for those with no incoming "blocks" relations ``` ### Project Overview ```bash # All tasks in project pytho