oneie 3.0.3 → 3.3.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.
@@ -0,0 +1,440 @@
1
+ # Installation Folders Workflow Integration
2
+
3
+ **Status:** ✅ Complete
4
+ **Version:** 1.0.0
5
+ **Date:** 2025-10-16
6
+ **Type:** Workflow Enhancement
7
+
8
+ ## Summary
9
+
10
+ Successfully integrated installation folder architecture into the complete ONE Platform workflow system. All agents now support hierarchical file resolution with installation-specific and group-specific documentation.
11
+
12
+ ## Changes Made
13
+
14
+ ### 1. CLAUDE.md - Development Workflow Updated
15
+
16
+ **Changed:** Development Workflow from 6-Phase to **7-Phase Process**
17
+
18
+ **Phase 0 Added: CHECK INSTALLATION FOLDER**
19
+
20
+ ```bash
21
+ # New first step before all development work
22
+ if [ -d "/${INSTALLATION_NAME}" ]; then
23
+ echo "✅ Installation folder detected"
24
+ # Use hierarchical file resolution
25
+ fi
26
+ ```
27
+
28
+ **File Resolution Priority Documented:**
29
+ 1. `/<installation-name>/groups/<group-path>/<file>` (group-specific)
30
+ 2. `/<installation-name>/<file>` (installation-wide)
31
+ 3. `/one/<file>` (global template)
32
+
33
+ **Updated Phases:**
34
+ - **Phase 0:** Check installation folder (NEW)
35
+ - **Phase 1:** Understand (with installation folder awareness)
36
+ - **Phase 2:** Map to ontology (with group-specific docs check)
37
+ - **Phase 3:** Design services
38
+ - **Phase 4:** Implement backend
39
+ - **Phase 5:** Build frontend
40
+ - **Phase 6:** Test & document (with installation-specific documentation)
41
+
42
+ **Key Additions:**
43
+ - Check for custom `things/vision.md` in installation folder
44
+ - Look for group-specific `groups/<group-name>/` docs
45
+ - Decide if feature needs installation-specific documentation
46
+ - Test file resolution with installation folder
47
+
48
+ ### 2. .claude/agents/agent-director.md - Ontology Guardian Updated
49
+
50
+ **Added: Installation Folders Section**
51
+
52
+ **Critical check before ALL validation:**
53
+ ```bash
54
+ if [ -n "$INSTALLATION_NAME" ] && [ -d "/${INSTALLATION_NAME}" ]; then
55
+ # Installation folder detected - use hierarchical file resolution
56
+ fi
57
+ ```
58
+
59
+ **Key Questions When Validating:**
60
+ - Does this feature need installation-specific documentation?
61
+ - Are there group-specific requirements in `/<installation-name>/groups/`?
62
+ - Should the plan be documented in global `/one/` or installation folder?
63
+
64
+ **Usage Guidelines:**
65
+ - **Global features** → Document in `/one/things/plans/`
66
+ - **Installation-specific features** → Document in `/<installation-name>/things/plans/`
67
+ - **Group-specific features** → Document in `/<installation-name>/groups/<group-slug>/`
68
+
69
+ ### 3. .claude/agents/agent-documenter.md - Documentation Writer Updated
70
+
71
+ **Added: Installation Folders Section**
72
+
73
+ **Decision Logic for Documentation Placement:**
74
+
75
+ ```
76
+ Is feature used by ALL installations?
77
+ → YES: Write to /one/things/features/ (global)
78
+ → NO: Installation-specific?
79
+ → YES: Write to /<installation-name>/things/features/
80
+ → NO: Group-specific?
81
+ → YES: Write to /<installation-name>/groups/<group-slug>/
82
+ ```
83
+
84
+ **Scope Indicators:**
85
+ - **Global:** Feature modifies core schema, adds new thing types, used by all
86
+ - **Installation:** Feature uses custom properties, org-specific workflow
87
+ - **Group:** Feature only applies to one team/department
88
+
89
+ **Updated Workflow:**
90
+ 1. Determine scope (global/installation/group)
91
+ 2. Write to appropriate location
92
+ 3. Add scope metadata to documentation
93
+ 4. Note installation folder in knowledge entries
94
+
95
+ **Updated Template:**
96
+ ```markdown
97
+ # Feature N-M: [Name]
98
+
99
+ **Scope:** [Global | Installation: <name> | Group: <installation>/<group-slug>]
100
+ ```
101
+
102
+ ## Integration Points
103
+
104
+ ### 1. File Resolution Throughout Workflow
105
+
106
+ **All agents now follow hierarchical resolution:**
107
+
108
+ ```typescript
109
+ async function resolveFile(relativePath: string, groupId?: Id<"groups">) {
110
+ const installationName = process.env.INSTALLATION_NAME;
111
+
112
+ if (groupId && installationName) {
113
+ // 1. Check group-specific
114
+ const groupPath = await getGroupPath(groupId);
115
+ const groupFile = `/${installationName}/groups/${groupPath}/${relativePath}`;
116
+ if (fileExists(groupFile)) return groupFile;
117
+
118
+ // 2. Walk up parent groups
119
+ // ... parent resolution logic
120
+ }
121
+
122
+ if (installationName) {
123
+ // 3. Check installation root
124
+ const installFile = `/${installationName}/${relativePath}`;
125
+ if (fileExists(installFile)) return installFile;
126
+ }
127
+
128
+ // 4. Global fallback
129
+ return `/one/${relativePath}`;
130
+ }
131
+ ```
132
+
133
+ ### 2. Documentation Routing
134
+
135
+ **Agents now route documentation based on feature scope:**
136
+
137
+ | Feature Type | Documentation Location | Example |
138
+ |--------------|----------------------|---------|
139
+ | Core platform feature | `/one/things/features/` | Entity CRUD operations |
140
+ | Installation-specific | `/<installation>/things/features/` | Custom approval workflow |
141
+ | Group-specific | `/<installation>/groups/<slug>/` | Engineering team practices |
142
+
143
+ ### 3. Ontology Validation
144
+
145
+ **Director validates against installation context:**
146
+
147
+ ```typescript
148
+ // Before validation
149
+ const installationName = process.env.INSTALLATION_NAME;
150
+ const ontologyDocs = installationName
151
+ ? await resolveFile('knowledge/ontology.md', groupId)
152
+ : '/one/knowledge/ontology.md';
153
+
154
+ // Load installation-specific ontology extensions
155
+ const customRules = installationName
156
+ ? await resolveFile('knowledge/rules.md', groupId)
157
+ : null;
158
+ ```
159
+
160
+ ### 4. Knowledge Dimension Updates
161
+
162
+ **Documenter creates installation-aware knowledge entries:**
163
+
164
+ ```typescript
165
+ await ctx.db.insert("knowledge", {
166
+ knowledgeType: "document",
167
+ text: documentationMarkdown,
168
+ labels: [
169
+ "feature:name",
170
+ installationName ? `installation:${installationName}` : "scope:global",
171
+ groupId ? `group:${groupSlug}` : null,
172
+ ].filter(Boolean),
173
+ metadata: {
174
+ scope: installationName ? "installation" : "global",
175
+ installationName: installationName || null,
176
+ groupId: groupId || null,
177
+ }
178
+ });
179
+ ```
180
+
181
+ ## Workflow Examples
182
+
183
+ ### Example 1: Global Feature (Course Platform)
184
+
185
+ ```
186
+ 1. Agent-Director validates idea
187
+ - Reads /one/knowledge/ontology.md (no installation override)
188
+ - Creates plan in /one/things/plans/2-course-platform.md
189
+
190
+ 2. Specialist implements feature
191
+ - Reads /one/connections/patterns.md
192
+ - Implements using global patterns
193
+
194
+ 3. Agent-Documenter writes docs
195
+ - Determines scope: Global (used by all installations)
196
+ - Writes to /one/things/features/2-1-course-crud.md
197
+ - Labels: ["scope:global", "feature:course_crud"]
198
+ ```
199
+
200
+ ### Example 2: Installation-Specific Feature (Acme Custom Approval)
201
+
202
+ ```
203
+ 1. Agent-Director validates idea
204
+ - Reads /acme/knowledge/rules.md (custom approval rules)
205
+ - Creates plan in /acme/things/plans/custom-approval-flow.md
206
+
207
+ 2. Specialist implements feature
208
+ - Reads /acme/connections/patterns.md (custom patterns)
209
+ - Implements using Acme-specific workflow
210
+
211
+ 3. Agent-Documenter writes docs
212
+ - Determines scope: Installation-specific (Acme only)
213
+ - Writes to /acme/things/features/custom-approval.md
214
+ - Labels: ["installation:acme", "feature:approval_flow"]
215
+ ```
216
+
217
+ ### Example 3: Group-Specific Feature (Engineering Team Sprint Guide)
218
+
219
+ ```
220
+ 1. Agent-Director validates idea
221
+ - Reads /acme/groups/engineering/practices.md
222
+ - Creates plan in /acme/groups/engineering/sprint-process.md
223
+
224
+ 2. Specialist implements feature
225
+ - Reads /acme/groups/engineering/workflows/
226
+ - Implements engineering-specific process
227
+
228
+ 3. Agent-Documenter writes docs
229
+ - Determines scope: Group-specific (engineering team only)
230
+ - Writes to /acme/groups/engineering/sprint-guide.md
231
+ - Labels: ["installation:acme", "group:engineering", "topic:agile"]
232
+ ```
233
+
234
+ ## Agent Coordination
235
+
236
+ ### Event-Driven Coordination with Installation Context
237
+
238
+ All events now include installation context:
239
+
240
+ ```typescript
241
+ // Director emits idea_validated
242
+ {
243
+ type: "idea_validated",
244
+ actorId: directorId,
245
+ targetId: ideaId,
246
+ metadata: {
247
+ installationName: "acme" || null,
248
+ groupId: engineeringGroupId || null,
249
+ scope: "installation" | "group" | "global",
250
+ planLocation: "/acme/things/plans/custom-feature.md"
251
+ }
252
+ }
253
+
254
+ // Documenter emits documentation_complete
255
+ {
256
+ type: "documentation_complete",
257
+ actorId: documenterId,
258
+ targetId: featureId,
259
+ metadata: {
260
+ installationName: "acme" || null,
261
+ groupId: engineeringGroupId || null,
262
+ documentPath: "/acme/things/features/custom-feature.md",
263
+ scope: "installation"
264
+ }
265
+ }
266
+ ```
267
+
268
+ ## Migration Guide
269
+
270
+ ### For Existing Agents
271
+
272
+ **Before (Old Workflow):**
273
+ ```typescript
274
+ // Agent reads global docs only
275
+ const ontologyDocs = '/one/knowledge/ontology.md';
276
+ const rulesDoc = '/one/knowledge/rules.md';
277
+ ```
278
+
279
+ **After (New Workflow):**
280
+ ```typescript
281
+ // Agent uses hierarchical resolution
282
+ const ontologyDocs = await resolveFile('knowledge/ontology.md', groupId);
283
+ const rulesDoc = await resolveFile('knowledge/rules.md', groupId);
284
+ ```
285
+
286
+ ### For New Features
287
+
288
+ **Always ask these questions:**
289
+
290
+ 1. **Is this feature global or installation-specific?**
291
+ - Global: Used by all installations → Document in `/one/`
292
+ - Installation: Specific to one org → Document in `/<installation>/`
293
+ - Group: Specific to one team → Document in `/<installation>/groups/<slug>/`
294
+
295
+ 2. **Are there existing installation overrides?**
296
+ - Check `/<installation>/knowledge/` for custom rules
297
+ - Check `/<installation>/groups/<slug>/` for team practices
298
+
299
+ 3. **Should this create new installation docs?**
300
+ - If feature adds new workflow, create guide in installation folder
301
+ - If feature uses custom properties, document in installation folder
302
+
303
+ ## Testing
304
+
305
+ ### Test Installation Folder Integration
306
+
307
+ ```bash
308
+ # 1. Create test installation
309
+ npx oneie init
310
+ # Enter: Test Organization, test-org
311
+
312
+ # 2. Create custom vision
313
+ echo "# Test Org Vision" > /test-org/things/vision.md
314
+
315
+ # 3. Test file resolution
316
+ # Should show Test Org Vision, not global
317
+ cat $(resolveFile "things/vision.md")
318
+
319
+ # 4. Create group-specific doc
320
+ mkdir -p /test-org/groups/engineering
321
+ echo "# Engineering Practices" > /test-org/groups/engineering/practices.md
322
+
323
+ # 5. Test group resolution
324
+ # Should show Engineering Practices
325
+ cat $(resolveFile "practices.md" --group="engineering")
326
+ ```
327
+
328
+ ## Success Criteria
329
+
330
+ - ✅ **7-phase workflow documented** in CLAUDE.md
331
+ - ✅ **Agent-Director aware** of installation folders
332
+ - ✅ **Agent-Documenter routes** docs based on scope
333
+ - ✅ **File resolution hierarchical** across all agents
334
+ - ✅ **Events include** installation context
335
+ - ✅ **Knowledge entries** tagged with scope
336
+ - ✅ **Backward compatible** with non-installation setups
337
+ - ✅ **Documentation complete** for all workflow changes
338
+
339
+ ## Benefits
340
+
341
+ ### 1. Context-Aware Documentation
342
+
343
+ Agents now understand the difference between:
344
+ - Platform-wide features (everyone uses)
345
+ - Organization-specific features (one company uses)
346
+ - Team-specific features (one department uses)
347
+
348
+ ### 2. Proper Documentation Routing
349
+
350
+ Documentation lands in the right place automatically:
351
+ - No more cluttering `/one/` with org-specific docs
352
+ - Group teams can manage their own documentation
353
+ - Global templates remain clean and universal
354
+
355
+ ### 3. Hierarchical Knowledge
356
+
357
+ Knowledge dimension now captures installation hierarchy:
358
+ - Global knowledge (searchable by all)
359
+ - Installation knowledge (searchable by org members)
360
+ - Group knowledge (searchable by team members)
361
+
362
+ ### 4. Flexible Customization
363
+
364
+ Organizations can:
365
+ - Override global vision with their own
366
+ - Add custom rules in their installation folder
367
+ - Document team-specific practices in group folders
368
+ - All while maintaining global platform coherence
369
+
370
+ ## Future Enhancements
371
+
372
+ ### Phase 2: Multi-Installation Agent Coordination
373
+
374
+ Enable agents to work across multiple installations:
375
+
376
+ ```typescript
377
+ // Query features across installations
378
+ const allFeatures = await queryKnowledge({
379
+ labels: ["feature:*"],
380
+ installations: ["acme", "tesla", "google"],
381
+ scope: "global" // Only show global features
382
+ });
383
+ ```
384
+
385
+ ### Phase 3: Installation-Specific Agent Customization
386
+
387
+ Allow installations to customize agent behavior:
388
+
389
+ ```yaml
390
+ # /acme/.claude/agents/agent-director.md
391
+ # Custom director rules for Acme
392
+ - Require legal approval for all features
393
+ - Enforce HIPAA compliance checks
394
+ - Route medical features to healthcare specialist
395
+ ```
396
+
397
+ ### Phase 4: Cross-Installation Learning
398
+
399
+ Enable agents to learn patterns across installations:
400
+
401
+ ```typescript
402
+ // Find similar patterns across installations
403
+ const similarPatterns = await vectorSearch({
404
+ query: "approval workflow",
405
+ installations: ["acme", "tesla"],
406
+ shareAcrossInstallations: true
407
+ });
408
+ ```
409
+
410
+ ## Files Modified
411
+
412
+ 1. `/Users/toc/Server/ONE/CLAUDE.md`
413
+ - Added Phase 0: CHECK INSTALLATION FOLDER
414
+ - Updated all workflow phases with installation awareness
415
+ - Added installation folder priority to "Critical Reading"
416
+
417
+ 2. `/Users/toc/Server/ONE/.claude/agents/agent-director.md`
418
+ - Added Installation Folders section
419
+ - Updated Core Responsibility with "Groups" terminology
420
+ - Added file resolution priority guidelines
421
+
422
+ 3. `/Users/toc/Server/ONE/.claude/agents/agent-documenter.md`
423
+ - Added Installation Folders section with decision logic
424
+ - Updated Decision 1 with scope determination
425
+ - Updated documentation locations for installation-aware paths
426
+ - Updated feature documentation template with Scope field
427
+
428
+ ## Related Documentation
429
+
430
+ - **Implementation Plan:** `/one/things/plans/group-folder-multi-tenancy.md`
431
+ - **Installation Guide:** `/one/knowledge/installation-folders.md`
432
+ - **CLI Usage:** `cli/src/commands/init.ts`
433
+ - **File Resolver:** `cli/src/utils/file-resolver.ts`
434
+ - **Frontend Integration:** `web/src/lib/utils/file-resolver.ts`
435
+
436
+ ---
437
+
438
+ **Status: ✅ Workflow Integration Complete**
439
+
440
+ All agents now support installation folders with hierarchical file resolution. The 7-phase workflow ensures installation-specific customization while maintaining global platform coherence.