Skip to content

Commit 72b6322

Browse files
committed
RFC: AI Documentation Directory Structure Proposal
This proposal outlines a modular AI documentation architecture: - AGENTS.md as central hub - Modular .ai/ guideline files - Claude Code settings.json configuration - Team vs personal configuration separation Requesting team review and feedback on proposed structure.
1 parent 0f84f2c commit 72b6322

File tree

1 file changed

+349
-0
lines changed

1 file changed

+349
-0
lines changed

PROPOSED-AI-DOCS-STRUCTURE.md

Lines changed: 349 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,349 @@
1+
# Proposed Directory Structure for AI Context & Configuration
2+
3+
**Purpose**: Establish modular AI documentation and Claude Code configuration
4+
**Date**: 2025-11-25
5+
**Status**: Awaiting team approval
6+
7+
---
8+
9+
## Summary of Changes
10+
11+
### What's Being Added
12+
-**AGENTS.md** - Central AI documentation hub
13+
-**.ai/README.md** - Explains .ai/ directory
14+
-**.ai/ARCHITECTURE.md** - System architecture, Plugin SDK, tech stack
15+
-**.ai/CONVENTIONS.md** - Coding standards, patterns, file naming
16+
-**.ai/TESTING.md** - All testing (unit, integration, E2E)
17+
-**.claude/settings.json** - Team Claude Code configuration
18+
19+
### What's Being Updated
20+
- 🔄 **CLAUDE.md** - Update to reference AGENTS.md
21+
- 🔄 **.cursor/context.md** - Update to reference AGENTS.md
22+
23+
### What's Being Removed
24+
-**.ai/context.md** - Content merged into new modular files
25+
26+
---
27+
28+
## Current Structure
29+
30+
```
31+
console/
32+
├── CLAUDE.md # Claude Code entry, references .ai/context.md
33+
├── .ai/
34+
│ ├── context.md # Single monolithic file (will be deleted)
35+
│ └── README.md
36+
├── .claude/
37+
│ └── commands/ # Team commands
38+
├── README.md
39+
├── CONTRIBUTING.md
40+
├── STYLEGUIDE.md
41+
└── INTERNATIONALIZATION.md
42+
```
43+
44+
**Issues with Current Structure**:
45+
- ❌ No team `.claude/settings.json` (causes "create settings.json" suggestions)
46+
- ❌ Monolithic `.ai/context.md` (hard to maintain, update specific sections)
47+
- ❌ No central AI documentation hub
48+
- ❌ Mixed concerns in single file
49+
50+
---
51+
52+
## Proposed Structure
53+
54+
```
55+
console/
56+
├── AGENTS.md # ✅ NEW - Central AI hub
57+
├── CLAUDE.md # 🔄 UPDATED - Points to AGENTS.md
58+
├── .ai/ # Team AI context (AI-agnostic)
59+
│ ├──[context.md deleted] # ❌ REMOVED - Content merged above
60+
│ ├── README.md # ✅ NEW - Explains .ai/ structure
61+
│ ├── ARCHITECTURE.md # ✅ NEW - System arch, Plugin SDK, tech stack
62+
│ ├── CONVENTIONS.md # ✅ NEW - Coding standards, patterns, etc.
63+
│ └── TESTING.md # ✅ NEW - All testing approaches
64+
├── .claude/ # Claude Code configuration
65+
│ ├── settings.json # ✅ NEW - Team config (checked in)
66+
│ └── commands/ # Team commands
67+
├── .cursor/ # ✔️ EXISTS - Cursor-specific configs
68+
│ └── context.md # 🔄 UPDATED - Points to AGENTS.md
69+
├── README.md # ✔️ UNCHANGED
70+
├── CONTRIBUTING.md # ✔️ UNCHANGED
71+
├── STYLEGUIDE.md # ✔️ UNCHANGED
72+
└── INTERNATIONALIZATION.md # ✔️ UNCHANGED
73+
74+
75+
Legend:
76+
✅ NEW - File to be created
77+
🔄 UPDATED - File to be modified
78+
❌ REMOVED - File to be deleted
79+
✔️ UNCHANGED - File stays as-is
80+
```
81+
82+
---
83+
84+
## File Purposes & Sizes
85+
86+
### Root Level
87+
88+
| File | Purpose | Size | Audience |
89+
|------|---------|------|----------|
90+
| **AGENTS.md** | Central AI documentation hub, quick start | 6-8KB | All AI tools |
91+
| **CLAUDE.md** | Claude Code entry point → AGENTS.md | Updated | Claude Code |
92+
93+
### .ai/ Directory (Team AI Context)
94+
95+
| File | Purpose | Size | Checked In |
96+
|------|---------|------|------------|
97+
| **README.md** | Explains .ai/ organization | 1-2KB | ✅ Yes |
98+
| **ARCHITECTURE.md** | System architecture, Plugin SDK, tech stack, monorepo | 10-12KB | ✅ Yes |
99+
| **CONVENTIONS.md** | Coding standards, P0/P1 patterns, file naming | 10-12KB | ✅ Yes |
100+
| **TESTING.md** | Unit, integration, E2E testing patterns | 6-8KB | ✅ Yes |
101+
102+
**Total .ai/ documentation**: ~30-35KB (vs current 5KB context.md)
103+
104+
### .claude/ Directory (Claude Code Configuration)
105+
106+
| File | Purpose | Checked In |
107+
|------|---------|------------|
108+
| **settings.json** | Team permissions, hooks | ✅ Yes |
109+
| **commands/** | Shared slash commands | ✅ Yes |
110+
111+
---
112+
113+
## Content Distribution
114+
115+
### .ai/ARCHITECTURE.md
116+
**Contains:**
117+
- Monorepo package structure (frontend/, pkg/, cmd/)
118+
- Technology stack overview:
119+
- Frontend: React, TypeScript, yarn workspaces, Webpack Module Federation
120+
- Backend: Go, klog, Kubernetes client libraries
121+
- Deployment: OpenShift/Kubernetes
122+
- Build tools: yarn, Go toolchain
123+
- Console Dynamic Plugin SDK architecture
124+
- Extension points system (25+ types)
125+
- Module Federation runtime loading
126+
- Type system and code references
127+
- Public API surface (re-exports from @console/shared, @console/internal, etc.)
128+
- Plugin structure patterns
129+
- Key architectural decisions
130+
- Package relationships and dependencies
131+
132+
### .ai/CONVENTIONS.md
133+
**Contains:**
134+
- TypeScript/React conventions
135+
- Functional components and hooks
136+
- State management patterns (Context API, migrating from Redux)
137+
- Component structure and file organization
138+
- Framework usage patterns:
139+
- PatternFly design system usage
140+
- React hooks best practices (useK8sWatchResource, etc.)
141+
- i18n with useTranslation hook
142+
- Go best practices
143+
- Package organization patterns
144+
- Error handling standards
145+
- Logging conventions (klog)
146+
- HTTP handler patterns
147+
- File naming conventions (PascalCase, kebab-case rules)
148+
- API call patterns (consoleFetchJSON, k8s resource hooks)
149+
- Styling conventions (SCSS modules, PatternFly integration)
150+
- Error handling patterns
151+
- P0/P1 review patterns
152+
153+
### .ai/TESTING.md
154+
**Contains:**
155+
- Unit testing patterns (Jest)
156+
- Integration testing approaches
157+
- E2E testing (Cypress)
158+
- Test organization and structure
159+
- Coverage expectations
160+
- Testing best practices
161+
162+
---
163+
164+
## How It Works
165+
166+
### Session Loading Order
167+
168+
When Claude Code starts a session:
169+
170+
1. **CLAUDE.md** → Points to AGENTS.md
171+
2. **settings.json hook** → Loads AGENTS.md
172+
3. **settings.json hook** → Loads all .ai/ files
173+
4. **settings.local.json hook** → Loads personal workflow (if configured)
174+
175+
### Team vs Personal Separation
176+
177+
**Team Configuration** (checked into git, affects everyone):
178+
- `.claude/settings.json` - Team permissions and hooks
179+
- `.ai/` directory - All team guidelines and rules
180+
- `.claude/commands/` - Shared slash commands
181+
- `AGENTS.md` - Central documentation hub
182+
183+
**Personal Configuration** (gitignored, individual developers, not checked in):
184+
- `.claude/settings.local.json` - Personal overrides and hooks
185+
- `.claude/local/` - Personal rules, preferences, analysis files
186+
187+
### AI Tool Compatibility
188+
189+
**Works With**:
190+
- ✅ Claude Code (via settings.json hooks)
191+
- ✅ CodeRabbit (via .coderabbit.yaml references)
192+
- ✅ Cursor/Copilot (via .cursorrules or similar)
193+
- ✅ Any AI tool (can read .ai/ files directly)
194+
195+
---
196+
197+
## Benefits
198+
199+
### For Developers
200+
**Clear separation**: Team standards vs personal workflow
201+
**No conflicts**: Personal settings don't affect teammates
202+
**No suggestions**: Claude stops suggesting "create settings.json"
203+
**Better onboarding**: AGENTS.md provides quick start
204+
205+
### For Maintainers
206+
**Modular updates**: Update only relevant files when things change
207+
**Scalable**: Easy to add new guideline files (ACCESSIBILITY.md, etc.)
208+
**Version control**: Track changes to specific guidelines
209+
**AI-agnostic**: Works with all AI tools, not just Claude
210+
211+
---
212+
213+
## What Gets Checked Into Git
214+
215+
**Checked In** (team files):
216+
```
217+
✅ AGENTS.md
218+
✅ CLAUDE.md (updated)
219+
✅ .cursor/context.md (updated)
220+
✅ .ai/README.md
221+
✅ .ai/ARCHITECTURE.md
222+
✅ .ai/CONVENTIONS.md
223+
✅ .ai/TESTING.md
224+
✅ .claude/settings.json
225+
✅ .claude/commands/**
226+
✅ .gitignore (updated)
227+
```
228+
229+
**Deleted**:
230+
```
231+
❌ .ai/context.md (content merged into new files)
232+
```
233+
234+
---
235+
236+
## Impact Assessment
237+
238+
### Who is affected?
239+
- **All developers**: Will benefit from AI documentation
240+
- **Claude Code users**: Will benefit from settings.json configuration
241+
- **Cursor/Copilot users**: Can reference .ai/ files
242+
- **PR reviewers**: AI agents will follow established patterns
243+
244+
### Breaking Changes?
245+
-**No breaking changes**
246+
- ✅ All existing files remain (except context.md merged)
247+
- ✅ Personal configurations (.claude/local/) unaffected
248+
- ✅ Backward compatible
249+
250+
### Migration Required?
251+
-**No migration needed**
252+
- ✅ .ai/context.md content merged into new files
253+
- ✅ Existing workflows continue working
254+
- ✅ Claude Code benefits immediately from settings.json
255+
256+
---
257+
258+
## Implementation Timeline
259+
260+
### Phase 0: Configuration (Day 1)
261+
- Create `.claude/settings.json`
262+
- Update `.gitignore`
263+
- Create `.ai/README.md`
264+
- Update `CLAUDE.md`
265+
266+
### Phases 1-5: Documentation (Days 2-4)
267+
- Create `AGENTS.md`
268+
- Create `.ai/ARCHITECTURE.md` (system arch + tech stack)
269+
- Create `.ai/CONVENTIONS.md` (standards + patterns)
270+
- Create `.ai/TESTING.md` (all testing types)
271+
272+
### Phase 6-7: Cleanup & Validation (Day 5)
273+
- Delete `.ai/context.md`
274+
- Validate all cross-references
275+
- Test with Claude Code session restart
276+
277+
**Total**: ~5 days implementation time
278+
279+
---
280+
281+
## Questions for Team Review
282+
283+
1. **Approve directory structure?** ✅ / ❌
284+
2. **Approve checking in `.claude/settings.json`?** ✅ / ❌
285+
3. **Approve deleting `.ai/context.md`?** ✅ / ❌
286+
4. **Any additional files needed?** _____________
287+
5. **Any concerns with gitignore strategy?** _____________
288+
6. **Preferred implementation timeline?** _____________
289+
290+
---
291+
292+
## Sample: .claude/settings.json (Team Configuration)
293+
294+
This is what will be checked into git:
295+
296+
```json
297+
{
298+
"hooks": {
299+
"SessionStart": [
300+
{
301+
"hooks": [
302+
{
303+
"type": "command",
304+
"comment": "Load central AI guide",
305+
"command": "cat AGENTS.md"
306+
},
307+
{
308+
"type": "command",
309+
"comment": "Load all team guidelines (3 .ai/ files)",
310+
"command": "find .ai -type f -name '*.md' -not -name 'README.md' -exec cat {} +"
311+
}
312+
]
313+
}
314+
]
315+
},
316+
"permissions": {
317+
"allow": [
318+
"Read(//AGENTS.md)",
319+
"Read(//CLAUDE.md)",
320+
"Read(//.ai/**)",
321+
"Read(//STYLEGUIDE.md)",
322+
"Read(//INTERNATIONALIZATION.md)",
323+
"Read(//CONTRIBUTING.md)",
324+
"Read(//.claude/commands/**)",
325+
"Bash(yarn test:*)",
326+
"Bash(yarn build)",
327+
"Bash(yarn lint)",
328+
"Bash(yarn i18n)",
329+
"Bash(./build-backend.sh)",
330+
"Bash(./test-backend.sh)",
331+
"Bash(git status)",
332+
"Bash(git diff:*)",
333+
"Bash(git log:*)",
334+
"SlashCommand(/init)",
335+
"SlashCommand(/plugin-api-review)"
336+
]
337+
}
338+
}
339+
```
340+
341+
**Why These Permissions?**
342+
- Common Console development operations
343+
- Safe read operations
344+
- Standard build/test commands
345+
- No destructive operations without asking
346+
347+
**Personal Permissions?**
348+
- Developers can add more in `.claude/settings.local.json` (gitignored)
349+
- Personal settings extend (not override) team settings

0 commit comments

Comments
 (0)