# Dexorder Knowledge Base This directory contains global knowledge documents that are automatically loaded into the agent's context at startup. ## Structure - **platform/**: Platform architecture and capabilities - **trading/**: Trading concepts and fundamentals - **indicators/**: Indicator development and usage - **strategies/**: Strategy development and patterns ## Document Format Documents should be in Markdown format with: - Clear headings for chunking - Optional YAML frontmatter for tags - Code examples where relevant - Cross-references to other docs ### Frontmatter Fields `description` (required) — One or two sentences describing what the article covers. This is injected into every agent's system prompt as a KB catalog so agents know what to look up without making an extra tool call. `tags` (optional) — List of topic tags for categorization. ### Example with Frontmatter ```markdown --- description: "Patterns for writing custom Python indicator scripts that compute values from OHLCV data and plot live on the chart." tags: [indicators, python, development] --- # Custom Indicator Development Content here... ``` ## How It Works 1. At gateway startup, the DocumentLoader scans this directory 2. Each markdown file is chunked by headers (max ~1000 tokens per chunk) 3. Content hash tracking enables incremental updates ## Updating Documents ### During Development - Edit markdown files - Restart gateway or call reload endpoint: `POST /admin/reload-knowledge` ### In Production - Update markdown files in git - Deploy new version - Gateway will detect changes and update vectors automatically ## Adding New Documents 1. Create markdown file in appropriate subdirectory 2. Use clear section headers (##, ###) for automatic chunking 3. Include practical examples and code samples 4. Add tags in frontmatter if using complex categorization 5. Restart gateway or reload knowledge ## Best Practices - **Keep chunks focused**: Each section should cover one topic - **Use examples**: Code samples and practical examples help - **Link concepts**: Reference other docs for deeper dives - **Update regularly**: Keep knowledge current with platform changes - **Test queries**: Verify RAG retrieves relevant chunks ## Maintenance The DocumentLoader tracks: - Content hashes for change detection - Number of chunks per document - Last update timestamps Check logs for load statistics: ``` Knowledge documents loaded: { loaded: 5, updated: 2, skipped: 3 } ```