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