diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..2858609 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,14 @@ +{ + "permissions": { + "allow": [ + "Bash(bash:*)", + "Bash(cat /c/dev/obsidian-claw/.superpowers/brainstorm/*/state/server-info)", + "Bash(ls -d /c/dev/obsidian-claw/KnowledgeVault/Default/*/)", + "Bash(git init:*)", + "Bash(git add:*)", + "Bash(git commit -m ':*)", + "WebFetch(domain:www.ollama.com)", + "mcp__web-reader__webReader" + ] + } +} diff --git a/.superpowers/brainstorm/27-1775849590/content/architecture-overview.html b/.superpowers/brainstorm/27-1775849590/content/architecture-overview.html new file mode 100644 index 0000000..f1830b2 --- /dev/null +++ b/.superpowers/brainstorm/27-1775849590/content/architecture-overview.html @@ -0,0 +1,103 @@ +
Layered Protocol Model — Obsidian RAG Plugin for OpenClaw
+ +LanceDB Schema, Indexer Bridge, Chunking & Embedding Pipeline
+ +┌──────────────────┬──────────────┬─────────────────────────────────────┐ +│ Column │ Type │ Description │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ vector │ FixedList │ 1024-dim float32 embedding │ +│ │ float32[1024]│ (mxbai-embed-large via Ollama) │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ chunk_id │ string │ UUID v4, primary key │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ chunk_text │ string │ Raw markdown text of the chunk │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ source_file │ string │ Relative path from vault root │ +│ │ │ e.g. "Journal/2024-01-15.md" │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ source_directory │ string │ Top-level directory name │ +│ │ │ e.g. "Journal", "Entertainment" │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ section │ string|null │ Section heading (structured notes) │ +│ │ │ e.g. "#mentalhealth", "#finance" │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ date │ string|null │ ISO 8601 date parsed from filename │ +│ │ │ e.g. "2024-01-15" │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ tags │ list<string> │ All hashtags in chunk │ +│ │ │ e.g. ["#mentalhealth", "#therapy"] │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ chunk_index │ int32 │ Position within source document │ +│ │ │ 0-indexed │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ total_chunks │ int32 │ Total chunks for this source file │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ modified_at │ string │ File mtime, ISO 8601 │ +│ │ │ Used for incremental sync │ +├──────────────────┼──────────────┼─────────────────────────────────────┤ +│ indexed_at │ string │ When this chunk was indexed │ +│ │ │ ISO 8601 timestamp │ +└──────────────────┴──────────────┴─────────────────────────────────────┘+
Path Traversal Prevention, Input Sanitization, Sensitive Content Guards & Local-Only Enforcement
+ +path.resolve(vault_path, input) must start with vault_pathsensitive_detected=true in response"local_only": true enforcedVault Watcher, Auto-Sync Scheduling & Plugin Health State Machine
+ +obsidian-rag sync~/.obsidian-rag/sync-result.jsonstatus: "degraded"Python Tests, TypeScript Tests, Integration Tests & Security Test Suites
+ +| Component | +Unit Test | +Integration Test | +
|---|---|---|
| Ollama embedding | +Mocked — fixed 1024-dim vectors | +Real — requires Ollama running | +
| LanceDB | +Real — temp directory, cleaned up | +Real — temp directory, cleaned up | +
| Obsidian vault | +Mocked — fixture markdown files | +Real — temp vault with real files | +
| Python CLI | +Mocked subprocess | +Real — actual CLI invocation | +
| Chokidar watcher | +Mocked events | +Real — actual file system events | +
| OpenClaw agent | +N/A | +Real — tool call envelope validation | +
Four Plugin Tools, Their Contracts & the OpenClaw Interaction Protocol
+ +| User Intent Pattern | +Tool | +Agent Behavior | +
|---|---|---|
| "What did I write about X?" "How was my Y in Z?" |
+ search | +Query vault, synthesize answer from chunks | +
| "Index my vault" "Update the search index" |
+ index | +Choose mode (sync default, full on no index), poll status | +
| "Is the index up to date?" "How many docs are indexed?" |
+ status | +Report health, suggest index if stale | +
| "Remember this" Auto-suggest after search |
+ memory_store | +Confirm with user, store key+value+source | +
Tool Registration, Request/Response Contracts & Error Normalization
+ +{
+ "status": "healthy" | "degraded" | "unavailable",
+ "data": T | null,
+ "error": {
+ "code": string, // e.g. "OLLAMA_UNREACHABLE"
+ "message": string, // human-readable
+ "recoverable": bool, // can the agent retry?
+ "suggestion": string // e.g. "Run obsidian-rag index first"
+ } | null,
+ "meta": {
+ "query_time_ms": number,
+ "chunks_scanned": number,
+ "index_version": string,
+ "vault_mtime": string // ISO 8601
+ }
+}
+ | Failure | +Status | +Code | +Recoverable | +
|---|---|---|---|
| Ollama down | +degraded | +OLLAMA_UNREACHABLE | +yes — retry after start | +
| Empty vault / no index | +unavailable | +INDEX_NOT_FOUND | +yes — run index first | +
| LanceDB corrupted | +unavailable | +INDEX_CORRUPTED | +yes — run reindex | +
| Path traversal attempt | +unavailable | +SECURITY_VIOLATION | +no | +
| Sensitive content blocked | +degraded | +SENSITIVE_FILTERED | +yes — with confirmation | +
| Indexer CLI crash | +unavailable | +INDEXER_FAILED | +yes — retry once | +