oneie 3.6.18 → 3.6.20

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.
Files changed (36) hide show
  1. package/.claude/agents/agent-ops.md +63 -2
  2. package/.claude/commands/commit.md +95 -0
  3. package/.claude/commands/npx.md +2 -2
  4. package/.claude/commands/one.md +7 -1
  5. package/.claude/commands/push.md +113 -21
  6. package/.claude/commands/release.md +2 -2
  7. package/.claude/hooks/release-cli.sh +195 -0
  8. package/CLAUDE.md +119 -0
  9. package/README.md +778 -497
  10. package/package.json +1 -1
  11. package/.claude/agents/NEWS-QUICKSTART.md +0 -321
  12. package/.claude/agents/NEWS-README.md +0 -353
  13. package/.claude/hooks/README-knowledge-hooks.md +0 -451
  14. package/.claude/hooks/README-root-cleanup.md +0 -200
  15. package/.claude/hooks/README.md +0 -284
  16. package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
  17. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  18. package/.claude/hooks/check-filenames.py +0 -177
  19. package/.claude/hooks/clean-post.py +0 -468
  20. package/.claude/hooks/clean-pre.py +0 -393
  21. package/.claude/hooks/clean-root-markdown.sh +0 -73
  22. package/.claude/hooks/done.py +0 -236
  23. package/.claude/hooks/format-hook.sh +0 -163
  24. package/.claude/hooks/hook-logger.sh +0 -173
  25. package/.claude/hooks/knowledge-post.py +0 -355
  26. package/.claude/hooks/knowledge-pre.py +0 -245
  27. package/.claude/hooks/notification-hook.sh +0 -279
  28. package/.claude/hooks/root-cleanup.py +0 -217
  29. package/.claude/hooks/security-hook.sh +0 -397
  30. package/.claude/hooks/tag-all-docs.py +0 -464
  31. package/.claude/hooks/test-validate-ontology.sh +0 -170
  32. package/.claude/hooks/todo.py +0 -368
  33. package/.claude/hooks/track-changes.sh +0 -101
  34. package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
  35. package/.claude/hooks/validate-ontology-structure.py +0 -518
  36. package/TESTING-ONBOARDING.md +0 -185
