Skip to content

Add missing scripts referenced in the guide (#11)#17

Merged
OnlyTerp merged 1 commit into
masterfrom
devin/1780514461-add-missing-scripts
Jun 3, 2026
Merged

Add missing scripts referenced in the guide (#11)#17
OnlyTerp merged 1 commit into
masterfrom
devin/1780514461-add-missing-scripts

Conversation

@OnlyTerp

@OnlyTerp OnlyTerp commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #11. The guide repeatedly references scripts under scripts/ (the Part 9 vault-graph tools, the Part 30 Ralph loop, the Part 15 worktree spawner) and even tells readers to "save the scripts from this repo" / "see scripts/vault-graph/ for the complete tools" — but the scripts/ directory didn't exist; the source only lived inline in the Markdown. This extracts the fully-inline scripts into runnable files, adds a scripts/README.md index, and links the committed files from the relevant parts.

Added (extracted verbatim from the part code blocks):

  • scripts/vault-graph/{graph-indexer,graph-search,auto-capture,process-inbox,update-mocs}.mjs (Part 9)
  • scripts/ralph.sh (Part 30)
  • scripts/fan-out.sh (Part 15)
  • scripts/README.md — index + usage, plus a "referenced elsewhere" table for the scripts whose source is intentionally not in this repo.

All five .mjs tools were run end-to-end against examples/vault/ (index → search → update-mocs → auto-capture → process-inbox) and the .sh wrappers pass bash -n.

Type of change

  • Tooling / CI / meta
  • Correction to an existing part

Review checklist

  • Added or updated cross-links from the README TOC and any related parts
  • Sources / release notes linked in the PR description (not inline as footnotes)
  • Ran markdownlint-cli2 and lychee --offline locally (CI will also run these)
  • No speculation presented as fact — any uncertainty is called out below

Notes / flagged items

  • I did not fabricate the scripts whose source is not in the guide:
    • scripts/memory-bridge/{memory-query,preflight-context}.js (Part 13) — Part 13's install step does git clone https://github.com/OnlyTerp/memory-bridge.git, but that repo currently 404s. I left the prose alone and instead documented the script's status in scripts/README.md. You may want to either publish OnlyTerp/memory-bridge or fix that install instruction.
    • lightrag-watcher.py (Part 21) and scripts/qwen_embed_server_v3.py (Part 10) — only config snippets / "lives in your local install" are in the guide, so these are documented as external in scripts/README.md rather than reproduced.
  • The Part 9 auto-capture.mjs (vault filer) and the Part 11 hooks/auto-capture/handler.ts (transcript extractor) are different things; scripts/README.md calls this out to avoid confusion.
  • CI doesn't lint or execute scripts/ (markdownlint/lychee only touch **/*.md), so the new code won't affect the existing checks.

Link to Devin session: https://app.devin.ai/sessions/21e86e63e6ed4a7cb88868ac2243d9ef
Requested by: @OnlyTerp


Open in Devin Review

The guide referenced scripts under scripts/ (vault-graph tools, ralph.sh,
fan-out.sh) but only included their source inline in the Markdown. Extract
the fully-inline scripts into runnable files, add a scripts/README.md index,
and link the committed files from the relevant parts.

Scripts whose source lives outside this repo (memory-bridge, lightrag-watcher,
qwen_embed_server) are documented in scripts/README.md rather than fabricated.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment on lines +85 to +89
if (!claim && !body) {
console.log('Usage: node auto-capture.mjs --claim "insight" --body "details..."');
process.exit(1);
}
const filename = toClaimName(claim);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 toClaimName generates hidden .md file when claim is empty

When --body is provided without --claim, the guard at auto-capture.mjs:85 (!claim && !body) passes because body is truthy while claim is ''. Then toClaimName('') at line 89 runs all its replacements on an empty string, which all produce '', and appends .md — creating a Unix hidden file named .md in the inbox. This file won't appear in normal ls listings, won't be found by subsequent process-inbox.mjs (which filters .endsWith('.md') but .md starts with a dot), and silently loses the user's capture.

Suggested change
if (!claim && !body) {
console.log('Usage: node auto-capture.mjs --claim "insight" --body "details..."');
process.exit(1);
}
const filename = toClaimName(claim);
if (!claim && !body) {
console.log('Usage: node auto-capture.mjs --claim "insight" --body "details..."');
process.exit(1);
}
if (!claim) claim = body.split('\n')[0] || 'untitled-capture';
const filename = toClaimName(claim);
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed real bug. Note this is pre-existing — the script was copied verbatim out of Part 9's code block, so the same defect lives in the guide prose too. Since this PR is purely "commit the inline scripts as files," I left the logic untouched to keep the file and the Part 9 block identical. Happy to fix it in a follow-up (or here) — but the fix should land in both scripts/vault-graph/auto-capture.mjs and the Part 9 code block so they don't drift. The suggested if (!claim) claim = body.split('\n')[0] || 'untitled-capture'; guard is the right shape. Deferring to the maintainer on whether to bundle that into this PR.

Comment on lines +65 to +68
const insertPoint = content.indexOf('\n', idx) + 1;
content = content.substring(0, insertPoint)
+ `\n- [ ] New capture linked: [[${linkName}]]\n`
+ content.substring(insertPoint);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 updateMOCs corrupts MOC file when ## Agent Notes has no trailing newline

If the ## Agent Notes heading is the last line of a MOC file (no trailing newline), content.indexOf('\n', idx) at auto-capture.mjs:65 returns -1. Adding 1 gives insertPoint = 0, so content.substring(0, 0) is the empty string. The result is the new link line prepended to the beginning of the file, with the entire original content appended after it — corrupting the MOC structure.

Suggested change
const insertPoint = content.indexOf('\n', idx) + 1;
content = content.substring(0, insertPoint)
+ `\n- [ ] New capture linked: [[${linkName}]]\n`
+ content.substring(insertPoint);
const nlIdx = content.indexOf('\n', idx);
const insertPoint = nlIdx !== -1 ? nlIdx + 1 : content.length;
content = content.substring(0, insertPoint)
+ `\n- [ ] New capture linked: [[${linkName}]]\n`
+ content.substring(insertPoint);
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same situation as the other finding — real bug, but pre-existing and copied verbatim from Part 9, so I kept the file identical to the guide block in this "extract scripts to files" PR. The suggested guard (const nlIdx = content.indexOf('\n', idx); const insertPoint = nlIdx !== -1 ? nlIdx + 1 : content.length;) is correct. If you want it fixed, I'll patch both auto-capture.mjs and the Part 9 code block together so they stay in sync.

@OnlyTerp OnlyTerp merged commit 3995bac into master Jun 3, 2026
3 checks passed
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.

[Gap] Scripts missing in repo

2 participants