# Sb

> Second-brain skill — captures every Claude Code conversation into the ai-mind Obsidian vault, scoped by project (cwd). Use proactively when the user mentions 'lesson', 'topic note', 'kanban', 'tasks', 'second brain', 'remember this', or asks about past conversations / decisions / action items. Subcommands: /sb:status /sb:analyze /sb:lesson /sb:topic /sb:tasks /sb:task /sb:kanban /sb:connect /sb:t…

- **Type:** Skill
- **Install:** `agentstack add skill-prajwalmahajan101-claude-skills-pack-sb`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [prajwalmahajan101](https://agentstack.voostack.com/s/prajwalmahajan101)
- **Installs:** 0
- **Category:** [Productivity](https://agentstack.voostack.com/c/productivity)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [prajwalmahajan101](https://github.com/prajwalmahajan101)
- **Source:** https://github.com/prajwalmahajan101/claude-skills-pack/tree/main/skills/sb

## Install

```sh
agentstack add skill-prajwalmahajan101-claude-skills-pack-sb
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Second Brain (`sb`)

Persistent second brain for Claude Code, backed by the `ai-mind` Obsidian vault.

## What it does

- **Captures** every conversation automatically (Stop hook → `conversations//.md`).
- **Scopes** notes by project — one project per `cwd`. Each gets `INDEX.md`, `kanban.md`, `lessons.md`, `plans/`.
- **Analyzes** unprocessed conversations into lessons, takeaways, action items, and tags (via `claude -p` → Haiku, JSON schema).
- **Tracks** project tasks via Kanban markdown boards.
- **Connects** notes across projects (tag overlap + keyword similarity).
- **Topic notes** for evergreen reference (CRUD, observability, k8s, etc.).
- **Auto-tags** notes from rules + LLM suggestions.
- **AI-first notes** — lessons/topics carry a `## For future Claude` preamble + `ai-first: true`; a non-blocking Write/Edit validator warns on notes that miss it.
- **Self-maintenance** — `/sb:consolidate` dedupes lessons, archives stale conversations, and promotes durable lessons to memory (manual, dry-run by default); `/sb:health` audits the vault.
- **Obsidian Bases** — `/sb:bases` generates database views (Lessons, Projects, Conversations, Tasks, Memory) in `00_Dashboard/`.
- **External memory bridges** — promotes durable lessons into the harness file-memory (`~/.claude/projects/.../memory`) and logs activity to the `~/.remember` rolling history; new-session INDEX surfaces both.

## Subcommands

| Command | Purpose |
|---|---|
| `/sb:status` | Project + brain dashboard |
| `/sb:analyze [sid?]` | Mine un-analyzed conversations → lessons/takeaways/actions/tags |
| `/sb:lesson ""` | Capture a lesson from the current conversation |
| `/sb:topic ` | Create or extend a study/topic note |
| `/sb:tasks [--project] [--all]` | List pending kanban tasks |
| `/sb:task add "" [...]` | Add task to project kanban |
| `/sb:task done ` | Mark task done |
| `/sb:kanban [--project] [--open]` | Render/open project kanban |
| `/sb:connect [--current]` | Suggest links between notes |
| `/sb:tag [path?]` | Auto-tag notes |
| `/sb:search ` | Vault full-text search via Obsidian CLI; `--semantic` fuses precomputed-vector neighbors with lexical (RRF, key-free) |
| `/sb:project []` | List projects / show project INDEX |
| `/sb:backfill [--days N\|--all]` | Import historical conversations |
| `/sb:consolidate [--apply]` | Dedupe lessons, archive stale convos, promote durable→memory, import global lessons (dry-run unless `--apply`) |
| `/sb:health [--json]` | Read-only vault audit (orphans, duplicates, stale tasks, malformed frontmatter) |
| `/sb:bases` | (Re)generate Obsidian Bases views into `00_Dashboard/` |
| `/sb:ingest [--payload ]` | Write a supplied JSON note payload into `02_Projects//` (generic; the sutra orchestrator feeds it parsed repo artifacts) |
| `/sb:decision "" [--from-council]` | Capture an ADR (Context/Decision/Consequences/Usage) into `02_Projects//decisions` + global `11_Decisions` |
| `/sb:lessons-import [--push]` | Import `~/.claude/lessons` into the vault; `--push` writes sb lessons back to the global INDEX |
| `/sb:graph [--project ]` | Build a knowledge graph via graphify + mirror `graphify-out/` into `09_Exports/graph` |
| `/sb:zettel ""` | Atomic permanent Zettelkasten note (claim-title, related/sources) in `14_Zettelkasten` |
| `/sb:meeting "" [--attendees a,b]` | Meeting note; attendees auto-linked to People + interaction-logged |
| `/sb:person  [--log "..."]` | People/CRM note + interaction log in `12_People` |
| `/sb:habit "" [--done\|--list]` | Habit tracker with streaks in `15_Habits` |
| `/sb:verify ` | Mark an AI-drafted note human-verified (clears the `[!ai]` callout + review queue) |
| `/sb:challenge ` | Append a skeptical `## Challenge` pass using your own related notes |
| `/sb:ask-highlights ""` | Verbatim-only retrieval (quotes + `file:line`), never generated prose |
| `/sb:dashboard` | Regenerate the Life-Dashboard homepage (`00_Dashboard/Home.md`) |
| `/sb:eval [--rebuild] [--sample N]` | Measure retrieval quality — recall@1/3/5/10 + MRR per type over a Haiku-paraphrased held-out question set (`_meta/eval-set.json`) |
| `/sb:distill ""` | Distill a note into atomic, source-anchored claims (each `(src: Bn)`); unsourced claims dropped + reported; `verified:false` note in `08_Insights` |
| `/sb:related "" [--k N]` | Semantically nearest notes via smart-connections precomputed vectors (key-free, note-to-note cosine) |
| `/sb:init` | (Re)generate `_CLAUDE.md` + `index.md` (folder map, note types, rules, command list, counts, Base links) — idempotent, sentinel-bounded |
| `/sb:emerge [--apply] [--min N]` | Cluster lessons/zettels/topics by shared tag/title-token; draft `type:synthesis`, `verified:false` pages in `08_Insights` (dedup via `_meta/synthesis-seen.json`) |
| `/sb:idea "" [--body "a; b"]` | Capture an idea into `16_Ideas` (`status:captured`); bullets become the graduation checklist |
| `/sb:graduate "" [--project ]` | Promote an idea → `02_Projects//` + seed kanban cards from its bullets; idea `status:graduated` + backlink |

Note: `/sb:task new "" [--parent ]` supports hierarchical sub-tasks. Haiku-drafted
notes (`/sb:lesson`, `/sb:decision`, `/sb:zettel --draft`) are written `verified: false` with a
visible `[!ai]` callout and appear in `unverified.base` until `/sb:verify`.

Note: `/sb:lesson "" [--memory]` — `--memory` (or a model `durable:true` flag) also promotes the lesson to harness file-memory.

Note: facts that change over time (a person's `role`/`company`/`relationship`, a project's `status`) are recorded **bi-temporally** via `lib/timeline.js` — a `timeline:` frontmatter list of `field|value|from|source` entries. Values are never overwritten; the first change also seeds the prior value (`source: initial`) so no history is lost. `currentValue`/`historyOf` read it back.

## When to invoke

- User mentions "lesson learned", "remember this", "note this decision" → `/sb:lesson`
- User asks "what's on my plate?", "show tasks", "todos" → `/sb:tasks` or `/sb:status`
- User wants to study a topic or build reference notes → `/sb:topic`
- User asks "what did we figure out about X?" → `/sb:search`
- After a significant decision, root-cause discovery, or pivot → `/sb:lesson` then `/sb:connect --current`
- User says "set up second brain" or "install sb" → point them at `~/Desktop/git_projects/my_work/main-project/secondbrain_obsidian_claude/README.md`

## Vault layout

```
~/Documents/vaults/ai-mind/
├── conversations//.md   # auto
├── projects//{INDEX,kanban,lessons}.md + plans/
├── lessons/-.md
├── topics/.md
├── connections/.md
├── 08_Insights/          # distillation + synthesis (verified:false until /sb:verify)
├── 16_Ideas/.md    # captured ideas (status: captured|graduated)
├── inbox/
├── templates/
├── tags.md
└── _meta/{session-map,tag-rules}.json
```

## Configuration env vars

| Var | Default | Purpose |
|---|---|---|
| `SB_VAULT_PATH` | `~/Documents/vaults/ai-mind` | Vault root |
| `SB_VAULT_NAME` | `ai-mind` | Vault name for `obsidian vault=…` calls |
| `SB_ANALYZER_MODEL` | `claude-haiku-4-5-20251001` | Model for `/sb:analyze` |
| `SB_ANALYZER_MAX_TURNS` | `60` | Truncate longer convos |
| `SB_CAPTURE_DEBOUNCE_MS` | `5000` | Min gap between writes |
| `SB_CLAUDE_BIN` | `claude` | Path to claude CLI |
| `SB_DISABLE` | unset | `1` to suppress all sb hooks |
| `SB_VALIDATE_DISABLE` | unset | `1` to mute the AI-first Write/Edit validator |
| `SB_CONSOLIDATE_STALE_DAYS` | `90` | Age after which an analyzed conversation is archive-eligible |
| `SB_MEMORY_DIR` | `~/.claude/projects//memory` | Harness file-memory location |
| `SB_MEMORY_PROMOTE` | unset | `0` to disable promoting durable lessons to memory |
| `SB_REMEMBER_DIR` | `~/.remember` | Rolling activity-history location |
| `SB_LESSONS_DIR` | `~/.claude/lessons` | Global (canonical) lessons store for the bridge |
| `SB_EMBED_CMD` | unset | Optional query-embedder command (query on stdin → JSON float array on stdout) for `/sb:search --semantic`. Unset → keyword-anchor fallback (key-free) |
| `SB_EMBED_MODEL` | `TaylorAI/bge-micro-v2` | Which precomputed smart-connections model's vectors to read from `.smart-env/multi/*.ajson` |
| `SB_EVAL_SAMPLE` | `12` | Notes sampled when building the `/sb:eval` question set |

## Implementation

- `lib/vault.js` — path/slug helpers, session-map I/O
- `lib/jsonl.js` — parse session JSONL → ordered turns
- `lib/markdown.js` — render turns; append-aware
- `lib/analyzer.js` — `claude -p` wrapper, JSON-schema extraction
- `lib/tagger.js` — rules + LLM tag merging
- `lib/kanban.js` — Obsidian Kanban markdown CRUD
- `lib/connector.js` — link suggestion engine
- `lib/ai-first.js` — `## For future Claude` preamble + frontmatter + note validation
- `lib/timeline.js` — bi-temporal facts (`timeline:` history; never overwrite)
- `lib/provenance.js` — numbered source blocks + source-anchored claim splitting (for `/sb:distill`)
- `lib/embeddings.js` — key-free semantic layer over smart-connections precomputed vectors (cosine/nearest/anchor)
- `lib/memory-bridge.js` — promote/list/mirror harness file-memory facts
- `lib/remember-bridge.js` — append/read the `~/.remember` rolling history
- `lib/git.js` — tiny generic git repo-root helper
- `lib/lessons-bridge.js` — import/list/push the global `~/.claude/lessons` store
- `commands/_runners/{consolidate,health,bases,init,emerge,eval}.js` — self-maintenance, Bases, entry docs, synthesis, retrieval eval
- `commands/_runners/{distill,related,idea,graduate}.js` — provenance distillation, semantic neighbors, idea lifecycle
- `commands/_runners/{ingest,decision,lessons-import,graph}.js` — vault-ingest + supporting runners
- `hooks/sb-capture.js` — Stop/SubagentStop/**PreCompact**, writes conversation file (`type: conversation`)
- `hooks/sb-plan-mirror.js` — PostToolUse, mirrors plans
- `hooks/sb-validate.js` — PostToolUse (Write/Edit), non-blocking AI-first validator
- `hooks/sb-session-start.js` — scaffolds project dir; injects Memory & Remember section

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [prajwalmahajan101](https://github.com/prajwalmahajan101)
- **Source:** [prajwalmahajan101/claude-skills-pack](https://github.com/prajwalmahajan101/claude-skills-pack)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-prajwalmahajan101-claude-skills-pack-sb
- Seller: https://agentstack.voostack.com/s/prajwalmahajan101
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
