Files

110 lines
4.7 KiB
Markdown
Raw Permalink Normal View History

---
name: session-start
description: "Auto-load project domain model from Obsidian wiki at session start. Detects project name from current working directory and loads the matching page via wiki-query pattern."
disable-model-invocation: true
---
# Session Start — Project Context Loader
This skill activates automatically when a new agent session begins in a project directory. It loads that project's domain model from the Obsidian wiki so the agent has full project context before processing any user request.
## When to use
At the very start of every new session, **before responding to anything else**, run this protocol:
1. Get current working directory name (basename)
2. Locate and read `wiki-config.md` in Obsidian vault to discover wiki root + index path
3. Read the wiki index (`index.md`) — find entry matching the cwd basename
4. Read that page's full content
5. Synthesize it into session context
6. Print: `✓ Session started for [project-name] — project context loaded from Obsidian wiki.`
## Instructions
### Step 1 — Detect project name
```bash
basename "$PWD"
```
This gives you the project identifier (e.g., `investor-flow`, `automaton`, `opencode-mcp-server-configuration`).
### Step 2 — Locate wiki config
Search for `wiki-config.md` in these locations (in order):
1. `~/Library/Mobile Documents/iCloud~md~obsidian/` (default Obsidian vault)
2. Any `.obsidian/` directory within the current project tree
3. Fallback: ask user for their wiki path if not found
Read `wiki-config.md` to discover:
- The wiki root directory
- The index file path (usually `<root>/index.md`)
- Any custom page paths or exclusions
### Step 3 — Find matching page in index
Read the wiki index. Look for an entry where the wikilink title matches the project name from step 1. Example:
```markdown
| [[investor-flow]] | domain-home | active | 2026-07-08 |
```
If no exact match found, try partial matching (e.g., `investor` → `[[investor-flow]]`). If still no match, inform the user: "No project wiki page found for this directory. Does your Obsidian vault have a domain model for it?" and proceed to step 6.
### Step 4 — Read the domain model page
Read the matched page in full (e.g., `~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Life/System/Projects/investor-flow.md`).
Key sections to extract:
- Design principles / architecture decisions
- Module catalog with status
- Tech stack summary
- Current build state and known issues
- Open questions
### Step 5 — Synthesize and present
Present a concise summary of the project context. Include:
- What the project is (one-line description)
- Key architectural decisions that affect code work
- Module status relevant to current directory or recent activity
- Current build state / what's in progress vs planned
- Any known issues or blockers
Keep it structured but brief — aim for ~10 lines of actionable context, not the full page. The goal is orientation, not reproduction.
### Step 6 — Confirm completion
Print exactly:
```
✓ Session started for [project-name] — project context loaded from Obsidian wiki.
```
Then proceed to handle the user's actual request with this context in mind.
## Rules
- **Do NOT skip this step.** Every new session must run it, even if you think you know the project. Wiki pages are the single source of truth and they evolve over time.
- **Do NOT modify any wiki files** during this process — read only.
- **If the wiki is not configured**, inform the user: "Your Obsidian vault doesn't have a wiki-config.md yet. Run `/wiki-config` to set up your wiki, then I can load project context automatically." End of turn.
- **Use the wiki's language and framing** — don't rephrase domain-specific terms from general knowledge.
## What this skill does not do
This skill only reads and presents existing wiki content. It does not:
- Create or modify wiki pages (that's for `/wiki-ingest`, `/wiki-crystallize`, etc.)
- Run any external commands beyond getting the cwd
- Make model invocations — it relies on filesystem read tools to access the Obsidian vault
## Example output
```
✓ Session started for investor-flow — project context loaded from Obsidian wiki.
**investor-flow** — Beginner-first investment research terminal with multi-agent orchestration, institutional/insider data, and options convexity. Local-first: Next.js + Bun/SQLite backend.
**Active modules:** M3 Options adapters (built), M4 Institution flow engine (built), M5 Insider transactions (built), M20 Risk posture dashboard (built). In-flight: Qwopus reviews on slices 7,10,15, portfolio.
**Known issues:** Empty route dirs (market-outlook, trade-closure), static HTML mockups not integrated into React app.
Ready for work with this context loaded.
```