tractatus/scripts/add-checkpoint-instruction.js
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

59 lines
2.5 KiB
JavaScript

#!/usr/bin/env node
/**
* Add Token Checkpoint Monitoring Instruction
*
* Adds inst_075 to instruction-history.json for checkpoint monitoring enforcement
*/
const fs = require('fs');
const path = require('path');
const INSTRUCTION_HISTORY_PATH = path.join(__dirname, '../.claude/instruction-history.json');
// Read current instruction history
const history = JSON.parse(fs.readFileSync(INSTRUCTION_HISTORY_PATH, 'utf8'));
// Check if inst_075 already exists
const exists = history.instructions.find(i => i.id === 'inst_075');
if (exists) {
console.log('inst_075 already exists - skipping');
process.exit(0);
}
// Create inst_075
const inst_075 = {
"id": "inst_075",
"text": "AFTER each response, check <system-warning> for current token count. IF token count > next_checkpoint value in .claude/token-checkpoints.json, MUST run: node scripts/check-token-checkpoint.js --tokens [current]/[budget]. This generates pressure report and marks checkpoint as completed. Checkpoints are at 25% (50k), 50% (100k), 75% (150k). Checking checkpoints is MANDATORY, not optional. Token budget awareness prevents context window exhaustion and maintains quality.",
"timestamp": new Date().toISOString(),
"quadrant": "SYSTEM",
"persistence": "HIGH",
"temporal_scope": "PERMANENT",
"verification_required": "MANDATORY",
"explicitness": 0.95,
"source": "framework",
"session_id": "2025-10-23-framework-analysis",
"parameters": {
"checkpoint_script": "scripts/check-token-checkpoint.js",
"checkpoints": [50000, 100000, 150000],
"verification_required": "MANDATORY",
"automation_trigger": "after_response"
},
"active": true,
"notes": "Created in response to token checkpoint enforcement failure (session passed 96k tokens without reporting at 50k and 100k thresholds). Makes checkpoint monitoring architecturally enforced through HIGH persistence instruction. Prevents context window exhaustion and session quality degradation.",
"created_date": "2025-10-23",
"incident_response": "token_checkpoint_enforcement_failure_2025_10_22"
};
// Add to instructions array
history.instructions.push(inst_075);
// Update metadata
history.last_updated = new Date().toISOString();
// Write back to file
fs.writeFileSync(INSTRUCTION_HISTORY_PATH, JSON.stringify(history, null, 2));
console.log('✅ Added inst_075: Token checkpoint monitoring');
console.log(` Total instructions: ${history.instructions.length}`);
console.log(` Active instructions: ${history.instructions.filter(i => i.active).length}`);