Skip to content

docs: Refactor documentation and remove book citations from code#6

Merged
m2ux merged 1 commit intomainfrom
feature-review
Nov 17, 2025
Merged

docs: Refactor documentation and remove book citations from code#6
m2ux merged 1 commit intomainfrom
feature-review

Conversation

@m2ux
Copy link
Owner

@m2ux m2ux commented Nov 17, 2025

Summary

This PR refactors the project documentation to follow best practices by:

  1. Creating a centralized REFERENCES.md for design patterns and book sources
  2. Removing direct book citations from code comments (per AGENTS.md guidelines)
  3. Documenting the recursive self-improvement approach
  4. Creating a dedicated SETUP.md for installation instructions
  5. Restructuring README.md for better clarity and prioritization (41% reduction)

Motivation

Code comments should document the system as it exists, not the process that created it.

Previously, book references were scattered throughout code comments. This approach cluttered code with process attribution rather than technical substance.

Key Changes

📚 New Files

  • REFERENCES.md (173 lines) - Comprehensive design patterns and book sources catalog

    • Documents recursive self-improvement approach
    • Maps patterns to files where they're applied
    • Provides guidance for applying concept-RAG to development
  • SETUP.md (302 lines) - Dedicated installation and configuration guide

    • Complete prerequisites and installation steps
    • Database seeding (initial and incremental)
    • MCP client configuration
    • Testing and troubleshooting

✏️ Modified Files

  • README.md (287 lines, down from 487) - 41% reduction

    • Recursive self-improvement featured prominently
    • Better priority order
    • Links to SETUP.md for detailed instructions
    • Design patterns linked to REFERENCES.md
  • 9 source files - Removed book citations from comments

    • Preserved pattern names
    • Added references to REFERENCES.md
    • Focus on 'what' and 'why' specific to this codebase

Recursive Self-Improvement

REFERENCES.md documents how concept-rag was built using its own capabilities:

  1. Software design books indexed into the database
  2. Used concept_search to find relevant patterns during development
  3. Applied discovered concepts to codebase design
  4. Used broad_chunks_search to explore related concepts

This validates the practical utility of RAG systems for software development.

Benefits

✅ Cleaner code comments focused on technical substance
✅ Better documentation organization and navigation
✅ Highlights unique recursive self-improvement value
✅ Follows AGENTS.md guidelines
✅ All pattern references preserved and centralized

Testing

  • ✅ All files compile without errors
  • ✅ No functionality changes (documentation only)
  • ✅ Links verified in documentation files
  • ✅ Pattern references maintained

Design Patterns Preserved

Repository, Domain Service, Adapter, Strategy, Composition Root, Exception Hierarchy, Test Fixture, Test Data Builder

Ready for review! 🚀

Full PR description available in: .ai/summaries/2025-11-17-pr-documentation-refactor.md

- Create REFERENCES.md with comprehensive design patterns and book sources
- Document recursive self-improvement approach (system used itself to discover patterns)
- Remove direct book citations from code comments (follow AGENTS.md guidelines)
- Replace book references with pattern names and link to REFERENCES.md
- Create SETUP.md with detailed installation and seeding instructions
- Restructure README.md for better priority and succinctness (41% reduction)
- Move detailed setup steps from README.md to dedicated SETUP.md

Files modified:
- src/application/container.ts
- src/domain/services/concept-search-service.ts
- src/domain/interfaces/repositories/chunk-repository.ts
- src/infrastructure/lancedb/searchable-collection-adapter.ts
- src/infrastructure/document-loaders/document-loader.ts
- src/infrastructure/document-loaders/pdf-loader.ts
- src/domain/exceptions.ts
- src/__tests__/integration/test-db-setup.ts
- src/__tests__/test-helpers/test-data.ts

Pattern references preserved: Repository, Domain Service, Adapter, Strategy,
Exception Hierarchy, Test Fixture, Test Data Builder, Composition Root.

Code comments now focus on 'what' and 'why' specific to this codebase,
while REFERENCES.md provides broader context and book sources.
@m2ux m2ux merged commit a2014cf into main Nov 17, 2025
@m2ux m2ux deleted the feature-review branch November 20, 2025 15:46
m2ux added a commit that referenced this pull request Nov 27, 2025
Implement ConceptRepository interface using LanceDB:
- findByName: Exact concept lookup by name
- findRelated: Vector search for similar concepts
- searchConcepts: Text-based concept search

Note: findByName() still uses string interpolation in WHERE clause.
This will be addressed in security fixes task (Issue #6).

Related: Architecture Review 2025-11-14, Task 1.8
m2ux added a commit that referenced this pull request Nov 27, 2025
Escape single quotes in user input before SQL WHERE clause:
- Replace single quotes with doubled quotes (SQL standard escaping)
- Prevents SQL injection in findByName() query

Example attack prevented:
  Input: "test' OR '1'='1"
  Before: WHERE concept = 'test' OR '1'='1'  (injection!)
  After: WHERE concept = 'test'' OR ''1''=''1'  (safe)

Fixes Issue #6 from architecture review (SQL injection vulnerability).

Related: Architecture Review 2025-11-14, Task 3.2, Issue #6
m2ux added a commit that referenced this pull request Nov 27, 2025
docs: Refactor documentation and remove book citations from code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant