Purpose: How to choose and apply the right organizational pattern
Last Updated: 2026-01-08
Estimated time: 30-45 min per category
Use for: Repository-specific context
Structure: Organize by what the information does
concepts/ - What it isexamples/ - Working codeguides/ - How to do itlookup/ - Quick referenceerrors/ - TroubleshootingExample: openagents-repo/
Use for: Multi-technology development context
Structure: Organize by what you're doing (concern), then how (approach/tech)
{concern}/ - What you're working on
{approach}/ - How you're doing it{tech}/ - What you're usingExample: development/
YES → Use Pattern A (Function-Based)
Examples:
openagents-repo/ - OpenAgents Control repository workmyproject-repo/ - Your project's repositoryNO → Continue to Step 2
YES → Use Pattern B (Concern-Based)
Examples:
development/ - Frontend, backend, data, infrastructureui/ - Web, terminal, mobile (future)NO → Use Pattern A (Function-Based)
Examples:
content/ - Copywriting frameworks (single domain)product/ - Product management (single domain)YES → Use Pattern B (Concern-Based)
Example hierarchy:
development/
├── frontend/ # Concern
│ ├── react/ # Tech
│ └── vue/ # Tech
├── backend/ # Concern
│ ├── api-patterns/ # Approach
│ └── nodejs/ # Tech
NO → Use Pattern A (Function-Based)
✅ Repository-specific context (e.g., openagents-repo/)
✅ Single-domain content (e.g., content/, product/)
✅ Content naturally groups by information type
✅ Users need to find "how to do X" quickly
{category}/
├── navigation.md
├── quick-start.md # Optional: orientation
│
├── core-concepts/ # Optional: foundational
│ ├── navigation.md
│ └── {concept}.md
│
├── concepts/ # What it is
│ ├── navigation.md
│ └── {concept}.md
│
├── examples/ # Working code
│ ├── navigation.md
│ └── {example}.md
│
├── guides/ # How to do it
│ ├── navigation.md
│ └── {guide}.md
│
├── lookup/ # Quick reference
│ ├── navigation.md
│ └── {lookup}.md
│
└── errors/ # Troubleshooting
├── navigation.md
└── {error}.md
openagents-repo/
├── navigation.md
├── quick-start.md
│
├── core-concepts/ # Foundational (agents, evals, registry)
├── concepts/ # Additional concepts
├── guides/ # How to add agent, test, etc.
├── lookup/ # Commands, file locations
├── examples/ # Context bundles, prompts
└── errors/ # Tool permissions, validation
Why this works:
✅ Multi-technology content (e.g., development/)
✅ Content organized by "what you're doing" (concern)
✅ Multiple approaches/technologies per concern
✅ Need to support full-stack workflows
{category}/
├── navigation.md
├── {concern}-navigation.md # Specialized (optional)
│
├── principles/ # Universal (optional)
│ ├── navigation.md
│ └── {principle}.md
│
├── {concern}/ # What you're doing
│ ├── navigation.md
│ │
│ ├── {approach}/ # How (approach-based)
│ │ ├── navigation.md
│ │ └── {pattern}.md
│ │
│ └── {tech}/ # How (tech-specific)
│ ├── navigation.md
│ └── {pattern}.md
development/
├── navigation.md
├── ui-navigation.md # Specialized
├── backend-navigation.md # Specialized
│
├── principles/ # Universal
│ ├── clean-code.md
│ └── api-design.md
│
├── frontend/ # Concern: client-side
│ ├── react/ # Tech
│ │ ├── hooks-patterns.md
│ │ └── tanstack/ # Sub-tech
│ └── vue/ # Tech
│
├── backend/ # Concern: server-side
│ ├── api-patterns/ # Approach
│ │ ├── rest-design.md
│ │ └── graphql-design.md
│ ├── nodejs/ # Tech
│ └── authentication/ # Functional concern
│
└── data/ # Concern: data layer
├── sql-patterns/ # Approach
└── orm-patterns/ # Approach
Why this works:
✅ Category has both repository-specific AND multi-tech content ✅ Need flexibility for different subcategories
{category}/
├── navigation.md
│
├── {subcategory-A}/ # Function-based
│ ├── concepts/
│ ├── guides/
│ └── examples/
│
└── {subcategory-B}/ # Concern-based
├── {concern}/
│ ├── {approach}/
│ └── {tech}/
ui/
├── navigation.md
│
├── web/ # Platform (concern-based)
│ ├── navigation.md
│ ├── animation-patterns.md
│ ├── ui-styling-standards.md
│ └── design/
│ ├── concepts/ # Function-based within
│ └── examples/
│
└── terminal/ # Platform (concern-based)
└── navigation.md
Why this works:
Use when: Multiple technologies solve the same concern
backend/
├── api-patterns/ # Concern: API design
│ ├── rest-design.md # Approach
│ ├── graphql-design.md # Approach
│ └── grpc-patterns.md # Approach
├── nodejs/ # Tech
└── python/ # Tech
Why: Principles (REST, GraphQL) are more important than implementation (Node, Python)
Use when: Technology dictates the approach
frontend/
├── react/ # Tech
│ ├── hooks-patterns.md # Concern: state
│ ├── component-architecture.md # Concern: structure
│ └── tanstack/ # Sub-tech
│ ├── query-patterns.md # Concern: data fetching
│ └── router-patterns.md # Concern: routing
└── vue/ # Tech
Why: React patterns differ significantly from Vue patterns
✅ Concern spans multiple subcategories ✅ Common workflows cross category boundaries ✅ Users need task-focused routes
ui-navigation.md (in development/):
development/frontend/ + ui/web/backend-navigation.md (in development/):
backend/api-patterns/, backend/nodejs/, backend/authentication/fullstack-navigation.md (in development/):
List all files:
find .opencode/context/{category} -name "*.md" | sort
Categorize each file:
Use decision tree above to choose:
For Pattern A:
mkdir -p {category}/{concepts,examples,guides,lookup,errors}
For Pattern B:
mkdir -p {category}/{concern}/{approach}
mkdir -p {category}/{concern}/{tech}
Move files to appropriate locations:
mv {category}/old-file.md {category}/{concern}/{tech}/new-file.md
Rename for clarity:
mv code.md code-quality.md
mv tests.md test-coverage.md
Create navigation.md at each level:
Follow navigation design guide (navigation-design.md)
Find and update all cross-references:
grep -r "old-path" .opencode/context/
# Update to new paths
Before (flat):
development/
├── clean-code.md
├── api-design.md
├── react-patterns.md
├── animation-patterns.md
├── design-systems.md
After (concern-based):
development/
├── navigation.md
├── ui-navigation.md
│
├── principles/
│ ├── clean-code.md
│ └── api-design.md
│
└── frontend/
└── react/
└── react-patterns.md
Moved to ui/:
ui/web/
├── animation-patterns.md
└── design-systems.md
Before (mixed):
openagents-repo/
├── README.md
├── agents.md
├── evals.md
├── adding-agent.md
├── testing-agent.md
├── commands.md
After (function-based):
openagents-repo/
├── navigation.md
├── quick-start.md
│
├── core-concepts/
│ ├── agent-architecture.md
│ └── eval-framework.md
│
├── guides/
│ ├── adding-agent.md
│ └── testing-agent.md
│
└── lookup/
└── commands.md
After organizing:
| Issue | Solution |
|---|---|
| File fits multiple concerns | Choose primary concern, add cross-reference |
| Too many subcategories | Group by higher-level concern |
| Unclear where file goes | Ask: "What task does this support?" |
| Navigation too complex | Create specialized navigation file |
../context-system.md - Core principlesnavigation-design.md - How to create navigation files../examples/navigation-examples.md - Good examples