ontology-discovery

ontology-discovery is an agent for Claude Code from modeled-information-format/mnemonic. It costs 14 tokens per session (618 once invoked), scanned A, original, MIT.

An agent that scans a codebase for entities such as technologies, components, and design patterns, based on defined ontology rules.

In plain words
What is it for?
Use it to read ontology patterns, scan source and documentation, compare findings with existing memories, and prepare capture suggestions.
Why use it?
It helps discover useful knowledge that should be recorded instead of relying on people to notice and capture everything manually.

Agent for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: model in frontmatter.

Part of the mnemonic plugin — 10 skills, 14 commands, 4 agents, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/modeled-information-format/mnemonic/ontology-discovery
Clone the repo
git clone --depth 1 https://github.com/modeled-information-format/mnemonic

Made for: Claude Code.

Or install mnemonic, the plugin that ships this one along with the rest of its 10 skills, 14 commands, 4 agents, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ontology-discovery

README.md
[![agentmods](https://agentmods.dev/badge/agents/modeled-information-format/mnemonic/ontology-discovery.svg)](https://agentmods.dev/agents/modeled-information-format/mnemonic/ontology-discovery)
Your own site
<a href="https://agentmods.dev/agents/modeled-information-format/mnemonic/ontology-discovery"><img src="https://agentmods.dev/badge/agents/modeled-information-format/mnemonic/ontology-discovery.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 618 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00014 $0.00618
Opus 5 $0.00007 $0.00309
Sonnet 5 $0.00003 $0.00124
Haiku 4.5 $0.00001 $0.00062

Measured 6d ago against content hash 6a9c679f36d0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

ontology-discovery scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/ontology-discovery.md · 101 lines

How it starts

The opening of the file, as written. The whole thing — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Ontology Discovery Agent

Analyzes code and documentation to suggest entity captures based on ontology discovery patterns.

Purpose

Proactively identify entities (technologies, components, patterns, etc.) mentioned in the codebase that should be captured as mnemonic memories.

Memory

Search first: /mnemonic:search {relevant_keywords} Capture after: /mnemonic:capture {namespace} "{title}"

Run /mnemonic:list --namespaces to see available namespaces from loaded ontologies.

Workflow

  1. Load Ontology

    • Read .claude/mnemonic/ontology.yaml
    • Extract discovery patterns
  2. Scan Codebase

    • Use Grep to find pattern matches
    • Group by entity type
  3. Check Existing Entities

    • Search mnemonic for existing memories
    • Filter out already-captured entities
  4. Generate Suggestions

    • Write suggestions to blackboard
    • Format for user confirmation

Execution

# Load patterns from ontology
ONTOLOGY=".claude/mnemonic/ontology.yaml"

# Scan for technologies
rg -i '\b(PostgreSQL|MySQL|MongoDB|Redis|Kafka)\b' . \
  --glob '*.{py,js,ts,yaml,md}' -l | head -20

# Scan for design patterns
rg -i '\b(Factory|Repository|Singleton|Observer)\s+Pattern\b' . \
  --glob '*.{py,js,ts,md}' -l | head -20

# Scan for components
find . -path '*/services/*' -name '*.py' | head -20
find . -path '*/components/*' -name '*.tsx' | head -20

Output Format

Write to blackboard:

## Entity Discovery Suggestions

### Technologies
- [ ] PostgreSQL (src/database.py) -> capture as technology
- [ ] Redis (src/cache.py) -> capture as technology

### Components
- [ ] PaymentService (src/services/payment.py) -> capture as component
- [ ] UserAuth (src/services/auth.py) -> capture as component

### Patterns
- [ ] Repository Pattern (src/repositories/) -> capture as design-pattern

User Confirmation

After discovery, ask user:

I found 5 potential entities that could be captured:

  • 2 technologies (PostgreSQL, Redis)
  • 2 components (PaymentService, UserAuth)
  • 1 pattern (Repository Pattern)

Would you like me to create memories for any of these?

Read the full file on GitHub · 101 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 101 lines · 14 tokens per session scan A 6a9c679f36d0

Subscribe to this mod's changes

ontology-discovery is an agent published in the GitHub repository modeled-information-format/mnemonic (23 stars, last pushed 1mo ago), licensed MIT. It adds 14 tokens to every session and 618 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.