Skip to content

Latest commit

Β 

History

History
519 lines (358 loc) Β· 14 KB

File metadata and controls

519 lines (358 loc) Β· 14 KB

Organization Patterns & Conventions

Last Updated: 2025-11-15

Purpose: Guide for maintaining consistent file organization and documentation structure


πŸ“‹ Overview

This document defines the patterns, conventions, and rules used to organize the repository. Follow these patterns when adding new files, creating indexes, or reorganizing content.


πŸ—‚οΈ Directory Structure Patterns

Root Directory

Documentation Files

  • README.md - Main project overview (always at root)
  • AGENTS.md - Repository guidelines for AI agents (always at root)
  • ROOT_FILES_INDEX.md - Index of root directory files
  • DATA_FILES_INDEX.md - Index of data files
  • CONFIGURATION_FILES_INDEX.md - Index of configuration files

Pattern: Root-level documentation files are high-level overviews or guidelines that should be immediately visible.

Configuration Files

  • .env - Active configuration (gitignored)
  • .env.example* - Configuration templates
  • package.json - Node.js package configuration
  • tsconfig.json - TypeScript configuration
  • ecosystem.config.cjs - PM2 configuration

Pattern: Configuration files stay at root for easy access.

Process Management

  • keep-alive.ts - Watchdog script (root for easy execution)

Pattern: Process management scripts at root for direct execution.


docs/ Directory Structure

docs/
β”œβ”€β”€ Core Documentation (root of docs/)
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   β”œβ”€β”€ EXECUTION_FLOW.md
β”‚   β”œβ”€β”€ CONCEPTS.md
β”‚   β”œβ”€β”€ CODE_STRUCTURE.md
β”‚   β”œβ”€β”€ CONFIGURATION_GUIDE.md
β”‚   β”œβ”€β”€ GETTING_STARTED.md
β”‚   β”œβ”€β”€ MASTER_SYNTHESIS.md
β”‚   β”œβ”€β”€ CHANGELOG_2025-11.md
β”‚   β”œβ”€β”€ INDEX_OF_INDEXES.md ⭐
β”‚   β”œβ”€β”€ DOCUMENTATION_INDEX.md
β”‚   β”œβ”€β”€ CROSS_REFERENCE_MAP.md
β”‚   β”œβ”€β”€ TIMELINE_INDEX.md
β”‚   β”œβ”€β”€ MERGE_PLAN.md
β”‚   β”œβ”€β”€ CURSOR_TODO.md
β”‚   └── README.md
β”‚
β”œβ”€β”€ guides/                    # User guides (27 files)
β”‚   β”œβ”€β”€ GUIDES_INDEX.md        # Category index
β”‚   └── [guide files]
β”‚
β”œβ”€β”€ audits/                    # Audit reports (80+ files)
β”‚   β”œβ”€β”€ AUDIT_INDEX.md         # Category index
β”‚   └── [audit files]
β”‚
β”œβ”€β”€ analysis/                  # Analysis reports (80+ files)
β”‚   β”œβ”€β”€ ANALYSIS_INDEX.md      # Category index
β”‚   └── [analysis files]
β”‚
β”œβ”€β”€ research/                  # Research documents (4 files)
β”‚   β”œβ”€β”€ RESEARCH_INDEX.md      # Category index
β”‚   └── [research files]
β”‚
└── prompts/                   # AI agent prompts (8 files)
    └── [prompt files]

Pattern: Each category has its own subdirectory with a dedicated index file.


πŸ“ File Naming Conventions

Documentation Files

Core Documentation

  • UPPERCASE_WITH_UNDERSCORES.md - Core documentation files
    • Examples: ARCHITECTURE.md, EXECUTION_FLOW.md, CONCEPTS.md
    • Use for: Main documentation files that are frequently referenced

Index Files

  • CATEGORY_INDEX.md - Category-specific indexes
    • Examples: GUIDES_INDEX.md, AUDIT_INDEX.md, ANALYSIS_INDEX.md
    • Pattern: Always named [CATEGORY]_INDEX.md in the category directory

Date-Stamped Files

  • DESCRIPTION_YYYY-MM-DD.md - Date-stamped documentation
    • Examples: POST_MORTEM_2025-11-13.md, AUDIT_2025-11-13.md
    • Pattern: [DESCRIPTION]_[YYYY-MM-DD].md or [DESCRIPTION]_[YYYY-MM-DD]_[TIME].md

Time-Stamped Files

  • DESCRIPTION_YYYY-MM-DD_HHMM.md - Time-stamped documentation
    • Examples: POST_MORTEM_2025-11-13_1111PST.md, AUDIT_2025-11-13_6PM.md
    • Pattern: [DESCRIPTION]_[YYYY-MM-DD]_[TIME][TZ].md or [DESCRIPTION]_[YYYY-MM-DD]_[TIME].md

Session Notes

  • cursor_[description].md - Cursor session notes
    • Examples: cursor_start_it_now.md, cursor_resume_merge_plan_discussion.md
    • Pattern: cursor_[lowercase_with_underscores].md
    • Location: docs/analysis/ (session notes are analysis files)

