Diary digest
Periodic reflective harvest of an append-only engineering journal (discipline/DIARY.md or any long log/changelog/postmortem). Reads the WHOLE journal via parallel diary-miner subagents, performs a k0-k4 metacognitive reflection over the mistakes and successes, turns every recurring mistake into a proposed mechanical gate, and saves the consolidated learning to Mycorrhiza. Use when the user asks for a "digest", "diary digest", "harvest do diary", "o que dá pra aprender do diary", "reflexão do diário", "mine the journal", "lessons from the log", a retro/postmortem over accumulated entries, or periodically when DIARY.md has grown by many entries since the last harvest. Output is lessons + proposed automation, NOT edits to the constitution (those are proposed and confirmed first).From its SKILL.md
npx -y skills add sfaustodev/discipline --skill diary-digestAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.7 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it
diary-digest
Turn a fat append-only journal into durable automation. The journal already paid for the mistakes; this skill makes sure each one is paid for once. It is the repeatable version of a manual harvest — profile, mine in parallel, reflect, propose gates, persist.
Principle (see global rule on mechanical gates): a lesson that lives only as prose in the log will be skipped again under pressure. The harvest is not done until each recurring mistake has a proposed mechanical gate (hook / script / lint / test / checklist), not just a paragraph.
Steps
1. Locate & profile
Find the journal (default discipline/DIARY.md; accept a path arg). Profile it cheaply before reading — this sizes the fan-out and surfaces the penalty taxonomy:
F="${1:-discipline/DIARY.md}"
wc -l "$F"
grep -Ec '^## ' "$F" # entry count
grep -Eo '\[[a-z][a-z-]+\]' "$F" | sort | uniq -c | sort -rn | head -30 # penalty taxonomy, by frequency
The penalty histogram is the single highest-signal artifact. Any label with count ≥2 is a recurring mistake and MUST end the harvest with a proposed gate.
Then read the digest watermark so you don't re-mine what a prior digest already covered:
grep -n '<!-- DIGEST-WATERMARK' "$F" | tail -1 # active (latest) marker. Anchor on '<!--' so prose mentioning the token isn't matched; parse its next_start_line:N
Mine only from that next_start_line:N value to EOF. The value is stable under append-only (old lines never shift, so a recorded line number stays valid forever). No marker found → first digest, mine the whole file.
2. Fan out diary-miner (parallel)
Split the un-digested range (watermark next_start_line → EOF; the whole file if no watermark) into ~2600-line chunks. Spawn one diary-miner subagent per chunk in a single message (parallel). Give each the exact path + line range. If the diary-miner agent type isn't registered in this session, fall back to general-purpose with the same extraction contract (MISTAKES with root-cause+gate / SUCCESSES / SKILL-CANDIDATES / THEMES / GOLD; terse; reply-is-the-data).
If the model fan-out is unavailable (overload / offline), degrade gracefully to a grep pass: grep -n -E '\[[a-z-]+\]|meu erro|deveria ter|errei' "$F" and read the surrounding entries yourself. A grep harvest is worse than a miner harvest but far better than none — never abandon the harvest because the fan-out failed.
3. Synthesize — k0-k4 reflection
Collect miner outputs, dedup across chunks, then reflect by metacognitive level (Logos Probabilis framing, global rule #17):
- k0 raw impulse — "ship it / skip the gate." Which mistakes were pure opportunism under time pressure?
- k1 ungrounded doubt — "looks like a bug, I'll fix it" → reverting hardened code; "fold the migration to be clean." Doubt acted on without cross-checking git/tests.
- k2 grounded action — the patterns that worked: cross-check before fixing, forward-only migrations, lock-before-idempotence, the review gate.
- k3 inflated doubt — real risk dressed as catastrophe (paranoia³). Did any response inflate?
- k4 meta — the pattern ACROSS the mistakes. Almost always: self-discipline fails under pressure; mechanical gates are the only durable fix. Name the specific shape this journal shows.
Group the deduped MISTAKES into families (gate-skipped, tests-green-but-ships, git/migration-state, stale-spec, timezone, env-empty-string, user-string-overwrite, worktree-state, …). Families, not incidents, are what you automate against.
4. Mistake → gate (delegate the mapping)
For each recurring family, derive the mechanical gate. Use the postmortem-to-gate skill's mapping (mistake-class → gate-type → where it lives) so the proposals are consistent across harvests.
5. Persist to Mycorrhiza
Consolidate the harvest into one rich link (not many small ones — recall is substring-based, dense links recall better). mcp__mycorrhiza__remember with tags: referencia-canonica, diary-digest, the project name, k4, plus a tag per mistake-family. First person, fact-dense, note-to-future-self. Run mcp__mycorrhiza__chain_status first if it's been many sessions (integrity check).
6. Stamp the watermark (append-only)
Append a fresh watermark marker at EOF so the next digest resumes where this one stopped. This is the ONLY write to the journal — never edit existing entries.
TODAY=$(date +%F)
TOTAL=$(wc -l < "$F") # everything up to here is now digested (cumulative)
cat >> "$F" <<EOF
---
## 📍 DIGEST WATERMARK — $TODAY
<!-- DIGEST-WATERMARK v1 | digested_through_line:$TOTAL | next_start_line:$((TOTAL + 1)) | digest_date:$TODAY -->
EOF
digested_through_line is cumulative (prior runs + this one); next_start_line is where the next digest begins. Each run appends its own marker; grep … | tail -1 always finds the active one.
7. Report & propose — do NOT auto-edit the constitution
Output: the k0-k4 reflection + the family table (family → frequency → proposed gate → status). Then propose deliverables:
- new skills/subagents for repeated manual work (SKILL-CANDIDATES with 2+ hits) → can create directly under
~/.claude/skills/or project.claude/skills/ - new discipline rules → PROPOSE and confirm before editing any global
~/.claude/CLAUDE.md(the constitution is human-ratified; "propor" ≠ "editar"). - project-specific technical gold → the project's
ETERNAL.md(on-demand, per rule #19), not here.
Guardrails
- Read-only on the journal's content. The only write allowed is appending a watermark marker at EOF (step 6) — never edit or "clean up" existing entries; the journal is append-only (rule #5).
- Don't fabricate gates. If a mistake has no clean mechanical gate, say so and route it to a checklist/HUMAN.md instead of inventing a brittle hook.
- Cross-project safe: hardcode nothing about a specific company/stack. Read the journal's own taxonomy.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.