Standards: Pattern Discovery Through RAG
This page explains how standards create knowledge compounding in prAxIs OS through automatic pattern discovery via semantic search.
What you'll understand:
- How standards enable automatic pattern discovery
- The self-improving mechanism
- RAG indexing and discovery
- The compounding effect over time
- Why AI-authored standards work better
What Are Standards?β
Standards are reusable patterns documented in markdown files that AI agents discover automatically through semantic search.
Location: .praxis-os/standards/development/[topic].md
Access: search_standards("pattern")
Purpose: Make project-specific conventions discoverable and automatically applied
The Problem Standards Solveβ
Without Standards: Reinvention and Inconsistencyβ
Scenario: Three AI Agents, Same Project
Agent 1 (Week 1):
- Implements authentication with custom JWT refresh pattern
- Makes architectural decisions about token storage
- Completes the work
- Learning is lost β
Agent 2 (Week 3):
- Needs to implement authorization
- Queries standards, finds only universal patterns
- Makes different decisions about token handling
- Creates inconsistency in the codebase β
Agent 3 (Week 5):
- Debugging auth issues
- Finds two different JWT patterns in code
- Wastes time investigating which is "correct"
- No single source of truth β
Result: Reinvention, inconsistency, technical debt.
With Standards: Discovery and Consistencyβ
Same Scenario With Standards
Agent 1 (Week 1):
- Implements authentication with custom JWT refresh pattern
- Human: "We should document this as a standard"
- Agent queries:
search_standards("how to create standards") - Creates:
.praxis-os/standards/development/authentication.md - Learning is captured β
Agent 2 (Week 3):
- Needs to implement authorization
- Queries:
search_standards("JWT authentication patterns") - RAG returns Agent 1's documented standard
- Follows the established pattern automatically
- Consistency maintained β
Agent 3 (Week 5):
- Working on auth features
- Queries standards, finds documented pattern
- Uses authoritative project convention
- Single source of truth β
Result: Consistency, velocity, compound knowledge.
How the Mechanism Worksβ
1. AI Queries Heavily (5-10+ Times Per Task)β
Key: AI always queries before implementing. This is the foundation of the system.
2. Human Identifies Reusable Patternsβ
As work progresses, you notice patterns worth documenting:
- "We use this error format consistently"
- "This is our third time handling API pagination this way"
- "This pattern should be our standard"
You say: "Let's create a standard for this"
3. AI Creates the Standard (Following Meta-Standards)β
AI doesn't just write the standardβit queries to learn HOW to create good standards:
# Query 1: Structure
search_standards("how to create standards")
# Returns: Required sections, quality criteria
# Query 2: Discoverability
search_standards("RAG content optimization")
# Returns: Keywords, query hooks, TL;DR patterns
# Query 3: Search patterns
search_standards("query construction patterns")
# Returns: How future queries will find this content
Then AI writes the standard with:
- Purpose: Why this exists
- The Problem: What happens without it
- The Standard: Specific, actionable rules
- Examples: Real code from your project
- Anti-patterns: Common mistakes to avoid
- Keywords: Optimized for semantic search
Why Heavy Querying Matters:
- Ensures consistent structure across all standards
- Optimizes for discoverability (AI knows how it searches)
- Follows meta-standards (standards about creating standards)
- Creates standards that AI can find
4. RAG Automatically Indexesβ
- File watcher detects new
.mdinstandards/development/ - RAG engine re-indexes within ~5 seconds
- Standard is now discoverable via
search_standards() - Semantic embeddings enable natural language queries
No manual work neededβjust save the file.
5. Future AI Discovers and Appliesβ
Next time any AI works on related code:
search_standards("API error handling")
# Returns YOUR standard in top 3 results
# AI follows YOUR project's conventions automatically
This happens automatically on every task, forever.
The Self-Improving Loopβ
The Reinforcing Mechanismβ
- Each query retrieves the "query more" message
- Repeated exposure strengthens the pattern
- Pattern becomes self-sustaining through repetition
- Works with AI's probabilistic nature, not against it
Each standard makes the next 10 tasks better.
Why This Is Self-Reinforcingβ
- Standards teach querying: Content includes "query before implementing"
- Querying finds standards: AI discovers patterns automatically
- Standards reinforce querying: Each result includes "query liberally"
- More queries = more discovery: AI learns to query comprehensively
- Better standards result: AI creates standards using learned patterns
The system improves through use.
The Compounding Effect Over Timeβ
AI: search_standards("API patterns")AI: search_standards("API patterns")AI: search_standards("API rate limiting")The timeline shows how standards accumulate:
Week 1: Foundationβ
Output: Good code using universal best practices.
Week 4: Project Awarenessβ
Output: Consistent code following YOUR patterns.
What changed:
- API error handling standardized
- Database naming conventions documented
- Testing patterns established
- Code organization defined
- Integration approaches captured
Week 12: Project Expertiseβ
Output: Expert-level code, fewer explanations needed, faster velocity.
What changed:
- Architectural patterns documented
- Domain-specific conventions established
- Performance optimization patterns captured
- Security practices standardized
- Deployment procedures defined
Week 24: Organizational Memoryβ
Output: AI delivers expert-level work automatically. New team members (human or AI) ramp up by querying standards.
What changed:
- Every major pattern documented
- Consistent quality across entire codebase
- New features follow established conventions
- Technical debt reduced (patterns followed consistently)
- Knowledge survives team changes
Why AI-Authored Standards Work Betterβ
When AI creates standards (with human approval):
1. AI Understands Search Patternsβ
AI knows how it will query in the future:
- What keywords to include
- What questions to answer
- What phrases match semantic search
Result: Standards optimized for AI discovery.
2. AI Follows Meta-Patternsβ
AI queries standard-creation standards:
- Learns required structure
- Follows RAG optimization guidelines
- Includes all necessary sections
Result: Consistent quality across all standards.
3. AI Optimizes for Its Own Consumptionβ
AI creates content structured for:
- Semantic search (embeddings)
- Natural language queries
- Contextual relevance
Result: High-quality retrieval on every query.
4. Queries Ensure Qualityβ
Heavy querying before creation means:
- Standards follow established patterns
- RAG optimization is built-in
- Discovery is tested implicitly
Result: Standards that work automatically.
Real-World Exampleβ
Before Standard: Inconsistencyβ
Task 1 (Week 1):
# AI implements error handling
try:
response = api.call()
except APIError as e:
return {"error": str(e)} # Pattern A
Task 2 (Week 2):
# Different AI, different pattern
try:
response = api.call()
except APIError as e:
raise HTTPException(detail=str(e)) # Pattern B
Result: Inconsistency, no single pattern.
After Creating Standard: Consistencyβ
Human: "We should standardize our API error handling. Let's always return structured errors with codes and messages."
AI Creates Standard:
- Queries:
search_standards("how to create standards") - Creates:
.praxis-os/standards/development/api-error-handling.md
# API Error Handling Standard
**Keywords**: API errors, error handling, error responses...
## The Standard
All API errors must return:
- `error_code`: String identifier
- `message`: Human-readable message
- `details`: Optional structured data
Example:
{
"error_code": "VALIDATION_ERROR",
"message": "Invalid email format",
"details": {"field": "email"}
}
...
Task 3 (Week 3):
# New AI queries before implementing
search_standards("API error handling")
# Discovers the standard
# Implements consistently
try:
response = api.call()
except APIError as e:
return {
"error_code": e.code,
"message": str(e),
"details": e.context
}
Result: Every future API implementation uses the same pattern automatically.
Key Principlesβ
1. Discovery Over Memoryβ
AI doesn't "memorize" standardsβit discovers them on demand:
- Queries before each task
- Gets fresh, relevant context
- Finds exactly what's needed when needed
- Scales to hundreds of standards
Why this matters: Memory fades, discovery works at any scale.
2. Patterns, Not Implementationsβ
Standards document reusable patterns:
- β "How to handle API errors" (pattern)
- β "User authentication implementation" (implementation)
Why this matters: Patterns apply to many situations, implementations don't.
3. Project-Specific, Not Universalβ
Standards capture YOUR conventions:
- β "Our API response format"
- β "REST API best practices" (already in universal standards)
Why this matters: Universal patterns are already availableβdocument what's unique to your project.
4. Collaborative Creationβ
Human decides what to document:
- Recognizes reusable patterns
- Makes strategic decision to standardize
- Provides context and requirements
AI does the writing:
- Queries heavily to learn structure
- Creates RAG-optimized content
- Follows meta-standards for consistency
Why this matters: Combines human judgment with AI execution.
The Long-Term ROIβ
Months 1-3: Building the Foundationβ
You're actively documenting patterns as you discover them. This feels like extra work initially, but you're investing in the future.
Cost: 5-10 minutes per standard ROI: Each standard saves 15-30 minutes on future tasks Break-even: After 2-3 uses of the pattern
Months 4-6: Acceleration Phaseβ
The knowledge base reaches critical mass. AI agents start delivering expert-level work with minimal guidance.
Effect: 3-4x velocity improvement on routine tasks Reason: AI automatically follows established patterns
Months 7-12: Organizational Memoryβ
Your project's conventions, patterns, and decisions are fully codified. New team members (human or AI) ramp up by querying standards.
Effect: Onboarding time reduced by 70-80% Reason: Standards provide instant project knowledge
Year 2+: Compound Returnsβ
Standards inform new standards. Patterns build on patterns. The system maintains consistency automatically across 100+ documented conventions.
Effect: Project maintains architectural consistency at scale without constant human oversight Reason: Knowledge density creates automatic quality
Common Patterns Worth Standardizingβ
API Patternsβ
- Error responses
- Pagination
- Filtering/sorting
- Authentication
- Rate limiting
- Versioning
Database Patternsβ
- Naming conventions (tables, columns, indexes)
- Migration patterns
- Query patterns
- Transaction handling
Code Organizationβ
- File structure
- Import ordering
- Module organization
- Naming conventions
Testing Patternsβ
- Test organization
- Naming patterns
- Fixture usage
- Mock strategies
Integration Patternsβ
- External API calls
- Event handling
- Message queue usage
- Caching strategies
Next Stepsβ
Learn How to Create Standards:
- Creating Project Standards - Complete how-to guide
- Your First Standard - Hands-on tutorial
Understand the Full Picture:
- Knowledge Compounding - Overview of both mechanisms
- Specs Compounding - How specs preserve history
See Related Concepts:
- How It Works: RAG - The RAG mechanism that powers discovery
- Standards Reference - Browse existing standards
Related Documentationβ
- Creating Project Standards - Complete how-to guide
- Your First Project Standard - Hands-on tutorial
- Knowledge Compounding - Overview of both mechanisms
- How It Works: RAG - RAG behavioral reinforcement