Build your house from paper and 0.37% of the time you'll get screwed 100% of the time
It’s better to make it harder for agents to do what you don’t want them to, than to encourage them to do what you want.
If you focus on that first, make it harder for them to err, you’ll find yourself more encouraged, too.
Initially I thought, they can just read the last 10% of the SD list (the most recent). It can work, but it requires an agent to have the instruction, prioritise the instruction, and execute the right tool call.
That’s 3 layers of probability. If that sequence is a core part of your development flow, I think you can see where I am headed with this. The code is straightforward:
import { readFileSync, writeFileSync } from 'fs';
const SD_FILE = 'docs/internal/session-decisions.md';
const INDEX_FILE = 'docs/internal/session-decisions-index.yaml';
const content = readFileSync(SD_FILE, 'utf-8');
const lines = content.split('\n');
const sdRows = [];
for (const line of lines) {
const match = line.match(
/^\|\s*SD-(\d+)\s*\|\s*\[([^\]]+)\]\s*(.+?)\s*\|\s*(.+?)\s*\|\s*(.+?)\s*\|$/
);
if (match) {
sdRows.push({
id: parseInt(match[1]),
label: match[2],
summary: match[3].slice(0, 200).replace(/\*\*/g, '').trim(),
author: match[4].trim(),
status: match[5].trim(),
});
}
}
const total = sdRows.length;
const latest = sdRows.slice(-20);
const first = sdRows[0];
const last = sdRows[sdRows.length - 1];
const yaml = `# session-decisions-index.yaml
# Auto-generated — do not edit manually
# Full file: ${SD_FILE} (${total} entries, append-only)
#
# This is the BOOT file. Read this, not the full log.
generated: "${new Date().toISOString()}"
total_decisions: ${total}
range: "SD-${first?.id} to SD-${last?.id}"
recent:
${latest.map(sd => ` - id: SD-${sd.id}
label: "${sd.label}"
summary: "${sd.summary.replace(/"/g, '\\"')}"
status: "${sd.status}"`).join('\n')}
`;
writeFileSync(INDEX_FILE, yaml);
-
Paper Guardrail — “The LLM creates a rule, then in the same breath asserts that the rule will prevent the failure it was designed for. The assertion has no enforcement mechanism.” (oceanheart.ai/slopodar/paper-guardrail) ↩︎