infinite-agents-public/infinite_variants/infinite_variant_1/pattern_library_template.json

109 lines
6.1 KiB
JSON

{
"version": "1.0",
"last_updated": "2025-10-10T00:00:00Z",
"total_iterations_analyzed": 0,
"analysis_depth": "deep",
"patterns": {
"structural": [
{
"name": "Example Structural Pattern",
"description": "Brief description of what this pattern achieves",
"example_file": "path/to/iteration_N.html",
"key_characteristics": [
"Characteristic 1: Clear separation of concerns",
"Characteristic 2: Modular component structure",
"Characteristic 3: Consistent naming conventions"
],
"success_metrics": "Why this pattern works: High readability (9/10), easy to extend, follows best practices",
"code_snippet": "// Example code demonstrating the pattern\nconst example = {\n data: {},\n render() {},\n update() {}\n};"
}
],
"content": [
{
"name": "Example Content Pattern",
"description": "Approach to documentation and clarity",
"example_file": "path/to/iteration_M.html",
"key_characteristics": [
"Characteristic 1: Progressive disclosure of complexity",
"Characteristic 2: Inline comments for complex logic",
"Characteristic 3: User-facing documentation separate from code comments"
],
"success_metrics": "Demonstrated effectiveness: 100% function coverage, clear for beginners and experts",
"code_snippet": "/**\n * HIGH-LEVEL: Function purpose\n * TECHNICAL: Implementation details\n * EXAMPLE: Usage example\n */\nfunction exampleFunction() {}"
}
],
"innovation": [
{
"name": "Example Innovation Pattern",
"description": "Novel approach or creative solution",
"example_file": "path/to/iteration_K.html",
"key_characteristics": [
"Characteristic 1: Unique problem-solving approach",
"Characteristic 2: Effective combination of techniques",
"Characteristic 3: Improved user experience through innovation"
],
"success_metrics": "Impact: Reduced code by 30%, improved performance by 2x, better UX",
"code_snippet": "// Innovative approach example\nconst innovation = data.map(d => ({\n ...d,\n validate() { return this.value > 0; }\n}));"
}
],
"quality": [
{
"name": "Example Quality Pattern",
"description": "Approach to robustness and error handling",
"example_file": "path/to/iteration_P.html",
"key_characteristics": [
"Characteristic 1: Comprehensive input validation",
"Characteristic 2: Graceful degradation for errors",
"Characteristic 3: Informative error messages"
],
"success_metrics": "Results: Zero runtime crashes, 100% error coverage, excellent debugging experience",
"code_snippet": "function robustFunction(input) {\n if (!input) return fallback();\n if (!isValid(input)) return handleError();\n return process(input);\n}"
}
]
},
"metadata": {
"extraction_date": "2025-10-10T00:00:00Z",
"source_directory": "output/",
"iterations_count": 0,
"patterns_extracted": 4,
"avg_quality_score": 0.0,
"most_common_theme": "Not yet analyzed",
"notes": "This is a template. Actual patterns will be extracted from generated iterations."
},
"schema_documentation": {
"version": "Semantic version of pattern library (incremented with each update)",
"last_updated": "ISO 8601 timestamp of last extraction",
"total_iterations_analyzed": "Total number of iterations analyzed to build this library",
"analysis_depth": "'quick' (3 patterns/category) or 'deep' (5 patterns/category)",
"patterns": "Object containing four categories of patterns",
"patterns.structural": "Array of 3-5 patterns related to code organization and architecture",
"patterns.content": "Array of 3-5 patterns related to documentation and clarity",
"patterns.innovation": "Array of 3-5 patterns showcasing creative or novel approaches",
"patterns.quality": "Array of 3-5 patterns for robustness, testing, and error handling",
"pattern_object": {
"name": "Short, descriptive name for the pattern",
"description": "1-2 sentence explanation of what the pattern achieves",
"example_file": "Path to iteration file that exemplifies this pattern",
"key_characteristics": "Array of 3-5 specific traits that define this pattern",
"success_metrics": "Measurable or observable reasons why this pattern is effective",
"code_snippet": "Representative code example (5-15 lines) demonstrating the pattern"
},
"metadata": {
"extraction_date": "When patterns were extracted",
"source_directory": "Directory containing analyzed iterations",
"iterations_count": "Number of iterations in source directory",
"patterns_extracted": "Total patterns across all categories",
"avg_quality_score": "Average quality score of all iterations (0-10 scale)",
"most_common_theme": "Dominant pattern or approach across iterations",
"notes": "Additional observations or context about the pattern extraction"
}
},
"usage_instructions": {
"for_humans": "This template shows the structure of a pattern library. Run /project:extract-patterns to populate it with actual patterns from your iterations.",
"for_agents": "When generating iterations with pattern library context, review 3-5 relevant patterns, understand their characteristics, and apply them while adding novel innovations. Patterns are examples (multi-shot prompting), not rigid rules.",
"pattern_selection": "Choose patterns most relevant to current task. For a visualization: structural pattern for organization, content pattern for documentation, quality pattern for error handling, innovation pattern for creative inspiration.",
"pattern_application": "Don't copy patterns verbatim. Understand the principle, adapt to current context, and extend with new ideas. Patterns provide consistency; innovation provides uniqueness.",
"pattern_evolution": "Best patterns are those that are: (1) Clear and understandable, (2) Demonstrably effective, (3) Broadly applicable, (4) Easy to adapt, (5) From top 20% of iterations by quality score"
}
}