# Optimal Startup Prompt for Next Session

**Copy and paste this prompt to begin the next session:**

---

Continue document optimization project for Tractatus framework.

## SESSION CONTEXT
- **Progress:** Getting Started category COMPLETE (3/37 documents, 8%)
- **Remaining:** 34 documents across 5 categories
- **Workflows:** Fully documented and tested (10-18 min per doc)
- **Pre-Approvals:** ALL bash commands pre-approved in CLAUDE.md § PRE-APPROVED BASH COMMANDS
- **Next:** Technical Reference category (9 documents)

## IMMEDIATE STARTUP SEQUENCE
1. **Run mandatory session init:** `node scripts/session-init.js`
2. **Read complete context:** `SESSION_HANDOFF_2025-10-13.md`
3. **Read workflow guide:** `docs/CONTINUOUS_FLOW_WORKFLOW_REMAINING_DOCS.md`
4. **Start dev server:** `npm start` (background)
5. **Find Technical Reference files:** All 9 markdown sources

## CRITICAL PATTERNS (ALL 34 REMAINING DOCUMENTS)
- ✅ ContextPressureMonitor weights: **40%/30%/15%/10%/5%**
- ✅ No inst_039 violations: **ensure/ensures/guarantee** → **designed to/helps/aims to**
- ✅ Apache 2.0 license section (complete text required)
- ✅ Document metadata section (version, dates, word count, reading time)
- ✅ Card sections generated (>5 per document)
- ✅ PDF created and validated on dev before production

## PROCESSING ORDER
1. **Technical Reference (9 docs)** - Start with technical-architecture.md
2. **Theory & Research (5 docs)** - organizational-theory-foundations.md
3. **Advanced Topics (6 docs)** - Value Pluralism topics
4. **Case Studies (6 docs)** - case-studies.md
5. **Business & Leadership (2 docs)** - business-case-tractatus-framework.md

## WORKFLOW EFFICIENCY (TESTED & VALIDATED)
- **Per document:** 10-18 minutes (depending on size)
- **Pre-approvals:** Complete - see CLAUDE.md § PRE-APPROVED BASH COMMANDS
- **User interruptions:** ZERO (all commands pre-approved)
- **Total estimate:** ~6.5 hours for 34 documents
- **Category deployment:** After completing ALL docs in category

## PER-DOCUMENT WORKFLOW (COPY-PASTE READY)
```bash
# Set document
DOC_FILE="docs/markdown/[filename].md"
DOC_SLUG=$(basename "$DOC_FILE" .md)

# Content analysis & edits (Claude Read + Edit)
# 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 OK"
node scripts/generate-single-pdf.js "$DOC_FILE" "public/downloads/$DOC_SLUG.pdf"

# 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)"
curl -s -I "http://localhost:9000/downloads/$DOC_SLUG.pdf" | grep -q "200 OK" && echo "✅ PDF OK"
```

## CATEGORY DEPLOYMENT (AFTER ALL DOCS IN CATEGORY)
```bash
# 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)
# Validate on production
```

## REFERENCE DOCUMENTS
- **SESSION_HANDOFF_2025-10-13.md** - Complete session context, accomplishments, patterns
- **docs/CONTINUOUS_FLOW_WORKFLOW_REMAINING_DOCS.md** - Continuous flow guide
- **docs/DOCUMENT_OPTIMIZATION_WORKFLOW.md** - Detailed workflow steps
- **CLAUDE.md § PRE-APPROVED BASH COMMANDS** - All pre-approved commands

## PROJECT GOAL
Complete all 37 documents so users can access professional, accurate documentation with working PDFs at **https://agenticgovernance.digital/docs.html**

---

## MANDATORY VERIFICATION BEFORE PROCEEDING

**Before processing any documents, explicitly verify and confirm:**

1. ✅ **Read CLAUDE.md § PRE-APPROVED BASH COMMANDS** - Confirm all workflow commands are pre-approved
2. ✅ **Check .claude/instruction-history.json** - Verify bash pre-approval instruction is active
3. ✅ **Confirm understanding:** NO user approval interruptions will occur for:
   - All database operations (mongosh read/write with approved patterns)
   - All file operations (Read, Edit tools)
   - All script executions (migrate-docs, generate-card-sections, generate-single-pdf)
   - All validation commands (curl, node, ls)
   - All production operations (ssh, rsync with deploy key)
   - All session management (pressure checks, state updates)

4. ✅ **Report to user:** "Pre-approvals verified. All bash commands for document optimization workflow are pre-approved per CLAUDE.md. NO user interruptions will occur during processing of 34 remaining documents."

**ONLY AFTER VERIFICATION CONFIRMED:**

**Proceed with continuous processing of ALL 34 remaining documents without interruption. Begin with Technical Reference category (9 documents starting with technical-architecture.md). Process documents sequentially within each category, deploy category when complete, then continue to next category. Report progress at 50k token checkpoints.**

---

**Created:** 2025-10-13
**Purpose:** Optimal startup for session continuity with zero interruptions
**Estimated completion:** 6.5 hours continuous processing (34 documents × 10-18 min avg)
