Skip to content

feat: lean .wolf handoff files — TODO.md, ROADMAP.md, history.md rotation + buglog index - #63

Open
meketreve wants to merge 3 commits into
cytostack:mainfrom
meketreve:feat/todo-file-and-status-autotrim
Open

feat: lean .wolf handoff files — TODO.md, ROADMAP.md, history.md rotation + buglog index#63
meketreve wants to merge 3 commits into
cytostack:mainfrom
meketreve:feat/todo-file-and-status-autotrim

Conversation

@meketreve

@meketreve meketreve commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What & why

A cohesive pass to keep the .wolf files that Claude reads every turn small, so long-lived projects don't pay a growing token tax on each session. On one real project (~130K-line STATUS.md, 200K memory.md, 270K buglog.json) the per-resume + per-fix read cost dropped dramatically with no data loss. Everything is opt-out-safe: existing installs are untouched on upgrade, and every mechanism is a no-op until a file actually grows.

Two commits, one theme.

New managed files

  • TODO.md — working checklist (🔥 Now / ⏭️ Next / 💡 Later / ✅ Done), complementing STATUS.md's handoff narrative. create-if-missing, seeded with {{PROJECT_NAME}}/{{DATE}}.
  • ROADMAP.md — planned-but-not-active work (milestones, backlog, someday), so STATUS.md stays focused on the current quest. create-if-missing.

Auto-rotation into a shared history.md (Stop hook)

  • STATUS.md session journal (> **SESSION N ... / > **SESSÃO N ... blocks) → history.md ## Session Journal, keeping the newest openwolf.status.max_sessions (default 2).
  • memory.md chronological ## Session: blocks → history.md ## Action Log, keeping the newest openwolf.memory.max_sessions (default 20). memory.md is oldest-first; handled explicitly.
  • Single history.md (name configurable via openwolf.status.archive_file) with both sections, newest-first. No-op unless a file exceeds its keep count.

buglog index + rotation (Stop hook)

  • Renders a compact buglog.md (id · tags · file · truncated message) from buglog.json when the source changes. Protocol now says scan buglog.md, then open only the matching entry — never read the whole JSON.
  • Rotation: caps live buglog.json at the newest openwolf.buglog.max_entries (default 200); older bugs move to buglog-archive.json (chronological, append-only). Keeps the index small without ever deleting a logged fix.

cerebrum budget nudge

  • Reminder (via additionalContext) when cerebrum.md exceeds ~2× openwolf.cerebrum.max_tokens. Not auto-trimmed — it's curated knowledge, so Claude is asked to consolidate by hand (keeping active preferences / Do-Not-Repeat).

Config (all defaulted)

"status":  { "max_sessions": 2, "archive_file": "history.md" },
"memory":  { "max_sessions": 20 },
"todo":    { "enabled": true }

Safety

  • All writes are atomic (tmp + rename) — a concurrent Stop hook from another agent/session in the same project can never read a half-written file (validated live with two concurrent Claude sessions).
  • Every housekeeping step is wrapped best-effort; a failure never breaks the Stop hook.
  • Reminders route through additionalContext (the v2 convention), except the pre-existing STATUS freshness check.

Testing

  • tsc -p tsconfig.json and tsc -p tsconfig.hooks.json both clean.
  • Fixtures exercise: journal rotation (kept newest N, preamble + live sections preserved), memory rotation (oldest-first eviction, reversed to newest-first in history), buglog index (pipe escaping, truncation), cerebrum nudge, mixed SESSION/SESSÃO markers, empty stdin.
  • Applied end-to-end to a real project: STATUS.md 18K→7K tokens, buglog read 68K→13K (index), memory 51K→18K, zero data loss (all rotated blocks accounted for in history.md).

🤖 Generated with Claude Code

meketreve and others added 2 commits July 25, 2026 02:53
Two related handoff-file improvements, both wired through init and the
Stop hook, zero required config.

TODO.md as a first-class .wolf file
- init now creates .wolf/TODO.md (create-if-missing, so an existing file
  is never overwritten) with {{PROJECT_NAME}}/{{DATE}} seeding, alongside
  a src/templates/TODO.md template.
- Stop hook nudges (via additionalContext) when 3+ files changed but
  TODO.md still has open items and wasn't touched this session.
- OPENWOLF.md + claude-rules document the STATUS.md (handoff) vs TODO.md
  (checklist) split and the session-end update step.
- config: openwolf.todo.enabled (default true).

Auto-rotating STATUS.md journal
- A running session journal at the top of STATUS.md (a leading blockquote
  of "> **SESSION N ..." / "> **SESSÃO N ..." blocks) grows every session
  and makes the "read STATUS.md first" resume expensive. The Stop hook now
  keeps only the newest N blocks and moves older ones to
  .wolf/STATUS-archive.md (newest first).
- N = openwolf.status.max_sessions (default 2). No-op unless there are more
  than N blocks, so most Stops touch nothing.
- Writes are atomic (tmp + rename) so a concurrent Stop hook from another
  agent/session in the same project can never read a half-written file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…OADMAP

Generalizes the STATUS.md auto-rotation from the previous commit into a
consistent "keep the files Claude reads every turn small" pass in the Stop
hook. All defaults are safe; existing installs are untouched on upgrade.

- Shared history file: STATUS.md journal + memory.md old sessions now rotate
  into a single .wolf/history.md (## Session Journal / ## Action Log), newest
  first. Configurable name via openwolf.status.archive_file (default history.md;
  replaces the earlier STATUS-archive.md).
- memory.md rotation: chronological "## Session:" blocks are trimmed to the
  newest N (openwolf.memory.max_sessions, default 20); older blocks move to
  history.md. memory.md is oldest-first, handled explicitly.
- buglog.md index: the Stop hook renders a compact index (id · tags · file ·
  truncated message) from buglog.json when the source changes. The protocol now
  says scan buglog.md and open only the matching entry — never read the whole
  JSON. buglog.json is never modified.
- cerebrum.md budget nudge: reminder (via additionalContext) when cerebrum.md
  exceeds ~2x openwolf.cerebrum.max_tokens. NOT auto-trimmed — it's curated
  knowledge, so Claude is asked to consolidate by hand.
- ROADMAP.md: new create-if-missing file for planned-but-not-active work, so
  STATUS.md stays focused on the current quest. Documented in OPENWOLF.md +
  claude-rules.

All writes are atomic (tmp + rename); every housekeeping step is best-effort
and never breaks the Stop hook.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@meketreve meketreve changed the title feat: native TODO.md + auto-rotating STATUS.md journal feat: lean .wolf handoff files — TODO.md, ROADMAP.md, history.md rotation + buglog index Jul 25, 2026
Caps live buglog.json at the newest N bugs (openwolf.buglog.max_entries,
default 200) in the Stop hook; older bugs move to buglog-archive.json
(chronological, append-only). Keeps the generated buglog.md index small
without ever deleting a logged fix. Atomic writes, archive-first so a crash
can only duplicate, never lose, a bug. Protocol notes that older bugs live
in buglog-archive.json (checked only if the index has no match).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant