Skip to content

An always-on second brain you talk to. Voice notes in Telegram → typed, linked knowledge in your Obsidian vault. Runs 24/7 on the Claude subscription you already have.

feat: add processing phases and new formatting rules

smixs723491ff4449
diff --git a/vault/.claude/rules/obsidian-markdown.md b/vault/.claude/rules/obsidian-markdown.md
new file mode 100644
index 0000000..2be7374
--- /dev/null
+++ b/vault/.claude/rules/obsidian-markdown.md
@@ -0,0 +1,154 @@
+---
+type: note
+title: Obsidian Markdown Rules
+---
+# Obsidian Markdown Rules
+
+Rules for writing valid Obsidian Flavored Markdown in vault files.
+Source: adapted from kepano/obsidian-skills (MIT).
+
+## Wiki-Links
+
+```markdown
+[[Note Name]] Basic link
+[[Note Name|Display Text]] Link with alias
+[[Note Name#Heading]] Link to heading
+[[#Heading in same note]] Same-note heading link
+[[Note Name#^block-id]] Link to block
+```
+
+### Block References
+
+Add `^block-id` at end of any paragraph to make it linkable:
+
+```markdown
+This paragraph can be linked to. ^my-block
+
+> Quote block content
+^quote-id
+```
+
+Then link with `[[Note#^my-block]]`.
+
+## Embeds
+
+```markdown
+![[Note Name]] Embed full note
+![[Note Name#Heading]] Embed section
+![[image.png]] Embed image
+![[image.png|300]] Image with width
+![[image.png|640x480]] Image with dimensions
+![[document.pdf#page=3]] PDF page
+```
+
+## Callouts
+
+```markdown
+> [!note]
+> Basic note callout.
+
+> [!warning] Custom Title
+> Warning with title.
+
+> [!tip]- Collapsed by default
+> Foldable content.
+```
+
+### Types we should use in vault:
+
+| Type | When to use |
+|------|-------------|
+| `[!warning]` | Blockers, risks, urgent items |
+| `[!info]` | Context, background info |
+| `[!tip]` | Recommendations, best practices |
+| `[!todo]` | Action items |
+| `[!success]` | Wins, completed milestones |
+| `[!question]` | Open questions |
+| `[!example]` | Examples, templates |
+
+## Tables with Wiki-Links
+
+Escape pipes inside wiki-links in tables:
+
+```markdown
+| Client | Link |
+|--------|------|
+| Client | [[business/crm/acme-corp\|Acme Corp]] |
+```
+
+## Comments
+
+Obsidian-native comments (hidden in reading view):
+
+```markdown
+%%This is hidden in reading view%%
+
+%%
+Multi-line hidden block.
+Only visible in edit mode.
+%%
+```
+
+Use `%%` for Obsidian, `<!-- -->` for HTML-compatible comments.
+Our processing markers (`<!-- processed -->`) stay as HTML comments since they're parsed by scripts.
+
+## Tags
+
+Valid tag characters:
+- Letters (any language), numbers, `_`, `-`, `/`
+- Numbers cannot be first character
+- `/` creates nested tags: `#business/client`
+
+```markdown
+#tag #nested/tag #tag-with-dashes
+
+# In frontmatter:
+tags:
+ - tag1
+ - nested/tag2
+```
+
+## Properties (Frontmatter)
+
+### Types
+
+| Type | Example |
+|------|---------|
+| Text | `title: My Title` |
+| Number | `rating: 4.5` |
+| Checkbox | `completed: true` |
+| Date | `date: 2024-01-15` |
+| Date+Time | `due: 2024-01-15T14:30:00` |
+| List | `tags: [one, two]` |
+| Links | `related: "[[Other Note]]"` |
+
+### Default properties (special meaning in Obsidian)
+
+- `tags` — searchable tags
+- `aliases` — alternative names (found via search/link autocomplete)
+- `cssclasses` — custom CSS classes
+
+## Escaping
+
+```markdown
+\*not italic\*
+\#not heading
+1\. not a list
+```
+
+## Footnotes
+
+```markdown
+Text with footnote[^1].
+
+[^1]: Footnote content.
+
+Inline footnote^[content here].
+```
+
+## Do NOT
+
+- Use `%%` comments for processing markers (keep `<!-- -->` for scripts)
+- Use block references (`^id`) in daily notes (too granular)
+- Add `aliases` to CRM files (use wiki-link aliases instead)
+- Use Mermaid/LaTeX unless specifically needed
diff --git a/vault/.claude/rules/weekly-reflection.md b/vault/.claude/rules/weekly-reflection.md
new file mode 100644
index 0000000..f46100b
--- /dev/null
+++ b/vault/.claude/rules/weekly-reflection.md
@@ -0,0 +1,82 @@
+---
+type: note
+paths: "thoughts/reflections/YYYY-W*"
+---
+
+# Weekly Reflection Format
+
+Rules for weekly system reflections (triggered on Sundays or by `/weekly`).
+
+## Purpose
+
+Analyze accumulated observations → find patterns → propose improvements.
+This is the **operational learning loop** — the system learns from its own friction.
+
+## When to Generate
+
+- Every Sunday (automatically or via `/weekly`)
+- When observations in `.session/handoff.md` reach ≥10
+
+## File Location
+
+`thoughts/reflections/YYYY-WNN-system-reflection.md`
+
+## Template
+
+```markdown
+---
+date: YYYY-MM-DD
+type: reflection
+description: "Week NN system analysis: N friction signals, M patterns found, K proposals"
+tags: [system, reflection, weekly]
+source: .session/handoff.md
+related: []
+---
+
+# Week NN System Reflection
+
+## Friction Patterns
+<!-- Group similar observations from handoff.md -->
+- **mcp-cli timeouts:** N occurrences — [root cause hypothesis]
+- **Empty daily files:** N of 7 days — [pattern: weekends?]
+- **Broken links:** N new this week — [source: CRM imports?]
+
+## Improvements Applied
+<!-- What was fixed this week -->
+- [fix] Description of what was improved
+- [fix] Another improvement
+
+## Proposals
+<!-- Concrete proposals for system improvements -->
+1. [proposal] Description — target file: `path/to/file`
+2. [proposal] Another proposal — target: `scripts/process.sh`
+
+## Graph Health
+Score: NN/100 (↑/↓ N vs last week)
+- Orphans: N (was M)
+- Broken links: N (was M)
+- Avg links/file: X.XX
+- Description coverage: Y%
+
+## Observations Cleared
+<!-- After reflection, clear processed observations from handoff.md -->
+Moved N observations to this reflection file.
+```
+
+## Process
+
+1. Read `.session/handoff.md` → collect `## Observations`
+2. Read `.graph/health-history.json` → get this week's trend
+3. Group observations by type (friction/pattern/idea)
+4. Find recurring patterns (same issue >2 times)
+5. Propose concrete improvements (file + change)
+6. Write reflection file
+7. Clear processed observations from handoff.md (keep unprocessed)
+8. Add reflection to daily log
+
+## Tags
+
+Use `#system` tag for all system reflections.
+Cross-reference with:
+- `[[MEMORY.md]]` — if proposals become decisions
+- `[[goals/3-weekly]]` — if proposals affect weekly focus
diff --git a/vault/.claude/skills/dbrain-processor/phases/capture.md b/vault/.claude/skills/dbrain-processor/phases/capture.md
new file mode 100644
index 0000000..3f78e77
--- /dev/null
+++ b/vault/.claude/skills/dbrain-processor/phases/capture.md
@@ -0,0 +1,98 @@
+# Phase 1: CAPTURE
+
+Read daily entries, classify them, and output structured JSON.
+
+## Input
+- `daily/{DATE}.md` — today's entries
+- `goals/3-weekly.md` — current week focus
+- `goals/2-monthly.md` — monthly priorities
+- `goals/1-yearly-2026.md` — yearly goals
+
+## Task
+
+1. Read `daily/{DATE}.md`
+2. For each entry (## HH:MM [type] block), classify:
+ - **task** — actionable item → will become Todoist task
+ - **idea** → will be saved to thoughts/ideas/
+ - **reflection** → thoughts/reflections/
+ - **learning** → thoughts/learnings/
+ - **project** → thoughts/projects/
+ - **crm_update** — mentions business client → update CRM
+ - **skip** — already processed or not actionable
+3. Detect entity mentions (company names, people, projects)
+4. Align with goals (which goal does this serve?)
+
+## Output Format
+
+Print ONLY valid JSON (no markdown, no explanation):
+
+```json
+{
+ "date": "2026-02-19",
+ "one_big_thing": "[Client A] NCP: POST-LAUNCH stabilization",
+ "entries": [
+ {
+ "time": "10:30",
+ "type": "voice",
+ "content": "Called Acme Corp about the project, discussed KPI",
+ "classification": "task",
+ "task_content": "Follow-up Acme Corp: send KPI report",
+ "task_priority": 2,
+ "task_due": "tomorrow",
+ "entities": ["business/crm/acme-corp"],
+ "goal_alignment": "ONE Big Thing"
+ },
+ {
+ "time": "14:00",
+ "type": "text",
+ "content": "AI agents need layered memory",
+ "classification": "idea",
+ "title": "AI agents need layered memory with decay scoring",
+ "description": "Pattern from analysis. Active memories decay if unused.",
+ "category": "ideas",
+ "tags": ["ai", "agents", "memory"],
+ "entities": [],
+ "goal_alignment": "yearly/AI Development"
+ }
+ ],
+ "stats": {
+ "total_entries": 5,
+ "tasks": 2,
+ "thoughts": 2,
+ "crm_updates": 1,
+ "skipped": 0
+ }
+}
+```
+
+## Classification Rules
+
+### Task indicators
+- "нужно", "надо", "сделать", "позвонить", "отправить", "подготовить"
+- Deadline mentions (завтра, в пятницу, до конца недели)
+- Follow-up mentions
+
+### Thought indicators
+- Insights, patterns, observations
+- "понял что", "интересно что", "заметил"
+- No clear action required
+
+### CRM indicators
+- Company name mention (known clients from CRM)
+- Deal/project status change
+- Meeting/call with client
+
+### Process goal formulation
+When creating task_content, prefer PROCESS over OUTCOME:
+- WRONG: "Закрыть сделку с Acme Corp"
+- RIGHT: "Отправить follow-up Acme Corp: KPI отчёт за февраль"
+
+### Prose-as-title for thoughts
+When creating thought titles, use CLAIMS not topic labels:
+- WRONG: "Agent Memory System" (topic label)
+- RIGHT: "AI agents need layered memory with decay scoring" (specific claim)
+Test: "Since [[title]], ..." should read naturally.
+
+## Important
+- Mark entries with `<!-- ✓ processed -->` as "skip"
+- Output ONLY JSON — no explanation, no markdown wrapping
diff --git a/vault/.claude/skills/dbrain-processor/phases/execute.md b/vault/.claude/skills/dbrain-processor/phases/execute.md
new file mode 100644
index 0000000..bf0c8e1
--- /dev/null
+++ b/vault/.claude/skills/dbrain-processor/phases/execute.md
@@ -0,0 +1,101 @@
+# Phase 2: EXECUTE
+
+Read capture.json from Phase 1. Create Todoist tasks, save thoughts, update CRM.
+
+## Input
+- `.session/capture.json` — output from Phase 1
+- `business/_index.md` — business context
+- `projects/_index.md` — projects context
+
+## Task
+
+### 1. Create Todoist tasks
+
+For each entry with `classification: "task"`:
+
+```bash
+mcp-cli call todoist add-tasks '{"tasks": [{"content": "...", "dueString": "...", "priority": N}]}'
+```
+
+Record created task IDs.
+
+### 2. Check process goals
+
+```bash
+mcp-cli call todoist find-tasks '{"labels": ["process-goal"]}'
+```
+
+If missing or stale → create from goals.
+
+### 3. Save thoughts
+
+For each entry with classification idea/reflection/learning/project:
+- Create file in `thoughts/{category}/YYYY-MM-DD-slug.md`
+- Include frontmatter with description field (retrieval filter, ~150 chars)
+- Add wiki-links to related entities
+- Add typed relationships in Related section:
+ ```markdown
+ ## Related
+ - [[business/crm/acme-corp|Acme Corp]] — context: discussed during project review
+ ```
+
+### 4. Update CRM
+
+For entries with `classification: "crm_update"`:
+- Update relevant `business/crm/*.md` or `projects/clients/*.md`
+- Update deal_status, status, or add notes
+
+### 5. Build links
+
+For all created/updated files:
+- Search for related notes in vault
+- Add wiki-links with context phrases
+- Update frontmatter `related:[]`
+
+### 6. Check workload
+
+```bash
+mcp-cli call todoist find-tasks-by-date '{"startDate": "today", "daysCount": 7}'
+```
+
+## mcp-cli retry algorithm
+
+```
+1. Call mcp-cli
+2. Error? Wait 10 sec, read vault files
+3. Call again
+4. Error? Wait 20 sec
+5. Call third time — GUARANTEED to work
+```
+
+NEVER say "MCP unavailable". Always retry 3x.
+
+## Output Format
+
+Print ONLY valid JSON:
+
+```json
+{
+ "tasks_created": [
+ {"id": "8501234567", "content": "Follow-up Acme Corp", "priority": 2, "due": "tomorrow"}
+ ],
+ "thoughts_saved": [
+ {"path": "thoughts/ideas/2026-02-19-layered-memory.md", "title": "AI agents need layered memory", "category": "ideas"}
+ ],
+ "crm_updated": [
+ {"path": "business/crm/acme-corp.md", "change": "Added meeting note"}
+ ],
+ "links_created": [
+ {"from": "thoughts/ideas/2026-02-19-layered-memory.md", "to": "business/crm/acme-corp.md", "context": "discussed during project review"}
+ ],
+ "process_goals": {
+ "active": 5,
+ "overdue": 1,
+ "created": 0
+ },
+ "workload": {
+ "mon": 3, "tue": 2, "wed": 4, "thu": 1, "fri": 2, "sat": 0, "sun": 0
+ },
+ "observations": []
+}
+```
diff --git a/vault/.claude/skills/dbrain-processor/phases/reflect.md b/vault/.claude/skills/dbrain-processor/phases/reflect.md
new file mode 100644
index 0000000..ae11e42
--- /dev/null
+++ b/vault/.claude/skills/dbrain-processor/phases/reflect.md
@@ -0,0 +1,94 @@
+# Phase 3: REFLECT
+
+Read execute results. Generate HTML report. Update MEMORY. Write observations. Log to daily.
+
+## Input
+- `.session/capture.json` — from Phase 1
+- `.session/execute.json` — from Phase 2
+- `MEMORY.md` — long-term memory
+- `.session/handoff.md` — session context
+- `.graph/health-history.json` — vault health trend
+
+## Task
+
+### 1. Generate HTML report
+
+Use the template from SKILL.md. Include:
+
+- ONE Big Thing (from capture.json)
+- Thoughts saved (from execute.json)
+- Tasks created (with IDs)
+- Process goals status
+- Workload by day
+- Vault Health score (from latest health-history.json entry)
+- Top 3 priorities
+- Observations (if any)
+
+### 2. Log actions to daily
+
+Append to `daily/{DATE}.md`:
+
+```markdown
+## HH:MM [text]
+d-brain processing
+
+**Tasks created:** N
+- "Task content" (id: XXXX, priority, due)
+
+**Thoughts saved:** M
+- [[path/to/thought|Title]] — category
+
+**CRM updated:** K
+- [[business/crm/client]] — change description
+```
+
+### 3. Evolve MEMORY.md
+
+Check if any information from today deserves long-term memory:
+- New key decisions
+- Pipeline changes (new lead, closed deal, status change)
+- Financial changes
+- Active Context updates
+
+Rules:
+- New info REPLACES outdated (don't append duplicates)
+- Only write significant changes
+
+### 4. Capture observations
+
+If problems occurred during processing, append to `.session/handoff.md` under `## Observations`:
+
+```markdown
+- [friction] 2026-02-19: mcp-cli timeout on todoist — retried 3x
+- [pattern] 2026-02-19: daily had only 2 entries — low activity day
+```
+
+### 5. Update handoff.md
+
+Update session context:
+- Last Session: what was processed
+- Key Decisions: if any
+- In Progress: incomplete items
+- Next Steps: what to do next
+
+## Output Format
+
+Return RAW HTML report (no markdown, no code blocks). Goes directly to Telegram.
+
+Follow the HTML template exactly:
+- Only use: `<b>`, `<i>`, `<code>`, `<s>`, `<u>`, `<a>`
+- NO: `<div>`, `<br>`, `<table>`, markdown syntax
+- Max 4096 characters
+
+### Vault Health section (add to report):
+
+```html
+<b>📊 Vault Health:</b> {score}/100
+Orphans: {N} | Broken: {M} | Avg links: {X} | Desc: {Y}%
+```
+
+## CRITICAL
+
+- Output is RAW HTML only
+- No markdown syntax anywhere
+- All HTML tags must be properly closed