diff --git a/SKILL.md b/SKILL.md index 0052556..6dffca4 100644 --- a/SKILL.md +++ b/SKILL.md @@ -6,6 +6,7 @@ description: Local-first personal knowledge base for tracking ideas, projects, t # Notebook Skill Object Based Personal Knowledge Base Purpose: Track any object type you define such as ideas, projects, tasks, habits, books, and people. + Location: {WORKSPACE}/skills/notebook/ ## Agent Onboarding Protocol diff --git a/data/index.json b/data/index.json deleted file mode 100644 index bfc1fe8..0000000 --- a/data/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "entries": [], - "archive": [], - "byTag": {}, - "objects": [] -} \ No newline at end of file diff --git a/data/types.yaml b/data/types.yaml deleted file mode 100644 index 77d540f..0000000 --- a/data/types.yaml +++ /dev/null @@ -1 +0,0 @@ -types: [] diff --git a/lib/store.js b/lib/store.js index 1dfd4d1..e3365d1 100644 --- a/lib/store.js +++ b/lib/store.js @@ -3,12 +3,24 @@ import path from 'path'; import { fileURLToPath } from 'url'; import yaml from 'js-yaml'; -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const DATA_DIR = path.join(__dirname, '..', 'data'); +// Always resolve skill folder from import.meta.url, not __dirname (which varies by CWD) +const SKILL_FOLDER = path.dirname(path.dirname(fileURLToPath(import.meta.url))); +// CLAWD_WORKSPACE env var takes precedence, otherwise walk up from skills folder +// The workspace is typically the parent of the 'skills' directory +const SKILLS_FOLDER = path.dirname(SKILL_FOLDER); +const WORKSPACE_DIR = process.env.CLAWD_WORKSPACE || path.dirname(SKILLS_FOLDER); +const DATA_DIR = path.join(WORKSPACE_DIR, 'notebook'); const OBJECTS_DIR = path.join(DATA_DIR, 'objects'); const TYPES_FILE = path.join(DATA_DIR, 'types.yaml'); const INDEX_FILE = path.join(DATA_DIR, 'index.json'); +// Debug logging +// console.error('DEBUG: SKILL_FOLDER =', SKILL_FOLDER); +// console.error('DEBUG: SKILLS_FOLDER =', SKILLS_FOLDER); +// console.error('DEBUG: WORKSPACE_DIR =', WORKSPACE_DIR); +// console.error('DEBUG: DATA_DIR =', DATA_DIR); +// console.error('DEBUG: TYPES_FILE =', TYPES_FILE); + // Ensure directories exist function init() { if (!fs.existsSync(DATA_DIR)) fs.mkdirSync(DATA_DIR, { recursive: true });