# Obelisk Query Patterns These are copyable CodeAct patterns for `runtime.mjs --query` scripts, plus one `--remember` registration pattern. They are not new APIs. Adapt them to the user's scope and return compact evidence. ## Bounded Search To Context Use `search()` to locate candidates, then expand only the strongest hits. ```js const hits = search('"runtime query"', { project: '%quiet-zero%', limit: 8 }); return hits.slice(0, 5).map(h => { const c = context(h.message.uuid); return { session_id: h.session.id, session_title: h.session.title, uuid: h.message.uuid, timestamp: h.message.timestamp, snippet: h.message.text?.slice(0, 240), parentChain: (c?.parentChain || []).slice(-3).map(m => ({ uuid: m.uuid, role: m.role, snippet: m.text?.slice(0, 120), })), }; }); ``` ## Memory Plus Session Evidence Use this when prior conclusions may exist but the answer still depends on raw session evidence. Keep memory as prior notes, not final authority; compare it with session evidence in your final answer when correctness matters. ```js const project = '%quiet-zero%'; const topic = 'markdown memory layer'; const ftsTopic = topic.replace(/[-_]/g, ' '); const prior_memories = memories({ project, query: topic, limit: 5, }).map(m => ({ id: m.id, path: m.path, session_id: m.session_id, message_start: m.message_start, message_end: m.message_end, created_at: m.created_at, summary: m.summary?.slice(0, 260), })); const session_evidence = search(ftsTopic, { project, limit: 8 }) .slice(0, 6) .map(h => ({ session_id: h.session.id, session_title: h.session.title, uuid: h.message.uuid, timestamp: h.message.timestamp, snippet: h.message.text?.slice(0, 220), })); return { query_plan: { project, topic, memory_limit: 5, session_limit: 8, }, prior_memories, session_evidence, }; ``` ## Register Approved Memory Use this only after the user approves writing memory and the markdown file already exists. `remember()` validates the file and stores a normalized absolute path, so keep the script small and return the registered record. Run this script with `runtime.mjs --remember