Planning Documents

  • DESCRIPTION.md - Planning and tracking documents
    • Examples: MERGE_PLAN.md, CURSOR_TODO.md
    • Pattern: UPPERCASE_WITH_UNDERSCORES.md
    • Location: docs/ root (planning documents)

πŸ“š Index Organization Patterns

Index File Structure

Every category index follows this structure:

# [Category] Index

Complete index of all [category] files, organized by [organization method].


---

## πŸ“‹ Quick Reference

### **Most [Important/Recent] [Items]**
- **[Item Name](path/to/file.md)** ⭐ - Brief description
- **[Item Name](path/to/file.md)** - Brief description

---

## πŸ“š [Category] by [Organization Method]

### **[Subcategory 1]**

#### **[Sub-subcategory]**
- **[Item Name](path/to/file.md)** - Description
  - Additional details
  - Key points

---

## πŸ“… [Category] by Date (if applicable)

### **YYYY-MM-DD**
- Item 1
- Item 2

---

## πŸ“– Related Documentation

- **[Related Index](../path/to/index.md)** - Description
- **[Related Guide](../path/to/guide.md)** - Description

---

**Total [Category] Files**: X

⭐ = Highly recommended / Most important

Index Organization Methods

By Category

  • Guides: Organized by category (Getting Started, Configuration, Running, etc.)
  • Audits: Organized by type (Post-Mortems, Comprehensive Audits, Code Reviews, etc.)

By Date

  • Audits: Organized by date (2025-11-13, 2025-11-12, etc.)
  • Analysis: Organized by date for date-specific reports

By Topic

  • Analysis: Organized by topic (Gas Strategy, Performance, Log Analysis, etc.)
  • Research: Organized by topic (RPC & Infrastructure, MEV & Optimization)

By Issue Type

  • Audits: Organized by issue type (Initialization, RPC, Balance, Gas, etc.)
  • Analysis: Organized by issue type for troubleshooting

πŸ—‚οΈ File Categorization Rules

Guides (docs/guides/)

Criteria: How-to guides, step-by-step instructions, user-facing documentation

Categories:

  • Getting Started - First-time setup, quick starts
  • Configuration & Setup - Configuration guides, timing setup
  • Running & Operations - Runbooks, operational guides
  • Troubleshooting - Problem-solving guides
  • Testing - Testing procedures
  • Optimization - Performance optimization guides
  • Reference - Reference materials, quick references

Pattern: User-facing, actionable content


Audits (docs/audits/)

Criteria: Code reviews, post-mortems, failure analysis, implementation notes

Categories:

  • Post-Mortems - Failure analysis, root cause analysis
  • Comprehensive Audits - Full system audits
  • Code Reviews - External code reviews (ChatGPT, Codex)
  • Implementation Notes - Implementation observations
  • Runtime Patch Notes - Runtime fixes and changes
  • Deep Failure Point Audits - Detailed failure analysis

Pattern: Analysis of failures, reviews, or implementation work


Analysis (docs/analysis/)

Criteria: Performance analysis, log analysis, optimization reports, status reports

Categories:

  • Gas Strategy & Optimization - Gas policy, cost analysis
  • Performance & Optimization - RPC optimization, runtime performance
  • Log Analysis - Log examination and analysis
  • Testing & Verification - Test results, verification reports
  • Fixes & Implementation - Fix reports, implementation status
  • Status & Reports - Status summaries, production reports
  • Session Notes & Planning - Session notes, planning documents

Pattern: Data analysis, performance reports, status updates


Research (docs/research/)

Criteria: External research, provider analysis, strategy research

Categories:

  • RPC & Infrastructure - RPC provider research, infrastructure analysis
  • MEV & Optimization - MEV strategies, optimization research

Pattern: External findings, provider research, strategy research


Prompts (docs/prompts/)

Criteria: AI agent prompts, collaboration prompts

Pattern: Prompts for AI agents (ChatGPT, Codex, etc.)


πŸ”— Cross-Reference Patterns

Cross-Reference Map (docs/CROSS_REFERENCE_MAP.md)

Purpose: Maps relationships between documents

Organization:

  • Issue-based cross-references (find all docs about a specific issue)
  • Timeline-based cross-references (find all docs from a specific date)
  • Implementation flow cross-references (follow implementation journeys)
  • Documentation cross-references (see how docs relate)

Pattern: Multi-dimensional relationship mapping


Timeline Index (docs/TIMELINE_INDEX.md)

Purpose: Chronological index of all documentation and events

Organization:

  • Complete timeline (hour-by-hour for recent dates)
  • Document creation timeline
  • Development phases
  • Key milestones

Pattern: Chronological organization


πŸ“Š Index Maintenance Patterns

