Files
SecondBrain/Bootstrap script for this vault.md

682 lines
11 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Use this `bootstrap-vault.sh`:
```bash
#!/bin/bash
set -e
echo ""
echo "======================================"
echo " SecondBrain Vault Bootstrap"
echo "======================================"
echo ""
folders=(
"00 Inbox/MeetMic"
"10 Knowledge/CTO Academy/Data"
"10 Knowledge/CTO Academy/Project Management"
"10 Knowledge/CTO Academy/Infrastructure"
"10 Knowledge/CTO Academy/Security"
"10 Knowledge/Quotes"
"10 Knowledge/Templates"
"20 Work/Contracts/Active"
"20 Work/Contracts/Archive"
"20 Work/Decisions"
"20 Work/Ideas"
"20 Work/Journal"
"20 Work/KPIs"
"20 Work/Meetings/Internal"
"20 Work/Meetings/Vendors"
"20 Work/Projects"
"20 Work/Team"
"20 Work/Tracking"
"20 Work/Weekly Review"
"90 Archives"
)
for folder in "${folders[@]}"; do
mkdir -p "$folder"
if [ ! -f "$folder/.gitkeep" ]; then
touch "$folder/.gitkeep"
fi
echo "✓ $folder"
done
echo ""
echo "Vault structure created."
echo ""
echo "Important:"
echo "- Employee folders under 20 Work/Team are created dynamically by Templater."
echo "- Month folders under employee 1-1 folders are also created dynamically."
echo "- Templates themselves should already exist in Git under 10 Knowledge/Templates."
echo ""
echo "SecondBrain bootstrap complete."
echo ""
```
Save it as:
scripts/bootstrap-vault.sh
Then:
chmod +x scripts/bootstrap-vault.sh
And commit it.
---
For the README, Id use something like this:
# SecondBrain
Personal work and leadership knowledge system built with Obsidian.
The vault is backed up through Git and a private Gitea repository.
The goal is to make the environment easy to restore on a new computer with minimal manual reconstruction.
---
# Quick Restore
## 1. Clone the vault
```bash
git clone <GITEA_REPOSITORY_URL>
cd SecondBrain
```
## 2. Restore the folder structure
```bash
./scripts/bootstrap-vault.sh
```
## 3. Open the vault in Obsidian
Open Obsidian and choose:
**Open folder as vault**
Select the cloned `SecondBrain` directory.
## 4. Restore plugins
Enable Community Plugins in Obsidian and install the plugins listed below.
Some plugin configuration is stored in `.obsidian/` and may already be restored by Git depending on what is tracked.
Machine-specific workspace state is intentionally excluded.
---
# Obsidian Plugins
## Core Workflow
These plugins are important to the functionality of SecondBrain.
### Templater
Used for dynamic note creation, automatic file naming, folder creation, dates, and structured templates.
Templates are stored in:
```text
10 Knowledge/Templates/
```
Important: YAML/frontmatter must remain at the very beginning of templates. Do not place Templater JavaScript before the YAML block.
### Dataview
Used to generate dynamic lists and views from note properties and metadata.
### Obsidian Git
Provides Git integration and automatic backup from the desktop vault.
Repository synchronization is done against a private Gitea repository.
### Auto GitKeep
Automatically creates `.gitkeep` files inside empty directories so the vault structure can be preserved by Git.
This is particularly useful because Git does not normally track empty directories.
---
# Navigation and Editing
These plugins improve the Obsidian interface but are not required for the underlying vault structure.
### Notebook Navigator
Replaces the standard Obsidian file explorer with a two-pane navigation interface.
### Folder Links
Allows folder links to reveal the corresponding folder in the navigation interface.
### Editing Toolbar
Provides a more visual editing toolbar with commonly used Markdown commands.
### Iconic
Adds custom icons to folders, files, properties, bookmarks, and other Obsidian interface elements.
### Omnisearch
Provides enhanced full-vault search.
---
# Integration
### Local REST API with MCP
Provides a local REST API and MCP interface for interacting with the vault from external tools and local automation.
This is an advanced integration and is not required for basic vault operation.
Do not expose the REST API directly to the public Internet.
---
# Optional / Disabled Plugins
### Settings Search
Provides search across Obsidian settings.
Currently installed but disabled.
---
# Vault Structure
```text
00 Inbox/
└── MeetMic/
10 Knowledge/
├── CTO Academy/
├── Quotes/
├── Templates/
└── Principles.md
20 Work/
├── Contracts/
│ ├── Active/
│ └── Archive/
├── Decisions/
├── Ideas/
├── Journal/
├── KPIs/
├── Meetings/
│ ├── Internal/
│ └── Vendors/
├── Projects/
├── Team/
├── Tracking/
└── Weekly Review/
90 Archives/
```
Employee and monthly 1-1 folders are created dynamically by Templater.
Example:
```text
20 Work/Team/
└── Employee Name/
└── 1-1/
└── 08/
```
---
# MeetMic Integration
MeetMic is used for local meeting transcription and/or summaries.
MeetMic should output Markdown or transcript files into:
```text
00 Inbox/MeetMic/
```
The Inbox is intentionally a temporary landing area.
After reviewing a MeetMic note:
- move useful meeting information into `20 Work/Meetings`
- extract decisions into `20 Work/Decisions`
- extract action items into Jira, Twos, or Monday
- delete/archive the raw MeetMic output when no longer useful
## MeetMic Machine Setup
MeetMic itself is not stored in this vault.
On a new computer:
1. Install MeetMic.
2. Configure its output folder to point to:
```text
<VAULT_PATH>/00 Inbox/MeetMic
```
3. Confirm Markdown output is enabled.
4. Test with a short recording.
---
# Contract Processing Integration
Contract PDFs are deliberately **not stored inside the Obsidian vault**.
The local contract processor lives separately, typically at:
```text
~/Herd/scripts/obsidian-contracts
```
Expected source structure:
```text
obsidian-contracts/
├── Algolia/
│ └── 2024/
│ └── contract.pdf
├── Directus/
│ └── 2026/
│ └── contract.pdf
├── process_contracts.py
├── prompt.md
├── .env
└── logs/
```
The vendor folder name is the canonical vendor name.
Example:
```text
Directus/2026/
```
will generate:
```text
Directus - 2026-2027.md
```
even if the contract itself names TFO as the purchaser.
Generated contract notes are written to:
```text
20 Work/Contracts/Active/
```
---
# Contract Processor Requirements
## Python
Create a virtual environment:
```bash
cd ~/Herd/scripts/obsidian-contracts
python3 -m venv .venv
source .venv/bin/activate
pip install requests python-dotenv
```
When returning to the project later:
```bash
cd ~/Herd/scripts/obsidian-contracts
source .venv/bin/activate
```
When finished:
```bash
deactivate
```
## PDF Extraction
Install Poppler:
```bash
brew install poppler
```
This provides:
```text
pdftotext
```
## Local AI
Ollama is used for local contract extraction.
Install Ollama and confirm:
```bash
ollama --version
```
The current contract model is:
```text
contract-reader
```
Example base model:
```text
qwen3:1.7b
```
The dedicated model should use a limited context to avoid excessive memory usage.
Example `Modelfile`:
```text
FROM qwen3:1.7b
PARAMETER num_ctx 4096
PARAMETER temperature 0.1
PARAMETER num_predict 1200
```
Create it:
```bash
ollama create contract-reader -f Modelfile
```
---
# Contract Processor Environment
The local `.env` file is **not committed to Git**.
Example:
```text
OBSIDIAN_VAULT="/Users/YOUR_USER/Documents/Obsidian Vault/SecondBrain"
CONTRACT_OUTPUT="20 Work/Contracts/Active"
OLLAMA_BASE_URL="http://127.0.0.1:11434"
OLLAMA_MODEL="contract-reader"
MAX_CONTEXT_CHARS="5000"
```
Process one contract:
```bash
python3 process_contracts.py --folder Algolia/2024
```
Force regeneration:
```bash
python3 process_contracts.py --folder Algolia/2024 --force
```
---
# Contract Processor Behavior
The processor:
1. extracts PDF text locally using `pdftotext`
2. reduces the contract to important sections
3. sends only those excerpts to local Ollama
4. extracts commercial and renewal information
5. validates important renewal clauses against the actual PDF text
6. creates an Obsidian Markdown contract record
Nothing is intentionally sent to a cloud AI provider.
Important renewal fields include:
```text
auto_renewal
renewal_term_months
customer_notice_days
vendor_notice_days
notice_deadline
renewal_increase_percent
renewal_pricing_rule
```
The generated note also contains source evidence from the PDF.
---
# Git Configuration
## Recommended `.gitignore`
```gitignore
# macOS
.DS_Store
# Obsidian machine-specific state
.obsidian/workspace.json
.obsidian/workspace-mobile.json
# PDFs should never be stored in the vault repository
*.pdf
```
The contract automation repository should additionally ignore:
```gitignore
.env
.venv/
logs/
token.json
credentials.json
*.pdf
```
## `.obsidian` Strategy
Do not ignore the entire `.obsidian/` directory.
Keeping selected Obsidian configuration in Git makes it much easier to reproduce the vault on another computer.
Machine-specific state such as the following should remain ignored:
```text
.obsidian/workspace.json
.obsidian/workspace-mobile.json
```
Plugin configuration can be synchronized where appropriate.
---
# Mobile
The mobile vault may use GitSync rather than the Obsidian Git community plugin.
Mobile and desktop should synchronize against the same private Gitea repository.
Avoid making conflicting edits to the same note simultaneously on multiple devices.
Machine-specific mobile workspace state is excluded through:
```text
.obsidian/workspace-mobile.json
```
---
# What Is NOT Backed Up By This Vault
The following must be restored separately:
- Ollama models
- MeetMic application/settings
- contract PDFs
- `~/Herd/scripts/obsidian-contracts` unless stored in its own private repository
- `.env`
- authentication tokens
- local application settings
- Git/Gitea credentials
- GitSync application configuration
---
# Recommended Recovery Strategy
Maintain two private Git repositories:
```text
SecondBrain
└── Obsidian content, templates, configuration and structure
obsidian-automation
└── scripts, prompts, Modelfiles and setup documentation
```
Never commit:
- contracts
- PDFs
- secrets
- `.env`
- authentication tokens
---
# Recovery Checklist
After moving to a new computer:
## Vault
- Install Git
- Clone SecondBrain from Gitea
- Run `bootstrap-vault.sh`
- Install Obsidian
- Open SecondBrain as a vault
## Obsidian Plugins
- Install Templater
- Install Dataview
- Install Obsidian Git
- Install Auto GitKeep
- Install Notebook Navigator
- Install Folder Links
- Install Editing Toolbar
- Install Iconic
- Install Omnisearch
- Install Local REST API with MCP
- Verify Templater template folder
- Verify Git configuration
- Verify plugin settings
## Integrations
- Configure MeetMic output
- Install Python
- Install Poppler
- Install Ollama
- Restore/create `contract-reader`
- Clone/copy contract automation scripts
- Recreate `.env`
- Test contract extraction
## Synchronization
- Test Git pull
- Test Git commit/push
- Configure GitSync on mobile if required
- Test mobile pull
- Test mobile push