opentology 0.3.8 → 0.4.0
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 +12 -10
- package/dist/index.js +0 -0
- package/dist/templates/claude-md-context.js +63 -6
- package/dist/templates/otx-ontology.d.ts +1 -1
- package/dist/templates/otx-ontology.js +31 -0
- package/dist/templates/slash-commands.js +79 -8
- package/dist/templates/stop-session-hook.js +15 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -117,11 +117,11 @@ Everything lives in RDF named graphs with the `otx:` ontology:
|
|
|
117
117
|
```
|
|
118
118
|
context graph sessions graph
|
|
119
119
|
├── otx:Module (source files) └── otx:Session (work logs)
|
|
120
|
-
│ └── otx:dependsOn ├── otx:
|
|
121
|
-
├── otx:Class / otx:Interface
|
|
122
|
-
│ └── otx:Method / otx:Function
|
|
123
|
-
├── otx:Decision (architecture choices)
|
|
124
|
-
├── otx:Issue (bugs, status tracking)
|
|
120
|
+
│ └── otx:dependsOn ├── otx:hasActivity → otx:Activity
|
|
121
|
+
├── otx:Class / otx:Interface ├── otx:Todo (open → done)
|
|
122
|
+
│ └── otx:Method / otx:Function ├── otx:Insight (patterns learned)
|
|
123
|
+
├── otx:Decision (architecture choices) ├── otx:Domain (work area tags)
|
|
124
|
+
├── otx:Issue (bugs, status tracking) └── otx:followsUp (session chaining)
|
|
125
125
|
└── otx:Knowledge (reusable patterns)
|
|
126
126
|
```
|
|
127
127
|
|
|
@@ -319,6 +319,7 @@ opentology doctor
|
|
|
319
319
|
- [x] Auto-sync from git history
|
|
320
320
|
- [x] AI behavioral instructions via CLAUDE.md injection
|
|
321
321
|
- [x] Interactive graph visualization web UI
|
|
322
|
+
- [x] Structured session schema (Activity, Todo, Insight, Domain) with proactive save
|
|
322
323
|
- [ ] OWL reasoning (owl:sameAs, owl:inverseOf)
|
|
323
324
|
- [ ] Remote ontology import
|
|
324
325
|
- [ ] Ontology snapshot versioning
|
|
@@ -445,11 +446,11 @@ SELECT ?from ?to WHERE {
|
|
|
445
446
|
```
|
|
446
447
|
context graph sessions graph
|
|
447
448
|
├── otx:Module (소스 파일) └── otx:Session (작업 로그)
|
|
448
|
-
│ └── otx:dependsOn ├── otx:
|
|
449
|
-
├── otx:Class / otx:Interface
|
|
450
|
-
│ └── otx:Method / otx:Function
|
|
451
|
-
├── otx:Decision (아키텍처 의사결정)
|
|
452
|
-
├── otx:Issue (버그, 상태 추적)
|
|
449
|
+
│ └── otx:dependsOn ├── otx:hasActivity → otx:Activity
|
|
450
|
+
├── otx:Class / otx:Interface ├── otx:Todo (open → done)
|
|
451
|
+
│ └── otx:Method / otx:Function ├── otx:Insight (학습된 패턴)
|
|
452
|
+
├── otx:Decision (아키텍처 의사결정) ├── otx:Domain (작업 영역 태그)
|
|
453
|
+
├── otx:Issue (버그, 상태 추적) └── otx:followsUp (세션 체이닝)
|
|
453
454
|
└── otx:Knowledge (재사용 가능한 패턴)
|
|
454
455
|
```
|
|
455
456
|
|
|
@@ -647,6 +648,7 @@ opentology doctor
|
|
|
647
648
|
- [x] git 이력에서 자동 동기화
|
|
648
649
|
- [x] CLAUDE.md 주입을 통한 AI 행동 지침
|
|
649
650
|
- [x] 인터랙티브 그래프 시각화 웹 UI
|
|
651
|
+
- [x] 구조화된 세션 스키마 (Activity, Todo, Insight, Domain) + 프로액티브 저장
|
|
650
652
|
- [ ] OWL 추론 (owl:sameAs, owl:inverseOf)
|
|
651
653
|
- [ ] 원격 온톨로지 임포트
|
|
652
654
|
- [ ] 온톨로지 스냅샷 버전 관리
|
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -29,13 +29,17 @@ export function generateContextSection(projectId, graphUri) {
|
|
|
29
29
|
| \`otx:Issue\` | Bugs and issues |
|
|
30
30
|
| \`otx:Knowledge\` | Reusable knowledge |
|
|
31
31
|
| \`otx:Session\` | Session logs |
|
|
32
|
+
| \`otx:Activity\` | Individual task within a session |
|
|
33
|
+
| \`otx:Todo\` | Trackable action item (open → in-progress → done \\| dropped) |
|
|
34
|
+
| \`otx:Insight\` | Inductively derived knowledge from session patterns |
|
|
35
|
+
| \`otx:Domain\` | Work area tag for sessions and activities |
|
|
32
36
|
| \`otx:Pattern\` | Recurring patterns/conventions |
|
|
33
37
|
| \`otx:Source\` | External knowledge source (article, paper, code, etc.) |
|
|
34
38
|
| \`otx:Module\` | Source file module |
|
|
35
39
|
| \`otx:Class\` / \`otx:Interface\` / \`otx:Function\` / \`otx:Method\` | Symbol-level entities (from deep scan) |
|
|
36
40
|
| \`otx:MethodCall\` | Call relationship between symbols |
|
|
37
41
|
|
|
38
|
-
Key properties: \`otx:title\`, \`otx:date\`, \`otx:body\`, \`otx:status\`, \`otx:reason\`, \`otx:
|
|
42
|
+
Key properties: \`otx:title\`, \`otx:date\`, \`otx:body\`, \`otx:status\`, \`otx:reason\`, \`otx:relatedTo\`, \`otx:dependsOn\`, \`otx:definedIn\`, \`otx:callerSymbol\`, \`otx:calleeSymbol\`, \`otx:sourceUrl\`, \`otx:sourceType\`. Session properties: \`otx:hasActivity\`, \`otx:followsUp\`, \`otx:domain\`, \`otx:impact\`, \`otx:activityType\`, \`otx:summary\`, \`otx:touchedModule\`, \`otx:createdIn\`, \`otx:resolvedIn\`, \`otx:priority\`, \`otx:confidence\`, \`otx:evidence\`, \`otx:supersedes\`. Full schema: use the \`schema\` tool.
|
|
39
43
|
|
|
40
44
|
### When to Record
|
|
41
45
|
|
|
@@ -45,7 +49,8 @@ Key properties: \`otx:title\`, \`otx:date\`, \`otx:body\`, \`otx:status\`, \`otx
|
|
|
45
49
|
| Bug/issue resolved | \`otx:Issue\` | context |
|
|
46
50
|
| Reusable knowledge | \`otx:Knowledge\` | context |
|
|
47
51
|
| Source ingested | \`otx:Source\` | context |
|
|
48
|
-
| Session end | \`otx:Session\` | sessions |
|
|
52
|
+
| Session end | \`otx:Session\` + \`otx:Activity\` + \`otx:Todo\` | sessions |
|
|
53
|
+
| Pattern/lesson from sessions | \`otx:Insight\` | sessions |
|
|
49
54
|
|
|
50
55
|
### Tools & Workflows
|
|
51
56
|
|
|
@@ -89,6 +94,18 @@ Types: article | paper | code | transcript | documentation | video | podcast | b
|
|
|
89
94
|
|
|
90
95
|
- Run \`context_scan\` after significant code changes (\`depth="module"\` for fast, \`depth="symbol"\` for thorough).
|
|
91
96
|
|
|
97
|
+
#### Proactive Session Save
|
|
98
|
+
|
|
99
|
+
After completing a meaningful work unit, proactively suggest saving a session log. Trigger conditions:
|
|
100
|
+
|
|
101
|
+
- **Feature/bugfix complete** — code changes committed or ready to commit
|
|
102
|
+
- **PR created or merged** — a development cycle finished
|
|
103
|
+
- **Architecture decision made** — important context worth preserving
|
|
104
|
+
- **Multi-step task done** — research, refactor, or investigation concluded
|
|
105
|
+
|
|
106
|
+
When triggered, suggest: "세션 로그를 저장할까요? (\`/context-save\`)"
|
|
107
|
+
Do NOT suggest for: trivial Q&A, typo fixes, or config tweaks.
|
|
108
|
+
|
|
92
109
|
#### Tool Reference
|
|
93
110
|
|
|
94
111
|
| Tool | When to Use |
|
|
@@ -101,19 +118,55 @@ Types: article | paper | code | transcript | documentation | video | podcast | b
|
|
|
101
118
|
| \`push\` | Record decisions, issues, knowledge, sources, or session summaries |
|
|
102
119
|
| \`doctor\` | Diagnose project health (config, store, hooks, CLAUDE.md) |
|
|
103
120
|
|
|
104
|
-
### Session
|
|
121
|
+
### Session Start — Sub-brain Query
|
|
122
|
+
|
|
123
|
+
At the start of each session, query for open Todos and recent Insights to restore working context:
|
|
124
|
+
|
|
125
|
+
\`\`\`sparql
|
|
126
|
+
PREFIX otx: <https://opentology.dev/vocab#>
|
|
127
|
+
SELECT ?type ?title ?status ?priority WHERE {
|
|
128
|
+
GRAPH <${sessionsUri}> {
|
|
129
|
+
{ ?s a otx:Todo ; otx:title ?title ; otx:status ?status .
|
|
130
|
+
OPTIONAL { ?s otx:priority ?priority }
|
|
131
|
+
FILTER(?status = "open" || ?status = "in-progress")
|
|
132
|
+
BIND("todo" AS ?type) }
|
|
133
|
+
UNION
|
|
134
|
+
{ ?s a otx:Insight ; otx:title ?title ; otx:confidence ?status .
|
|
135
|
+
BIND("insight" AS ?type) BIND("" AS ?priority) }
|
|
136
|
+
}
|
|
137
|
+
} ORDER BY DESC(?priority) LIMIT 20
|
|
138
|
+
\`\`\`
|
|
139
|
+
|
|
140
|
+
### Session End — Structured Recording
|
|
105
141
|
|
|
106
|
-
Push a
|
|
142
|
+
Push a structured session at the end of each meaningful session. Use \`/context-save\` for the full workflow. Minimal example:
|
|
107
143
|
|
|
108
144
|
\`\`\`turtle
|
|
109
145
|
@prefix otx: <https://opentology.dev/vocab#> .
|
|
110
146
|
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
111
147
|
|
|
148
|
+
# Session with domain and chaining
|
|
112
149
|
<urn:session:YYYY-MM-DD> a otx:Session ;
|
|
113
|
-
otx:title "Session summary
|
|
150
|
+
otx:title "Session summary" ;
|
|
114
151
|
otx:date "YYYY-MM-DD"^^xsd:date ;
|
|
115
152
|
otx:body "What was done" ;
|
|
116
|
-
otx:
|
|
153
|
+
otx:domain <urn:domain:{slug}> ;
|
|
154
|
+
otx:impact "medium" ;
|
|
155
|
+
otx:followsUp <urn:session:PREV-DATE> ;
|
|
156
|
+
otx:hasActivity <urn:activity:YYYY-MM-DD-1> .
|
|
157
|
+
|
|
158
|
+
# Activity per task
|
|
159
|
+
<urn:activity:YYYY-MM-DD-1> a otx:Activity ;
|
|
160
|
+
otx:activityType "feature" ;
|
|
161
|
+
otx:summary "What this task did" ;
|
|
162
|
+
otx:touchedModule <urn:module:src/path/file.ts> .
|
|
163
|
+
|
|
164
|
+
# Open todo
|
|
165
|
+
<urn:todo:YYYY-MM-DD-slug> a otx:Todo ;
|
|
166
|
+
otx:title "Next action" ;
|
|
167
|
+
otx:status "open" ;
|
|
168
|
+
otx:priority "high" ;
|
|
169
|
+
otx:createdIn <urn:session:YYYY-MM-DD> .
|
|
117
170
|
\`\`\`
|
|
118
171
|
${MARKER_END}`;
|
|
119
172
|
}
|
|
@@ -145,6 +198,10 @@ Claude Code는 글로벌 MCP \`opentology\`를 통해 프로젝트 지식을 RDF
|
|
|
145
198
|
| 지식 | \`urn:knowledge:{slug}\` | \`urn:knowledge:wasm-oxigraph\` |
|
|
146
199
|
| 패턴 | \`urn:pattern:{slug}\` | \`urn:pattern:singleton-adapter\` |
|
|
147
200
|
| 소스 | \`urn:source:{slug}\` | \`urn:source:karpathy-llm-wiki\` |
|
|
201
|
+
| 활동 | \`urn:activity:{date}-{n}\` | \`urn:activity:2026-04-05-1\` |
|
|
202
|
+
| 할일 | \`urn:todo:{date}-{slug}\` | \`urn:todo:2026-04-05-error-handling\` |
|
|
203
|
+
| 인사이트 | \`urn:insight:{slug}\` | \`urn:insight:push-error-pattern\` |
|
|
204
|
+
| 도메인 | \`urn:domain:{slug}\` | \`urn:domain:mcp-tools\` |
|
|
148
205
|
|
|
149
206
|
## 기록 기준
|
|
150
207
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OTX_BOOTSTRAP_TURTLE = "@prefix otx: <https://opentology.dev/vocab#> .\n@prefix owl: <http://www.w3.org/2002/07/owl#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\notx:Project a owl:Class .\notx:Decision a owl:Class .\notx:Issue a owl:Class .\notx:Knowledge a owl:Class .\notx:Session a owl:Class .\notx:Pattern a owl:Class .\notx:Module a owl:Class .\n\notx:title a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:date a owl:DatatypeProperty ; rdfs:range xsd:date .\notx:body a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:status a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:reason a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:cause a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:solution a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:nextTodo a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:relatedTo a owl:ObjectProperty .\notx:project a owl:ObjectProperty .\notx:dependsOn a owl:ObjectProperty ; rdfs:domain otx:Module ; rdfs:range otx:Module .\notx:stack a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:alternative a owl:DatatypeProperty ; rdfs:range xsd:string .\n\notx:Source a owl:Class .\n\notx:Class a owl:Class .\notx:Interface a owl:Class .\notx:Function a owl:Class .\notx:Method a owl:Class .\notx:MethodCall a owl:Class .\n\notx:definedIn a owl:ObjectProperty ; rdfs:range otx:Module .\notx:extends a owl:ObjectProperty ; rdfs:domain otx:Class ; rdfs:range otx:Class .\notx:implements a owl:ObjectProperty ; rdfs:domain otx:Class ; rdfs:range otx:Interface .\notx:hasMethod a owl:ObjectProperty ; rdfs:domain otx:Class ; rdfs:range otx:Method .\notx:calls a owl:ObjectProperty .\notx:callerSymbol a owl:ObjectProperty ; rdfs:domain otx:MethodCall .\notx:calleeSymbol a owl:ObjectProperty ; rdfs:domain otx:MethodCall .\notx:returns a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:paramType a owl:DatatypeProperty ; rdfs:range xsd:string .\n\notx:sourceUrl a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:sourceType a owl:DatatypeProperty ; rdfs:range xsd:string .\n";
|
|
1
|
+
export declare const OTX_BOOTSTRAP_TURTLE = "@prefix otx: <https://opentology.dev/vocab#> .\n@prefix owl: <http://www.w3.org/2002/07/owl#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\notx:Project a owl:Class .\notx:Decision a owl:Class .\notx:Issue a owl:Class .\notx:Knowledge a owl:Class .\notx:Session a owl:Class .\notx:Pattern a owl:Class .\notx:Module a owl:Class .\n\notx:title a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:date a owl:DatatypeProperty ; rdfs:range xsd:date .\notx:body a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:status a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:reason a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:cause a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:solution a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:nextTodo a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:relatedTo a owl:ObjectProperty .\notx:project a owl:ObjectProperty .\notx:dependsOn a owl:ObjectProperty ; rdfs:domain otx:Module ; rdfs:range otx:Module .\notx:stack a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:alternative a owl:DatatypeProperty ; rdfs:range xsd:string .\n\notx:Source a owl:Class .\n\notx:Class a owl:Class .\notx:Interface a owl:Class .\notx:Function a owl:Class .\notx:Method a owl:Class .\notx:MethodCall a owl:Class .\n\notx:definedIn a owl:ObjectProperty ; rdfs:range otx:Module .\notx:extends a owl:ObjectProperty ; rdfs:domain otx:Class ; rdfs:range otx:Class .\notx:implements a owl:ObjectProperty ; rdfs:domain otx:Class ; rdfs:range otx:Interface .\notx:hasMethod a owl:ObjectProperty ; rdfs:domain otx:Class ; rdfs:range otx:Method .\notx:calls a owl:ObjectProperty .\notx:callerSymbol a owl:ObjectProperty ; rdfs:domain otx:MethodCall .\notx:calleeSymbol a owl:ObjectProperty ; rdfs:domain otx:MethodCall .\notx:returns a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:paramType a owl:DatatypeProperty ; rdfs:range xsd:string .\n\notx:sourceUrl a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:sourceType a owl:DatatypeProperty ; rdfs:range xsd:string .\n\n# \u2500\u2500 Session sub-brain classes \u2500\u2500\notx:Activity a owl:Class .\notx:Todo a owl:Class .\notx:Insight a owl:Class .\notx:Domain a owl:Class .\n\n# Session \u2192 Activity\notx:hasActivity a owl:ObjectProperty ; rdfs:domain otx:Session ; rdfs:range otx:Activity .\notx:activityType a owl:DatatypeProperty ; rdfs:domain otx:Activity ; rdfs:range xsd:string .\notx:summary a owl:DatatypeProperty ; rdfs:range xsd:string .\notx:touchedModule a owl:ObjectProperty ; rdfs:domain otx:Activity ; rdfs:range otx:Module .\n\n# Domain tagging\notx:domain a owl:ObjectProperty ; rdfs:range otx:Domain .\notx:impact a owl:DatatypeProperty ; rdfs:range xsd:string .\n\n# Session chaining\notx:followsUp a owl:ObjectProperty ; rdfs:domain otx:Session ; rdfs:range otx:Session .\n\n# Todo (open \u2192 in-progress \u2192 done | dropped)\notx:createdIn a owl:ObjectProperty ; rdfs:range otx:Session .\notx:resolvedIn a owl:ObjectProperty ; rdfs:domain otx:Todo ; rdfs:range otx:Session .\notx:priority a owl:DatatypeProperty ; rdfs:range xsd:string .\n\n# Insight (inductive knowledge from session patterns)\notx:confidence a owl:DatatypeProperty ; rdfs:domain otx:Insight ; rdfs:range xsd:string .\notx:evidence a owl:ObjectProperty ; rdfs:domain otx:Insight .\n\n# Decision chaining\notx:supersedes a owl:ObjectProperty ; rdfs:domain otx:Decision ; rdfs:range otx:Decision .\n";
|
|
@@ -46,4 +46,35 @@ otx:paramType a owl:DatatypeProperty ; rdfs:range xsd:string .
|
|
|
46
46
|
|
|
47
47
|
otx:sourceUrl a owl:DatatypeProperty ; rdfs:range xsd:string .
|
|
48
48
|
otx:sourceType a owl:DatatypeProperty ; rdfs:range xsd:string .
|
|
49
|
+
|
|
50
|
+
# ── Session sub-brain classes ──
|
|
51
|
+
otx:Activity a owl:Class .
|
|
52
|
+
otx:Todo a owl:Class .
|
|
53
|
+
otx:Insight a owl:Class .
|
|
54
|
+
otx:Domain a owl:Class .
|
|
55
|
+
|
|
56
|
+
# Session → Activity
|
|
57
|
+
otx:hasActivity a owl:ObjectProperty ; rdfs:domain otx:Session ; rdfs:range otx:Activity .
|
|
58
|
+
otx:activityType a owl:DatatypeProperty ; rdfs:domain otx:Activity ; rdfs:range xsd:string .
|
|
59
|
+
otx:summary a owl:DatatypeProperty ; rdfs:range xsd:string .
|
|
60
|
+
otx:touchedModule a owl:ObjectProperty ; rdfs:domain otx:Activity ; rdfs:range otx:Module .
|
|
61
|
+
|
|
62
|
+
# Domain tagging
|
|
63
|
+
otx:domain a owl:ObjectProperty ; rdfs:range otx:Domain .
|
|
64
|
+
otx:impact a owl:DatatypeProperty ; rdfs:range xsd:string .
|
|
65
|
+
|
|
66
|
+
# Session chaining
|
|
67
|
+
otx:followsUp a owl:ObjectProperty ; rdfs:domain otx:Session ; rdfs:range otx:Session .
|
|
68
|
+
|
|
69
|
+
# Todo (open → in-progress → done | dropped)
|
|
70
|
+
otx:createdIn a owl:ObjectProperty ; rdfs:range otx:Session .
|
|
71
|
+
otx:resolvedIn a owl:ObjectProperty ; rdfs:domain otx:Todo ; rdfs:range otx:Session .
|
|
72
|
+
otx:priority a owl:DatatypeProperty ; rdfs:range xsd:string .
|
|
73
|
+
|
|
74
|
+
# Insight (inductive knowledge from session patterns)
|
|
75
|
+
otx:confidence a owl:DatatypeProperty ; rdfs:domain otx:Insight ; rdfs:range xsd:string .
|
|
76
|
+
otx:evidence a owl:ObjectProperty ; rdfs:domain otx:Insight .
|
|
77
|
+
|
|
78
|
+
# Decision chaining
|
|
79
|
+
otx:supersedes a owl:ObjectProperty ; rdfs:domain otx:Decision ; rdfs:range otx:Decision .
|
|
49
80
|
`;
|
|
@@ -64,24 +64,95 @@ If context is not initialized, suggest running /context-init first.
|
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
filename: 'context-save.md',
|
|
67
|
-
content: `Save a session summary to the OpenTology sessions graph.
|
|
67
|
+
content: `Save a structured session summary to the OpenTology sessions graph.
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
## Step 1 — Query previous state
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
Before recording, run these queries against the sessions graph:
|
|
72
|
+
|
|
73
|
+
\`\`\`sparql
|
|
74
|
+
# Find the most recent session (for followsUp linking)
|
|
75
|
+
PREFIX otx: <https://opentology.dev/vocab#>
|
|
76
|
+
SELECT ?s ?title ?date WHERE {
|
|
77
|
+
GRAPH <https://opentology.dev/opentology-context/sessions> {
|
|
78
|
+
?s a otx:Session ; otx:title ?title ; otx:date ?date .
|
|
79
|
+
}
|
|
80
|
+
} ORDER BY DESC(?date) LIMIT 1
|
|
81
|
+
\`\`\`
|
|
82
|
+
|
|
83
|
+
\`\`\`sparql
|
|
84
|
+
# Find open Todos (to update status if resolved)
|
|
85
|
+
PREFIX otx: <https://opentology.dev/vocab#>
|
|
86
|
+
SELECT ?s ?title ?status WHERE {
|
|
87
|
+
GRAPH <https://opentology.dev/opentology-context/sessions> {
|
|
88
|
+
?s a otx:Todo ; otx:title ?title ; otx:status ?status .
|
|
89
|
+
FILTER(?status = "open" || ?status = "in-progress")
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
## Step 2 — Decompose the session
|
|
95
|
+
|
|
96
|
+
Summarize the conversation and break it down into:
|
|
97
|
+
|
|
98
|
+
1. **Session** — overall summary with domain tag and impact level
|
|
99
|
+
2. **Activities** — each distinct task/action as a separate entity
|
|
100
|
+
3. **Todos** — new open items + status updates for existing ones
|
|
101
|
+
4. **Insight** (optional) — any pattern or lesson learned inductively
|
|
102
|
+
|
|
103
|
+
## Step 3 — Push structured triples
|
|
104
|
+
|
|
105
|
+
Push to the sessions graph (use graph name "sessions").
|
|
72
106
|
|
|
73
107
|
\`\`\`turtle
|
|
74
108
|
@prefix otx: <https://opentology.dev/vocab#> .
|
|
75
109
|
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
76
110
|
|
|
77
|
-
|
|
78
|
-
|
|
111
|
+
# Session
|
|
112
|
+
<urn:session:{YYYY-MM-DD}> a otx:Session ;
|
|
113
|
+
otx:title "{summary title}" ;
|
|
79
114
|
otx:date "{YYYY-MM-DD}"^^xsd:date ;
|
|
80
|
-
otx:body "{what was done}" ;
|
|
81
|
-
otx:
|
|
115
|
+
otx:body "{what was done — keep concise}" ;
|
|
116
|
+
otx:domain <urn:domain:{slug}> ;
|
|
117
|
+
otx:impact "{high|medium|low}" ;
|
|
118
|
+
otx:followsUp <{previous session URI, if any}> ;
|
|
119
|
+
otx:hasActivity <urn:activity:{YYYY-MM-DD}-1> .
|
|
120
|
+
|
|
121
|
+
# Activity (one per distinct task)
|
|
122
|
+
<urn:activity:{YYYY-MM-DD}-1> a otx:Activity ;
|
|
123
|
+
otx:activityType "{code-change|bugfix|feature|refactor|research|schema-change|review|deploy}" ;
|
|
124
|
+
otx:summary "{what this activity did}" ;
|
|
125
|
+
otx:touchedModule <urn:module:{file/path}> .
|
|
126
|
+
|
|
127
|
+
# Todo — new open item
|
|
128
|
+
<urn:todo:{YYYY-MM-DD}-{slug}> a otx:Todo ;
|
|
129
|
+
otx:title "{what needs to be done}" ;
|
|
130
|
+
otx:status "open" ;
|
|
131
|
+
otx:priority "{high|medium|low}" ;
|
|
132
|
+
otx:createdIn <urn:session:{YYYY-MM-DD}> .
|
|
133
|
+
|
|
134
|
+
# Todo — resolve existing (if applicable, use delete+push to update status)
|
|
135
|
+
# <urn:todo:{existing}> otx:status "done" ; otx:resolvedIn <urn:session:{YYYY-MM-DD}> .
|
|
136
|
+
|
|
137
|
+
# Insight (optional — only if a pattern emerged)
|
|
138
|
+
# <urn:insight:{slug}> a otx:Insight ;
|
|
139
|
+
# otx:title "{pattern or lesson}" ;
|
|
140
|
+
# otx:confidence "{high|medium|low}" ;
|
|
141
|
+
# otx:evidence <urn:session:{YYYY-MM-DD}> ;
|
|
142
|
+
# otx:domain <urn:domain:{slug}> .
|
|
143
|
+
|
|
144
|
+
# Domain (create only if new)
|
|
145
|
+
# <urn:domain:{slug}> a otx:Domain ; otx:title "{Domain Name}" .
|
|
82
146
|
\`\`\`
|
|
83
147
|
|
|
84
|
-
|
|
148
|
+
## Guidelines
|
|
149
|
+
|
|
150
|
+
- **Multiple sessions per day**: append a counter, e.g. \`urn:session:2026-04-06-2\`
|
|
151
|
+
- **Activity types**: code-change, bugfix, feature, refactor, research, schema-change, review, deploy (free-form OK)
|
|
152
|
+
- **Todo status machine**: open → in-progress → done | dropped (dropped requires otx:reason)
|
|
153
|
+
- **Insight confidence**: high (3+ evidence), medium (2 evidence), low (1 evidence / hunch)
|
|
154
|
+
- **Domain**: reuse existing domains when possible. Query first before creating new ones.
|
|
155
|
+
- **followsUp**: always link to the previous session if one exists
|
|
85
156
|
`,
|
|
86
157
|
},
|
|
87
158
|
{
|
|
@@ -75,23 +75,24 @@ try {
|
|
|
75
75
|
const reminders = [];
|
|
76
76
|
|
|
77
77
|
if (!sessionExists) {
|
|
78
|
-
reminders.push('Push
|
|
78
|
+
reminders.push('Push a structured session to the sessions graph:');
|
|
79
|
+
reminders.push(' □ Session — summary, domain, impact, followsUp (link to previous session)');
|
|
80
|
+
reminders.push(' □ Activity — one per distinct task (activityType, summary, touchedModule)');
|
|
81
|
+
reminders.push(' □ Todo — new open items with priority; update resolved ones to "done"');
|
|
82
|
+
reminders.push(' □ Insight — if a pattern or lesson emerged (optional)');
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
reminders.push('
|
|
83
|
-
reminders.push('-
|
|
84
|
-
reminders.push('-
|
|
85
|
-
reminders.push('-
|
|
86
|
-
reminders.push('- External sources ingested → otx:Source');
|
|
85
|
+
reminders.push('Also review if any of these should be recorded to the context graph:');
|
|
86
|
+
reminders.push(' - Architecture/tech decisions → otx:Decision');
|
|
87
|
+
reminders.push(' - Reusable patterns or lessons → otx:Knowledge');
|
|
88
|
+
reminders.push(' - Resolved bugs/issues → otx:Issue');
|
|
89
|
+
reminders.push(' - External sources ingested → otx:Source');
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
for (const r of reminders) console.log(' ' + r);
|
|
94
|
-
}
|
|
91
|
+
const header = sessionExists
|
|
92
|
+
? 'Session log exists. Check if additional knowledge should be recorded:'
|
|
93
|
+
: 'Session log missing (' + today + ', ' + commitCount + ' commits, importance: ' + importance + '). Before ending:';
|
|
94
|
+
console.log(header);
|
|
95
|
+
for (const r of reminders) console.log(' ' + r);
|
|
95
96
|
} catch {
|
|
96
97
|
process.exit(0);
|
|
97
98
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opentology",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Ontology-powered project memory for AI coding assistants — your codebase as a knowledge graph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"opentology": "dist/index.js"
|
|
7
|
+
"opentology": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/"
|