When Adding a New File

  1. Determine Category

    • Guide β†’ docs/guides/
    • Audit β†’ docs/audits/
    • Analysis β†’ docs/analysis/
    • Research β†’ docs/research/
    • Prompt β†’ docs/prompts/
  2. Add to Category Index

    • Open the appropriate [CATEGORY]_INDEX.md
    • Add entry in appropriate section
    • Follow existing formatting patterns
  3. Update Master Indexes (if needed)

    • Update docs/INDEX_OF_INDEXES.md if structure changes
    • Update docs/DOCUMENTATION_INDEX.md if it's a major document
    • Update docs/CROSS_REFERENCE_MAP.md if it relates to other documents
    • Update docs/TIMELINE_INDEX.md with creation date
  4. Update Counts

    • Update file count in category index
    • Update total count in master indexes if needed

When Creating a New Category

  1. Create Directory

    • Create docs/[category]/ directory
  2. Create Index File

    • Create docs/[category]/[CATEGORY]_INDEX.md
    • Follow index file structure pattern
  3. Update Master Indexes

    • Add category to docs/INDEX_OF_INDEXES.md
    • Add category to docs/DOCUMENTATION_INDEX.md
    • Update structure diagram in docs/DOCUMENTATION_INDEX.md
  4. Update Cross-References

    • Add category to docs/CROSS_REFERENCE_MAP.md if applicable

🎯 Naming Pattern Examples

Date-Stamped Files

POST_MORTEM_2025-11-13.md                    # Date only
POST_MORTEM_2025-11-13_1111PST.md           # Date + time + timezone
AUDIT_2025-11-13_6PM.md                      # Date + time (informal)
CHATGPT_DEEP_RESEARCH_AUDIT_2025-11-13_6PM.md # Date + time (descriptive)

Pattern: [DESCRIPTION]_[YYYY-MM-DD][_TIME][TZ].md


Session Notes

cursor_start_it_now.md
cursor_continue_testing_and_integration.md
cursor_resume_merge_plan_discussion.md
cursor_find_steady_teddy_and_mibera_ids.md

Pattern: cursor_[lowercase_with_underscores].md

Location: docs/analysis/ (session notes are analysis files)


Planning Documents

MERGE_PLAN.md
CURSOR_TODO.md

Pattern: UPPERCASE_WITH_UNDERSCORES.md

Location: docs/ root (planning documents)


πŸ“‹ Index Entry Patterns

Standard Entry

- **[Item Name](path/to/file.md)** - Brief description

Entry with Details

- **[Item Name](path/to/file.md)** - Brief description
  - Additional detail 1
  - Additional detail 2
  - Key point

Entry with Star (Important)

- **[Item Name](path/to/file.md)** ⭐ - Brief description

Entry with Type/Status

- **[Item Name](path/to/file.md)** βœ…
  - **Type**: Type description
  - **Status**: Status description
  - **Key Findings**: Key points

πŸ” File Location Decision Tree

Is it a user-facing how-to guide?
β”œβ”€ YES β†’ docs/guides/
└─ NO β†’ Continue

Is it a code review, post-mortem, or failure analysis?
β”œβ”€ YES β†’ docs/audits/
└─ NO β†’ Continue

Is it a performance analysis, log analysis, or status report?
β”œβ”€ YES β†’ docs/analysis/
└─ NO β†’ Continue

Is it external research or provider analysis?
β”œβ”€ YES β†’ docs/research/
└─ NO β†’ Continue

Is it an AI agent prompt?
β”œβ”€ YES β†’ docs/prompts/
└─ NO β†’ Continue

Is it a planning or tracking document?
β”œβ”€ YES β†’ docs/ (root of docs/)
└─ NO β†’ Continue

Is it core documentation (architecture, concepts, etc.)?
β”œβ”€ YES β†’ docs/ (root of docs/)
└─ NO β†’ Review categorization criteria

βœ… Verification Checklist

When adding or organizing files, verify:

  • File is in correct directory based on categorization rules
  • File name follows naming conventions
  • File is added to appropriate category index
  • Category index entry follows formatting patterns
  • File count updated in category index
  • Master indexes updated if needed
  • Cross-reference map updated if file relates to other documents
  • Timeline index updated with creation date
  • Documentation index updated if it's a major document

πŸ“– Related Documentation


🎯 Quick Reference

Directory Patterns

  • docs/guides/ - User guides (27 files)
  • docs/audits/ - Audit reports (80+ files)
  • docs/analysis/ - Analysis reports (80+ files)
  • docs/research/ - Research documents (4 files)
  • docs/prompts/ - AI agent prompts (8 files)

Naming Patterns

  • Core docs: UPPERCASE_WITH_UNDERSCORES.md
  • Date-stamped: DESCRIPTION_YYYY-MM-DD.md
  • Time-stamped: DESCRIPTION_YYYY-MM-DD_HHMM.md
  • Session notes: cursor_[description].md
  • Index files: [CATEGORY]_INDEX.md

Index Patterns

  • Category index in each category directory
  • Master index at docs/INDEX_OF_INDEXES.md
  • Cross-reference map at docs/CROSS_REFERENCE_MAP.md
  • Timeline index at docs/TIMELINE_INDEX.md

Maintained By: Organization Patterns System
Review Frequency: As needed when patterns change