Second Brainのロゴ

Second Brain

コミュニティ
morankor
second-brain

理論論文のローカルライブラリを対象とするエージェント型RAG(LaTeX対応の取り込み、定理・証明ツール、ハイブリッド検索)を使って、学術向けの「セカンドブレイン」を構築し、活用します。フォルダ内の論文用にセカンドブレインを作りたい場合、「/second-brain」「set up a second brain here」「ingest this paper into my second brain」と入力した場合、または既存のセカンドブレインライブラリ([paths]セクションを含むconfig.tomlとindex/フォルダがあるディレクトリ)を対象に質問する場合に使用します。

概要

公開者morankor
リポジトリtheorist-toolbox
スキル名second-brain
スター
92
フォーク
23
同梱ファイル
41
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 41個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    morankorがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Second Brain」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/morankor/theorist-toolbox/tree/master/skills/second-brain
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/morankor/theorist-toolbox.git /tmp/theorist-toolbox
mkdir -p .claude/skills
cp -r /tmp/theorist-toolbox/skills/second-brain .claude/skills/second-brain
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSecond Brainを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSecond Brainを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Second Brainは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Second Brain — setup and usage

Author: Moran Koren, Ben-Gurion University of the Negev (korenmor@bgu.ac.il). Part of the Theorist Toolbox.

Sets up a self-contained agentic-RAG library in a target directory: papers are ingested from LaTeX source (preferred), HTML, or PDF-OCR into a chunked, QA-gated index; an agent (or Claude Code itself via MCP) answers questions by reading exact theorems/proofs with custom macros and prerequisite definitions auto-bundled. Full design: package/ in this skill contains the complete brain Python package.

Throughout, $SKILL means this skill's base directory (shown in the message that loaded this file) and $TARGET means the directory the user wants the second brain in (default: the current working directory; ask only if the cwd is clearly wrong for a paper library, e.g. a code repo).

Step 0 — detect state

$TARGET/config.toml exists AND $TARGET/.venv/bin/brain runs → already initialized: skip to Usage. Otherwise run Init.

Init

bash
cd "$TARGET"
python3 -m venv .venv
.venv/bin/pip install -q "$SKILL/package[dev,providers,mcp,web]"
cp "$SKILL/templates/config.toml" config.toml
.venv/bin/brain status        # creates papers/ parsed_papers/ index/ scratchpad/

Then register the MCP server for Claude Code by writing $TARGET/.mcp.json (absolute paths, no ~):

json
{
  "mcpServers": {
    "second-brain": {
      "command": "<ABS_TARGET>/.venv/bin/python",
      "args": ["-m", "brain.mcp_server"],
      "env": { "BRAIN_CONFIG": "<ABS_TARGET>/config.toml" }
    }
  }
}

Verify the install with the bundled fixture, then remove the test entry:

bash
.venv/bin/brain ingest "$SKILL/package/tests/fixtures/mini_paper" --id selftest --no-llm
.venv/bin/brain search "monotone valuations"       # selftest must rank first
.venv/bin/python -c "
from pathlib import Path; from brain.config import load_config; from brain.index import store
import shutil
cfg = load_config(Path('config.toml')); idx = store.load_index(cfg.index_file)
idx.pop('selftest', None); store.save_index(cfg.index_file, idx)
shutil.rmtree(cfg.parsed_dir / 'selftest', ignore_errors=True)"

Finish by telling the user: (1) init is done and verified; (2) restarting Claude Code in $TARGET and approving the "second-brain" MCP server lets them ask about their library in any session, billed to their Claude subscription; (3) the standalone CLI default (claude-code provider) also uses the subscription — keep ANTHROPIC_API_KEY unset for that; and (4) offer to ingest papers right away (see below). If the directory already contains PDFs or .tex sources, list them and offer to ingest them.

Usage

All commands run from $TARGET with .venv/bin/brain:

  • Ingest — brain ingest <arxiv-id | tex-dir | file.tex | url | file.pdf>
    • Prefer arXiv ids / LaTeX source (Tier 0: exact math, no OCR). PDFs need pip install "$SKILL/package[ocr]" and are QA-flagged by default.
    • Idempotent; add --force to re-ingest, --no-llm to skip metadata enrichment (use --no-llm when the user wants speed or determinism).
    • After a batch, run brain status and report any ⚠ needs_review papers.
  • Search (no LLM) — brain search "query" -v
  • Ask — brain ask "question" -v (or brain repl for multi-turn). Inside Claude Code, prefer the MCP tools directly instead of shelling out to brain ask — same backend, no nested agent.
  • Health — brain status; run .venv/bin/pytest "$SKILL/package/tests" -q if something seems broken.

When answering from MCP tools yourself, follow the library's grounding rules: search first; use read_theorem_or_proof for any formal statement; record notation with write_to_scratchpad after reading a Model section; cite [paper_id, Item] for every mathematical claim; flag needs_review sources.

Updating the bundled package

If the canonical copy in papers_2nd_brain evolves, refresh this skill with: rsync -a --exclude __pycache__ --exclude '*.egg-info' <canonical>/pyproject.toml <canonical>/src <canonical>/tests "$SKILL/package/" — then existing brains pick it up via .venv/bin/pip install -q --force-reinstall "$SKILL/package[dev,providers,mcp,web]".

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Second Brain」では何ができますか?

理論論文のローカルライブラリを対象とするエージェント型RAG(LaTeX対応の取り込み、定理・証明ツール、ハイブリッド検索)を使って、学術向けの「セカンドブレイン」を構築し、活用します。フォルダ内の論文用にセカンドブレインを作りたい場合、「/second-brain」「set up a second brain here」「ingest this paper into my second brain」と入力した場合、または既存のセカンドブレインライブラリ([paths]セクションを含むconfig.tomlとindex/フォルダがあるディレクトリ)を対象に質問する場合に使用します。

TypingMindでSecond Brainを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Second Brainはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSecond Brainをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/morankor/theorist-toolbox/tree/master/skills/second-brainを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Second Brainを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Second Brainで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSecond Brainを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Second Brain」は無料ですか?

はい。morankorがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