@@ -1,284 +0,0 @@
1
- # Claude Code Hooks - ONE Platform
2
-
3
- Hooks for Claude Code that align with the 6-dimension ontology and inference-based execution.
4
-
5
- ## Overview
6
-
7
- The hook system logs all hook executions as EVENTS with full ontology context tracking:
8
- - **Inference number** - Current position in 100-inference sequence
9
- - **Dimension** - Which dimension is being worked on (groups, people, things, connections, events, knowledge)
10
- - **Specialist agent** - Which AI agent is responsible
11
- - **Duration** - Execution time in milliseconds
12
- - **Exit code** - Success or failure status
13
- - **Ontology version** - Version of ontology specification (1.0.0)
14
-
15
- ## Hook Logger (hook-logger.sh)
16
-
17
- Central logging system that all hooks use.
18
-
19
- ### Key Features
20
-
21
- 1. **Ontology-Aware Logging**: Every log entry includes inference number and dimension
22
- 2. **Agent Detection**: Automatically identifies specialist agent from hook name
23
- 3. **Event Tracking**: Logs hook execution as structured EVENTS
24
- 4. **Performance Monitoring**: Warns if hooks take >5 seconds
25
- 5. **Debug Mode**: Optional verbose output to stderr
26
-
27
- ### Environment Variables
28
-
29
- ```bash
30
- # Required
31
- CLAUDE_PROJECT_DIR=/path/to/project # Project root directory
32
-
33
- # Optional
34
- LOG_FILE=$CLAUDE_PROJECT_DIR/.claude/hooks.log # Log file location
35
- DEBUG_MODE=false # Enable verbose logging to stderr
36
- INFERENCE_STATE_FILE=$CLAUDE_PROJECT_DIR/.claude/state/inference.json # Inference state
37
- ONTOLOGY_VERSION=1.0.0 # Ontology specification version
38
- ```
39
-
40
- ### Functions
41
-
42
- #### get_inference_context()
43
- Reads current inference number from `.claude/state/inference.json`.
44
-
45
- ```bash
46
- inference=$(get_inference_context)
47
- # Returns: 0-100 (current inference number)
48
- ```
49
-
50
- #### get_inference_dimension(inference_number)
51
- Maps inference number to ontology dimension based on 100-inference sequence.
52
-
53
- ```bash
54
- dimension=$(get_inference_dimension 15)
55
- # Returns: "things" (inference 11-30 = things dimension)
56
- ```
57
-
58
- **Dimension Mapping:**
59
- - Cycle 1-10: `foundation` (setup and validation)
60
- - Cycle 11-30: `things` (backend schema & frontend components)
61
- - Cycle 31-40: `connections` (integration & relationships)
62
- - Cycle 41-50: `people` (authentication & authorization)
63
- - Cycle 51-60: `knowledge` (RAG & embeddings)
64
- - Cycle 61-70: `quality` (testing & validation)
65
- - Cycle 71-80: `design` (wireframes & UI)
66
- - Cycle 81-90: `events` (performance & optimization)
67
- - Cycle 91-100: `deployment` (deployment & documentation)
68
-
69
- #### get_specialist_agent(hook_name)
70
- Detects specialist agent from hook name patterns.
71
-
72
- ```bash
73
- agent=$(get_specialist_agent "backend-mutation-test")
74
- # Returns: "agent-backend"
75
- ```
76
-
77
- **Agent Detection Patterns:**
78
- - `*backend*|*mutation*|*query*|*schema*` → agent-backend
79
- - `*frontend*|*component*|*page*|*ui*` → agent-frontend
80
- - `*integration*|*webhook*|*sync*` → agent-integrator
81
- - `*test*|*quality*` → agent-quality
82
- - `*design*|*wireframe*` → agent-designer
83
- - `*clean*|*refactor*` → agent-clean
84
- - `*deploy*|*release*` → agent-ops
85
- - `*problem*|*debug*` → agent-problem-solver
86
- - `*document*|*doc*` → agent-documenter
87
- - Default → agent-director
88
-
89
- #### log_message(level, message)
90
- Logs a message with ontology context.
91
-
92
- ```bash
93
- log_message "INFO" "Processing user entities"
94
- # Output: [2025-11-03 21:32:23] [INFO] [Cycle 15] [things] Processing user entities
95
- ```
96
-
97
- #### log_hook_execution(hook_name, command, start_time, end_time, exit_code)
98
- Logs hook execution as a structured EVENT.
99
-
100
- ```bash
101
- start=$(get_time_ms)
102
- # ... execute hook ...
103
- end=$(get_time_ms)
104
- log_hook_execution "backend-mutation" "test" "$start" "$end" 0
105
- ```
106
-
107
- **Output:**
108
- ```
109
- [2025-11-03 21:32:23] [EVENT] hook_executed | hook=backend-mutation | inference=15 | dimension=things | agent=agent-backend | duration=134ms | exit_code=0 | ontology_version=1.0.0
110
- [2025-11-03 21:32:23] [INFO] [Cycle 15] [things] Hook completed successfully: backend-mutation
111
- ```
112
-
113
- #### get_time_ms()
114
- Returns current time in milliseconds (cross-platform).
115
-
116
- ```bash
117
- start=$(get_time_ms)
118
- # Returns: 1762179999000 (Unix timestamp in milliseconds)
119
- ```
120
-
121
- ## Log Format
122
-
123
- ### Standard Log Entry
124
- ```
125
- [timestamp] [level] [Cycle N] [dimension] message
126
- ```
127
-
128
- Example:
129
- ```
130
- [2025-11-03 21:32:23] [INFO] [Cycle 15] [things] Hook completed successfully: backend-mutation
131
- ```
132
-
133
- ### Event Log Entry
134
- ```
135
- [timestamp] [EVENT] hook_executed | hook=name | inference=N | dimension=X | agent=Y | duration=Nms | exit_code=N | ontology_version=X.Y.Z
136
- ```
137
-
138
- Example:
139
- ```
140
- [2025-11-03 21:32:23] [EVENT] hook_executed | hook=backend-mutation | inference=15 | dimension=things | agent=agent-backend | duration=134ms | exit_code=0 | ontology_version=1.0.0
141
- ```
142
-
143
- ## Usage in Hooks
144
-
145
- All hooks should source the logger and use it:
146
-
147
- ```bash
148
- #!/bin/bash
149
-
150
- # Source the logger
151
- source "$CLAUDE_PROJECT_DIR/.claude/hooks/hook-logger.sh"
152
-
153
- # Get start time
154
- start_time=$(get_time_ms)
155
-
156
- # Your hook logic here
157
- log_message "INFO" "Starting hook execution"
158
-
159
- # ... do work ...
160
-
161
- # Log completion
162
- end_time=$(get_time_ms)
163
- log_hook_execution "my-hook" "my-command" "$start_time" "$end_time" $?
164
- ```
165
-
166
- ## Ontology Alignment
167
-
168
- The hook logger aligns with the 6-dimension ontology:
169
-
170
- 1. **EVENTS** - Hook executions are logged as events with:
171
- - `type: hook_executed`
172
- - `actorId: <agent_id>`
173
- - `timestamp: <unix_ms>`
174
- - `metadata: { hook, inference, dimension, agent, duration, exit_code, ontology_version }`
175
-
176
- 2. **PEOPLE** - Agent detection identifies which specialist agent (person role) executed the hook
177
-
178
- 3. **THINGS** - Hooks may operate on things (files, components, schemas)
179
-
180
- 4. **CONNECTIONS** - Integration hooks track connections between systems
181
-
182
- 5. **KNOWLEDGE** - Documentation hooks generate knowledge artifacts
183
-
184
- 6. **GROUPS** - All hooks execute within an organization context
185
-
186
- ## Testing
187
-
188
- Test the logger:
189
-
190
- ```bash
191
- # Test inference context
192
- export CLAUDE_PROJECT_DIR=/path/to/project
193
- source .claude/hooks/hook-logger.sh
194
- get_inference_context
195
- # Should return: 100 (or current inference)
196
-
197
- # Test dimension mapping
198
- get_inference_dimension 15
199
- # Should return: things
200
-
201
- # Test agent detection
202
- get_specialist_agent "backend-mutation-test"
203
- # Should return: agent-backend
204
-
205
- # Test complete execution logging
206
- start=$(get_time_ms)
207
- sleep 0.1
208
- end=$(get_time_ms)
209
- log_hook_execution "test-hook" "test" "$start" "$end" 0
210
- # Check .claude/hooks.log for entries
211
- ```
212
-
213
- ## Monitoring
214
-
215
- View recent hook executions:
216
-
217
- ```bash
218
- # Last 10 entries
219
- tail -n 10 .claude/hooks.log
220
-
221
- # All events
222
- grep "\[EVENT\]" .claude/hooks.log
223
-
224
- # Specific dimension
225
- grep "\[things\]" .claude/hooks.log
226
-
227
- # Specific agent
228
- grep "agent=agent-backend" .claude/hooks.log
229
-
230
- # Performance issues (>5s)
231
- grep "\[WARN\]" .claude/hooks.log
232
-
233
- # Failures
234
- grep "\[ERROR\]" .claude/hooks.log
235
- ```
236
-
237
- ## Best Practices
238
-
239
- 1. **Always use the logger** - Don't write custom logging
240
- 2. **Source at start** - First line should source hook-logger.sh
241
- 3. **Log key steps** - Use log_message for important milestones
242
- 4. **Track timing** - Always measure hook duration
243
- 5. **Handle errors** - Log failures with exit code
244
- 6. **Test locally** - Verify hooks work before committing
245
- 7. **Monitor performance** - Review logs for slow hooks (>5s)
246
- 8. **Use debug mode** - Enable DEBUG_MODE for troubleshooting
247
-
248
- ## Integration with Inference System
249
-
250
- The hook logger integrates with the inference-based execution system:
251
-
252
- 1. Reads current inference from `.claude/state/inference.json`
253
- 2. Maps inference to dimension (based on 100-inference sequence in `one/knowledge/todo.md`)
254
- 3. Logs all hook executions with full context
255
- 4. Enables tracking of which dimensions are being worked on
256
- 5. Provides audit trail for entire feature development
257
-
258
- ## Version History
259
-
260
- - **1.0.0** (2025-11-03) - Initial release with 6-dimension ontology alignment
261
- - Inference context tracking
262
- - Dimension mapping (foundation → deployment)
263
- - Agent detection (9 specialist agents)
264
- - Event logging with structured metadata
265
- - Performance monitoring (>5s warnings)
266
- - Cross-platform time measurement (macOS + Linux)
267
- - Debug mode support
268
-
269
- ## Files
270
-
271
- - `hook-logger.sh` - Core logging functions (173 lines)
272
- - `hooks.log` - Log file (generated)
273
- - `README.md` - This documentation
274
-
275
- ## References
276
-
277
- - **6-Dimension Ontology**: `/one/knowledge/ontology.md`
278
- - **100-Inference Sequence**: `/one/knowledge/todo.md`
279
- - **Agent Definitions**: `/.claude/agents/`
280
- - **Inference State**: `/.claude/state/inference.json`
281
-
282
- ---
283
-
284
- **Built with clarity, simplicity, and ontology alignment in mind.**
@@ -1,177 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Check for files that don't follow kebab-case naming and validate 6-dimension ontology structure.
4
-
5
- The 6-Dimension Ontology:
6
- - groups: Hierarchical containers for collaboration
7
- - people: Authorization & governance
8
- - things: All entities (users, agents, content, etc.)
9
- - connections: All relationships between entities
10
- - events: All actions and state changes
11
- - knowledge: Labels, embeddings, and semantic search
12
- """
13
- import os
14
- import re
15
- from pathlib import Path
16
-
17
- # Valid ontology dimensions
18
- VALID_DIMENSIONS = {'groups', 'people', 'things', 'connections', 'events', 'knowledge'}
19
-
20
- # Core infrastructure directories to skip
21
- SKIP_DIRS = {'.git', '.obsidian', '.claude', 'node_modules', '.vscode', '.github'}
22
-
23
- # Pattern for kebab-case filenames
24
- KEBAB_CASE_PATTERN = re.compile(r'^[a-z0-9]+(-[a-z0-9]+)*\.(md|yaml|yml|json)$')
25
-
26
- # Pattern for valid installation folder names (lowercase, hyphens allowed, no spaces)
27
- INSTALLATION_PATTERN = re.compile(r'^[a-z0-9]+(-[a-z0-9]+)*$')
28
-
29
- def is_installation_folder(path):
30
- """Check if a directory looks like an installation folder (not infrastructure)."""
31
- name = os.path.basename(path)
32
-
33
- # Skip core infrastructure
34
- if name in {'web', 'backend', 'apps', 'cli', 'scripts', 'docs', 'media', 'import', 'one'}:
35
- return False
36
- if name in SKIP_DIRS:
37
- return False
38
-
39
- # Check if it matches installation naming pattern
40
- return INSTALLATION_PATTERN.match(name) is not None
41
-
42
- def validate_ontology_structure(one_dir):
43
- """Validate that /one/<dimension>/ follows the 6-dimension ontology."""
44
- errors = []
45
-
46
- if not os.path.exists(one_dir):
47
- return []
48
-
49
- # Check for invalid dimension directories
50
- for item in os.listdir(one_dir):
51
- item_path = os.path.join(one_dir, item)
52
- if os.path.isdir(item_path) and item not in SKIP_DIRS:
53
- if item not in VALID_DIMENSIONS:
54
- errors.append({
55
- 'type': 'invalid_dimension',
56
- 'path': item_path,
57
- 'dimension': item,
58
- 'message': f"Invalid dimension '{item}'. Must be one of: {', '.join(sorted(VALID_DIMENSIONS))}"
59
- })
60
-
61
- return errors
62
-
63
- def check_filenames(root_dir):
64
- """Check filenames in /one/ and installation folders."""
65
- invalid_files = []
66
-
67
- # Check /one/ directory
68
- one_dir = os.path.join(root_dir, "one")
69
- if os.path.exists(one_dir):
70
- for root, dirs, files in os.walk(one_dir):
71
- # Skip infrastructure directories
72
- dirs[:] = [d for d in dirs if d not in SKIP_DIRS]
73
-
74
- for filename in files:
75
- if filename.endswith(('.md', '.yaml', '.yml', '.json')):
76
- if not KEBAB_CASE_PATTERN.match(filename):
77
- filepath = os.path.join(root, filename)
78
- # Get relative path for clearer output
79
- rel_path = os.path.relpath(filepath, root_dir)
80
-
81
- # Suggest kebab-case name
82
- suggested = filename.lower()
83
- suggested = re.sub(r'[^a-z0-9.]+', '-', suggested)
84
- suggested = re.sub(r'-+', '-', suggested)
85
- suggested = re.sub(r'^-|-$', '', suggested)
86
-
87
- invalid_files.append({
88
- 'type': 'invalid_filename',
89
- 'path': rel_path,
90
- 'filename': filename,
91
- 'suggested': suggested,
92
- 'location': 'ontology'
93
- })
94
-
95
- # Check installation folders at root level
96
- for item in os.listdir(root_dir):
97
- item_path = os.path.join(root_dir, item)
98
- if os.path.isdir(item_path) and is_installation_folder(item_path):
99
- # Found an installation folder - check its files
100
- for root, dirs, files in os.walk(item_path):
101
- # Skip infrastructure directories
102
- dirs[:] = [d for d in dirs if d not in SKIP_DIRS]
103
-
104
- for filename in files:
105
- if filename.endswith(('.md', '.yaml', '.yml', '.json')):
106
- if not KEBAB_CASE_PATTERN.match(filename):
107
- filepath = os.path.join(root, filename)
108
- rel_path = os.path.relpath(filepath, root_dir)
109
-
110
- # Suggest kebab-case name
111
- suggested = filename.lower()
112
- suggested = re.sub(r'[^a-z0-9.]+', '-', suggested)
113
- suggested = re.sub(r'-+', '-', suggested)
114
- suggested = re.sub(r'^-|-$', '', suggested)
115
-
116
- invalid_files.append({
117
- 'type': 'invalid_filename',
118
- 'path': rel_path,
119
- 'filename': filename,
120
- 'suggested': suggested,
121
- 'location': f'installation: {item}'
122
- })
123
-
124
- return invalid_files
125
-
126
- def main():
127
- root_dir = Path(__file__).parent.parent.parent # Go up from .claude/hooks/
128
-
129
- print("🔍 Checking 6-Dimension Ontology Structure and File Naming...\n")
130
-
131
- # Validate ontology dimensions
132
- one_dir = os.path.join(root_dir, "one")
133
- ontology_errors = validate_ontology_structure(one_dir)
134
-
135
- # Check filenames
136
- filename_errors = check_filenames(root_dir)
137
-
138
- # Report results
139
- has_errors = False
140
-
141
- if ontology_errors:
142
- has_errors = True
143
- print(f"❌ Found {len(ontology_errors)} ontology structure errors:\n")
144
- for error in ontology_errors:
145
- print(f" {error['path']}")
146
- print(f" {error['message']}")
147
- print(f" Valid dimensions: groups, people, things, connections, events, knowledge\n")
148
-
149
- if filename_errors:
150
- has_errors = True
151
- print(f"❌ Found {len(filename_errors)} files with invalid naming:\n")
152
- for item in filename_errors:
153
- print(f" {item['path']}")
154
- print(f" Current: {item['filename']}")
155
- print(f" Suggested: {item['suggested']}")
156
- print(f" Location: {item['location']}")
157
- print()
158
-
159
- if not has_errors:
160
- print("✅ All files follow kebab-case naming convention!")
161
- print("✅ Ontology structure is valid!")
162
- print()
163
- print("6-Dimension Ontology:")
164
- print(" • groups: Hierarchical containers for collaboration")
165
- print(" • people: Authorization & governance")
166
- print(" • things: All entities (users, agents, content)")
167
- print(" • connections: All relationships between entities")
168
- print(" • events: All actions and state changes")
169
- print(" • knowledge: Labels, embeddings, and semantic search")
170
- else:
171
- print("\n📚 Reference: See /one/knowledge/ontology.md for the complete specification")
172
- return 1
173
-
174
- return 0
175
-
176
- if __name__ == "__main__":
177
- exit(main())