Skip to content
Back to search

open-second-brain

Local-first 🧠 memory for Hermes Agent that lives in your Obsidian vault and remembers project context. Nightly 😴 dream passes turn repeat corrections into confirmed preferences with measurable confidence. Adapters ship for Claude Code, Codex, and OpenClaw, with an MCP server for anything else.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026. Its scripts were only partly scanned.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/itechmeat/open-second-brain with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/itechmeat/open-second-brain'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/itechmeat--open-second-brain/badge.svg)](/listings/itechmeat--open-second-brain)

HTML

<a href="/listings/itechmeat--open-second-brain"><img src="/api/listings/itechmeat--open-second-brain/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. Install [Bun](https://bun.sh/) 1.1 or later: [`install/prerequisites.md`](install/prerequisites.md). 2. Install the plugin for your client (guides below), or get the `o2b` CLI: [`install/prerequisites.md`](install/prerequisites.md#get-the-o2b-cli). 3. Create the vault files:

   o2b init       --vault /path/to/vault --name "My Second Brain"
   o2b brain init --vault /path/to/vault

4. Connect the client (table below), then check the result:

   o2b doctor --vault /path/to/vault
   o2b install --check

The full router with readiness criteria is [`install.md`](install.md); native Windows is covered in [`install/windows.md`](install/windows.md).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 20 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. {
  2. "name": "open-second-brain",
  3. "owner": {
  4. "name": "itechmeat",
  5. "url": "https://github.com/itechmeat"
  6. },
  7. "metadata": {
  8. "description": "Open Second Brain marketplace (single self-hosted plugin).",
  9. "version": "1.0.0"
  10. },
  11. "plugins": [
  12. {
  13. "name": "open-second-brain",
  14. "source": "./",
  15. "description": "Plugin-first second brain for AI agents and humans (Obsidian-compatible Markdown vaults).",
  16. "category": "knowledge",
  17. "tags": ["second-brain", "obsidian", "agents", "skills", "event-log", "mcp"]
  18. }
  19. ]
  20. }
