You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: patterns/2-structured/ai-code-generation-context.md
+70-70Lines changed: 70 additions & 70 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,24 +12,24 @@ With the growing use of AI tools (like GitHub Copilot, ChatGPT, or custom LLMs),
12
12
13
13
## Context
14
14
15
-
- InnerSource adoption is in place across the organization
16
-
- Developers are encouraged to use AI tools to improve productivity
17
-
- Contributors may not be familiar or failed to prompt meticulously while generating code through AI with the target codebase's idioms, architecture, or constraints
18
-
- Maintainers want to empower contributors using AI while preserving code consistency and maintainability
19
-
- Multiple teams are contributing to shared repositories with varying levels of familiarity with project standards
20
-
- Code review processes are becoming bottlenecked by AI-generated code that requires significant rework
15
+
* InnerSource adoption is in place across the organization
16
+
* Developers are encouraged to use AI tools to improve productivity
17
+
* Contributors may not be familiar or failed to prompt meticulously while generating code through AI with the target codebase's idioms, architecture, or constraints
18
+
* Maintainers want to empower contributors using AI while preserving code consistency and maintainability
19
+
* Multiple teams are contributing to shared repositories with varying levels of familiarity with project standards
20
+
* Code review processes are becoming bottlenecked by AI-generated code that requires significant rework
21
21
22
22
## Forces
23
23
24
-
-**AI Model Limitations**: AI models generate code based on generalized training data, not project-specific patterns, leading to generic solutions that may not fit the project's architecture
25
-
-**Knowledge Gap**: New contributors using AI tools might unknowingly bypass existing architectural norms, coding standards, and established patterns
26
-
-**Review Overhead**: AI-assisted PRs can significantly increase review load if not aligned with existing practices, as maintainers must spend time explaining and correcting deviations
27
-
-**Productivity vs. Quality Trade-off**: While AI tools boost individual productivity, they can reduce overall team productivity if the generated code requires extensive rework
28
-
-**Context Switching Cost**: Developers benefit from AI tools only when they have the right contextual grounding, but manually providing this context for each AI interaction is time-consuming
29
-
-**Inconsistent Standards**: Different AI tools and different prompting approaches by contributors can lead to wildly inconsistent code styles and patterns
30
-
-**Maintenance Burden**: Creating and maintaining comprehensive AI context requires ongoing effort from maintainers
31
-
-**Tool Integration Complexity**: Different AI tools have different ways of consuming context, making it challenging to create universal guidance
32
-
-**AI Tool Cost Constraints**: Comprehensive AI context increases processing costs (AI tools charge based on "tokens" - units of text measurement) and usage limits, requiring strategic balance between context completeness and efficiency
24
+
***AI Model Limitations**: AI models generate code based on generalized training data, not project-specific patterns, leading to generic solutions that may not fit the project's architecture
25
+
***Knowledge Gap**: New contributors using AI tools might unknowingly bypass existing architectural norms, coding standards, and established patterns
26
+
***Review Overhead**: AI-assisted PRs can significantly increase review load if not aligned with existing practices, as maintainers must spend time explaining and correcting deviations
27
+
***Productivity vs. Quality Trade-off**: While AI tools boost individual productivity, they can reduce overall team productivity if the generated code requires extensive rework
28
+
***Context Switching Cost**: Developers benefit from AI tools only when they have the right contextual grounding, but manually providing this context for each AI interaction is time-consuming
29
+
***Inconsistent Standards**: Different AI tools and different prompting approaches by contributors can lead to wildly inconsistent code styles and patterns
30
+
***Maintenance Burden**: Creating and maintaining comprehensive AI context requires ongoing effort from maintainers
31
+
***Tool Integration Complexity**: Different AI tools have different ways of consuming context, making it challenging to create universal guidance
32
+
***AI Tool Cost Constraints**: Comprehensive AI context increases processing costs (AI tools charge based on "tokens" * units of text measurement) and usage limits, requiring strategic balance between context completeness and efficiency
33
33
34
34
## Solution
35
35
@@ -42,57 +42,57 @@ Create a `innersource-ai/` folder in the repository root containing:
42
42
#### Core Documentation Files (Required)
43
43
44
44
`PROMPT.md`: Project-specific instructions for AI tools
* Template files for common patterns (controllers, services, utilities)
75
75
76
76
##### Configuration and Tooling
77
77
78
78
`CONFIG/`: Shared formatter and analysis configurations
79
-
-`.prettierrc`, `.eslintrc`, or equivalent formatting configs
80
-
-`.editorconfig` for consistent editor settings
81
-
- Static analysis tool configurations
82
-
- Pre-commit hook configurations
79
+
*`.prettierrc`, `.eslintrc`, or equivalent formatting configs
80
+
*`.editorconfig` for consistent editor settings
81
+
* Static analysis tool configurations
82
+
* Pre-commit hook configurations
83
83
84
84
`INTEGRATION/`: AI tool-specific integration guides
85
-
- GitHub Copilot workspace configuration
86
-
- Custom GPT instructions and prompts
87
-
- IDE plugin configurations
88
-
- CLI tool integration examples
85
+
* GitHub Copilot workspace configuration
86
+
* Custom GPT instructions and prompts
87
+
* IDE plugin configurations
88
+
* CLI tool integration examples
89
89
90
90
##### Advanced Features
91
91
92
92
`EMBEDDINGS/` (Optional): For advanced LLM integrations
93
-
- Searchable knowledge base of project patterns
94
-
- Vector embeddings of code examples
95
-
- Semantic search capabilities for finding relevant patterns
93
+
* Searchable knowledge base of project patterns
94
+
* Vector embeddings of code examples
95
+
* Semantic search capabilities for finding relevant patterns
96
96
97
97
### Implementation Strategy
98
98
@@ -101,33 +101,33 @@ Create a `innersource-ai/` folder in the repository root containing:
101
101
### Usage Patterns
102
102
103
103
#### For Contributors
104
-
1.**Before Starting**: Review the AI context package to understand project standards
105
-
2.**During Development**: Reference specific files when prompting AI tools
106
-
3.**Code Generation**: Include relevant context snippets in AI prompts
107
-
4.**Validation**: Use provided examples to verify AI-generated code aligns with standards
104
+
***Before Starting**: Review the AI context package to understand project standards
105
+
***During Development**: Reference specific files when prompting AI tools
106
+
***Code Generation**: Include relevant context snippets in AI prompts
107
+
***Validation**: Use provided examples to verify AI-generated code aligns with standards
108
108
109
109
#### For AI Tool Integration
110
-
-**Direct Reference**: Copy relevant sections into AI tool prompts
111
-
-**URL Integration**: Reference files via repository URLs in AI tools that support web access
112
-
-**IDE Integration**: Configure AI plugins to automatically include context
113
-
-**Custom Workflows**: Integrate context into CI/CD pipelines for automated validation
110
+
***Direct Reference**: Copy relevant sections into AI tool prompts
111
+
***URL Integration**: Reference files via repository URLs in AI tools that support web access
112
+
***IDE Integration**: Configure AI plugins to automatically include context
113
+
***Custom Workflows**: Integrate context into CI/CD pipelines for automated validation
114
114
115
115
### Maintenance Strategy
116
116
117
-
-**Version Control**: Track changes to AI context alongside code changes
118
-
-**Regular Updates**: Review and update context as project standards evolve
119
-
-**Community Contribution**: Allow contributors to suggest improvements to AI context
120
-
-**Metrics Tracking**: Monitor the effectiveness of AI context through code review metrics
117
+
***Version Control**: Track changes to AI context alongside code changes
118
+
***Regular Updates**: Review and update context as project standards evolve
119
+
***Community Contribution**: Allow contributors to suggest improvements to AI context
120
+
***Metrics Tracking**: Monitor the effectiveness of AI context through code review metrics
121
121
122
122
## Resulting Context
123
123
124
-
-**Improved Code Quality**: AI-assisted contributions become consistent with existing code standards and architectural patterns from the first submission
125
-
-**Reduced Review Friction**: Maintainers can trust incoming PRs more readily, significantly reducing review fatigue and time-to-merge
126
-
-**Enhanced Contributor Experience**: Contributors using AI produce better, more maintainable code even on their first attempts, leading to increased confidence and participation
127
-
-**Scalable Collaboration**: Opens the door to scalable, AI-aware InnerSource collaboration across teams without sacrificing code quality
128
-
-**Knowledge Preservation**: Project knowledge becomes more explicit and accessible, reducing dependency on tribal knowledge
129
-
-**Faster Onboarding**: New contributors can leverage AI tools effectively from day one, reducing the learning curve for project-specific patterns
130
-
-**Consistent Evolution**: As AI tools improve, the context package ensures that enhanced capabilities are channeled toward project-appropriate solutions
124
+
***Improved Code Quality**: AI-assisted contributions become consistent with existing code standards and architectural patterns from the first submission
125
+
***Reduced Review Friction**: Maintainers can trust incoming PRs more readily, significantly reducing review fatigue and time-to-merge
126
+
***Enhanced Contributor Experience**: Contributors using AI produce better, more maintainable code even on their first attempts, leading to increased confidence and participation
127
+
***Scalable Collaboration**: Opens the door to scalable, AI-aware InnerSource collaboration across teams without sacrificing code quality
128
+
***Knowledge Preservation**: Project knowledge becomes more explicit and accessible, reducing dependency on tribal knowledge
129
+
***Faster Onboarding**: New contributors can leverage AI tools effectively from day one, reducing the learning curve for project-specific patterns
130
+
***Consistent Evolution**: As AI tools improve, the context package ensures that enhanced capabilities are channeled toward project-appropriate solutions
131
131
132
132
## Rationale
133
133
@@ -143,18 +143,18 @@ To be added.
143
143
144
144
## Status
145
145
146
-
- Structured
147
-
- Drafted in August 2025
146
+
* Structured
147
+
* Drafted in August 2025
148
148
149
149
## Author
150
150
151
151
[Amburi Roy](https://www.linkedin.com/in/amburi/)
152
152
153
153
## Related Patterns
154
154
155
-
-[Standard Base Documentation](../base-documentation.md) - Provides the foundation documentation that AI context builds upon
156
-
-[InnerSource Portal](../innersource-portal.md) - Could include AI context availability as searchable metadata for project discovery
157
-
-[Trusted Committer](../trusted-committer.md) - Trusted Committers are responsible for maintaining and evolving the AI context package
155
+
*[Standard Base Documentation](../base-documentation.md) - Provides the foundation documentation that AI context builds upon
156
+
*[InnerSource Portal](../innersource-portal.md) - Could include AI context availability as searchable metadata for project discovery
157
+
*[Trusted Committer](../trusted-committer.md) - Trusted Committers are responsible for maintaining and evolving the AI context package
0 commit comments