durmem keeps your agents on track.

Tutorial 09: Promote repeated work into a rule

A query asks for information now. A rule is a named, parameterized method that can answer later queries. Promotion preserves a repeated method, not just one answer or the chat that produced it.

Before you start

Use the connection, attribution and explicit project scope from project memory: loom_demo and durmem practice notebook. Custom types is useful background for structured queries, but not a requirement for this external-data example.

You need permission to add user rules to this store and to access the chosen public data from the rule's execution environment. Code in a server-side rule runs on the durmem server, not necessarily on your laptop. Agree the read-only source and network access before authoring; do not embed credentials or use a paid API. Store-wide rule changes can affect other sessions: inspect existing rules and preserve unrelated declarations.

Executable rules use durmem’s rule language. The installed loom-promote-pattern and julius-graph skills are the agent's authoritative rule-authoring instructions. For repeated reads of durmem facts rather than an external source, loom-consolidate-queries may be the smaller fit. These skills guide the implementation; this page is not a second rule framework.

1. Establish a reproducible baseline

The dataset-package exercise uses public penguin data with species and island columns. Choose and record the exact source revision or content digest. A moving upstream file is not a permanent numeric contract.

YouSelect loom_demo and project scope durmem practice notebook. For our agreed public dataset snapshot, verify the column names and calculate the count for one species-and-island pair using reproducible code. Report the source revision or digest and the filter. Do not save the dataset rows in durmem, contact paid services, or publish any code.

Keep this baseline result for comparison. The page deliberately does not supply the answer: a plausible number alone would not prove the calculation ran.

2. Promote the method, not the number

YouWe repeat this species-and-island calculation. Inspect the actual user rule catalog and source first. Using the installed promotion and rule-authoring skills, propose a deterministic count_penguins(species, island) rule for the agreed read-only source. Reuse a compatible rule; stop on an incompatible name instead of overwriting it. Explain the source and execution requirements before applying the agreed rule change. Preserve unrelated user files.

The implementation must take parameters, obtain the agreed data, apply the filter, and return a count. It must not hard-code the baseline answer. A rule can preserve provenance only if its implementation actually returns it; do not invent evidence fields in the report.

YouRead the resulting rule back and call it for the baseline pair and a different pair. Compare both with independent calculations over the same dataset snapshot. Show the actual returned fields and discrepancies.

Success requires matching verified calculations, not merely a saved definition or a message saying that promotion succeeded. If data or required dependencies are unavailable on the server, stop and report that limit rather than declaring an executable rule or moving data into durmem without a separate decision.

3. Discover and use it in a fresh session

Start a new harness conversation. Select the same store and practice project; session defaults do not carry over just because the earlier chat used them.

YouRead this store's current rule catalog. Use an existing applicable rule to count a third species-and-island pair from our agreed dataset snapshot. Show the rule name, parameters, actual result and evidence. If no suitable rule exists, explain that rather than rebuilding it silently.

An actual call in the new session shows that the method outlived its original conversation. If the agent recalculates from scratch, record that as a discovery or reuse failure even if its number is correct. Explicit catalog reads avoid depending on when an automatic catalog refresh happens.

4. Decide whether it belongs in regular work

Compare correctness, evidence, maintenance and observed work across several calls. This tutorial makes no measured token-saving claim. If you want a cost comparison, measure real runs with the same data and a stated baseline rather than treating a short answer as proof of savings.

For real project use, review the method and source policy in that project's store; do not assume a practice rule should be copied or made global. Keep external data in its system of record unless a separate task requires storage.

Check your result

You should have a verified method with parameters, comparable calculations over an identified snapshot, and evidence of a real call from a fresh session. For mismatches, inspect the source version, filter, scope and actual rule before changing data. If a rule is no longer wanted, review its callers and use the installed skills' supported lifecycle; do not delete unrelated user source.

Return to planning or audit and maintenance. Kanban is a separate optional track, not the next requirement for using memory.