log
Create or update today's daily log file with notes and tags to organize personal knowledge and build connections between entries.
Instructions
Create or update today's daily log file. Optionally add notes to the log.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | Yes | ||
| tags | Yes | Tags must follow these rules: - Can contain letters, numbers, underscore (_), hyphen (-), and forward slash (/) - Must contain at least one non-numerical character - Cannot contain spaces (use camelCase, PascalCase, snake_case, or kebab-case) - Are case-insensitive (stored as lowercase) Analyze the note's content and identify key themes, concepts, and categories that connect it to other notes. Consider: - Core topics and themes present in the note - Broader domains or areas of knowledge - Types of information (decisions, ideas, research, etc.) - Projects or contexts that might want to reference this later Do not force tags - only add ones that naturally emerge from the content and would help build meaningful connections between notes. |
Implementation Reference
- src/tools/index.ts:92-117 (registration)Registration of the 'log' tool, defining its name, description, and input schema.{ name: "log", description: "Create or update today's daily log file. Optionally add notes to the log.", inputSchema: { type: "object", properties: { notes: { type: "string" }, tags: { type: "array", items: { type: "string" }, description: `${TAG_VALIDATION_DESCRIPTION} Analyze the note's content and identify key themes, concepts, and categories that connect it to other notes. Consider: - Core topics and themes present in the note - Broader domains or areas of knowledge - Types of information (decisions, ideas, research, etc.) - Projects or contexts that might want to reference this later Do not force tags - only add ones that naturally emerge from the content and would help build meaningful connections between notes.` } }, required: ["notes", "tags"] } },
- src/tools/index.ts:226-271 (handler)The handler function for the 'log' tool within handleToolCall, which processes arguments, creates LogNote instance, adds tags, appends entry, and returns result.case "log": { try { const logArgs = args as LogArgs; // Create LogNote without tags first const logNote = new LogNote(notesPath); await logNote.load(); try { // Add tags separately to handle validation errors if (logArgs.tags && logArgs.tags.length > 0) { logNote.addTags(logArgs.tags); } const result = await logNote.appendEntry(logArgs.notes); if (!result.success) { return { content: [{ type: "text", text: `Error creating log: ${result.error}` }], isError: true, }; } return { content: [{ type: "text", text: `I've added your note to today's log at ${result.path}.` }], }; } catch (tagError) { // Specific handling for tag validation errors const errorMessage = tagError instanceof Error ? tagError.message : String(tagError); return { content: [{ type: "text", text: errorMessage }], isError: true, }; } } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error in log command: ${errorMessage}` }], isError: true, }; } }
- src/notes/LogNote.ts:47-67 (helper)Core helper method in LogNote class that appends a new entry to the daily log file, handling loading, templating, and saving.async appendEntry(entry: string) { // Load existing content if available if (!this.exists) { await this.load(); // If still no content, load template if (!this.template) { await this.loadTemplate(); } if (!this.content && this.template) { this.content = this.template; } } // Add the entry this.addEntry(entry); // Save the updated note return await this.save(); }
- src/notes/LogNote.ts:10-32 (helper)LogNote class constructor that sets up the daily log file path and initial template.export class LogNote extends Note { template: string; constructor(notesBasePath: string, options: LogNoteOptions = {}) { const date = options.date || new Date(); const dateInfo = { dayOfWeek: format(date, 'EEEE'), fullDate: format(date, 'MMMM d, yyyy'), isoDate: format(date, 'yyyy-MM-dd'), time: format(date, 'h:mm a') }; // Log notes always go in the Log directory with date-based filename const relativePath = path.join('Log', `${dateInfo.isoDate}.md`); super(notesBasePath, relativePath, { ...options, date }); this.template = `# ${this.dateInfo.dayOfWeek}, ${this.dateInfo.fullDate}\n\n`; }