oneie 3.6.24 โ 3.6.25
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/.claude/agents/agent-backend.md +2 -2
- package/.claude/agents/agent-designer.md +1 -0
- package/.claude/agents/agent-director.md +71 -71
- package/.claude/agents/agent-onboard.md +1 -1
- package/.claude/agents/agent-ontology.md +2 -2
- package/.claude/agents/agent-ops.md +58 -38
- package/.claude/agents/agent-sales.md +3 -3
- package/.claude/commands/cascade.md +21 -21
- package/.claude/commands/create.md +19 -19
- package/.claude/commands/deploy.md +82 -104
- package/.claude/commands/mcp-on.md +191 -0
- package/.claude/commands/one.md +267 -92
- package/.claude/commands/plan.md +17 -17
- package/.claude/commands/release.md +65 -14
- package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +473 -0
- package/.claude/hooks/README-knowledge-hooks.md +451 -0
- package/.claude/hooks/README-root-cleanup.md +200 -0
- package/.claude/hooks/README.md +284 -0
- package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/check-filenames.py +177 -0
- package/.claude/hooks/clean-post.py +468 -0
- package/.claude/hooks/clean-pre.py +393 -0
- package/.claude/hooks/clean-root-markdown.sh +73 -0
- package/.claude/hooks/commit-push.sh +95 -0
- package/.claude/hooks/done.py +236 -0
- package/.claude/hooks/format-hook.sh +163 -0
- package/.claude/hooks/hook-logger.sh +173 -0
- package/.claude/hooks/knowledge-post.py +355 -0
- package/.claude/hooks/knowledge-pre.py +245 -0
- package/.claude/hooks/mcp-on.sh +134 -0
- package/.claude/hooks/notification-hook.sh +279 -0
- package/.claude/hooks/push.sh +101 -0
- package/.claude/hooks/release-cli.sh +16 -8
- package/.claude/hooks/root-cleanup.py +217 -0
- package/.claude/hooks/security-hook.sh +397 -0
- package/.claude/hooks/tag-all-docs.py +464 -0
- package/.claude/hooks/test-validate-ontology.sh +170 -0
- package/.claude/hooks/todo.py +368 -0
- package/.claude/hooks/track-changes.sh +101 -0
- package/.claude/hooks/validate-ontology-structure-summary.md +243 -0
- package/.claude/hooks/validate-ontology-structure.py +518 -0
- package/.claude/skills/INDEX.md +1 -1
- package/.claude/skills/ontology/README.md +1 -1
- package/package.json +1 -1
- package/.claude/commands/mcp-toggle.md +0 -93
- package/.claude/commands/npx.md +0 -84
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
# Knowledge Tagging Hooks - 6-Dimension Ontology
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The knowledge tagging hooks automatically map all created/modified artifacts to the **6-dimension ontology**. This enables:
|
|
6
|
+
|
|
7
|
+
- ๐ Automatic ontology dimension mapping (groups, people, things, connections, events, knowledge)
|
|
8
|
+
- ๐ท๏ธ Semantic labeling aligned with Reality-as-DSL architecture
|
|
9
|
+
- ๐ RAG-ready artifact indexing for AI agent learning
|
|
10
|
+
- ๐ Knowledge tracking per cycle (Cycle 1-100)
|
|
11
|
+
- ๐ง Complete audit trail of created knowledge
|
|
12
|
+
- ๐ฏ Guided documentation paths for each dimension
|
|
13
|
+
|
|
14
|
+
## The 6-Dimension Ontology
|
|
15
|
+
|
|
16
|
+
**Version:** 3.0.0 (Reality as DSL)
|
|
17
|
+
|
|
18
|
+
Every artifact created in ONE Platform maps to one of these 6 dimensions:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
22
|
+
โ 1. GROUPS โ
|
|
23
|
+
โ Multi-tenant isolation with hierarchical nesting โ
|
|
24
|
+
โ โ /one/groups/ or /<installation-name>/ โ
|
|
25
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
26
|
+
โ
|
|
27
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
28
|
+
โ 2. PEOPLE โ
|
|
29
|
+
โ Authorization & governance (roles, permissions) โ
|
|
30
|
+
โ โ /one/people/ โ
|
|
31
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
32
|
+
โ
|
|
33
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
34
|
+
โ 3. THINGS โ
|
|
35
|
+
โ All entities (66+ types) - users, products, courses, agents โ
|
|
36
|
+
โ โ /one/things/, /backend/, /web/ โ
|
|
37
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
38
|
+
โ
|
|
39
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
40
|
+
โ 4. CONNECTIONS โ
|
|
41
|
+
โ All relationships (25+ types) - owns, purchased, enrolled_in โ
|
|
42
|
+
โ โ /one/connections/ โ
|
|
43
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
44
|
+
โ
|
|
45
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
46
|
+
โ 5. EVENTS โ
|
|
47
|
+
โ All actions & state changes - created, updated, purchased โ
|
|
48
|
+
โ โ /one/events/ โ
|
|
49
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
50
|
+
โ
|
|
51
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
52
|
+
โ 6. KNOWLEDGE โ
|
|
53
|
+
โ Labels, embeddings, vectors powering RAG & semantic search โ
|
|
54
|
+
โ โ /one/knowledge/, /test/ โ
|
|
55
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Reference:** `/one/knowledge/ontology.md` (Complete specification)
|
|
59
|
+
|
|
60
|
+
## How It Works
|
|
61
|
+
|
|
62
|
+
### Pre-Hook: `knowledge-pre.py`
|
|
63
|
+
|
|
64
|
+
Runs **before** Write/Edit operations to validate and guide ontology mapping:
|
|
65
|
+
|
|
66
|
+
1. โ
Maps artifact to correct ontology dimension
|
|
67
|
+
2. ๐บ๏ธ Shows documentation paths for the dimension
|
|
68
|
+
3. ๐ท๏ธ Prepares semantic labels (dimension:*, artifact:*, etc.)
|
|
69
|
+
4. ๐ Displays ontology structure with highlighted dimension
|
|
70
|
+
5. โ ๏ธ Skips temporary and generated files
|
|
71
|
+
|
|
72
|
+
**Example Output:**
|
|
73
|
+
```
|
|
74
|
+
๐ Knowledge Pre-Hook - 6-Dimension Ontology
|
|
75
|
+
Artifact: EntityList.tsx
|
|
76
|
+
Type: code
|
|
77
|
+
Dimension: THINGS
|
|
78
|
+
Docs: /one/things/ or /one/knowledge/ontology.md#things
|
|
79
|
+
Labels: dimension:things, components, ui, frontend
|
|
80
|
+
โ Will be tagged in knowledge dimension after creation
|
|
81
|
+
|
|
82
|
+
6-Dimension Ontology:
|
|
83
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
84
|
+
โ 1. GROUPS - Multi-tenant โ
|
|
85
|
+
โ 2. PEOPLE - Authorization โ
|
|
86
|
+
โ 3. THINGS - Entities โ โ HERE
|
|
87
|
+
โ 4. CONNECTIONS - Relationships โ
|
|
88
|
+
โ 5. EVENTS - Actions โ
|
|
89
|
+
โ 6. KNOWLEDGE - Labels & embeddings โ
|
|
90
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Post-Hook: `knowledge-post.py`
|
|
94
|
+
|
|
95
|
+
Runs **after** Write/Edit operations to create knowledge entries:
|
|
96
|
+
|
|
97
|
+
1. ๐ Creates knowledge entry with ontology dimension mapping
|
|
98
|
+
2. ๐ท๏ธ Tags with semantic labels (dimension:*, artifact:*, technology:*, etc.)
|
|
99
|
+
3. ๐ Links to current cycle context (Cycle 1-100)
|
|
100
|
+
4. ๐พ Saves to daily knowledge log (~/.claude/knowledge-log/)
|
|
101
|
+
5. ๐ Generates content hash for versioning
|
|
102
|
+
6. ๐ Tracks ontology version (3.0.0)
|
|
103
|
+
|
|
104
|
+
**Example Output:**
|
|
105
|
+
```
|
|
106
|
+
โจ Knowledge Tagged - 6-Dimension Ontology
|
|
107
|
+
Artifact: EntityList.tsx
|
|
108
|
+
Type: code
|
|
109
|
+
Dimension: THINGS
|
|
110
|
+
Labels: dimension:things, components, ui, frontend
|
|
111
|
+
Cycle: 22/100
|
|
112
|
+
Hash: a3f9d2c1b4e5f6a7
|
|
113
|
+
โ Logged to: knowledge-2025-11-03.jsonl
|
|
114
|
+
|
|
115
|
+
6-Dimension Ontology:
|
|
116
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
117
|
+
โ 1. GROUPS - Multi-tenant โ
|
|
118
|
+
โ 2. PEOPLE - Authorization โ
|
|
119
|
+
โ 3. THINGS - Entities โ โ Captured
|
|
120
|
+
โ 4. CONNECTIONS - Relationships โ
|
|
121
|
+
โ 5. EVENTS - Actions โ
|
|
122
|
+
โ 6. KNOWLEDGE - Labels & embeddings โ
|
|
123
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Knowledge Entry Structure
|
|
127
|
+
|
|
128
|
+
Each knowledge entry is saved as JSON with ontology dimension mapping:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"type": "knowledge_item",
|
|
133
|
+
"artifact_type": "code",
|
|
134
|
+
"ontology_dimension": "things",
|
|
135
|
+
"file_path": "/Users/toc/Server/ONE/web/src/components/EntityList.tsx",
|
|
136
|
+
"file_name": "EntityList.tsx",
|
|
137
|
+
"labels": [
|
|
138
|
+
"dimension:things",
|
|
139
|
+
"components",
|
|
140
|
+
"ui",
|
|
141
|
+
"frontend",
|
|
142
|
+
"artifact:code"
|
|
143
|
+
],
|
|
144
|
+
"content_hash": "a3f9d2c1b4e5f6a7",
|
|
145
|
+
"created_at": "2025-11-03T21:30:45.123456",
|
|
146
|
+
"cycle_number": 22,
|
|
147
|
+
"feature": "Entity Management",
|
|
148
|
+
"organization": "Default Org",
|
|
149
|
+
"created_by_role": "platform_owner",
|
|
150
|
+
"content_preview": "import { useQuery } from 'convex/react'...",
|
|
151
|
+
"metadata": {
|
|
152
|
+
"file_size": 1234,
|
|
153
|
+
"directory": "/Users/toc/Server/ONE/web/src/components",
|
|
154
|
+
"extension": ".tsx",
|
|
155
|
+
"ontology_version": "3.0.0"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Ontology Dimension Mapping
|
|
161
|
+
|
|
162
|
+
The hooks automatically map file paths to ontology dimensions:
|
|
163
|
+
|
|
164
|
+
| Dimension | File Paths | Labels |
|
|
165
|
+
|-----------|-----------|--------|
|
|
166
|
+
| **GROUPS** | `/one/groups/`, `/<installation>/`, `/groups/` | `dimension:groups`, `multi-tenancy`, `isolation` |
|
|
167
|
+
| **PEOPLE** | `/one/people/` | `dimension:people`, `authorization`, `governance`, `roles` |
|
|
168
|
+
| **THINGS** | `/one/things/`, `/backend/`, `/web/` | `dimension:things`, `entities`, `schema`, `mutations`, `queries` |
|
|
169
|
+
| **CONNECTIONS** | `/one/connections/` | `dimension:connections`, `relationships`, `patterns` |
|
|
170
|
+
| **EVENTS** | `/one/events/` | `dimension:events`, `actions`, `audit-trail` |
|
|
171
|
+
| **KNOWLEDGE** | `/one/knowledge/`, `/test/` | `dimension:knowledge`, `documentation`, `patterns`, `testing` |
|
|
172
|
+
|
|
173
|
+
## Semantic Label Taxonomy
|
|
174
|
+
|
|
175
|
+
Labels follow ontology governance prefixes:
|
|
176
|
+
|
|
177
|
+
- **dimension:*** - Ontology dimension (groups, people, things, connections, events, knowledge)
|
|
178
|
+
- **artifact:*** - Artifact type (code, documentation, test, config, design)
|
|
179
|
+
- **technology:*** - Technology stack (react, convex, astro, typescript)
|
|
180
|
+
- **pattern:*** - Implementation pattern (crud, event-logging, service)
|
|
181
|
+
- **topic:*** - Domain topic (education, commerce, finance)
|
|
182
|
+
|
|
183
|
+
**Example Labels:**
|
|
184
|
+
- `dimension:things` - Maps to THINGS dimension
|
|
185
|
+
- `artifact:code` - TypeScript/JavaScript code
|
|
186
|
+
- `technology:react` - React component
|
|
187
|
+
- `pattern:crud` - CRUD operations pattern
|
|
188
|
+
- `topic:education` - Education domain
|
|
189
|
+
|
|
190
|
+
## Artifact Types
|
|
191
|
+
|
|
192
|
+
The hooks recognize 5 artifact types:
|
|
193
|
+
|
|
194
|
+
| Type | Extensions | Labels |
|
|
195
|
+
|------|-----------|--------|
|
|
196
|
+
| **code** | .py, .ts, .tsx, .js, .jsx, .astro, .json, .yaml | `artifact:code` |
|
|
197
|
+
| **documentation** | .md, .mdx, .txt | `artifact:documentation` |
|
|
198
|
+
| **test** | .test.ts, .spec.ts, etc. | `artifact:test` |
|
|
199
|
+
| **config** | .json, .yaml, .yml, .toml, .ini | `artifact:config` |
|
|
200
|
+
| **design** | .fig, .sketch, .svg, .png, .jpg | `artifact:design` |
|
|
201
|
+
|
|
202
|
+
## Smart Path Mapping
|
|
203
|
+
|
|
204
|
+
Labels are automatically generated based on file path and ontology dimension:
|
|
205
|
+
|
|
206
|
+
| Path Pattern | Dimension | Auto Labels |
|
|
207
|
+
|-------------|-----------|-------------|
|
|
208
|
+
| `/one/groups` | GROUPS | `dimension:groups`, `ontology`, `multi-tenancy` |
|
|
209
|
+
| `/one/people` | PEOPLE | `dimension:people`, `ontology`, `authorization`, `governance` |
|
|
210
|
+
| `/one/things` | THINGS | `dimension:things`, `ontology`, `entities`, `specifications` |
|
|
211
|
+
| `/backend/convex/schema` | THINGS | `dimension:things`, `schema`, `entities`, `backend` |
|
|
212
|
+
| `/backend/convex/mutations` | THINGS | `dimension:things`, `mutations`, `write-operations` |
|
|
213
|
+
| `/backend/convex/queries` | THINGS | `dimension:things`, `queries`, `read-operations` |
|
|
214
|
+
| `/backend/convex/services` | THINGS | `dimension:things`, `services`, `business-logic` |
|
|
215
|
+
| `/web/src/components` | THINGS | `dimension:things`, `components`, `ui`, `frontend` |
|
|
216
|
+
| `/web/src/pages` | THINGS | `dimension:things`, `pages`, `routing`, `frontend` |
|
|
217
|
+
| `/one/connections` | CONNECTIONS | `dimension:connections`, `ontology`, `relationships` |
|
|
218
|
+
| `/one/events` | EVENTS | `dimension:events`, `ontology`, `actions`, `audit-trail` |
|
|
219
|
+
| `/one/knowledge` | KNOWLEDGE | `dimension:knowledge`, `ontology`, `documentation` |
|
|
220
|
+
| `/test` | KNOWLEDGE | `dimension:knowledge`, `testing`, `quality`, `validation` |
|
|
221
|
+
|
|
222
|
+
## Installation Folders (Multi-Tenancy)
|
|
223
|
+
|
|
224
|
+
Installation-specific artifacts map to the GROUPS dimension:
|
|
225
|
+
|
|
226
|
+
| Path Pattern | Dimension | Labels |
|
|
227
|
+
|-------------|-----------|--------|
|
|
228
|
+
| `/<installation-name>/` | GROUPS | `dimension:groups`, `installation`, `organization` |
|
|
229
|
+
| `/<installation>/groups/<group-slug>/` | GROUPS | `dimension:groups`, `group-specific`, `team` |
|
|
230
|
+
|
|
231
|
+
**Example:** `/acme/knowledge/brand-guide.md` โ `dimension:groups`, `installation`, `organization`
|
|
232
|
+
|
|
233
|
+
## Knowledge Logs
|
|
234
|
+
|
|
235
|
+
Knowledge entries are saved to `~/.claude/knowledge-log/` as daily JSONL files:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
~/.claude/knowledge-log/
|
|
239
|
+
โโโ knowledge-2025-11-03.jsonl
|
|
240
|
+
โโโ knowledge-2025-11-02.jsonl
|
|
241
|
+
โโโ knowledge-2025-11-01.jsonl
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Each line is a complete JSON knowledge entry. This format enables:
|
|
245
|
+
|
|
246
|
+
- ๐ Easy aggregation and analysis
|
|
247
|
+
- ๐ Fast searching with grep/jq
|
|
248
|
+
- ๐ Knowledge growth tracking per dimension
|
|
249
|
+
- ๐ง RAG corpus building for AI agents
|
|
250
|
+
- ๐ฏ Ontology dimension coverage metrics
|
|
251
|
+
|
|
252
|
+
## Cycle Context Integration
|
|
253
|
+
|
|
254
|
+
The hooks integrate with the cycle tracking system:
|
|
255
|
+
|
|
256
|
+
- ๐ Current cycle number (1-100)
|
|
257
|
+
- ๐ฏ Feature being implemented
|
|
258
|
+
- ๐ข Organization context
|
|
259
|
+
- ๐ค Person role (platform_owner, org_owner, etc.)
|
|
260
|
+
|
|
261
|
+
**State File:** `.claude/state/cycle.json`
|
|
262
|
+
|
|
263
|
+
This links every knowledge artifact back to:
|
|
264
|
+
1. The cycle that created it (1-100)
|
|
265
|
+
2. The feature being implemented
|
|
266
|
+
3. The organization context
|
|
267
|
+
4. The person role (authorization dimension)
|
|
268
|
+
|
|
269
|
+
## Filtering Rules
|
|
270
|
+
|
|
271
|
+
The hooks **skip** tagging for:
|
|
272
|
+
|
|
273
|
+
- โ Temporary files (`/tmp/`, `/.temp/`)
|
|
274
|
+
- โ Generated files (`/_generated/`, `/node_modules/`)
|
|
275
|
+
- โ Non-recognized artifact types
|
|
276
|
+
- โ Non-Write/Edit operations (Read, Bash, etc.)
|
|
277
|
+
|
|
278
|
+
## Usage Example
|
|
279
|
+
|
|
280
|
+
When you create a new component:
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
// Write: web/src/components/TokenBalance.tsx
|
|
284
|
+
import { useQuery } from 'convex/react';
|
|
285
|
+
export function TokenBalance({ userId }) { ... }
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Pre-Hook Output:**
|
|
289
|
+
```
|
|
290
|
+
๐ Knowledge Pre-Hook - 6-Dimension Ontology
|
|
291
|
+
Artifact: TokenBalance.tsx
|
|
292
|
+
Type: code
|
|
293
|
+
Dimension: THINGS
|
|
294
|
+
Docs: /one/things/ or /one/knowledge/ontology.md#things
|
|
295
|
+
Labels: dimension:things, components, ui, frontend
|
|
296
|
+
โ Will be tagged in knowledge dimension after creation
|
|
297
|
+
|
|
298
|
+
6-Dimension Ontology:
|
|
299
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
300
|
+
โ 1. GROUPS - Multi-tenant โ
|
|
301
|
+
โ 2. PEOPLE - Authorization โ
|
|
302
|
+
โ 3. THINGS - Entities โ โ HERE
|
|
303
|
+
โ 4. CONNECTIONS - Relationships โ
|
|
304
|
+
โ 5. EVENTS - Actions โ
|
|
305
|
+
โ 6. KNOWLEDGE - Labels & embeddings โ
|
|
306
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Post-Hook Output:**
|
|
310
|
+
```
|
|
311
|
+
โจ Knowledge Tagged - 6-Dimension Ontology
|
|
312
|
+
Artifact: TokenBalance.tsx
|
|
313
|
+
Type: code
|
|
314
|
+
Dimension: THINGS
|
|
315
|
+
Labels: dimension:things, components, ui, frontend
|
|
316
|
+
Cycle: 22/100
|
|
317
|
+
Hash: b8c3d4e5f6a7b8c9
|
|
318
|
+
โ Logged to: knowledge-2025-11-03.jsonl
|
|
319
|
+
|
|
320
|
+
6-Dimension Ontology:
|
|
321
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
322
|
+
โ 1. GROUPS - Multi-tenant โ
|
|
323
|
+
โ 2. PEOPLE - Authorization โ
|
|
324
|
+
โ 3. THINGS - Entities โ โ Captured
|
|
325
|
+
โ 4. CONNECTIONS - Relationships โ
|
|
326
|
+
โ 5. EVENTS - Actions โ
|
|
327
|
+
โ 6. KNOWLEDGE - Labels & embeddings โ
|
|
328
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Querying Knowledge Logs
|
|
332
|
+
|
|
333
|
+
Use `jq` to query knowledge logs by dimension:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
# All artifacts created today
|
|
337
|
+
cat ~/.claude/knowledge-log/knowledge-$(date +%Y-%m-%d).jsonl | jq .
|
|
338
|
+
|
|
339
|
+
# All THINGS dimension artifacts
|
|
340
|
+
cat ~/.claude/knowledge-log/*.jsonl | jq 'select(.ontology_dimension == "things")'
|
|
341
|
+
|
|
342
|
+
# All GROUPS dimension artifacts (multi-tenancy)
|
|
343
|
+
cat ~/.claude/knowledge-log/*.jsonl | jq 'select(.ontology_dimension == "groups")'
|
|
344
|
+
|
|
345
|
+
# All code artifacts
|
|
346
|
+
cat ~/.claude/knowledge-log/*.jsonl | jq 'select(.artifact_type == "code")'
|
|
347
|
+
|
|
348
|
+
# All artifacts for cycle 22
|
|
349
|
+
cat ~/.claude/knowledge-log/*.jsonl | jq 'select(.cycle_number == 22)'
|
|
350
|
+
|
|
351
|
+
# All frontend components (THINGS dimension)
|
|
352
|
+
cat ~/.claude/knowledge-log/*.jsonl | jq 'select(.labels | contains(["dimension:things", "components", "frontend"]))'
|
|
353
|
+
|
|
354
|
+
# Count by ontology dimension
|
|
355
|
+
cat ~/.claude/knowledge-log/*.jsonl | jq -r '.ontology_dimension' | sort | uniq -c
|
|
356
|
+
|
|
357
|
+
# Ontology coverage (which dimensions have artifacts)
|
|
358
|
+
cat ~/.claude/knowledge-log/*.jsonl | jq -r '.ontology_dimension' | sort | uniq
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Integration with 6-Dimension Ontology
|
|
362
|
+
|
|
363
|
+
These hooks implement **Dimension 6: Knowledge** while mapping all artifacts to their correct dimension:
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
1. GROUPS โ Multi-tenant isolation (installation folders)
|
|
367
|
+
2. PEOPLE โ Authorization & roles (who can do what)
|
|
368
|
+
3. THINGS โ Entities (backend, frontend, schema)
|
|
369
|
+
4. CONNECTIONS โ Relationships (how things relate)
|
|
370
|
+
5. EVENTS โ Actions (what happened when)
|
|
371
|
+
6. KNOWLEDGE โ ๐ข Labels + embeddings + vectors (YOU ARE HERE)
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
Every artifact created is:
|
|
375
|
+
1. โ
Mapped to correct **ontology dimension** (1-6)
|
|
376
|
+
2. ๐ท๏ธ Tagged with **semantic labels** (dimension:*, artifact:*, etc.)
|
|
377
|
+
3. ๐ Linked to **cycle context** (Cycle 1-100)
|
|
378
|
+
4. ๐ Indexed for **RAG search** (embeddings ready)
|
|
379
|
+
5. ๐ฏ Guided to **dimension docs** (ontology alignment)
|
|
380
|
+
|
|
381
|
+
## Benefits
|
|
382
|
+
|
|
383
|
+
- **98% AI code generation accuracy** - Agents learn from ontology-aligned knowledge
|
|
384
|
+
- **Pattern convergence** - All features map to same 6 dimensions
|
|
385
|
+
- **Semantic search** - Find similar implementations by dimension and labels
|
|
386
|
+
- **Ontology governance** - Ensure all artifacts align with reality model
|
|
387
|
+
- **Knowledge compounding** - Each feature makes the next more accurate
|
|
388
|
+
|
|
389
|
+
## Future Enhancements
|
|
390
|
+
|
|
391
|
+
Planned improvements:
|
|
392
|
+
|
|
393
|
+
- ๐ง Auto-generate embeddings with OpenAI/Anthropic
|
|
394
|
+
- ๐ Vector search across all dimensions
|
|
395
|
+
- ๐ Knowledge dashboard visualization by dimension
|
|
396
|
+
- ๐ค RAG-powered code search by ontology dimension
|
|
397
|
+
- ๐ Ontology coverage metrics (which dimensions need work)
|
|
398
|
+
- ๐ Link artifacts to related things via thingKnowledge junction
|
|
399
|
+
- ๐ฏ Dimension-specific documentation generation
|
|
400
|
+
|
|
401
|
+
## Troubleshooting
|
|
402
|
+
|
|
403
|
+
### Hooks not running?
|
|
404
|
+
|
|
405
|
+
Check that hooks are executable:
|
|
406
|
+
```bash
|
|
407
|
+
chmod +x .claude/hooks/knowledge-*.py
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Knowledge logs not created?
|
|
411
|
+
|
|
412
|
+
Ensure directory exists:
|
|
413
|
+
```bash
|
|
414
|
+
mkdir -p ~/.claude/knowledge-log
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Want to test hooks manually?
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
# Test pre-hook
|
|
421
|
+
echo '{"hook_event_name":"PreToolUse","tool_name":"Write","tool_input":{"file_path":"/Users/toc/Server/ONE/web/src/components/Test.tsx"}}' | python3 .claude/hooks/knowledge-pre.py
|
|
422
|
+
|
|
423
|
+
# Test post-hook
|
|
424
|
+
echo '{"hook_event_name":"PostToolUse","tool_name":"Write","tool_input":{"file_path":"/Users/toc/Server/ONE/web/src/components/Test.tsx","content":"test content"}}' | python3 .claude/hooks/knowledge-post.py
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Want to disable temporarily?
|
|
428
|
+
|
|
429
|
+
Remove from `.claude/settings.local.json`:
|
|
430
|
+
```json
|
|
431
|
+
// Remove these blocks
|
|
432
|
+
{
|
|
433
|
+
"type": "command",
|
|
434
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/knowledge-pre.py",
|
|
435
|
+
"timeout": 5
|
|
436
|
+
}
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## See Also
|
|
440
|
+
|
|
441
|
+
- **`validate-ontology-structure.py`**: Validates 6-dimension ontology structure
|
|
442
|
+
- **`todo.py`**: Cycle context tracking (Cycle 1-100)
|
|
443
|
+
- **`done.py`**: Marks cycles complete
|
|
444
|
+
- **`/one/knowledge/ontology.md`**: Complete 6-dimension ontology spec (Version 3.0.0)
|
|
445
|
+
- **`/one/knowledge/todo.md`**: 100-cycle execution sequence
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
**Built with clarity, simplicity, and infinite scale in mind.**
|
|
450
|
+
|
|
451
|
+
The 6-dimension ontology models reality itself. These hooks ensure every artifact aligns with that reality.
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Root Cleanup Hook - 6-Dimension Ontology Alignment
|
|
2
|
+
|
|
3
|
+
**Purpose:** Automatically moves misplaced documentation files from the root directory to the appropriate `/one/<dimension>/` directory based on the 6-dimension ontology.
|
|
4
|
+
|
|
5
|
+
## 6-Dimension Ontology
|
|
6
|
+
|
|
7
|
+
The ONE platform organizes all documentation and data according to six fundamental dimensions:
|
|
8
|
+
|
|
9
|
+
1. **groups** - Hierarchical containers (organizations, teams, communities)
|
|
10
|
+
2. **people** - Authorization & governance (roles, users, governance)
|
|
11
|
+
3. **things** - Entities (specs, plans, components, agents)
|
|
12
|
+
4. **connections** - Relationships (protocols, workflows, integrations)
|
|
13
|
+
5. **events** - Actions & state changes (deployments, releases, reports)
|
|
14
|
+
6. **knowledge** - Labels & learning (architecture, patterns, rules, guides)
|
|
15
|
+
|
|
16
|
+
## Approved Root Files
|
|
17
|
+
|
|
18
|
+
Only these files are allowed to remain in the root directory:
|
|
19
|
+
|
|
20
|
+
- `README.md` - Platform overview and quick start
|
|
21
|
+
- `LICENSE.md` - Legal terms and conditions
|
|
22
|
+
- `SECURITY.md` - Security policy and vulnerability reporting
|
|
23
|
+
- `CLAUDE.md` - Claude Code instructions
|
|
24
|
+
- `AGENTS.md` - AI agent coordination and rules
|
|
25
|
+
|
|
26
|
+
All other markdown and text files will be moved to appropriate dimension directories.
|
|
27
|
+
|
|
28
|
+
## Classification Logic
|
|
29
|
+
|
|
30
|
+
The hook uses intelligent pattern matching to classify files:
|
|
31
|
+
|
|
32
|
+
### Groups Dimension
|
|
33
|
+
**Keywords:** group, organization, org-, team, community, hierarchy
|
|
34
|
+
**Examples:** `team-structure.md`, `organization-chart.md`
|
|
35
|
+
|
|
36
|
+
### People Dimension
|
|
37
|
+
**Keywords:** role, user, people, governance, authorization, auth, permission
|
|
38
|
+
**Examples:** `user-roles.md`, `governance-model.md`
|
|
39
|
+
|
|
40
|
+
### Things Dimension
|
|
41
|
+
**Keywords:** spec, plan, component, agent, feature, implementation, design, blueprint
|
|
42
|
+
**Examples:** `feature-spec.md`, `agent-clean.md`, `component-design.md`
|
|
43
|
+
|
|
44
|
+
### Connections Dimension
|
|
45
|
+
**Keywords:** protocol, workflow, integration, connection, api, sync, communication
|
|
46
|
+
**Examples:** `api-integration.md`, `workflow-automation.md`
|
|
47
|
+
|
|
48
|
+
### Events Dimension
|
|
49
|
+
**Keywords:** deploy, release, report, audit, summary, event, log, history, status
|
|
50
|
+
**Examples:** `deployment-report.md`, `audit-summary.md`, `release-notes.md`
|
|
51
|
+
|
|
52
|
+
### Knowledge Dimension
|
|
53
|
+
**Keywords:** guide, pattern, rule, architecture, knowledge, best-practice, convention
|
|
54
|
+
**Examples:** `architecture-guide.md`, `best-practices.md`, `patterns.md`
|
|
55
|
+
|
|
56
|
+
**Default:** Files that don't match any pattern are moved to `events/` as general reports.
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
### Manual Execution
|
|
61
|
+
```bash
|
|
62
|
+
python3 .claude/hooks/root-cleanup.py
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Automatic Execution
|
|
66
|
+
The hook runs automatically:
|
|
67
|
+
- When triggered by Claude Code workflows
|
|
68
|
+
- During release processes
|
|
69
|
+
- As part of git pre-commit hooks (if configured)
|
|
70
|
+
|
|
71
|
+
## Features
|
|
72
|
+
|
|
73
|
+
### 1. Intelligent Classification
|
|
74
|
+
Uses filename pattern matching and content preview (first 500 chars) to determine the best dimension for each file.
|
|
75
|
+
|
|
76
|
+
### 2. Duplicate Handling
|
|
77
|
+
If a file with the same name already exists in the target directory, the hook appends a numeric suffix (`_1`, `_2`, etc.) to avoid conflicts.
|
|
78
|
+
|
|
79
|
+
### 3. Installation Folder Protection
|
|
80
|
+
The hook automatically ignores installation-specific folders:
|
|
81
|
+
- Standard folders: `web/`, `backend/`, `apps/`, `cli/`, `scripts/`, `node_modules/`
|
|
82
|
+
- Installation folders: `one-inc/`, `nine-padel/`, `onei-ie/`, `one.ie/`
|
|
83
|
+
|
|
84
|
+
### 4. Detailed Reporting
|
|
85
|
+
After execution, the hook provides:
|
|
86
|
+
- Count of files moved per dimension
|
|
87
|
+
- Reason for each classification
|
|
88
|
+
- List of approved files kept in root
|
|
89
|
+
- Summary of the 6-dimension structure
|
|
90
|
+
|
|
91
|
+
## Example Output
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
======================================================================
|
|
95
|
+
๐งน ROOT CLEANUP - 6-Dimension Ontology Alignment
|
|
96
|
+
======================================================================
|
|
97
|
+
|
|
98
|
+
โ
Moved 8 files to dimension directories:
|
|
99
|
+
|
|
100
|
+
๐ /one/things/ (4 files)
|
|
101
|
+
โข ALIGNMENT_AUDIT_QUALITY_AGENT.md
|
|
102
|
+
โโ Thing/entity specification
|
|
103
|
+
โข IMPLEMENTATION_STATUS.md
|
|
104
|
+
โโ Thing/entity specification
|
|
105
|
+
|
|
106
|
+
๐ /one/events/ (4 files)
|
|
107
|
+
โข ALIGNMENT_SUMMARY.md
|
|
108
|
+
โโ Event/report content
|
|
109
|
+
โข AUDIT-ONTOLOGY-ALIGNMENT.md
|
|
110
|
+
โโ Event/report content
|
|
111
|
+
|
|
112
|
+
โ
Kept 5 essential files in root:
|
|
113
|
+
โข AGENTS.md
|
|
114
|
+
โข CLAUDE.md
|
|
115
|
+
โข LICENSE.md
|
|
116
|
+
โข README.md
|
|
117
|
+
โข SECURITY.md
|
|
118
|
+
|
|
119
|
+
======================================================================
|
|
120
|
+
๐ Approved root files: README.md, LICENSE.md, SECURITY.md,
|
|
121
|
+
CLAUDE.md, AGENTS.md
|
|
122
|
+
|
|
123
|
+
๐ 6 Dimensions: groups, people, things, connections, events, knowledge
|
|
124
|
+
======================================================================
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Testing
|
|
128
|
+
|
|
129
|
+
The hook includes comprehensive classification tests:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Test classification logic
|
|
133
|
+
python3 -c "
|
|
134
|
+
exec(open('.claude/hooks/root-cleanup.py').read())
|
|
135
|
+
test_files = [
|
|
136
|
+
('team-structure.md', 'groups'),
|
|
137
|
+
('user-roles.md', 'people'),
|
|
138
|
+
('feature-spec.md', 'things'),
|
|
139
|
+
('api-integration.md', 'connections'),
|
|
140
|
+
('deployment-report.md', 'events'),
|
|
141
|
+
('architecture-guide.md', 'knowledge'),
|
|
142
|
+
]
|
|
143
|
+
for filename, expected in test_files:
|
|
144
|
+
dim, reason = classify_file(filename)
|
|
145
|
+
print(f'{filename} โ {dim} (expected: {expected})')
|
|
146
|
+
"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Benefits
|
|
150
|
+
|
|
151
|
+
1. **Consistent Organization** - All documentation follows the 6-dimension ontology
|
|
152
|
+
2. **Clean Root** - Only essential files remain in root directory
|
|
153
|
+
3. **Automatic Classification** - No manual sorting required
|
|
154
|
+
4. **Safe Operations** - Protects approved files and installation folders
|
|
155
|
+
5. **Clear Reporting** - Understand what was moved and why
|
|
156
|
+
6. **Ontology Compliance** - Enforces architectural standards
|
|
157
|
+
|
|
158
|
+
## Maintenance
|
|
159
|
+
|
|
160
|
+
### Adding New Keywords
|
|
161
|
+
Edit the `classify_file()` function to add new classification patterns:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
# Add new keywords for a dimension
|
|
165
|
+
if any(word in lower for word in ["existing", "keywords", "new_keyword"]):
|
|
166
|
+
return ("dimension", "Reason for classification")
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Updating Approved Files
|
|
170
|
+
Modify the `ALLOWED_ROOT_FILES` set:
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
ALLOWED_ROOT_FILES = {
|
|
174
|
+
"README.md",
|
|
175
|
+
"LICENSE.md",
|
|
176
|
+
# Add new approved files here
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Adding Installation Folders
|
|
181
|
+
Update the `INSTALLATION_FOLDERS` set:
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
INSTALLATION_FOLDERS = {
|
|
185
|
+
"web", "backend",
|
|
186
|
+
# Add new installation folders here
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Related Documentation
|
|
191
|
+
|
|
192
|
+
- `/one/knowledge/ontology.md` - Complete 6-dimension ontology specification
|
|
193
|
+
- `CLAUDE.md` - Root directory file policy
|
|
194
|
+
- `.claude/hooks/` - Other automation hooks
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
**Version:** 2.0.0 (6-Dimension Aligned)
|
|
199
|
+
**Last Updated:** 2025-11-03
|
|
200
|
+
**Maintainer:** Clean Agent
|