implement missing brain-expand pipeline scripts#21
Closed
w3t-wr3 wants to merge 1 commit into
Closed
Conversation
adds the five scripts that brain-expand references but were previously stubs or missing entirely (issue 0xNyk#18): - run_session_sync.sh: extracts recent Claude/Codex session artifacts into the inbox as timestamped notes with frontmatter - detect_knowledge_gaps.py: scans the knowledge graph for orphan notes, broken wikilinks, and stale content; writes gaps.json - generate_review_queue.py: builds a prioritized review queue from unrouted inbox items older than 24 hours - route_inbox.py: sorts inbox notes into knowledge graph subdirectories based on frontmatter type and tags (supports --apply for dry run) - archive_inbox.py: moves notes older than 30 days to archive/inbox (supports --apply and --days flags) all scripts conform to the JSON stdout contract expected by lacp-brain-expand and pass the existing test suite.
0xNyk
added a commit
that referenced
this pull request
Mar 22, 2026
Audit fixes for community PR #21: - run_session_sync.sh: add set -e, fix JSON stdout contract - Extract shared parse_frontmatter() to brain_utils.py (was duplicated 3x) - Replace deprecated datetime.utcnow() with timezone-aware alternative - Add path traversal guard (skip filenames containing ..) - Add scripts/ci/test-brain-automation-scripts.sh (20 tests, exercises all 5 scripts directly with real temp dirs)
3 tasks
0xNyk
added a commit
that referenced
this pull request
Mar 22, 2026
* implement missing brain-expand pipeline scripts adds the five scripts that brain-expand references but were previously stubs or missing entirely (issue #18): - run_session_sync.sh: extracts recent Claude/Codex session artifacts into the inbox as timestamped notes with frontmatter - detect_knowledge_gaps.py: scans the knowledge graph for orphan notes, broken wikilinks, and stale content; writes gaps.json - generate_review_queue.py: builds a prioritized review queue from unrouted inbox items older than 24 hours - route_inbox.py: sorts inbox notes into knowledge graph subdirectories based on frontmatter type and tags (supports --apply for dry run) - archive_inbox.py: moves notes older than 30 days to archive/inbox (supports --apply and --days flags) all scripts conform to the JSON stdout contract expected by lacp-brain-expand and pass the existing test suite. * fix: harden brain-expand pipeline scripts + add direct tests Audit fixes for community PR #21: - run_session_sync.sh: add set -e, fix JSON stdout contract - Extract shared parse_frontmatter() to brain_utils.py (was duplicated 3x) - Replace deprecated datetime.utcnow() with timezone-aware alternative - Add path traversal guard (skip filenames containing ..) - Add scripts/ci/test-brain-automation-scripts.sh (20 tests, exercises all 5 scripts directly with real temp dirs) --------- Co-authored-by: MyrmtolioDebroudon <84546963+MyrmtolioDebroudon@users.noreply.github.com>
Owner
|
Thanks for the contribution @w3t-wr3 — great work implementing all 5 scripts. I've merged a hardened version in #23 that builds on your work with a few fixes:
Closing this in favor of #23. Thanks again for the solid foundation! |
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.
Hey Nyk; this implements the five scripts that brain-expand calls but were missing (re: #18).
What's included:
run_session_sync.shpulls recent Claude/Codex session artifacts into the inbox as timestamped notes with proper frontmatter. Tracks what's been processed so it doesn't duplicate on reruns.detect_knowledge_gaps.pyscans the knowledge graph for orphans (no inbound links), broken wikilinks (referenced but no file exists), and stale notes (30+ days untouched). Writesgaps.jsonto the expected path.generate_review_queue.pybuilds a prioritized queue from unrouted inbox items older than 24 hours, ranked by age and connection density. Writes the review-queue.md that session_orient reads.route_inbox.pysorts inbox notes into knowledge graph subdirectories based on frontmatter type and tags. Supports--applyfor the real move vs dry run.archive_inbox.pymoves notes older than N days to archive/inbox. Supports--applyand--daysflags.All five scripts conform to the JSON stdout contract that
lacp-brain-expandexpects and pass the existing test suite (test-brain-expand.shall green).I've been running a similar pipeline in my own Obsidian + Claude Code setup for a while now; these scripts are adapted from patterns I've battle tested. Happy to iterate on anything.