tractatus/docs/CONTINUOUS_FLOW_WORKFLOW_REMAINING_DOCS.md
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

8.8 KiB
Raw Blame History

Continuous Flow Workflow - Remaining 34 Documents

Purpose: Process all remaining documents without interruption Status: Ready for execution Pre-Approvals: All bash commands pre-approved in CLAUDE.md


Progress Status

Completed: 3 of 37 documents (8%)

  • Getting Started (3 docs) - COMPLETE

Remaining: 34 of 37 documents (92%)

  1. Technical Reference (9 docs)
  2. Theory & Research (5 docs)
  3. Advanced Topics (6 docs)
  4. Case Studies (6 docs)
  5. Business & Leadership (2 docs)

Continuous Flow Process

Phase 1: Technical Reference (9 documents)

Documents in order:

  1. technical-architecture.md
  2. implementation-guide.md
  3. implementation-guide-v1.1.md (check if duplicate, may consolidate)
  4. API Reference (find file)
  5. OpenAPI 3.0 Specification (find file)
  6. JavaScript API Integration Examples (find file)
  7. Python API Integration Examples (find file)
  8. comparison-matrix.md
  9. Any other technical docs found

Per Document Workflow:

# 1. Set document
DOC_FILE="docs/markdown/[filename].md"
DOC_SLUG=$(basename "$DOC_FILE" .md)

# 2. Content analysis and edits
# - Read file
# - Check ContextPressureMonitor weights (must be 40/30/15/10/5)
# - Check inst_039 violations
# - Check license (Apache 2.0 required)
# - Check metadata section
# - Apply edits

# 3. Database pipeline
npm run migrate:docs -- --source docs/markdown --force
mongosh tractatus_dev --quiet --eval "db.documents.updateOne({title: /pattern/i}, {\$set: {slug: '$DOC_SLUG'}})"
timeout 90 node scripts/generate-card-sections.js "$DOC_FILE" --update-db || echo "Timeout (validating...)"
node scripts/generate-single-pdf.js "$DOC_FILE" "public/downloads/$DOC_SLUG.pdf"

# 4. Validate on dev
curl -s "http://localhost:9000/api/documents/$DOC_SLUG" | node -e "const d=JSON.parse(require('fs').readFileSync(0,'utf8')).document; console.log('Sections:', d.sections?.length, 'License:', d.sections?.find(s=>s.title==='License')?'YES':'NO')"
curl -s -I "http://localhost:9000/downloads/$DOC_SLUG.pdf" | grep -q "200 OK" && echo "✅ PDF OK"

Category Deployment (after all 9 docs complete):

# Deploy to production
printf "yes\nyes\n" | ./scripts/deploy-full-project-SAFE.sh

# Restart and migrate
ssh -i ~/.ssh/tractatus_deploy ubuntu@vps-93a693da.vps.ovh.net 'sudo systemctl restart tractatus && cd /var/www/tractatus && npm run migrate:docs -- --source docs/markdown --force'

# Fix slugs and generate cards (for each doc)
for DOC in [list of slugs]; do
  ssh -i ~/.ssh/tractatus_deploy ubuntu@vps-93a693da.vps.ovh.net "mongosh tractatus_prod -u tractatus_user -p 'PASS' --authenticationDatabase tractatus_prod --eval \"db.documents.updateOne({title: /$DOC/i}, {\\\$set: {slug: '$DOC'}})\""

  ssh -i ~/.ssh/tractatus_deploy ubuntu@vps-93a693da.vps.ovh.net "cd /var/www/tractatus && timeout 90 node scripts/generate-card-sections.js docs/markdown/$DOC.md --update-db" || echo "Timeout OK"
done

# Validate on production
for DOC in [list]; do
  curl -s "https://agenticgovernance.digital/api/documents/$DOC" | node -e "const d=JSON.parse(require('fs').readFileSync(0,'utf8')).document; console.log('$DOC:', d.sections?.length, 'sections')"
done

Phase 2: Theory & Research (5 documents)

Documents:

  1. organizational-theory-foundations.md
  2. Research Foundations (find file)
  3. Rule Proliferation (find file)
  4. LLM Integration Feasibility (llm-integration-feasibility-research-scope.md)
  5. Any other research docs

Process: Same as Phase 1 (per-doc workflow + category deployment)


Phase 3: Advanced Topics (6 documents)

Documents:

  1. Value Pluralism (find file)
  2. Pluralistic Values Deliberation Plan (find file)
  3. Technical Architecture Diagram (find file)
  4. Framework Enforcement (find file)
  5. Any other advanced docs

Process: Same as Phase 1


Phase 4: Case Studies (6 documents)

Documents:

  1. case-studies.md
  2. Port 27027 Incident (find specific file)
  3. Framework in Action (find file)
  4. When Frameworks Fail (find file)
  5. Real-world Governance (find file)
  6. Any other case study docs

Process: Same as Phase 1


