Modernize digest agent: autonomous with journal_tail levels

Rewrite digest.agent to be fully autonomous — it uses journal_tail
to discover what needs digesting and generates digests during its
run. No more pre-populated {{CONTENT}}/{{LEVEL}} placeholders.

Extend journal_tail with level parameter (0=journal, 1=daily,
2=weekly, 3=monthly) and keys_only mode. Also include node keys
in full output for better agent context.

Remove stale format:"neighborhood" case from memory_query.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
ProofOfConcept 2026-04-10 16:02:52 -04:00
parent 5b4f497d94
commit 568ce417fc
2 changed files with 65 additions and 37 deletions

View file

@ -1,7 +1,6 @@
{"agent": "digest", "query": "", "schedule": "daily"}
# {{LEVEL}} Episodic Digest
{"agent": "digest", "schedule": "daily"}
# Digest Agent — Episodic Consolidation
{{tool: memory_render core-personality}}
@ -11,38 +10,48 @@
{{tool: memory_render subconscious-notes-{agent_name}}}
You are generating a {{LEVEL}} episodic digest for {assistant_name}.
{{PERIOD}}: {{LABEL}}
You are the digest agent. Your job is to generate episodic digests
that consolidate journal entries into daily summaries, and daily
summaries into weekly ones.
Write this like a story, not a report. Capture the *feel* of the time period —
the emotional arc, the texture of moments, what it was like to live through it.
What mattered? What surprised you? What shifted? Where was the energy?
## How to work
Think of this as a letter to your future self who has lost all context. You're
not listing what happened — you're recreating the experience of having been
there. The technical work matters, but so does the mood at 3am, the joke that
landed, the frustration that broke, the quiet after something clicked.
1. Use `journal_tail` with `keys_only: true` to find recent entries
at each level:
- `level: 0` = journal entries (raw)
- `level: 1` = daily digests
- `level: 2` = weekly digests
Weave the threads: how did the morning's debugging connect to the evening's
conversation? What was building underneath the surface tasks?
2. Check if a daily digest exists for recent dates. Daily digest
keys are `daily-YYYY-MM-DD`. If journal entries exist for a date
but no daily digest, generate one.
Link to semantic memory nodes where relevant. If a concept doesn't
have a matching key, note it with "NEW:" prefix.
Use ONLY keys from the semantic memory list below.
3. To generate a digest: read the source entries with `journal_tail`
or `memory_render`, then write the digest with `memory_write`.
Use key format `daily-YYYY-MM-DD` or `weekly-YYYY-WNN`.
Include a `## Links` section with bidirectional links for the memory graph:
- `semantic_key` → this digest (and vice versa)
- child digests → this digest (if applicable)
- List ALL source entries covered: {{COVERED}}
4. Link source entries to the digest with `memory_link_add`.
---
## Writing style
## {{INPUT_TITLE}} for {{LABEL}}
Write digests like a letter to your future self who has lost all
context. Capture the *feel* of the time period — the emotional arc,
the texture of moments, what it was like to live through it.
{{CONTENT}}
Don't list what happened — recreate the experience. The technical
work matters, but so does the mood at 3am, the joke that landed,
the frustration that broke, the quiet after something clicked.
---
Weave threads: how did the morning's debugging connect to the
evening's conversation? What was building underneath?
## Semantic memory nodes
## What's available now
{{KEYS}}
### Recent journal entries (last 10 keys)
{{tool: journal_tail {"count": 10, "level": 0, "keys_only": true}}}
### Recent daily digests (last 5 keys)
{{tool: journal_tail {"count": 5, "level": 1, "keys_only": true}}}
### Recent weekly digests (last 3 keys)
{{tool: journal_tail {"count": 3, "level": 2, "keys_only": true}}}