oneie 3.6.4 → 3.6.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/.claude/commands/one copy.md +565 -0
- package/.claude/hooks/README-knowledge-hooks.md +265 -0
- package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/check-filenames.py +40 -0
- package/.claude/hooks/clean-post.py +301 -0
- package/.claude/hooks/clean-pre.py +308 -0
- package/.claude/hooks/done.py +175 -0
- package/.claude/hooks/format-hook.sh +75 -0
- package/.claude/hooks/hook-logger.sh +59 -0
- package/.claude/hooks/knowledge-post.py +251 -0
- package/.claude/hooks/knowledge-pre.py +150 -0
- package/.claude/hooks/notification-hook.sh +112 -0
- package/.claude/hooks/security-hook.sh +157 -0
- package/.claude/hooks/tag-all-docs.py +338 -0
- package/.claude/hooks/todo.py +298 -0
- package/.claude/hooks/validate-ontology-structure.py +455 -0
- package/.claude/skills/astro/add-content-collection.md +30 -0
- package/.claude/skills/astro/check-build.md +29 -0
- package/.claude/skills/astro/create-component.md +29 -0
- package/.claude/skills/astro/create-page.md +30 -0
- package/.claude/skills/astro/optimize-performance.md +21 -0
- package/.claude/skills/convex/check-deployment.md +46 -0
- package/.claude/skills/convex/create-mutation.md +405 -0
- package/.claude/skills/convex/create-query.md +52 -0
- package/.claude/skills/convex/read-schema.md +373 -0
- package/.claude/skills/convex/test-function.md +50 -0
- package/.claude/skills/deployment/check-deployment-health.md +20 -0
- package/.claude/skills/deployment/create-release.md +21 -0
- package/.claude/skills/deployment/deploy-cloudflare.md +31 -0
- package/.claude/skills/deployment/deploy-convex.md +30 -0
- package/.claude/skills/deployment/sync-repositories.md +19 -0
- package/.claude/skills/design/check-accessibility.md +21 -0
- package/.claude/skills/design/create-component-spec.md +27 -0
- package/.claude/skills/design/generate-design-tokens.md +24 -0
- package/.claude/skills/design/generate-wireframe.md +30 -0
- package/.claude/skills/documentation/create-migration-guide.md +20 -0
- package/.claude/skills/documentation/generate-api-docs.md +27 -0
- package/.claude/skills/documentation/generate-readme.md +22 -0
- package/.claude/skills/documentation/update-knowledge.md +20 -0
- package/.claude/skills/integration/connect-external-system.md +21 -0
- package/.claude/skills/integration/implement-a2a.md +20 -0
- package/.claude/skills/integration/implement-acp.md +20 -0
- package/.claude/skills/integration/verify-integration.md +20 -0
- package/.claude/skills/ontology/README.md +255 -0
- package/.claude/skills/ontology/check-dimension.md +307 -0
- package/.claude/skills/ontology/generate-entity-type.md +339 -0
- package/.claude/skills/ontology/validate-schema.md +229 -0
- package/.claude/skills/ontology/verify-relationships.md +310 -0
- package/.claude/skills/problem-solving/analyze-test-failure.md +21 -0
- package/.claude/skills/problem-solving/identify-root-cause.md +20 -0
- package/.claude/skills/problem-solving/propose-solution.md +29 -0
- package/.claude/skills/problem-solving/verify-fix.md +21 -0
- package/.claude/skills/sales/generate-demo-script.md +21 -0
- package/.claude/skills/sales/qualify-lead.md +30 -0
- package/.claude/skills/sales/track-trial.md +20 -0
- package/.claude/skills/sales/verify-kyc.md +20 -0
- package/.claude/skills/testing/analyze-coverage.md +24 -0
- package/.claude/skills/testing/generate-tests.md +24 -0
- package/.claude/skills/testing/run-tests.md +27 -0
- package/.claude/skills/testing/validate-e2e.md +25 -0
- package/.mcp.json +30 -3
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +13 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/utils/installation-setup.d.ts.map +1 -1
- package/dist/utils/installation-setup.js +9 -0
- package/dist/utils/installation-setup.js.map +1 -1
- package/dist/utils/launch-claude.d.ts +3 -2
- package/dist/utils/launch-claude.d.ts.map +1 -1
- package/dist/utils/launch-claude.js +64 -29
- package/dist/utils/launch-claude.js.map +1 -1
- package/one/.obsidian/workspace.json +22 -22
- package/one/events/CREATE-WEBSITE.md +442 -0
- package/one/events/CUSTOM-DOMAIN.md +357 -0
- package/one/events/DEPLOYMENT copy.md +426 -0
- package/one/events/ECOMMERCE-BEFORE-AFTER.md +251 -0
- package/one/events/ECOMMERCE-ENHANCEMENTS.md +576 -0
- package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +421 -0
- package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +196 -0
- package/one/events/ECOMMERCE-SETUP-SUMMARY.md +396 -0
- package/one/events/INSTALLATION_FOLDERS.md +516 -0
- package/one/events/INSTALLATION_FOLDERS_FILES.md +205 -0
- package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +419 -0
- package/one/events/LICENSE.md +89 -0
- package/one/events/MCP-CONFIGURATION.md +336 -0
- package/one/events/MCP-SETUP-COMPLETE.md +205 -0
- package/one/events/NODE-UPGRADE.md +111 -0
- package/one/events/PACKAGE-STRUCTURE.md +310 -0
- package/one/events/PLAYBOOK-SETUP-SUMMARY.md +331 -0
- package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +567 -0
- package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +262 -0
- package/one/events/STRIPE-INTEGRATION.md +414 -0
- package/one/events/STRIPE-SETUP-GUIDE.md +462 -0
- package/one/events/TRANSPARENCY-FIXES.md +275 -0
- package/package.json +4 -2
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
ONE Platform - Metadata Tagging Script
|
|
4
|
+
Applies metadata tags to all documentation files.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python3 .claude/hooks/tag-all-docs.py [--dry-run] [--verbose]
|
|
8
|
+
|
|
9
|
+
This script:
|
|
10
|
+
- Scans all markdown files in one/ directory
|
|
11
|
+
- Adds metadata frontmatter if missing
|
|
12
|
+
- Infers dimension, category, and tags from file location and content
|
|
13
|
+
- Updates existing metadata if incomplete
|
|
14
|
+
- Generates a comprehensive report
|
|
15
|
+
"""
|
|
16
|
+
import argparse
|
|
17
|
+
import re
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from datetime import datetime
|
|
20
|
+
from typing import Dict, List, Tuple, Optional
|
|
21
|
+
import sys
|
|
22
|
+
|
|
23
|
+
# Dimension inference from directory structure
|
|
24
|
+
DIMENSION_MAP = {
|
|
25
|
+
"groups": "groups",
|
|
26
|
+
"people": "people",
|
|
27
|
+
"things": "things",
|
|
28
|
+
"connections": "connections",
|
|
29
|
+
"events": "events",
|
|
30
|
+
"knowledge": "knowledge",
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Category inference from subdirectories
|
|
34
|
+
CATEGORY_MAP = {
|
|
35
|
+
"agents": "agents",
|
|
36
|
+
"plans": "plans",
|
|
37
|
+
"products": "products",
|
|
38
|
+
"features": "features",
|
|
39
|
+
"components": "components",
|
|
40
|
+
"examples": "examples",
|
|
41
|
+
"claude": "agents",
|
|
42
|
+
"protocols": "protocols",
|
|
43
|
+
"workflows": "workflows",
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Tag suggestions based on keywords in content
|
|
47
|
+
TAG_KEYWORDS = {
|
|
48
|
+
"ai": ["ai", "artificial-intelligence", "machine-learning"],
|
|
49
|
+
"agent": ["intelligence-agent", "ai-agent", "automation"],
|
|
50
|
+
"ontology": ["ontology", "data-model", "schema"],
|
|
51
|
+
"protocol": ["protocol", "specification", "interoperability"],
|
|
52
|
+
"architecture": ["architecture", "system-design", "patterns"],
|
|
53
|
+
"frontend": ["frontend", "ui", "components", "react"],
|
|
54
|
+
"backend": ["backend", "convex", "database", "services"],
|
|
55
|
+
"blockchain": ["blockchain", "crypto", "web3", "sui", "solana"],
|
|
56
|
+
"authentication": ["auth", "authentication", "authorization", "rbac"],
|
|
57
|
+
"testing": ["testing", "quality", "validation", "e2e"],
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class MetadataTagger:
|
|
62
|
+
def __init__(self, project_dir: str, dry_run: bool = False, verbose: bool = False):
|
|
63
|
+
self.project_dir = Path(project_dir)
|
|
64
|
+
self.dry_run = dry_run
|
|
65
|
+
self.verbose = verbose
|
|
66
|
+
self.files_processed = 0
|
|
67
|
+
self.files_tagged = 0
|
|
68
|
+
self.files_updated = 0
|
|
69
|
+
self.files_skipped = 0
|
|
70
|
+
|
|
71
|
+
def scan_and_tag_all(self):
|
|
72
|
+
"""Scan all markdown files and add/update metadata"""
|
|
73
|
+
one_dir = self.project_dir / "one"
|
|
74
|
+
if not one_dir.exists():
|
|
75
|
+
print(f"Error: {one_dir} does not exist")
|
|
76
|
+
return
|
|
77
|
+
|
|
78
|
+
markdown_files = list(one_dir.rglob("*.md"))
|
|
79
|
+
print(f"Found {len(markdown_files)} markdown files to process\n")
|
|
80
|
+
|
|
81
|
+
for md_file in markdown_files:
|
|
82
|
+
self.files_processed += 1
|
|
83
|
+
self.process_file(md_file)
|
|
84
|
+
|
|
85
|
+
def process_file(self, file_path: Path):
|
|
86
|
+
"""Process a single markdown file"""
|
|
87
|
+
try:
|
|
88
|
+
content = file_path.read_text()
|
|
89
|
+
relative_path = file_path.relative_to(self.project_dir)
|
|
90
|
+
|
|
91
|
+
# Check if file has metadata
|
|
92
|
+
has_metadata, existing_metadata = self.parse_existing_metadata(content)
|
|
93
|
+
|
|
94
|
+
if has_metadata and self.is_metadata_complete(existing_metadata):
|
|
95
|
+
if self.verbose:
|
|
96
|
+
print(f"✓ {relative_path} - Already has complete metadata")
|
|
97
|
+
self.files_skipped += 1
|
|
98
|
+
return
|
|
99
|
+
|
|
100
|
+
# Generate metadata
|
|
101
|
+
metadata = self.generate_metadata(file_path, content, existing_metadata)
|
|
102
|
+
|
|
103
|
+
# Apply metadata
|
|
104
|
+
if has_metadata:
|
|
105
|
+
new_content = self.update_metadata(content, metadata)
|
|
106
|
+
action = "Updated"
|
|
107
|
+
self.files_updated += 1
|
|
108
|
+
else:
|
|
109
|
+
new_content = self.add_metadata(content, metadata)
|
|
110
|
+
action = "Tagged"
|
|
111
|
+
self.files_tagged += 1
|
|
112
|
+
|
|
113
|
+
if self.dry_run:
|
|
114
|
+
print(f"[DRY RUN] Would {action.lower()}: {relative_path}")
|
|
115
|
+
if self.verbose:
|
|
116
|
+
print(f" Metadata: {metadata}")
|
|
117
|
+
else:
|
|
118
|
+
file_path.write_text(new_content)
|
|
119
|
+
print(f"{action}: {relative_path}")
|
|
120
|
+
if self.verbose:
|
|
121
|
+
print(f" Metadata: {metadata}")
|
|
122
|
+
|
|
123
|
+
except Exception as e:
|
|
124
|
+
print(f"✗ Error processing {file_path.name}: {e}")
|
|
125
|
+
|
|
126
|
+
def parse_existing_metadata(self, content: str) -> Tuple[bool, Dict]:
|
|
127
|
+
"""Parse existing YAML frontmatter"""
|
|
128
|
+
if not content.startswith("---\n"):
|
|
129
|
+
return False, {}
|
|
130
|
+
|
|
131
|
+
# Find end of frontmatter
|
|
132
|
+
end_match = re.search(r"\n---\n", content[4:])
|
|
133
|
+
if not end_match:
|
|
134
|
+
return False, {}
|
|
135
|
+
|
|
136
|
+
frontmatter = content[4:4 + end_match.start()]
|
|
137
|
+
|
|
138
|
+
# Parse YAML-like metadata (simple parsing)
|
|
139
|
+
metadata = {}
|
|
140
|
+
for line in frontmatter.split("\n"):
|
|
141
|
+
if ":" in line:
|
|
142
|
+
key, value = line.split(":", 1)
|
|
143
|
+
metadata[key.strip()] = value.strip()
|
|
144
|
+
|
|
145
|
+
return True, metadata
|
|
146
|
+
|
|
147
|
+
def is_metadata_complete(self, metadata: Dict) -> bool:
|
|
148
|
+
"""Check if metadata has all required fields"""
|
|
149
|
+
required_fields = [
|
|
150
|
+
"title",
|
|
151
|
+
"dimension",
|
|
152
|
+
"category",
|
|
153
|
+
"tags",
|
|
154
|
+
"created",
|
|
155
|
+
"updated",
|
|
156
|
+
"version",
|
|
157
|
+
"ai_context"
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
return all(field in metadata for field in required_fields)
|
|
161
|
+
|
|
162
|
+
def generate_metadata(
|
|
163
|
+
self,
|
|
164
|
+
file_path: Path,
|
|
165
|
+
content: str,
|
|
166
|
+
existing: Dict
|
|
167
|
+
) -> Dict:
|
|
168
|
+
"""Generate metadata for a file"""
|
|
169
|
+
relative_path = file_path.relative_to(self.project_dir)
|
|
170
|
+
parts = relative_path.parts
|
|
171
|
+
|
|
172
|
+
# Infer dimension from first directory level
|
|
173
|
+
dimension = parts[1] if len(parts) > 1 and parts[1] in DIMENSION_MAP else "knowledge"
|
|
174
|
+
|
|
175
|
+
# Infer category from second directory level or filename
|
|
176
|
+
category = "general"
|
|
177
|
+
if len(parts) > 2:
|
|
178
|
+
subdir = parts[2]
|
|
179
|
+
category = CATEGORY_MAP.get(subdir, subdir)
|
|
180
|
+
|
|
181
|
+
# Generate title from filename
|
|
182
|
+
title = existing.get("title") or file_path.stem.replace("-", " ").title()
|
|
183
|
+
|
|
184
|
+
# Extract/infer tags
|
|
185
|
+
tags = self.infer_tags(content, file_path, existing)
|
|
186
|
+
|
|
187
|
+
# Generate AI context
|
|
188
|
+
ai_context = self.generate_ai_context(file_path, dimension, category, content)
|
|
189
|
+
|
|
190
|
+
return {
|
|
191
|
+
"title": title,
|
|
192
|
+
"dimension": dimension,
|
|
193
|
+
"category": category,
|
|
194
|
+
"tags": tags,
|
|
195
|
+
"created": existing.get("created", datetime.now().strftime("%Y-%m-%d")),
|
|
196
|
+
"updated": datetime.now().strftime("%Y-%m-%d"),
|
|
197
|
+
"version": existing.get("version", "1.0.0"),
|
|
198
|
+
"ai_context": ai_context,
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
def infer_tags(self, content: str, file_path: Path, existing: Dict) -> List[str]:
|
|
202
|
+
"""Infer tags from content and context"""
|
|
203
|
+
tags = set()
|
|
204
|
+
|
|
205
|
+
# Use existing tags if present
|
|
206
|
+
if existing.get("tags"):
|
|
207
|
+
existing_tags_str = existing["tags"].strip("[]")
|
|
208
|
+
tags.update(tag.strip() for tag in existing_tags_str.split(","))
|
|
209
|
+
|
|
210
|
+
# Add tags based on filename
|
|
211
|
+
filename_lower = file_path.stem.lower()
|
|
212
|
+
for keyword, keyword_tags in TAG_KEYWORDS.items():
|
|
213
|
+
if keyword in filename_lower:
|
|
214
|
+
tags.update(keyword_tags[:2]) # Add first 2 related tags
|
|
215
|
+
|
|
216
|
+
# Add tags based on content (first 500 chars)
|
|
217
|
+
content_sample = content[:500].lower()
|
|
218
|
+
for keyword, keyword_tags in TAG_KEYWORDS.items():
|
|
219
|
+
if keyword in content_sample:
|
|
220
|
+
tags.add(keyword_tags[0]) # Add primary tag
|
|
221
|
+
|
|
222
|
+
# Limit to 7 tags
|
|
223
|
+
return sorted(list(tags))[:7]
|
|
224
|
+
|
|
225
|
+
def generate_ai_context(
|
|
226
|
+
self,
|
|
227
|
+
file_path: Path,
|
|
228
|
+
dimension: str,
|
|
229
|
+
category: str,
|
|
230
|
+
content: str
|
|
231
|
+
) -> str:
|
|
232
|
+
"""Generate AI context description"""
|
|
233
|
+
relative_path = file_path.relative_to(self.project_dir)
|
|
234
|
+
|
|
235
|
+
# Extract first heading or first paragraph
|
|
236
|
+
purpose = "Provides information"
|
|
237
|
+
heading_match = re.search(r"^#\s+(.+)$", content, re.MULTILINE)
|
|
238
|
+
if heading_match:
|
|
239
|
+
purpose = f"Documents {heading_match.group(1).lower()}"
|
|
240
|
+
else:
|
|
241
|
+
first_para = re.search(r"^[A-Z].+\.", content, re.MULTILINE)
|
|
242
|
+
if first_para:
|
|
243
|
+
purpose = first_para.group(0)[:100]
|
|
244
|
+
|
|
245
|
+
return f"""This document is part of the {dimension} dimension in the {category} category.
|
|
246
|
+
Location: {relative_path}
|
|
247
|
+
Purpose: {purpose}
|
|
248
|
+
For AI agents: Read this to understand {file_path.stem.replace("-", " ")}."""
|
|
249
|
+
|
|
250
|
+
def add_metadata(self, content: str, metadata: Dict) -> str:
|
|
251
|
+
"""Add metadata frontmatter to content"""
|
|
252
|
+
tags_str = ", ".join(metadata["tags"])
|
|
253
|
+
|
|
254
|
+
frontmatter = f"""---
|
|
255
|
+
title: {metadata['title']}
|
|
256
|
+
dimension: {metadata['dimension']}
|
|
257
|
+
category: {metadata['category']}
|
|
258
|
+
tags: [{tags_str}]
|
|
259
|
+
created: {metadata['created']}
|
|
260
|
+
updated: {metadata['updated']}
|
|
261
|
+
version: {metadata['version']}
|
|
262
|
+
ai_context: |
|
|
263
|
+
{metadata['ai_context']}
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
"""
|
|
267
|
+
return frontmatter + content
|
|
268
|
+
|
|
269
|
+
def update_metadata(self, content: str, metadata: Dict) -> str:
|
|
270
|
+
"""Update existing metadata frontmatter"""
|
|
271
|
+
# Find end of existing frontmatter
|
|
272
|
+
end_match = re.search(r"\n---\n", content[4:])
|
|
273
|
+
if not end_match:
|
|
274
|
+
return self.add_metadata(content, metadata)
|
|
275
|
+
|
|
276
|
+
# Replace with new metadata
|
|
277
|
+
body = content[4 + end_match.end():]
|
|
278
|
+
return self.add_metadata(body, metadata)
|
|
279
|
+
|
|
280
|
+
def print_summary(self):
|
|
281
|
+
"""Print summary of tagging operation"""
|
|
282
|
+
print("\n" + "=" * 70)
|
|
283
|
+
print("METADATA TAGGING SUMMARY")
|
|
284
|
+
print("=" * 70)
|
|
285
|
+
print(f"Files Processed: {self.files_processed}")
|
|
286
|
+
print(f"Files Tagged: {self.files_tagged}")
|
|
287
|
+
print(f"Files Updated: {self.files_updated}")
|
|
288
|
+
print(f"Files Skipped: {self.files_skipped}")
|
|
289
|
+
print("=" * 70)
|
|
290
|
+
|
|
291
|
+
if self.dry_run:
|
|
292
|
+
print("\n[DRY RUN] No files were actually modified.")
|
|
293
|
+
print("Run without --dry-run to apply changes.")
|
|
294
|
+
else:
|
|
295
|
+
print("\n✅ Tagging complete! All files now have metadata.")
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
def main():
|
|
299
|
+
parser = argparse.ArgumentParser(
|
|
300
|
+
description="Add metadata tags to all ONE Platform documentation files"
|
|
301
|
+
)
|
|
302
|
+
parser.add_argument(
|
|
303
|
+
"--dry-run",
|
|
304
|
+
action="store_true",
|
|
305
|
+
help="Show what would be tagged without modifying files"
|
|
306
|
+
)
|
|
307
|
+
parser.add_argument(
|
|
308
|
+
"--verbose",
|
|
309
|
+
action="store_true",
|
|
310
|
+
help="Show detailed output for each file"
|
|
311
|
+
)
|
|
312
|
+
parser.add_argument(
|
|
313
|
+
"--project-dir",
|
|
314
|
+
default=".",
|
|
315
|
+
help="Project root directory (default: current directory)"
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
args = parser.parse_args()
|
|
319
|
+
|
|
320
|
+
tagger = MetadataTagger(
|
|
321
|
+
project_dir=args.project_dir,
|
|
322
|
+
dry_run=args.dry_run,
|
|
323
|
+
verbose=args.verbose
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
print("=" * 70)
|
|
327
|
+
print("ONE PLATFORM METADATA TAGGING")
|
|
328
|
+
print("=" * 70)
|
|
329
|
+
if args.dry_run:
|
|
330
|
+
print("[DRY RUN MODE - No files will be modified]")
|
|
331
|
+
print()
|
|
332
|
+
|
|
333
|
+
tagger.scan_and_tag_all()
|
|
334
|
+
tagger.print_summary()
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
if __name__ == "__main__":
|
|
338
|
+
main()
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
ONE Platform - Todo Context Hook
|
|
4
|
+
Loads current inference context and injects it into Claude's conversation.
|
|
5
|
+
|
|
6
|
+
This hook runs on UserPromptSubmit to provide context about:
|
|
7
|
+
- Current inference number (Infer 1-100)
|
|
8
|
+
- Task description
|
|
9
|
+
- Required ontology dimensions
|
|
10
|
+
- Dependencies from previous inferences
|
|
11
|
+
- Organization and person context
|
|
12
|
+
"""
|
|
13
|
+
import json
|
|
14
|
+
import sys
|
|
15
|
+
import os
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
from typing import Dict, Any, Optional
|
|
18
|
+
|
|
19
|
+
# Inference-to-dimension mapping
|
|
20
|
+
INFERENCE_DIMENSIONS = {
|
|
21
|
+
"organizations": [6, 18, 43],
|
|
22
|
+
"people": [7, 42, 43, 44, 45, 46, 47, 48, 49, 50],
|
|
23
|
+
"things": [2, 11, 12, 21, 22, 23],
|
|
24
|
+
"connections": [3, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40],
|
|
25
|
+
"events": [4, 17, 34, 39, 49],
|
|
26
|
+
"knowledge": [5, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 98, 99],
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Inference-to-specialist mapping
|
|
30
|
+
INFERENCE_SPECIALISTS = {
|
|
31
|
+
"backend": list(range(11, 21)) + list(range(41, 51)),
|
|
32
|
+
"frontend": list(range(21, 31)) + list(range(71, 81)),
|
|
33
|
+
"integration": list(range(31, 41)),
|
|
34
|
+
"quality": list(range(61, 71)),
|
|
35
|
+
"design": list(range(71, 81)),
|
|
36
|
+
"documenter": list(range(95, 100)),
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# The 100 inference tasks (abbreviated for context efficiency)
|
|
40
|
+
INFERENCE_TASKS = {
|
|
41
|
+
1: "Validate idea against 6-dimension ontology",
|
|
42
|
+
2: "Map idea to specific entity types (66+ thing types)",
|
|
43
|
+
3: "Identify connection types needed (25+ relationship types)",
|
|
44
|
+
4: "List event types that will be triggered (67+ event types)",
|
|
45
|
+
5: "Determine knowledge requirements (embeddings, vectors, RAG)",
|
|
46
|
+
6: "Identify organization scope (single-tenant vs multi-tenant)",
|
|
47
|
+
7: "Define people roles involved (4 roles)",
|
|
48
|
+
8: "Create high-level vision document",
|
|
49
|
+
9: "Generate initial plan with feature breakdown",
|
|
50
|
+
10: "Assign features to specialists",
|
|
51
|
+
11: "Design database schema changes",
|
|
52
|
+
12: "Update backend/convex/schema.ts",
|
|
53
|
+
13: "Create Effect.ts service for business logic",
|
|
54
|
+
14: "Define service errors with tagged unions",
|
|
55
|
+
15: "Write Convex queries for read operations",
|
|
56
|
+
16: "Write Convex mutations for write operations",
|
|
57
|
+
17: "Add event logging to all mutations",
|
|
58
|
+
18: "Implement organization scoping",
|
|
59
|
+
19: "Add rate limiting to mutations",
|
|
60
|
+
20: "Write unit tests for Effect.ts services",
|
|
61
|
+
21: "Create Astro page with SSR data fetching",
|
|
62
|
+
22: "Build React components for interactive UI",
|
|
63
|
+
23: "Use shadcn/ui components (50+ pre-installed)",
|
|
64
|
+
24: "Implement loading states with Suspense",
|
|
65
|
+
25: "Add error boundaries for graceful failures",
|
|
66
|
+
26: "Create forms with validation",
|
|
67
|
+
27: "Implement client-side state with Convex hooks",
|
|
68
|
+
28: "Style with Tailwind v4",
|
|
69
|
+
29: "Ensure responsive design (mobile-first)",
|
|
70
|
+
30: "Add dark mode support",
|
|
71
|
+
31: "Map external system to ontology dimensions",
|
|
72
|
+
32: "Create connection records for system relationships",
|
|
73
|
+
33: "Implement data synchronization logic",
|
|
74
|
+
34: "Add event tracking for cross-system actions",
|
|
75
|
+
35: "Create webhook handlers",
|
|
76
|
+
36: "Implement polling logic",
|
|
77
|
+
37: "Add error handling for integration failures",
|
|
78
|
+
38: "Create retry logic with exponential backoff",
|
|
79
|
+
39: "Log all integration events",
|
|
80
|
+
40: "Write integration tests for data flows",
|
|
81
|
+
41: "Configure Better Auth with 6 methods",
|
|
82
|
+
42: "Implement role-based access control (4 roles)",
|
|
83
|
+
43: "Add organization-scoped permissions",
|
|
84
|
+
44: "Create session management with JWT tokens",
|
|
85
|
+
45: "Implement password reset flow",
|
|
86
|
+
46: "Add email verification flow",
|
|
87
|
+
47: "Enable 2FA",
|
|
88
|
+
48: "Add brute force protection",
|
|
89
|
+
49: "Log all auth events",
|
|
90
|
+
50: "Write auth integration tests",
|
|
91
|
+
51: "Create knowledge records with labels",
|
|
92
|
+
52: "Generate embeddings for content",
|
|
93
|
+
53: "Store vectors in knowledge table",
|
|
94
|
+
54: "Implement vector search",
|
|
95
|
+
55: "Create RAG pipeline",
|
|
96
|
+
56: "Link knowledge to things via junction table",
|
|
97
|
+
57: "Add semantic search to UI",
|
|
98
|
+
58: "Implement knowledge graph traversal",
|
|
99
|
+
59: "Create AI-powered recommendations",
|
|
100
|
+
60: "Test RAG accuracy with sample queries",
|
|
101
|
+
61: "Define user flows",
|
|
102
|
+
62: "Create acceptance criteria",
|
|
103
|
+
63: "Write unit tests for services",
|
|
104
|
+
64: "Write integration tests for flows",
|
|
105
|
+
65: "Write e2e tests for critical paths",
|
|
106
|
+
66: "Run tests and capture results",
|
|
107
|
+
67: "Validate against ontology",
|
|
108
|
+
68: "Check type safety",
|
|
109
|
+
69: "Run linter",
|
|
110
|
+
70: "Fix all failing tests",
|
|
111
|
+
71: "Create wireframes that satisfy acceptance criteria",
|
|
112
|
+
72: "Design component architecture",
|
|
113
|
+
73: "Set design tokens",
|
|
114
|
+
74: "Ensure WCAG AA accessibility",
|
|
115
|
+
75: "Design loading states and skeletons",
|
|
116
|
+
76: "Create error state designs",
|
|
117
|
+
77: "Design empty states",
|
|
118
|
+
78: "Implement animations and transitions",
|
|
119
|
+
79: "Validate design enables tests to pass",
|
|
120
|
+
80: "Get design approval",
|
|
121
|
+
81: "Optimize database queries",
|
|
122
|
+
82: "Implement pagination for large lists",
|
|
123
|
+
83: "Add caching where appropriate",
|
|
124
|
+
84: "Optimize images",
|
|
125
|
+
85: "Minimize JavaScript bundle size",
|
|
126
|
+
86: "Use Astro Islands for selective hydration",
|
|
127
|
+
87: "Enable SSR for critical pages",
|
|
128
|
+
88: "Optimize Lighthouse scores",
|
|
129
|
+
89: "Test on slow connections",
|
|
130
|
+
90: "Monitor Core Web Vitals",
|
|
131
|
+
91: "Build production bundle",
|
|
132
|
+
92: "Deploy backend to Convex Cloud",
|
|
133
|
+
93: "Deploy frontend to Cloudflare Pages",
|
|
134
|
+
94: "Run smoke tests in production",
|
|
135
|
+
95: "Write feature documentation",
|
|
136
|
+
96: "Update API documentation",
|
|
137
|
+
97: "Create user guide",
|
|
138
|
+
98: "Capture lessons learned",
|
|
139
|
+
99: "Update knowledge base with patterns",
|
|
140
|
+
100: "Mark feature complete and notify stakeholders",
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def load_state() -> Dict[str, Any]:
|
|
145
|
+
"""Load current inference state from .claude/state/inference.json"""
|
|
146
|
+
state_file = Path(os.environ.get("CLAUDE_PROJECT_DIR", ".")) / ".claude" / "state" / "inference.json"
|
|
147
|
+
|
|
148
|
+
# Create state directory if it doesn't exist
|
|
149
|
+
state_file.parent.mkdir(parents=True, exist_ok=True)
|
|
150
|
+
|
|
151
|
+
# Initialize default state if file doesn't exist
|
|
152
|
+
if not state_file.exists():
|
|
153
|
+
default_state = {
|
|
154
|
+
"current_inference": 1,
|
|
155
|
+
"completed_inferences": [],
|
|
156
|
+
"feature_name": "New Feature",
|
|
157
|
+
"organization": "Default Org",
|
|
158
|
+
"person_role": "platform_owner",
|
|
159
|
+
"lessons_learned": []
|
|
160
|
+
}
|
|
161
|
+
state_file.write_text(json.dumps(default_state, indent=2))
|
|
162
|
+
return default_state
|
|
163
|
+
|
|
164
|
+
return json.loads(state_file.read_text())
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def get_dimensions_for_inference(inference: int) -> list:
|
|
168
|
+
"""Get ontology dimensions relevant to this inference"""
|
|
169
|
+
dimensions = []
|
|
170
|
+
for dimension, inferences in INFERENCE_DIMENSIONS.items():
|
|
171
|
+
if inference in inferences:
|
|
172
|
+
dimensions.append(dimension)
|
|
173
|
+
return dimensions
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def get_specialist_for_inference(inference: int) -> Optional[str]:
|
|
177
|
+
"""Get specialist agent responsible for this inference"""
|
|
178
|
+
for specialist, inferences in INFERENCE_SPECIALISTS.items():
|
|
179
|
+
if inference in inferences:
|
|
180
|
+
return specialist
|
|
181
|
+
return None
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def get_dependencies(inference: int) -> list:
|
|
185
|
+
"""Get inference dependencies (what must be completed first)"""
|
|
186
|
+
# Simple linear dependencies for now
|
|
187
|
+
if inference <= 10:
|
|
188
|
+
return list(range(1, inference))
|
|
189
|
+
elif inference <= 20:
|
|
190
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + list(range(11, inference))
|
|
191
|
+
elif inference <= 30:
|
|
192
|
+
return list(range(1, 11)) + [12, 13] + list(range(21, inference)) # Need schema first
|
|
193
|
+
elif inference <= 40:
|
|
194
|
+
return list(range(1, 11)) + list(range(31, inference))
|
|
195
|
+
else:
|
|
196
|
+
return list(range(1, 11)) # Foundation always required
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def generate_context(state: Dict[str, Any]) -> str:
|
|
200
|
+
"""Generate context to inject into Claude's conversation"""
|
|
201
|
+
current = state["current_inference"]
|
|
202
|
+
task = INFERENCE_TASKS.get(current, "Unknown task")
|
|
203
|
+
dimensions = get_dimensions_for_inference(current)
|
|
204
|
+
specialist = get_specialist_for_inference(current)
|
|
205
|
+
dependencies = [d for d in get_dependencies(current) if d in state["completed_inferences"]]
|
|
206
|
+
|
|
207
|
+
context = f"""
|
|
208
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
209
|
+
📋 CURRENT INFERENCE: Infer {current}/100
|
|
210
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
211
|
+
|
|
212
|
+
**Feature:** {state["feature_name"]}
|
|
213
|
+
**Organization:** {state["organization"]}
|
|
214
|
+
**Person Role:** {state["person_role"]}
|
|
215
|
+
|
|
216
|
+
**Task:** {task}
|
|
217
|
+
|
|
218
|
+
**Ontology Dimensions:** {", ".join(dimensions) if dimensions else "Foundation"}
|
|
219
|
+
**Assigned Specialist:** {specialist if specialist else "Engineering Director"}
|
|
220
|
+
|
|
221
|
+
**Dependencies Met:** {len(dependencies)}/{len(get_dependencies(current))} completed
|
|
222
|
+
**Progress:** {len(state["completed_inferences"])}/100 inferences complete ({len(state["completed_inferences"])}%)
|
|
223
|
+
|
|
224
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
225
|
+
🎯 NEXT 5 INFERENCES:
|
|
226
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
227
|
+
"""
|
|
228
|
+
|
|
229
|
+
# Add next 5 inferences
|
|
230
|
+
for i in range(current, min(current + 5, 101)):
|
|
231
|
+
task_desc = INFERENCE_TASKS.get(i, "Unknown")
|
|
232
|
+
dims = get_dimensions_for_inference(i)
|
|
233
|
+
spec = get_specialist_for_inference(i)
|
|
234
|
+
status = "✅" if i in state["completed_inferences"] else "⏸️ " if i == current else "⏹️ "
|
|
235
|
+
context += f"{status} Infer {i}: {task_desc}\n"
|
|
236
|
+
if dims or spec:
|
|
237
|
+
context += f" └─ Dimensions: {', '.join(dims) if dims else 'N/A'} | Specialist: {spec if spec else 'N/A'}\n"
|
|
238
|
+
|
|
239
|
+
context += "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
|
|
240
|
+
|
|
241
|
+
# Add recent lessons learned
|
|
242
|
+
if state.get("lessons_learned"):
|
|
243
|
+
recent_lessons = state["lessons_learned"][-3:] # Last 3 lessons
|
|
244
|
+
context += "💡 RECENT LESSONS LEARNED:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n"
|
|
245
|
+
for lesson in recent_lessons:
|
|
246
|
+
context += f"• Infer {lesson['inference']}: {lesson['lesson']}\n"
|
|
247
|
+
context += "\n"
|
|
248
|
+
|
|
249
|
+
context += """
|
|
250
|
+
🔄 WORKFLOW COMMANDS:
|
|
251
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
252
|
+
/done - Mark current inference complete and advance
|
|
253
|
+
/next - Skip to next inference (use when current is not applicable)
|
|
254
|
+
/infer N - Jump to specific inference N (use sparingly)
|
|
255
|
+
/plan - View complete 100-inference plan
|
|
256
|
+
|
|
257
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
return context
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def main():
|
|
264
|
+
try:
|
|
265
|
+
# Load hook input from stdin
|
|
266
|
+
input_data = json.load(sys.stdin)
|
|
267
|
+
prompt = input_data.get("prompt", "")
|
|
268
|
+
|
|
269
|
+
# Load current state
|
|
270
|
+
state = load_state()
|
|
271
|
+
|
|
272
|
+
# Check if prompt is a workflow command
|
|
273
|
+
if prompt.strip().startswith("/"):
|
|
274
|
+
# Don't inject context for commands (they handle their own context)
|
|
275
|
+
sys.exit(0)
|
|
276
|
+
|
|
277
|
+
# Generate and output context
|
|
278
|
+
context = generate_context(state)
|
|
279
|
+
|
|
280
|
+
# Output as JSON with additionalContext
|
|
281
|
+
output = {
|
|
282
|
+
"hookSpecificOutput": {
|
|
283
|
+
"hookEventName": "UserPromptSubmit",
|
|
284
|
+
"additionalContext": context,
|
|
285
|
+
},
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
print(json.dumps(output))
|
|
289
|
+
sys.exit(0)
|
|
290
|
+
|
|
291
|
+
except Exception as e:
|
|
292
|
+
# Don't block on errors, just log to stderr
|
|
293
|
+
print(f"Error in todo hook: {e}", file=sys.stderr)
|
|
294
|
+
sys.exit(0)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
if __name__ == "__main__":
|
|
298
|
+
main()
|