README.md · README · 148 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # Open Second Brain
  2. ![Open Second Brain - your knowledge, amplified by AI](docs/images/readme-poster.jpg)
  3. Open Second Brain is a memory layer for AI agents that lives in an [Obsidian](https://obsidian.md) vault. Agents read and write it through MCP servers, lifecycle hooks and the `o2b` CLI. Everything the agent learns is a Markdown file under `Brain/`, so you can open, edit, grep and version it like any other note. A deterministic `dream` pass turns repeated signals into rules and retires the ones nothing uses; no model runs inside that algorithm.
  4. ## How it fits
  5. ```mermaid
  6. flowchart LR
  7. subgraph Clients["Agent clients"]
  8. Plug["Plugins: Claude Code, Codex,<br/>Hermes, opencode, Grok Build"]
  9. Mcp["MCP config: Cursor, kiro, Copilot CLI,<br/>Gemini CLI, ZCode, any MCP host"]
  10. Claw["OpenClaw<br/>in-process plugin"]
  11. Cliu["Aider, Pi<br/>CLI and context file"]
  12. end
  13. subgraph Product["Open Second Brain"]
  14. Srv["MCP servers<br/>open-second-brain, open-second-brain-writer"]
  15. Hooks["Lifecycle hooks<br/>o2b-hook"]
  16. Cli["CLI<br/>o2b"]
  17. Core["Core"]
  18. end
  19. subgraph Vault["Your vault"]
  20. Brain["Brain/<br/>Markdown the agent writes"]
  21. Notes["Your notes"]
  22. Index[(".open-second-brain/brain.sqlite<br/>rebuildable search index")]
  23. end
  24. Plug --> Srv
  25. Plug --> Hooks
  26. Mcp --> Srv
  27. Claw --> Core
  28. Cliu --> Cli
  29. Srv --> Core
  30. Hooks --> Core
  31. Cli --> Core
  32. Core --> Brain
  33. Core --> Index
  34. Core -. reads, writes a named note on request .-> Notes
  35. ```
  36. Each client reaches the same core through a plugin, an MCP registration or the CLI. The core keeps its own records under `Brain/` and a generated search index under `.open-second-brain/` that it can rebuild from the files. Your notes are read; the note tools write one only at a path the caller names.
  37. ```mermaid
  38. flowchart LR
  39. Agent["Agent"] -->|brain_feedback| Inbox["Brain/inbox/<br/>signal"]
  40. Inbox -->|dream pass| Pref["Brain/preferences/<br/>rule"]
  41. Pref -->|rendered into| Active["Brain/active.md"]
  42. Active -->|read at session start| Agent
  43. Agent -->|brain_apply_evidence| Log["Brain/log/"]
  44. Log -->|next dream pass| Pref
  45. ```
  46. The learning loop: signals become rules, rules reach the next session through `Brain/active.md`, and applied or violated evidence confirms, quarantines or retires them. Details: [`docs/how-it-works.md`](docs/how-it-works.md#a-preferences-lifecycle).
  47. ## Install
  48. 1. Install [Bun](https://bun.sh/) 1.1 or later: [`install/prerequisites.md`](install/prerequisites.md).
  49. 2. Install the plugin for your client (guides below), or get the `o2b` CLI: [`install/prerequisites.md`](install/prerequisites.md#get-the-o2b-cli).
  50. 3. Create the vault files:
  51. ```bash
  52. o2b init --vault /path/to/vault --name "My Second Brain"
  53. o2b brain init --vault /path/to/vault
  54. ```
  55. 4. Connect the client (table below), then check the result:
  56. ```bash
  57. o2b doctor --vault /path/to/vault
  58. o2b install --check
  59. ```
  60. The full router with readiness criteria is [`install.md`](install.md); native Windows is covered in [`install/windows.md`](install/windows.md).
  61. ## Supported clients
  62. | Client | Integration | Guide |
  63. | ------------------ | ------------------------------------------------------------------------ | -------------------------------------------------- |
  64. | Claude Code | Marketplace plugin: MCP servers and hooks | [`install/claudecode.md`](install/claudecode.md) |
  65. | OpenAI Codex | Marketplace plugin, then `o2b install --target codex --apply` | [`install/codex.md`](install/codex.md) |
  66. | ChatGPT desktop | Reads the shared Codex config: `o2b install --target codex --apply` | [`install/codex.md`](install/codex.md) |
  67. | Hermes Agent | Plugin and memory provider | [`install/hermes.md`](install/hermes.md) |
  68. | OpenClaw | Native plugin, no MCP | [`install/openclaw.md`](install/openclaw.md) |
  69. | opencode | `o2b install --target opencode --apply`: MCP servers and a native plugin | [`install/opencode.md`](install/opencode.md) |
  70. | Grok Build | `o2b install --target grok --apply`: MCP servers and hooks | [`install/grok.md`](install/grok.md) |
  71. | Cursor | `o2b install --target cursor --apply` | [`install/cursor.md`](install/cursor.md) |
  72. | kiro | `o2b install --target kiro --apply` | [`install/kiro.md`](install/kiro.md) |
  73. | GitHub Copilot CLI | `o2b install --target copilot-cli --apply` | [`install/copilot-cli.md`](install/copilot-cli.md) |
  74. | Gemini CLI | `o2b install --target gemini-cli --apply` | [`install/gemini-cli.md`](install/gemini-cli.md) |
  75. | ZCode | MCP servers added to its config by hand | [`install/zcode.md`](install/zcode.md) |
  76. | Aider | `o2b install --target aider --apply`: context file, no MCP | [`install/aider.md`](install/aider.md) |
  77. | Pi | `o2b install --target pi --apply`: skill over the CLI | [`install/pi.md`](install/pi.md) |
  78. | Any other MCP host | `o2b install --target generic --apply --out -` prints the server entries | [`install/generic.md`](install/generic.md) |
  79. `o2b uninstall --target <name> --apply` removes what `o2b install` wrote; the vault is never touched ([`install.md`](install.md#uninstall)).
  80. ## Capabilities
  81. - **Preferences that learn and expire.** Signals, a deterministic dream pass, confidence and retirement: [how it works](docs/how-it-works.md#a-preferences-lifecycle).
  82. - **Reversible changes.** Brain mutations take a snapshot first; `o2b brain rollback` restores it: [snapshots](docs/how-it-works.md#snapshots-and-rollback).
  83. - **Attributed writes.** `o2b brain writes` lists every note write by agent and device, `writes revert` plans a restore, `o2b brain freeze` stops all writers, and `o2b brain log verify` checks the hash-chained log: [Brain CLI](docs/cli-reference.md#brain-observing-memory).
  84. - **Search.** Keyword search with an optional semantic lane, result explanations, recall profiles and compact cards; an opt-in iterative loop (`search_iterative_recall_enabled`, default off) keeps querying when coverage gaps survive, pausing with a plan the caller answers through `brain_search`'s round trip; and an opt-in per-source-session cap (`search_pool_max_per_session`, default off) keeps one long imported session from filling the candidate window, so diversity spreads across sessions: [search CLI](docs/cli-reference.md#search), [iterative recall](docs/cli-reference.md#iterative-recall-since-v1820), [pool cap](docs/cli-reference.md#the-per-source-session-pool-cap-since-v1830), [ranking](docs/how-it-works.md#full-text-search).
  85. - **Session recall.** Import agent transcripts already on disk, search them, or select whole-thread coverage under a character budget (`o2b brain session-grep --operation coverage --char-budget <n>`, with `--entity-key` seeding the fan-out from mined entity mentions): [session logs](docs/cli-reference.md#session-logs-this-machine-already-has-since-v1500), [coverage](docs/cli-reference.md#coverage-first-session-recall-since-v1820).
  86. - **Hygiene.** `o2b brain hygiene scan` finds contested, duplicate, stale and unused memories; `apply` runs only the findings you pick: [maintenance](docs/cli-reference.md#maintenance-and-operator-surfaces).
  87. - **Claim ledger.** `o2b brain truth ingest` records an entity claim with an optional validity window (`--valid-from`/`--valid-until`; with the flags absent, a window on the source record's frontmatter is adopted and frozen at ingest), `truth events` recalls a windowed slice of the ledger, and `truth state` grounds an agent-stated claim with an anchoring verdict - committed, or reported back with reason codes. `truth state` accepts an optional opaque `--sample-id` naming the context-pack sample the claim drew on, and claim reads report the receipt and outcome provenance behind it at the caller's reach - "receipt known, outcome unknown", never an invented verdict: [entity truth CLI](docs/cli-reference.md#entity-truth-and-self-improving-dream-since-v0430).
  88. - **Corrections.** `o2b brain lifecycle correct <target>` reports a correction's blast radius and retires the affected records - validity-closed by default, tombstoned with `--flatly-wrong`, dry run by default and `--apply` to write. A retired record that recall can still serve is served only beside its correction, never alone: [belief lifecycle CLI](docs/cli-reference.md#belief-lifecycle-and-decision-memory-since-v1330).
  89. - **Sharing and backup.** Knowledge packs export a chosen subset; `o2b brain bank-export` writes a one-file backup bundle: [knowledge packs](docs/cli-reference.md#knowledge-packs).
  90. - **Secret custody.** Credentials live encrypted in the vault's state dir behind a capability-gated store; `$secret:NAME` references resolve at the use sites, `o2b brain secret unlock` wraps the keyfile under a passphrase, and `secret export`/`import` move the store between installs as one passphrase-encrypted bundle: [custody CLI](docs/cli-reference.md#write-time-integrity-and-governance-since-v0440).
  91. - **Today view and note markers.** `o2b brain today`, `@osb loop` and `@osb set` markers: [Brain CLI](docs/cli-reference.md#brain-observing-memory).
  92. - **Self-inspection.** `o2b version`, `o2b install --friction` and `o2b state status` report what is installed and where state lives: [CLI reference](docs/cli-reference.md#core).
  93. - **MCP surface.** Tools, tool profiles for hosts with tool limits, and the always-loaded writer server: [`docs/mcp.md`](docs/mcp.md).
  94. ## Optional features
  95. - **Semantic search:** an embedding provider plus `sqlite-vec`; the `embeddings-setup` skill walks through it: [`skills/embeddings-setup/SKILL.md`](skills/embeddings-setup/SKILL.md).
  96. - **Decision models:** a typed judgment model that can rerank search and filter candidates, off by default per use: [`docs/decision-models.md`](docs/decision-models.md).
  97. - **Deep relational recall:** a fourth search arm over typed links, off by default. Its traversal runs under width budgets - 8 seeds, 4 edges per node, 16 nodes in total, and a hub above 12 walked edges is reached but not expanded - each overridable through an `OPEN_SECOND_BRAIN_SEARCH_TRAVERSAL_*` environment variable or a `search_traversal_*` config key; entity co-occurrence bridges join the walk by default and switch off separately (`OPEN_SECOND_BRAIN_SEARCH_ENTITY_BRIDGES`): [retrieval quality](docs/cli-reference.md#retrieval-quality-and-context-delivery-since-v1370).
  98. - **Staged review for agent writes, off by default.** With no key set every write publishes exactly as before. `write_approval.notes` / `OPEN_SECOND_BRAIN_WRITE_APPROVAL_NOTES_ENABLED` and `write_approval.ingest` / `OPEN_SECOND_BRAIN_WRITE_APPROVAL_INGEST_ENABLED` (each falling back to the `write_approval.enabled` master, default off) stage note creates and ingest summary pages into `Brain/pending/` beside the staged signals, where they stay out of the search index until an operator runs `o2b brain pending list` and applies or rejects them; [write-path integrity](docs/cli-reference.md#write-path-integrity-and-store-safety-since-v1320).
  99. - **A permissions document, absent by default.** `Brain/_permissions.yaml` (an operator-edited vault file) resolves `allow`/`ask`/`deny` per agent, role and target for the write, ingest and owner-write actions; with the file absent every check behaves exactly as today. `ask` stages the write, `deny` refuses with the `write-refused` token and the next command `o2b brain permissions show`, and every ask/deny verdict lands in a queryable decision ledger under `Brain/logs/decisions/`; `o2b brain permissions show` dry-runs the decision table, `ledger` reads the rows; [Brain CLI](docs/cli-reference.md#brain-observing-memory).
  100. - **The owner-write gate, off by default.** `integrity.owner_scope_writes` in `Brain/_brain.yaml` (`off` | `warn` | `fail`, default `off`) refuses a caller-named owner that differs from the caller's resolved identity on the preference and note lanes (`warn` allows and records one decision-ledger row); a document `owner_write` verdict composes most-restrictive-wins with the gate; [write-time integrity](docs/cli-reference.md#write-time-integrity-and-governance-since-v0440).
  101. - **Named MCP tokens, optional.** `o2b mcp token mint|rotate|revoke|list` keeps a hash-at-rest token per agent (`.open-second-brain/secrets/mcp-tokens.json`; material shown exactly once). Over HTTP a valid token authenticates as its agent per request, the shared `--api-key` stays valid as the operator master credential, and `mcp_tokens_required` / `OPEN_SECOND_BRAIN_MCP_TOKENS_REQUIRED` (default `false`) makes a non-empty token map refuse credential-less requests. `o2b bootstrap --target <harness> [--token] [--rotate] [--check]` provisions MCP registration, token and receipt in one idempotent command, and `o2b bootstrap --remove <harness>` tears a provision down again; the minted token authenticates HTTP clients configured by hand, while the registered stdio harness presents no credential and keeps its config-derived identity; [core CLI](docs/cli-reference.md#core).
  102. - **Ambient capture consent, opt-out.** `guardrails.ambient_writeback: false` suppresses the ambient extraction lane with a counted `ambient-withheld` event (absent keeps today's behavior), and `guardrails.ambient_ttl_days` stamps an `expiration_date` on ambient-extracted signals so reads drop them after the window (absent stamps nothing); a TTL-stamped signal still stages when the review gate is on and survives apply verbatim.
  103. - **Open decisions.** `o2b brain decision open --title <t> --question <q> --option <o> [...]` parks a question with enumerated options at `Brain/decisions/open-<slug>.md`; `resolve` mints the real `type: decision` page, `discard` closes without deciding, and the morning brief renders up to five open questions: [belief lifecycle](docs/cli-reference.md#belief-lifecycle-and-decision-memory-since-v1330).
  104. ## What is new
  105. Open Second Brain 1.98.0 is the agent-presence and self-improvement release. `o2b install --target <host> --apply` now writes the brain-usage block into the agent-instruction file the installed host reads at the vault root (AGENTS.md for codex, cursor, opencode and aider; GEMINI.md for gemini-cli) under the same consent prompt as the config writes, preserving every byte outside the block and recording its ownership so uninstall removes exactly the pair the tool wrote; the dream pass gains an operator-approved exit into those same files, where a lesson promotes into a managed lessons block only with a fresh approval pinned to the approved text, and the doctor grades every block state it can name. The skill lane gains a benchmark-gated rewrite loop: a skill is rewritten only after a candidate beats the incumbent on scored dev tasks with full coverage and survives the one held-out check - Open Second Brain never calls a model, the scorer reads structural predicates and nothing the agent claims about its own work, and the accept stays an operator step on the command line. And ChatGPT desktop is named where its operators look for it: it reads the shared Codex config, so one codex registration serves both. Every release is described in the [CHANGELOG](CHANGELOG.md).
  106. ## Documentation
  107. | Topic | Page |
  108. | --------------------------------------------------------- | ---------------------------------------------------------------- |
  109. | Mental model, vault layout, dream pass, safety properties | [`docs/how-it-works.md`](docs/how-it-works.md) |
  110. | Every CLI verb and flag | [`docs/cli-reference.md`](docs/cli-reference.md) |
  111. | MCP protocol, tools, writer split | [`docs/mcp.md`](docs/mcp.md) |
  112. | Brain store: setup, sync, migration, the human view | [`docs/brain-store.md`](docs/brain-store.md) |
  113. | Architecture and configuration model | [`docs/architecture.md`](docs/architecture.md) |
  114. | Updating (`o2b update`) and upgrade notes | [`docs/updating.md`](docs/updating.md) |
  115. | Observability events | [`docs/observability.md`](docs/observability.md) |
  116. | Metrics data contract | [`docs/metrics.md`](docs/metrics.md) |
  117. | Cross-project pointer | [`docs/cross-project-pointer.md`](docs/cross-project-pointer.md) |
  118. | Scheduled Brain digest (Hermes cron) | [`docs/hermes-cron.md`](docs/hermes-cron.md) |
  119. | Stability policy | [`docs/stability.md`](docs/stability.md) |
  120. | Origin of the idea | [`docs/idea.md`](docs/idea.md) |
  121. ## Project
  122. [CHANGELOG](CHANGELOG.md) · [Security policy](SECURITY.md) · [Source on GitHub](https://github.com/itechmeat/open-second-brain) · [MIT License](LICENSE)
scripts/o2b-aider.cmd · Bundled script · 44 lines · 1 finding marked
  1. @echo off
  2. rem Aider wrapper.
  3. rem Windows twin of the bash launcher beside it (scripts/o2b-aider); cmd.exe
  4. rem cannot run that one. Resolves Bun the way _bun-precheck.sh does: PATH
  5. rem first, then the default %USERPROFILE%\.bun\bin install location.
  6. rem DisableDelayedExpansion: a ! in the checkout path must stay a character
  7. rem even where delayed expansion is switched on in the registry.
  8. setlocal DisableDelayedExpansion
  9. rem cmd.exe looks in the current directory before PATH, so a bun.cmd or
  10. rem bun.exe in the project an agent host opened would run instead of Bun.
  11. set "NoDefaultCurrentDirectoryInExePath=1"
  12. set "O2B_ROOT=%~dp0.."
  13. set "O2B_BUN=bun"
  14. where bun >nul 2>&1
  15. if errorlevel 1 (
  16. if exist "%USERPROFILE%\.bun\bin\bun.exe" (
  17. set "O2B_BUN=%USERPROFILE%\.bun\bin\bun.exe"
  18. ) else (
  19. >&2 echo error: 'bun' is not on PATH. Open Second Brain runs on Bun ^(^>=1.1.0^). Install it with:
  20. >&2 echo powershell -c "irm bun.sh/install.ps1 ^| iex"
  21. exit /b 127
  22. )
  23. )
  24. rem Dependency bootstrap. A marketplace add/upgrade replaces this checkout
  25. rem wholesale, so node_modules can arrive missing even though package.json and
  26. rem bun.lock ship with the tree, and the CLI then cannot start. One file stat
  27. rem when the tree is present; one frozen install when it is not. Mirrors the
  28. rem block in scripts/o2b; O2B_SKIP_DEP_BOOTSTRAP opts out.
  29. if not exist "%O2B_ROOT%\node_modules\proper-lockfile\package.json" (
  30. if not defined O2B_SKIP_DEP_BOOTSTRAP (
  31. >&2 echo o2b-aider: dependency tree missing in this checkout; running 'bun install --frozen-lockfile'...
  32. pushd "%O2B_ROOT%"
  33. "%O2B_BUN%" install --frozen-lockfile 1>&2
  34. if errorlevel 1 (
  35. >&2 echo error: the automatic 'bun install --frozen-lockfile' failed in "%O2B_ROOT%".
  36. >&2 echo Run that command inside the checkout yourself, then retry. See install/codex.md and docs/updating.md.
  37. popd
  38. exit /b 1
  39. )
  40. popd
  41. )
  42. )
  43. "%O2B_BUN%" run "%O2B_ROOT%\src\cli\main.ts" aider wrap %*
  44. exit /b %ERRORLEVEL%
scripts/o2b-mcp.cmd · Bundled script · 46 lines · 1 finding marked
  1. @echo off
  2. rem Open Second Brain MCP server (stdio).
  3. rem Windows twin of the bash launcher beside it (scripts/o2b-mcp); cmd.exe
  4. rem cannot run that one. Resolves Bun the way _bun-precheck.sh does: PATH
  5. rem first, then the default %USERPROFILE%\.bun\bin install location.
  6. rem DisableDelayedExpansion: a ! in the checkout path must stay a character
  7. rem even where delayed expansion is switched on in the registry.
  8. setlocal DisableDelayedExpansion
  9. rem cmd.exe looks in the current directory before PATH, so a bun.cmd or
  10. rem bun.exe in the project an agent host opened would run instead of Bun.
  11. set "NoDefaultCurrentDirectoryInExePath=1"
  12. set "O2B_ROOT=%~dp0.."
  13. set "O2B_BUN=bun"
  14. where bun >nul 2>&1
  15. if errorlevel 1 (
  16. if exist "%USERPROFILE%\.bun\bin\bun.exe" (
  17. set "O2B_BUN=%USERPROFILE%\.bun\bin\bun.exe"
  18. ) else (
  19. >&2 echo error: 'bun' is not on PATH. Open Second Brain runs on Bun ^(^>=1.1.0^). Install it with:
  20. >&2 echo powershell -c "irm bun.sh/install.ps1 ^| iex"
  21. exit /b 127
  22. )
  23. )
  24. rem Dependency bootstrap. A marketplace add/upgrade replaces this checkout
  25. rem wholesale, so node_modules can arrive missing even though package.json and
  26. rem bun.lock ship with the tree, and the CLI then cannot start. One file stat
  27. rem when the tree is present; one frozen install when it is not. Mirrors the
  28. rem block at the bottom of _bun-precheck.sh; O2B_SKIP_DEP_BOOTSTRAP opts out.
  29. rem stdout joins stderr: this launcher serves the MCP stdio transport, and
  30. rem bun's install report must never interleave with the JSON-RPC stream.
  31. if not exist "%O2B_ROOT%\node_modules\proper-lockfile\package.json" (
  32. if not defined O2B_SKIP_DEP_BOOTSTRAP (
  33. >&2 echo o2b: dependency tree missing in this checkout; running 'bun install --frozen-lockfile'...
  34. pushd "%O2B_ROOT%"
  35. "%O2B_BUN%" install --frozen-lockfile 1>&2
  36. if errorlevel 1 (
  37. >&2 echo error: the automatic 'bun install --frozen-lockfile' failed in "%O2B_ROOT%".
  38. >&2 echo Run that command inside the checkout yourself, then retry. See install/codex.md and docs/updating.md.
  39. popd
  40. exit /b 1
  41. )
  42. popd
  43. )
  44. )
  45. "%O2B_BUN%" run "%O2B_ROOT%\src\cli\main.ts" mcp %*
  46. exit /b %ERRORLEVEL%
scripts/o2b.cmd · Bundled script · 46 lines · 1 finding marked
  1. @echo off
  2. rem Open Second Brain CLI.
  3. rem Windows twin of the bash launcher beside it (scripts/o2b); cmd.exe
  4. rem cannot run that one. Resolves Bun the way _bun-precheck.sh does: PATH
  5. rem first, then the default %USERPROFILE%\.bun\bin install location.
  6. rem DisableDelayedExpansion: a ! in the checkout path must stay a character
  7. rem even where delayed expansion is switched on in the registry.
  8. setlocal DisableDelayedExpansion
  9. rem cmd.exe looks in the current directory before PATH, so a bun.cmd or
  10. rem bun.exe in the project an agent host opened would run instead of Bun.
  11. set "NoDefaultCurrentDirectoryInExePath=1"
  12. set "O2B_ROOT=%~dp0.."
  13. set "O2B_BUN=bun"
  14. where bun >nul 2>&1
  15. if errorlevel 1 (
  16. if exist "%USERPROFILE%\.bun\bin\bun.exe" (
  17. set "O2B_BUN=%USERPROFILE%\.bun\bin\bun.exe"
  18. ) else (
  19. >&2 echo error: 'bun' is not on PATH. Open Second Brain runs on Bun ^(^>=1.1.0^). Install it with:
  20. >&2 echo powershell -c "irm bun.sh/install.ps1 ^| iex"
  21. exit /b 127
  22. )
  23. )
  24. rem Dependency bootstrap. A marketplace add/upgrade replaces this checkout
  25. rem wholesale, so node_modules can arrive missing even though package.json and
  26. rem bun.lock ship with the tree, and the CLI then cannot start. One file stat
  27. rem when the tree is present; one frozen install when it is not. Mirrors the
  28. rem block at the bottom of _bun-precheck.sh; O2B_SKIP_DEP_BOOTSTRAP opts out.
  29. if not exist "%O2B_ROOT%\node_modules\proper-lockfile\package.json" (
  30. if not defined O2B_SKIP_DEP_BOOTSTRAP (
  31. >&2 echo o2b: dependency tree missing in this checkout; running 'bun install --frozen-lockfile'...
  32. pushd "%O2B_ROOT%"
  33. rem stdout joins stderr: this launcher also serves the MCP stdio transport,
  34. rem and bun's install report must never interleave with the JSON-RPC stream.
  35. "%O2B_BUN%" install --frozen-lockfile 1>&2
  36. if errorlevel 1 (
  37. >&2 echo error: the automatic 'bun install --frozen-lockfile' failed in "%O2B_ROOT%".
  38. >&2 echo Run that command inside the checkout yourself, then retry. See install/codex.md and docs/updating.md.
  39. popd
  40. exit /b 1
  41. )
  42. popd
  43. )
  44. )
  45. "%O2B_BUN%" run "%O2B_ROOT%\src\cli\main.ts" %*
  46. exit /b %ERRORLEVEL%
scripts/vault-log.cmd · Bundled script · 44 lines · 1 finding marked
  1. @echo off
  2. rem Append one event to the vault log.
  3. rem Windows twin of the bash launcher beside it (scripts/vault-log); cmd.exe
  4. rem cannot run that one. Resolves Bun the way _bun-precheck.sh does: PATH
  5. rem first, then the default %USERPROFILE%\.bun\bin install location.
  6. rem DisableDelayedExpansion: a ! in the checkout path must stay a character
  7. rem even where delayed expansion is switched on in the registry.
  8. setlocal DisableDelayedExpansion
  9. rem cmd.exe looks in the current directory before PATH, so a bun.cmd or
  10. rem bun.exe in the project an agent host opened would run instead of Bun.
  11. set "NoDefaultCurrentDirectoryInExePath=1"
  12. set "O2B_ROOT=%~dp0.."
  13. set "O2B_BUN=bun"
  14. where bun >nul 2>&1
  15. if errorlevel 1 (
  16. if exist "%USERPROFILE%\.bun\bin\bun.exe" (
  17. set "O2B_BUN=%USERPROFILE%\.bun\bin\bun.exe"
  18. ) else (
  19. >&2 echo error: 'bun' is not on PATH. Open Second Brain runs on Bun ^(^>=1.1.0^). Install it with:
  20. >&2 echo powershell -c "irm bun.sh/install.ps1 ^| iex"
  21. exit /b 127
  22. )
  23. )
  24. rem Dependency bootstrap. A marketplace add/upgrade replaces this checkout
  25. rem wholesale, so node_modules can arrive missing even though package.json and
  26. rem bun.lock ship with the tree, and the CLI then cannot start. One file stat
  27. rem when the tree is present; one frozen install when it is not. Mirrors the
  28. rem block in scripts/o2b; O2B_SKIP_DEP_BOOTSTRAP opts out.
  29. if not exist "%O2B_ROOT%\node_modules\proper-lockfile\package.json" (
  30. if not defined O2B_SKIP_DEP_BOOTSTRAP (
  31. >&2 echo vault-log: dependency tree missing in this checkout; running 'bun install --frozen-lockfile'...
  32. pushd "%O2B_ROOT%"
  33. "%O2B_BUN%" install --frozen-lockfile 1>&2
  34. if errorlevel 1 (
  35. >&2 echo error: the automatic 'bun install --frozen-lockfile' failed in "%O2B_ROOT%".
  36. >&2 echo Run that command inside the checkout yourself, then retry. See install/codex.md and docs/updating.md.
  37. popd
  38. exit /b 1
  39. )
  40. popd
  41. )
  42. )
  43. "%O2B_BUN%" run "%O2B_ROOT%\src\cli\main.ts" append-event %*
  44. exit /b %ERRORLEVEL%

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.