/** * Add Governance Evolution Banners to Blog Posts * Demonstrates framework catching its own content violations */ const { MongoClient } = require('mongodb'); // Can be overridden by environment variable for production deployment const DEV_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017'; const DEV_DB = process.env.MONGODB_DB || 'tractatus_dev'; // Banner templates const BANNERS = { 'five-component-tractatus-architecture': `

Framework Evolution Notice

This blog was written in early October 2025 describing our five-component architecture. When we ran it through updated governance rules in late October 2025, the framework flagged language that violated newly-added instructions:

  • inst_017 (No Absolute Assurances): Detected use of "guarantees" - now requires evidence-based language
  • inst_018 (Honest Testing Status): Flags "production-ready" claims without multi-project validation

This is the framework working as designed. As governance rules evolve, they catch content that previously passed review. Rather than silently revise, we're leaving this as a live demonstration of how architectural governance improves over time. Read our framework failure case study for more on transparent error handling.

Note: This blog describes early-stage research (single-project validation). The framework components exist and function, but have not been validated across multiple production deployments.

`, 'introducing-tractatus-framework': `

Framework Evolution Notice

This introductory blog was written in early October 2025. Updated governance rules (inst_017, inst_018) now flag absolute assurance language like "guarantees" and unvalidated production readiness claims.

The framework caught its own content. Rather than silently revise, we're demonstrating transparent governance evolution. The framework components described here exist and function in single-project deployment, but have not been validated at scale.

See: Framework failure case study

`, 'scaling-tractatus-roadmap': `

Governance Evolution Notice

This roadmap blog was written in mid-October 2025. Updated governance rules (inst_017) now flag absolute assurance language. The framework detected violations in its own published content - demonstrating that architectural governance improves through iteration.

Rather than silently edit, we're preserving this as evidence of transparent evolution. See: Framework failure case study

`, 'when-frameworks-fail-case-study': `

Educational Content Notice

This blog contains prohibited terms in quoted examples for educational purposes. Terms like "guarantee", "production-ready", and "battle-tested" appear in:

  • Governance rule definitions (inst_017, inst_018)
  • Examples of violations to avoid
  • Critical analysis of problematic claims

These educational uses demonstrate what not to do - they are not claims made by the framework itself.

` }; async function addBannerToBlog(collection, slug, banner) { const blog = await collection.findOne({ slug }); if (!blog) { console.log(` āŒ Blog not found: ${slug}`); return false; } // Check if banner already exists if (blog.content.includes('Framework Evolution Notice') || blog.content.includes('Educational Content Notice')) { console.log(` āš ļø Banner already exists, skipping`); return false; } let updatedContent; // Check if content is HTML (contains

tag) const h1Match = blog.content.match(/(]*>.*?<\/h1>)/); if (h1Match) { // HTML content: Insert banner after first

tag updatedContent = blog.content.replace( h1Match[0], h1Match[0] + banner ); console.log(` šŸ“ Format: HTML`); } else { // Markdown content: Convert banner to markdown-style notice // For markdown blogs, prepend as HTML (it will be rendered in the blog viewer) const markdownBanner = '\n' + banner + '\n'; // Insert after first line (title) or at the beginning const lines = blog.content.split('\n'); const firstNonEmptyLine = lines.findIndex(line => line.trim().length > 0); if (firstNonEmptyLine >= 0 && lines[firstNonEmptyLine].startsWith('#')) { // Insert after markdown title lines.splice(firstNonEmptyLine + 1, 0, markdownBanner); } else { // Prepend to content lines.unshift(markdownBanner); } updatedContent = lines.join('\n'); console.log(` šŸ“ Format: Markdown`); } // Update the blog const result = await collection.updateOne( { slug }, { $set: { content: updatedContent } } ); if (result.modifiedCount === 1) { console.log(` āœ… Banner added successfully`); return true; } else { console.log(` āŒ Failed to update blog`); return false; } } async function addBannersToBlogs() { const client = new MongoClient(DEV_URI); try { console.log('šŸ“‹ Adding Governance Evolution Banners to Blogs\n'); console.log('═'.repeat(70)); await client.connect(); const db = client.db(DEV_DB); const collection = db.collection('blog_posts'); let successCount = 0; const blogSlugs = Object.keys(BANNERS); for (const slug of blogSlugs) { console.log(`\nšŸ“„ Processing: ${slug}`); const success = await addBannerToBlog(collection, slug, BANNERS[slug]); if (success) successCount++; } console.log('\n' + '═'.repeat(70)); console.log(`\n✨ Complete: ${successCount}/${blogSlugs.length} blogs updated\n`); } catch (error) { console.error('āŒ Error:', error.message); throw error; } finally { await client.close(); } } // Run if called directly if (require.main === module) { addBannersToBlogs() .then(() => { console.log('āœ… Banners added to dev database'); console.log('\nNext steps:'); console.log('1. Test blogs locally at http://localhost:9000/blog.html'); console.log('2. Deploy to production with same script targeting prod DB\n'); process.exit(0); }) .catch(error => { console.error('\nšŸ’„ Failed:', error); process.exit(1); }); } module.exports = { addBannersToBlogs, BANNERS };