opentology 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +390 -552
- package/dist/templates/claude-md-context.js +60 -0
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OpenTology
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Ontology-powered project memory for AI coding assistants — your codebase as a knowledge graph
|
|
4
4
|
|
|
5
5
|
[English](#english) | [한국어](#한국어)
|
|
6
6
|
|
|
@@ -8,351 +8,270 @@
|
|
|
8
8
|
|
|
9
9
|
## English
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```mermaid
|
|
14
|
-
graph TB
|
|
15
|
-
subgraph CLI["opentology CLI"]
|
|
16
|
-
Init[init]
|
|
17
|
-
Push[push]
|
|
18
|
-
Query[query]
|
|
19
|
-
Validate[validate]
|
|
20
|
-
Infer[infer]
|
|
21
|
-
More[...]
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
subgraph MCP["MCP Server"]
|
|
25
|
-
Tools[23 Tools]
|
|
26
|
-
Resource["opentology://schema"]
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
subgraph Adapter["StoreAdapter"]
|
|
30
|
-
HTTP["HTTP Mode\nOxigraph Server"]
|
|
31
|
-
Embedded["Embedded Mode\nWASM In-Process"]
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
subgraph Pipeline["Processing Pipeline"]
|
|
35
|
-
SHACL["SHACL Validation"]
|
|
36
|
-
RDFS["RDFS Reasoning"]
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
CLI --> Adapter
|
|
40
|
-
MCP --> Adapter
|
|
41
|
-
CLI --> Pipeline
|
|
42
|
-
Pipeline --> Adapter
|
|
43
|
-
```
|
|
11
|
+
Most MCP servers give AI assistants tools. OpenTology gives them **understanding**.
|
|
44
12
|
|
|
45
|
-
|
|
13
|
+
When you connect OpenTology to Claude Code (or any MCP client), it doesn't just expose SPARQL queries — it builds a persistent knowledge graph of your project: module dependencies, architectural decisions, resolved bugs, session history, and code-level symbols. Then it **automatically instructs** the AI to check impact before editing, search past decisions before choosing, and record what it learns.
|
|
46
14
|
|
|
47
|
-
|
|
15
|
+
The result: an AI assistant that remembers across sessions, understands your codebase structure, and thinks before it acts.
|
|
48
16
|
|
|
49
|
-
|
|
50
|
-
- **oxigraph** uses WebAssembly (WASM) — platform-independent, runs everywhere Node.js runs. No C++ compiler, Python, or native build tools needed.
|
|
17
|
+
### How It Works
|
|
51
18
|
|
|
52
|
-
|
|
19
|
+
```
|
|
20
|
+
npm install -g opentology # 1. Install
|
|
21
|
+
opentology context init # 2. Initialize (creates graph + hooks + CLAUDE.md instructions)
|
|
22
|
+
opentology context scan # 3. Scan codebase into the knowledge graph
|
|
23
|
+
# 4. Done — AI now uses the graph automatically
|
|
24
|
+
```
|
|
53
25
|
|
|
54
|
-
|
|
55
|
-
# Zero-install embedded mode (no Docker!)
|
|
56
|
-
opentology init --embedded my-project
|
|
57
|
-
|
|
58
|
-
# Define ontology with class hierarchy
|
|
59
|
-
cat > ontology.ttl << 'EOF'
|
|
60
|
-
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
61
|
-
@prefix ex: <http://example.org/> .
|
|
62
|
-
ex:Person a rdfs:Class .
|
|
63
|
-
ex:Doctor rdfs:subClassOf ex:Person .
|
|
64
|
-
ex:Kim a ex:Doctor ; ex:name "Dr. Kim" .
|
|
65
|
-
ex:Lee a ex:Person ; ex:name "Lee" .
|
|
66
|
-
EOF
|
|
67
|
-
|
|
68
|
-
# Push with automatic RDFS inference
|
|
69
|
-
opentology push ontology.ttl
|
|
70
|
-
# -> Pushed 6 triples
|
|
71
|
-
# -> Inferred 1 additional triples
|
|
26
|
+
After setup, every session follows this cycle:
|
|
72
27
|
|
|
73
|
-
# Query: Doctor instances found as Person (inference!)
|
|
74
|
-
opentology query 'SELECT ?name WHERE { ?p a ex:Person . ?p ex:name ?name }'
|
|
75
|
-
# -> Kim, Lee (Kim is a Doctor, but inferred as Person)
|
|
76
28
|
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
29
|
+
┌─────────── Session Start ───────────┐
|
|
30
|
+
│ SessionStart hook │
|
|
31
|
+
│ → context_sync (auto-recover │
|
|
32
|
+
│ missed sessions, rescan modules) │
|
|
33
|
+
│ │
|
|
34
|
+
│ "Edit src/lib/reasoner.ts" │
|
|
35
|
+
│ → context_impact (blast radius) │
|
|
36
|
+
│ → "5 dependents, impact: high" │
|
|
37
|
+
│ → Confirms with user, then edits │
|
|
38
|
+
│ │
|
|
39
|
+
│ Encounters a bug │
|
|
40
|
+
│ → query (search past issues) │
|
|
41
|
+
│ → Finds similar resolved issue │
|
|
42
|
+
│ │
|
|
43
|
+
│ Makes architecture decision │
|
|
44
|
+
│ → push (records Decision) │
|
|
45
|
+
│ │
|
|
46
|
+
│ Session End │
|
|
47
|
+
│ → push (records Session summary) │
|
|
48
|
+
└─────────────────────────────────────┘
|
|
90
49
|
```
|
|
91
50
|
|
|
92
|
-
###
|
|
51
|
+
### What Makes This Different
|
|
93
52
|
|
|
94
|
-
| |
|
|
95
|
-
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
| Query language | SPARQL (auto-prefixed) | SPARQL (raw) | Cypher |
|
|
102
|
-
| Data format | Turtle files | Turtle/N-Triples | Property graph |
|
|
103
|
-
| Project scoping | Automatic named graphs | Manual | Database-level |
|
|
104
|
-
|
|
105
|
-
### Features
|
|
53
|
+
| | Typical MCP | OpenTology |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| Provides | Tools only | Tools + behavioral instructions + auto-sync hooks |
|
|
56
|
+
| AI behavior | User must prompt correctly | AI proactively checks impact, searches context |
|
|
57
|
+
| Memory | Resets every session | Persistent knowledge graph across sessions |
|
|
58
|
+
| Codebase awareness | None | Module dependencies, symbols, call graphs |
|
|
59
|
+
| Setup | Manual per-project config | One command (`context init`) |
|
|
106
60
|
|
|
107
|
-
**
|
|
61
|
+
OpenTology doesn't just add capabilities — it **shapes how the AI works** on your project.
|
|
108
62
|
|
|
109
|
-
|
|
110
|
-
- Project-level configuration with `.opentology.json`
|
|
111
|
-
- Named graph scoping -- queries are automatically scoped to your project
|
|
112
|
-
- Two modes: HTTP (Oxigraph server) and embedded (WASM, zero Docker)
|
|
113
|
-
- Prefix registry with auto-injection into SPARQL queries
|
|
63
|
+
### The Knowledge Graph
|
|
114
64
|
|
|
115
|
-
|
|
65
|
+
Everything lives in RDF named graphs with the `otx:` ontology:
|
|
116
66
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
67
|
+
```
|
|
68
|
+
context graph sessions graph
|
|
69
|
+
├── otx:Module (source files) └── otx:Session (work logs)
|
|
70
|
+
│ └── otx:dependsOn ├── otx:body (what was done)
|
|
71
|
+
├── otx:Class / otx:Interface └── otx:nextTodo (what's next)
|
|
72
|
+
│ └── otx:Method / otx:Function
|
|
73
|
+
├── otx:Decision (architecture choices)
|
|
74
|
+
├── otx:Issue (bugs, status tracking)
|
|
75
|
+
└── otx:Knowledge (reusable patterns)
|
|
76
|
+
```
|
|
120
77
|
|
|
121
|
-
|
|
78
|
+
Query anything with SPARQL:
|
|
122
79
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
80
|
+
```sparql
|
|
81
|
+
# What depends on this module?
|
|
82
|
+
SELECT ?dep WHERE { ?dep otx:dependsOn <urn:module:src/lib/reasoner> }
|
|
126
83
|
|
|
127
|
-
|
|
84
|
+
# What decisions were made about auth?
|
|
85
|
+
SELECT ?title ?reason WHERE {
|
|
86
|
+
?d a otx:Decision ; otx:title ?title ; otx:reason ?reason
|
|
87
|
+
FILTER(CONTAINS(LCASE(?title), "auth"))
|
|
88
|
+
}
|
|
128
89
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
90
|
+
# What did we do last session?
|
|
91
|
+
SELECT ?title ?body ?next WHERE {
|
|
92
|
+
?s a otx:Session ; otx:title ?title ; otx:body ?body
|
|
93
|
+
OPTIONAL { ?s otx:nextTodo ?next }
|
|
94
|
+
} ORDER BY DESC(?date) LIMIT 1
|
|
95
|
+
```
|
|
132
96
|
|
|
133
|
-
|
|
97
|
+
### Quick Start
|
|
134
98
|
|
|
135
|
-
|
|
136
|
-
- Explore classes, instances, and relationships visually with vis-network
|
|
137
|
-
- SPARQL query editor, node filtering, search, and focus mode
|
|
99
|
+
#### 1. Add to your MCP client
|
|
138
100
|
|
|
139
|
-
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"mcpServers": {
|
|
104
|
+
"opentology": {
|
|
105
|
+
"command": "npx",
|
|
106
|
+
"args": ["-y", "opentology", "mcp"]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
140
111
|
|
|
141
|
-
|
|
142
|
-
|---|---|---|
|
|
143
|
-
| Backend | Oxigraph server (Docker or binary) | In-process WASM store |
|
|
144
|
-
| Docker | Required | Not required |
|
|
145
|
-
| Init | `opentology init my-project` | `opentology init --embedded my-project` |
|
|
146
|
-
| Source of truth | Oxigraph server | Local `.ttl` files |
|
|
147
|
-
| Best for | Production, shared access | Local dev, quick experiments |
|
|
148
|
-
| Performance | Server-grade | Single-user |
|
|
112
|
+
#### 2. Initialize project context
|
|
149
113
|
|
|
150
|
-
|
|
114
|
+
Ask your AI assistant to run `context_init`, or from the CLI:
|
|
151
115
|
|
|
152
116
|
```bash
|
|
153
|
-
|
|
117
|
+
opentology context init
|
|
154
118
|
```
|
|
155
119
|
|
|
156
|
-
|
|
120
|
+
This creates:
|
|
121
|
+
- `.opentology.json` — project config
|
|
122
|
+
- Context and sessions named graphs
|
|
123
|
+
- SessionStart hook for auto-sync
|
|
124
|
+
- CLAUDE.md instructions (impact checks, graph queries, session recording)
|
|
157
125
|
|
|
158
|
-
|
|
126
|
+
#### 3. Scan your codebase
|
|
159
127
|
|
|
160
128
|
```bash
|
|
161
|
-
|
|
162
|
-
serve --location /data --bind 0.0.0.0:7878
|
|
129
|
+
opentology context scan
|
|
163
130
|
```
|
|
164
131
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
### CLI Commands
|
|
168
|
-
|
|
169
|
-
| Command | Description |
|
|
170
|
-
|---------|-------------|
|
|
171
|
-
| `opentology init [project-id]` | Initialize project (`--embedded` for Docker-free mode) |
|
|
172
|
-
| `opentology validate <file>` | Validate Turtle syntax (`--shacl` for SHACL validation) |
|
|
173
|
-
| `opentology push <file>` | Push triples with auto SHACL validation and RDFS inference (`--replace`, `--no-shacl`, `--no-infer`) |
|
|
174
|
-
| `opentology query <sparql>` | Run SPARQL with auto prefix injection (`--format table\|json\|csv`, `--raw`) |
|
|
175
|
-
| `opentology status` | Show asserted/inferred/total triple counts (file count in embedded mode) |
|
|
176
|
-
| `opentology pull` | Export project graph as Turtle |
|
|
177
|
-
| `opentology drop` | Drop the entire project graph (`--force` to skip confirmation) |
|
|
178
|
-
| `opentology delete <file>` | Delete triples from a file or by pattern (`--where`) |
|
|
179
|
-
| `opentology diff <file>` | Compare local Turtle file against the graph |
|
|
180
|
-
| `opentology shapes` | List or show SHACL shapes |
|
|
181
|
-
| `opentology infer` | Run RDFS materialization (`--clear` to remove inferred triples) |
|
|
182
|
-
| `opentology graph` | List, create, or drop named graphs |
|
|
183
|
-
| `opentology prefix` | List, add, or remove project prefixes |
|
|
184
|
-
| `opentology context` | Project context management (`init`, `load`, `status`, `scan`, `impact`, `sync`, `graph`) |
|
|
185
|
-
| `opentology viz` | Visualize ontology schema (`schema`) |
|
|
186
|
-
| `opentology doctor` | Check project health (config, store, context, hooks, dependencies) |
|
|
187
|
-
| `opentology mcp` | Start the MCP server |
|
|
188
|
-
|
|
189
|
-
### MCP Integration
|
|
190
|
-
|
|
191
|
-
Add to your MCP client configuration (`.mcp.json`):
|
|
132
|
+
Builds the module dependency graph. For deeper analysis:
|
|
192
133
|
|
|
193
134
|
```json
|
|
194
|
-
{
|
|
195
|
-
"mcpServers": {
|
|
196
|
-
"opentology": {
|
|
197
|
-
"command": "npx",
|
|
198
|
-
"args": ["opentology", "mcp"]
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
135
|
+
{ "depth": "symbol", "includeMethodCalls": true }
|
|
202
136
|
```
|
|
203
137
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
| Tool | Description |
|
|
207
|
-
|------|-------------|
|
|
208
|
-
| `opentology_init` | Initialize a project |
|
|
209
|
-
| `opentology_validate` | Validate Turtle content |
|
|
210
|
-
| `opentology_push` | Validate and push triples |
|
|
211
|
-
| `opentology_query` | Execute SPARQL queries |
|
|
212
|
-
| `opentology_status` | Get project status |
|
|
213
|
-
| `opentology_pull` | Export graph as Turtle |
|
|
214
|
-
| `opentology_drop` | Drop project graph |
|
|
215
|
-
| `opentology_delete` | Delete triples |
|
|
216
|
-
| `opentology_diff` | Compare local vs graph |
|
|
217
|
-
| `opentology_schema` | Introspect ontology schema |
|
|
218
|
-
| `opentology_infer` | Run RDFS inference |
|
|
219
|
-
| `opentology_graph_list` | List named graphs |
|
|
220
|
-
| `opentology_graph_create` | Create a named graph |
|
|
221
|
-
| `opentology_graph_drop` | Drop a named graph |
|
|
222
|
-
| `opentology_visualize` | Generate schema visualization (Mermaid/DOT) |
|
|
223
|
-
| `opentology_context_init` | Initialize project context graph |
|
|
224
|
-
| `opentology_context_load` | Load project context |
|
|
225
|
-
| `opentology_context_status` | Check context initialization status |
|
|
226
|
-
| `opentology_context_scan` | Scan codebase (module or symbol-level) |
|
|
227
|
-
| `opentology_context_impact` | Analyze file modification impact (dependents, dependencies, related context) |
|
|
228
|
-
| `opentology_context_sync` | Auto-sync: recover missed sessions from git, rescan module graph |
|
|
229
|
-
| `opentology_context_graph` | Start interactive graph visualization web UI |
|
|
230
|
-
| `opentology_doctor` | Check project health (config, store, hooks, dependencies) |
|
|
231
|
-
|
|
232
|
-
**1 Resource:**
|
|
233
|
-
|
|
234
|
-
| Resource | Description |
|
|
235
|
-
|----------|-------------|
|
|
236
|
-
| `opentology://schema` | Auto-loaded ontology overview (classes, properties, instances) |
|
|
237
|
-
|
|
238
|
-
### RDFS Reasoning
|
|
239
|
-
|
|
240
|
-
OpenTology automatically materializes RDFS inferences when you push data. If your ontology defines a class hierarchy, queries against a parent class return instances of all subclasses.
|
|
241
|
-
|
|
242
|
-
```mermaid
|
|
243
|
-
graph TD
|
|
244
|
-
Kim["ex:Kim"] -->|a| Doctor["ex:Doctor"]
|
|
245
|
-
Doctor -->|rdfs:subClassOf| MedProf["ex:MedicalProfessional"]
|
|
246
|
-
MedProf -->|rdfs:subClassOf| Person["ex:Person"]
|
|
247
|
-
Kim -.->|inferred: a| MedProf
|
|
248
|
-
Kim -.->|inferred: a| Person
|
|
249
|
-
|
|
250
|
-
style Kim fill:#4CAF50,color:white
|
|
251
|
-
style Doctor fill:#2196F3,color:white
|
|
252
|
-
style MedProf fill:#2196F3,color:white
|
|
253
|
-
style Person fill:#2196F3,color:white
|
|
254
|
-
```
|
|
138
|
+
#### 4. Work normally
|
|
255
139
|
|
|
256
|
-
|
|
140
|
+
The AI now automatically:
|
|
141
|
+
- Checks `context_impact` before editing files
|
|
142
|
+
- Searches decisions/issues/knowledge when relevant
|
|
143
|
+
- Records session summaries at the end
|
|
257
144
|
|
|
258
|
-
|
|
259
|
-
- **rdfs:subPropertyOf** -- triples with subproperty imply triples with superproperty
|
|
260
|
-
- **rdfs:domain** -- using a property implies the subject is of the domain class
|
|
261
|
-
- **rdfs:range** -- using a property implies the object is of the range class
|
|
145
|
+
### Codebase Scanning
|
|
262
146
|
|
|
263
|
-
|
|
147
|
+
| Depth | What it extracts | Use case |
|
|
148
|
+
|-------|-----------------|----------|
|
|
149
|
+
| `module` (default) | File-level import graph | Impact analysis, dependency tracking |
|
|
150
|
+
| `symbol` | Classes, interfaces, functions, methods, call graphs | Deep code understanding |
|
|
264
151
|
|
|
265
|
-
|
|
152
|
+
**Supported languages for symbol-level scan:**
|
|
266
153
|
|
|
267
|
-
|
|
154
|
+
| Language | Engine |
|
|
155
|
+
|----------|--------|
|
|
156
|
+
| TypeScript/JavaScript | ts-morph |
|
|
157
|
+
| Python | Tree-sitter |
|
|
158
|
+
| Go | Tree-sitter |
|
|
159
|
+
| Rust | Tree-sitter |
|
|
160
|
+
| Java | Tree-sitter |
|
|
161
|
+
| Swift | Tree-sitter |
|
|
268
162
|
|
|
269
|
-
|
|
270
|
-
# shapes/person-shape.ttl
|
|
271
|
-
@prefix sh: <http://www.w3.org/ns/shacl#> .
|
|
272
|
-
@prefix ex: <http://example.org/> .
|
|
163
|
+
Optional dependencies for symbol scan:
|
|
273
164
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
sh:path ex:name ;
|
|
278
|
-
sh:minCount 1 ;
|
|
279
|
-
sh:datatype xsd:string ;
|
|
280
|
-
] .
|
|
165
|
+
```bash
|
|
166
|
+
npm install ts-morph # TypeScript/JavaScript
|
|
167
|
+
npm install web-tree-sitter tree-sitter-wasms # Python, Go, Rust, Java, Swift
|
|
281
168
|
```
|
|
282
169
|
|
|
283
|
-
|
|
284
|
-
# Validate explicitly
|
|
285
|
-
opentology validate --shacl data.ttl
|
|
170
|
+
### RDF Infrastructure
|
|
286
171
|
|
|
287
|
-
|
|
288
|
-
opentology push data.ttl
|
|
172
|
+
Under the hood, OpenTology is a full RDF/SPARQL toolkit:
|
|
289
173
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
174
|
+
- **RDFS reasoning** — push data, get automatic inference (subClassOf, domain, range)
|
|
175
|
+
- **SHACL validation** — shape constraints checked on every push
|
|
176
|
+
- **Two storage modes** — embedded (WASM, zero Docker) or HTTP (Oxigraph server)
|
|
177
|
+
- **Interactive visualization** — web UI for exploring the graph (`opentology context graph`)
|
|
178
|
+
- **Named graph scoping** — queries auto-scope to your project
|
|
293
179
|
|
|
294
|
-
|
|
180
|
+
```bash
|
|
181
|
+
# Push RDF data with auto-inference
|
|
182
|
+
opentology push ontology.ttl
|
|
295
183
|
|
|
296
|
-
|
|
184
|
+
# Query with auto-prefixed SPARQL
|
|
185
|
+
opentology query 'SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10'
|
|
297
186
|
|
|
298
|
-
|
|
187
|
+
# Visualize schema
|
|
188
|
+
opentology viz schema
|
|
299
189
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
| Python | Tree-sitter | class, ABC/Protocol, function, method calls |
|
|
304
|
-
| Go | Tree-sitter | struct, interface, func, method calls |
|
|
305
|
-
| Rust | Tree-sitter | struct, trait, impl, fn, method calls |
|
|
306
|
-
| Java | Tree-sitter | class, interface, method, method calls |
|
|
307
|
-
| Swift | Tree-sitter | class, struct, protocol, func, method calls |
|
|
190
|
+
# Health check
|
|
191
|
+
opentology doctor
|
|
192
|
+
```
|
|
308
193
|
|
|
309
|
-
|
|
194
|
+
### CLI Commands
|
|
310
195
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
196
|
+
| Command | Description |
|
|
197
|
+
|---------|-------------|
|
|
198
|
+
| `context init` | Initialize project context (graphs + hooks + CLAUDE.md) |
|
|
199
|
+
| `context scan` | Scan codebase into knowledge graph |
|
|
200
|
+
| `context load` | Load recent sessions, open issues, decisions |
|
|
201
|
+
| `context impact` | Analyze blast radius of a file change |
|
|
202
|
+
| `context sync` | Auto-recover sessions from git, rescan modules |
|
|
203
|
+
| `context graph` | Start interactive visualization web UI |
|
|
204
|
+
| `init` | Initialize RDF project |
|
|
205
|
+
| `push` | Push triples with SHACL validation + RDFS inference |
|
|
206
|
+
| `query` | Execute SPARQL queries |
|
|
207
|
+
| `validate` | Validate Turtle syntax and SHACL shapes |
|
|
208
|
+
| `pull` | Export graph as Turtle |
|
|
209
|
+
| `diff` | Compare local file vs graph |
|
|
210
|
+
| `delete` | Delete triples by file or pattern |
|
|
211
|
+
| `drop` | Drop entire graph |
|
|
212
|
+
| `infer` | Run/clear RDFS materialization |
|
|
213
|
+
| `graph` | Manage named graphs |
|
|
214
|
+
| `status` | Show triple counts |
|
|
215
|
+
| `doctor` | Diagnose project health |
|
|
216
|
+
| `mcp` | Start MCP server |
|
|
217
|
+
|
|
218
|
+
### MCP Tools (23)
|
|
314
219
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
220
|
+
| Tool | Description |
|
|
221
|
+
|------|-------------|
|
|
222
|
+
| `context_init` | Initialize project context graph |
|
|
223
|
+
| `context_load` | Load project context (sessions, issues, decisions) |
|
|
224
|
+
| `context_scan` | Scan codebase (module or symbol-level) |
|
|
225
|
+
| `context_impact` | Analyze file modification impact |
|
|
226
|
+
| `context_sync` | Auto-sync from git history |
|
|
227
|
+
| `context_status` | Check context initialization status |
|
|
228
|
+
| `context_graph` | Start interactive graph visualization |
|
|
229
|
+
| `init` | Initialize RDF project |
|
|
230
|
+
| `push` | Validate and push triples |
|
|
231
|
+
| `query` | Execute SPARQL queries |
|
|
232
|
+
| `validate` | Validate Turtle content |
|
|
233
|
+
| `pull` | Export graph as Turtle |
|
|
234
|
+
| `drop` | Drop project graph |
|
|
235
|
+
| `delete` | Delete triples |
|
|
236
|
+
| `diff` | Compare local vs graph |
|
|
237
|
+
| `schema` | Introspect ontology schema |
|
|
238
|
+
| `infer` | Run RDFS inference |
|
|
239
|
+
| `graph_list` | List named graphs |
|
|
240
|
+
| `graph_create` | Create named graph |
|
|
241
|
+
| `graph_drop` | Drop named graph |
|
|
242
|
+
| `visualize` | Generate schema diagram (Mermaid/DOT) |
|
|
243
|
+
| `status` | Get project status |
|
|
244
|
+
| `doctor` | Check project health |
|
|
318
245
|
|
|
319
|
-
|
|
246
|
+
### System Requirements
|
|
320
247
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
"depth": "symbol",
|
|
324
|
-
"includeMethodCalls": true,
|
|
325
|
-
"languages": ["typescript", "python"]
|
|
326
|
-
}
|
|
327
|
-
```
|
|
248
|
+
- **Node.js** >= 20.0.0
|
|
249
|
+
- **oxigraph** uses WebAssembly — runs everywhere Node.js runs, no native build tools needed
|
|
328
250
|
|
|
329
251
|
### Tech Stack
|
|
330
252
|
|
|
331
|
-
- TypeScript,
|
|
332
|
-
- Oxigraph WASM (embedded mode) / Oxigraph server (HTTP mode)
|
|
253
|
+
- TypeScript, Oxigraph WASM, N3.js, commander.js
|
|
333
254
|
- @modelcontextprotocol/sdk for MCP server
|
|
334
255
|
- shacl-engine for SHACL validation
|
|
335
|
-
- picocolors for terminal output
|
|
336
256
|
- ts-morph (optional) for TypeScript symbol analysis
|
|
337
|
-
- web-tree-sitter + tree-sitter-wasms (optional) for multi-language
|
|
257
|
+
- web-tree-sitter + tree-sitter-wasms (optional) for multi-language analysis
|
|
338
258
|
|
|
339
259
|
### Roadmap
|
|
340
260
|
|
|
341
|
-
- [x] CLI
|
|
342
|
-
- [x] MCP server
|
|
343
|
-
- [x]
|
|
344
|
-
- [x]
|
|
345
|
-
- [x]
|
|
346
|
-
- [x]
|
|
347
|
-
- [x]
|
|
348
|
-
- [x]
|
|
349
|
-
- [x]
|
|
350
|
-
- [x]
|
|
351
|
-
- [x]
|
|
261
|
+
- [x] Full RDF lifecycle CLI (18 commands)
|
|
262
|
+
- [x] MCP server (23 tools + 1 resource)
|
|
263
|
+
- [x] RDFS reasoning with auto-materialization
|
|
264
|
+
- [x] SHACL validation
|
|
265
|
+
- [x] Embedded mode (zero Docker)
|
|
266
|
+
- [x] Project context graph (decisions, issues, sessions)
|
|
267
|
+
- [x] Codebase scanning (module + symbol level, 6 languages)
|
|
268
|
+
- [x] Impact analysis with dependency tracking
|
|
269
|
+
- [x] Auto-sync from git history
|
|
270
|
+
- [x] AI behavioral instructions via CLAUDE.md injection
|
|
271
|
+
- [x] Interactive graph visualization web UI
|
|
352
272
|
- [ ] OWL reasoning (owl:sameAs, owl:inverseOf)
|
|
353
273
|
- [ ] Remote ontology import
|
|
354
|
-
- [ ]
|
|
355
|
-
- [x] Interactive graph visualization web UI
|
|
274
|
+
- [ ] Ontology snapshot versioning
|
|
356
275
|
|
|
357
276
|
### Contributing
|
|
358
277
|
|
|
@@ -369,351 +288,270 @@ MIT
|
|
|
369
288
|
|
|
370
289
|
## 한국어
|
|
371
290
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
```mermaid
|
|
375
|
-
graph TB
|
|
376
|
-
subgraph CLI["opentology CLI"]
|
|
377
|
-
Init[init]
|
|
378
|
-
Push[push]
|
|
379
|
-
Query[query]
|
|
380
|
-
Validate[validate]
|
|
381
|
-
Infer[infer]
|
|
382
|
-
More[...]
|
|
383
|
-
end
|
|
384
|
-
|
|
385
|
-
subgraph MCP["MCP Server"]
|
|
386
|
-
Tools[23 Tools]
|
|
387
|
-
Resource["opentology://schema"]
|
|
388
|
-
end
|
|
389
|
-
|
|
390
|
-
subgraph Adapter["StoreAdapter"]
|
|
391
|
-
HTTP["HTTP Mode\nOxigraph Server"]
|
|
392
|
-
Embedded["Embedded Mode\nWASM In-Process"]
|
|
393
|
-
end
|
|
394
|
-
|
|
395
|
-
subgraph Pipeline["Processing Pipeline"]
|
|
396
|
-
SHACL["SHACL Validation"]
|
|
397
|
-
RDFS["RDFS Reasoning"]
|
|
398
|
-
end
|
|
399
|
-
|
|
400
|
-
CLI --> Adapter
|
|
401
|
-
MCP --> Adapter
|
|
402
|
-
CLI --> Pipeline
|
|
403
|
-
Pipeline --> Adapter
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
온톨로지 도구들은 개발자 경험이 열악합니다. OpenTology는 터미널에서 RDF의 전체 생애주기를 관리합니다. 프로젝트 초기화, Turtle 작성, SHACL 검증, RDFS 추론이 포함된 푸시, SPARQL 쿼리, 인터랙티브 그래프 시각화까지 CLI 하나로 처리합니다. MCP 서버를 내장하고 있어 AI 어시스턴트가 지식 그래프를 직접 다룰 수 있고, Docker 없이 임베디드 모드로 바로 시작할 수 있습니다.
|
|
407
|
-
|
|
408
|
-
### 시스템 요구사항
|
|
291
|
+
대부분의 MCP 서버는 AI에게 도구를 줍니다. OpenTology는 AI에게 **이해**를 줍니다.
|
|
409
292
|
|
|
410
|
-
|
|
411
|
-
- **oxigraph**는 WebAssembly(WASM)를 사용하므로 플랫폼 독립적입니다. Node.js가 실행되는 모든 환경에서 동작하며, C++ 컴파일러, Python, 또는 네이티브 빌드 도구가 필요하지 않습니다.
|
|
293
|
+
OpenTology를 Claude Code(또는 MCP 호환 클라이언트)에 연결하면, 단순히 SPARQL 쿼리를 노출하는 것이 아니라 프로젝트의 영속적인 지식 그래프를 구축합니다: 모듈 의존성, 아키텍처 의사결정, 해결된 버그, 세션 이력, 코드 수준의 심볼까지. 그리고 AI가 **자동으로** 편집 전에 영향도를 확인하고, 의사결정 전에 과거 기록을 검색하고, 배운 것을 기록하도록 **지침을 주입**합니다.
|
|
412
294
|
|
|
413
|
-
|
|
295
|
+
결과: 세션을 넘어 기억하고, 코드베이스 구조를 이해하며, 행동 전에 생각하는 AI 어시스턴트.
|
|
414
296
|
|
|
415
|
-
|
|
416
|
-
# Docker 없이 바로 시작 (임베디드 모드)
|
|
417
|
-
opentology init --embedded my-project
|
|
418
|
-
|
|
419
|
-
# 클래스 계층 구조가 포함된 온톨로지 작성
|
|
420
|
-
cat > ontology.ttl << 'EOF'
|
|
421
|
-
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
422
|
-
@prefix ex: <http://example.org/> .
|
|
423
|
-
ex:Person a rdfs:Class .
|
|
424
|
-
ex:Doctor rdfs:subClassOf ex:Person .
|
|
425
|
-
ex:Kim a ex:Doctor ; ex:name "Dr. Kim" .
|
|
426
|
-
ex:Lee a ex:Person ; ex:name "Lee" .
|
|
427
|
-
EOF
|
|
428
|
-
|
|
429
|
-
# RDFS 추론 포함 자동 푸시
|
|
430
|
-
opentology push ontology.ttl
|
|
431
|
-
# -> Pushed 6 triples
|
|
432
|
-
# -> Inferred 1 additional triples
|
|
297
|
+
### 작동 방식
|
|
433
298
|
|
|
434
|
-
# Doctor를 Person으로 자동 추론하여 결과에 포함
|
|
435
|
-
opentology query 'SELECT ?name WHERE { ?p a ex:Person . ?p ex:name ?name }'
|
|
436
|
-
# -> Kim, Lee (Kim은 Doctor이지만 Person으로 추론됨)
|
|
437
299
|
```
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
graph LR
|
|
443
|
-
A["Write .ttl"] --> B["validate"]
|
|
444
|
-
B --> C{"SHACL shapes?"}
|
|
445
|
-
C -->|Yes| D["SHACL Check"]
|
|
446
|
-
C -->|No| E["push"]
|
|
447
|
-
D -->|Pass| E
|
|
448
|
-
D -->|Fail| F["Error"]
|
|
449
|
-
E --> G["RDFS Inference"]
|
|
450
|
-
G --> H["query"]
|
|
300
|
+
npm install -g opentology # 1. 설치
|
|
301
|
+
opentology context init # 2. 초기화 (그래프 + 훅 + CLAUDE.md 지침 생성)
|
|
302
|
+
opentology context scan # 3. 코드베이스를 지식 그래프로 스캔
|
|
303
|
+
# 4. 끝 — AI가 자동으로 그래프를 활용
|
|
451
304
|
```
|
|
452
305
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
| | OpenTology | Oxigraph 직접 사용 | Neo4j |
|
|
456
|
-
|---|---|---|---|
|
|
457
|
-
| 설치 | `npm install -g opentology` | 바이너리/Docker 직접 구성 | 서버 설치 + 라이선스 |
|
|
458
|
-
| Docker 필수 | 아니오 (임베디드 모드) | 예 | 예 |
|
|
459
|
-
| RDFS 추론 | 푸시 시 자동 | SPARQL CONSTRUCT 수동 작성 | 네이티브 미지원 |
|
|
460
|
-
| SHACL 검증 | 내장 | 별도 도구 필요 | 해당 없음 |
|
|
461
|
-
| AI 연동 | MCP 서버 23개 도구 | 없음 | 플러그인 생태계 |
|
|
462
|
-
| 쿼리 언어 | SPARQL (접두사 자동 삽입) | SPARQL (수동) | Cypher |
|
|
463
|
-
| 데이터 형식 | Turtle 파일 | Turtle/N-Triples | 속성 그래프 |
|
|
464
|
-
| 프로젝트 구분 | Named Graph 자동 | 수동 관리 | 데이터베이스 단위 |
|
|
465
|
-
|
|
466
|
-
### 주요 기능
|
|
467
|
-
|
|
468
|
-
**핵심**
|
|
469
|
-
|
|
470
|
-
- RDF 전체 생애주기를 다루는 18개 CLI 명령어
|
|
471
|
-
- `.opentology.json` 기반 프로젝트 설정
|
|
472
|
-
- Named Graph 자동 스코핑 -- 쿼리가 프로젝트 그래프에 자동 한정
|
|
473
|
-
- HTTP 모드(Oxigraph 서버)와 임베디드 모드(WASM, Docker 불필요) 지원
|
|
474
|
-
- 프로젝트 수준 접두사 레지스트리, SPARQL 쿼리에 자동 삽입
|
|
475
|
-
|
|
476
|
-
**추론**
|
|
477
|
-
|
|
478
|
-
- RDFS 추론: subClassOf, subPropertyOf, domain, range
|
|
479
|
-
- `Person`을 쿼리하면 `Doctor` 인스턴스도 자동 포함
|
|
480
|
-
- 푸시 시 자동 물질화, `infer` 명령어로 수동 제어
|
|
481
|
-
|
|
482
|
-
**검증**
|
|
483
|
-
|
|
484
|
-
- 푸시 전 Turtle 문법 자동 검증
|
|
485
|
-
- SHACL 형상 제약 조건 검증
|
|
486
|
-
- `shapes/` 디렉토리 규칙으로 형상 파일 관리
|
|
306
|
+
설정 후 매 세션은 이 사이클을 따릅니다:
|
|
487
307
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
308
|
+
```
|
|
309
|
+
┌─────────── 세션 시작 ───────────────┐
|
|
310
|
+
│ SessionStart 훅 │
|
|
311
|
+
│ → context_sync (놓친 세션 복구, │
|
|
312
|
+
│ 모듈 그래프 갱신) │
|
|
313
|
+
│ │
|
|
314
|
+
│ "src/lib/reasoner.ts 수정해줘" │
|
|
315
|
+
│ → context_impact (폭발 반경 확인) │
|
|
316
|
+
│ → "5개 의존 모듈, impact: high" │
|
|
317
|
+
│ → 유저 확인 후 수정 │
|
|
318
|
+
│ │
|
|
319
|
+
│ 버그 발생 │
|
|
320
|
+
│ → query (과거 이슈 검색) │
|
|
321
|
+
│ → 유사한 해결 이슈 발견 │
|
|
322
|
+
│ │
|
|
323
|
+
│ 아키텍처 의사결정 │
|
|
324
|
+
│ → push (Decision 기록) │
|
|
325
|
+
│ │
|
|
326
|
+
│ 세션 종료 │
|
|
327
|
+
│ → push (Session 요약 기록) │
|
|
328
|
+
└─────────────────────────────────────┘
|
|
329
|
+
```
|
|
493
330
|
|
|
494
|
-
|
|
331
|
+
### 무엇이 다른가
|
|
495
332
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
333
|
+
| | 일반 MCP | OpenTology |
|
|
334
|
+
|---|---|---|
|
|
335
|
+
| 제공하는 것 | 도구만 | 도구 + 행동 지침 + 자동 동기화 훅 |
|
|
336
|
+
| AI 행동 | 유저가 정확히 프롬프트해야 함 | AI가 자발적으로 영향도 확인, 컨텍스트 검색 |
|
|
337
|
+
| 메모리 | 매 세션 리셋 | 세션을 넘어 영속하는 지식 그래프 |
|
|
338
|
+
| 코드베이스 인식 | 없음 | 모듈 의존성, 심볼, 호출 그래프 |
|
|
339
|
+
| 설정 | 프로젝트마다 수동 설정 | 명령어 하나 (`context init`) |
|
|
499
340
|
|
|
500
|
-
|
|
341
|
+
OpenTology는 기능만 추가하는 것이 아니라, **AI가 프로젝트에서 일하는 방식 자체를 바꿉니다**.
|
|
501
342
|
|
|
502
|
-
|
|
503
|
-
|---|---|---|
|
|
504
|
-
| 백엔드 | Oxigraph 서버 (Docker 또는 바이너리) | 인프로세스 WASM 스토어 |
|
|
505
|
-
| Docker | 필요 | 불필요 |
|
|
506
|
-
| 초기화 | `opentology init my-project` | `opentology init --embedded my-project` |
|
|
507
|
-
| 원본 데이터 | Oxigraph 서버 | 로컬 `.ttl` 파일 |
|
|
508
|
-
| 적합한 용도 | 프로덕션, 공유 환경 | 로컬 개발, 빠른 실험 |
|
|
509
|
-
| 성능 | 서버급 | 단일 사용자 |
|
|
343
|
+
### 지식 그래프 구조
|
|
510
344
|
|
|
511
|
-
|
|
345
|
+
모든 데이터는 `otx:` 온톨로지를 사용하는 RDF named graph에 저장됩니다:
|
|
512
346
|
|
|
513
|
-
```
|
|
514
|
-
|
|
347
|
+
```
|
|
348
|
+
context graph sessions graph
|
|
349
|
+
├── otx:Module (소스 파일) └── otx:Session (작업 로그)
|
|
350
|
+
│ └── otx:dependsOn ├── otx:body (수행한 작업)
|
|
351
|
+
├── otx:Class / otx:Interface └── otx:nextTodo (다음 할 일)
|
|
352
|
+
│ └── otx:Method / otx:Function
|
|
353
|
+
├── otx:Decision (아키텍처 의사결정)
|
|
354
|
+
├── otx:Issue (버그, 상태 추적)
|
|
355
|
+
└── otx:Knowledge (재사용 가능한 패턴)
|
|
515
356
|
```
|
|
516
357
|
|
|
517
|
-
|
|
358
|
+
SPARQL로 무엇이든 쿼리 가능:
|
|
518
359
|
|
|
519
|
-
|
|
360
|
+
```sparql
|
|
361
|
+
# 이 모듈에 의존하는 것은?
|
|
362
|
+
SELECT ?dep WHERE { ?dep otx:dependsOn <urn:module:src/lib/reasoner> }
|
|
520
363
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
364
|
+
# 인증 관련 의사결정은?
|
|
365
|
+
SELECT ?title ?reason WHERE {
|
|
366
|
+
?d a otx:Decision ; otx:title ?title ; otx:reason ?reason
|
|
367
|
+
FILTER(CONTAINS(LCASE(?title), "auth"))
|
|
368
|
+
}
|
|
525
369
|
|
|
526
|
-
|
|
370
|
+
# 지난 세션에서 뭘 했지?
|
|
371
|
+
SELECT ?title ?body ?next WHERE {
|
|
372
|
+
?s a otx:Session ; otx:title ?title ; otx:body ?body
|
|
373
|
+
OPTIONAL { ?s otx:nextTodo ?next }
|
|
374
|
+
} ORDER BY DESC(?date) LIMIT 1
|
|
375
|
+
```
|
|
527
376
|
|
|
528
|
-
###
|
|
377
|
+
### 빠른 시작
|
|
529
378
|
|
|
530
|
-
|
|
531
|
-
|--------|------|
|
|
532
|
-
| `opentology init [project-id]` | 프로젝트 초기화 (`--embedded`로 Docker 불필요 모드) |
|
|
533
|
-
| `opentology validate <file>` | Turtle 문법 검증 (`--shacl`로 SHACL 검증) |
|
|
534
|
-
| `opentology push <file>` | SHACL 자동 검증 + RDFS 추론 포함 푸시 (`--replace`, `--no-shacl`, `--no-infer`) |
|
|
535
|
-
| `opentology query <sparql>` | 접두사 자동 삽입 SPARQL 실행 (`--format table\|json\|csv`, `--raw`) |
|
|
536
|
-
| `opentology status` | asserted/inferred/total 트리플 수 표시 (임베디드 모드에서 파일 수 포함) |
|
|
537
|
-
| `opentology pull` | 프로젝트 그래프를 Turtle로 내보내기 |
|
|
538
|
-
| `opentology drop` | 프로젝트 그래프 전체 삭제 (`--force`로 확인 생략) |
|
|
539
|
-
| `opentology delete <file>` | 파일 또는 패턴(`--where`)으로 트리플 삭제 |
|
|
540
|
-
| `opentology diff <file>` | 로컬 Turtle 파일과 그래프 비교 |
|
|
541
|
-
| `opentology shapes` | SHACL 형상 목록 조회/상세 보기 |
|
|
542
|
-
| `opentology infer` | RDFS 물질화 실행 (`--clear`로 추론 트리플 제거) |
|
|
543
|
-
| `opentology graph` | Named Graph 목록/생성/삭제 |
|
|
544
|
-
| `opentology prefix` | 프로젝트 접두사 목록/추가/제거 |
|
|
545
|
-
| `opentology context` | 프로젝트 컨텍스트 관리 (`init`, `load`, `status`, `scan`, `impact`, `sync`, `graph`) |
|
|
546
|
-
| `opentology viz` | 온톨로지 스키마 시각화 (`schema`) |
|
|
547
|
-
| `opentology doctor` | 프로젝트 건강 진단 (설정, 스토어, 컨텍스트, 훅, 의존성) |
|
|
548
|
-
| `opentology mcp` | MCP 서버 시작 |
|
|
549
|
-
|
|
550
|
-
### MCP 연동
|
|
551
|
-
|
|
552
|
-
MCP 클라이언트 설정 파일(`.mcp.json`)에 추가:
|
|
379
|
+
#### 1. MCP 클라이언트에 추가
|
|
553
380
|
|
|
554
381
|
```json
|
|
555
382
|
{
|
|
556
383
|
"mcpServers": {
|
|
557
384
|
"opentology": {
|
|
558
385
|
"command": "npx",
|
|
559
|
-
"args": ["opentology", "mcp"]
|
|
386
|
+
"args": ["-y", "opentology", "mcp"]
|
|
560
387
|
}
|
|
561
388
|
}
|
|
562
389
|
}
|
|
563
390
|
```
|
|
564
391
|
|
|
565
|
-
|
|
392
|
+
#### 2. 프로젝트 컨텍스트 초기화
|
|
566
393
|
|
|
567
|
-
|
|
568
|
-
|------|------|
|
|
569
|
-
| `opentology_init` | 프로젝트 초기화 |
|
|
570
|
-
| `opentology_validate` | Turtle 내용 검증 |
|
|
571
|
-
| `opentology_push` | 트리플 검증 및 푸시 |
|
|
572
|
-
| `opentology_query` | SPARQL 쿼리 실행 |
|
|
573
|
-
| `opentology_status` | 프로젝트 상태 조회 |
|
|
574
|
-
| `opentology_pull` | 그래프를 Turtle로 내보내기 |
|
|
575
|
-
| `opentology_drop` | 프로젝트 그래프 삭제 |
|
|
576
|
-
| `opentology_delete` | 트리플 삭제 |
|
|
577
|
-
| `opentology_diff` | 로컬 파일과 그래프 비교 |
|
|
578
|
-
| `opentology_schema` | 온톨로지 스키마 조회 |
|
|
579
|
-
| `opentology_infer` | RDFS 추론 실행 |
|
|
580
|
-
| `opentology_graph_list` | Named Graph 목록 조회 |
|
|
581
|
-
| `opentology_graph_create` | Named Graph 생성 |
|
|
582
|
-
| `opentology_graph_drop` | Named Graph 삭제 |
|
|
583
|
-
| `opentology_visualize` | 스키마 시각화 생성 (Mermaid/DOT) |
|
|
584
|
-
| `opentology_context_init` | 프로젝트 컨텍스트 그래프 초기화 |
|
|
585
|
-
| `opentology_context_load` | 프로젝트 컨텍스트 로드 |
|
|
586
|
-
| `opentology_context_status` | 컨텍스트 초기화 상태 확인 |
|
|
587
|
-
| `opentology_context_scan` | 코드베이스 스캔 (모듈/심볼 수준) |
|
|
588
|
-
| `opentology_context_impact` | 파일 수정 영향 분석 (의존 모듈, 관련 컨텍스트) |
|
|
589
|
-
| `opentology_context_sync` | 자동 동기화: git에서 누락 세션 복구, 모듈 그래프 재스캔 |
|
|
590
|
-
| `opentology_context_graph` | 인터랙티브 그래프 시각화 웹 UI 시작 |
|
|
591
|
-
| `opentology_doctor` | 프로젝트 건강 진단 (설정, 스토어, 훅, 의존성) |
|
|
592
|
-
|
|
593
|
-
**1개 리소스:**
|
|
594
|
-
|
|
595
|
-
| 리소스 | 설명 |
|
|
596
|
-
|--------|------|
|
|
597
|
-
| `opentology://schema` | 온톨로지 개요 자동 로드 (클래스, 속성, 인스턴스) |
|
|
394
|
+
AI 어시스턴트에게 `context_init` 실행을 요청하거나, CLI에서:
|
|
598
395
|
|
|
599
|
-
|
|
396
|
+
```bash
|
|
397
|
+
opentology context init
|
|
398
|
+
```
|
|
600
399
|
|
|
601
|
-
|
|
400
|
+
생성되는 것:
|
|
401
|
+
- `.opentology.json` — 프로젝트 설정
|
|
402
|
+
- context / sessions named graph
|
|
403
|
+
- SessionStart 훅 (자동 동기화)
|
|
404
|
+
- CLAUDE.md 지침 (영향도 확인, 그래프 쿼리, 세션 기록)
|
|
602
405
|
|
|
603
|
-
|
|
604
|
-
graph TD
|
|
605
|
-
Kim["ex:Kim"] -->|a| Doctor["ex:Doctor"]
|
|
606
|
-
Doctor -->|rdfs:subClassOf| MedProf["ex:MedicalProfessional"]
|
|
607
|
-
MedProf -->|rdfs:subClassOf| Person["ex:Person"]
|
|
608
|
-
Kim -.->|inferred: a| MedProf
|
|
609
|
-
Kim -.->|inferred: a| Person
|
|
406
|
+
#### 3. 코드베이스 스캔
|
|
610
407
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
style MedProf fill:#2196F3,color:white
|
|
614
|
-
style Person fill:#2196F3,color:white
|
|
408
|
+
```bash
|
|
409
|
+
opentology context scan
|
|
615
410
|
```
|
|
616
411
|
|
|
617
|
-
|
|
412
|
+
모듈 의존성 그래프를 구축합니다. 심볼 수준 분석:
|
|
618
413
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
- **rdfs:range** -- 속성 사용 시 목적어가 범위 클래스의 인스턴스임을 함의
|
|
414
|
+
```json
|
|
415
|
+
{ "depth": "symbol", "includeMethodCalls": true }
|
|
416
|
+
```
|
|
623
417
|
|
|
624
|
-
|
|
418
|
+
#### 4. 평소처럼 작업
|
|
625
419
|
|
|
626
|
-
|
|
420
|
+
AI가 자동으로:
|
|
421
|
+
- 파일 수정 전 `context_impact`로 영향도 확인
|
|
422
|
+
- 관련 의사결정/이슈/지식 검색
|
|
423
|
+
- 세션 종료 시 작업 요약 기록
|
|
627
424
|
|
|
628
|
-
|
|
425
|
+
### 코드베이스 스캔
|
|
629
426
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
427
|
+
| 깊이 | 추출 내용 | 용도 |
|
|
428
|
+
|------|----------|------|
|
|
429
|
+
| `module` (기본) | 파일 수준 import 그래프 | 영향도 분석, 의존성 추적 |
|
|
430
|
+
| `symbol` | 클래스, 인터페이스, 함수, 메서드, 호출 그래프 | 심층 코드 이해 |
|
|
634
431
|
|
|
635
|
-
|
|
636
|
-
sh:targetClass ex:Person ;
|
|
637
|
-
sh:property [
|
|
638
|
-
sh:path ex:name ;
|
|
639
|
-
sh:minCount 1 ;
|
|
640
|
-
sh:datatype xsd:string ;
|
|
641
|
-
] .
|
|
642
|
-
```
|
|
432
|
+
**심볼 스캔 지원 언어:**
|
|
643
433
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
434
|
+
| 언어 | 엔진 |
|
|
435
|
+
|------|------|
|
|
436
|
+
| TypeScript/JavaScript | ts-morph |
|
|
437
|
+
| Python | Tree-sitter |
|
|
438
|
+
| Go | Tree-sitter |
|
|
439
|
+
| Rust | Tree-sitter |
|
|
440
|
+
| Java | Tree-sitter |
|
|
441
|
+
| Swift | Tree-sitter |
|
|
647
442
|
|
|
648
|
-
|
|
649
|
-
opentology push data.ttl
|
|
443
|
+
심볼 스캔 선택적 의존성:
|
|
650
444
|
|
|
651
|
-
|
|
652
|
-
|
|
445
|
+
```bash
|
|
446
|
+
npm install ts-morph # TypeScript/JavaScript
|
|
447
|
+
npm install web-tree-sitter tree-sitter-wasms # Python, Go, Rust, Java, Swift
|
|
653
448
|
```
|
|
654
449
|
|
|
655
|
-
###
|
|
450
|
+
### RDF 인프라
|
|
656
451
|
|
|
657
|
-
|
|
452
|
+
내부적으로 OpenTology는 완전한 RDF/SPARQL 툴킷입니다:
|
|
658
453
|
|
|
659
|
-
|
|
454
|
+
- **RDFS 추론** — 데이터 푸시 시 자동 추론 (subClassOf, domain, range)
|
|
455
|
+
- **SHACL 검증** — 푸시마다 형상 제약 자동 검증
|
|
456
|
+
- **두 가지 스토리지 모드** — 임베디드 (WASM, Docker 불필요) 또는 HTTP (Oxigraph 서버)
|
|
457
|
+
- **인터랙티브 시각화** — 그래프 탐색 웹 UI (`opentology context graph`)
|
|
458
|
+
- **Named graph 스코핑** — 쿼리가 프로젝트에 자동 한정
|
|
660
459
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
| Python | Tree-sitter | class, ABC/Protocol, function, method calls |
|
|
665
|
-
| Go | Tree-sitter | struct, interface, func, method calls |
|
|
666
|
-
| Rust | Tree-sitter | struct, trait, impl, fn, method calls |
|
|
667
|
-
| Java | Tree-sitter | class, interface, method, method calls |
|
|
668
|
-
| Swift | Tree-sitter | class, struct, protocol, func, method calls |
|
|
460
|
+
```bash
|
|
461
|
+
# RDFS 추론 포함 데이터 푸시
|
|
462
|
+
opentology push ontology.ttl
|
|
669
463
|
|
|
670
|
-
|
|
464
|
+
# 접두사 자동 삽입 SPARQL 쿼리
|
|
465
|
+
opentology query 'SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10'
|
|
671
466
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
npm install ts-morph
|
|
467
|
+
# 스키마 시각화
|
|
468
|
+
opentology viz schema
|
|
675
469
|
|
|
676
|
-
#
|
|
677
|
-
|
|
470
|
+
# 건강 진단
|
|
471
|
+
opentology doctor
|
|
678
472
|
```
|
|
679
473
|
|
|
680
|
-
|
|
474
|
+
### CLI 명령어
|
|
681
475
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
476
|
+
| 명령어 | 설명 |
|
|
477
|
+
|--------|------|
|
|
478
|
+
| `context init` | 프로젝트 컨텍스트 초기화 (그래프 + 훅 + CLAUDE.md) |
|
|
479
|
+
| `context scan` | 코드베이스를 지식 그래프로 스캔 |
|
|
480
|
+
| `context load` | 최근 세션, 미해결 이슈, 의사결정 로드 |
|
|
481
|
+
| `context impact` | 파일 변경의 폭발 반경 분석 |
|
|
482
|
+
| `context sync` | git 이력에서 세션 복구, 모듈 재스캔 |
|
|
483
|
+
| `context graph` | 인터랙티브 시각화 웹 UI 시작 |
|
|
484
|
+
| `init` | RDF 프로젝트 초기화 |
|
|
485
|
+
| `push` | SHACL 검증 + RDFS 추론 포함 트리플 푸시 |
|
|
486
|
+
| `query` | SPARQL 쿼리 실행 |
|
|
487
|
+
| `validate` | Turtle 문법 및 SHACL 검증 |
|
|
488
|
+
| `pull` | 그래프를 Turtle로 내보내기 |
|
|
489
|
+
| `diff` | 로컬 파일과 그래프 비교 |
|
|
490
|
+
| `delete` | 파일/패턴으로 트리플 삭제 |
|
|
491
|
+
| `drop` | 그래프 전체 삭제 |
|
|
492
|
+
| `infer` | RDFS 물질화 실행/정리 |
|
|
493
|
+
| `graph` | Named graph 관리 |
|
|
494
|
+
| `status` | 트리플 수 표시 |
|
|
495
|
+
| `doctor` | 프로젝트 건강 진단 |
|
|
496
|
+
| `mcp` | MCP 서버 시작 |
|
|
497
|
+
|
|
498
|
+
### MCP 도구 (23개)
|
|
499
|
+
|
|
500
|
+
| 도구 | 설명 |
|
|
501
|
+
|------|------|
|
|
502
|
+
| `context_init` | 프로젝트 컨텍스트 그래프 초기화 |
|
|
503
|
+
| `context_load` | 프로젝트 컨텍스트 로드 (세션, 이슈, 의사결정) |
|
|
504
|
+
| `context_scan` | 코드베이스 스캔 (모듈/심볼 수준) |
|
|
505
|
+
| `context_impact` | 파일 수정 영향도 분석 |
|
|
506
|
+
| `context_sync` | git 이력에서 자동 동기화 |
|
|
507
|
+
| `context_status` | 컨텍스트 초기화 상태 확인 |
|
|
508
|
+
| `context_graph` | 인터랙티브 그래프 시각화 시작 |
|
|
509
|
+
| `init` | RDF 프로젝트 초기화 |
|
|
510
|
+
| `push` | 트리플 검증 및 푸시 |
|
|
511
|
+
| `query` | SPARQL 쿼리 실행 |
|
|
512
|
+
| `validate` | Turtle 내용 검증 |
|
|
513
|
+
| `pull` | 그래프를 Turtle로 내보내기 |
|
|
514
|
+
| `drop` | 프로젝트 그래프 삭제 |
|
|
515
|
+
| `delete` | 트리플 삭제 |
|
|
516
|
+
| `diff` | 로컬 파일과 그래프 비교 |
|
|
517
|
+
| `schema` | 온톨로지 스키마 조회 |
|
|
518
|
+
| `infer` | RDFS 추론 실행 |
|
|
519
|
+
| `graph_list` | Named graph 목록 |
|
|
520
|
+
| `graph_create` | Named graph 생성 |
|
|
521
|
+
| `graph_drop` | Named graph 삭제 |
|
|
522
|
+
| `visualize` | 스키마 다이어그램 생성 (Mermaid/DOT) |
|
|
523
|
+
| `status` | 프로젝트 상태 조회 |
|
|
524
|
+
| `doctor` | 프로젝트 건강 진단 |
|
|
525
|
+
|
|
526
|
+
### 시스템 요구사항
|
|
527
|
+
|
|
528
|
+
- **Node.js** >= 20.0.0
|
|
529
|
+
- **oxigraph**는 WebAssembly를 사용하므로 Node.js가 실행되는 모든 환경에서 동작합니다
|
|
689
530
|
|
|
690
531
|
### 기술 스택
|
|
691
532
|
|
|
692
|
-
- TypeScript,
|
|
693
|
-
- Oxigraph WASM (임베디드 모드) / Oxigraph 서버 (HTTP 모드)
|
|
533
|
+
- TypeScript, Oxigraph WASM, N3.js, commander.js
|
|
694
534
|
- @modelcontextprotocol/sdk (MCP 서버)
|
|
695
535
|
- shacl-engine (SHACL 검증)
|
|
696
|
-
- picocolors (터미널 출력)
|
|
697
536
|
- ts-morph (선택) TypeScript 심볼 분석
|
|
698
|
-
- web-tree-sitter + tree-sitter-wasms (선택) 다중 언어
|
|
537
|
+
- web-tree-sitter + tree-sitter-wasms (선택) 다중 언어 분석
|
|
699
538
|
|
|
700
539
|
### 로드맵
|
|
701
540
|
|
|
702
|
-
- [x] 18개
|
|
703
|
-
- [x] 23개
|
|
704
|
-
- [x]
|
|
705
|
-
- [x]
|
|
706
|
-
- [x] SHACL 검증 (푸시 시 형상 제약 자동 검증)
|
|
707
|
-
- [x] DX 개선 (diff, 컬러 출력, 에러 메시지)
|
|
708
|
-
- [x] 멀티 그래프 지원
|
|
709
|
-
- [x] 접두사 관리
|
|
541
|
+
- [x] 전체 RDF 생애주기 CLI (18개 명령어)
|
|
542
|
+
- [x] MCP 서버 (23개 도구 + 1개 리소스)
|
|
543
|
+
- [x] RDFS 추론 (자동 물질화)
|
|
544
|
+
- [x] SHACL 검증
|
|
710
545
|
- [x] 임베디드 모드 (Docker 불필요)
|
|
711
|
-
- [x]
|
|
712
|
-
- [x]
|
|
546
|
+
- [x] 프로젝트 컨텍스트 그래프 (의사결정, 이슈, 세션)
|
|
547
|
+
- [x] 코드베이스 스캔 (모듈 + 심볼 수준, 6개 언어)
|
|
548
|
+
- [x] 의존성 추적 기반 영향도 분석
|
|
549
|
+
- [x] git 이력에서 자동 동기화
|
|
550
|
+
- [x] CLAUDE.md 주입을 통한 AI 행동 지침
|
|
551
|
+
- [x] 인터랙티브 그래프 시각화 웹 UI
|
|
713
552
|
- [ ] OWL 추론 (owl:sameAs, owl:inverseOf)
|
|
714
553
|
- [ ] 원격 온톨로지 임포트
|
|
715
554
|
- [ ] 온톨로지 스냅샷 버전 관리
|
|
716
|
-
- [x] 인터랙티브 그래프 시각화 웹 UI
|
|
717
555
|
|
|
718
556
|
### 기여 방법
|
|
719
557
|
|
|
@@ -67,6 +67,66 @@ SELECT ?title ?date WHERE {
|
|
|
67
67
|
} ORDER BY DESC(?date)
|
|
68
68
|
\`\`\`
|
|
69
69
|
|
|
70
|
+
### How to Use OpenTology Tools
|
|
71
|
+
|
|
72
|
+
OpenTology provides MCP tools to query and manage the project knowledge graph. Use them proactively.
|
|
73
|
+
|
|
74
|
+
#### Pre-Analysis Context Check
|
|
75
|
+
|
|
76
|
+
Before exploring code or analyzing architecture, query the knowledge graph for existing context:
|
|
77
|
+
- **Decisions**: past architectural choices that may inform the current analysis
|
|
78
|
+
- **Knowledge**: reusable patterns or lessons already recorded
|
|
79
|
+
- **Issues**: known problems related to the area under investigation
|
|
80
|
+
- **Sessions**: recent work in the same area
|
|
81
|
+
|
|
82
|
+
\`\`\`sparql
|
|
83
|
+
PREFIX otx: <https://opentology.dev/vocab#>
|
|
84
|
+
SELECT ?type ?title ?body WHERE {
|
|
85
|
+
GRAPH <${contextUri}> {
|
|
86
|
+
{ ?s a otx:Decision ; otx:title ?title ; otx:body ?body . BIND("decision" AS ?type) }
|
|
87
|
+
UNION
|
|
88
|
+
{ ?s a otx:Knowledge ; otx:title ?title ; otx:body ?body . BIND("knowledge" AS ?type) }
|
|
89
|
+
UNION
|
|
90
|
+
{ ?s a otx:Issue ; otx:title ?title ; otx:body ?body . BIND("issue" AS ?type) }
|
|
91
|
+
}
|
|
92
|
+
FILTER(CONTAINS(LCASE(?title), "keyword") || CONTAINS(LCASE(?body), "keyword"))
|
|
93
|
+
} LIMIT 10
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
This prevents redundant analysis and ensures past decisions and knowledge inform current work.
|
|
97
|
+
|
|
98
|
+
#### Pre-Edit Impact Check
|
|
99
|
+
|
|
100
|
+
Before modifying a file, run \`context_impact\` with the target file path to understand the blast radius:
|
|
101
|
+
- **dependents** — modules that import or depend on this file
|
|
102
|
+
- **dependencies** — modules this file imports
|
|
103
|
+
- **related** — decisions, issues, knowledge linked to this file
|
|
104
|
+
- **impact level** — high / medium / low
|
|
105
|
+
|
|
106
|
+
If impact is **high**, inform the user of affected modules and get confirmation before proceeding.
|
|
107
|
+
|
|
108
|
+
#### Searching the Knowledge Graph
|
|
109
|
+
|
|
110
|
+
Use \`query\` with SPARQL to find anything in the project graph:
|
|
111
|
+
- **Decisions**: \`?s a otx:Decision\` — why architectural choices were made
|
|
112
|
+
- **Issues**: \`?s a otx:Issue ; otx:status "open"\` — known bugs and their status
|
|
113
|
+
- **Knowledge**: \`?s a otx:Knowledge\` — reusable patterns and lessons learned
|
|
114
|
+
- **Sessions**: query the sessions graph for past work logs and next TODOs
|
|
115
|
+
- **Modules**: \`?s a otx:Module\` — all scanned source modules and their dependencies (\`otx:dependsOn\`)
|
|
116
|
+
- **Symbols**: \`?s a otx:Class\`, \`otx:Interface\`, \`otx:Function\`, \`otx:Method\` — code-level entities (available after symbol-depth scan)
|
|
117
|
+
|
|
118
|
+
#### Other Useful Tools
|
|
119
|
+
|
|
120
|
+
| Tool | When to Use |
|
|
121
|
+
|------|-------------|
|
|
122
|
+
| \`context_load\` | Session start — loads recent sessions, open issues, recent decisions |
|
|
123
|
+
| \`context_scan\` | After significant code changes — rescans module/symbol dependencies |
|
|
124
|
+
| \`context_impact\` | Before editing — checks blast radius of a file change |
|
|
125
|
+
| \`schema\` | Explore ontology classes and properties, or inspect a specific class |
|
|
126
|
+
| \`query\` | Run any SPARQL query against the project graph |
|
|
127
|
+
| \`push\` | Record decisions, issues, knowledge, or session summaries |
|
|
128
|
+
| \`doctor\` | Diagnose project health (config, store, hooks, CLAUDE.md) |
|
|
129
|
+
|
|
70
130
|
### Session End Reminder
|
|
71
131
|
|
|
72
132
|
At the end of each session, push a summary:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opentology",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.6",
|
|
4
|
+
"description": "Ontology-powered project memory for AI coding assistants — your codebase as a knowledge graph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"opentology": "./dist/index.js"
|
|
@@ -17,14 +17,16 @@
|
|
|
17
17
|
"prepublishOnly": "npm run build && npm test"
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"knowledge-graph",
|
|
22
|
+
"ontology",
|
|
20
23
|
"rdf",
|
|
21
24
|
"sparql",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"semantic-web"
|
|
25
|
+
"ai-coding",
|
|
26
|
+
"project-memory",
|
|
27
|
+
"codebase-context",
|
|
28
|
+
"claude-code",
|
|
29
|
+
"shacl"
|
|
28
30
|
],
|
|
29
31
|
"author": "Younkyum Jin",
|
|
30
32
|
"license": "MIT",
|