Ontology and Memory Systems (1/13) — Why Ontology Is Necessary in Claude Code

OpenClaw Gateway와 24시간 무중단 자동화 설계

As AI agents multiply, relationship design determines system performance


Key Takeaways

  • An ontology is a structural map that defines relationships and dependencies between agents
  • In Claude Code, CLAUDE.md and the memory system are the concrete implementation of ontology
  • Operating multiple Claude Code projects simultaneously requires shared knowledge and a consistent user perspective to maintain system-wide coherence
  • Agents beyond Claude Code — GPT, Gemini, local LLMs — can participate in the same ontology

Background

When running projects with Claude Code, agents accumulate naturally. One for app development, one for server management, one for content writing. Each works fine in isolation.

Beyond a handful of agents, structural problems emerge. "Can the agent that produced this data feed it to another agent?" "When a new project is added, how does it connect to existing agents?" "Does user behavior need to be defined separately for every agent?"

Ontology solves these problems.


Body

LaunchAgent 설치와 타임존 주입

1. What Is an Ontology?

Ontology is a philosophical term originally meaning "the study of being." In information technology the definition narrows to something precise: a structural map that defines relationships between entities.

An AI agent ontology defines three things:

① Who exists (entities) Which agents are in the system, and what role each one serves.

② Who connects to whom (relationships) Which agent sends data to which agent. Which technology stacks are shared. Where content flows.

③ What rules are shared (shared knowledge) What user preferences, working principles, and judgment criteria every agent must know.

A database schema defines relationships between data; an ontology defines relationships between agents. A database without a schema produces chaos — so does a multi-agent system without an ontology.


2. How Ontology Works in Claude Code

Claude Code already ships with the structure needed to implement an ontology.

CLAUDE.md — agent identity and persistent memory

Every Claude Code project reads CLAUDE.md automatically at session start. It holds the project's purpose, rules, and structure — the identity of that individual agent.

CLAUDE.md operates on two layers: - Global CLAUDE.md (~/.claude/CLAUDE.md): applied to every project - Project CLAUDE.md (project root): applied only to that project

This two-layer structure is the foundation of the ontology. Define the full agent roster, relationship graph, and shared rules in the global CLAUDE.md — then every project opens with complete system context already loaded.

Memory system — persistence across conversations

Claude Code's memory persists across sessions. Understanding of the user, task feedback, and project state accumulate over time.

When memory is combined with ontology, the following mechanism activates: - A user preference learned in Agent A (e.g., preference for data-driven decisions) is written to global context - Agent B reads the same fact automatically at session start via the global CLAUDE.md - Even a brand-new project operates immediately in alignment with user preferences

User perspective does not need to be redefined per agent. A policy shared once applies to the entire system.


Daily Audit 파이프라인

3. Advantages of Ontology Across Multiple Claude Code Projects

With a single Claude Code project, ontology is unnecessary. Two or three can be tracked mentally. Beyond that, the gap becomes significant.

① Knowledge reuse

A state management pattern solved in a Flutter app project is recorded in the ontology as a technology relationship. Other Flutter projects consult that relationship path — "check existing patterns in sibling projects" — before solving the same problem again. The same problem is not solved twice.

② Data flow visibility

Insights from a stock analysis agent flow into a content agent as blog source material. When this flow is explicitly declared in the ontology as a [data] relationship, the content agent knows its input sources and expected format from session start.

③ Consistent user perspective

This is the most critical effect. Define the user's decision criteria, values, and preferred working style in the global CLAUDE.md — every agent in the system understands the same person in the same way.

The development agent knows the user prefers data-driven judgment; the content agent applies the same principle when writing. No per-agent re-explanation is needed.

④ New agent onboarding

Without ontology, adding a new agent means configuring it from scratch. With ontology, reading the global CLAUDE.md is sufficient for the new agent to immediately understand the full system context, user preferences, and its relationships to existing agents.


4. Other AI Systems Can Participate in the Same Ontology

The ontology is implemented as a Markdown file — CLAUDE.md. It is not Claude Code-exclusive.

GPT, Gemini, and local LLMs can all read it. Markdown is a format any AI model understands. Injecting the same ontology file into a system prompt or context window gives any AI model the same relationship map and user perspective.

Practical examples: - Claude Code as the primary agent, GPT as a fact-checking assistant → role boundaries are clear under a shared ontology - A local LLM handles data preprocessing, Claude Code handles analysis → data relationships are defined in the ontology - Adding a new AI service → register its role and relationships in the ontology; integration is complete

The criterion is role, not AI vendor. An ontology is a system-level blueprint — it is not bound to any specific AI.


5. Three Relationship Types in an Ontology

Relationships between agents fall into three categories.

Data relationship [data] — the output of one agent is the input of another

OpenClaw Manager → Home Server: analysis insights → dashboard display
Stock Director → Content Director: investment analysis → blog source material

Technology relationship [tech] — shared stack enables pattern reuse

QuietLeaf ↔ GrowNote: Flutter UI patterns, state management shared
Prompt Harness → all projects: harness structure provided

Content relationship [content] — domain knowledge becomes source material for other agents

Life Manager → Content Director: experiences/decisions → blog material
Stock Director → Content Director: analysis insights → content source

These relationships are managed as a table in CLAUDE.md. When a new agent is added, its relationship type is defined immediately.


Design Considerations

  • Ontology does not need to be built early. When the agent count is small, mental tracking is sufficient. Documentation is appropriate when management overhead becomes a real burden.

  • A global CLAUDE.md that grows too long becomes counterproductive. The longer the prompt, the lower the relative attention given to content near the beginning. Keep the ontology concise; put detailed rules in each project's CLAUDE.md.

  • Relationships must be classified as unidirectional or bidirectional. "A → B" (A sends to B) is not the same as "A ↔ B" (mutual exchange). Misclassifying a one-way relationship as bidirectional creates the expectation of a dependency that does not exist.


Closing

An ontology is not an abstract concept. It is "a document that records how your agents are connected."

But that single document produces compounding returns. Knowledge is reused. User perspective is consistent across the system. New agents join the system immediately. AI models other than Claude Code operate in the same shared context.

Part 2 covers actual implementation: message hub design, context isolation, and memory layer architecture.

댓글

이 블로그의 인기 게시물

Agent Memory Engine (2/10) — Building an AI Agent Memory System with SQLite Alone

"ML Foundations (9/9) — PyTorch vs TensorFlow, and the Road to Local LLMs"

"RAG Core Study (14/26) — Evaluation Sets with RAGAS & DeepEval"

"ML Foundations (8/9) — Deep Learning Architectures: CNN, RNN, Attention"

"ML Foundations (7/9) — Deep Learning Training: Optimizers, Regularization, Initialization"

OpenClaw to Hermes Migration (2/13) — What to Preserve, Partially Port, or Discard

AI Agents I Built (5/7) — Building an Automated Blogger API Publishing System