Skip to content

Auto-capture sessions and synthesize knowledge in dream#289

Merged
drn merged 3 commits intomasterfrom
wip-branch
May 6, 2026
Merged

Auto-capture sessions and synthesize knowledge in dream#289
drn merged 3 commits intomasterfrom
wip-branch

Conversation

@drn
Copy link
Copy Markdown
Owner

@drn drn commented May 6, 2026

Summary

  • New SessionEnd hook (agents/hooks/session-end-capture.sh) writes a structured raw note into <vault>/memory/inbox/ whenever a Claude Code session authored a commit. Tags [session-capture, high-value, commit-merged] when any commit lands on origin/main/origin/master, [session-capture, work-in-progress] for unmerged commits. Captures intent, commit shas, files touched, and metadata. Fail-soft on every error path.
  • Hook registration mirrors the existing SessionStart pattern in cli/commands/install/agents.go. Run dots install agents to register.
  • /dream upgraded to translate raw data into knowledge: new Phase 0 ingests yesterday's Granola + Notion meetings into the inbox; rewritten Phase 3 distills inbox captures into existing topical docs (decisions, people facts, conventions, gotchas) instead of just filing the raw note. High-value (commit-merged) captures process first.
  • Hardened .github/skill-tests/harness.sh against the silent remote-collision pitfall that earlier in this PR caused test commits to be pushed to a real GitHub master.

Test Plan

  • go install ./... — build clean
  • revive -set_exit_status ./... — lint clean
  • bash .github/skill-tests/run_all.sh — 8/8 suites pass (5 new tests in test_session_capture.sh)
  • bash .github/lint-skills.sh — skill schema clean

Notes

  • Origin/master at c8caa53..bdf06c2 includes 4 historical test-pollution commits (seed, draft work in progress, ship feature foo, another ship) from before the harness fix in this PR. Those are now permanent master history; not reverted.
  • The CI build will run on macOS where the BSD stat -f path is used; a GNU stat -c fallback is included for any future Linux runner.

Co-Authored-By: Claude noreply@anthropic.com

Darren Cheng and others added 3 commits May 5, 2026 17:37
Add a SessionEnd hook that writes a structured raw note to memory/inbox/
whenever a session authored a commit. Tags `commit-merged` (high-value)
when commits land on origin/main|master, `work-in-progress` otherwise.
Captures intent, commit shas, files touched, and session metadata.

Upgrade the dream skill to translate raw data into knowledge:
- Phase 0 ingests yesterday's Granola + Notion meetings into the inbox
- Phase 3 distills inbox captures (decisions, people facts, conventions)
  into existing topical docs instead of just filing the raw note
- High-value (commit-merged) captures process first

Includes a guarded test suite. Hardens against the harness's silent
remote-collision pitfall: aborts loudly if cwd isn't a temp dir or if
origin doesn't point at the temp bare repo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- session-end-capture.sh: add `|| true` to git fetch, COMMITS pipe, INTENT
  jq so the ERR trap doesn't kill the hook on fail-soft branches
- session-end-capture.sh: sanitize SHORT_SESSION before use in filename
- session-end-capture.sh: strip leading/trailing hyphens from SLUG
- session-end-capture.sh: add Linux GNU stat fallback for the transcript
  mtime path
- session-end-capture.sh: hoist MAX_COMMITS / MAX_FILES / MAX_INTENT_CHARS
  to named constants
- session-end-capture.sh: add `command -v argus` guard mirroring peer hooks
- session-end-capture.sh: document the `set -uo pipefail` + ERR trap
  divergence from peer hooks
- dream/SKILL.md: replace `thanx/` paths in the synthesis examples and
  report templates with generic `<org>/`, `patterns/`, `memory/people/`
  for public-repo policy compliance (pre-existing thanx/ refs left in
  place — out of scope for this PR)
- dream/SKILL.md: drop the private `[[granola]]` wikilink in Phase 0;
  inline the same-day quirk explanation
- dream/SKILL.md: note that the original Claude Code transcript at
  transcript_path is the recovery path after Phase 3 deletes inbox notes
- dream/SKILL.md: explicit "skip silently on tool-not-found" instruction
  for Phase 0 MCP tools
- test_session_capture.sh: add a comment explaining why the sleep 1
  calls are required (git --since second-level granularity)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`add_test_remote` previously swallowed the "remote already exists" error
from `git remote add`, which let the subsequent `git push origin master`
push test commits to whatever the parent repo's origin pointed at — in
practice, the real GitHub remote. Refuse to proceed when the colliding
remote URL doesn't match the temp bare we just created.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@drn drn merged commit 6cd4c19 into master May 6, 2026
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