OpenWriterControle/.opencode/context/core/context-system/standards/codebase-references.md
Darren Hinde 1819b2516b
refactor: remove plugins from profiles and update opencoder agent (#122)
* refactor: remove plugins from profiles and update opencoder agent

- Remove plugin:notify, plugin:telegram-bot, and plugin:telegram-notify from Business, Full, and Advanced profiles
- Update opencoder agent to use ContextScout for discovery instead of 'DIGGING IN...' phrase
- Reduces profile component count and improves agent context discovery workflow

* feat: implement function-based context system with wildcard dependencies

## Context System Overhaul

### New Context Standards (3 files)
- Add frontmatter.md: HTML comment frontmatter format for all context files
- Add codebase-references.md: Standards for linking context to code implementation
- Update templates.md: Add frontmatter and codebase references to all 5 templates

### System Builder Updates
- Replace topic-based folders (domain/processes/standards/templates) with function-based folders (concepts/examples/guides/lookup/errors)
- Add navigation.md as REQUIRED file in all context structures
- Update validation rules: 4 → 8 checks (frontmatter, codebase refs, MVI limits)
- Update file size limits to match MVI principle per folder type
- Update architecture planning, context organization, and delivery stages

### Context Organizer Refactor
- Replace 27 individual dependencies with 1 wildcard: context:core/context-system/*
- Implement 9-step standards-based workflow with code discovery
- Add Step 0: Load standards via @ symbol
- Add Step 1: Discover codebase using glob patterns
- Update all generation steps to use templates with frontmatter + codebase refs
- Add comprehensive validation (frontmatter, codebase refs, MVI, file size)

### Registry Updates
- Add 2 new context entries: frontmatter, codebase-references
- Update context-organizer dependencies: 11 individual IDs → 1 wildcard pattern
- Simplify maintenance: auto-includes new context-system files

### Benefits
- Simpler maintenance: 27 lines → 2 lines in agent dependencies
- Better organization: Function-based structure (what/how/reference/troubleshooting)
- Auto-scaling: New context-system files automatically included
- Standards enforcement: Frontmatter and codebase references required
- Complete coverage: All context-system files discoverable via wildcard

### Other Changes
- Update ContextScout permissions and documentation
- Add visual-development.md context file
- Update design-iteration workflow
- Remove deprecated WORKFLOW_GUIDE.md
- Update README.md and developer profile

Co-authored-by: System Builder <system@openagents.dev>

* fix: add wildcard support to registry validation script

- Handle wildcard patterns in context dependencies (e.g., context:core/context-system/*)
- Extract prefix before wildcard and match against context file paths
- Prevents validation failures for wildcard dependencies in registry

---------

Co-authored-by: System Builder <system@openagents.dev>
2026-01-27 22:49:24 +00:00

3.4 KiB

Codebase References

Purpose: Link context files to actual code implementation

Last Updated: 2026-01-27


Core Principle

ALL context files SHOULD include `📂 Codebase References` section linking to relevant code. Use sections that apply to your context type (not all files need all sections).

Why: Agents need to find actual implementation, not just read about it.


Section Types (Use What's Relevant)

Business Domain Context

**Business Logic**: (MOST IMPORTANT for business domains)
- `src/orders/rules/validation-rules.ts` - Order validation business rules

**Implementation**:
- `src/orders/order-processor.ts` - Main order processing logic

**Models/Types**:
- `src/orders/models/order.model.ts` - Order data model

**Tests**:
- `src/orders/__tests__/processor.test.ts` - Order processing tests

**Configuration**:
- `config/orders.config.ts` - Order processing config

Technical/Code Context

**Implementation**: (MOST IMPORTANT for technical contexts)
- `src/auth/jwt-handler.ts` - JWT authentication implementation

**Examples**:
- `src/auth/examples/jwt-example.ts` - Working JWT example

**Types**:
- `src/auth/types/jwt-payload.ts` - JWT payload types

**Tests**:
- `src/auth/__tests__/jwt.test.ts` - JWT tests

Standards/Quality Context

**Validation/Enforcement**: (MOST IMPORTANT for standards)
- `scripts/validate-code-quality.ts` - Code quality validator
- `eslint.config.js` - ESLint rules

**Examples**:
- `examples/good-code.ts` - Good code example
- `examples/bad-code.ts` - Anti-pattern example

**Tests**:
- `tests/code-quality.test.ts` - Quality validation tests

Operational Context

**Scripts/Tools**: (MOST IMPORTANT for operations)
- `scripts/deploy.sh` - Deployment script
- `scripts/monitor.ts` - Monitoring setup

**Configuration**:
- `config/deployment.config.ts` - Deployment configuration
- `.github/workflows/deploy.yml` - CI/CD workflow

Rules

1. Use project-relative paths (src/..., not /Users/...) 2. Use forward slashes (/) 3. Include file extension (.ts, .js, .sh) 4. Brief description (3-10 words) for each file 5. Verify files exist (warn if not found) 6. Use relevant sections only (not all files need all sections)

Examples

Business Context:

## 📂 Codebase References

**Business Logic**:
- `src/payments/rules/validation-rules.ts` - Card validation rules
- `src/payments/rules/fraud-detection.ts` - Fraud detection logic

**Implementation**:
- `src/payments/payment-processor.ts` - Main payment processing

**Tests**:
- `src/payments/__tests__/processor.test.ts` - Payment tests

Technical Context:

## 📂 Codebase References

**Implementation**:
- `src/auth/jwt-handler.ts` - JWT authentication

**Examples**:
- `examples/jwt-auth.ts` - Working example

**Tests**:
- `src/auth/__tests__/jwt.test.ts` - JWT tests

Validation

  • Has "📂 Codebase References" section?
  • Most important section for context type included?
  • Paths are project-relative?
  • Paths include extensions?
  • Each path has 3-10 word description?

  • frontmatter.md - Frontmatter format
  • templates.md - File templates
  • structure.md - File organization
  • templates/ - File templates with codebase references