Phase 5: Business & Leadership (2 documents)

Documents:

  1. business-case-tractatus-framework.md
  2. Any other business/leadership docs

Process: Same as Phase 1


Critical Patterns (ALWAYS Follow)

1. ContextPressureMonitor Weights

MUST be: 40%/30%/15%/10%/5% (conversation/token/task/error/instruction)

If found different: Fix immediately with explanation:

**Updated 2025-10-12:** Weights rebalanced after observing that compaction events (triggered by message count ~60 messages) are the PRIMARY cause of session disruption.

2. inst_039 Compliance

Prohibited words: "ensure/ensures/ensuring/guarantee/guarantees/guaranteed"

Replace with: "designed to", "helps", "aims to", "works to", "intended to"

3. License Section (Apache 2.0)

Every document must have:

## License

Copyright 2025 John Stroh

Licensed under the Apache License, Version 2.0...
[Full license text as in completed docs]

4. Metadata Section

Every document must have:

## Document Metadata

<div class="document-metadata">

- **Version:** [version]
- **Created:** [YYYY-MM-DD]
- **Last Modified:** [YYYY-MM-DD]
- **Author:** John Stroh
- **Word Count:** [calculated] words
- **Reading Time:** ~[calculated] minutes
- **Document ID:** [slug]
- **Status:** Active

</div>

5. Slug Handling

CRITICAL: Slug must match filename case exactly

DOC_SLUG=$(basename "$DOC_FILE" .md)  # Preserves case

6. Timeout Handling

Card generation often times out but succeeds. ALWAYS validate afterward:

timeout 90 node scripts/generate-card-sections.js ... || echo "Timeout (validating...)"
sleep 2
# Check sections created
mongosh ... "print(db.documents.findOne({slug: '...'}).sections.length)"

Estimated Timeline

Per document: 10-15 minutes (small) or 13-18 minutes (large) Per category deployment: ~10 minutes

Total estimate:

  • Technical Reference: 9 × 12 min = 108 min + 10 min deploy = ~2 hours
  • Theory & Research: 5 × 12 min = 60 min + 10 min deploy = ~1.2 hours
  • Advanced Topics: 6 × 12 min = 72 min + 10 min deploy = ~1.4 hours
  • Case Studies: 6 × 12 min = 72 min + 10 min deploy = ~1.4 hours
  • Business & Leadership: 2 × 12 min = 24 min + 10 min deploy = ~0.6 hours

Grand Total: ~6.5 hours of continuous processing


Session Management

Every 50k Tokens (~10-12 documents)

Run pressure check and report to user:

node scripts/check-session-pressure.js --tokens [current]/200000 --messages [count]

At 150k Tokens (~30 documents)

Consider session handoff to maintain quality. Create handoff document with:

  • Documents completed (list with status)
  • Current category progress
  • Next document to process
  • Any issues encountered
  • Slug fixes needed on production

Error Recovery

Slug Mismatch

# Check actual slug
mongosh tractatus_dev --quiet --eval "db.documents.findOne({title: /pattern/i}, {slug: 1})"

# Fix if needed
mongosh tractatus_dev --quiet --eval "db.documents.updateOne({slug: 'wrong'}, {\$set: {slug: 'correct'}})"

Card Sections Not Created

# Retry without timeout
node scripts/generate-card-sections.js "$DOC_FILE" --update-db

PDF Generation Failed

# Check Puppeteer/Chrome available
node scripts/generate-single-pdf.js "$DOC_FILE" "$PDF_OUTPUT"

Production Sync Issue

# Redeploy specific files
rsync -avz -e "ssh -i ~/.ssh/tractatus_deploy" \
  docs/markdown/$DOC.md \
  public/downloads/$DOC.pdf \
  ubuntu@vps-93a693da.vps.ovh.net:/var/www/tractatus/

Success Criteria Per Document

  • ContextPressureMonitor weights correct (40/30/15/10/5)
  • No inst_039 violations
  • Apache 2.0 license section present
  • Document metadata section present
  • Card sections generated (>5 sections)
  • PDF created and accessible on dev
  • Validated on dev (API + PDF)

Success Criteria Per Category

  • All documents processed
  • Deployed to production
  • Slugs fixed on production
  • Card sections generated on production
  • All documents validated on production
  • Visible in side panel at agenticgovernance.digital

Final Deliverable

When all 37 documents complete:

  1. Full validation report (all docs, all categories)
  2. PDF download links verified
  3. Side panel navigation confirmed
  4. License compliance confirmed (Apache 2.0 in all)
  5. Metadata presence confirmed (all docs)
  6. ContextPressureMonitor accuracy confirmed (all mentions updated)

Completion criteria: User can navigate https://agenticgovernance.digital/docs.html and access all 37 documents with working PDFs, proper card sections, and professional metadata.


Created: 2025-10-13 For: Next session continuous processing Pre-Approvals: All commands in CLAUDE.md § PRE-APPROVED BASH COMMANDS