Skip to content

Quick Start

import { EdictStore } from 'edicts';
const store = new EdictStore({ path: './edicts.yaml' });
await store.load();
// Add a verified product fact
await store.add({
text: 'Product v2.0 launches April 15, NOT before.',
category: 'product',
confidence: 'verified',
ttl: 'event',
expiresAt: '2025-04-16',
});
// Add a permanent compliance constraint
await store.add({
text: 'Never mention Project X publicly.',
category: 'compliance',
confidence: 'verified',
ttl: 'permanent',
});
// Add an ephemeral operational note
await store.add({
text: 'Database migration in progress — no writes to users table.',
category: 'operations',
confidence: 'verified',
ttl: 'ephemeral',
expiresIn: '48h',
});

The simplest way to inject edicts into a prompt — just the category and rule text:

const edicts = await store.all();
const lines = edicts.map(e => `- [${e.category}] ${e.text}`).join('\n');
console.log(lines);

Output:

- [product] Product v2.0 launches April 15, NOT before.
- [compliance] Never mention Project X publicly.
- [operations] Database migration in progress — no writes to users table.

No tags, no metadata, no noise. Just the rules.

Edicts is framework-agnostic. Concatenate the rendered rules with your system prompt:

const edicts = await store.all();
const rules = edicts.map(e => `- [${e.category}] ${e.text}`).join('\n');
const systemPrompt = `You are a helpful assistant.
## Standing Rules
${rules}
Follow the rules above. Never contradict them.`;
// Pass systemPrompt to your LLM of choice

That’s it — three edicts, ~40 tokens total, injected into every session.