| name | focusnote-add-to-daily-note |
| description | Add text to today's daily note in FocusNote as a new bullet point |
FocusNote: Add to Daily Note
This skill adds user-provided text to today's daily note in FocusNote as a new bullet point.
How It Works
- Reads the FocusNote documents path from
~/.lucia/documents-path.txt
- Generates today's date in
YYYY-MM-DD format
- Locates or creates today's daily note
- Adds the user's text as a new bullet point
- Updates the document's JSON structure files
Prerequisites
- FocusNote app must be running (it creates
~/.lucia/documents-path.txt on startup)
- Node.js installed for running the helper script
Implementation
When the user asks to add text to their daily note, follow these steps:
Step 1: Read Documents Path
const fs = require("fs");
const path = require("path");
const os = require("os");
const focusnoteConfigPath = path.join(
os.homedir(),
".lucia",
"documents-path.txt",
);
const documentsPath = fs.readFileSync(focusnoteConfigPath, "utf-8").trim();
Step 2: Generate Today's Date
const today = new Date();
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, "0");
const day = String(today.getDate()).padStart(2, "0");
const todayDocName = `${year}-${month}-${day}`;
Step 3: Locate Daily Note Folder
const dailyNotePath = path.join(documentsPath, "notes", todayDocName);
const structurePath = path.join(dailyNotePath, "_structure.json");
const metadataPath = path.join(dailyNotePath, "_metadata.json");
const nodesDir = path.join(dailyNotePath, ".nodes");
Step 4: Create Daily Note If It Doesn't Exist
if (!fs.existsSync(dailyNotePath)) {
fs.mkdirSync(dailyNotePath, { recursive: true });
fs.mkdirSync(nodesDir, { recursive: true });
const metadata = {
name: todayDocName,
createdAt: Date.now(),
updatedAt: Date.now(),
};
fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2));
const structure = {
rootNodeIds: [],
deletedNodeIds: [],
nodes: {},
};
fs.writeFileSync(structurePath, JSON.stringify(structure, null, 2));
}
Step 5: Create New Bullet Node
const { v4: uuidv4 } = require("uuid");
const nodeId = uuidv4();
const timestamp = Date.now();
const lexicalContent = {
root: {
children: [
{
children: [
{
children: [
{
detail: 0,
format: 0,
mode: "normal",
style: "",
text: userText,
type: "text",
version: 1,
},
],
direction: "ltr",
format: "",
indent: 0,
type: "listitem",
version: 1,
value: 1,
},
],
direction: "ltr",
format: "",
indent: 0,
type: ,
: ,
: ,
: ,
: ,
},
],
: ,
: ,
: ,
: ,
: ,
},
};
newNode = {
: nodeId,
: .(lexicalContent),
: ,
: ,
: ,
: ,
: ,
: ,
: timestamp,
: timestamp,
};
Step 6: Save Node to Sharded Directory
const shard = nodeId.substring(0, 2);
const shardDir = path.join(nodesDir, shard);
if (!fs.existsSync(shardDir)) {
fs.mkdirSync(shardDir, { recursive: true });
}
const nodeFilePath = path.join(shardDir, `node-${nodeId}.json`);
fs.writeFileSync(nodeFilePath, JSON.stringify(newNode, null, 2));
Step 7: Update Structure File
const structure = JSON.parse(fs.readFileSync(structurePath, "utf-8"));
structure.rootNodeIds.push(nodeId);
structure.nodes[nodeId] = {
parentId: null,
orderIndex: structure.rootNodeIds.length - 1,
childIds: [],
};
structure.updatedAt = timestamp;
fs.writeFileSync(structurePath, JSON.stringify(structure, null, 2));
Complete Script Example
Here's a complete Node.js script you can use:
#!/usr/bin/env node
const fs = require("fs");
const path = require("path");
const os = require("os");
const { v4: uuidv4 } = require("uuid");
function addToDailyNote(userText) {
try {
const focusnoteConfigPath = path.join(
os.homedir(),
".lucia",
"documents-path.txt",
);
if (!fs.existsSync(focusnoteConfigPath)) {
throw new Error(
"FocusNote config file not found. Make sure FocusNote is running.",
);
}
const documentsPath = fs.readFileSync(focusnoteConfigPath, "utf-8").trim();
const today = new Date();
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, "0");
const day = String(today.()).(, );
todayDocName = ;
dailyNotePath = path.(documentsPath, , todayDocName);
structurePath = path.(dailyNotePath, );
metadataPath = path.(dailyNotePath, );
nodesDir = path.(dailyNotePath, );
(!fs.(dailyNotePath)) {
fs.(dailyNotePath, { : });
fs.(nodesDir, { : });
metadata = {
: todayDocName,
: .(),
: .(),
};
fs.(metadataPath, .(metadata, , ));
structure = {
: [],
: [],
: {},
};
fs.(structurePath, .(structure, , ));
}
nodeId = ();
timestamp = .();
lexicalContent = {
: {
: [
{
: [
{
: [
{
: ,
: ,
: ,
: ,
: userText,
: ,
: ,
},
],
: ,
: ,
: ,
: ,
: ,
: ,
},
],
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
},
],
: ,
: ,
: ,
: ,
: ,
},
};
newNode = {
: nodeId,
: .(lexicalContent),
: ,
: ,
: ,
: ,
: ,
: ,
: timestamp,
: timestamp,
};
shard = nodeId.(, );
shardDir = path.(nodesDir, shard);
(!fs.(shardDir)) {
fs.(shardDir, { : });
}
nodeFilePath = path.(shardDir, );
fs.(nodeFilePath, .(newNode, , ));
structure = .(fs.(structurePath, ));
structure..(nodeId);
structure.[nodeId] = {
: ,
: structure.. - ,
: [],
};
structure. = timestamp;
fs.(structurePath, .(structure, , ));
.();
{ : , : todayDocName, nodeId };
} (error) {
.(, error.);
{ : , : error. };
}
}
(. === ) {
userText = process..().() || ;
(userText);
}
. = { addToDailyNote };
Usage Examples
User: "Add to my daily note: Finished the OpenClaw skill implementation"
Assistant: I'll add that to your daily note.
node add-to-daily-note.js "Finished the OpenClaw skill implementation"
Output: ✅ Added bullet to 2026-02-11: "Finished the OpenClaw skill implementation"
User: "Add a reminder to call mom tomorrow"
Assistant: I'll add that to today's note.
node add-to-daily-note.js "Reminder to call mom tomorrow"
Installation
- Save the script as
add-to-daily-note.js in your OpenClaw skills directory
- Install dependencies:
npm install uuid
- Make it executable:
chmod +x add-to-daily-note.js
Notes
- The skill creates a new bullet point each time it's called
- Bullets are added to the end of the daily note
- If the daily note doesn't exist, it will be created automatically
- The FocusNote app must be running for the documents path file to exist
- Changes are immediately visible when you open/refresh the daily note in FocusNote
Troubleshooting
Error: "FocusNote config file not found"
- Make sure FocusNote is running
- Check that
~/.lucia/documents-path.txt exists
Bullets not appearing in FocusNote
- Try closing and reopening the daily note
- Check that the node files were created in
.nodes/ directory
- Verify
_structure.json was updated correctly