Quick Start
Add edicts programmatically
Section titled “Add edicts programmatically”import { EdictStore } from 'edicts';
const store = new EdictStore({ path: './edicts.yaml' });await store.load();
// Add a verified product factawait 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 constraintawait store.add({ text: 'Never mention Project X publicly.', category: 'compliance', confidence: 'verified', ttl: 'permanent',});
// Add an ephemeral operational noteawait store.add({ text: 'Database migration in progress — no writes to users table.', category: 'operations', confidence: 'verified', ttl: 'ephemeral', expiresIn: '48h',});Render for prompt injection
Section titled “Render for prompt injection”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.
Inject into your agent
Section titled “Inject into your agent”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 choiceThat’s it — three edicts, ~40 tokens total, injected into every session.
What’s next?
Section titled “What’s next?”- Memory Hierarchy — understand where Edicts fits in your agent’s context
- Best Practices — write effective edicts
- API Reference — full method documentation
- OpenClaw Integration — automatic prompt injection via plugin