Back to Logbook
May 19, 2026 Project: #Portfolio

Knowledge base markdown import.

satisfied

Wanted the RAG knowledge base to pull straight from the markdown files I keep at the repo root. Added a markdown importer accessible from admin (POST /admin/kb/import-files) and as a CLI command (php spark kb:import-files). Each imported chunk gets lightweight keywords extracted from the markdown-as-text — improves the keyword/LIKE pass.

Added chunk metadata fields (chunk_index, total_chunks) and a chunks navigation panel in the admin KB editor so I can step through parent and child chunks of long docs.

The RAG pipeline now normalises markdown and HTML to plain text both for relevance scoring and for the prompt context — no more raw markdown tokens leaking into prompts.

Two MySQL strict-mode bugs to fix: the KB importer was saving chunk_index/total_chunks as NULL on single-chunk docs, and the admin KB index page was passing no view data so the "Recent Entries" panel was always empty. Both fixed.

Lessons Learned

Strict modes catch silent bugs that loose modes hide for months.