skills/treylom/knowledge-manager/Storage Abstraction Layer

Storage Abstraction Layer

SKILL.md

Storage Abstraction Layer

Unified interface for saving notes across different storage backends


Storage Selection

function get_storage_backend() {
  config = Read("km-config.json")
  return config?.storage?.primary || "local"
}

πŸ›‘ MCP 도ꡬ μš°μ„  μ‚¬μš© κ·œμΉ™ (CRITICAL)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ›‘ CRITICAL: MCP 도ꡬ μ‚¬μš© κ°•μ œ                      β”‚
β”‚                                                      β”‚
β”‚ MCP 도ꡬ가 μ‚¬μš© κ°€λŠ₯ν•œ ν™˜κ²½μ—μ„œλŠ” λ°˜λ“œμ‹œ MCP μ‚¬μš©!    β”‚
β”‚                                                      β”‚
β”‚ ❌ 잘λͺ»λœ 예:                                        β”‚
β”‚    - write_to_file("vault/note.md", content)         β”‚
β”‚                                                      β”‚
β”‚ βœ… μ˜¬λ°”λ₯Έ 예:                                        β”‚
β”‚    - mcp_obsidian_create_note(path, content)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Backend Mapping (Antigravity/Gemini CLI)

Feature Obsidian Notion Local
Create mcp_obsidian_create_note mcp_notion_API-post-page write_to_file
Search mcp_obsidian_search_vault mcp_notion_API-post-search N/A
Read mcp_obsidian_read_note mcp_notion_API-get-block-children read_file
Path format Relative to vault Database/Page ID File system path
Wikilinks Supported Converted to mentions Supported

μ°Έκ³ : AntigravityλŠ” MCP 도ꡬ 이름에 μ‹±κΈ€ μ–Έλ”μŠ€μ½”μ–΄(_)λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€.

MCP 도ꡬ μ‚¬μš© κ°€μ΄λ“œ (Obsidian)

μž‘μ—… 도ꡬλͺ… μ„€λͺ…
λ…ΈνŠΈ 생성 mcp_obsidian_create_note μƒˆ λ…ΈνŠΈ 생성
λ…ΈνŠΈ 검색 mcp_obsidian_search_vault Vault λ‚΄ ν‚€μ›Œλ“œ 검색
λ…ΈνŠΈ 읽기 mcp_obsidian_read_note λ…ΈνŠΈ λ‚΄μš© 읽기
λ…ΈνŠΈ λͺ©λ‘ mcp_obsidian_list_notes 폴더 λ‚΄ λ…ΈνŠΈ λͺ©λ‘

Unified Save Function

// Antigravity/Gemini CLI용 (μ‹±κΈ€ μ–Έλ”μŠ€μ½”μ–΄ μ‚¬μš©)
function save_note(relativePath, content) {
  backend = get_storage_backend()
  config = Read("km-config.json")

  switch (backend) {
    case "obsidian":
      // ⚠️ λ°˜λ“œμ‹œ MCP 도ꡬ μ‚¬μš©!
      return mcp_obsidian_create_note({
        path: relativePath,
        content: content
      })

    case "notion":
      return mcp_notion_API_post_page({
        parent: { page_id: config.storage.notion.parentPageId },
        properties: { title: [{ text: { content: getTitle(relativePath) } }] }
      })

    case "local":
    default:
      fullPath = `${config.storage.local.outputPath}/${relativePath}`
      return write_to_file(fullPath, content)
  }
}

Path Normalization

function normalize_path(path) {
  // Windows backslash β†’ forward slash
  path = path.replace(/\\/g, '/')

  // Remove leading slash for relative paths
  path = path.replace(/^\//, '')

  return path
}

Verification (CRITICAL)

After every save operation:

β–‘ Did the tool actually execute? (no JSON-only output!)
β–‘ Did we receive a success response?
β–‘ Verify with Glob that file exists
Weekly Installs
0
GitHub Stars
42
First Seen
Jan 1, 1970