clawlet 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawlet",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "A lightweight AI based personal assistant.",
5
5
  "main": "src/cli.ts",
6
6
  "type": "module",
package/src/tools.ts CHANGED
@@ -485,6 +485,27 @@ export function createTools(memory: AgentMemory, model: LanguageModel) {
485
485
  }
486
486
  }),
487
487
 
488
+ 'fs.appendFile': tool({
489
+ description: 'Apped specific string to a file (will create it if it does not exist yet). Use this for appending something to daily memory files and the likes.',
490
+ inputSchema: jsonSchema<{ path: string, find: string, replace: string }>({
491
+ type: 'object',
492
+ properties: {
493
+ path: { type: 'string', description: 'Path/key of the file to edit' },
494
+ content: { type: 'string', description: 'The new text to append to the file.' },
495
+ },
496
+ required: ['path', 'content'],
497
+ }),
498
+ execute: async ({ path, find, replace }) => {
499
+ logger.debug({ path }, 'FS appendFile');
500
+ try {
501
+ const content = await memory.workspace.getItem(path);
502
+ const fileText = String(content || '');
503
+ await memory.workspace.setItem(path, (fileText != '' ? (fileText + "\n") : '') + content);
504
+ return `Success: Appended "${path}".`;
505
+ } catch (e: any) { return "Error appending file: " + e.message; }
506
+ }
507
+ }),
508
+
488
509
  'fs.delete': tool({
489
510
  description: 'Delete a file. If the file is outside .trash/, it is moved to .trash/ (soft delete). If the file is already inside .trash/, it is permanently removed.',
490
511
  inputSchema: jsonSchema<{ path: string }>({
@@ -937,6 +958,20 @@ Return ONLY a JSON object mapping tool names to arrays of permission rules. Exam
937
958
  }
938
959
  ];
939
960
 
961
+ skillPermissions['fs.appendFile'] = skillPermissions['fs.appendFile'] || [
962
+ {
963
+ path: "memory/*",
964
+ allowed: "1"
965
+ }
966
+ ];
967
+
968
+ skillPermissions['fs.editFile'] = skillPermissions['fs.editFile'] || [
969
+ {
970
+ path: "memory/*",
971
+ allowed: "1"
972
+ }
973
+ ];
974
+
940
975
  skillPermissions['fs.readFile'] = skillPermissions['fs.readFile'] || [
941
976
  {
942
977
  path: "memory/*",
@@ -36,7 +36,7 @@ You wake up fresh each session. Files are your only continuity.
36
36
 
37
37
  ### 📝 Write It Down or It Didn't Happen
38
38
  **Memory is limited.** "Mental notes" die when the session ends.
39
- - **Action:** When you learn something, **immediately** write it to `memory/YYYY-MM-DD.md` or `MEMORY.md` using `fs.writeFile`.
39
+ - **Action:** When you learn something, **immediately** write it to `memory/YYYY-MM-DD.md` by using `fs.appendFile` or `MEMORY.md` using `fs.writeFile` or `fs.editFile`.
40
40
  - **Method:** You cannot "remember" things between sessions unless they are saved to a file.
41
41
 
42
42
  ### 🚨 Error Transparency Protocol
@@ -105,13 +105,13 @@ Use `skills.install <name> "<url>"` to add new capabilities.
105
105
 
106
106
  **1. File Writing Protocol:**
107
107
  You must use `fs.writeFile` to persist **ALL** critical updates.
108
- - Updating user preferences? -> `fs.writeFile` to `USER.md`.
109
- - Logging an event? -> `fs.writeFile` to `memory/YYYY-MM-DD.md`.
108
+ - Updating user preferences? -> `fs.writeFile` or `fs.editFile` to `USER.md`.
109
+ - Logging an event? -> `fs.appendFile` or `fs.editFile` to `memory/YYYY-MM-DD.md`.
110
110
  - **Never** assume stating "I have updated the memory" is enough. You must execute the write.
111
111
 
112
112
  **2. Message History Persistence:**
113
113
  - Message history is **not** stored in RAM.
114
- - Any decision or context you need for the future must be written to a file using `fs.writeFile`.
114
+ - Any decision or context you need for the future must be written to a file using `fs.writeFile` or `fs.editFile`.
115
115
  - **Violation Consequence:** If you fail to write to a file, you will forget that information immediately upon session restart.
116
116
 
117
117
  ## 🔐 Security
@@ -119,4 +119,4 @@ You must use `fs.writeFile` to persist **ALL** critical updates.
119
119
  - **Secrets:** Never print API keys in plain text logs.
120
120
 
121
121
  ## Make It Yours
122
- Refine this `AGENTS.md` as you learn. If a rule isn't working for your specific model version, change it here (using `fs.editFile` or read only part of the file to avoid exceeding token limits).
122
+ Refine this `AGENTS.md` as you learn. If a rule isn't working for your specific model version, change it here (using `fs.editFile` or add a section using `fs.appendFile` or read only part of the file to avoid exceeding token limits).