Skip to content

Commit 554b912

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 554b912

File tree

1 file changed

+350
-0
lines changed

1 file changed

+350
-0
lines changed

PROPOSED-AI-DOCS-STRUCTURE.md

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

0 commit comments

Comments
 (0)