Auto-capture sessions and synthesize knowledge in dream#289
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SessionEndhook (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 onorigin/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.SessionStartpattern incli/commands/install/agents.go. Rundots install agentsto register./dreamupgraded 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..github/skill-tests/harness.shagainst 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 cleanrevive -set_exit_status ./...— lint cleanbash .github/skill-tests/run_all.sh— 8/8 suites pass (5 new tests intest_session_capture.sh)bash .github/lint-skills.sh— skill schema cleanNotes
c8caa53..bdf06c2includes 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.stat -fpath is used; a GNUstat -cfallback is included for any future Linux runner.Co-Authored-By: Claude noreply@anthropic.com